]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: fix save wrong speed and duplex problem if autoneg is on
authorGuangbin Huang <huangguangbin2@huawei.com>
Sat, 27 Feb 2021 03:05:58 +0000 (11:05 +0800)
committerDavid S. Miller <davem@davemloft.net>
Mon, 1 Mar 2021 21:16:16 +0000 (13:16 -0800)
commit71a751f9472bb11f64fb942dd4a3162977a0f19c
tree79984b97843e7427d4605a04243e11f07f7c98e4
parente269c5d4f6880a2e84c3aab9f153d293ec5edeeb
net: phy: fix save wrong speed and duplex problem if autoneg is on

If phy uses generic driver and autoneg is on, enter command
"ethtool -s eth0 speed 50" will not change phy speed actually, but
command "ethtool eth0" shows speed is 50Mb/s because phydev->speed
has been set to 50 and no update later.

And duplex setting has same problem too.

However, if autoneg is on, phy only changes speed and duplex according to
phydev->advertising, but not phydev->speed and phydev->duplex. So in this
case, phydev->speed and phydev->duplex don't need to be set in function
phy_ethtool_ksettings_set() if autoneg is on.

Fixes: 09e0fe0c3d47 ("PHY: Avoid unnecessary aneg restarts")
Signed-off-by: Guangbin Huang <huangguangbin2@huawei.com>
Signed-off-by: Huazhong Tan <tanhuazhong@huawei.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy.c