Re: [PATCH net-next v1 1/1] phy: dp83tg720: Add statistics support

From: Andrew Lunn
Date: Mon Aug 19 2024 - 17:57:53 EST


> +static const struct dp83tg720_hw_stat dp83tg720_hw_stats[] = {
> + {
> + .string = "esd_event_count",
> + .cache_index1 = DP83TG720_CACHE_A2D_REG_66,
> + .cache_index2 = DP83TG720_CACHE_EMPTY,
> + .mask1 = DP83TG720S_ESD_EVENT_COUNT_MASK,
> + .shift1 = 9,
> + .flags = DP83TG720_FLAG_COUNTER,
> + },
> + {
> + .string = "link_training_time",
> + .cache_index1 = DP83TG720_CACHE_LINK_QUAL_1,
> + .cache_index2 = DP83TG720_CACHE_EMPTY,
> + .mask1 = DP83TG720S_LINK_TRAINING_TIME_MASK,
> + },
> + {
> + .string = "remote_receiver_time",
> + .cache_index1 = DP83TG720_CACHE_LINK_QUAL_2,
> + .cache_index2 = DP83TG720_CACHE_EMPTY,
> + .mask1 = DP83TG720S_REMOTE_RECEIVER_TIME_MASK,
> + .shift1 = 8,
> + },

If i remember correctly, some of these are part of an Open Alliance
standard. Ideally, we want all PHYs which follow the standard to use
the same names of these statistics.

Maybe add to the open alliance header something like

#define TC42_ESD_EVENT_COUNT "esd_event_count"

Given that the Open Alliance failed to define the registers, i don't
think we can do much more than that?

> +static void dp83tg720_get_strings(struct phy_device *phydev, u8 *data)
> +{
> + int i, j = 0;
> +
> + for (i = 0; i < ARRAY_SIZE(dp83tg720_hw_stats); i++) {
> + strscpy(&data[j * ETH_GSTRING_LEN],
> + dp83tg720_hw_stats[i].string, ETH_GSTRING_LEN);

ethtool_puts()

Andrew

---
pw-bot: cr