EEE requires aneg and full duplex, therefore return EPROTONOSUPPORT
if aneg is disabled or aneg resulted in a half duplex mode.

Signed-off-by: Heiner Kallweit <hkallwe...@gmail.com>
---
 drivers/net/phy/phy.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index 8c22d02b4..891bb6929 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -1110,6 +1110,9 @@ int phy_ethtool_set_eee(struct phy_device *phydev, struct 
ethtool_eee *data)
        if (!phydev->drv)
                return -EIO;
 
+       if (phydev->autoneg == AUTONEG_DISABLE || phydev->duplex == DUPLEX_HALF)
+               return -EPROTONOSUPPORT;
+
        /* Get Supported EEE */
        cap = phy_read_mmd(phydev, MDIO_MMD_PCS, MDIO_PCS_EEE_ABLE);
        if (cap < 0)
-- 
2.26.2


Reply via email to