Netdev List
 help / color / mirror / Atom feed
* [PATCH net v2] net: phy: skip EEE advertisement write when autoneg is disabled
  2026-05-16 11:43 [PATCH net] " Nerijus Bendžiūnas
@ 2026-05-16 14:52 ` Nerijus Bendžiūnas
  0 siblings, 0 replies; 3+ messages in thread
From: Nerijus Bendžiūnas @ 2026-05-16 14:52 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Russell King, Russell King (Oracle), David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	regressions, stable

genphy_c45_an_config_eee_aneg() writes the EEE advertisement to the
auto-negotiation device's MMD register space (MDIO_MMD_AN, register
MDIO_AN_EEE_ADV).  These registers are read by the link partner only
during auto-negotiation, so writing them while autoneg is disabled
cannot influence the link.  On some PHYs (e.g. Broadcom BCM54213PE)
the write nevertheless reaches the chip and disturbs the receive
datapath.

Concretely, running

    ethtool -s eth0 speed 100 duplex full autoneg off
    ethtool --set-eee eth0 eee off

leaves eth0 with TX working and RX completely silent on a
Raspberry Pi 4 / CM4 board (bcmgenet + BCM54213PE in rgmii-rxid).
Switching back to autoneg recovers the link.

Prior to commit f26a29a038ee ("net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled"),
the disable path was effectively a no-op because the helper read
the stale eee_cfg.eee_enabled, so the underlying PHY behavior never
surfaced.

Bisected on rpi-6.12.y between commits 83943264 (good) and
effcbc88 (bad) to f26a29a038ee.

Fixes: f26a29a038ee ("net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled")
Cc: stable@vger.kernel.org
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
---
Changes since v1:
 - Reworded the inline comment and commit message: the MMD AN
   write is read by the chip with side-effects, not silently
   ignored. Suggested by Andrew Lunn.
 - Tightened the reproducer paragraph (was repeating paragraph 1).

v1: https://lore.kernel.org/netdev/20260516114334.812828-1-nerijus.bendziunas@gmail.com/
 drivers/net/phy/phy-c45.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index d48aa7231b37..126951741428 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -940,6 +940,14 @@ EXPORT_SYMBOL_GPL(genphy_c45_read_eee_abilities);
  */
 int genphy_c45_an_config_eee_aneg(struct phy_device *phydev)
 {
+	/* Writing MMD AN advertisements while autoneg is disabled has no
+	 * effect on link-partner negotiation, but on some PHYs (e.g. the
+	 * Broadcom BCM54213PE) the write itself disturbs the receive
+	 * datapath. Skip it.
+	 */
+	if (phydev->autoneg == AUTONEG_DISABLE)
+		return 0;
+
 	if (!phydev->eee_cfg.eee_enabled) {
 		__ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {};
 
-- 
2.54.0


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

* [PATCH net v2] net: phy: skip EEE advertisement write when autoneg is disabled
@ 2026-05-16 15:02 Nerijus Bendžiūnas
  2026-05-19 12:49 ` Nicolai Buchwitz
  0 siblings, 1 reply; 3+ messages in thread
From: Nerijus Bendžiūnas @ 2026-05-16 15:02 UTC (permalink / raw)
  To: Andrew Lunn, Heiner Kallweit
  Cc: Russell King, Russell King (Oracle), David S . Miller,
	Eric Dumazet, Jakub Kicinski, Paolo Abeni, netdev, linux-kernel,
	regressions, stable

genphy_c45_an_config_eee_aneg() writes the EEE advertisement to the
auto-negotiation device's MMD register space (MDIO_MMD_AN, register
MDIO_AN_EEE_ADV).  These registers are read by the link partner only
during auto-negotiation, so writing them while autoneg is disabled
cannot influence the link.  On some PHYs (e.g. Broadcom BCM54213PE)
the write nevertheless reaches the chip and disturbs the receive
datapath.

Concretely, running

    ethtool -s eth0 speed 100 duplex full autoneg off
    ethtool --set-eee eth0 eee off

leaves eth0 with TX working and RX completely silent on a
Raspberry Pi 4 / CM4 board (bcmgenet + BCM54213PE in rgmii-rxid).
Switching back to autoneg recovers the link.

Prior to commit f26a29a038ee ("net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled"),
the disable path was effectively a no-op because the helper read
the stale eee_cfg.eee_enabled, so the underlying PHY behavior never
surfaced.

Bisected on rpi-6.12.y between commits 83943264 (good) and
effcbc88 (bad) to f26a29a038ee.

Fixes: f26a29a038ee ("net: phy: ensure that genphy_c45_an_config_eee_aneg() sees new value of phydev->eee_cfg.eee_enabled")
Cc: stable@vger.kernel.org
Signed-off-by: Nerijus Bendžiūnas <nerijus.bendziunas@gmail.com>
---
Changes since v1:
 - Reworded the inline comment and commit message: the MMD AN
   write is read by the chip with side-effects, not silently
   ignored. Suggested by Andrew Lunn.
 - Tightened the reproducer paragraph (was repeating paragraph 1).

