diff options
author | Heiner Kallweit <hkallweit1@gmail.com> | 2019-03-31 19:54:07 +0200 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2019-04-02 13:16:17 -0700 |
commit | 372fcc1b8b66148367af8374d09d48b6a0385faf (patch) | |
tree | b5bf6c846595526713022e0ee9f82bc05907f9e9 /drivers/net/phy/phy-c45.c | |
parent | 5d237a07f131938e3e35635d483397a0ef0901e6 (diff) |
net: phy: deal properly with autoneg incomplete in genphy_c45_read_lpa
The link partner advertisement registers are not guaranteed to contain
valid values if autoneg is incomplete. Therefore, if
MDIO_AN_STAT1_COMPLETE isn't set, let's clear all link partner
capability bits. This also avoids unnecessary register reads if link
is down and phylib is in polling mode.
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/phy/phy-c45.c')
-rw-r--r-- | drivers/net/phy/phy-c45.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c index 666fbb0eec04..05c3e87ffc2d 100644 --- a/drivers/net/phy/phy-c45.c +++ b/drivers/net/phy/phy-c45.c @@ -266,6 +266,17 @@ int genphy_c45_read_lpa(struct phy_device *phydev) if (val < 0) return val; + if (!(val & MDIO_AN_STAT1_COMPLETE)) { + linkmode_clear_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, + phydev->lp_advertising); + mii_10gbt_stat_mod_linkmode_lpa_t(phydev->lp_advertising, 0); + mii_adv_mod_linkmode_adv_t(phydev->lp_advertising, 0); + phydev->pause = 0; + phydev->asym_pause = 0; + + return 0; + } + linkmode_mod_bit(ETHTOOL_LINK_MODE_Autoneg_BIT, phydev->lp_advertising, val & MDIO_AN_STAT1_LPABLE); |