mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE
@ 2026-05-18  8:23 Nicolai Buchwitz
  2026-05-18  8:23 ` [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee() Nicolai Buchwitz
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Nicolai Buchwitz @ 2026-05-18  8:23 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Oleksij Rempel
  Cc: netdev, linux-kernel, Nicolai Buchwitz

While debugging why ethtool --show-eee reports "not supported" on a
Raspberry Pi CM4 with eee-broken-1000t / eee-broken-100tx set on the
PHY node, I noticed two phylib helpers copy phydev->supported_eee
into phydev->advertising_eee without applying
phydev->eee_disabled_modes: phy_support_eee() and
phy_advertise_eee_all(). That undoes the filtering phy_probe() set
up after of_set_phy_eee_broken(), so the PHY ends up advertising EEE
for modes that were marked broken in DT (or by the driver via
eee_disabled_modes).

The visible effect on MAC drivers that call phy_support_eee() after
probe (bcmgenet, fec, lan743x, lan78xx, r8169) is that ethtool on the
local interface reports "not supported" (because supported is masked
by eee_disabled_modes and ends up empty), while the link partner
happily sees EEE negotiated and active.

Patch 1 fixes phy_support_eee(). Patch 2 fixes phy_advertise_eee_all(),
which is also reached from genphy_c45_ethtool_set_eee() when user
space passes an empty advertisement.

I went through the other users of supported_eee as suggested by Andrew
and they look fine:

  - phy_probe() already masks via eee_disabled_modes after
    of_set_phy_eee_broken().
  - genphy_c45_ethtool_get_eee() masks supported_eee with
    eee_disabled_modes when reporting to user space.
  - genphy_c45_ethtool_set_eee() masks user-supplied adv against
    eee_disabled_modes, and the empty-adv path is now covered by
    patch 2.
  - genphy_c45_read_eee_abilities(), read_eee_cap1/cap2 populate
    supported_eee from PHY registers (source of truth).
  - genphy_c45_read_eee_adv(), read_eee_lpa() and write_eee_adv() use
    supported_eee only to gate which MMD registers to access, not to
    construct an advertisement.

Changes since v1:
  - Add patch 2 fixing phy_advertise_eee_all() (Andrew Lunn)

Previous version:

v1: https://lore.kernel.org/netdev/20260516-devel-phy-support-eee-fix-v1-1-59debc00eda0@tipi-net.de/
---
Nicolai Buchwitz (2):
      net: phy: honor eee_disabled_modes in phy_support_eee()
      net: phy: honor eee_disabled_modes in phy_advertise_eee_all()

 drivers/net/phy/phy_device.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
---
base-commit: aaec7096f9961eb223b5b149abe9495525c205d9
change-id: 20260516-devel-phy-support-eee-fix-d9cf040a6557

Best regards,
-- 
Nicolai Buchwitz <nb@tipi-net.de>


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

* [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee()
  2026-05-18  8:23 [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE Nicolai Buchwitz
@ 2026-05-18  8:23 ` Nicolai Buchwitz
  2026-05-19  2:19   ` Andrew Lunn
  2026-05-18  8:23 ` [PATCH net v2 2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all() Nicolai Buchwitz
  2026-05-20  2:00 ` [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE patchwork-bot+netdevbpf
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolai Buchwitz @ 2026-05-18  8:23 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Oleksij Rempel
  Cc: netdev, linux-kernel, Nicolai Buchwitz

phy_support_eee() copies supported_eee into advertising_eee
unconditionally, overwriting any filtering applied during phy_probe()
based on DT eee-broken-* properties or driver-populated
eee_disabled_modes. MAC drivers that call phy_support_eee() after
probe (e.g. bcmgenet, fec, lan743x, lan78xx, r8169) then cause the PHY
to advertise EEE for modes the user marked as broken.

The symptom is that ethtool --show-eee on the local interface reports
"not supported" (supported & ~eee_disabled_modes is empty) while the
link partner sees EEE negotiated and active.

phy_probe() already filters advertising_eee via eee_disabled_modes
after calling of_set_phy_eee_broken(). Apply the same mask in
phy_support_eee() so the filtering survives the copy.

Fixes: 49168d1980e2 ("net: phy: Add phy_support_eee() indicating MAC support EEE")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/phy/phy_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index c2cdf1ae354249c033445f2d942e07220205b41c..83b074bc4a8f716b3e10c8ff57aff7c7abba0236 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2903,7 +2903,8 @@ EXPORT_SYMBOL_GPL(phy_advertise_eee_all);
  */
 void phy_support_eee(struct phy_device *phydev)
 {
-	linkmode_copy(phydev->advertising_eee, phydev->supported_eee);
+	linkmode_andnot(phydev->advertising_eee, phydev->supported_eee,
+			phydev->eee_disabled_modes);
 	phydev->eee_cfg.tx_lpi_enabled = true;
 	phydev->eee_cfg.eee_enabled = true;
 

-- 
2.51.0


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

* [PATCH net v2 2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all()
  2026-05-18  8:23 [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE Nicolai Buchwitz
  2026-05-18  8:23 ` [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee() Nicolai Buchwitz
@ 2026-05-18  8:23 ` Nicolai Buchwitz
  2026-05-19 11:56   ` Andrew Lunn
  2026-05-20  2:00 ` [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE patchwork-bot+netdevbpf
  2 siblings, 1 reply; 8+ messages in thread
From: Nicolai Buchwitz @ 2026-05-18  8:23 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit, Russell King, David S. Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, Oleksij Rempel
  Cc: netdev, linux-kernel, Nicolai Buchwitz

phy_advertise_eee_all() copies supported_eee into advertising_eee
unconditionally, overwriting any filtering applied during phy_probe()
based on DT eee-broken-* properties or driver-populated
eee_disabled_modes. genphy_c45_ethtool_set_eee() calls this helper
when user space passes an empty advertisement, undoing the filtering.

Apply the same eee_disabled_modes mask in phy_advertise_eee_all() so
the filtering survives the copy, matching the pattern in phy_probe()
and phy_support_eee().

Fixes: b64691274f5d ("net: phy: add helper phy_advertise_eee_all")
Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
---
 drivers/net/phy/phy_device.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
index 83b074bc4a8f716b3e10c8ff57aff7c7abba0236..3370eb822017b264cfc26881b0eade8a49e1530f 100644
--- a/drivers/net/phy/phy_device.c
+++ b/drivers/net/phy/phy_device.c
@@ -2877,7 +2877,8 @@ EXPORT_SYMBOL(phy_advertise_supported);
  */
 void phy_advertise_eee_all(struct phy_device *phydev)
 {
-	linkmode_copy(phydev->advertising_eee, phydev->supported_eee);
+	linkmode_andnot(phydev->advertising_eee, phydev->supported_eee,
+			phydev->eee_disabled_modes);
 }
 EXPORT_SYMBOL_GPL(phy_advertise_eee_all);
 

-- 
2.51.0


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

* Re: [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee()
  2026-05-18  8:23 ` [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee() Nicolai Buchwitz
@ 2026-05-19  2:19   ` Andrew Lunn
  2026-05-19  6:20     ` Nicolai Buchwitz
  0 siblings, 1 reply; 8+ messages in thread
From: Andrew Lunn @ 2026-05-19  2:19 UTC (permalink / raw)
  To: Nicolai Buchwitz
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Oleksij Rempel, netdev,
	linux-kernel

On Mon, May 18, 2026 at 10:23:09AM +0200, Nicolai Buchwitz wrote:
> phy_support_eee() copies supported_eee into advertising_eee
> unconditionally, overwriting any filtering applied during phy_probe()
> based on DT eee-broken-* properties or driver-populated
> eee_disabled_modes.

Sorry, i should of questioned this on v1. What PHY are you using which
masks advertising_eee in probe? It seems like this is wrong, and it
should be setting >eee_disabled_modes, or maybe eee_supported.

> Fixes: 49168d1980e2 ("net: phy: Add phy_support_eee() indicating MAC support EEE")
> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>

This patch itself looks O.K.

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

    Andrew

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

* Re: [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee()
  2026-05-19  2:19   ` Andrew Lunn
@ 2026-05-19  6:20     ` Nicolai Buchwitz
  2026-05-19 11:56       ` Andrew Lunn
  0 siblings, 1 reply; 8+ messages in thread
From: Nicolai Buchwitz @ 2026-05-19  6:20 UTC (permalink / raw)
  To: Andrew Lunn
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Oleksij Rempel, netdev,
	linux-kernel

Hi Andrew,

Thanks for your review.

On 19.5.2026 04:19, Andrew Lunn wrote:
> On Mon, May 18, 2026 at 10:23:09AM +0200, Nicolai Buchwitz wrote:
>> phy_support_eee() copies supported_eee into advertising_eee
>> unconditionally, overwriting any filtering applied during phy_probe()
>> based on DT eee-broken-* properties or driver-populated
>> eee_disabled_modes.
> 
> Sorry, i should of questioned this on v1. What PHY are you using which
> masks advertising_eee in probe? It seems like this is wrong, and it
> should be setting >eee_disabled_modes, or maybe eee_supported.c

The masking isn't PHY-specific. phy_probe() applies eee_disabled_modes
to advertising_eee after of_set_phy_eee_broken() picks up the
eee-broken-* properties from the PHY DT node.

The PHYs in my case are BCM54210PE / BCM54213PE on Raspberry Pi
CM4 / 5, and I use eee-broken-* to disable EEE on boards where the
switch doesn't handle LPI well. phy_support_eee() then clobbers that
filtering by overwriting advertising_eee with the unfiltered
supported_eee.

> 
>> Fixes: 49168d1980e2 ("net: phy: Add phy_support_eee() indicating MAC 
>> support EEE")
>> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>
> 
> This patch itself looks O.K.
> 
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>
> 
>     Andrew

Regards
Nicolai

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

* Re: [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee()
  2026-05-19  6:20     ` Nicolai Buchwitz
@ 2026-05-19 11:56       ` Andrew Lunn
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2026-05-19 11:56 UTC (permalink / raw)
  To: Nicolai Buchwitz
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Oleksij Rempel, netdev,
	linux-kernel

On Tue, May 19, 2026 at 08:20:02AM +0200, Nicolai Buchwitz wrote:
> Hi Andrew,
> 
> Thanks for your review.
> 
> On 19.5.2026 04:19, Andrew Lunn wrote:
> > On Mon, May 18, 2026 at 10:23:09AM +0200, Nicolai Buchwitz wrote:
> > > phy_support_eee() copies supported_eee into advertising_eee
> > > unconditionally, overwriting any filtering applied during phy_probe()
> > > based on DT eee-broken-* properties or driver-populated
> > > eee_disabled_modes.
> > 
> > Sorry, i should of questioned this on v1. What PHY are you using which
> > masks advertising_eee in probe? It seems like this is wrong, and it
> > should be setting >eee_disabled_modes, or maybe eee_supported.c
> 
> The masking isn't PHY-specific. phy_probe() applies eee_disabled_modes
> to advertising_eee after of_set_phy_eee_broken() picks up the
> eee-broken-* properties from the PHY DT node.

Ah, O.K, i understood that wrongly. But you do say phy_probe(), not
PHY probe(), so it was my error.

	Andrew

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

* Re: [PATCH net v2 2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all()
  2026-05-18  8:23 ` [PATCH net v2 2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all() Nicolai Buchwitz
@ 2026-05-19 11:56   ` Andrew Lunn
  0 siblings, 0 replies; 8+ messages in thread
From: Andrew Lunn @ 2026-05-19 11:56 UTC (permalink / raw)
  To: Nicolai Buchwitz
  Cc: Heiner Kallweit, Russell King, David S. Miller, Eric Dumazet,
	Jakub Kicinski, Paolo Abeni, Oleksij Rempel, netdev,
	linux-kernel

On Mon, May 18, 2026 at 10:23:10AM +0200, Nicolai Buchwitz wrote:
> phy_advertise_eee_all() copies supported_eee into advertising_eee
> unconditionally, overwriting any filtering applied during phy_probe()
> based on DT eee-broken-* properties or driver-populated
> eee_disabled_modes. genphy_c45_ethtool_set_eee() calls this helper
> when user space passes an empty advertisement, undoing the filtering.
> 
> Apply the same eee_disabled_modes mask in phy_advertise_eee_all() so
> the filtering survives the copy, matching the pattern in phy_probe()
> and phy_support_eee().
> 
> Fixes: b64691274f5d ("net: phy: add helper phy_advertise_eee_all")
> Signed-off-by: Nicolai Buchwitz <nb@tipi-net.de>

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

    Andrew

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

* Re: [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE
  2026-05-18  8:23 [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE Nicolai Buchwitz
  2026-05-18  8:23 ` [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee() Nicolai Buchwitz
  2026-05-18  8:23 ` [PATCH net v2 2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all() Nicolai Buchwitz
@ 2026-05-20  2:00 ` patchwork-bot+netdevbpf
  2 siblings, 0 replies; 8+ messages in thread
From: patchwork-bot+netdevbpf @ 2026-05-20  2:00 UTC (permalink / raw)
  To: Nicolai Buchwitz
  Cc: andrew, hkallweit1, linux, davem, edumazet, kuba, pabeni,
	o.rempel, netdev, linux-kernel

Hello:

This series was applied to netdev/net.git (main)
by Jakub Kicinski <kuba@kernel.org>:

On Mon, 18 May 2026 10:23:08 +0200 you wrote:
> While debugging why ethtool --show-eee reports "not supported" on a
> Raspberry Pi CM4 with eee-broken-1000t / eee-broken-100tx set on the
> PHY node, I noticed two phylib helpers copy phydev->supported_eee
> into phydev->advertising_eee without applying
> phydev->eee_disabled_modes: phy_support_eee() and
> phy_advertise_eee_all(). That undoes the filtering phy_probe() set
> up after of_set_phy_eee_broken(), so the PHY ends up advertising EEE
> for modes that were marked broken in DT (or by the driver via
> eee_disabled_modes).
> 
> [...]

Here is the summary with links:
  - [net,v2,1/2] net: phy: honor eee_disabled_modes in phy_support_eee()
    https://git.kernel.org/netdev/net/c/3655063e0838
  - [net,v2,2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all()
    https://git.kernel.org/netdev/net/c/8baa7506d793

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] 8+ messages in thread

end of thread, other threads:[~2026-05-20  2:00 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-05-18  8:23 [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE Nicolai Buchwitz
2026-05-18  8:23 ` [PATCH net v2 1/2] net: phy: honor eee_disabled_modes in phy_support_eee() Nicolai Buchwitz
2026-05-19  2:19   ` Andrew Lunn
2026-05-19  6:20     ` Nicolai Buchwitz
2026-05-19 11:56       ` Andrew Lunn
2026-05-18  8:23 ` [PATCH net v2 2/2] net: phy: honor eee_disabled_modes in phy_advertise_eee_all() Nicolai Buchwitz
2026-05-19 11:56   ` Andrew Lunn
2026-05-20  2:00 ` [PATCH net v2 0/2] net: phy: honor eee_disabled_modes when advertising EEE 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

Powered by JetHome