From: Aleksei Sviridkin <f@lex.la>
To: Andrew Lunn <andrew@lunn.ch>
Cc: Vladimir Oltean <olteanv@gmail.com>,
Heiner Kallweit <hkallweit1@gmail.com>,
Russell King <linux@armlinux.org.uk>,
netdev@vger.kernel.org, Aleksei Sviridkin <f@lex.la>
Subject: Re: [PATCH net-next 0/3] net: survive a PHY whose driver arrives after the switch probes
Date: Tue, 25 Aug 2026 11:25:12 +0300 [thread overview]
Message-ID: <20260825082512.63501-1-f@lex.la> (raw)
In-Reply-To: <a230d199-5d4d-4637-aff3-e725a37e1da1@lunn.ch>
Hi Andrew
I built it: both halves, as an MVP on my board. The MDIO device with a
nested pass-through bus for one address, and slow-to-probe in phylink
with a poller modeled on the SFP path. The port survives the switch
probe, the poller connects the real driver a few seconds later with its
interrupt from DT, and it held across reboots in both topologies. Holes
I hit, all on real boots:
1. "Polls until it resolves" needs a stricter resolve than the device
existing. A phy_device with no driver gets genphy bound by
phy_attach_direct(), which cannot drive this PHY;
phylink_sfp_connect_phy() already refuses a driverless PHY for the same
reason. And "driver bound" is still not enough, because the core
assigns dev->driver before probe runs. A poll tick landing mid-probe
connected a PHY with an all-zero supported mask:
lan4: validation of 2500base-x with support 0000000,00000000,00000000,00000000 ... failed: -EINVAL
What survived hardware: driver bound, not genphy, state past PHY_DOWN.
2. The poller needs rtnl to connect, and phylink_disconnect_phy() runs
under rtnl, so a synchronous cancel there deadlocks. Trylock plus
requeue in the worker, non-sync cancel at disconnect, sync cancel only
in phylink_destroy(). A failed connect must not stop the polling, errno
cannot tell the race above from a permanent failure. The retry needs
backoff though: failed bringup goes through phy_detach(), which pulses
the reset line, and this chip's firmware lives behind that line.
3. Returning 0 for the armed case matters beyond the error code: on
-ENODEV, DSA goes looking on the switch's internal MDIO bus and
attaches the internal GbE PHY to the 2500base-x port, which then fails
validation.
4. Polling costs one interval of latency. The tick phase is set when
the port arms, so the attach lands anywhere in [0, interval) after the
PHY becomes ready; I measured 0.7s of a 1s interval. The exact event
exists, BUS_NOTIFY_BOUND_DRIVER fires at probe completion, but
mdio_bus_type is internal to phylib, so the notifier has to live there
behind a small API, it still needs the genphy filter, and the callback
runs under device_lock so it still defers to a workqueue. My plan is
polling first and the notifier as a follow-up, unless you want it
event-driven from the start.
Two questions before I send the series.
My MCU driver only waits for the firmware files and registers the
nested bus; the download stays in the PHY driver, which already does
it. Moving it into the MDIO driver duplicates the loader for a quad-PHY
case no board has yet. Is the MCU-side download a hard part of the
design for you?
On this board the minimal variant, slow-to-probe alone with the PHY
node directly on the bus, carries everything by itself: the chip
answers its ID from the bootloader, and the driver and firmware arrive
together. The MDIO-device layer buys the general case (chips silent
before firmware, quad PHY, reset ownership). Both layers in one series,
or slow-to-probe first?
Aleksei
next prev parent reply other threads:[~2026-08-25 8:25 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
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
2026-08-22 15:52 ` [PATCH net-next 3/3] net: dsa: connect a late-arriving PHY at ifup Aleksei Sviridkin
2026-08-22 19:38 ` 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 [this message]
2026-08-28 13:30 ` Andrew Lunn
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=20260825082512.63501-1-f@lex.la \
--to=f@lex.la \
--cc=andrew@lunn.ch \
--cc=hkallweit1@gmail.com \
--cc=linux@armlinux.org.uk \
--cc=netdev@vger.kernel.org \
--cc=olteanv@gmail.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.