@@ -307,6 +307,7 @@ enum ice_pf_state {
ICE_PHY_INIT_COMPLETE,
ICE_FD_VF_FLUSH_CTX, /* set at FD Rx IRQ or timeout */
ICE_AUX_ERR_PENDING,
+ ICE_RTNL_WAITS_FOR_RESET,
ICE_STATE_NBITS /* must be last */
};
@@ -2740,12 +2740,24 @@ ice_queue_set_napi(struct ice_vsi *vsi, unsigned int queue_index,
if (current_work() == &pf->serv_task ||
test_bit(ICE_PREPARED_FOR_RESET, pf->state) ||
test_bit(ICE_DOWN, pf->state) ||
- test_bit(ICE_SUSPENDED, pf->state))
+ test_bit(ICE_SUSPENDED, pf->state)) {
+ bool rtnl_held_here = true;
+
+ while (!rtnl_trylock()) {
+ if (test_bit(ICE_RTNL_WAITS_FOR_RESET, pf->state)) {
+ rtnl_held_here = false;
+ break;
+ }
+ usleep_range(1000, 2000);
+ }
__ice_queue_set_napi(vsi->netdev, queue_index, type, napi,
- false);
- else
+ true);
+ if (rtnl_held_here)
+ rtnl_unlock();
+ } else {
__ice_queue_set_napi(vsi->netdev, queue_index, type, napi,
true);
+ }
}
/**
@@ -3103,8 +3103,11 @@ static int ice_xdp(struct net_device *dev, struct netdev_bpf *xdp)
return -EINVAL;
}
- while (test_and_set_bit(ICE_CFG_BUSY, pf->state))
+ while (test_and_set_bit(ICE_CFG_BUSY, pf->state)) {
+ set_bit(ICE_RTNL_WAITS_FOR_RESET, pf->state);
usleep_range(1000, 2000);
+ }
+ clear_bit(ICE_RTNL_WAITS_FOR_RESET, pf->state);
switch (xdp->command) {
case XDP_SETUP_PROG: