aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBen Hutchings2013-01-28 13:01:06 -0600
committerBen Hutchings2013-02-26 09:00:46 -0600
commit29c69a4882641285a854d6d03ca5adbba68c0034 (patch)
tree02308179fff9f2ba3f5a7c2333a8aea523d85735 /drivers
parentb590ace09d51cd39744e0f7662c5e4a0d1b5d952 (diff)
downloadam43-linux-kernel-29c69a4882641285a854d6d03ca5adbba68c0034.tar.gz
am43-linux-kernel-29c69a4882641285a854d6d03ca5adbba68c0034.tar.xz
am43-linux-kernel-29c69a4882641285a854d6d03ca5adbba68c0034.zip
sfc: Detach net device when stopping queues for reconfiguration
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. The device is ready if all the following are true: (a) It has a qdisc (b) It is marked present (c) It is running (d) The link is reported up (a) and (c) are normally true, and must not be changed by a driver. (d) is under our control, but fake link changes may disturb userland. This leaves (b). We already mark the device absent during reset and self-test, but we need to do the same during MTU changes and ring reallocation. We don't need to do this when the device is brought down because then (c) is already false. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/ethernet/sfc/efx.c16
1 files changed, 12 insertions, 4 deletions
diff --git a/drivers/net/ethernet/sfc/efx.c b/drivers/net/ethernet/sfc/efx.c
index bf57b3cb16a..0bc00991d31 100644
--- a/drivers/net/ethernet/sfc/efx.c
+++ b/drivers/net/ethernet/sfc/efx.c
@@ -779,6 +779,7 @@ efx_realloc_channels(struct efx_nic *efx, u32 rxq_entries, u32 txq_entries)
779 tx_queue->txd.entries); 779 tx_queue->txd.entries);
780 } 780 }
781 781
782 efx_device_detach_sync(efx);
782 efx_stop_all(efx); 783 efx_stop_all(efx);
783 efx_stop_interrupts(efx, true); 784 efx_stop_interrupts(efx, true);
784 785
@@ -832,6 +833,7 @@ out:
832 833
833 efx_start_interrupts(efx, true); 834 efx_start_interrupts(efx, true);
834 efx_start_all(efx); 835 efx_start_all(efx);
836 netif_device_attach(efx->net_dev);
835 return rc; 837 return rc;
836 838
837rollback: 839rollback:
@@ -1641,8 +1643,12 @@ static void efx_stop_all(struct efx_nic *efx)
1641 /* Flush efx_mac_work(), refill_workqueue, monitor_work */ 1643 /* Flush efx_mac_work(), refill_workqueue, monitor_work */
1642 efx_flush_all(efx); 1644 efx_flush_all(efx);
1643 1645
1644 /* Stop the kernel transmit interface late, so the watchdog 1646 /* Stop the kernel transmit interface. This is only valid if
1645 * timer isn't ticking over the flush */ 1647 * the device is stopped or detached; otherwise the watchdog
1648 * may fire immediately.
1649 */
1650 WARN_ON(netif_running(efx->net_dev) &&
1651 netif_device_present(efx->net_dev));
1646 netif_tx_disable(efx->net_dev); 1652 netif_tx_disable(efx->net_dev);
1647 1653
1648 efx_stop_datapath(efx); 1654 efx_stop_datapath(efx);
@@ -1963,16 +1969,18 @@ static int efx_change_mtu(struct net_device *net_dev, int new_mtu)
1963 if (new_mtu > EFX_MAX_MTU) 1969 if (new_mtu > EFX_MAX_MTU)
1964 return -EINVAL; 1970 return -EINVAL;
1965 1971
1966 efx_stop_all(efx);
1967
1968 netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu); 1972 netif_dbg(efx, drv, efx->net_dev, "changing MTU to %d\n", new_mtu);
1969 1973
1974 efx_device_detach_sync(efx);
1975 efx_stop_all(efx);
1976
1970 mutex_lock(&efx->mac_lock); 1977 mutex_lock(&efx->mac_lock);
1971 net_dev->mtu = new_mtu; 1978 net_dev->mtu = new_mtu;
1972 efx->type->reconfigure_mac(efx); 1979 efx->type->reconfigure_mac(efx);
1973 mutex_unlock(&efx->mac_lock); 1980 mutex_unlock(&efx->mac_lock);
1974 1981
1975 efx_start_all(efx); 1982 efx_start_all(efx);
1983 netif_device_attach(efx->net_dev);
1976 return 0; 1984 return 0;
1977} 1985}
1978 1986