summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRussell King (Oracle) <rmk+kernel@armlinux.org.uk>2025-01-13 12:22:39 +0300
committerJakub Kicinski <kuba@kernel.org>2025-01-16 00:23:30 +0300
commit60a331fff5e80a1f89260e2b1701c22e2ba08daf (patch)
tree43870daeed82f479dc2cef3d78d88828fe8045aa
parent7e3cb4e874ab0dcf8b10e43e5068824bf0adcb4c (diff)
downloadlinux-60a331fff5e80a1f89260e2b1701c22e2ba08daf.tar.xz
net: phylink: use neg_mode in phylink_mii_c22_pcs_decode_state()
Rather than using the state of the Autoneg bit, which is unreliable with the new PCS neg mode support, use the passed neg_mode to decide whether to decode the link partner advertisement data. Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk> Reviewed-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Tested-by: Maxime Chevallier <maxime.chevallier@bootlin.com> Link: https://patch.msgid.link/E1tXGed-000EtF-CN@rmk-PC.armlinux.org.uk Signed-off-by: Jakub Kicinski <kuba@kernel.org>
-rw-r--r--drivers/net/phy/phylink.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c
index b29b7e73b5bd..b79f975bc164 100644
--- a/drivers/net/phy/phylink.c
+++ b/drivers/net/phy/phylink.c
@@ -3877,11 +3877,15 @@ void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
{
state->link = !!(bmsr & BMSR_LSTATUS);
state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
- /* If there is no link or autonegotiation is disabled, the LP advertisement
- * data is not meaningful, so don't go any further.
+
+ /* If the link is down, the advertisement data is undefined. */
+ if (!state->link)
+ return;
+
+ /* If in-band is disabled, then the advertisement data is not
+ * meaningful.
*/
- if (!state->link || !linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
- state->advertising))
+ if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED)
return;
switch (state->interface) {