Skip to content

Commit

Permalink
net: phy: fix duplex out of sync problem while changing settings
Browse files Browse the repository at this point in the history
As reported by Zhang there's a small issue if in forced mode the duplex
mode changes with the link staying up [0]. In this case the MAC isn't
notified about the change.

The proposed patch relies on the phylib state machine and ignores the
fact that there are drivers that uses phylib but not the phylib state
machine. So let's don't change the behavior for such drivers and fix
it w/o re-adding state PHY_FORCING for the case that phylib state
machine is used.

[0] https://lore.kernel.org/netdev/[email protected]/T/

Fixes: 2bd229d ("net: phy: remove state PHY_FORCING")
Reported-by: Zhang Changzhong <[email protected]>
Tested-by: Zhang Changzhong <[email protected]>
Signed-off-by: Heiner Kallweit <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
hkallweit authored and kuba-moo committed Nov 4, 2021
1 parent 96d0c9b commit a4db905
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion drivers/net/phy/phy.c
Original file line number Diff line number Diff line change
Expand Up @@ -815,7 +815,12 @@ int phy_ethtool_ksettings_set(struct phy_device *phydev,
phydev->mdix_ctrl = cmd->base.eth_tp_mdix_ctrl;

/* Restart the PHY */
_phy_start_aneg(phydev);
if (phy_is_started(phydev)) {
phydev->state = PHY_UP;
phy_trigger_machine(phydev);
} else {
_phy_start_aneg(phydev);
}

mutex_unlock(&phydev->lock);
return 0;
Expand Down

0 comments on commit a4db905

Please sign in to comment.