lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <E1vJVWF-0000000E5F2-0cKz@rmk-PC.armlinux.org.uk>
Date: Thu, 13 Nov 2025 11:29:39 +0000
From: "Russell King (Oracle)" <rmk+kernel@...linux.org.uk>
To: Andrew Lunn <andrew@...n.ch>,
	Heiner Kallweit <hkallweit1@...il.com>
Cc: "David S. Miller" <davem@...emloft.net>,
	Eric Dumazet <edumazet@...gle.com>,
	Jakub Kicinski <kuba@...nel.org>,
	netdev@...r.kernel.org,
	Paolo Abeni <pabeni@...hat.com>
Subject: [PATCH net-next v2 1/2] net: phy: allow drivers to disable EEE
 support via .get_features()

Allow PHY drivers to hook the .get_features() method to disable EEE
support. This is useful for TI PHYs, where we have a statement that
none of their gigabit products support EEE, yet at least DP83867
reports EEE capabilties and implements EEE negotiation.

Reviewed-by: Oleksij Rempel <o.rempel@...gutronix.de>
Signed-off-by: Russell King (Oracle) <rmk+kernel@...linux.org.uk>
---
 drivers/net/phy/phy-core.c   |  2 --
 drivers/net/phy/phy_device.c | 32 +++++++++++++++++++++++++++++---
 include/linux/phy.h          |  1 +
 3 files changed, 30 insertions(+), 5 deletions(-)

diff --git a/drivers/net/phy/phy-core.c b/drivers/net/phy/phy-core.c
index 605ca20ae192..43ccbd3a09f8 100644
--- a/drivers/net/phy/phy-core.c
+++ b/drivers/net/phy/phy-core.c
@@ -207,8 +207,6 @@ void of_set_phy_eee_broken(struct phy_device *phydev)
 	if (!IS_ENABLED(CONFIG_OF_MDIO) || !node)
 		return;
 
-	linkmode_zero(modes);
-
 	if (of_property_read_bool(node, "eee-broken-100tx"))
 		linkmode_set_bit(ETHTOOL_LINK_MODE_100baseT_Full_BIT, modes);
 	if (of_property_read_bool(node, "eee-broken-1000t"))
diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 81984d4ebb7c..b384f99a40f2 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -3397,6 +3397,34 @@ struct fwnode_handle *fwnode_get_phy_node(const struct fwnode_handle *fwnode)
 }
 EXPORT_SYMBOL_GPL(fwnode_get_phy_node);
 
+static int phy_get_features(struct phy_device *phydev)
+{
+	int err;
+
+	if (phydev->is_c45)
+		err = genphy_c45_pma_read_abilities(phydev);
+	else
+		err = genphy_read_abilities(phydev);
+
+	return err;
+}
+
+/**
+ * phy_get_features_no_eee - read the PHY features, disabling all EEE
+ * @phydev: phy_device structure to be added to the MDIO bus
+ *
+ * Read the PHY features, and fill the @phydev->eee_disabled_modes to
+ * prevent EEE being used. This is intended to be used for PHY .get_feature
+ * methods where a PHY reports incorrect capabilities.
+ */
+int phy_get_features_no_eee(struct phy_device *phydev)
+{
+	linkmode_fill(phydev->eee_disabled_modes);
+
+	return phy_get_features(phydev);
+}
+EXPORT_SYMBOL_GPL(phy_get_features_no_eee);
+
 /**
  * phy_probe - probe and init a PHY device
  * @dev: device to probe and init
@@ -3442,10 +3470,8 @@ static int phy_probe(struct device *dev)
 	}
 	else if (phydrv->get_features)
 		err = phydrv->get_features(phydev);
-	else if (phydev->is_c45)
-		err = genphy_c45_pma_read_abilities(phydev);
 	else
-		err = genphy_read_abilities(phydev);
+		err = phy_get_features(phydev);
 
 	if (err)
 		goto out;
diff --git a/include/linux/phy.h b/include/linux/phy.h
index bf5457341ca8..2655c0ae6488 100644
--- a/include/linux/phy.h
+++ b/include/linux/phy.h
@@ -2299,6 +2299,7 @@ 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);
+int phy_get_features_no_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);
-- 
2.47.3


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