Project

General

Profile

USB on the go speed

Added by Lars Majlof almost 11 years ago

Hi,
When I configure Linux (3.2.0+) to use the ethernet gadget with RNDIS support, I get poor data transfer speeds. With data packet sizes aligned to the Ethernet packet size, we typically find speeds in the order of 0.6MB/s. That is perhaps not too surprising because RNDIS is a pretty heay protocol.
I updated my kernel to the Head version in the git repository in the hope that enabling DMA transfers for that interface would help the situation.
Alas, I measured no significant improvement.

I also ran before /after benchmarks using the g_serial gadget and various packet sizes without seeing any difference.
Before building the kernel, I did disable the "Disable DMA (always use PIO)" option under USB support.

A couple of questions:
1. Is there anything else I should have changed in the configuration?
2. Would you expect better performance than I am seeing using the g_ether gadget and RNDIS?
3. What gadget protocol, in your experience, is the fastest way to move data to/from a Windows environment to the ARM using USB?

Thanks,
Lars


Replies (2)

RE: USB on the go speed - Added by Michael Williamson almost 11 years ago

Hi Lars,

We have found that RNDIS has been very slow as well and we have not used the serial gadget, but I would suggest that using larger packet sizes will help. We have used the gadgetfs driver with a camera product here and were able to push about 15 MB / sec by:

1) Using larger packet sizes
2) Using async I/O

Even without the DMA patches, we were able to get much better than 1 MB / second at the expense of loading the ARM CPU up. With the patches, the ARM CPU was freed significantly.

Unless using async I/O, the current driver schedules 1 write request at a time and then waits for it to finish per system call write() transaction. It is very inefficient. Larger packets help by reducing the relative time between posting writes compared to the transmit time. Async I/O lets you schedule smaller packets and not stall between write calls.

I have some example code (it's prototype, doesn't have a lot of error handling and robustness needed for fielded code) that I would be glad to send you via email for using the gadgetfs, though it's based on the usb.c gadgetfs example. Gadgetfs is a bit more taxing to get set up, but it removes all of the overhead of RNDIS or the other stacks, which often times is acceptable. It uses BULK endpoints, so the data can be treated as a stream.

Let me know if you would like it and I will send you via email. I don't want to post it, it's really not prime time code.

-Mike

RE: USB on the go speed - Added by Lars Majlof almost 11 years ago

Hi Mike,
It would be great if I can get a copy of your sample code! It would help tremendously if I can get close to 10MB/s transfer rates.

Thanks,
Lars

    (1-2/2)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)