lan743x_pcidev_shutdown(), which suspend also uses, calls netif_device_detach() and then lan743x_netdev_close() with the qdisc still attached. Detaching only sets the queue stop bits. It does not wait for an ndo_start_xmit() that is already running, and the TX NAPI poll still wakes a stopped queue as soon as it has reclaimed descriptors. The TX NAPI of a channel that has not been closed yet can therefore restart its queue, and the stack then transmits on a ring that lan743x_tx_close() is freeing. Only wake a queue from TX NAPI while the device is present. In lan743x_netdev_close(), wait for any NAPI poll that may have missed the detach with synchronize_net(), then stop all queues with netif_tx_disable(), which also waits for transmits in progress, before closing the channels. For ndo_stop the qdisc is already deactivated, so this only adds a grace period there. Fixes: 23f0703c125b ("lan743x: Add main source files for new lan743x driver") Signed-off-by: Chris Babroski --- drivers/net/ethernet/microchip/lan743x_main.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/net/ethernet/microchip/lan743x_main.c b/drivers/net/ethernet/microchip/lan743x_main.c index 92cdc13495fe..57d52930f89b 100644 --- a/drivers/net/ethernet/microchip/lan743x_main.c +++ b/drivers/net/ethernet/microchip/lan743x_main.c @@ -2137,7 +2137,8 @@ static int lan743x_tx_napi_poll(struct napi_struct *napi, int weight) /* clean up tx ring */ lan743x_tx_release_completed_descriptors(tx); txq = netdev_get_tx_queue(adapter->netdev, tx->channel_number); - if (netif_tx_queue_stopped(txq)) { + if (netif_tx_queue_stopped(txq) && + netif_device_present(adapter->netdev)) { if (tx->rqd_descriptors) { if (tx->rqd_descriptors <= lan743x_tx_get_avail_desc(tx)) { @@ -3374,6 +3375,9 @@ static int lan743x_netdev_close(struct net_device *netdev) struct lan743x_adapter *adapter = netdev_priv(netdev); int index; + synchronize_net(); + netif_tx_disable(netdev); + for (index = 0; index < adapter->used_tx_channels; index++) lan743x_tx_close(&adapter->tx[index]); -- 2.34.1