All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@kernel.org>
To: Jijie Shao <shaojijie@huawei.com>
Cc: davem@davemloft.net, edumazet@google.com, kuba@kernel.org,
	pabeni@redhat.com, shenjian15@huawei.com,
	wangpeiyang1@huawei.com, liuyonglong@huawei.com,
	chenhao418@huawei.com, sudongming1@huawei.com,
	xujunsheng@huawei.com, shiyongbang@huawei.com,
	libaihan@huawei.com, andrew@lunn.ch, jdamato@fastly.com,
	kalesh-anakkur.purayil@broadcom.com,
	christophe.jaillet@wanadoo.fr, jonathan.cameron@huawei.com,
	shameerali.kolothum.thodi@huawei.com, salil.mehta@huawei.com,
	netdev@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH V11 net-next 04/10] net: hibmcge: Add interrupt supported in this module
Date: Thu, 10 Oct 2024 11:22:01 +0100	[thread overview]
Message-ID: <20241010102201.GG1098236@kernel.org> (raw)
In-Reply-To: <20241008022358.863393-5-shaojijie@huawei.com>

On Tue, Oct 08, 2024 at 10:23:52AM +0800, Jijie Shao wrote:
> The driver supports four interrupts: TX interrupt, RX interrupt,
> mdio interrupt, and error interrupt.
> 
> Actually, the driver does not use the mdio interrupt.
> Therefore, the driver does not request the mdio interrupt.
> 
> The error interrupt distinguishes different error information
> by using different masks. To distinguish different errors,
> the statistics count is added for each error.
> 
> To ensure the consistency of the code process, masks are added for the
> TX interrupt and RX interrupt.
> 
> This patch implements interrupt request, and provides a
> unified entry for the interrupt handler function. However,
> the specific interrupt handler function of each interrupt
> is not implemented currently.
> 
> Because of pcim_enable_device(), the interrupt vector
> is already device managed and does not need to be free actively.
> 
> Signed-off-by: Jijie Shao <shaojijie@huawei.com>

...

> diff --git a/drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c b/drivers/net/ethernet/hisilicon/hibmcge/hbg_irq.c

...

> +static const char *irq_names_map[HBG_VECTOR_NUM] = { "tx", "rx", "err", "mdio" };
> +
> +int hbg_irq_init(struct hbg_priv *priv)
> +{
> +	struct hbg_vector *vectors = &priv->vectors;
> +	struct device *dev = &priv->pdev->dev;
> +	int ret, id;
> +	u32 i;
> +
> +	/* used pcim_enable_device(),  so the vectors become device managed */
> +	ret = pci_alloc_irq_vectors(priv->pdev, HBG_VECTOR_NUM, HBG_VECTOR_NUM,
> +				    PCI_IRQ_MSI | PCI_IRQ_MSIX);
> +	if (ret < 0)
> +		return dev_err_probe(dev, ret, "failed to allocate MSI vectors\n");
> +
> +	if (ret != HBG_VECTOR_NUM)
> +		return dev_err_probe(dev, -EINVAL,
> +				     "requested %u MSI, but allocated %d MSI\n",
> +				     HBG_VECTOR_NUM, ret);
> +
> +	/* mdio irq not requested, so the number of requested interrupts
> +	 * is HBG_VECTOR_NUM - 1.
> +	 */
> +	for (i = 0; i < HBG_VECTOR_NUM - 1; i++) {
> +		id = pci_irq_vector(priv->pdev, i);
> +		if (id < 0)
> +			return dev_err_probe(dev, id, "failed to get irq number\n");
> +
> +		snprintf(vectors->name[i], sizeof(vectors->name[i]), "%s-%s-%s",
> +			 dev_driver_string(dev), pci_name(priv->pdev),
> +			 irq_names_map[i]);
> +
> +		ret = devm_request_irq(dev, id, hbg_irq_handle, 0,
> +				       vectors->name[i], priv);
> +		if (ret)
> +			return dev_err_probe(dev, ret,
> +					     "failed to requset irq: %s\n",

nit: request

> +					     irq_names_map[i]);
> +	}
> +
> +	vectors->info_array = hbg_irqs;
> +	vectors->info_array_len = ARRAY_SIZE(hbg_irqs);
> +	return 0;
> +}

...

  reply	other threads:[~2024-10-10 10:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-08  2:23 [PATCH V11 net-next 00/10] Add support of HIBMCGE Ethernet Driver Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 01/10] net: hibmcge: Add pci table supported in this module Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 02/10] net: hibmcge: Add read/write registers supported through the bar space Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 03/10] net: hibmcge: Add mdio and hardware configuration supported in this module Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 04/10] net: hibmcge: Add interrupt " Jijie Shao
2024-10-10 10:22   ` Simon Horman [this message]
2024-10-10 14:24     ` Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 05/10] net: hibmcge: Implement some .ndo functions Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 06/10] net: hibmcge: Implement .ndo_start_xmit function Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 07/10] net: hibmcge: Implement rx_poll function to receive packets Jijie Shao
2024-10-09 21:35   ` Joe Damato
2024-10-09 21:42     ` Joe Damato
2024-10-10  1:04       ` Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 08/10] net: hibmcge: Implement some ethtool_ops functions Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 09/10] net: hibmcge: Add a Makefile and update Kconfig for hibmcge Jijie Shao
2024-10-08  2:23 ` [PATCH V11 net-next 10/10] net: hibmcge: Add maintainer " Jijie Shao
2024-10-10  2:37   ` Jakub Kicinski
2024-10-10 14:26     ` Jijie Shao
2024-10-10  2:36 ` [PATCH V11 net-next 00/10] Add support of HIBMCGE Ethernet Driver Jakub Kicinski
2024-10-10 14:25   ` Jijie Shao

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20241010102201.GG1098236@kernel.org \
    --to=horms@kernel.org \
    --cc=andrew@lunn.ch \
    --cc=chenhao418@huawei.com \
    --cc=christophe.jaillet@wanadoo.fr \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=jdamato@fastly.com \
    --cc=jonathan.cameron@huawei.com \
    --cc=kalesh-anakkur.purayil@broadcom.com \
    --cc=kuba@kernel.org \
    --cc=libaihan@huawei.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=liuyonglong@huawei.com \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=salil.mehta@huawei.com \
    --cc=shameerali.kolothum.thodi@huawei.com \
    --cc=shaojijie@huawei.com \
    --cc=shenjian15@huawei.com \
    --cc=shiyongbang@huawei.com \
    --cc=sudongming1@huawei.com \
    --cc=wangpeiyang1@huawei.com \
    --cc=xujunsheng@huawei.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.