|
|
Log in / Subscribe / Register

ethtool: introduce PHY MSE diagnostics UAPI and drivers

From:  Oleksij Rempel <o.rempel-AT-pengutronix.de>
To:  Andrew Lunn <andrew-AT-lunn.ch>, Jakub Kicinski <kuba-AT-kernel.org>, "David S. Miller" <davem-AT-davemloft.net>, Eric Dumazet <edumazet-AT-google.com>, Paolo Abeni <pabeni-AT-redhat.com>, Simon Horman <horms-AT-kernel.org>, Donald Hunter <donald.hunter-AT-gmail.com>, Jonathan Corbet <corbet-AT-lwn.net>, Heiner Kallweit <hkallweit1-AT-gmail.com>, Russell King <linux-AT-armlinux.org.uk>, Kory Maincent <kory.maincent-AT-bootlin.com>, Maxime Chevallier <maxime.chevallier-AT-bootlin.com>, Nishanth Menon <nm-AT-ti.com>
Subject:  [PATCH net-next v6 0/5] ethtool: introduce PHY MSE diagnostics UAPI and drivers
Date:  Fri, 17 Oct 2025 12:47:27 +0200
Message-ID:  <20251017104732.3575484-1-o.rempel@pengutronix.de>
Cc:  Oleksij Rempel <o.rempel-AT-pengutronix.de>, kernel-AT-pengutronix.de, linux-kernel-AT-vger.kernel.org, netdev-AT-vger.kernel.org, UNGLinuxDriver-AT-microchip.com, linux-doc-AT-vger.kernel.org, Michal Kubecek <mkubecek-AT-suse.cz>, Roan van Dijk <roan-AT-protonic.nl>
Archive-link:  Article

changes v6:
- rework the code to use uint instead of u32/u64
- use bitset for flags
- use nest for each separate channel
changes v5:
- add struct phy_mse_snapshot and phy_mse_config to the documentation
changes v4:
- remove -ENETDOWN as expected error value for get_mse_config() and
  get_mse_snapshot()
- fix htmldocs builds
- s/__ethtool-a-mse/--ethtool-a-mse
changes v3:
- add missing ETHTOOL_A_LINKSTATE_MSE_* yaml changes
changes v2:
- rebase on latest net-next

This series introduces a generic kernel-userspace API for retrieving PHY
Mean Square Error (MSE) diagnostics, together with netlink integration,
a fast-path reporting hook in LINKSTATE_GET, and initial driver
implementations for the KSZ9477 and DP83TD510E PHYs.

MSE is defined by the OPEN Alliance "Advanced diagnostic features for
100BASE-T1 automotive Ethernet PHYs" specification [1] as a measure of
slicer error rate, typically used internally to derive the Signal
Quality Indicator (SQI). While SQI is useful as a normalized quality
index, it hides raw measurement data, varies in scaling and thresholds
between vendors, and may not indicate certain failure modes - for
example, cases where autonegotiation would fail even though SQI reports
a good link. In practice, such scenarios can only be investigated in
fixed-link mode; here, MSE can provide an empirically estimated value
indicating conditions under which autonegotiation would not succeed.

Example output with current implementation:
root@DistroKit:~ ethtool lan1
Settings for lan1:
...
        Speed: 1000Mb/s
        Duplex: Full
...
        Link detected: yes
        SQI: 5/7
        MSE: 3/127 (channel: worst)

root@DistroKit:~ ethtool --show-mse lan1
MSE diagnostics for lan1:
MSE Configuration:
        Max Average MSE: 127
        Refresh Rate: 2000000 ps
        Symbols per Sample: 250
        Supported capabilities: average channel-a channel-b channel-c
                                channel-d worst

MSE Snapshot (Channel: a):
        Average MSE: 4

MSE Snapshot (Channel: b):
        Average MSE: 3

MSE Snapshot (Channel: c):
        Average MSE: 2

MSE Snapshot (Channel: d):
        Average MSE: 3

[1] https://opensig.org/wp-content/uploads/2024/01/Advanced_P...

Oleksij Rempel (5):
  ethtool: introduce core UAPI and driver API for PHY MSE diagnostics
  ethtool: netlink: add ETHTOOL_MSG_MSE_GET and wire up PHY MSE access
  ethtool: netlink: add lightweight MSE reporting to LINKSTATE_GET
  net: phy: micrel: add MSE interface support for KSZ9477 family
  net: phy: dp83td510: add MSE interface support for 10BASE-T1L

 Documentation/netlink/specs/ethtool.yaml      | 195 +++++++++
 Documentation/networking/ethtool-netlink.rst  |  82 ++++
 drivers/net/phy/dp83td510.c                   |  61 +++
 drivers/net/phy/micrel.c                      | 101 +++++
 include/linux/phy.h                           | 127 ++++++
 include/uapi/linux/ethtool.h                  |   2 +
 .../uapi/linux/ethtool_netlink_generated.h    | 109 +++++
 net/ethtool/Makefile                          |   2 +-
 net/ethtool/common.c                          |  13 +
 net/ethtool/common.h                          |   2 +
 net/ethtool/linkstate.c                       |  94 ++++
 net/ethtool/mse.c                             | 411 ++++++++++++++++++
 net/ethtool/netlink.c                         |  10 +
 net/ethtool/netlink.h                         |   2 +
 net/ethtool/strset.c                          |   5 +
 15 files changed, 1215 insertions(+), 1 deletion(-)
 create mode 100644 net/ethtool/mse.c

--
2.47.3




Copyright © 2025, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds