I did some performance tests for the g_ncm driver with the iperf tool.
The tests were done between a board with an IMX6DL SoC + 1GB of RAM and a laptop.
Used kernel version is 3.14.38 and Android L.
I observed that there is a very high CPU load when I set the sent USB packet length of the laptop to 1800 bytes.
In order to execute the test, on the board I run an iperf server:
~# iperf-armv7 -V -s -u &
and on the laptop I run the the iperf client after I set the packet length to 1800 bytes:
~# echo 1800 > /sys/class/net/usb0/cdc_ncm/tx_max # this sets the USB packet length over the NCM interface to 1800 bytes
~# iperf -V -u -c $(BOARD_IPV6_ADDR)%usb0 -b 50M # this starts the test for 50Mb/s bandwidth
When I run the test with the above commands I can see that on the board the CPU consumption raises much with the following 2 processes:
1321 1 31% S 4 16564K 480K fg root iperf-armv7
3 0 20% R 1 0K 0K fg root ksoftirqd/0
If I raise the speed of the test to >70Mb/s the board becomes totally unresponsive during the test.
When I leave the packet length to default value instead of changing it to 1800, I observed that the length of the sent packets is ~9k bytes and the ksoftirqd isn't trigger anymore and the system behaves better.
I observed the length of the packets with a USB protocol analyzer.
The problem is that the board needs to communicate with a phone that sends data over the NCM interface at 50Mb/s and 100Mb/s with the USB packet length being 1500 bytes.
This affects our performance badly.
I also observed in "/proc/interrupts" that many more USB interrupts are triggered when the package size is 1500 bytes vs. when it is 9000 bytes.
Does anyone know what could cause this performance problem and if there is any fix for it?