Skip to content

Commit 34d5a86

Browse files
dangowrtdavem330
authored andcommitted
net: phy: realtek: clear 1000Base-T lpa if link is down
Only read 1000Base-T link partner advertisement if autonegotiation has completed and otherwise 1000Base-T link partner advertisement bits. This fixes bogus 1000Base-T link partner advertisement after link goes down (eg. by disconnecting the wire). Fixes: 5cb409b ("net: phy: realtek: clear 1000Base-T link partner advertisement") Signed-off-by: Daniel Golle <[email protected]> Reviewed-by: Michal Swiatkowski <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent ce69b40 commit 34d5a86

File tree

1 file changed

+8
-11
lines changed

1 file changed

+8
-11
lines changed

drivers/net/phy/realtek.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1023,23 +1023,20 @@ static int rtl822x_c45_read_status(struct phy_device *phydev)
10231023
{
10241024
int ret, val;
10251025

1026-
ret = genphy_c45_read_status(phydev);
1027-
if (ret < 0)
1028-
return ret;
1029-
1030-
if (phydev->autoneg == AUTONEG_DISABLE ||
1031-
!genphy_c45_aneg_done(phydev))
1032-
mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, 0);
1033-
10341026
/* Vendor register as C45 has no standardized support for 1000BaseT */
1035-
if (phydev->autoneg == AUTONEG_ENABLE) {
1027+
if (phydev->autoneg == AUTONEG_ENABLE && genphy_c45_aneg_done(phydev)) {
10361028
val = phy_read_mmd(phydev, MDIO_MMD_VEND2,
10371029
RTL822X_VND2_GANLPAR);
10381030
if (val < 0)
10391031
return val;
1040-
1041-
mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val);
1032+
} else {
1033+
val = 0;
10421034
}
1035+
mii_stat1000_mod_linkmode_lpa_t(phydev->lp_advertising, val);
1036+
1037+
ret = genphy_c45_read_status(phydev);
1038+
if (ret < 0)
1039+
return ret;
10431040

10441041
if (!phydev->link)
10451042
return 0;

0 commit comments

Comments
 (0)