Skip to content

Commit

Permalink
sfc: Hold the RTNL lock for more of the suspend/resume cycle
Browse files Browse the repository at this point in the history
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: Ben Hutchings <bhutchings@solarflare.com>
  • Loading branch information
Ben Hutchings committed Aug 24, 2012
1 parent f16aeea commit 61da026
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions drivers/net/ethernet/sfc/efx.c
Original file line number Diff line number Diff line change
Expand Up @@ -2727,20 +2727,26 @@ static int efx_pm_freeze(struct device *dev)
{
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));

rtnl_lock();

efx->state = STATE_UNINIT;

netif_device_detach(efx->net_dev);

efx_stop_all(efx);
efx_stop_interrupts(efx, false);

rtnl_unlock();

return 0;
}

static int efx_pm_thaw(struct device *dev)
{
struct efx_nic *efx = pci_get_drvdata(to_pci_dev(dev));

rtnl_lock();

efx_start_interrupts(efx, false);

mutex_lock(&efx->mac_lock);
Expand All @@ -2755,6 +2761,8 @@ static int efx_pm_thaw(struct device *dev)

efx->type->resume_wol(efx);

rtnl_unlock();

/* Reschedule any quenched resets scheduled during efx_pm_freeze() */
queue_work(reset_workqueue, &efx->reset_work);

Expand Down

0 comments on commit 61da026

Please sign in to comment.