aboutsummaryrefslogtreecommitdiff
path: root/drivers/net/sfc/mdio_10g.c
diff options
context:
space:
mode:
authorBen Hutchings <bhutchings@solarflare.com>2008-12-26 13:49:25 -0800
committerDavid S. Miller <davem@davemloft.net>2008-12-26 13:49:25 -0800
commit843813453f52e3378fc988c8364063fd4cb9d0e3 (patch)
treed17c5d80afd77f58e95dccaff53d6e4c671b3fa6 /drivers/net/sfc/mdio_10g.c
parentf4bd954e7c24063b15fa9abc8b4b1242772928ed (diff)
sfc: If AN is enabled, always read speed/duplex from the AN advertising bits
When AN is enabled and the link is down the speed/duplex control bits will not be meaningful. Use the advertising bits instead, and mask them with the LPA bits if and only if AN is complete (as before). Signed-off-by: Ben Hutchings <bhutchings@solarflare.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc/mdio_10g.c')
-rw-r--r--drivers/net/sfc/mdio_10g.c17
1 files changed, 10 insertions, 7 deletions
diff --git a/drivers/net/sfc/mdio_10g.c b/drivers/net/sfc/mdio_10g.c
index f131ad2b683..f6a16428113 100644
--- a/drivers/net/sfc/mdio_10g.c
+++ b/drivers/net/sfc/mdio_10g.c
@@ -368,13 +368,16 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
} else
ecmd->autoneg = AUTONEG_DISABLE;
- /* If AN is enabled and complete, report best common mode */
- if (ecmd->autoneg &&
- (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, MDIO_MMDREG_STAT1) &
- (1 << MDIO_AN_STATUS_AN_DONE_LBN))) {
- u32 common, lpa;
- lpa = mdio_clause45_get_an(efx, MDIO_AN_LPA, xnp_lpa);
- common = ecmd->advertising & lpa;
+ if (ecmd->autoneg) {
+ /* If AN is complete, report best common mode,
+ * otherwise report best advertised mode. */
+ u32 common = ecmd->advertising;
+ if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
+ MDIO_MMDREG_STAT1) &
+ (1 << MDIO_AN_STATUS_AN_DONE_LBN)) {
+ common &= mdio_clause45_get_an(efx, MDIO_AN_LPA,
+ xnp_lpa);
+ }
if (common & ADVERTISED_10000baseT_Full) {
ecmd->speed = SPEED_10000;
ecmd->duplex = DUPLEX_FULL;