freenode
Kernel & Low-Level

Linux net stack gains fwnode PCS API for external SerDes blocks

Phylink takes ownership of PCS selection as SoCs put coding sublayers outside the MAC, with Airoha AN7581 as the first in-tree consumer.

Christian Marangi has posted a fifteenth-round patch series that adds firmware-node based provider and consumer support for Physical Coding Sublayer (PCS) devices in the Linux networking stack, and wires the first platform driver to use it.

PCS blocks sit between a MAC and the rest of the physical layer, handling framing, scrambling, and encoding, often with an attached SerDes. Early phylink design assumed the PCS lived in the same driver as the MAC, so MAC drivers were given wide latitude to pick a PCS themselves. That assumption no longer holds. With 10G links appearing in more consumer silicon, SoCs increasingly expose standalone PCS units outside the MAC, and ad hoc selection paths have diverged.

The series answers that with a producer-consumer model patterned on clocks and PHYs. A PCS driver registers as a provider against a firmware node and supplies a translation function so consumers can request a PCS by phandle and cells. Phylink gains an internal PCS list: MAC drivers fill available PCS instances and declare which interface modes need a dedicated PCS, and phylink performs selection from supported-interface bitmaps instead of leaving that logic in the MAC. The older MAC-side selection callback is treated as deprecated; implementing both paths is rejected.

Notifier hooks cover the race cases that matter on real boards: a PCS provider that appears after phylink is already running can attach late, and a provider that disappears can be torn out of the active list with a forced reconfiguration so the link can recover when the PCS returns. Helper parse paths read pcs-handle properties from device tree or ACPI, documentation for the new subsystem is included, and Marangi is listed as maintainer. Daniel Golle co-developed the core provider work.

The first consumer is Airoha’s AN7581 silicon. A new PCS driver registers Ethernet, PON, PCIe, and USB SerDes blocks as fwnode providers for modes including USXGMII, 10GBASE-R, 2500BASE-X, 1000BASE-X, and SGMII, and the Airoha Ethernet MAC driver gains phylink integration so GDM ports can bind external PHYs or SFP cages through pcs-handle. Lorenzo Bianconi acked the MAC-side pieces.

The change matters beyond one SoC family: it gives the kernel a single, removable, probe-deferrable way to describe external PCS hardware as multi-gigabit designs keep splitting MAC and coding sublayer across drivers.