From: "Nabil S. Alramli" <dev@nalramli.com>
To: anthony.l.nguyen@intel.com, przemyslaw.kitszel@intel.com
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, ast@kernel.org,
daniel@iogearbox.net, hawk@kernel.org, john.fastabend@gmail.com,
lishujin@kuaishou.com, xingwanli@kuaishou.com,
intel-wired-lan@lists.osuosl.org, netdev@vger.kernel.org,
linux-kernel@vger.kernel.org, bpf@vger.kernel.org,
team-kernel@fastly.com, khubert@fastly.com, nalramli@fastly.com,
dev@nalramli.com
Subject: [RFC ixgbe 2/2] ixgbe: Fix CPU to ring assignment
Date: Thu, 9 Oct 2025 15:28:31 -0400 [thread overview]
Message-ID: <20251009192831.3333763-3-dev@nalramli.com> (raw)
In-Reply-To: <20251009192831.3333763-1-dev@nalramli.com>
The ixgbe driver uses ixgbe_determine_*_ring to determine the CPU mapping
of transmit rings. Those helper functions have a hard-coded number of
rings equal to IXGBE_MAX_XDP_QS, which is set to 64. However, this does
not take into account the number of actual rings configured, which could
be lower. This results in NULL being returned, if the modulus operation
falls into a ring that is not configured. Instead, use the actual number
of configured rings.
Signed-off-by: Nabil S. Alramli <dev@nalramli.com>
Fixes: 4fe815850bdc ("ixgbe: let the xdpdrv work with more than 64 cpus")
---
drivers/net/ethernet/intel/ixgbe/ixgbe.h | 12 ++----------
1 file changed, 2 insertions(+), 10 deletions(-)
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe.h b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
index 26c378853755..e2c09545bad1 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe.h
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe.h
@@ -830,18 +830,10 @@ struct ixgbe_adapter {
spinlock_t vfs_lock;
};
-static inline int ixgbe_determine_xdp_q_idx(int cpu)
-{
- if (static_key_enabled(&ixgbe_xdp_locking_key))
- return cpu % IXGBE_MAX_XDP_QS;
- else
- return cpu;
-}
-
static inline
struct ixgbe_ring *ixgbe_determine_xdp_ring(struct ixgbe_adapter *adapter)
{
- int index = ixgbe_determine_xdp_q_idx(smp_processor_id());
+ int index = smp_processor_id() % adapter->num_xdp_queues;
return adapter->xdp_ring[index];
}
@@ -849,7 +841,7 @@ struct ixgbe_ring *ixgbe_determine_xdp_ring(struct ixgbe_adapter *adapter)
static inline
struct ixgbe_ring *ixgbe_determine_tx_ring(struct ixgbe_adapter *adapter)
{
- int index = ixgbe_determine_xdp_q_idx(smp_processor_id());
+ int index = smp_processor_id() % adapter->num_tx_queues;
return adapter->tx_ring[index];
}
--
2.43.0
prev parent reply other threads:[~2025-10-09 19:28 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-10-09 19:28 [RFC ixgbe 0/2] ixgbe: Implement support for ndo_xdp_xmit in skb mode and fix CPU to ring assignment Nabil S. Alramli
2025-10-09 19:28 ` [RFC ixgbe 1/2] ixgbe: Implement support for ndo_xdp_xmit in skb mode Nabil S. Alramli
2025-11-03 16:38 ` Maciej Fijalkowski
2025-11-03 17:40 ` Nabil S. Alramli
2025-11-03 18:54 ` Maciej Fijalkowski
2025-10-09 19:28 ` Nabil S. Alramli [this message]
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=20251009192831.3333763-3-dev@nalramli.com \
--to=dev@nalramli.com \
--cc=andrew+netdev@lunn.ch \
--cc=anthony.l.nguyen@intel.com \
--cc=ast@kernel.org \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=hawk@kernel.org \
--cc=intel-wired-lan@lists.osuosl.org \
--cc=john.fastabend@gmail.com \
--cc=khubert@fastly.com \
--cc=kuba@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lishujin@kuaishou.com \
--cc=nalramli@fastly.com \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=przemyslaw.kitszel@intel.com \
--cc=team-kernel@fastly.com \
--cc=xingwanli@kuaishou.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).