Commit 1dfc5cea authored by Ben Hutchings's avatar Ben Hutchings Committed by David S. Miller

sfc: Hold MAC lock for longer in efx_init_port()

Although efx_init_port() is only called at probe time and so cannot
race with port reconfiguration, most of the functions it calls can
expect to be called with the MAC lock held.
Signed-off-by: default avatarBen Hutchings <bhutchings@solarflare.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 26deba50
...@@ -737,23 +737,27 @@ static int efx_init_port(struct efx_nic *efx) ...@@ -737,23 +737,27 @@ static int efx_init_port(struct efx_nic *efx)
EFX_LOG(efx, "init port\n"); EFX_LOG(efx, "init port\n");
mutex_lock(&efx->mac_lock);
rc = efx->phy_op->init(efx); rc = efx->phy_op->init(efx);
if (rc) if (rc)
return rc; goto fail1;
mutex_lock(&efx->mac_lock);
efx->phy_op->reconfigure(efx); efx->phy_op->reconfigure(efx);
rc = falcon_switch_mac(efx); rc = falcon_switch_mac(efx);
mutex_unlock(&efx->mac_lock);
if (rc) if (rc)
goto fail; goto fail2;
efx->mac_op->reconfigure(efx); efx->mac_op->reconfigure(efx);
efx->port_initialized = true; efx->port_initialized = true;
efx_stats_enable(efx); efx_stats_enable(efx);
mutex_unlock(&efx->mac_lock);
return 0; return 0;
fail: fail2:
efx->phy_op->fini(efx); efx->phy_op->fini(efx);
fail1:
mutex_unlock(&efx->mac_lock);
return rc; return rc;
} }
......
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