Thread View: linux.kernel.netdev
4 messages
4 total messages
Started by Linmao Li
Fri, 09 Oct 2026 07:18
Re: [PATCH net v2] r8152: Use BMSR to detect the link state
Author: Linmao Li
Date: Fri, 09 Oct 2026 07:18
Date: Fri, 09 Oct 2026 07:18
63 lines
8346 bytes
8346 bytes
在 2026/10/6 2:32, Birger Koblitz 写道:
> Hi Linmao,
>
> On 05/10/2026 12:52 pm, Linmao Li wrote:
>> r8152 detects carrier from PLA_PHYSTATUS without reading BMSR, so
>> BMSR_LSTATUS can still be latched low when the carrier comes up.
>> Since commit f6f2e946aa4d ("net: mii: Fix the Speed display when the
>> network cable is not connected"), the first speed query after link up
>> can then report SPEED_UNKNOWN, leaving NetworkManager at 0 Mb/s until
>> the next carrier change.
>>
>> Use BMSR_LSTATUS in set_carrier() and rtl8152_runtime_resume(), so the
>> driver consumes the latched link down itself. If the first read still
>> reports link down, the next link-up notification triggers another read
>> and brings the carrier up.
>>
>> Tested on an RTL8153B with a 6.6-based kernel. In 5 rebinds and 6 cable
>> replugs, the first read returned LSTATUS=0, a second link-up
>> notification came about 32 ms later, the second read returned
>> LSTATUS=1 and the carrier went up; NetworkManager reported 1000 Mb/s.
>> Runtime suspend/resume with the link up did not change the carrier.
>
> I have been trying to reproduce the issue with the following adapter:
> driver: r8152
> version: 7.1.8+deb13-amd64
> firmware-version: rtl8153a-4 v2 02/07/20
>
> But I am not able to do so. Both after a link-up after a plugin event
> and after a system resume, ethtool always reports that the correct
> link speed and state. Could you explain, what you actually do,
> exactly? Or is the wrong link information only there for 32ms and I am
> just too slow?
>
> Birger
Hi Birger,
Thanks for testing. Only the first BMSR read after link up returns the
latched value, so ethtool shows the problem only if nothing else reads
the PHY first. On my systems NetworkManager reads it right after
carrier up, so a later ethtool reports 1000Mb/s while NetworkManager
keeps the unknown speed it read.
With an RTL8153B on v7.3-rc6, stopping NetworkManager was enough for
ethtool alone to show it after 3 of 3 USB rebinds:
# systemctl stop NetworkManager
# (rebind the device, bring the interface up, wait for carrier)
# ethtool <iface> | grep Speed
Speed: Unknown!
# ethtool <iface> | grep Speed
Speed: 1000Mb/s
I got the same result with cable replugs on a 6.6-based kernel. The
latch does not time out: the first ethtool still reported Unknown 3 s
after carrier up. On the 6.6-based system, the network service of a
Chromium-based browser also read the PHY first, so other tools may
need to be stopped too. I have not checked your setup and have not
tested an RTL8153A.
Thanks,
Linmao
Re: [PATCH net v2] r8152: Use BMSR to detect the link state
Author: Birger Koblitz
Date: Mon, 12 Oct 2026 16:13
Date: Mon, 12 Oct 2026 16:13
51 lines
8692 bytes
8692 bytes
Hi Linmao, On 09/10/2026 9:18 am, Linmao Li wrote: > Hi Birger, > > Thanks for testing. Only the first BMSR read after link up returns the > latched value, so ethtool shows the problem only if nothing else reads > the PHY first. On my systems NetworkManager reads it right after > carrier up, so a later ethtool reports 1000Mb/s while NetworkManager > keeps the unknown speed it read. > > With an RTL8153B on v7.3-rc6, stopping NetworkManager was enough for > ethtool alone to show it after 3 of 3 USB rebinds: > > # systemctl stop NetworkManager > # (rebind the device, bring the interface up, wait for carrier) > # ethtool <iface> | grep Speed > Speed: Unknown! > # ethtool <iface> | grep Speed > Speed: 1000Mb/s > > I got the same result with cable replugs on a 6.6-based kernel. The > latch does not time out: the first ethtool still reported Unknown 3 s > after carrier up. On the 6.6-based system, the network service of a > Chromium-based browser also read the PHY first, so other tools may > need to be stopped too. I have not checked your setup and have not > tested an RTL8153A. Thanks for the explanation. I re-did the test and confirm that the fix works. I tested on: RTL8157 (5GBit device, 2.5GBit link) driver: r8152 version: 7.1.8+deb13-amd64 firmware-version: rtl8157-1 v1 2026/01/01 RTL8153A (1GBit device, 1GBit link) driver: r8152 version: 7.1.8+deb13-amd64 firmware-version: rtl8153a-4 v2 02/07/20 both worked flawlessly. I tested - plug/unplug during normal operation - link-changes by peer in normal operation - plug or unplug during suspend, then resume Tested-by: Birger Koblitz <mail@birger-koblitz.de> Birger
Re: [PATCH net v2] r8152: Use BMSR to detect the link state
Author: Linmao Li
Date: Tue, 13 Oct 2026 02:38
Date: Tue, 13 Oct 2026 02:38
65 lines
8055 bytes
8055 bytes
在 2026/10/13 0:13, Birger Koblitz 写道: > Hi Linmao, > > On 09/10/2026 9:18 am, Linmao Li wrote: > >> Hi Birger, >> >> Thanks for testing. Only the first BMSR read after link up returns the >> latched value, so ethtool shows the problem only if nothing else reads >> the PHY first. On my systems NetworkManager reads it right after >> carrier up, so a later ethtool reports 1000Mb/s while NetworkManager >> keeps the unknown speed it read. >> >> With an RTL8153B on v7.3-rc6, stopping NetworkManager was enough for >> ethtool alone to show it after 3 of 3 USB rebinds: >> >> # systemctl stop NetworkManager >> # (rebind the device, bring the interface up, wait for carrier) >> # ethtool <iface> | grep Speed >> Speed: Unknown! >> # ethtool <iface> | grep Speed >> Speed: 1000Mb/s >> >> I got the same result with cable replugs on a 6.6-based kernel. The >> latch does not time out: the first ethtool still reported Unknown 3 s >> after carrier up. On the 6.6-based system, the network service of a >> Chromium-based browser also read the PHY first, so other tools may >> need to be stopped too. I have not checked your setup and have not >> tested an RTL8153A. > > Thanks for the explanation. I re-did the test and confirm that the fix > works. I tested on: > > RTL8157 (5GBit device, 2.5GBit link) > driver: r8152 > version: 7.1.8+deb13-amd64 > firmware-version: rtl8157-1 v1 2026/01/01 > > RTL8153A (1GBit device, 1GBit link) > driver: r8152 > version: 7.1.8+deb13-amd64 > firmware-version: rtl8153a-4 v2 02/07/20 > > both worked flawlessly. I tested > - plug/unplug during normal operation > - link-changes by peer in normal operation > - plug or unplug during suspend, then resume > > Tested-by: Birger Koblitz <mail@birger-koblitz.de> > > Birger Hi Birger, Thanks a lot for testing both devices. Just to be sure, was it the v2 patch as posted, without other changes? The RTL8157 result is interesting given Hayes's comment about the newer ICs. The next version will probably change the approach, so I will only keep your Tested-by if the code stays the same, and would be glad if you could test it again. Thanks, Linmao
Re: [PATCH net v2] r8152: Use BMSR to detect the link state
Author: Birger Koblitz
Date: Tue, 13 Oct 2026 03:51
Date: Tue, 13 Oct 2026 03:51
21 lines
7920 bytes
7920 bytes
Hi Linmao, On 13/10/2026 4:38 am, Linmao Li wrote: > Thanks a lot for testing both devices. Just to be sure, was it the v2 > patch as posted, without other changes? The RTL8157 result is > interesting given Hayes's comment about the newer ICs. > > The next version will probably change the approach, so I will only > keep your Tested-by if the code stays the same, and would be glad if > you could test it again. I tested your v2 without further changes and I can test again if you like. I also found more adapters, including an RTL8159 and RTL8156 plus some more 1GBit ones I don't know exactly what they are at the moment. I can test those, too in a next round if you like. I also wonder which role FW plays in this respect. I would suspect that this could be configurable. Maybe Hayes can comment. Birger
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads