]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: ethtool: plumb PHY stats to PHY drivers
authorJakub Kicinski <kuba@kernel.org>
Fri, 10 Jan 2025 06:05:12 +0000 (07:05 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 13 Mar 2025 12:02:07 +0000 (13:02 +0100)
commit9c1d09cdbcf5694670a36c1b35de41f658984f32
treecf1608ed6a91d40dc7edf5d73f8d23814a1ed144
parentb71cd95764ad964fec295a31c299b0f71799264f
net: ethtool: plumb PHY stats to PHY drivers

[ Upstream commit b7a2c1fe6b55364e61b4b54b991eb43a47bb1104 ]

Introduce support for standardized PHY statistics reporting in ethtool
by extending the PHYLIB framework. Add the functions
phy_ethtool_get_phy_stats() and phy_ethtool_get_link_ext_stats() to
provide a consistent interface for retrieving PHY-level and
link-specific statistics. These functions are used within the ethtool
implementation to avoid direct access to the phy_device structure
outside of the PHYLIB framework.

A new structure, ethtool_phy_stats, is introduced to standardize PHY
statistics such as packet counts, byte counts, and error counters.
Drivers are updated to include callbacks for retrieving PHY and
link-specific statistics, ensuring values are explicitly set only for
supported fields, initialized with ETHTOOL_STAT_NOT_SET to avoid
ambiguity.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Stable-dep-of: 637399bf7e77 ("net: ethtool: netlink: Allow NULL nlattrs when getting a phy_device")
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c
include/linux/ethtool.h
include/linux/phy.h
include/linux/phylib_stubs.h
net/ethtool/linkstate.c
net/ethtool/stats.c