Re: [net-next PATCH v6 03/10] net: pcs: Add subsystem
From: Sean Anderson
Date: Thu Jun 12 2025 - 11:45:43 EST
On 6/10/25 20:24, Randy Dunlap wrote:
> Hi,
>
>
>> diff --git a/Documentation/networking/pcs.rst b/Documentation/networking/pcs.rst
>> new file mode 100644
>> index 000000000000..4b41ba884160
>> --- /dev/null
>> +++ b/Documentation/networking/pcs.rst
>> @@ -0,0 +1,102 @@
>> +.. SPDX-License-Identifier: GPL-2.0
>> +
>> +=============
>> +PCS Subsystem
>> +=============
>> +
>> +The PCS (Physical Coding Sublayer) subsystem handles the registration and lookup
>> +of PCS devices. These devices contain the upper sublayers of the Ethernet
>> +physical layer, generally handling framing, scrambling, and encoding tasks. PCS
>> +devices may also include PMA (Physical Medium Attachment) components. PCS
>> +devices transfer data between the Link-layer MAC device, and the rest of the
>> +physical layer, typically via a serdes. The output of the serdes may be
>> +connected more-or-less directly to the medium when using fiber-optic or
>> +backplane connections (1000BASE-SX, 1000BASE-KX, etc). It may also communicate
>> +with a separate PHY (such as over SGMII) which handles the connection to the
>> +medium (such as 1000BASE-T).
>> +
>> +Looking up PCS Devices
>> +----------------------
>> +
>> +There are generally two ways to look up a PCS device. If the PCS device is
>> +internal to a larger device (such as a MAC or switch), and it does not share an
>> +implementation with an existing PCS, then it does not need to be registered with
>> +the PCS subsystem. Instead, you can populate a :c:type:`phylink_pcs`
>> +in your probe function. Otherwise, you must look up the PCS.
>> +
>> +If your device has a :c:type:`fwnode_handle`, you can add a PCS using the
>> +``pcs-handle`` property::
>> +
>> + ethernet-controller {
>> + // ...
>> + pcs-handle = <&pcs>;
>> + pcs-handle-names = "internal";
>> + };
>> +
>> +Then, during your probe function, you can get the PCS using :c:func:`pcs_get`::
>
> It's preferable to use PCS using pcs_get()::
> instead of the :c:func: notation to make the .rst file more human-readable.
> They produce the same generated output.
If you find this syntax useful, then you should update
Documentation/doc-guide/{kernel-doc,sphinx}.rst. I did not use it
because it I did not know about it because it is not documented.
--Sean