Skip to content

Commit e432ffc

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: provide fixed state for 1000base-X and 2500base-X
When decoding clause 22 state, if in-band is disabled and using either 1000base-X or 2500base-X, rather than reporting link-down, we know the speed, and we only support full duplex. Pause modes taken from XPCS. This fixes a problem reported by Eric Woudstra. 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 60a331f commit e432ffc

File tree

1 file changed

+19
-10
lines changed

1 file changed

+19
-10
lines changed

drivers/net/phy/phylink.c

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3882,27 +3882,36 @@ void phylink_mii_c22_pcs_decode_state(struct phylink_link_state *state,
38823882
if (!state->link)
38833883
return;
38843884

3885-
/* If in-band is disabled, then the advertisement data is not
3886-
* meaningful.
3887-
*/
3888-
if (neg_mode != PHYLINK_PCS_NEG_INBAND_ENABLED)
3889-
return;
3890-
38913885
switch (state->interface) {
38923886
case PHY_INTERFACE_MODE_1000BASEX:
3893-
phylink_decode_c37_word(state, lpa, SPEED_1000);
3887+
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
3888+
phylink_decode_c37_word(state, lpa, SPEED_1000);
3889+
} else {
3890+
state->speed = SPEED_1000;
3891+
state->duplex = DUPLEX_FULL;
3892+
state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
3893+
}
38943894
break;
38953895

38963896
case PHY_INTERFACE_MODE_2500BASEX:
3897-
phylink_decode_c37_word(state, lpa, SPEED_2500);
3897+
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED) {
3898+
phylink_decode_c37_word(state, lpa, SPEED_2500);
3899+
} else {
3900+
state->speed = SPEED_2500;
3901+
state->duplex = DUPLEX_FULL;
3902+
state->pause |= MLO_PAUSE_TX | MLO_PAUSE_RX;
3903+
}
38983904
break;
38993905

39003906
case PHY_INTERFACE_MODE_SGMII:
39013907
case PHY_INTERFACE_MODE_QSGMII:
3902-
phylink_decode_sgmii_word(state, lpa);
3908+
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
3909+
phylink_decode_sgmii_word(state, lpa);
39033910
break;
3911+
39043912
case PHY_INTERFACE_MODE_QUSGMII:
3905-
phylink_decode_usgmii_word(state, lpa);
3913+
if (neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED)
3914+
phylink_decode_usgmii_word(state, lpa);
39063915
break;
39073916

39083917
default:

0 commit comments

Comments
 (0)