]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
net: phy: micrel: Add RX error counter support for KSZ9477 switch-integrated PHYs
authorOleksij Rempel <o.rempel@pengutronix.de>
Tue, 10 Jun 2025 09:13:53 +0000 (11:13 +0200)
committerJakub Kicinski <kuba@kernel.org>
Thu, 12 Jun 2025 00:37:48 +0000 (17:37 -0700)
commit597ebdf37222ba7deb2ed24aa4de777d7edf22f7
tree7ba10424460a579a3fff0f74c7fe5b742e3fff04
parentee868127170c1211c528f0629277d8b44a0e1852
net: phy: micrel: Add RX error counter support for KSZ9477 switch-integrated PHYs

Add support for tracking receive error statistics from PHYs integrated
into the KSZ9477 family of Ethernet switches.

The integrated PHYs expose a receive error (RXER) counter in register 0x15.
This counter increments when the PHY detects one or more symbol errors
on a received frame. The register is cleared upon reading.

Changes include:
- `kszphy_update_stats()` to accumulate the RX error count.
- `kszphy_get_phy_stats()` to expose this count via ethtool PHY stats.
- Addition of a private `rx_err_pkt_cnt` field in the driver.
- Registration of `.update_stats` and `.get_phy_stats` callbacks in the
  KSZ9477 PHY driver structure.

The functionality of this counter was confirmed by physically disturbing
the signal lines - specifically by wiggling exposed twisted pair wires and
intentionally shorting between pairs. These actions triggered RXER
increments, validating the counter's behavior.

This RXER counter is confirmed for KSZ9477 and likely applicable to
other related PHYs like those in KSZ9313.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Reviewed-by: Andrew Lunn <andrew@lunn.ch>
Link: https://patch.msgid.link/20250610091354.4060454-3-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/micrel.c