From: Andrew Lunn <andrew@lunn.ch>
To: Linmao Li <lilinmao@kylinos.cn>
Cc: Andrew Lunn <andrew+netdev@lunn.ch>,
"David S . Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@kernel.org>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Xiangqian Zhang <zhangxiangqian@kylinos.cn>,
netdev@vger.kernel.org, linux-kernel@vger.kernel.org,
stable@vger.kernel.org
Subject: Re: [PATCH net] net: mii: Fix unknown speed after link up
Date: Wed, 30 Sep 2026 23:47:32 +0200 [thread overview]
Message-ID: <e31a9b2c-2f65-4767-b66a-85676d5a0d5c@lunn.ch> (raw)
In-Reply-To: <20260930113842.2640928-1-lilinmao@kylinos.cn>
On Wed, Sep 30, 2026 at 07:38:42PM +0800, Linmao Li wrote:
> mii_ethtool_get_link_ksettings() reads BMSR only once. Since
> BMSR_LSTATUS is latched low, the first query after link up can
> report SPEED_UNKNOWN even though the link is already up.
>
> This is seen with r8152, which detects carrier using a MAC register
> without clearing the BMSR latch. NetworkManager can then keep
> reporting 0 Mb/s until the next carrier change.
>
> Read BMSR twice to obtain the current link status, as mii_link_ok()
> already does.
There is a reason for this latch behaviour, so you should not ignore
it. It ensures a link down is reported, even if it is for a short
period.
I suggest you change the code to detect link based on BMSR, not a MAC
register. Better still, throw away all the mii code and port it to
phylink. A lot of code will go away because phylink/phylib and PHY
drivers will implement it.
Andrew
---
pw-bot: cr
next prev parent reply other threads:[~2026-09-30 21:47 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-30 11:38 [PATCH net] net: mii: Fix unknown speed after link up Linmao Li
2026-09-30 21:47 ` Andrew Lunn [this message]
2026-10-01 2:09 ` Linmao Li
2026-10-01 12:01 ` Andrew Lunn
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=e31a9b2c-2f65-4767-b66a-85676d5a0d5c@lunn.ch \
--to=andrew@lunn.ch \
--cc=andrew+netdev@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@kernel.org \
--cc=kuba@kernel.org \
--cc=lilinmao@kylinos.cn \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
--cc=zhangxiangqian@kylinos.cn \
/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