netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Realtek RTL8156 devices defaulting to CDC-NCM instead of vendor mode, resulting in reduced performance
@ 2022-05-02  6:43 Forest Crossman
  2022-05-03  3:08 ` Hayes Wang
  0 siblings, 1 reply; 2+ messages in thread
From: Forest Crossman @ 2022-05-02  6:43 UTC (permalink / raw)
  To: hayeswang, davem, kuba; +Cc: netdev, linux-usb

Hi, all,

I recently purchased a pair of USB to 2.5G Ethernet dongles based on
the RTL8156, and have so far been very happy with them, but only after
adding some udev rules[0] to to take advantage of the r8152 driver by
switching the devices from their default CDC-NCM mode to the vendor
mode. I was prompted to use those rules to switch the driver because
one of the adapters (based on the RTL8156A) would get very hot, up to
120 F (49 C) even while idle, and the round-trip latency directly
between the pair of adapters was about 3 ms, and I couldn't help but
wonder if maybe the vendor mode might be more efficient.

After performing some tests of latency and power consumption, testing
first with both adapters in NCM mode and then again with both in
vendor mode, I proved my hunch correct. I discovered that, in a
disconnected state, the RTL8156A adapter used about half as much power
(0.64 W -> 0.30 W) while the RTL8156B adapter saw a 21% reduction in
power (0.34 W -> 0.27 W). Similarly, in a connected-but-idle state the
RTL8156A again saw about a 55% savings in power consumption (2.17 W ->
0.97 W) and a 40% savings in the RTL8156B adapter (0.94 W -> 0.56 W).
It was only under full load that the fewest power savings were seen,
with a reduction of only 15% in the RTL8156A (2.23 W -> 1.90 W) and no
savings for the RTL8156B (0.96 W). Similarly, round-trip latency while
idle went from 3 ms to 0.6 ms. I also tested under load and saw much
larger latency savings and reduced packet loss, but forgot to write
down the numbers (I can run the tests again if someone really wants me
too). Also, jumbo frames drastically reduced performance under NCM
mode, while vendor mode handled it like a champ (again, I forgot to
write down the numbers but can test again if asked).

So, with all the benefits I've seen from using these adapters in their
vendor mode, is there still a reason to let the kernel prefer their
NCM mode? It'd be nice to be able to get the maximum performance from
these adapters on any Linux system I plug them into, without having to
install a udev rule on every one of those systems.

If anyone would like to try replicating the results I listed here, or
to perform new tests, the specific RTL8156A adapter I used is the
Ugreen CM275[1] and the RTL8156B adapter is the Inateck ET1001[2].


Curious to hear your thoughts on this,

Forest


[0]: https://github.com/bb-qq/r8152/blob/160fb96d2319cdf64ae7597e8739972934ac83b2/50-usb-realtek-net.rules
[1]: https://www.amazon.com/gp/product/B081TY1WQX/
[2]: https://www.amazon.com/gp/product/B08VN3DGK6/

^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: Realtek RTL8156 devices defaulting to CDC-NCM instead of vendor mode, resulting in reduced performance
  2022-05-02  6:43 Realtek RTL8156 devices defaulting to CDC-NCM instead of vendor mode, resulting in reduced performance Forest Crossman
@ 2022-05-03  3:08 ` Hayes Wang
  0 siblings, 0 replies; 2+ messages in thread
From: Hayes Wang @ 2022-05-03  3:08 UTC (permalink / raw)
  To: Forest Crossman, davem, kuba; +Cc: netdev, linux-usb, nic_swsd

Forest Crossman <cyrozap@gmail.com>
> Sent: Monday, May 2, 2022 2:43 PM
> To: Hayes Wang <hayeswang@realtek.com>; davem@davemloft.net;
> kuba@kernel.org
> Cc: netdev@vger.kernel.org; linux-usb@vger.kernel.org
> Subject: Realtek RTL8156 devices defaulting to CDC-NCM instead of vendor
> mode, resulting in reduced performance
> 
> Hi, all,
> 
> I recently purchased a pair of USB to 2.5G Ethernet dongles based on
> the RTL8156, and have so far been very happy with them, but only after
> adding some udev rules[0] to to take advantage of the r8152 driver by
> switching the devices from their default CDC-NCM mode to the vendor
> mode. I was prompted to use those rules to switch the driver because
> one of the adapters (based on the RTL8156A) would get very hot, up to
> 120 F (49 C) even while idle, and the round-trip latency directly
> between the pair of adapters was about 3 ms, and I couldn't help but
> wonder if maybe the vendor mode might be more efficient.
> 
> After performing some tests of latency and power consumption, testing
> first with both adapters in NCM mode and then again with both in
> vendor mode, I proved my hunch correct. I discovered that, in a
> disconnected state, the RTL8156A adapter used about half as much power
> (0.64 W -> 0.30 W) while the RTL8156B adapter saw a 21% reduction in
> power (0.34 W -> 0.27 W). Similarly, in a connected-but-idle state the
> RTL8156A again saw about a 55% savings in power consumption (2.17 W ->
> 0.97 W) and a 40% savings in the RTL8156B adapter (0.94 W -> 0.56 W).
> It was only under full load that the fewest power savings were seen,
> with a reduction of only 15% in the RTL8156A (2.23 W -> 1.90 W) and no
> savings for the RTL8156B (0.96 W). Similarly, round-trip latency while
> idle went from 3 ms to 0.6 ms. I also tested under load and saw much
> larger latency savings and reduced packet loss, but forgot to write
> down the numbers (I can run the tests again if someone really wants me
> too). Also, jumbo frames drastically reduced performance under NCM
> mode, while vendor mode handled it like a champ (again, I forgot to
> write down the numbers but can test again if asked).
> 
> So, with all the benefits I've seen from using these adapters in their
> vendor mode, is there still a reason to let the kernel prefer their
> NCM mode? It'd be nice to be able to get the maximum performance from
> these adapters on any Linux system I plug them into, without having to
> install a udev rule on every one of those systems.
> 
> If anyone would like to try replicating the results I listed here, or
> to perform new tests, the specific RTL8156A adapter I used is the
> Ugreen CM275[1] and the RTL8156B adapter is the Inateck ET1001[2].
> 
> 
> Curious to hear your thoughts on this,

The default configuration of USB device is determined by USB-core of Linux
kernel. It is not selected by the Ethernet driver or device. I tried to
submit a patch that could switch the configuration automatically through
the driver. Then, the users could select their favorite mode when
configuring the kernel. However, the patch was rejected. Someone said
that the kernel support multi-configurations for USB and they have to be
switched by the users. The final conclusion was to change it at run-time,
or use udev rule.

Best Regards,
Hayes


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-05-03  3:09 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-02  6:43 Realtek RTL8156 devices defaulting to CDC-NCM instead of vendor mode, resulting in reduced performance Forest Crossman
2022-05-03  3:08 ` Hayes Wang

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).