]> git.ipfire.org Git - thirdparty/linux.git/commit
phy: micrel: add Signal Quality Indicator (SQI) support for KSZ9477 switch PHYs
authorOleksij Rempel <o.rempel@pengutronix.de>
Fri, 27 Jun 2025 11:25:39 +0000 (13:25 +0200)
committerJakub Kicinski <kuba@kernel.org>
Wed, 2 Jul 2025 02:13:18 +0000 (19:13 -0700)
commitf461c7a885d9d625137b897cd63fa236e92e03c4
tree6b015c3f67173fa6dbe3adb323ae442d6ef3cdb7
parentbe75d319d1b3e9429bbb61681f14f88d59f32eb2
phy: micrel: add Signal Quality Indicator (SQI) support for KSZ9477 switch PHYs

Add support for the Signal Quality Indicator (SQI) feature on KSZ9477
family switches, providing a relative measure of receive signal quality.

The hardware exposes separate SQI readings per channel. For 1000BASE-T,
all four channels are read. For 100BASE-TX, only one channel is reported,
but which receive pair is active depends on Auto MDI-X negotiation, which
is not exposed by the hardware. Therefore, it is not possible to reliably
map the measured channel to a specific wire pair.

This resolves an earlier discussion about how to handle multi-channel
SQI. Originally, the plan was to expose all channels individually.
However, since pair mapping is sometimes unavailable, this
implementation treats SQI as a per-link metric instead. This fallback
avoids ambiguity and ensures consistent behavior. The existing get_sqi()
UAPI was designed for single-pair Ethernet (SPE), where per-pair and
per-link are effectively equivalent. Restricting its use to per-link
metrics does not introduce regressions for existing users.

The raw 7-bit SQI value (0–127, lower is better) is converted to the
standard 0–7 (high is better) scale. Empirical testing showed that the
link becomes unstable around a raw value of 8.

The SQI raw value remains zero if no data is received, even if noise is
present. This confirms that the measurement reflects the "quality" during
active data reception rather than the passive line state. User space
must ensure that traffic is present on the link to obtain valid SQI
readings.

Signed-off-by: Oleksij Rempel <o.rempel@pengutronix.de>
Link: https://patch.msgid.link/20250627112539.895255-1-o.rempel@pengutronix.de
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/phy/micrel.c