From: Yonglong Liu <liuyonglong@huawei.com>
To: Heiner Kallweit <hkallweit1@gmail.com>, <davem@davemloft.net>,
<andrew@lunn.ch>, Florian Fainelli <f.fainelli@gmail.com>
Cc: <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
<linuxarm@huawei.com>, <salil.mehta@huawei.com>,
<yisen.zhuang@huawei.com>, <shiju.jose@huawei.com>
Subject: Re: [RFC PATCH net] net: phy: Fix "link partner" information disappear issue
Date: Fri, 11 Oct 2019 13:55:30 +0800 [thread overview]
Message-ID: <670bd6ac-54ee-ecfa-c108-fcf48a3a7dc8@huawei.com> (raw)
In-Reply-To: <ee969d27-debe-9bc4-92f2-fe5b04c36a39@gmail.com>
On 2019/10/11 3:17, Heiner Kallweit wrote:
> On 10.10.2019 11:30, Yonglong Liu wrote:
>> 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.
>>
> I think that clearing link partner advertising info in
> phy_start_aneg() is questionable. If advertising doesn't change
> then phy_config_aneg() basically is a no-op. Instead we may have
> to clear the link partner advertising info in genphy_read_lpa()
> if aneg is disabled or aneg isn't completed (basically the same
> as in genphy_c45_read_lpa()). Something like:
>
> if (!phydev->autoneg_complete) { /* also covers case that aneg is disabled */
> linkmode_zero(phydev->lp_advertising);
> } else if (phydev->autoneg == AUTONEG_ENABLE) {
> ...
> }
>
If clear the link partner advertising info in genphy_read_lpa() and
genphy_c45_read_lpa(), for the drivers that use genphy_read_status()
is ok, but for those drivers that use there own read_status() may
have problem, like aqr_read_status(), it will update lp_advertising
first, and than call genphy_c45_read_status(), so will cause
lp_advertising lost.
Another question, please see genphy_c45_read_status(), if clear the
link partner advertising info in genphy_c45_read_lpa(), if autoneg is
off, phydev->lp_advertising will not clear.
>> This patch call genphy_read_lpa() before the link state judgement
>> to fix this problem.
>>
>> Fixes: 88d6272acaaa ("net: phy: avoid unneeded MDIO reads in genphy_read_status")
>> Signed-off-by: Yonglong Liu <liuyonglong@huawei.com>
>> ---
>> drivers/net/phy/phy_device.c | 8 ++++----
>> 1 file changed, 4 insertions(+), 4 deletions(-)
>>
>> diff --git a/drivers/net/phy/phy_device.c b/drivers/net/phy/phy_device.c
>> index 9d2bbb1..ef3073c 100644
>> --- a/drivers/net/phy/phy_device.c
>> +++ b/drivers/net/phy/phy_device.c
>> @@ -1839,6 +1839,10 @@ int genphy_read_status(struct phy_device *phydev)
>> if (err)
>> return err;
>>
>> + err = genphy_read_lpa(phydev);
>> + if (err < 0)
>> + return err;
>> +
>> /* why bother the PHY if nothing can have changed */
>> if (phydev->autoneg == AUTONEG_ENABLE && old_link && phydev->link)
>> return 0;
>> @@ -1848,10 +1852,6 @@ int genphy_read_status(struct phy_device *phydev)
>> phydev->pause = 0;
>> phydev->asym_pause = 0;
>>
>> - err = genphy_read_lpa(phydev);
>> - if (err < 0)
>> - return err;
>> -
>> if (phydev->autoneg == AUTONEG_ENABLE && phydev->autoneg_complete) {
>> phy_resolve_aneg_linkmode(phydev);
>> } else if (phydev->autoneg == AUTONEG_DISABLE) {
>>
>
>
> .
>
next prev parent reply other threads:[~2019-10-11 5:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-10 9:30 [RFC PATCH net] net: phy: Fix "link partner" information disappear issue Yonglong Liu
2019-10-10 19:17 ` Heiner Kallweit
2019-10-11 5:55 ` Yonglong Liu [this message]
2019-10-12 20:40 ` Heiner Kallweit
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=670bd6ac-54ee-ecfa-c108-fcf48a3a7dc8@huawei.com \
--to=liuyonglong@huawei.com \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=f.fainelli@gmail.com \
--cc=hkallweit1@gmail.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linuxarm@huawei.com \
--cc=netdev@vger.kernel.org \
--cc=salil.mehta@huawei.com \
--cc=shiju.jose@huawei.com \
--cc=yisen.zhuang@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).