Skip to content

Commit 406cb0c

Browse files
Russell Kingdavem330
authored andcommitted
net: phylink: ensure inband AN works correctly
Do not update the link interface mode while the link is down to avoid spurious link interface changes. Always call mac_config if we have a PHY to propagate the pause mode settings to the MAC. Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 94d250f commit 406cb0c

File tree

1 file changed

+15
-22
lines changed

1 file changed

+15
-22
lines changed

drivers/net/phy/phylink.c

Lines changed: 15 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -422,28 +422,21 @@ static void phylink_resolve(struct work_struct *w)
422422

423423
case MLO_AN_INBAND:
424424
phylink_get_mac_state(pl, &link_state);
425-
if (pl->phydev) {
426-
bool changed = false;
427-
428-
link_state.link = link_state.link &&
429-
pl->phy_state.link;
430-
431-
if (pl->phy_state.interface !=
432-
link_state.interface) {
433-
link_state.interface = pl->phy_state.interface;
434-
changed = true;
435-
}
436-
437-
/* Propagate the flow control from the PHY
438-
* to the MAC. Also propagate the interface
439-
* if changed.
440-
*/
441-
if (pl->phy_state.link || changed) {
442-
link_state.pause |= pl->phy_state.pause;
443-
phylink_resolve_flow(pl, &link_state);
444-
445-
phylink_mac_config(pl, &link_state);
446-
}
425+
426+
/* If we have a phy, the "up" state is the union of
427+
* both the PHY and the MAC */
428+
if (pl->phydev)
429+
link_state.link &= pl->phy_state.link;
430+
431+
/* Only update if the PHY link is up */
432+
if (pl->phydev && pl->phy_state.link) {
433+
link_state.interface = pl->phy_state.interface;
434+
435+
/* If we have a PHY, we need to update with
436+
* the pause mode bits. */
437+
link_state.pause |= pl->phy_state.pause;
438+
phylink_resolve_flow(pl, &link_state);
439+
phylink_mac_config(pl, &link_state);
447440
}
448441
break;
449442
}

0 commit comments

Comments
 (0)