aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/sfc/sfe4001.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/sfe4001.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/sfe4001.c')
-rw-r--r--drivers/net/sfc/sfe4001.c15
1 files changed, 14 insertions, 1 deletions
diff --git a/drivers/net/sfc/sfe4001.c b/drivers/net/sfc/sfe4001.c
index 853057e87fb2..cb25ae5b257a 100644
--- a/drivers/net/sfc/sfe4001.c
+++ b/drivers/net/sfc/sfe4001.c
@@ -235,12 +235,18 @@ static ssize_t set_phy_flash_cfg(struct device *dev,
235 } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) { 235 } else if (efx->state != STATE_RUNNING || netif_running(efx->net_dev)) {
236 err = -EBUSY; 236 err = -EBUSY;
237 } else { 237 } else {
238 /* Reset the PHY, reconfigure the MAC and enable/disable
239 * MAC stats accordingly. */
238 efx->phy_mode = new_mode; 240 efx->phy_mode = new_mode;
241 if (new_mode & PHY_MODE_SPECIAL)
242 efx_stats_disable(efx);
239 if (efx->board_info.type == EFX_BOARD_SFE4001) 243 if (efx->board_info.type == EFX_BOARD_SFE4001)
240 err = sfe4001_poweron(efx); 244 err = sfe4001_poweron(efx);
241 else 245 else
242 err = sfn4111t_reset(efx); 246 err = sfn4111t_reset(efx);
243 efx_reconfigure_port(efx); 247 efx_reconfigure_port(efx);
248 if (!(new_mode & PHY_MODE_SPECIAL))
249 efx_stats_enable(efx);
244 } 250 }
245 rtnl_unlock(); 251 rtnl_unlock();
246 252
@@ -329,6 +335,11 @@ int sfe4001_init(struct efx_nic *efx)
329 efx->board_info.monitor = sfe4001_check_hw; 335 efx->board_info.monitor = sfe4001_check_hw;
330 efx->board_info.fini = sfe4001_fini; 336 efx->board_info.fini = sfe4001_fini;
331 337
338 if (efx->phy_mode & PHY_MODE_SPECIAL) {
339 /* PHY won't generate a 156.25 MHz clock and MAC stats fetch
340 * will fail. */
341 efx_stats_disable(efx);
342 }
332 rc = sfe4001_poweron(efx); 343 rc = sfe4001_poweron(efx);
333 if (rc) 344 if (rc)
334 goto fail_ioexp; 345 goto fail_ioexp;
@@ -405,8 +416,10 @@ int sfn4111t_init(struct efx_nic *efx)
405 if (rc) 416 if (rc)
406 goto fail_hwmon; 417 goto fail_hwmon;
407 418
408 if (efx->phy_mode & PHY_MODE_SPECIAL) 419 if (efx->phy_mode & PHY_MODE_SPECIAL) {
420 efx_stats_disable(efx);
409 sfn4111t_reset(efx); 421 sfn4111t_reset(efx);
422 }
410 423
411 return 0; 424 return 0;
412 425