Netdev List
 help / color / mirror / Atom feed
From: Andrew Lunn <andrew@lunn.ch>
To: Markus Stockhausen <markus.stockhausen@gmx.de>
Cc: hkallweit1@gmail.com, linux@armlinux.org.uk, davem@davemloft.net,
	edumazet@google.com, kuba@kernel.org, pabeni@redhat.com,
	netdev@vger.kernel.org, chris.packham@alliedtelesis.co.nz,
	daniel@makrotopia.org, mensi@mensi.ch
Subject: Re: [PATCH net-next 6/8] net: mdio: realtek-rtl9300: relocate topology setup
Date: Tue, 2 Jun 2026 22:29:40 +0200	[thread overview]
Message-ID: <1843116c-e84c-47f6-a565-e41bd6918ced@lunn.ch> (raw)
In-Reply-To: <00b401dcf2c0$6e2826c0$4a787440$@gmx.de>

> The hardware polling in these devices is very important for the DSA
> driver. Especially as a port can be either PHY or SerDes driven. Some
> MAC operations simply do not work if a wrong state is reported.

And you will get the wrong state if the timing of the poll is in the
middle of the PHY driver swapping the page to read/write something.

I've not looked at what PHYs you plan to support, but code like

https://elixir.bootlin.com/linux/v7.0.10/source/drivers/net/phy/realtek/realtek_main.c#L907

could be called every 50ms to blink the LEDs. That changes the page,
writes a register, and then changes back to the original page. If the
HW polling happens in the middle of that, it will read from the wrong
place. If that HW poll actually changes the page, without restoring
it, the write made in that function could go to the wrong page.

So, in order to be able to use the Linux PHY drivers, you need to
ensure the Linux PHY drivers has exclusive access to the bus when it
needs it.

All the phy_*_paged() methods call phy_lock_mdio_bus(), do what they
need to do, and then call phy_unlock_mdio_bus(). You will need to
extend those calls to disable the HW polling while the bus is locked,
and re-enable it when the bus is unlocked.

> There is no evidence about any issues in the OpenWrt ecosystem 

Try blinking the LEDs as fast as you can, and see if anything
breaks. Some PHYs also have hwmon sensors, and statistics. Read them
as well, as fast as you can, so you create contention on the bus. You
are then more likely to hit the race conditions.

	Andrew

  reply	other threads:[~2026-06-02 20:29 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-06-02  5:26 [PATCH net-next 0/8] net: mdio: realtek-rtl9300: Refactor initialization and port lookup Markus Stockhausen
2026-06-02  5:26 ` [PATCH net-next 1/8] net: mdio: realtek-rtl9300: Convert to fwnode API Markus Stockhausen
2026-06-02 12:06   ` Andrew Lunn
2026-06-02 12:29     ` AW: " Markus Stockhausen
2026-06-02 12:50       ` Andrew Lunn
2026-06-02 18:05   ` Jakub Kicinski
2026-06-02 18:58     ` AW: " Markus Stockhausen
2026-06-02  5:26 ` [PATCH net-next 2/8] net: mdio: realtek-rtl9300: Correctly handle ethernet-phy-package Markus Stockhausen
2026-06-02  9:32   ` Jagielski, Jedrzej
2026-06-02 10:23     ` AW: " Markus Stockhausen
2026-06-02 11:22       ` Jagielski, Jedrzej
2026-06-02  5:26 ` [PATCH net-next 3/8] net: mdio: realtek-rtl9300: harden otto_emdio_map_ports() Markus Stockhausen
2026-06-02  9:38   ` Jagielski, Jedrzej
2026-06-02 10:42     ` AW: " Markus Stockhausen
2026-06-02 11:29       ` Jagielski, Jedrzej
2026-06-02 12:14   ` Andrew Lunn
2026-06-02  5:26 ` [PATCH net-next 4/8] net: mdio: realtek-rtl9300: harden otto_emdio_probe_one() Markus Stockhausen
2026-06-02  5:26 ` [PATCH net-next 5/8] net: mdio: realtek-rtl9300: adapt spaces for defines Markus Stockhausen
2026-06-02  9:42   ` Jagielski, Jedrzej
2026-06-02 10:18     ` AW: " Markus Stockhausen
2026-06-02 11:16       ` Jagielski, Jedrzej
2026-06-02 12:20   ` Andrew Lunn
2026-06-02  5:26 ` [PATCH net-next 6/8] net: mdio: realtek-rtl9300: relocate topology setup Markus Stockhausen
2026-06-02  9:50   ` Jagielski, Jedrzej
2026-06-02 10:50     ` AW: " Markus Stockhausen
2026-06-02 12:24   ` Andrew Lunn
2026-06-02 13:01     ` AW: " Markus Stockhausen
2026-06-02 15:17       ` Andrew Lunn
2026-06-02 18:48         ` AW: " Markus Stockhausen
2026-06-02 20:29           ` Andrew Lunn [this message]
2026-06-02  5:26 ` [PATCH net-next 7/8] net: mdio: realtek-rtl9300: reorder controller setup Markus Stockhausen
2026-06-02  5:26 ` [PATCH net-next 8/8] net: mdio: realtek-rtl9300: Convert port lookup from O(n) to O(1) Markus Stockhausen
2026-06-02 12:30   ` Andrew Lunn
2026-06-02 20:02     ` AW: " Markus Stockhausen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1843116c-e84c-47f6-a565-e41bd6918ced@lunn.ch \
    --to=andrew@lunn.ch \
    --cc=chris.packham@alliedtelesis.co.nz \
    --cc=daniel@makrotopia.org \
    --cc=davem@davemloft.net \
    --cc=edumazet@google.com \
    --cc=hkallweit1@gmail.com \
    --cc=kuba@kernel.org \
    --cc=linux@armlinux.org.uk \
    --cc=markus.stockhausen@gmx.de \
    --cc=mensi@mensi.ch \
    --cc=netdev@vger.kernel.org \
    --cc=pabeni@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox