Skip to content

Commit bd88891

Browse files
bwh-ctdavem330
authored andcommitted
sh_eth: Detach net device when stopping queue to resize DMA rings
We must only ever stop TX queues when they are full or the net device is not 'ready' so far as the net core, and specifically the watchdog, is concerned. Otherwise, the watchdog may fire *immediately* if no packets have been added to the queue in the last 5 seconds. What's more, sh_eth_tx_timeout() will likely crash if called while we're resizing the TX ring. I could easily trigger this by running the loop: while ethtool -G eth0 rx 128 && ethtool -G eth0 rx 64; do echo -n .; done Signed-off-by: Ben Hutchings <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent eebfb64 commit bd88891

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

drivers/net/ethernet/renesas/sh_eth.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1968,6 +1968,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
19681968
return -EINVAL;
19691969

19701970
if (netif_running(ndev)) {
1971+
netif_device_detach(ndev);
19711972
netif_tx_disable(ndev);
19721973
/* Disable interrupts by clearing the interrupt mask. */
19731974
sh_eth_write(ndev, 0x0000, EESIPR);
@@ -2001,7 +2002,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
20012002
sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
20022003
/* Setting the Rx mode will start the Rx process. */
20032004
sh_eth_write(ndev, EDRRR_R, EDRRR);
2004-
netif_wake_queue(ndev);
2005+
netif_device_attach(ndev);
20052006
}
20062007

20072008
return 0;

0 commit comments

Comments
 (0)