Skip to content

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

Citing Wikipedia:

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

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.

Merge request reports