Skip to content

Commit d2806d9

Browse files
Marcin Szycikanguy11
authored andcommitted
Revert "iavf: Detach device during reset task"
This reverts commit aa626da. Detaching device during reset was not fully fixing the rtnl locking issue, as there could be a situation where callback was already in progress before detaching netdev. Furthermore, detaching netdevice causes TX timeouts if traffic is running. To reproduce: ip netns exec ns1 iperf3 -c $PEER_IP -t 600 --logfile /dev/null & while :; do for i in 200 7000 400 5000 300 3000 ; do ip netns exec ns1 ip link set $VF1 mtu $i sleep 2 done sleep 10 done Currently, callbacks such as iavf_change_mtu() wait for the reset. If the reset fails to acquire the rtnl_lock, they schedule the netdev update for later while continuing the reset flow. Operations like MTU changes are performed under the rtnl_lock. Therefore, when the operation finishes, another callback that uses rtnl_lock can start. Signed-off-by: Dawid Wesierski <[email protected]> Signed-off-by: Marcin Szycik <[email protected]> Signed-off-by: Mateusz Palczewski <[email protected]> Tested-by: Rafal Romanowski <[email protected]> Signed-off-by: Tony Nguyen <[email protected]>
1 parent c2ed240 commit d2806d9

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

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

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2977,19 +2977,14 @@ static void iavf_reset_task(struct work_struct *work)
29772977
int i = 0, err;
29782978
bool running;
29792979

2980-
/* Detach interface to avoid subsequent NDO callbacks */
2981-
rtnl_lock();
2982-
netif_device_detach(netdev);
2983-
rtnl_unlock();
2984-
29852980
/* When device is being removed it doesn't make sense to run the reset
29862981
* task, just return in such a case.
29872982
*/
29882983
if (!mutex_trylock(&adapter->crit_lock)) {
29892984
if (adapter->state != __IAVF_REMOVE)
29902985
queue_work(adapter->wq, &adapter->reset_task);
29912986

2992-
goto reset_finish;
2987+
return;
29932988
}
29942989

29952990
while (!mutex_trylock(&adapter->client_lock))
@@ -3192,7 +3187,7 @@ static void iavf_reset_task(struct work_struct *work)
31923187
mutex_unlock(&adapter->client_lock);
31933188
mutex_unlock(&adapter->crit_lock);
31943189

3195-
goto reset_finish;
3190+
return;
31963191
reset_err:
31973192
if (running) {
31983193
set_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
@@ -3213,10 +3208,6 @@ static void iavf_reset_task(struct work_struct *work)
32133208
}
32143209

32153210
dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
3216-
reset_finish:
3217-
rtnl_lock();
3218-
netif_device_attach(netdev);
3219-
rtnl_unlock();
32203211
}
32213212

32223213
/**

0 commit comments

Comments
 (0)