aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/falcon.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2009-01-29 13:00:07 -0500
committerDavid S. Miller <davem@davemloft.net>2009-01-30 17:06:33 -0500
commit1974cc205e63cec4a17a6b3fca31fa4240ded77e (patch)
treed658cbc56064d86f3f57e786b4ebcf33346188bd /drivers/net/sfc/falcon.c
parentaf4ad9bca0c4039355b20d760b4fd39afa48c59d (diff)
sfc: Replace stats_enabled flag with a disable count
Currently we use a spin-lock to serialise statistics fetches and also to inhibit them for short periods of time, plus a flag to enable/disable statistics fetches for longer periods of time, during online reset. This was apparently insufficient to deal with the several reasons for stats being disabled. Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/falcon.c')
-rw-r--r--drivers/net/sfc/falcon.c15
1 files changed, 11 insertions, 4 deletions
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c
index d9412f83a78e..d5378e60fcdd 100644
--- a/drivers/net/sfc/falcon.c
+++ b/drivers/net/sfc/falcon.c
@@ -1883,7 +1883,7 @@ static int falcon_reset_macs(struct efx_nic *efx)
1883 1883
1884 /* MAC stats will fail whilst the TX fifo is draining. Serialise 1884 /* MAC stats will fail whilst the TX fifo is draining. Serialise
1885 * the drain sequence with the statistics fetch */ 1885 * the drain sequence with the statistics fetch */
1886 spin_lock(&efx->stats_lock); 1886 efx_stats_disable(efx);
1887 1887
1888 falcon_read(efx, &reg, MAC0_CTRL_REG_KER); 1888 falcon_read(efx, &reg, MAC0_CTRL_REG_KER);
1889 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1); 1889 EFX_SET_OWORD_FIELD(reg, TXFIFO_DRAIN_EN_B0, 1);
@@ -1913,7 +1913,7 @@ static int falcon_reset_macs(struct efx_nic *efx)
1913 udelay(10); 1913 udelay(10);
1914 } 1914 }
1915 1915
1916 spin_unlock(&efx->stats_lock); 1916 efx_stats_enable(efx);
1917 1917
1918 /* If we've reset the EM block and the link is up, then 1918 /* If we've reset the EM block and the link is up, then
1919 * we'll have to kick the XAUI link so the PHY can recover */ 1919 * we'll have to kick the XAUI link so the PHY can recover */
@@ -2273,6 +2273,10 @@ int falcon_switch_mac(struct efx_nic *efx)
2273 struct efx_mac_operations *old_mac_op = efx->mac_op; 2273 struct efx_mac_operations *old_mac_op = efx->mac_op;
2274 efx_oword_t nic_stat; 2274 efx_oword_t nic_stat;
2275 unsigned strap_val; 2275 unsigned strap_val;
2276 int rc = 0;
2277
2278 /* Don't try to fetch MAC stats while we're switching MACs */
2279 efx_stats_disable(efx);
2276 2280
2277 /* Internal loopbacks override the phy speed setting */ 2281 /* Internal loopbacks override the phy speed setting */
2278 if (efx->loopback_mode == LOOPBACK_GMAC) { 2282 if (efx->loopback_mode == LOOPBACK_GMAC) {
@@ -2302,13 +2306,16 @@ int falcon_switch_mac(struct efx_nic *efx)
2302 } 2306 }
2303 2307
2304 if (old_mac_op == efx->mac_op) 2308 if (old_mac_op == efx->mac_op)
2305 return 0; 2309 goto out;
2306 2310
2307 EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G'); 2311 EFX_LOG(efx, "selected %cMAC\n", EFX_IS10G(efx) ? 'X' : 'G');
2308 /* Not all macs support a mac-level link state */ 2312 /* Not all macs support a mac-level link state */
2309 efx->mac_up = true; 2313 efx->mac_up = true;
2310 2314
2311 return falcon_reset_macs(efx); 2315 rc = falcon_reset_macs(efx);
2316out:
2317 efx_stats_enable(efx);
2318 return rc;
2312} 2319}
2313 2320
2314/* This call is responsible for hooking in the MAC and PHY operations */ 2321/* This call is responsible for hooking in the MAC and PHY operations */