aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/phy/phy.c
diff options
context:
space:
mode:
authorJakub Kicinski <[email protected]>2022-11-04 19:01:25 +0000
committerPaolo Abeni <[email protected]>2022-11-08 09:36:54 +0000
commit9a0f830f80265bd1ef816e1541ac24bee80e9a3c (patch)
tree6b133c57ec859a96c27e2a06c9f80405c448b540 /drivers/net/phy/phy.c
parentMerge branch 'net-txgbe-fix-two-bugs-in-txgbe_calc_eeprom_checksum' (diff)
downloadkernel-9a0f830f80265bd1ef816e1541ac24bee80e9a3c.tar.gz
kernel-9a0f830f80265bd1ef816e1541ac24bee80e9a3c.zip
ethtool: linkstate: add a statistic for PHY down events
The previous attempt to augment carrier_down (see Link) was not met with much enthusiasm so let's do the simple thing of exposing what some devices already maintain. Add a common ethtool statistic for link going down. Currently users have to maintain per-driver mapping to extract the right stat from the vendor-specific ethtool -S stats. carrier_down does not fit the bill because it counts a lot of software related false positives. Add the statistic to the extended link state API to steer vendors towards implementing all of it. Implement for bnxt and all Linux-controlled PHYs. mlx5 and (possibly) enic also have a counter for this but I leave the implementation to their maintainers. Link: https://lore.kernel.org/r/[email protected] Reviewed-by: Florian Fainelli <[email protected]> Reviewed-by: Michael Chan <[email protected]> Reviewed-by: Andrew Lunn <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Paolo Abeni <[email protected]>
Diffstat (limited to 'drivers/net/phy/phy.c')
-rw-r--r--drivers/net/phy/phy.c1
1 files changed, 1 insertions, 0 deletions
diff --git a/drivers/net/phy/phy.c b/drivers/net/phy/phy.c
index e741d8aebffe..e5b6cb1a77f9 100644
--- a/drivers/net/phy/phy.c
+++ b/drivers/net/phy/phy.c
@@ -67,6 +67,7 @@ static void phy_link_down(struct phy_device *phydev)
{
phydev->phy_link_change(phydev, false);
phy_led_trigger_change_speed(phydev);
+ WRITE_ONCE(phydev->link_down_events, phydev->link_down_events + 1);
}
static const char *phy_pause_str(struct phy_device *phydev)