Skip to content

Commit

Permalink
net: phylink: use neg_mode in phylink_mii_c22_pcs_decode_state()
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Russell King (Oracle) authored and Jakub Kicinski committed Jan 15, 2025
1 parent 7e3cb4e commit 60a331f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions drivers/net/phy/phylink.c
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 60a331f

Please sign in to comment.