Skip to content

Commit 61c113b

Browse files
azaki1mehmetb0
authored andcommitted
iavf: fix reset_task for early reset event
BugLink: https://bugs.launchpad.net/bugs/2119603 [ Upstream commit 0c6f4631436ecea841f1583b98255aedd7495b18 ] 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]> Signed-off-by: Sasha Levin <[email protected]> Signed-off-by: Manuel Diewald <[email protected]> Signed-off-by: Mehmet Basaran <[email protected]>
1 parent b8e772e commit 61c113b

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
@@ -3028,6 +3028,17 @@ static void iavf_reset_task(struct work_struct *work)
30283028
}
30293029

30303030
continue_reset:
3031+
/* If we are still early in the state machine, just restart. */
3032+
if (adapter->state <= __IAVF_INIT_FAILED) {
3033+
iavf_shutdown_adminq(hw);
3034+
iavf_change_state(adapter, __IAVF_STARTUP);
3035+
iavf_startup(adapter);
3036+
queue_delayed_work(adapter->wq, &adapter->watchdog_task,
3037+
msecs_to_jiffies(30));
3038+
netdev_unlock(netdev);
3039+
return;
3040+
}
3041+
30313042
/* We don't use netif_running() because it may be true prior to
30323043
* ndo_open() returning, so we can't assume it means all our open
30333044
* 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
@@ -78,6 +78,23 @@ iavf_poll_virtchnl_msg(struct iavf_hw *hw, struct iavf_arq_event_info *event,
7878
return iavf_status_to_errno(status);
7979
received_op =
8080
(enum virtchnl_ops)le32_to_cpu(event->desc.cookie_high);
81+
82+
if (received_op == VIRTCHNL_OP_EVENT) {
83+
struct iavf_adapter *adapter = hw->back;
84+
struct virtchnl_pf_event *vpe =
85+
(struct virtchnl_pf_event *)event->msg_buf;
86+
87+
if (vpe->event != VIRTCHNL_EVENT_RESET_IMPENDING)
88+
continue;
89+
90+
dev_info(&adapter->pdev->dev, "Reset indication received from the PF\n");
91+
if (!(adapter->flags & IAVF_FLAG_RESET_PENDING))
92+
iavf_schedule_reset(adapter,
93+
IAVF_FLAG_RESET_PENDING);
94+
95+
return -EIO;
96+
}
97+
8198
if (op_to_poll == received_op)
8299
break;
83100
}

0 commit comments

Comments
 (0)