libusb performance on 8.1
Daniel O'Connor
doconnor at gsoft.com.au
Sun Jan 23 00:15:50 UTC 2011
On 23/01/2011, at 24:03, Hans Petter Selasky wrote:
>> While doing some speed testing I find that FreeBSD does ~4Mb/sec, but Linux
>> does 17Mb/sec & OS X does 8-10Mb/sec.
>
> You need to change the way you buffer the data. FreeBSD does not queue more
> than 2 URB's at any time, and the turnaround time varies from 1ms to 125us due
> to hardware IRQ restrictions. Linux queues up all it can get, which leads to
> other kind of problems. The current internal buffer limit is 16Kbyte 8000
> times per second which gives a MAX of 128 MByte/second.
>
> In general during hardware design:
>
> 1) Avoid short packets.
> 2) Make sure transfer buffers are matched between host and device.
>
> From my experience it is very possible to reach +30Mbyte/second with LibUSB
> under FreeBSD 8.2+, given the buffering is optimal for the kernel.
>
Hmm... I am transferring fixed size packets of 512 bytes, so there shouldn't be any short packets (unless I misunderstand what you mean).
Ahh, I I see what you mean now.. I was transferring a single packet at a time because I didn't realise you could transfer more at once.
If I switch to transferring 2k at once it goes up to 16Mb/sec.
Thanks :)
--
Daniel O'Connor software and network engineer
for Genesis Software - http://www.gsoft.com.au
"The nice thing about standards is that there
are so many of them to choose from."
-- Andrew Tanenbaum
GPG Fingerprint - 5596 B766 97C0 0E94 4347 295E E593 DC20 7B3F CE8C
More information about the freebsd-usb
mailing list