Skip to content

Commit 0f1396d

Browse files
Russell King (Oracle)kuba-moo
authored andcommitted
net: phylink: use pcs_neg_mode in phylink_mac_pcs_get_state()
As in-band AN no longer just depends on MLO_AN_INBAND + Autoneg bit, we need to take account of the pcs_neg_mode when deciding how to initialise the speed, duplex and pause state members before calling into the .pcs_neg_mode() method. Add this. 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 9eb8069 commit 0f1396d

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

drivers/net/phy/phylink.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1492,12 +1492,24 @@ static int phylink_change_inband_advert(struct phylink *pl)
14921492
static void phylink_mac_pcs_get_state(struct phylink *pl,
14931493
struct phylink_link_state *state)
14941494
{
1495+
struct phylink_pcs *pcs;
1496+
bool autoneg;
1497+
14951498
linkmode_copy(state->advertising, pl->link_config.advertising);
14961499
linkmode_zero(state->lp_advertising);
14971500
state->interface = pl->link_config.interface;
14981501
state->rate_matching = pl->link_config.rate_matching;
1499-
if (linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
1500-
state->advertising)) {
1502+
state->an_complete = 0;
1503+
state->link = 1;
1504+
1505+
pcs = pl->pcs;
1506+
if (!pcs || pcs->neg_mode)
1507+
autoneg = pl->pcs_neg_mode == PHYLINK_PCS_NEG_INBAND_ENABLED;
1508+
else
1509+
autoneg = linkmode_test_bit(ETHTOOL_LINK_MODE_Autoneg_BIT,
1510+
state->advertising);
1511+
1512+
if (autoneg) {
15011513
state->speed = SPEED_UNKNOWN;
15021514
state->duplex = DUPLEX_UNKNOWN;
15031515
state->pause = MLO_PAUSE_NONE;
@@ -1506,11 +1518,9 @@ static void phylink_mac_pcs_get_state(struct phylink *pl,
15061518
state->duplex = pl->link_config.duplex;
15071519
state->pause = pl->link_config.pause;
15081520
}
1509-
state->an_complete = 0;
1510-
state->link = 1;
15111521

1512-
if (pl->pcs)
1513-
pl->pcs->ops->pcs_get_state(pl->pcs, state);
1522+
if (pcs)
1523+
pcs->ops->pcs_get_state(pcs, state);
15141524
else
15151525
state->link = 0;
15161526
}

0 commit comments

Comments
 (0)