Skip to contentSkip to conversation

net: phy: fix genphy_c45_eee_is_active() for disabled EEE

PATCH Applied Russell King (Oracle) 3 participants 3 messages Mar 16, 2025 – Mar 21, 2025

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 net: phy: fix genphy_c45_eee_is_active() for disabled EEE

Commit 809265fe96fe ("net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active") stopped reading the local advertisement from the PHY earlier in this development cycle, which broke "ethtool --set-eee ethX eee off".

When ethtool is used to set EEE off, genphy_c45_eee_is_active() indicates that EEE was active if the link partner reported an advertisement, which causes phylib to set phydev->enable_tx_lpi on link up, despite our local advertisement in hardware being empty. However, phydev->advertising_eee is preserved while EEE is turned off, which leads to genphy_c45_eee_is_active() incorrectly reporting that EEE is active.

Fix it by checking phydev->eee_cfg.eee_enabled, and if clear, immediately indicate that EEE is not active.

---
 drivers/net/phy/phy-c45.c | 3 +++
 1 file changed, 3 insertions(+)
drivers/net/phy/phy-c45.c +3 -0
index 0bcbdce38107..f1973ed90072 100644
@@ -1476,6 +1476,9 @@ int genphy_c45_eee_is_active(struct phy_device *phydev, unsigned long *lp)
 	__ETHTOOL_DECLARE_LINK_MODE_MASK(common);
 	int ret;
 
+	if (!phydev->eee_cfg.eee_enabled)
+		return 0;
+
 	ret = genphy_c45_read_eee_lpa(phydev, tmp_lp);
 	if (ret)
 		return ret;
Signature · 1 line
2.30.2
maintainer Reviewed-by on v1 1/1
#1 lore raw
Quoted 13 lines · Russell King (Oracle)

Commit 809265fe96fe ("net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active") stopped reading the local advertisement from the PHY earlier in this development cycle, which broke "ethtool --set-eee ethX eee off".

When ethtool is used to set EEE off, genphy_c45_eee_is_active() indicates that EEE was active if the link partner reported an advertisement, which causes phylib to set phydev->enable_tx_lpi on link up, despite our local advertisement in hardware being empty. However, phydev->advertising_eee is preserved while EEE is turned off, which leads to genphy_c45_eee_is_active() incorrectly reporting that EEE is active.

Quoted 4 lines

Fix it by checking phydev->eee_cfg.eee_enabled, and if clear, immediately indicate that EEE is not active.

Andrew

#2 lore raw
In reply to Russell King (Oracle)
This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Hello:

This patch was applied to netdev/net-next.git (main) by Paolo Abeni <[email protected]>:

Quoted 13 lines · On Sun, 16 Mar 2025 11:51:11 +0000 you wrote:

Commit 809265fe96fe ("net: phy: c45: remove local advertisement parameter from genphy_c45_eee_is_active") stopped reading the local advertisement from the PHY earlier in this development cycle, which broke "ethtool --set-eee ethX eee off".

When ethtool is used to set EEE off, genphy_c45_eee_is_active() indicates that EEE was active if the link partner reported an advertisement, which causes phylib to set phydev->enable_tx_lpi on link up, despite our local advertisement in hardware being empty. However, phydev->advertising_eee is preserved while EEE is turned off, which leads to genphy_c45_eee_is_active() incorrectly reporting that EEE is active.

Quoted 1 line

[...]

Here is the summary with links:
- [net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE

    https://git.kernel.org/netdev/net-next/c/4b9235a880f1

You are awesome, thank you!

Signature · 2 lines
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html