USBLAN and Gadget EEM

The CDC EEM protocol allows multiple network frames to be aggregated into a single CDC-EEM USB Bulk transfer. This allows for higher bus utilization and higher overall network throughput than the more commonly used CDC ECM (Ethernet Control Model) and Microsoft’s proprietary RNDIS protocols.

The CDC-EEM protocol also supports a streaming mode where the sender can send reasonably large CDC-EEM transfers even when the receiver does not know what the maximum size transfer is. This is achieved by ensuring that the CDC-EEM sender always terminates a CDC-EEM transfer with a short or Zero Length packet. The Belcarra USBLAN driver supports both frame aggregation and streaming with the CDC-EEM protocol.

The Linux Gadget drivers implement the CDC-EEM protocols.
 - About 2 years ago, CDC-EEM support started appearing in the Linux kernel.
 - On the device (peripheral USB) side, this support is a add-on to the existing ECM support (the g_ether module in Gadget system).

The Gadget implementation of the CDC-EEM protocol supports receiving a CDC-EEM transfer with multiple frames. But it will only receive up to 1536 byte transfers and does not support decoding the CDC-EEM protocol across multiple received USB Transfers.

To allow the Belcarra Windows v2.4 USBLAN driver  to inter-operate with the Gadget EEM driver (and any driver with a similar design limitation) there is a global configuration option:
  •  MaxPacketsSend - the maximum number of 512 byte packets to send in a single CDC-EEM transfer
For correct operation with Gadget this should be set to three (3x512 is 1536 bytes.) There is a simple patch to the gadget driver available here.

This simply allocates a larger receive buffer. For example 8192 (set MaxPacketsSend to 16). Which in turn allows the Belcarra USBLAN driver to send network data at a higher rate.

There is no simple patch to allow the Gadget EEM driver to implement frame aggregation when it sends CDC-EEM transfers. The Gadget NCM driver does implement frame aggregation so it may be more appropriate for use if your USB Device requires higher data throughput when sending data to the USB Host.

Belcarra's USBLAN 2.4 driver is fully compatible with the Gadget NCM driver.