[PATCH net-next 0/3] net: survive a PHY whose driver arrives after the switch probes

From: Aleksei Sviridkin

Date: Sat Aug 22 2026 - 11:53:16 EST


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