From owner-freebsd-usb@FreeBSD.ORG Sat Jan 22 13:33:20 2011 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 5573A1065672 for ; Sat, 22 Jan 2011 13:33:20 +0000 (UTC) (envelope-from hselasky@c2i.net) Received: from swip.net (mailfe02.c2i.net [212.247.154.34]) by mx1.freebsd.org (Postfix) with ESMTP id D85FF8FC0C for ; Sat, 22 Jan 2011 13:33:19 +0000 (UTC) X-Cloudmark-Score: 0.000000 [] X-Cloudmark-Analysis: v=1.1 cv=CCOfvygxSj2xAPGFFsF6kM/l7Sx9XnKmxb3UJ56T8ow= c=1 sm=1 a=-lJg8f7At1MA:10 a=8nJEP1OIZ-IA:10 a=CL8lFSKtTFcA:10 a=i9M/sDlu2rpZ9XS819oYzg==:17 a=hT26Byu-KU2cBiC-61YA:9 a=U2bz0Vpbba9MpGxMotYJHHV60mcA:4 a=wPNLvfGTeEIA:10 a=i9M/sDlu2rpZ9XS819oYzg==:117 Received: from [188.126.198.129] (account mc467741@c2i.net HELO laptop002.hselasky.homeunix.org) by mailfe02.swip.net (CommuniGate Pro SMTP 5.2.19) with ESMTPA id 77541670; Sat, 22 Jan 2011 14:33:17 +0100 From: Hans Petter Selasky To: freebsd-usb@freebsd.org Date: Sat, 22 Jan 2011 14:33:22 +0100 User-Agent: KMail/1.13.5 (FreeBSD/8.2-PRERELEASE; KDE/4.4.5; amd64; ; ) References: <9CF6C32F-E230-446B-94FC-C57F0F02B0E4@gsoft.com.au> In-Reply-To: <9CF6C32F-E230-446B-94FC-C57F0F02B0E4@gsoft.com.au> X-Face: *nPdTl_}RuAI6^PVpA02T?$%Xa^>@hE0uyUIoiha$pC:9TVgl.Oq, NwSZ4V"|LR.+tj}g5 %V,x^qOs~mnU3]Gn; cQLv&.N>TrxmSFf+p6(30a/{)KUU!s}w\IhQBj}[g}bj0I3^glmC( :AuzV9:.hESm-x4h240C`9=w MIME-Version: 1.0 Content-Type: Text/Plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable Message-Id: <201101221433.23194.hselasky@c2i.net> Cc: Subject: Re: libusb performance on 8.1 X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 22 Jan 2011 13:33:20 -0000 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