diff options
author | Ben Hutchings <bhutchings@solarflare.com> | 2008-12-13 06:59:24 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2008-12-13 06:59:24 +0100 |
commit | 766ca0fa6bf1600bdf4bc7726c74f14c8455c6b8 (patch) | |
tree | b1ea2df622753f2493b1053fda21c0db3f18a043 /drivers/net/sfc/tenxpress.c | |
parent | sfc: Implement auto-negotiation (diff) | |
download | linux-766ca0fa6bf1600bdf4bc7726c74f14c8455c6b8.tar.xz linux-766ca0fa6bf1600bdf4bc7726c74f14c8455c6b8.zip |
sfc: Rework MAC, PHY and board event handling
From: Steve Hodgson <shodgson@solarflare.com>
MAC, PHY and board events may be separately enabled and signalled.
Our current arrangement of chaining the polling functions can result
in events being missed. Change them to be more independent.
Signed-off-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/tenxpress.c')
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 44 |
1 files changed, 14 insertions, 30 deletions
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index 634ff9198823..7256ea4abf9c 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c @@ -348,50 +348,34 @@ static void tenxpress_phy_reconfigure(struct efx_nic *efx) efx->link_fc = mdio_clause45_get_pause(efx); } -static void tenxpress_phy_clear_interrupt(struct efx_nic *efx) -{ - /* Nothing done here - LASI interrupts aren't reliable so poll */ -} - - /* Poll PHY for interrupt */ -static int tenxpress_phy_check_hw(struct efx_nic *efx) +static void tenxpress_phy_poll(struct efx_nic *efx) { struct tenxpress_phy_data *phy_data = efx->phy_data; - bool link_ok; - int rc = 0; + bool change = false, link_ok; + unsigned link_fc; link_ok = tenxpress_link_ok(efx); + if (link_ok != efx->link_up) { + change = true; + } else { + link_fc = mdio_clause45_get_pause(efx); + if (link_fc != efx->link_fc) + change = true; + } tenxpress_check_bad_lp(efx, link_ok); - if (link_ok != efx->link_up) + if (change) falcon_sim_phy_event(efx); if (phy_data->phy_mode != PHY_MODE_NORMAL) - return 0; + return; if (atomic_read(&phy_data->bad_crc_count) > crc_error_reset_threshold) { EFX_ERR(efx, "Resetting XAUI due to too many CRC errors\n"); falcon_reset_xaui(efx); atomic_set(&phy_data->bad_crc_count, 0); } - - rc = efx->board_info.monitor(efx); - if (rc) { - EFX_ERR(efx, "Board sensor %s; shutting down PHY\n", - (rc == -ERANGE) ? "reported fault" : "failed"); - if (efx->phy_mode & PHY_MODE_OFF) { - /* Assume that board has shut PHY off */ - phy_data->phy_mode = PHY_MODE_OFF; - } else { - efx->phy_mode |= PHY_MODE_LOW_POWER; - mdio_clause45_set_mmds_lpower(efx, true, - efx->phy_op->mmds); - phy_data->phy_mode |= PHY_MODE_LOW_POWER; - } - } - - return rc; } static void tenxpress_phy_fini(struct efx_nic *efx) @@ -461,9 +445,9 @@ struct efx_phy_operations falcon_tenxpress_phy_ops = { .macs = EFX_XMAC, .init = tenxpress_phy_init, .reconfigure = tenxpress_phy_reconfigure, - .check_hw = tenxpress_phy_check_hw, + .poll = tenxpress_phy_poll, .fini = tenxpress_phy_fini, - .clear_interrupt = tenxpress_phy_clear_interrupt, + .clear_interrupt = efx_port_dummy_op_void, .test = tenxpress_phy_test, .get_settings = tenxpress_get_settings, .set_settings = mdio_clause45_set_settings, |