Skip to content

Commit 0bb4f9e

Browse files
mfijalkoanguy11
authored andcommitted
ice: unify xdp_rings accesses
There has been a long lasting issue of improper xdp_rings indexing for XDP_TX and XDP_REDIRECT actions. Given that currently rx_ring->q_index is mixed with smp_processor_id(), there could be a situation where Tx descriptors are produced onto XDP Tx ring, but tail is never bumped - for example pin a particular queue id to non-matching IRQ line. Address this problem by ignoring the user ring count setting and always initialize the xdp_rings array to be of num_possible_cpus() size. Then, always use the smp_processor_id() as an index to xdp_rings array. This provides serialization as at given time only a single softirq can run on a particular CPU. Signed-off-by: Maciej Fijalkowski <[email protected]> Tested-by: George Kuruvinakunnel <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent e72bba2 commit 0bb4f9e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

drivers/net/ethernet/intel/ice/ice_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3215,7 +3215,7 @@ int ice_vsi_rebuild(struct ice_vsi *vsi, bool init_vsi)
32153215

32163216
ice_vsi_map_rings_to_vectors(vsi);
32173217
if (ice_is_xdp_ena_vsi(vsi)) {
3218-
vsi->num_xdp_txq = vsi->alloc_rxq;
3218+
vsi->num_xdp_txq = num_possible_cpus();
32193219
ret = ice_prepare_xdp_rings(vsi, vsi->xdp_prog);
32203220
if (ret)
32213221
goto err_vectors;

drivers/net/ethernet/intel/ice/ice_main.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2638,7 +2638,7 @@ ice_xdp_setup_prog(struct ice_vsi *vsi, struct bpf_prog *prog,
26382638
}
26392639

26402640
if (!ice_is_xdp_ena_vsi(vsi) && prog) {
2641-
vsi->num_xdp_txq = vsi->alloc_rxq;
2641+
vsi->num_xdp_txq = num_possible_cpus();
26422642
xdp_ring_err = ice_prepare_xdp_rings(vsi, prog);
26432643
if (xdp_ring_err)
26442644
NL_SET_ERR_MSG_MOD(extack, "Setting up XDP Tx resources failed");

drivers/net/ethernet/intel/ice/ice_txrx_lib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -297,7 +297,7 @@ void ice_finalize_xdp_rx(struct ice_rx_ring *rx_ring, unsigned int xdp_res)
297297

298298
if (xdp_res & ICE_XDP_TX) {
299299
struct ice_tx_ring *xdp_ring =
300-
rx_ring->vsi->xdp_rings[rx_ring->q_index];
300+
rx_ring->vsi->xdp_rings[smp_processor_id()];
301301

302302
ice_xdp_ring_update_tail(xdp_ring);
303303
}

0 commit comments

Comments
 (0)