sfc: lock TX queues when calling netif_device_detach()
[pandora-kernel.git] / drivers / net / ethernet / sfc / efx.h
index 1355245..55e72af 100644 (file)
@@ -149,4 +149,17 @@ extern void efx_link_status_changed(struct efx_nic *efx);
 extern void efx_link_set_advertising(struct efx_nic *efx, u32);
 extern void efx_link_set_wanted_fc(struct efx_nic *efx, u8);
 
+static inline void efx_device_detach_sync(struct efx_nic *efx)
+{
+       struct net_device *dev = efx->net_dev;
+
+       /* Lock/freeze all TX queues so that we can be sure the
+        * TX scheduler is stopped when we're done and before
+        * netif_device_present() becomes false.
+        */
+       netif_tx_lock(dev);
+       netif_device_detach(dev);
+       netif_tx_unlock(dev);
+}
+
 #endif /* EFX_EFX_H */