diff mbox series

[iwl-net,10/11] ice: lock with PF state instead of VSI state in ice_xsk_pool_setup()

Message ID 20240528131429.3012910-11-maciej.fijalkowski@intel.com (mailing list archive)
State Superseded
Delegated to: Netdev Maintainers
Headers show
Series ice: fix AF_XDP ZC timeout and concurrency issues | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for net
netdev/apply fail Patch does not apply to net-0

Commit Message

Maciej Fijalkowski May 28, 2024, 1:14 p.m. UTC
From: Larysa Zaremba <larysa.zaremba@intel.com>

The main intent of using ICE_CFG_BUSY is to prevent the reset from
starting, when other configuration is being processed. pf->state is checked
before starting reset, but ice_xsk_pool_setup sets the flag in vsi->state,
which is almost useless. Also, ICE_CFG_BUSY belongs to enum ice_pf_state,
not ice_vsi_state.

Change vsi->state to pf->state in ice_xsk_pool_setup() locking code, so
reset would not interfere with AF_XDP configuration.

Fixes: 2d4238f55697 ("ice: Add support for AF_XDP")
Signed-off-by: Larysa Zaremba <larysa.zaremba@intel.com>
---
 drivers/net/ethernet/intel/ice/ice_xsk.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_xsk.c b/drivers/net/ethernet/intel/ice/ice_xsk.c
index fe4aa4b537dd..225d027d3d7a 100644
--- a/drivers/net/ethernet/intel/ice/ice_xsk.c
+++ b/drivers/net/ethernet/intel/ice/ice_xsk.c
@@ -370,6 +370,7 @@  int ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid)
 {
 	bool if_running, pool_present = !!pool;
 	int ret = 0, pool_failure = 0;
+	struct ice_pf *pf = vsi->back;
 
 	if (qid >= vsi->num_rxq || qid >= vsi->num_txq) {
 		netdev_err(vsi->netdev, "Please use queue id in scope of combined queues count\n");
@@ -383,7 +384,7 @@  int ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid)
 		struct ice_rx_ring *rx_ring = vsi->rx_rings[qid];
 		int timeout = 50;
 
-		while (test_and_set_bit(ICE_CFG_BUSY, vsi->state)) {
+		while (test_and_set_bit(ICE_CFG_BUSY, pf->state)) {
 			timeout--;
 			if (!timeout)
 				return -EBUSY;
@@ -411,7 +412,7 @@  int ice_xsk_pool_setup(struct ice_vsi *vsi, struct xsk_buff_pool *pool, u16 qid)
 			napi_schedule(&vsi->rx_rings[qid]->xdp_ring->q_vector->napi);
 		else if (ret)
 			netdev_err(vsi->netdev, "ice_qp_ena error = %d\n", ret);
-		clear_bit(ICE_CFG_BUSY, vsi->state);
+		clear_bit(ICE_CFG_BUSY, pf->state);
 	}
 
 failure: