freenodenews
Kernel & Low-Level

Kernel gains fwnode PCS API as external serdes become common

Christian Marangi’s net-next series gives phylink a proper producer-consumer model for Physical Coding Sublayer devices, with Airoha AN7581 as the first in-tree user.

Linux networking is getting a long-requested way to wire up Physical Coding Sublayer (PCS) blocks through firmware nodes, instead of ad-hoc export symbols and MAC-driver glue.

Christian Marangi posted v9 of the work on the netdev list. It adds a producer-consumer PCS provider API in the style of clocks and PHYs, and moves PCS selection and lifetime handling into phylink. PCS drivers register as providers, consumers look them up from fwnode (including Device Tree pcs-handle and #pcs-cells), and removal can probe-defer or cleanly detach under phylink rather than leaving MAC drivers to paper over the edges.

That matters because the old model assumed the PCS lived in the same driver as the MAC. Marangi notes that early phylink flexibility let MAC drivers diverge, and that assumption no longer holds: with 10G landing in more consumer SoCs, external PCS and serdes blocks are showing up quickly. Giving phylink control is meant to stop the spread of one-off selection paths and to handle races when a PCS appears or disappears after phylink is created.

A competing approach from Sean was set aside in favor of this series once the race cases were covered. The patches also document the subsystem, teach fw_devlink about PCS dependencies, and add optional PCS link-down teardown for hardware that needs a clean reset between sessions.

The first concrete user is Airoha’s AN7581, with a new PCS driver for its Ethernet, PON, PCIe, and USB serdes (USXGMII, 10GBASE-R, 2500BASE-X, 1000BASE-X, SGMII) and phylink integration on the Airoha GDM ports for external PHYs and SFP cages. Marangi also lists himself as maintainer of the Ethernet PCS subsystem.

Maxime Chevallier tested the API by porting the Marvell mvpp2 driver for dynamic internal PCS selection, reported success, and offered Reviewed-by and Tested-by tags on the phylink core pieces. Airoha co-maintainer Lorenzo Bianconi pushed back on reusing a stats spinlock in the MAC link-up path, preferring rtnl where needed,an open integration nit on top of otherwise positive traction for the framework.