Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 22 Jan 2011 14:33:22 +0100
From:      Hans Petter Selasky <hselasky@c2i.net>
To:        freebsd-usb@freebsd.org
Subject:   Re: libusb performance on 8.1
Message-ID:  <201101221433.23194.hselasky@c2i.net>
In-Reply-To: <9CF6C32F-E230-446B-94FC-C57F0F02B0E4@gsoft.com.au>
References:  <9CF6C32F-E230-446B-94FC-C57F0F02B0E4@gsoft.com.au>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thursday 20 January 2011 07:37:32 Daniel O'Connor wrote:
> [re-sent from the correct address]
>=20
> Hi,
> I am building a USB interface to a radar data acquisition chassis based on
> the Cypress CY7C68013A.
>=20
> While doing some speed testing I find that FreeBSD does ~4Mb/sec, but Lin=
ux
> does 17Mb/sec & OS X does 8-10Mb/sec.

Hi,

You need to change the way you buffer the data. FreeBSD does not queue more=
=20
than 2 URB's at any time, and the turnaround time varies from 1ms to 125us =
due=20
to hardware IRQ restrictions. Linux queues up all it can get, which leads t=
o=20
other kind of problems. The current internal buffer limit is 16Kbyte 8000=20
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.

=46rom my experience it is very possible to reach +30Mbyte/second with LibU=
SB=20
under FreeBSD 8.2+, given the buffering is optimal for the kernel.

Hint: The libusb20 API has features to transfer multi-short packets in a mo=
re=20
optimised way, which are not exposed in the libusb10 API.

>=20
> It is using libusb-1.0 with the async API in a threaded app. I spawn a
> thread which sites in the following loop:
>=20

=2D-HPS



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201101221433.23194.hselasky>