Re: [PATCH net-next v2 1/5] ethtool: introduce core UAPI and driver API for PHY MSE diagnostics
From: Oleksij Rempel
Date: Wed Aug 20 2025 - 00:45:58 EST
On Wed, Aug 20, 2025 at 05:03:14AM +0200, Andrew Lunn wrote:
> > 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.
In the case of the cable test, MDI-X does not affect the reported
results, or if it does, we can actively change the configuration and
re-run the test. For SQI/MSE on this chip, however, the measurement is
purely passive. If the hardware does not expose an MDI-X indicator, we
cannot reliably assign the values to a specific pair, so we need the
LINK selector to avoid returning misleading data.
> > @@ -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?
Good point. I'll remove this part of comment.
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |