From: Simon Horman <horms@kernel.org>
To: Dong Yibo <dong100@mucse.com>
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, corbet@lwn.net,
gur.stavi@huawei.com, maddy@linux.ibm.com, mpe@ellerman.id.au,
danishanwar@ti.com, lee@trager.us, gongfan1@huawei.com,
lorenzo@kernel.org, geert+renesas@glider.be,
Parthiban.Veerasooran@microchip.com, lukas.bulwahn@redhat.com,
alexanderduyck@fb.com, richardcochran@gmail.com,
netdev@vger.kernel.org, linux-doc@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2 10/15] net: rnpgbe: Add netdev irq in open
Date: Tue, 22 Jul 2025 15:03:26 +0100 [thread overview]
Message-ID: <20250722140326.GJ2459@horms.kernel.org> (raw)
In-Reply-To: <20250721113238.18615-11-dong100@mucse.com>
On Mon, Jul 21, 2025 at 07:32:33PM +0800, Dong Yibo wrote:
> Initialize irq for tx/rx in open func.
>
> Signed-off-by: Dong Yibo <dong100@mucse.com>
...
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_chip.c
...
> +/**
> + * rnpgbe_set_mac_hw_ops_n500 - Setup mac address to hw
> + * @hw: pointer to hw structure
> + * @mac: pointer to mac addr
> + *
> + * Setup a mac address to hw.
> + **/
> +static void rnpgbe_set_mac_hw_ops_n500(struct mucse_hw *hw, u8 *mac)
> +{
> + struct mucse_eth_info *eth = &hw->eth;
> + struct mucse_mac_info *mac_info = &hw->mac;
Reverse xmas tree here please.
> +
> + /* use idx 0 */
> + eth->ops.set_rar(eth, 0, mac);
> + mac_info->ops.set_mac(mac_info, mac, 0);
> +}
...
> diff --git a/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c b/drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c
...
> +/**
> + * rnpgbe_msix_clean_rings - msix irq handler for ring irq
> + * @irq: irq num
> + * @data: private data
> + *
> + * rnpgbe_msix_clean_rings handle irq from ring, start napi
Please also document the return value of this function.
Likewise for rnpgbe_request_msix_irqs(), rnpgbe_intr() and
rnpgbe_request_irq().
> + **/
> +static irqreturn_t rnpgbe_msix_clean_rings(int irq, void *data)
> +{
> + return IRQ_HANDLED;
> +}
...
> +/**
> + * rnpgbe_request_msix_irqs - Initialize MSI-X interrupts
> + * @mucse: pointer to private structure
> + *
> + * rnpgbe_request_msix_irqs allocates MSI-X vectors and requests
> + * interrupts from the kernel.
> + **/
> +static int rnpgbe_request_msix_irqs(struct mucse *mucse)
> +{
> + struct net_device *netdev = mucse->netdev;
> + int q_off = mucse->q_vector_off;
> + struct msix_entry *entry;
> + int i = 0;
> + int err;
> +
> + for (i = 0; i < mucse->num_q_vectors; i++) {
> + struct mucse_q_vector *q_vector = mucse->q_vector[i];
> +
> + entry = &mucse->msix_entries[i + q_off];
> + if (q_vector->tx.ring && q_vector->rx.ring) {
> + snprintf(q_vector->name, sizeof(q_vector->name) - 1,
> + "%s-%s-%d", netdev->name, "TxRx", i);
Probably the full range of i is not used, in particular I assume
it is never negative, and thus i and mucse->num_q_vectors
could be unsigned int rather than int.
But as it stands q_vector->name is once character too short to
fit the maximum possible string formatted by snprintf().
I was able to address the warning flagged by GCC 15.0.0 about this by
increasing the size of q_vector->name by one byte.
.../rnpgbe_lib.c: In function 'rnpgbe_request_irq':
.../rnpgbe_lib.c:1015:43: warning: 'snprintf' output may be truncated before the last format character [-Wformat-truncation=]
1015 | "%s-%s-%d", netdev->name, "TxRx", i);
| ^
In function 'rnpgbe_request_msix_irqs',
inlined from 'rnpgbe_request_irq' at drivers/net/ethernet/mucse/rnpgbe/rnpgbe_lib.c:1069:9:
.../rnpgbe_lib.c:1014:25: note: 'snprintf' output between 8 and 33 bytes into a destination of size 32
1014 | snprintf(q_vector->name, sizeof(q_vector->name) - 1,
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1015 | "%s-%s-%d", netdev->name, "TxRx", i);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> + } else {
> + /* skip this unused q_vector */
> + continue;
> + }
> + err = request_irq(entry->vector, &rnpgbe_msix_clean_rings, 0,
> + q_vector->name, q_vector);
> + if (err)
> + goto free_queue_irqs;
> + /* register for affinity change notifications */
> + q_vector->affinity_notify.notify = rnpgbe_irq_affinity_notify;
> + q_vector->affinity_notify.release = rnpgbe_irq_affinity_release;
> + irq_set_affinity_notifier(entry->vector,
> + &q_vector->affinity_notify);
> + irq_set_affinity_hint(entry->vector, &q_vector->affinity_mask);
> + }
> +
> + return 0;
> +
> +free_queue_irqs:
> + while (i) {
> + i--;
> + entry = &mucse->msix_entries[i + q_off];
> + irq_set_affinity_hint(entry->vector, NULL);
> + free_irq(entry->vector, mucse->q_vector[i]);
> + irq_set_affinity_notifier(entry->vector, NULL);
> + irq_set_affinity_hint(entry->vector, NULL);
> + }
> + return err;
> +}
...
next prev parent reply other threads:[~2025-07-22 14:03 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-21 11:32 [PATCH v2 00/15] Add driver for 1Gbe network chips from MUCSE Dong Yibo
2025-07-21 11:32 ` [PATCH v2 01/15] net: rnpgbe: Add build support for rnpgbe Dong Yibo
2025-07-21 13:30 ` Vadim Fedorenko
2025-07-21 14:57 ` Andrew Lunn
2025-07-22 3:02 ` Yibo Dong
2025-07-22 10:17 ` Vadim Fedorenko
2025-07-22 11:05 ` Yibo Dong
2025-07-21 14:55 ` Andrew Lunn
2025-07-22 3:38 ` Yibo Dong
2025-07-22 14:58 ` Andrew Lunn
2025-07-21 21:23 ` Brett Creeley
2025-07-22 4:59 ` Yibo Dong
2025-07-22 11:29 ` Simon Horman
2025-07-23 3:01 ` Yibo Dong
2025-07-23 20:09 ` Simon Horman
2025-07-24 6:10 ` Yibo Dong
2025-07-25 9:51 ` Simon Horman
2025-07-21 11:32 ` [PATCH v2 02/15] net: rnpgbe: Add n500/n210 chip support Dong Yibo
2025-07-21 14:21 ` Vadim Fedorenko
2025-07-22 9:51 ` Yibo Dong
2025-07-22 10:26 ` Vadim Fedorenko
2025-07-22 11:09 ` Yibo Dong
2025-07-21 15:25 ` Andrew Lunn
2025-07-22 6:21 ` Yibo Dong
2025-07-22 13:56 ` Andrew Lunn
2025-07-21 11:32 ` [PATCH v2 03/15] net: rnpgbe: Add basic mbx ops support Dong Yibo
2025-07-21 14:40 ` Vadim Fedorenko
2025-07-21 15:43 ` Andrew Lunn
2025-07-22 6:45 ` Yibo Dong
2025-07-22 13:50 ` Andrew Lunn
2025-07-23 10:27 ` Yibo Dong
2025-07-21 21:54 ` Brett Creeley
2025-07-22 7:39 ` Yibo Dong
2025-07-22 11:35 ` Simon Horman
2025-07-23 3:07 ` Yibo Dong
2025-07-23 14:38 ` Andrew Lunn
2025-07-25 10:11 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 04/15] net: rnpgbe: Add get_capability mbx_fw " Dong Yibo
2025-07-21 22:08 ` Brett Creeley
2025-07-22 8:04 ` Yibo Dong
2025-07-22 13:19 ` Simon Horman
2025-07-23 3:15 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 05/15] net: rnpgbe: Add download firmware for n210 chip Dong Yibo
2025-07-21 11:32 ` [PATCH v2 06/15] net: rnpgbe: Add some functions for hw->ops Dong Yibo
2025-07-21 11:32 ` [PATCH v2 07/15] net: rnpgbe: Add get mac from hw Dong Yibo
2025-07-21 11:32 ` [PATCH v2 08/15] net: rnpgbe: Add irq support Dong Yibo
2025-07-22 13:25 ` Simon Horman
2025-07-23 3:21 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 09/15] net: rnpgbe: Add netdev register and init tx/rx memory Dong Yibo
2025-07-21 11:32 ` [PATCH v2 10/15] net: rnpgbe: Add netdev irq in open Dong Yibo
2025-07-22 14:03 ` Simon Horman [this message]
2025-07-23 6:13 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 11/15] net: rnpgbe: Add setup hw ring-vector, true up/down hw Dong Yibo
2025-07-21 11:32 ` [PATCH v2 12/15] net: rnpgbe: Add link up handler Dong Yibo
2025-07-21 15:47 ` Andrew Lunn
2025-07-22 6:48 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 13/15] net: rnpgbe: Add base tx functions Dong Yibo
2025-07-21 11:32 ` [PATCH v2 14/15] net: rnpgbe: Add base rx function Dong Yibo
2025-07-22 14:14 ` Simon Horman
2025-07-23 6:49 ` Yibo Dong
2025-07-21 11:32 ` [PATCH v2 15/15] net: rnpgbe: Add ITR for rx Dong Yibo
2025-07-22 11:20 ` [PATCH v2 00/15] Add driver for 1Gbe network chips from MUCSE MD Danish Anwar
2025-07-22 11:35 ` Yibo Dong
2025-07-22 15:07 ` Andrew Lunn
2025-07-23 10:42 ` Yibo Dong
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=20250722140326.GJ2459@horms.kernel.org \
--to=horms@kernel.org \
--cc=Parthiban.Veerasooran@microchip.com \
--cc=alexanderduyck@fb.com \
--cc=andrew+netdev@lunn.ch \
--cc=corbet@lwn.net \
--cc=danishanwar@ti.com \
--cc=davem@davemloft.net \
--cc=dong100@mucse.com \
--cc=edumazet@google.com \
--cc=geert+renesas@glider.be \
--cc=gongfan1@huawei.com \
--cc=gur.stavi@huawei.com \
--cc=kuba@kernel.org \
--cc=lee@trager.us \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lorenzo@kernel.org \
--cc=lukas.bulwahn@redhat.com \
--cc=maddy@linux.ibm.com \
--cc=mpe@ellerman.id.au \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=richardcochran@gmail.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.