From: Jakub Kicinski <kuba@kernel.org>
To: Xiangqian Zhang <zhangxiangqian@kylinos.cn>
Cc: andrew@lunn.ch, andrew+netdev@lunn.ch, davem@davemloft.net,
edumazet@google.com, linux-kernel@vger.kernel.org,
netdev@vger.kernel.org, pabeni@redhat.com
Subject: Re: [PATCH v2] net: mii: Fix the Speed display when the network cable is not connected
Date: Tue, 14 Jan 2025 14:37:21 -0800 [thread overview]
Message-ID: <20250114143721.670ee406@kernel.org> (raw)
In-Reply-To: <20250111132242.3327654-1-zhangxiangqian@kylinos.cn>
On Sat, 11 Jan 2025 21:22:42 +0800 Xiangqian Zhang wrote:
> Two different models of usb card, the drivers are r8152 and asix. If no
> network cable is connected, Speed = 10Mb/s. This problem is repeated in
> linux 3.10, 4.19, and 5.4. Both drivers call
> mii_ethtool_get_link_ksettings, but the value of cmd->base.speed in this
> function can only be SPEED_1000 or SPEED_100 or SPEED_10.
> When the network cable is not connected, set cmd->base.speed
> =SPEED_UNKNOWN.
>
> Signed-off-by: Xiangqian Zhang <zhangxiangqian@kylinos.cn>
> ---
> drivers/net/mii.c | 3 +++
> 1 file changed, 3 insertions(+)
>
> diff --git a/drivers/net/mii.c b/drivers/net/mii.c
> index 22680f47385d..297a0cc3682f 100644
> --- a/drivers/net/mii.c
> +++ b/drivers/net/mii.c
> @@ -213,6 +213,9 @@ void mii_ethtool_get_link_ksettings(struct mii_if_info *mii,
> lp_advertising = 0;
> }
>
> + if (!mii_link_ok(mii))
> + cmd->base.speed = SPEED_UNKNOWN;
Maybe you could use the already read value of bmsr?
if (!(bmsr & BMSR_LSTATUS))
cmd->base.speed = SPEED_UNKNOWN;
When you post a v3 please added a link to v2:
---
v2: https://lore.kernel.org/20250111132242.3327654-1-zhangxiangqian@kylinos.cn
but do *not* post it in reply to this thread.
--
pw-bot: cr
prev parent reply other threads:[~2025-01-14 22:37 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-10 9:23 [PATCH RESEND] net: mii: Fix the Speed display when the network cable is not connected Xiangqian Zhang
2025-01-10 18:03 ` Andrew Lunn
2025-01-11 13:22 ` [PATCH v2] " Xiangqian Zhang
2025-01-14 22:37 ` Jakub Kicinski [this message]
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=20250114143721.670ee406@kernel.org \
--to=kuba@kernel.org \
--cc=andrew+netdev@lunn.ch \
--cc=andrew@lunn.ch \
--cc=davem@davemloft.net \
--cc=edumazet@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--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;
as well as URLs for NNTP newsgroup(s).