Skip to content

Commit 1ac2524

Browse files
mfijalkoAlexei Starovoitov
authored andcommitted
ice: xsk: Fix indexing in ice_tx_xsk_pool()
Ice driver tries to always create XDP rings array to be num_possible_cpus() sized, regardless of user's queue count setting that can be changed via ethtool -L for example. Currently, ice_tx_xsk_pool() calculates the qid by decrementing the ring->q_index by the count of XDP queues, but ring->q_index is set to 'i + vsi->alloc_txq'. When user did ethtool -L $IFACE combined 1, alloc_txq is 1, but vsi->num_xdp_txq is still num_possible_cpus(). Then, ice_tx_xsk_pool() will do OOB access and in the final result ring would not get xsk_pool pointer assigned. Then, each ice_xsk_wakeup() call will fail with error and it will not be possible to get into NAPI and do the processing from driver side. Fix this by decrementing vsi->alloc_txq instead of vsi->num_xdp_txq from ring-q_index in ice_tx_xsk_pool() so the calculation is reflected to the setting of ring->q_index. Fixes: 22bf877 ("ice: introduce XDP_TX fallback path") Signed-off-by: Maciej Fijalkowski <maciej.fijalkowski@intel.com> Signed-off-by: Alexei Starovoitov <ast@kernel.org> Link: https://lore.kernel.org/bpf/20220328142123.170157-5-maciej.fijalkowski@intel.com
1 parent 0ec1713 commit 1ac2524

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

  • drivers/net/ethernet/intel/ice

drivers/net/ethernet/intel/ice/ice.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -710,7 +710,7 @@ static inline struct xsk_buff_pool *ice_tx_xsk_pool(struct ice_tx_ring *ring)
710710
struct ice_vsi *vsi = ring->vsi;
711711
u16 qid;
712712

713-
qid = ring->q_index - vsi->num_xdp_txq;
713+
qid = ring->q_index - vsi->alloc_txq;
714714

715715
if (!ice_is_xdp_ena_vsi(vsi) || !test_bit(qid, vsi->af_xdp_zc_qps))
716716
return NULL;

0 commit comments

Comments
 (0)