Skip to content

Commit f50c687

Browse files
walking-machineanguy11
authored andcommitted
ice: check for XDP rings instead of bpf program when unconfiguring
If VSI rebuild is pending, .ndo_bpf() can attach/detach the XDP program on VSI without applying new ring configuration. When unconfiguring the VSI, we can encounter the state in which there is an XDP program but no XDP rings to destroy or there will be XDP rings that need to be destroyed, but no XDP program to indicate their presence. When unconfiguring, rely on the presence of XDP rings rather then XDP program, as they better represent the current state that has to be destroyed. Reviewed-by: Wojciech Drewek <[email protected]> Reviewed-by: Jacob Keller <[email protected]> Tested-by: Chandan Kumar Rout <[email protected]> Acked-by: Maciej Fijalkowski <[email protected]> Signed-off-by: Larysa Zaremba <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent 2504b84 commit f50c687

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2426,7 +2426,7 @@ void ice_vsi_decfg(struct ice_vsi *vsi)
24262426
dev_err(ice_pf_to_dev(pf), "Failed to remove RDMA scheduler config for VSI %u, err %d\n",
24272427
vsi->vsi_num, err);
24282428

2429-
if (ice_is_xdp_ena_vsi(vsi))
2429+
if (vsi->xdp_rings)
24302430
/* return value check can be skipped here, it always returns
24312431
* 0 if reset is in progress
24322432
*/
@@ -2528,7 +2528,7 @@ static void ice_vsi_release_msix(struct ice_vsi *vsi)
25282528
for (q = 0; q < q_vector->num_ring_tx; q++) {
25292529
ice_write_itr(&q_vector->tx, 0);
25302530
wr32(hw, QINT_TQCTL(vsi->txq_map[txq]), 0);
2531-
if (ice_is_xdp_ena_vsi(vsi)) {
2531+
if (vsi->xdp_rings) {
25322532
u32 xdp_txq = txq + vsi->num_xdp_txq;
25332533

25342534
wr32(hw, QINT_TQCTL(vsi->txq_map[xdp_txq]), 0);

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7249,7 +7249,7 @@ int ice_down(struct ice_vsi *vsi)
72497249
if (tx_err)
72507250
netdev_err(vsi->netdev, "Failed stop Tx rings, VSI %d error %d\n",
72517251
vsi->vsi_num, tx_err);
7252-
if (!tx_err && ice_is_xdp_ena_vsi(vsi)) {
7252+
if (!tx_err && vsi->xdp_rings) {
72537253
tx_err = ice_vsi_stop_xdp_tx_rings(vsi);
72547254
if (tx_err)
72557255
netdev_err(vsi->netdev, "Failed stop XDP rings, VSI %d error %d\n",
@@ -7266,7 +7266,7 @@ int ice_down(struct ice_vsi *vsi)
72667266
ice_for_each_txq(vsi, i)
72677267
ice_clean_tx_ring(vsi->tx_rings[i]);
72687268

7269-
if (ice_is_xdp_ena_vsi(vsi))
7269+
if (vsi->xdp_rings)
72707270
ice_for_each_xdp_txq(vsi, i)
72717271
ice_clean_tx_ring(vsi->xdp_rings[i]);
72727272

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, u16 q_idx)
3939
sizeof(vsi_stat->rx_ring_stats[q_idx]->rx_stats));
4040
memset(&vsi_stat->tx_ring_stats[q_idx]->stats, 0,
4141
sizeof(vsi_stat->tx_ring_stats[q_idx]->stats));
42-
if (ice_is_xdp_ena_vsi(vsi))
42+
if (vsi->xdp_rings)
4343
memset(&vsi->xdp_rings[q_idx]->ring_stats->stats, 0,
4444
sizeof(vsi->xdp_rings[q_idx]->ring_stats->stats));
4545
}
@@ -52,7 +52,7 @@ static void ice_qp_reset_stats(struct ice_vsi *vsi, u16 q_idx)
5252
static void ice_qp_clean_rings(struct ice_vsi *vsi, u16 q_idx)
5353
{
5454
ice_clean_tx_ring(vsi->tx_rings[q_idx]);
55-
if (ice_is_xdp_ena_vsi(vsi))
55+
if (vsi->xdp_rings)
5656
ice_clean_tx_ring(vsi->xdp_rings[q_idx]);
5757
ice_clean_rx_ring(vsi->rx_rings[q_idx]);
5858
}
@@ -194,7 +194,7 @@ static int ice_qp_dis(struct ice_vsi *vsi, u16 q_idx)
194194
err = ice_vsi_stop_tx_ring(vsi, ICE_NO_RESET, 0, tx_ring, &txq_meta);
195195
if (!fail)
196196
fail = err;
197-
if (ice_is_xdp_ena_vsi(vsi)) {
197+
if (vsi->xdp_rings) {
198198
struct ice_tx_ring *xdp_ring = vsi->xdp_rings[q_idx];
199199

200200
memset(&txq_meta, 0, sizeof(txq_meta));

0 commit comments

Comments
 (0)