Netdev List
 help / color / mirror / Atom feed
* [PATCH net-next 0/3] net: survive a PHY whose driver arrives after the switch probes
@ 2026-08-22 15:52 Aleksei Sviridkin
  2026-08-22 15:52 ` [PATCH net-next 1/3] net: phylink: unwind the PHY binding when bringup fails late Aleksei Sviridkin
                   ` (3 more replies)
  0 siblings, 4 replies; 14+ messages in thread
From: Aleksei Sviridkin @ 2026-08-22 15:52 UTC (permalink / raw)
  To: Andrew Lunn, Vladimir Oltean, Heiner Kallweit, Russell King
  Cc: David S . Miller, Eric Dumazet, Jakub Kicinski, Paolo Abeni,
	Simon Horman, netdev, linux-kernel, Aleksei Sviridkin

A PHY that loads firmware at probe keeps its driver in a module on the
rootfs: built in, request_firmware_direct() fails against a rootfs that
is not mounted yet and the error comes straight out of probe. A DSA
switch probes long before that module can load, and three things go
wrong, one per layer.

phylink can fail its PHY bringup after it has already recorded the PHY
in pl->phydev, leaving a pointer to a PHY that phy_detach() has since
released. Depending on the caller that is either a permanent -EBUSY or
a stale pointer handed to phy_disconnect() later, which detaches the
same PHY twice (patch 1). Keeping a port across a failed connect makes
that window reachable, so it comes first.

phylib binds the generic driver during the attach, and once the failed
connect unwinds, the interrupt the firmware node declared is gone:
phy_probe() parked the PHY in polling mode and nothing after MDIO bus
registration ever brings the irq back (patch 2).

DSA drops the user port when the connect at setup fails, so the port
never exists, no matter that the driver shows up seconds later
(patch 3).

With the series applied the port survives setup and connects its PHY on
the first ifup after the module loads, with the interrupt the device
tree declares.

Tested on an MT7981B board (mt7530 switch, Airoha EN8811H with its
INT_B line in the device tree) running a 6.18 backport of everything
here except the retry in patch 3: the attach line reports a real
interrupt instead of irq=POLL, the EINT is claimed and its counter
advances on link changes forced from the link partner, and the port
passes traffic. On net-next all three files are compile-tested; the
board runs an OpenWrt 6.18 kernel.

Aleksei Sviridkin (3):
  net: phylink: unwind the PHY binding when bringup fails late
  net: phy: restore the interrupt after a generic-driver bind cycle
  net: dsa: connect a late-arriving PHY at ifup

 drivers/net/phy/phy_device.c | 13 +++++
 drivers/net/phy/phylink.c    | 12 +++++
 include/linux/phy.h          |  6 +++
 net/dsa/user.c               | 98 ++++++++++++++++++++++++++++++++++++
 4 files changed, 129 insertions(+)

-- 
2.43.0


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

end of thread, other threads:[~2026-08-28 13:30 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-22 15:52 [PATCH net-next 0/3] net: survive a PHY whose driver arrives after the switch probes Aleksei Sviridkin
2026-08-22 15:52 ` [PATCH net-next 1/3] net: phylink: unwind the PHY binding when bringup fails late Aleksei Sviridkin
2026-08-22 17:30   ` Andrew Lunn
2026-08-22 15:52 ` [PATCH net-next 2/3] net: phy: restore the interrupt after a generic-driver bind cycle Aleksei Sviridkin
2026-08-22 19:28   ` Andrew Lunn
     [not found] ` <20260822155259.87146-4-f@lex.la>
2026-08-22 19:38   ` [PATCH net-next 3/3] net: dsa: connect a late-arriving PHY at ifup Andrew Lunn
2026-08-23  0:05     ` Aleksei Sviridkin
2026-08-23  1:24       ` Andrew Lunn
2026-08-23 12:37         ` Aleksei Sviridkin
2026-08-23 15:20           ` Andrew Lunn
2026-08-24  2:40         ` Aleksei Sviridkin
2026-08-24 16:25 ` [PATCH net-next 0/3] net: survive a PHY whose driver arrives after the switch probes Andrew Lunn
2026-08-25  8:25   ` Aleksei Sviridkin
2026-08-28 13:30     ` Andrew Lunn

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