netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE
@ 2025-03-16 11:51 Russell King (Oracle)
  2025-03-17 21:35 ` Andrew Lunn
  2025-03-21 20:50 ` patchwork-bot+netdevbpf
  0 siblings, 2 replies; 3+ messages in thread
From: Russell King (Oracle) @ 2025-03-16 11:51 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: David S. Miller, Eric Dumazet, Jakub Kicinski, netdev,
	Paolo Abeni

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.

Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
---
 drivers/net/phy/phy-c45.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index 0bcbdce38107..f1973ed90072 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -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;
-- 
2.30.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE
  2025-03-16 11:51 [PATCH net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE Russell King (Oracle)
@ 2025-03-17 21:35 ` Andrew Lunn
  2025-03-21 20:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: Andrew Lunn @ 2025-03-17 21:35 UTC (permalink / raw)
  To: Russell King (Oracle)
  Cc: Heiner Kallweit, David S. Miller, Eric Dumazet, Jakub Kicinski,
	netdev, Paolo Abeni

On Sun, Mar 16, 2025 at 11:51:11AM +0000, Russell King (Oracle) 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.
> 
> Fix it by checking phydev->eee_cfg.eee_enabled, and if clear,
> immediately indicate that EEE is not active.
> 
> Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

    Andrew

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE
  2025-03-16 11:51 [PATCH net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE Russell King (Oracle)
  2025-03-17 21:35 ` Andrew Lunn
@ 2025-03-21 20:50 ` patchwork-bot+netdevbpf
  1 sibling, 0 replies; 3+ messages in thread
From: patchwork-bot+netdevbpf @ 2025-03-21 20:50 UTC (permalink / raw)
  To: Russell King; +Cc: andrew, hkallweit1, davem, edumazet, kuba, netdev, pabeni

Hello:

This patch was applied to netdev/net-next.git (main)
by Paolo Abeni <pabeni@redhat.com>:

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.
> 
> [...]

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!
-- 
Deet-doot-dot, I am a bot.
https://korg.docs.kernel.org/patchwork/pwbot.html



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-03-21 20:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-16 11:51 [PATCH net-next] net: phy: fix genphy_c45_eee_is_active() for disabled EEE Russell King (Oracle)
2025-03-17 21:35 ` Andrew Lunn
2025-03-21 20:50 ` patchwork-bot+netdevbpf

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).