aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings <ben.hutchings@codethink.co.uk>2015-01-22 07:40:25 -0500
committerDavid S. Miller <davem@davemloft.net>2015-01-26 19:13:15 -0500
commitbd8889163a7f392f89de5bb01ad00f5772c7ea25 (patch)
tree7a659481ceabb22aa47ff25ddc65848e96f5879b
parenteebfb643c0799ecb98ba77d4a0dd0e56f6a17553 (diff)
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 <ben.hutchings@codethink.co.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r--drivers/net/ethernet/renesas/sh_eth.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/renesas/sh_eth.c b/drivers/net/ethernet/renesas/sh_eth.c
index 4ae22fc05918..fa8a7b775b4a 100644
--- a/drivers/net/ethernet/renesas/sh_eth.c
+++ b/drivers/net/ethernet/renesas/sh_eth.c
@@ -1968,6 +1968,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
1968 return -EINVAL; 1968 return -EINVAL;
1969 1969
1970 if (netif_running(ndev)) { 1970 if (netif_running(ndev)) {
1971 netif_device_detach(ndev);
1971 netif_tx_disable(ndev); 1972 netif_tx_disable(ndev);
1972 /* Disable interrupts by clearing the interrupt mask. */ 1973 /* Disable interrupts by clearing the interrupt mask. */
1973 sh_eth_write(ndev, 0x0000, EESIPR); 1974 sh_eth_write(ndev, 0x0000, EESIPR);
@@ -2001,7 +2002,7 @@ static int sh_eth_set_ringparam(struct net_device *ndev,
2001 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR); 2002 sh_eth_write(ndev, mdp->cd->eesipr_value, EESIPR);
2002 /* Setting the Rx mode will start the Rx process. */ 2003 /* Setting the Rx mode will start the Rx process. */
2003 sh_eth_write(ndev, EDRRR_R, EDRRR); 2004 sh_eth_write(ndev, EDRRR_R, EDRRR);
2004 netif_wake_queue(ndev); 2005 netif_device_attach(ndev);
2005 } 2006 }
2006 2007
2007 return 0; 2008 return 0;