v1: https://lore.kernel.org/netdev/20260516114334.812828-1-nerijus.bendziunas@gmail.com/
 drivers/net/phy/phy-c45.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
index d48aa7231b37..126951741428 100644
--- a/drivers/net/phy/phy-c45.c
+++ b/drivers/net/phy/phy-c45.c
@@ -940,6 +940,14 @@ EXPORT_SYMBOL_GPL(genphy_c45_read_eee_abilities);
  */
 int genphy_c45_an_config_eee_aneg(struct phy_device *phydev)
 {
+	/* Writing MMD AN advertisements while autoneg is disabled has no
+	 * effect on link-partner negotiation, but on some PHYs (e.g. the
+	 * Broadcom BCM54213PE) the write itself disturbs the receive
+	 * datapath. Skip it.
+	 */
+	if (phydev->autoneg == AUTONEG_DISABLE)
+		return 0;
+
 	if (!phydev->eee_cfg.eee_enabled) {
 		__ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {};
 
-- 
2.54.0


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

* Re: [PATCH net v2] net: phy: skip EEE advertisement write when autoneg is disabled
  2026-05-16 15:02 [PATCH net v2] net: phy: skip EEE advertisement write when autoneg is disabled Nerijus Bendžiūnas
@ 2026-05-19 12:49 ` Nicolai Buchwitz
  0 siblings, 0 replies; 3+ messages in thread
From: Nicolai Buchwitz @ 2026-05-19 12:49 UTC (permalink / raw)
  To: Nerijus Bendžiūnas
  Cc: Andrew Lunn, Heiner Kallweit, Russell King, Russell King (Oracle),
	David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	netdev, linux-kernel, regressions, stable

Hi Nerijus

On 16.5.2026 17:02, Nerijus Bendžiūnas wrote:
> genphy_c45_an_config_eee_aneg() writes the EEE advertisement to the
> auto-negotiation device's MMD register space (MDIO_MMD_AN, register
> MDIO_AN_EEE_ADV).  These registers are read by the link partner only
> during auto-negotiation, so writing them while autoneg is disabled
> cannot influence the link.  On some PHYs (e.g. Broadcom BCM54213PE)
> the write nevertheless reaches the chip and disturbs the receive
> datapath.
> 
> Concretely, running
> 
>     ethtool -s eth0 speed 100 duplex full autoneg off
>     ethtool --set-eee eth0 eee off
> 
> leaves eth0 with TX working and RX completely silent on a
> Raspberry Pi 4 / CM4 board (bcmgenet + BCM54213PE in rgmii-rxid).
> Switching back to autoneg recovers the link.
> 

Can confirm this. A quick look at the BCM54213PE datasheet shows that 
EEE is
only applied if autoneg is enabled (as expected). With autoneg disabled 
it
is undefined behavior, but clearly breaks communication.

> [...]

> 
> diff --git a/drivers/net/phy/phy-c45.c b/drivers/net/phy/phy-c45.c
> index d48aa7231b37..126951741428 100644
> --- a/drivers/net/phy/phy-c45.c
> +++ b/drivers/net/phy/phy-c45.c
> @@ -940,6 +940,14 @@ EXPORT_SYMBOL_GPL(genphy_c45_read_eee_abilities);
>   */
>  int genphy_c45_an_config_eee_aneg(struct phy_device *phydev)
>  {
> +	/* Writing MMD AN advertisements while autoneg is disabled has no
> +	 * effect on link-partner negotiation, but on some PHYs (e.g. the
> +	 * Broadcom BCM54213PE) the write itself disturbs the receive
> +	 * datapath. Skip it.
> +	 */
> +	if (phydev->autoneg == AUTONEG_DISABLE)
> +		return 0;
> +
>  	if (!phydev->eee_cfg.eee_enabled) {
>  		__ETHTOOL_DECLARE_LINK_MODE_MASK(adv) = {};

Reviewed-by: Nicolai Buchwitz <nb@tipi-net.de>
Tested-by: Nicolai Buchwitz <nb@tipi-net.de>

Thanks
Nicolai

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

end of thread, other threads:[~2026-05-19 12:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-16 15:02 [PATCH net v2] net: phy: skip EEE advertisement write when autoneg is disabled Nerijus Bendžiūnas
2026-05-19 12:49 ` Nicolai Buchwitz
  -- strict thread matches above, loose matches on Subject: below --
2026-05-16 11:43 [PATCH net] " Nerijus Bendžiūnas
2026-05-16 14:52 ` [PATCH net v2] " Nerijus Bendžiūnas

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox