net: phy: fix aneg restart in phy_ethtool_set_eee
authorHeiner Kallweit <hkallweit1@gmail.com>
Tue, 12 May 2020 19:45:53 +0000 (21:45 +0200)
committerDavid S. Miller <davem@davemloft.net>
Wed, 13 May 2020 22:21:59 +0000 (15:21 -0700)
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")
Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c

index 72c69a9c8a98aef62cdef34a186fa3b7b1657a44..20ca6418f7bc7ff34347310078884c2547a35fcd 100644 (file)
@@ -1132,9 +1132,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;