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 <[email protected]> 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
