Skip to contentSkip to conversation

net: phy: fix aneg restart in phy_ethtool_set_eee

PATCH In review Heiner Kallweit 2 participants 2 messages May 12, 2020 – May 13, 2020

Subsystems (3)
lore
Share & tools
lore

Heiner Kallweit

author maintainer
#0 lore raw

PATCH 1/1 net: phy: fix aneg restart in phy_ethtool_set_eee

phy_restart_aneg() enables aneg in the PHY. That's not what we want if phydev->autoneg is disabled. In this case still update EEE advertisement register, but don't enable aneg and don't trigger an aneg restart.

Fixes f75abeb8338e ("net: phy: restart phy autonegotiation after EEE advertisment change")
---
 drivers/net/phy/phy.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/net/phy/phy.c +5 -3
index 9bdc924ee..d4bbf79da 100644
@@ -1240,9 +1240,11 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct ethtool_eee *data)
 		/* Restart autonegotiation so the new modes get sent to the
 		 * link partner.
 		 */
-		ret = phy_restart_aneg(phydev);
-		if (ret < 0)
-			return ret;
+		if (phydev->autoneg == AUTONEG_ENABLE) {
+			ret = phy_restart_aneg(phydev);
+			if (ret < 0)
+				return ret;
+		}
 	}
 
 	return 0;
Signature · 1 line
2.26.2
maintainer
#1 lore raw

From: Heiner Kallweit <[email protected]>
Date: Tue, 12 May 2020 21:45:53 +0200

Quoted 7 lines

phy_restart_aneg() enables aneg in the PHY. That's not what we want if phydev->autoneg is disabled. In this case still update EEE advertisement register, but don't enable aneg and don't trigger an aneg restart.

Fixes f75abeb8338e ("net: phy: restart phy autonegotiation after EEE advertisment change")

Applied and queued up for -stable, thanks.