Re: [PATCH net-next v3 2/5] ethtool: netlink: add ETHTOOL_MSG_MSE_GET and wire up PHY MSE access

From: Kory Maincent
Date: Wed Aug 20 2025 - 05:49:40 EST


Le Tue, 19 Aug 2025 09:12:53 +0200,
Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx> a écrit :

> Introduce the userspace entry point for PHY MSE diagnostics via
> ethtool netlink. This exposes the core API added previously and
> returns both configuration and one or more snapshots.
>
> Userspace sends ETHTOOL_MSG_MSE_GET with an optional channel
> selector. The reply carries:
> - ETHTOOL_A_MSE_CONFIG: scale limits, timing, and supported
> capability bitmask
> - ETHTOOL_A_MSE_SNAPSHOT+: one or more snapshots, each tagged
> with the selected channel
>
> If no channel is requested, the kernel returns snapshots for all
> supported selectors (per‑channel if available, otherwise WORST,
> otherwise LINK). Requests for unsupported selectors fail with
> -EOPNOTSUPP; link down returns -ENOLINK.
>
> Changes:
> - YAML: add attribute sets (mse, mse-config, mse-snapshot) and
> the mse-get operation
> - UAPI (generated): add ETHTOOL_A_MSE_* enums and message IDs,
> ETHTOOL_MSG_MSE_GET/REPLY
> - ethtool core: add net/ethtool/mse.c implementing the request,
> register genl op, and hook into ethnl dispatch
> - docs: document MSE_GET in ethtool-netlink.rst
>
> The include/uapi/linux/ethtool_netlink_generated.h is generated
> from Documentation/netlink/specs/ethtool.yaml.
>
> Signed-off-by: Oleksij Rempel <o.rempel@xxxxxxxxxxxxxx>
> ---
> Documentation/netlink/specs/ethtool.yaml | 88 +++++
> Documentation/networking/ethtool-netlink.rst | 65 ++++
> .../uapi/linux/ethtool_netlink_generated.h | 37 ++
> net/ethtool/Makefile | 2 +-
> net/ethtool/mse.c | 362 ++++++++++++++++++
> net/ethtool/netlink.c | 10 +
> net/ethtool/netlink.h | 2 +
> 7 files changed, 565 insertions(+), 1 deletion(-)
> create mode 100644 net/ethtool/mse.c
>
> diff --git a/Documentation/netlink/specs/ethtool.yaml
> b/Documentation/netlink/specs/ethtool.yaml index 6bffac0904f1..ed4774826b16
> 100644 --- a/Documentation/netlink/specs/ethtool.yaml
> +++ b/Documentation/netlink/specs/ethtool.yaml
> @@ -1872,6 +1872,79 @@ attribute-sets:
> type: uint
> enum: pse-event
> doc: List of events reported by the PSE controller
> + -
> + name: mse-config
> + attr-cnt-name: __ethtool-a-mse-config-cnt

Please use double dash here, Jakub wants to remove all underscore from the
specs.

> + -
> + name: mse-snapshot
> + attr-cnt-name: __ethtool-a-mse-snapshot-cnt

Same

> + name: mse
> + attr-cnt-name: __ethtool-a-mse-cnt

Same

...

> +MSE Configuration
> +-----------------
> +
> +This nested attribute contains the full configuration properties for the MSE
> +measurements
> +
> + =============================================== ======
> ====================
> + ETHTOOL_A_MSE_CONFIG_MAX_AVERAGE_MSE u32 max avg_mse scale
> + ETHTOOL_A_MSE_CONFIG_MAX_PEAK_MSE u32 max peak_mse scale
> + ETHTOOL_A_MSE_CONFIG_REFRESH_RATE_PS u64 sample rate (ps)
> + ETHTOOL_A_MSE_CONFIG_NUM_SYMBOLS u64 symbols per sample
> + ETHTOOL_A_MSE_CONFIG_SUPPORTED_CAPS bitset capability bitmask
> + =============================================== ======
> ==================== +
> +.. kernel-doc:: include/linux/phy.h
> + :identifiers: phy_mse_config
> +
> +.. kernel-doc:: include/uapi/linux/ethtool_netlink_generated.h
> + :identifiers: phy_mse_snapshot

I think you forgot to remove this kernel-doc lines as the MSE snapshot is
described below.

> +
> +MSE Snapshot
> +------------
> +
> +This nested attribute contains an atomic snapshot of MSE values for a
> specific +channel or for the link as a whole.
> +
> + =============================================== ======
> ======================
> + ETHTOOL_A_MSE_SNAPSHOT_CHANNEL u32 channel enum value
> + ETHTOOL_A_MSE_SNAPSHOT_AVERAGE_MSE u32 average MSE value
> + ETHTOOL_A_MSE_SNAPSHOT_PEAK_MSE u32 current peak MSE
> + ETHTOOL_A_MSE_SNAPSHOT_WORST_PEAK_MSE u32 worst-case peak
> MSE
> + =============================================== ======
> ====================== +
> +.. kernel-doc:: include/linux/phy.h
> + :identifiers: phy_mse_snapshot
> +
> Request translation
> ===================

--
Köry Maincent, Bootlin
Embedded Linux and kernel engineering
https://bootlin.com