Skip to content

Commit 60a331f

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
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) <[email protected]> Reviewed-by: Maxime Chevallier <[email protected]> Tested-by: Maxime Chevallier <[email protected]> Link: https://patch.msgid.link/[email protected] Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 7e3cb4e commit 60a331f

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

drivers/net/phy/phylink.c

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3877,11 +3877,15 @@ void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
38773877
{
38783878
state->link = !!(bmsr & BMSR_LSTATUS);
38793879
state->an_complete = !!(bmsr & BMSR_ANEGCOMPLETE);
3880-
/* If there is no link or autonegotiation is disabled, the LP advertisement
3881-
* data is not meaningful, so don't go any further.
3880+
3881+
/* If the link is down, the advertisement data is undefined. */
3882+
if (!state->link)
3883+
return;
3884+
3885+
/* If in-band is disabled, then the advertisement data is not
3886+
* meaningful.
38823887
*/
3883-
if (!state->link || !linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
3884-
state->advertising))
3888+
if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED)
38853889
return;
38863890

38873891
switch (state->interface) {

0 commit comments

Comments
 (0)