]> git.baikalelectronics.ru Git - kernel.git/commit
net: phy: Fix "link partner" information disappear issue
authorYonglong Liu <liuyonglong@huawei.com>
Wed, 16 Oct 2019 02:30:39 +0000 (10:30 +0800)
committerDavid S. Miller <davem@davemloft.net>
Wed, 16 Oct 2019 20:17:01 +0000 (13:17 -0700)
commit4afbcd4212e2392c8f968a164dbf4151509c7a47
treec0225d3e3dcdef741584977b821f3f60710f2565
parent1eaf3a3514916127f03e9c7540258cc23ca2f8ee
net: phy: Fix "link partner" information disappear issue

Some drivers just call phy_ethtool_ksettings_set() to set the
links, for those phy drivers that use genphy_read_status(), if
autoneg is on, and the link is up, than execute "ethtool -s
ethx autoneg on" will cause "link partner" information disappear.

The call trace is phy_ethtool_ksettings_set()->phy_start_aneg()
->linkmode_zero(phydev->lp_advertising)->genphy_read_status(),
the link didn't change, so genphy_read_status() just return, and
phydev->lp_advertising is zero now.

This patch moves the clear operation of lp_advertising from
phy_start_aneg() to genphy_read_lpa()/genphy_c45_read_lpa(), and
if autoneg on and autoneg not complete, just clear what the
generic functions care about.

Fixes: 828930c11553 ("net: phy: avoid unneeded MDIO reads in genphy_read_status")
Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
Reviewed-by: Heiner Kallweit <hkallweit1@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/phy/phy-c45.c
drivers/net/phy/phy.c
drivers/net/phy/phy_device.c