Skip to content
Snippets Groups Projects
Commit 75602288 authored by Sebastian Krzyszkowiak's avatar Sebastian Krzyszkowiak
Browse files

default: gadget: Use CDC-NCM instead of CDC-ECM

Citing Wikipedia [0]:

    Of these protocols [RNDIS, ECM, EEM and NCM] ECM could be classified
    the simplest - frames are simply sent and received without modification
    one at a time. This was a satisfactory strategy for USB 1.1 systems
    (current when the protocol was issued) with 64 byte packets but not for
    USB 2.0 systems which use 512 byte packets.

We're already using USB 3.0, so we should switch away from ECM.
Reasonable alternatives include EEM and NCM (RNDIS is a proprietary
Windows protocol, which - although supported by Linux - is considered
unsafe and may get removed [1]).

Bandwidth tests with iperf3 gave me these results:
 - ECM: 526 Mbits/sec
 - EEM: 761 Mbits/sec
 - NCM: 1.67 Gbits/sec

While NCM is newer, it's been supported in Linux since 2.6.37 already,
which is quite ancient by today's standards, so switching to it
should be safe for any kind of reasonably modern Linux host (plus we still
expose ACM serial that will be available even if NCM is not supported,
so basic communication with the device will still be possible).

It also has an added bonus of being supported in Windows 10 and
later, while ECM and EEM aren't supported there at all.

Therefore, switch the Ethernet gadget to use NCM.

[0] https://en.wikipedia.org/wiki/Ethernet_over_USB
[1] https://lore.kernel.org/lkml/20221123124620.1387499-1-gregkh@linuxfoundation.org/
parent 1b154d93
No related branches found
No related tags found
1 merge request!342default: gadget: Use CDC-NCM instead of CDC-ECM
Checking pipeline status
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment