All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jacob Keller <jacob.e.keller@intel.com>
To: "Behera, VIVEK" <vivek.behera@siemens.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	 Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	 Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>
Cc: "intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [Intel-wired-lan] [PATCH] igc: Fix trigger of incorrect irq in igc_xsk_wakeup function
Date: Mon, 8 Dec 2025 15:53:35 -0800	[thread overview]
Message-ID: <4c90ed4e-307c-429a-9f8c-29032cc146ee@intel.com> (raw)
In-Reply-To: <AS1PR10MB5392B7268416DB8A1624FDB88FA7A@AS1PR10MB5392.EURPRD10.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 7396 bytes --]



On 12/5/2025 4:39 AM, Behera, VIVEK wrote:
> From 4e3ebdc0af6baa83ccfc17c61c1eb61408095ffd Mon Sep 17 00:00:00 2001
> From: Vivek Behera <vivek.behera@siemens.com>
> Date: Fri, 5 Dec 2025 10:26:05 +0100
> Subject: [PATCH] igc: Fix trigger of incorrect irq in igc_xsk_wakeup function
> 
> When the i226 is configured to use only 2 combined queues using ethtool
> or in an environment with only 2 active CPU cores the 4 irq lines
> are used in a split configuration with one irq
> assigned to each of the two rx and tx queues
> (see console output below)
> 
> sudo ethtool -l enp1s0
> Channel parameters for enp1s0:
> Pre-set maximums:
> RX:                        n/a
> TX:                         n/a
> Other:                  1
> Combined:        4
> Current hardware settings:
> RX:                        n/a
> TX:                         n/a
> Other:                  1
> Combined:        2
> eddx@mvs:~$ cat /proc/interrupts | grep enp1s0
> 147:          1          0  IR-PCI-MSIX-0000:01:00.0   0-edge      enp1s0
> 148:          8          0  IR-PCI-MSIX-0000:01:00.0   1-edge      enp1s0-rx-0
> 149:          0          0  IR-PCI-MSIX-0000:01:00.0   2-edge      enp1s0-rx-1
> 150:         26          0  IR-PCI-MSIX-0000:01:00.0   3-edge      enp1s0-tx-0
> 151:          0          0  IR-PCI-MSIX-0000:01:00.0   4-edge      enp1s0-tx-1
> 
> While testing with the RTC Testbench it was noticed
> using the bpftrace that the
> igc_xsk_wakeup when triggered by xsk_sendmsg
> was triggering the incorrect irq for
> tx-0(see trace below)
> 
> TIMESTAMP: 456992309829 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456992317157 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> TIMESTAMP: 456993309408 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456993316591 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> TIMESTAMP: 456994309630 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456994316674 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> TIMESTAMP: 456995309493 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456995316593 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> 
> Due to this bug no XDP Zc send is possible in this split irq configuration.
> This patch implements the correct logic of extracting the q_vectors saved
> duirng the rx and tx ring allocation.
> Furthermore the patch includes usage of flags provided by the ndo_xsk_wakeup
> api to trigger the required irq. With this patch correct irqs are triggered
> 
> cat /proc/interrupts | grep enp1s0
> 161:          1          0          0          0 IR-PCI-MSIX-0000:01:00.0    0-edge      enp1s0
> 162:          2          0          0          0 IR-PCI-MSIX-0000:01:00.0    1-edge      enp1s0-rx-0
> 163:        359          0          0          0 IR-PCI-MSIX-0000:01:00.0    2-edge      enp1s0-rx-1
> 164:     872005          0          0          0 IR-PCI-MSIX-0000:01:00.0    3-edge      enp1s0-tx-0
> 165:         71          0          0          0 IR-PCI-MSIX-0000:01:00.0    4-edge      enp1s0-tx-1
> 
> TIMESTAMP: 149658589239205 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 10633) - queue_id: 0
> TIMESTAMP: 149658589244662 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658589293396 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658589295357 | FUNCTION: xsk_tx_completed | ENTRY: irq/164-enp1s0- (PID: 10593) - num_entries: 61
> TIMESTAMP: 149658589342151 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658589343881 | FUNCTION: xsk_tx_completed | ENTRY: irq/164-enp1s0- (PID: 10593) - num_entries: 3
> TIMESTAMP: 149658589391394 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658590239215 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 10633) - queue_id: 0
> 

I appreciate the detailed outline of how to configure the system so this
fails, and the steps taken to verify the change fixes the issue.

> Signed-off-by: Vivek Behera <vivek.behera@siemens.com>

This is a bug fix, so it should be targeted at net. You will need a
Fixes tag associating which commit this fixes as well. Alternatively,
since this is for an Intel networking driver and you sent it to Intel
Wired LAN, it would be "iwl-net" so that it gets picked up by Tony for
testing along with our other igc changes.


> ---
> drivers/net/ethernet/intel/igc/igc_main.c | 31 +++++++++++++++++++----
> 1 file changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index 7aafa60ba0c8..0cfcd20a2536 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -6930,21 +6930,42 @@ int igc_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags)
>            if (!igc_xdp_is_enabled(adapter))
>                        return -ENXIO;
> -           if (queue_id >= adapter->num_rx_queues)
> +          if ((flags & XDP_WAKEUP_RX) && (flags & XDP_WAKEUP_TX)) {
> +                      /* If both TX and RX need to be woken up queue pair per IRQ is needed */
> +                      if (!(adapter->flags & IGC_FLAG_QUEUE_PAIRS))
> +                                  return -EINVAL; /* igc queue pairs are not activated.
> +                                                          * Can't trigger irq
> +                                                          */

We only have to check for queue pairs if we want to wake both. Makes sense.

> +                      /* Just get the ring params from Rx */
> +                      if (queue_id >= adapter->num_rx_queues)
> +                                  return -EINVAL;
> +                      ring = adapter->rx_ring[queue_id];
> +          } else if (flags & XDP_WAKEUP_TX) {
> +                      if (queue_id >= adapter->num_tx_queues)
> +                                  return -EINVAL;
> +                      /* Get the ring params from Tx */
> +                      ring = adapter->tx_ring[queue_id];
> +          } else if (flags & XDP_WAKEUP_RX) {
> +                      if (queue_id >= adapter->num_rx_queues)
> +                                  return -EINVAL;
> +                      /* Get the ring params from Rx */
> +                      ring = adapter->rx_ring[queue_id];
> +          } else {
> +                      /* Invalid Flags */
>                        return -EINVAL;
> -
> -           ring = adapter->rx_ring[queue_id];
> +          }
>             if (!ring->xsk_pool)
>                        return -ENXIO;
> -
> -           q_vector = adapter->q_vector[queue_id];
> +          /* Retrieve the q_vector saved in the ring */
> +          q_vector = ring->q_vector;
>            if (!napi_if_scheduled_mark_missed(&q_vector->napi))
>                        igc_trigger_rxtxq_interrupt(adapter, q_vector);

The actual code changes seem correct to me, so you may add my review tag
on a version which has the Fixes and the appropriate tree tag i.e.
[iwl-net] or [PATCH iwl-net].

Reviewed-by: Jacob Keller <jacob.keller@intel.com>

Thanks,
Jake

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Jacob Keller <jacob.e.keller@intel.com>
To: "Behera, VIVEK" <vivek.behera@siemens.com>,
	Tony Nguyen <anthony.l.nguyen@intel.com>,
	Przemek Kitszel <przemyslaw.kitszel@intel.com>,
	Andrew Lunn <andrew+netdev@lunn.ch>,
	"David S. Miller" <davem@davemloft.net>,
	Eric Dumazet <edumazet@google.com>,
	Jakub Kicinski <kuba@kernel.org>,
	"Paolo Abeni" <pabeni@redhat.com>
Cc: "intel-wired-lan@lists.osuosl.org"
	<intel-wired-lan@lists.osuosl.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH] igc: Fix trigger of incorrect irq in igc_xsk_wakeup function
Date: Mon, 8 Dec 2025 15:53:35 -0800	[thread overview]
Message-ID: <4c90ed4e-307c-429a-9f8c-29032cc146ee@intel.com> (raw)
In-Reply-To: <AS1PR10MB5392B7268416DB8A1624FDB88FA7A@AS1PR10MB5392.EURPRD10.PROD.OUTLOOK.COM>


[-- Attachment #1.1: Type: text/plain, Size: 7396 bytes --]



On 12/5/2025 4:39 AM, Behera, VIVEK wrote:
> From 4e3ebdc0af6baa83ccfc17c61c1eb61408095ffd Mon Sep 17 00:00:00 2001
> From: Vivek Behera <vivek.behera@siemens.com>
> Date: Fri, 5 Dec 2025 10:26:05 +0100
> Subject: [PATCH] igc: Fix trigger of incorrect irq in igc_xsk_wakeup function
> 
> When the i226 is configured to use only 2 combined queues using ethtool
> or in an environment with only 2 active CPU cores the 4 irq lines
> are used in a split configuration with one irq
> assigned to each of the two rx and tx queues
> (see console output below)
> 
> sudo ethtool -l enp1s0
> Channel parameters for enp1s0:
> Pre-set maximums:
> RX:                        n/a
> TX:                         n/a
> Other:                  1
> Combined:        4
> Current hardware settings:
> RX:                        n/a
> TX:                         n/a
> Other:                  1
> Combined:        2
> eddx@mvs:~$ cat /proc/interrupts | grep enp1s0
> 147:          1          0  IR-PCI-MSIX-0000:01:00.0   0-edge      enp1s0
> 148:          8          0  IR-PCI-MSIX-0000:01:00.0   1-edge      enp1s0-rx-0
> 149:          0          0  IR-PCI-MSIX-0000:01:00.0   2-edge      enp1s0-rx-1
> 150:         26          0  IR-PCI-MSIX-0000:01:00.0   3-edge      enp1s0-tx-0
> 151:          0          0  IR-PCI-MSIX-0000:01:00.0   4-edge      enp1s0-tx-1
> 
> While testing with the RTC Testbench it was noticed
> using the bpftrace that the
> igc_xsk_wakeup when triggered by xsk_sendmsg
> was triggering the incorrect irq for
> tx-0(see trace below)
> 
> TIMESTAMP: 456992309829 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456992317157 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> TIMESTAMP: 456993309408 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456993316591 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> TIMESTAMP: 456994309630 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456994316674 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> TIMESTAMP: 456995309493 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 945) - queue_id: 0
> TIMESTAMP: 456995316593 | FUNCTION: igc_poll | ENTRY: irq/148-enp1s0- (PID: 948)
> 
> Due to this bug no XDP Zc send is possible in this split irq configuration.
> This patch implements the correct logic of extracting the q_vectors saved
> duirng the rx and tx ring allocation.
> Furthermore the patch includes usage of flags provided by the ndo_xsk_wakeup
> api to trigger the required irq. With this patch correct irqs are triggered
> 
> cat /proc/interrupts | grep enp1s0
> 161:          1          0          0          0 IR-PCI-MSIX-0000:01:00.0    0-edge      enp1s0
> 162:          2          0          0          0 IR-PCI-MSIX-0000:01:00.0    1-edge      enp1s0-rx-0
> 163:        359          0          0          0 IR-PCI-MSIX-0000:01:00.0    2-edge      enp1s0-rx-1
> 164:     872005          0          0          0 IR-PCI-MSIX-0000:01:00.0    3-edge      enp1s0-tx-0
> 165:         71          0          0          0 IR-PCI-MSIX-0000:01:00.0    4-edge      enp1s0-tx-1
> 
> TIMESTAMP: 149658589239205 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 10633) - queue_id: 0
> TIMESTAMP: 149658589244662 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658589293396 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658589295357 | FUNCTION: xsk_tx_completed | ENTRY: irq/164-enp1s0- (PID: 10593) - num_entries: 61
> TIMESTAMP: 149658589342151 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658589343881 | FUNCTION: xsk_tx_completed | ENTRY: irq/164-enp1s0- (PID: 10593) - num_entries: 3
> TIMESTAMP: 149658589391394 | FUNCTION: igc_poll | ENTRY: irq/164-enp1s0- (PID: 10593)
> TIMESTAMP: 149658590239215 | FUNCTION: igc_xsk_wakeup | ENTRY: RtcTxThread (PID: 10633) - queue_id: 0
> 

I appreciate the detailed outline of how to configure the system so this
fails, and the steps taken to verify the change fixes the issue.

> Signed-off-by: Vivek Behera <vivek.behera@siemens.com>

This is a bug fix, so it should be targeted at net. You will need a
Fixes tag associating which commit this fixes as well. Alternatively,
since this is for an Intel networking driver and you sent it to Intel
Wired LAN, it would be "iwl-net" so that it gets picked up by Tony for
testing along with our other igc changes.


