OSDN Git Service

net: phylink: fix link mode modification in PHY mode
authorRussell King <rmk+kernel@armlinux.org.uk>
Tue, 19 Nov 2019 17:28:14 +0000 (17:28 +0000)
committerDavid S. Miller <davem@davemloft.net>
Wed, 20 Nov 2019 02:55:38 +0000 (18:55 -0800)
commitd9922c0e9171129aada1911489dc9e021fcfcb96
tree166444a71ee87b58a27bf2bdc2f3215c961fcc40
parent269a6b5f23a68803c3038faaef96acff2f18d22d
net: phylink: fix link mode modification in PHY mode

Modifying the link settings via phylink_ethtool_ksettings_set() and
phylink_ethtool_set_pauseparam() didn't always work as intended for
PHY based setups, as calling phylink_mac_config() would result in the
unresolved configuration being committed to the MAC, rather than the
configuration with the speed and duplex setting.

This would work fine if the update caused the link to renegotiate,
but if no settings have changed, phylib won't trigger a renegotiation
cycle, and the MAC will be left incorrectly configured.

Avoid calling phylink_mac_config() unless we are using an inband mode
in phylink_ethtool_ksettings_set(), and use phy_set_asym_pause() as
introduced in 4.20 to set the PHY settings in
phylink_ethtool_set_pauseparam().

Signed-off-by: Russell King <rmk+kernel@armlinux.org.uk>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phylink.c