[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20251009192831.3333763-3-dev@nalramli.com>
Date: Thu, 9 Oct 2025 15:28:31 -0400
From: "Nabil S. Alramli" <dev@...ramli.com>
To: anthony.l.nguyen@...el.com,
przemyslaw.kitszel@...el.com
Cc: andrew+netdev@...n.ch,
davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
ast@...nel.org,
daniel@...earbox.net,
hawk@...nel.org,
john.fastabend@...il.com,
lishujin@...ishou.com,
xingwanli@...ishou.com,
intel-wired-lan@...ts.osuosl.org,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
bpf@...r.kernel.org,
team-kernel@...tly.com,
khubert@...tly.com,
nalramli@...tly.com,
dev@...ramli.com
Subject: [RFC ixgbe 2/2] ixgbe: Fix CPU to ring assignment
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@...ramli.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
Powered by blists - more mailing lists