]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: Maintain MDIO device and bus statistics
authorFlorian Fainelli <f.fainelli@gmail.com>
Thu, 16 Jan 2020 04:48:50 +0000 (20:48 -0800)
committerDavid S. Miller <davem@davemloft.net>
Fri, 17 Jan 2020 10:12:44 +0000 (11:12 +0100)
commitcfb8dd63a00637d2368f63cae16f0e6274866a58
tree9c005fadcb64962761e2bbc9e72a8b1b46892df6
parente1bf3119d720b9c1cb27441aa8b0b28c324a2157
net: phy: Maintain MDIO device and bus statistics

We maintain global statistics for an entire MDIO bus, as well as broken
down, per MDIO bus address statistics. Given that it is possible for
MDIO devices such as switches to access MDIO bus addresses for which
there is not a mdio_device instance created (therefore not a a
corresponding device directory in sysfs either), we also maintain
per-address statistics under the statistics folder. The layout looks
like this:

/sys/class/mdio_bus/../statistics/
transfers
errrors
writes
reads
transfers_<addr>
errors_<addr>
writes_<addr>
reads_<addr>

When a mdio_device instance is registered, a statistics/ folder is
created with the tranfers, errors, writes and reads attributes which
point to the appropriate MDIO bus statistics structure.

Statistics are 64-bit unsigned quantities and maintained through the
u64_stats_sync.h helper functions.

Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
Tested-by: Andrew Lunn <andrew@lunn.ch>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Signed-off-by: David S. Miller <davem@davemloft.net>
Documentation/ABI/testing/sysfs-bus-mdio [new file with mode: 0644]
drivers/net/phy/mdio_bus.c
include/linux/phy.h