Re: [net-next PATCH v6 03/10] net: pcs: Add subsystem

From: Randy Dunlap

Date: Mon Oct 26 2026 - 19:36:25 EST


Hi,
Sorry for the delay.


On 6/12/25 8:38 AM, Sean Anderson wrote:
> 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.

See Documentation/doc-guide/kernel-doc.rst,
commit 7c8b9e3000f8
Author: Nícolas F. R. A. Prado <nfraprado@xxxxxxxxxxxxxx>
Date: Thu Sep 3 00:58:26 2020 +0000
kernel-doc: Update "cross-referencing from rST" section to use automarkup


Cross-referencing from reStructuredText
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

No additional syntax is needed to cross-reference the functions and types
defined in the kernel-doc comments from reStructuredText documents.
Just end function names with ``()`` and write ``struct``, ``union``, ``enum``
or ``typedef`` before types.

--
~Randy