Re: [PATCH net-next 2/5] ionic: Report "link_down_events_phy" in ethtool statistics

Jakub Kicinski
2026-05-01T23:39:52Z

On Thu, 30 Apr 2026 20:15:52 -0700 Eric Joyner wrote:
> The number of times that link has gone down at the port level is tracked
> by the firmware and sent to the driver via regular DMA writes to an
> instance of struct ionic_port_status in the driver's memory.
>
> This statistic was never reported, but it is useful for diagnostics, so
> add it to the "ethtool -S` stats output, grouped with the other
> port-level stats that are contained in struct ionic_port_stats.

We have a standard stat for this:

struct ethtool_link_ext_stats {
/* Custom Linux statistic for PHY level link down events.
* In a simpler world it should be equal to netdev->carrier_down_count
* unfortunately netdev also counts local reconfigurations which don't
* actually take the physical link down, not to mention NC-SI which,
* if present, keeps the link up regardless of host state.
* This statistic counts when PHY _actually_ went down, or lost link.
*
* Note that we need u64 for ethtool_stats_init() and comparisons
* to ETHTOOL_STAT_NOT_SET, but only u32 is exposed to the user.
*/
u64 link_down_events;
};

IOW the definition of this stat is - ignoring asymetric link faults
this counter should match between link partners.