freenode
Kernel & Low-Level

Linux networking gains fwnode PCS provider API for external SerDes

Phylink takes ownership of PCS selection and hotplug, ending ad-hoc MAC driver wiring as external 10G blocks proliferate.

Linux networking is gaining a proper producer-consumer API for Physical Coding Sublayer (PCS) devices, the blocks that sit between a MAC and a SerDes or external PHY. Christian Marangi posted the work to the kernel networking tree, with Daniel Golle as co-developer.

PCS handling grew messy because early phylink designs assumed the PCS lived inside the MAC driver. That assumption no longer holds. Consumer platforms with 10G ports increasingly place one or more PCS blocks outside the MAC, and drivers papered over the gap with custom export symbols and per-driver selection logic. Marangi's approach mirrors the clock and PHY subsystems: a PCS driver registers as a firmware-node provider, consumers look up instances by phandle, and simple helpers cover the common single-PCS case. Probe deferral and clean driver removal are first-class.

Phylink itself now keeps an internal list of available PCS instances, tracks which interface modes need a dedicated PCS, and owns selection instead of leaving it to each MAC's select callback. That older path is treated as deprecated. Notifiers let phylink attach or detach PCS blocks after create time, so a late-probed or unbound provider can bring a link back or tear it down without races. Supported interface masks are refreshed when the set of PCS devices changes.

The first concrete user is Airoha's AN7581, whose Ethernet, PON, PCIe, and USB SerDes ports expose multiple PCS modes (USXGMII, 10GBASE-R, 2500BASE-X, 1000BASE-X, SGMII) and can drive external PHYs or SFP cages. Device-tree bindings, a PCS driver, and phylink wiring for the SoC's GDM ports land with the core API. Marangi is listed as maintainer of the new Ethernet PCS subsystem, and documentation covers the provider model and the migration away from MAC-side selection.

The change matters for any platform that treats PCS as a shared, hot-pluggable resource rather than a private MAC detail. It replaces one-off glue with a pattern other subsystems already rely on, and it gives phylink a single place to reason about which coding modes a link can actually use.