Revert "iavf: Detach device during reset task"

This reverts commit aa626da947.

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 <dawidx.wesierski@intel.com>
Signed-off-by: Marcin Szycik <marcin.szycik@linux.intel.com>
Signed-off-by: Mateusz Palczewski <mateusz.palczewski@intel.com>
Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
Signed-off-by: Tony Nguyen <anthony.l.nguyen@intel.com>
This commit is contained in:
Marcin Szycik 2023-06-05 10:52:23 -04:00 committed by Tony Nguyen
parent c2ed2403f1
commit d2806d960e

View File

@ -2977,11 +2977,6 @@ static void iavf_reset_task(struct work_struct *work)
int i = 0, err;
bool running;
/* Detach interface to avoid subsequent NDO callbacks */
rtnl_lock();
netif_device_detach(netdev);
rtnl_unlock();
/* When device is being removed it doesn't make sense to run the reset
* task, just return in such a case.
*/
@ -2989,7 +2984,7 @@ static void iavf_reset_task(struct work_struct *work)
if (adapter->state != __IAVF_REMOVE)
queue_work(adapter->wq, &adapter->reset_task);
goto reset_finish;
return;
}
while (!mutex_trylock(&adapter->client_lock))
@ -3192,7 +3187,7 @@ static void iavf_reset_task(struct work_struct *work)
mutex_unlock(&adapter->client_lock);
mutex_unlock(&adapter->crit_lock);
goto reset_finish;
return;
reset_err:
if (running) {
set_bit(__IAVF_VSI_DOWN, adapter->vsi.state);
@ -3213,10 +3208,6 @@ static void iavf_reset_task(struct work_struct *work)
}
dev_err(&adapter->pdev->dev, "failed to allocate resources during reinit\n");
reset_finish:
rtnl_lock();
netif_device_attach(netdev);
rtnl_unlock();
}
/**