diff options
-rw-r--r-- | drivers/net/phy/phylink.c | 19 |
1 files changed, 17 insertions, 2 deletions
diff --git a/drivers/net/phy/phylink.c b/drivers/net/phy/phylink.c index 161c4d828437..39c4b8e29fae 100644 --- a/drivers/net/phy/phylink.c +++ b/drivers/net/phy/phylink.c @@ -1144,6 +1144,15 @@ static unsigned int phylink_pcs_neg_mode(unsigned int mode, return neg_mode; } +static u8 phylink_choose_act_link_an_mode(struct phylink *pl) +{ + if (pl->req_link_an_mode == MLO_AN_INBAND && pl->phydev && + pl->pcs_neg_mode == PHYLINK_PCS_NEG_OUTBAND) + return MLO_AN_PHY; + + return pl->req_link_an_mode; +} + static void phylink_major_config(struct phylink *pl, bool restart, const struct phylink_link_state *state) { @@ -1171,7 +1180,10 @@ static void phylink_major_config(struct phylink *pl, bool restart, pcs_changed = pcs && pl->pcs != pcs; } - pl->act_link_an_mode = pl->req_link_an_mode; + /* set the active link AN mode, which may end up different from the + * current link AN mode depending on the PCS and PHY capabilities. + */ + pl->act_link_an_mode = phylink_choose_act_link_an_mode(pl); phylink_pcs_poll_stop(pl); @@ -1267,7 +1279,10 @@ static int phylink_change_inband_advert(struct phylink *pl) pl->link_config.interface, pl->link_config.advertising); - pl->act_link_an_mode = pl->req_link_an_mode; + /* set the active link AN mode, which may end up different from the + * current link AN mode depending on the PCS and PHY capabilities. + */ + pl->act_link_an_mode = phylink_choose_act_link_an_mode(pl); neg_mode = pl->act_link_an_mode; if (pl->pcs->neg_mode) |