* [PATCH] net: mii: Fix the Speed display when the network cable is not connected
@ 2025-01-15 11:18 Xiangqian Zhang
2025-01-16 1:42 ` Yanteng Si
0 siblings, 1 reply; 3+ messages in thread
From: Xiangqian Zhang @ 2025-01-15 11:18 UTC (permalink / raw)
To: andrew+netdev
Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel,
Xiangqian Zhang
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@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..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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] net: mii: Fix the Speed display when the network cable is not connected
2025-01-15 11:18 [PATCH] net: mii: Fix the Speed display when the network cable is not connected Xiangqian Zhang
@ 2025-01-16 1:42 ` Yanteng Si
0 siblings, 0 replies; 3+ messages in thread
From: Yanteng Si @ 2025-01-16 1:42 UTC (permalink / raw)
To: Xiangqian Zhang, andrew+netdev
Cc: davem, edumazet, kuba, pabeni, netdev, linux-kernel
在 2025/1/15 19:18, Xiangqian Zhang 写道:
> 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
So, you've already sent a v2. This patch should be sent as v3.
Also, the link to v2 should not be included in the commit message.
Instead, it should be placed here:
---
v2:
https://lore.kernel.org/20250111132242.3327654-1-zhangxiangqian@kylinos.cn
drivers/net/mii.c | 3 +++
1 file changed, 3 insertions(+)
Thanks,
Yanteng
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH] net: mii: Fix the Speed display when the network cable is not connected
@ 2025-01-10 9:03 Xiangqian Zhang
0 siblings, 0 replies; 3+ messages in thread
From: Xiangqian Zhang @ 2025-01-10 9:03 UTC (permalink / raw)
To: andrew+netdev
Cc: davem, edumazet, kuba, pabeni, netdev, inux-kernel,
Xiangqian Zhang
Speed should be SPEED_UNKNOWN when the network cable is not connected
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;
+
mii->full_duplex = cmd->base.duplex;
ethtool_convert_legacy_u32_to_link_mode(cmd->link_modes.supported,
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-01-16 1:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-15 11:18 [PATCH] net: mii: Fix the Speed display when the network cable is not connected Xiangqian Zhang
2025-01-16 1:42 ` Yanteng Si
-- strict thread matches above, loose matches on Subject: below --
2025-01-10 9:03 Xiangqian Zhang
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).