mirror of
https://github.com/raspberrypi/linux.git
synced 2025-12-25 19:42:19 +00:00
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/20220520004500.2250674-1-kuba@kernel.org Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Reviewed-by: Michael Chan <michael.chan@broadcom.com> Reviewed-by: Andrew Lunn <andrew@lunn.ch> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://lore.kernel.org/r/20221104190125.684910-1-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
This commit is contained in:
committed by
Paolo Abeni
parent
91c596cc8d
commit
9a0f830f80
@@ -4112,6 +4112,20 @@ static void bnxt_get_rmon_stats(struct net_device *dev,
|
||||
*ranges = bnxt_rmon_ranges;
|
||||
}
|
||||
|
||||
static void bnxt_get_link_ext_stats(struct net_device *dev,
|
||||
struct ethtool_link_ext_stats *stats)
|
||||
{
|
||||
struct bnxt *bp = netdev_priv(dev);
|
||||
u64 *rx;
|
||||
|
||||
if (BNXT_VF(bp) || !(bp->flags & BNXT_FLAG_PORT_STATS_EXT))
|
||||
return;
|
||||
|
||||
rx = bp->rx_port_stats_ext.sw_stats;
|
||||
stats->link_down_events =
|
||||
*(rx + BNXT_RX_STATS_EXT_OFFSET(link_down_events));
|
||||
}
|
||||
|
||||
void bnxt_ethtool_free(struct bnxt *bp)
|
||||
{
|
||||
kfree(bp->test_info);
|
||||
@@ -4161,6 +4175,7 @@ const struct ethtool_ops bnxt_ethtool_ops = {
|
||||
.get_eeprom = bnxt_get_eeprom,
|
||||
.set_eeprom = bnxt_set_eeprom,
|
||||
.get_link = bnxt_get_link,
|
||||
.get_link_ext_stats = bnxt_get_link_ext_stats,
|
||||
.get_eee = bnxt_get_eee,
|
||||
.set_eee = bnxt_set_eee,
|
||||
.get_module_info = bnxt_get_module_info,
|
||||
|
||||
Reference in New Issue
Block a user