> ---
> drivers/net/ethernet/intel/igc/igc_main.c | 31 +++++++++++++++++++----
> 1 file changed, 26 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igc/igc_main.c b/drivers/net/ethernet/intel/igc/igc_main.c
> index 7aafa60ba0c8..0cfcd20a2536 100644
> --- a/drivers/net/ethernet/intel/igc/igc_main.c
> +++ b/drivers/net/ethernet/intel/igc/igc_main.c
> @@ -6930,21 +6930,42 @@ int igc_xsk_wakeup(struct net_device *dev, u32 queue_id, u32 flags)
>            if (!igc_xdp_is_enabled(adapter))
>                        return -ENXIO;
> -           if (queue_id >= adapter->num_rx_queues)
> +          if ((flags & XDP_WAKEUP_RX) && (flags & XDP_WAKEUP_TX)) {
> +                      /* If both TX and RX need to be woken up queue pair per IRQ is needed */
> +                      if (!(adapter->flags & IGC_FLAG_QUEUE_PAIRS))
> +                                  return -EINVAL; /* igc queue pairs are not activated.
> +                                                          * Can't trigger irq
> +                                                          */

We only have to check for queue pairs if we want to wake both. Makes sense.

> +                      /* Just get the ring params from Rx */
> +                      if (queue_id >= adapter->num_rx_queues)
> +                                  return -EINVAL;
> +                      ring = adapter->rx_ring[queue_id];
> +          } else if (flags & XDP_WAKEUP_TX) {
> +                      if (queue_id >= adapter->num_tx_queues)
> +                                  return -EINVAL;
> +                      /* Get the ring params from Tx */
> +                      ring = adapter->tx_ring[queue_id];
> +          } else if (flags & XDP_WAKEUP_RX) {
> +                      if (queue_id >= adapter->num_rx_queues)
> +                                  return -EINVAL;
> +                      /* Get the ring params from Rx */
> +                      ring = adapter->rx_ring[queue_id];
> +          } else {
> +                      /* Invalid Flags */
>                        return -EINVAL;
> -
> -           ring = adapter->rx_ring[queue_id];
> +          }
>             if (!ring->xsk_pool)
>                        return -ENXIO;
> -
> -           q_vector = adapter->q_vector[queue_id];
> +          /* Retrieve the q_vector saved in the ring */
> +          q_vector = ring->q_vector;
>            if (!napi_if_scheduled_mark_missed(&q_vector->napi))
>                        igc_trigger_rxtxq_interrupt(adapter, q_vector);

The actual code changes seem correct to me, so you may add my review tag
on a version which has the Fixes and the appropriate tree tag i.e.
[iwl-net] or [PATCH iwl-net].

Reviewed-by: Jacob Keller <jacob.keller@intel.com>

Thanks,
Jake

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 236 bytes --]

  parent reply	other threads:[~2025-12-08 23:53 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-12-05 12:39 [Intel-wired-lan] [PATCH] igc: Fix trigger of incorrect irq in igc_xsk_wakeup function Behera, VIVEK
2025-12-05 12:39 ` Behera, VIVEK
2025-12-05 21:05 ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-12-06 12:03   ` Behera, VIVEK
2025-12-06 12:03     ` Behera, VIVEK
2025-12-07 15:46 ` [Intel-wired-lan] [PATCH v2] igc: Enhance xsk wakeup for split IRQ and fix PTP TX wakeup Behera, VIVEK
2025-12-07 15:46   ` Behera, VIVEK
2025-12-08 23:53 ` Jacob Keller [this message]
2025-12-08 23:53   ` [PATCH] igc: Fix trigger of incorrect irq in igc_xsk_wakeup function Jacob Keller
2025-12-09  6:03   ` [Intel-wired-lan] " Behera, VIVEK
2025-12-09  6:03     ` Behera, VIVEK
2025-12-09  6:46     ` [Intel-wired-lan] [PATCH v3 iwl-net] " Behera, VIVEK
2025-12-09  6:46       ` Behera, VIVEK
2025-12-09  8:05       ` [Intel-wired-lan] " Loktionov, Aleksandr
2025-12-09  8:05         ` Loktionov, Aleksandr
2025-12-10  7:09         ` [Intel-wired-lan] [PATCH v4 " Behera, VIVEK
2025-12-10  7:09           ` AW: " Behera, VIVEK
2025-12-10  7:16         ` [Intel-wired-lan] [PATCH v3 " Loktionov, Aleksandr
2025-12-10  7:16           ` Loktionov, Aleksandr
2025-12-10  7:50           ` [Intel-wired-lan] [PATCH v5 " Behera, VIVEK
2025-12-10  7:50             ` AW: " Behera, VIVEK
2025-12-10  8:57             ` [Intel-wired-lan] " Jakub Kicinski
2025-12-10  8:57               ` Jakub Kicinski
2025-12-10 10:16             ` [Intel-wired-lan] " Kurt Kanzenbach
2025-12-10 10:16               ` AW: " Kurt Kanzenbach
2025-12-10 10:48               ` [Intel-wired-lan] " Behera, VIVEK
2025-12-10 14:34                 ` Kurt Kanzenbach
2025-12-10 16:41             ` Paul Menzel
2025-12-10 10:15       ` [Intel-wired-lan] [PATCH v3 " Kwapulinski, Piotr
2025-12-10 10:15         ` Kwapulinski, Piotr

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=4c90ed4e-307c-429a-9f8c-29032cc146ee@intel.com \
    --to=jacob.e.keller@intel.com \
    --cc=andrew+netdev@lunn.ch \
    --cc=anthony.l.nguyen@intel.com \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=intel-wired-lan@lists.osuosl.org \
    --cc=kuba@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    --cc=przemyslaw.kitszel@intel.com \
    --cc=vivek.behera@siemens.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.