Re: [PATCH net-next v2 1/5] ethtool: introduce core UAPI and driver API for PHY MSE diagnostics

From: Andrew Lunn
Date: Tue Aug 19 2025 - 23:03:46 EST


> Channel-to-pair mapping is normally straightforward, but in some cases
> (e.g. 100BASE-TX with MDI-X resolution unknown) the mapping is ambiguous.
> If hardware does not expose MDI-X status, the exact pair cannot be
> determined. To avoid returning misleading per-channel data in this case,
> a LINK selector is defined for aggregate MSE measurements.

This is the same with cable test. The API just labels the pairs using

ETHTOOL_A_CABLE_PAIR_A,
ETHTOOL_A_CABLE_PAIR_B,
ETHTOOL_A_CABLE_PAIR_C,
ETHTOOL_A_CABLE_PAIR_D,

It does not take into account MDI-X or anything.

> @@ -1174,6 +1246,60 @@ struct phy_driver {
> /** @get_sqi_max: Get the maximum signal quality indication */
> int (*get_sqi_max)(struct phy_device *dev);
>
> + /**
> + * get_mse_config - Get configuration and scale of MSE measurement
> + * @dev: PHY device
> + * @config: Output (filled on success)
> + *
> + * Fill @config with the PHY's MSE configuration for the current
> + * link mode: scale limits (max_average_mse, max_peak_mse), update
> + * interval (refresh_rate_ps), sample length (num_symbols) and the
> + * capability bitmask (supported_caps).
> + *
> + * Implementations may defer configuration until hardware has
> + * converged; in that case they should return -EAGAIN and allow the
> + * caller to retry later.
> + *
> + * Return:
> + * * 0 - success, @config is valid
> + * * -EOPNOTSUPP - MSE configuration not implemented by the PHY
> + * or not supported in the current link mode
> + * * -ENETDOWN - link is down and configuration is not
> + * available in that state

This seems a bit odd. phylib knows the state of the link. If it is
down, why would it even ask?

Andrew