Skip to content

Commit 0c6f463

Browse files
azaki1anguy11
authored andcommitted
iavf: fix reset_task for early reset event
If a reset event is received from the PF early in the init cycle, the state machine hangs for about 25 seconds. Reproducer: echo 1 > /sys/class/net/$PF0/device/sriov_numvfs ip link set dev $PF0 vf 0 mac $NEW_MAC The log shows: [792.620416] ice 0000:5e:00.0: Enabling 1 VFs [792.738812] iavf 0000:5e:01.0: enabling device (0000 -> 0002) [792.744182] ice 0000:5e:00.0: Enabling 1 VFs with 17 vectors and 16 queues per VF [792.839964] ice 0000:5e:00.0: Setting MAC 52:54:00:00:00:11 on VF 0. VF driver will be reinitialized [813.389684] iavf 0000:5e:01.0: Failed to communicate with PF; waiting before retry [818.635918] iavf 0000:5e:01.0: Hardware came out of reset. Attempting reinit. [818.766273] iavf 0000:5e:01.0: Multiqueue Enabled: Queue pair count = 16 Fix it by scheduling the reset task and making the reset task capable of resetting early in the init cycle. Fixes: ef8693e ("i40evf: refactor reset handling") Signed-off-by: Ahmed Zaki <[email protected]> Tested-by: Przemek Kitszel <[email protected]> Reviewed-by: Przemek Kitszel <[email protected]> Signed-off-by: Marcin Szycik <[email protected]> Reviewed-by: Simon Horman <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent fb4e923 commit 0c6f463

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

drivers/net/ethernet/intel/iavf/iavf_main.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3209,6 +3209,17 @@ static void iavf_reset_task(struct work_struct *work)
32093209
}
32103210

32113211
continue_reset:
3212+
/* If we are still early in the state machine, just restart. */
3213+
if (adapter->state <= __IAVF_INIT_FAILED) {
3214+
iavf_shutdown_adminq(hw);
3215+
iavf_change_state(adapter, __IAVF_STARTUP);
3216+
iavf_startup(adapter);
3217+
queue_delayed_work(adapter->wq, &adapter->watchdog_task,
3218+
msecs_to_jiffies(30));
3219+
netdev_unlock(netdev);
3220+
return;
3221+
}
3222+
32123223
/* We don't use netif_running() because it may be true prior to
32133224
* ndo_open() returning, so we can't assume it means all our open
32143225
* tasks have finished, since we're not holding the rtnl_lock here.

drivers/net/ethernet/intel/iavf/iavf_virtchnl.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,23 @@ iavf_poll_virtchnl_msg(struct iavf_hw *hw, struct iavf_arq_event_info *event,
7979
return iavf_status_to_errno(status);
8080
received_op =
8181
(enum virtchnl_ops)le32_to_cpu(event->desc.cookie_high);
82+
83+
if (received_op == VIRTCHNL_OP_EVENT) {
84+
struct iavf_adapter *adapter = hw->back;
85+
struct virtchnl_pf_event *vpe =
86+
(struct virtchnl_pf_event *)event->msg_buf;
87+
88+
if (vpe->event != VIRTCHNL_EVENT_RESET_IMPENDING)
89+
continue;
90+
91+
dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n");
92+
if (!(adapter->flags & IAVF_FLAG_RESET_PENDING))
93+
iavf_schedule_reset(adapter,
94+
IAVF_FLAG_RESET_PENDING);
95+
96+
return -EIO;
97+
}
98+
8299
if (op_to_poll == received_op)
83100
break;
84101
}

0 commit comments

Comments
 (0)