[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20250115112157.3894984-1-zhangxiangqian@kylinos.cn>
Date: Wed, 15 Jan 2025 19:21:57 +0800
From: Xiangqian Zhang <zhangxiangqian@...inos.cn>
To: andrew+netdev@...n.ch
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
netdev@...r.kernel.org,
linux-kernel@...r.kernel.org,
Xiangqian Zhang <zhangxiangqian@...inos.cn>
Subject: [PATCH v3 RESEND] net: mii: Fix the Speed display when the network cable is not connected
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.
v2:
https://lore.kernel.org/20250111132242.3327654-1-zhangxiangqian@kylinos.cn
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..37bc3131d31a 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 (!(bmsr & BMSR_LSTATUS))
+ cmd->base.speed = SPEED_UNKNOWN;
+
mii->full_duplex = cmd->base.duplex;
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
--
2.25.1
Powered by blists - more mailing lists