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>
This commit is contained in:
Ben Hutchings 2008-12-26 13:49:25 -08:00 committed by David S. Miller
parent f4bd954e7c
commit 843813453f

View file

@ -368,13 +368,16 @@ void mdio_clause45_get_settings_ext(struct efx_nic *efx,
} else } else
ecmd->autoneg = AUTONEG_DISABLE; ecmd->autoneg = AUTONEG_DISABLE;
/* If AN is enabled and complete, report best common mode */ if (ecmd->autoneg) {
if (ecmd->autoneg && /* If AN is complete, report best common mode,
(mdio_clause45_read(efx, phy_id, MDIO_MMD_AN, MDIO_MMDREG_STAT1) & * otherwise report best advertised mode. */
(1 << MDIO_AN_STATUS_AN_DONE_LBN))) { u32 common = ecmd->advertising;
u32 common, lpa; if (mdio_clause45_read(efx, phy_id, MDIO_MMD_AN,
lpa = mdio_clause45_get_an(efx, MDIO_AN_LPA, xnp_lpa); MDIO_MMDREG_STAT1) &
common = ecmd->advertising & lpa; (1 << MDIO_AN_STATUS_AN_DONE_LBN)) {
common &= mdio_clause45_get_an(efx, MDIO_AN_LPA,
xnp_lpa);
}
if (common & ADVERTISED_10000baseT_Full) { if (common & ADVERTISED_10000baseT_Full) {
ecmd->speed = SPEED_10000; ecmd->speed = SPEED_10000;
ecmd->duplex = DUPLEX_FULL; ecmd->duplex = DUPLEX_FULL;