i40e: add link_down_events statistic
Subsystems (3)
PATCH 1/1 i40e: add link_down_events statistic
Introduce a link_down_events counter to the i40e driver, incremented each time the link transitions from up to down.
This counter can help diagnose issues related to link stability, such as port flapping or unexpected link drops.
The value is exposed via ethtool's get_link_ext_stats() interface.
---
Based on series [1] from Martyna where this was implemented for ixgbe and ice drivers.
[1] https://lore.kernel.org/netdev/[email protected]/
--- drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 10 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++ 3 files changed, 14 insertions(+)
drivers/net/ethernet/intel/i40e/i40e.h +1 -0
@@ -548,6 +548,7 @@ struct i40e_pf {u16 empr_count;/* EMP reset count */ u16 pfr_count;/* PF reset count */ u16 sw_int_count;/* SW interrupt count */ +u32 link_down_events;struct mutex switch_mutex;u16 lan_vsi;/* our default LAN VSI */
drivers/net/ethernet/intel/i40e/i40e_ethtool.c +10 -0
@@ -2749,6 +2749,15 @@ static void i40e_diag_test(struct net_device *netdev,netif_info (pf, drv, netdev,"testing failed\n" ); } +static void i40e_get_link_ext_stats (struct net_device *netdev, +struct ethtool_link_ext_stats *stats) +{ +struct i40e_netdev_priv *np =netdev_priv (netdev); +struct i40e_pf *pf = np->vsi->back; + + stats->link_down_events = pf->link_down_events; +} +static void i40e_get_wol (struct net_device *netdev,struct ethtool_wolinfo *wol) {
@@ -5807,6 +5816,7 @@ static const struct ethtool_ops i40e_ethtool_ops = { .get_regs = i40e_get_regs, .nway_reset = i40e_nway_reset, .get_link = ethtool_op_get_link, + .get_link_ext_stats = i40e_get_link_ext_stats, .get_wol = i40e_get_wol, .set_wol = i40e_set_wol, .set_eeprom = i40e_set_eeprom,
drivers/net/ethernet/intel/i40e/i40e_main.c +3 -0
@@ -9933,6 +9933,9 @@ static void i40e_link_event(struct i40e_pf *pf) new_link == netif_carrier_ok(vsi->netdev)))return ; +if (!new_link && old_link) + pf->link_down_events++; +i40e_print_link_message (vsi, new_link);/* Notify the base of the switch tree connected to
Signature · 1 line
2.47.0
Quoted 11 lines · Dawid Osuchowski
Introduce a
link_down_eventscounter to the i40e driver, incremented each time the link transitions from up to down.
This counter can help diagnose issues related to link stability, such as port flapping or unexpected link drops.The value is exposed via ethtool's
get_link_ext_stats()interface.Co-developed-by Martyna Szapar-Mudlaw <[email protected]>Signed-off-by Martyna Szapar-Mudlaw <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>Signed-off-by Dawid Osuchowski <[email protected]>
Quoted 5 lines
---
Based on series [1] from Martyna where this was implemented for ixgbe and ice drivers.
Quoted 19 lines
-----Original Message-----
From: Intel-wired-lan <[email protected]> On Behalf Of Dawid Osuchowski
Sent: 21 May 2025 19:54
To: [email protected]
Cc: [email protected]; Dawid Osuchowski <[email protected]>; Martyna Szapar-Mudlaw <[email protected]>; Michal Swiatkowski <[email protected]>
Subject: [Intel-wired-lan] [PATCH iwl-next] i40e: addlink_down_eventsstatisticIntroduce a
link_down_eventscounter to the i40e driver, incremented each time the link transitions from up to down. This counter can help diagnose issues related to link stability, such as port flapping or unexpected link drops.The value is exposed via ethtool's
get_link_ext_stats()interface.Co-developed-by Martyna Szapar-Mudlaw <[email protected]>Signed-off-by Martyna Szapar-Mudlaw <[email protected]>Reviewed-by Michal Swiatkowski <[email protected]>Signed-off-by Dawid Osuchowski <[email protected]>---
Based on series [1] from Martyna where this was implemented for ixgbe and ice drivers.
Quoted 7 lines
[1] https://lore.kernel.org/netdev/[email protected]/
---drivers/net/ethernet/intel/i40e/i40e.h | 1 + drivers/net/ethernet/intel/i40e/i40e_ethtool.c | 10 ++++++++++ drivers/net/ethernet/intel/i40e/i40e_main.c | 3 +++ 3 files changed, 14 insertions(+)