[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20250114143721.670ee406@kernel.org>
Date: Tue, 14 Jan 2025 14:37:21 -0800
From: Jakub Kicinski <kuba@...nel.org>
To: Xiangqian Zhang <zhangxiangqian@...inos.cn>
Cc: andrew@...n.ch, andrew+netdev@...n.ch, davem@...emloft.net,
edumazet@...gle.com, linux-kernel@...r.kernel.org, netdev@...r.kernel.org,
pabeni@...hat.com
Subject: Re: [PATCH v2] net: mii: Fix the Speed display when the network
cable is not connected
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@...inos.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
Powered by blists - more mailing lists