Commit 61da026d authored by Ben Hutchings's avatar Ben Hutchings

sfc: Hold the RTNL lock for more of the suspend/resume cycle

I don't think these PM functions can race with userland net device
operations, but it's much easier to reason about locking if state is
consistently guarded by the same lock.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
parent f16aeea0
...@@ -2727,6 +2727,8 @@ static int efx_pm_freeze(struct device *dev) ...@@ -2727,6 +2727,8 @@ static int efx_pm_freeze(struct device *dev)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
rtnl_lock();
efx->state = STATE_UNINIT; efx->state = STATE_UNINIT;
netif_device_detach(efx->net_dev); netif_device_detach(efx->net_dev);
...@@ -2734,6 +2736,8 @@ static int efx_pm_freeze(struct device *dev) ...@@ -2734,6 +2736,8 @@ static int efx_pm_freeze(struct device *dev)
efx_stop_all(efx); efx_stop_all(efx);
efx_stop_interrupts(efx, false); efx_stop_interrupts(efx, false);
rtnl_unlock();
return 0; return 0;
} }
...@@ -2741,6 +2745,8 @@ static int efx_pm_thaw(struct device *dev) ...@@ -2741,6 +2745,8 @@ static int efx_pm_thaw(struct device *dev)
{ {
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev)); struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));
rtnl_lock();
efx_start_interrupts(efx, false); efx_start_interrupts(efx, false);
mutex_lock(&efx->mac_lock); mutex_lock(&efx->mac_lock);
...@@ -2755,6 +2761,8 @@ static int efx_pm_thaw(struct device *dev) ...@@ -2755,6 +2761,8 @@ static int efx_pm_thaw(struct device *dev)
efx->type->resume_wol(efx); efx->type->resume_wol(efx);
rtnl_unlock();
/* Reschedule any quenched resets scheduled during efx_pm_freeze() */ /* Reschedule any quenched resets scheduled during efx_pm_freeze() */
queue_work(reset_workqueue, &efx->reset_work); queue_work(reset_workqueue, &efx->reset_work);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment