]> www.infradead.org Git - users/dwmw2/linux.git/commitdiff
net: phy: add phy_disable_eee
authorHeiner Kallweit <hkallweit1@gmail.com>
Mon, 16 Dec 2024 21:31:18 +0000 (22:31 +0100)
committerJakub Kicinski <kuba@kernel.org>
Fri, 20 Dec 2024 03:07:48 +0000 (19:07 -0800)
If a MAC driver doesn't support EEE, then the PHY shouldn't advertise it.
Add phy_disable_eee() for this purpose.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/fd51738c-dcd6-4d61-b8c5-faa6ac0f1026@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/phy_device.c
include/linux/phy.h

index 1a908af4175b2c6a0dd856a531359cf751839a36..928dc3c509b66de5bea9dbaf51f7e637fb42995f 100644 (file)
@@ -3003,6 +3003,22 @@ void phy_support_eee(struct phy_device *phydev)
 }
 EXPORT_SYMBOL(phy_support_eee);
 
+/**
+ * phy_disable_eee - Disable EEE for the PHY
+ * @phydev: Target phy_device struct
+ *
+ * This function is used by MAC drivers for MAC's which don't support EEE.
+ * It disables EEE on the PHY layer.
+ */
+void phy_disable_eee(struct phy_device *phydev)
+{
+       linkmode_zero(phydev->supported_eee);
+       linkmode_zero(phydev->advertising_eee);
+       phydev->eee_cfg.tx_lpi_enabled = false;
+       phydev->eee_cfg.eee_enabled = false;
+}
+EXPORT_SYMBOL_GPL(phy_disable_eee);
+
 /**
  * phy_support_sym_pause - Enable support of symmetrical pause
  * @phydev: target phy_device struct
index e597a32cc787a3b142f9b012e0ea5004f7c6b560..5bc71d59910c3fbcf16f85714302073f228ed384 100644 (file)
@@ -2071,6 +2071,7 @@ void phy_advertise_eee_all(struct phy_device *phydev);
 void phy_support_sym_pause(struct phy_device *phydev);
 void phy_support_asym_pause(struct phy_device *phydev);
 void phy_support_eee(struct phy_device *phydev);
+void phy_disable_eee(struct phy_device *phydev);
 void phy_set_sym_pause(struct phy_device *phydev, bool rx, bool tx,
                       bool autoneg);
 void phy_set_asym_pause(struct phy_device *phydev, bool rx, bool tx);