From owner-freebsd-usb@FreeBSD.ORG Sun Jan 23 00:15:50 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 642C4106566B for ; Sun, 23 Jan 2011 00:15:50 +0000 (UTC) (envelope-from doconnor@gsoft.com.au) Received: from cain.gsoft.com.au (cain.gsoft.com.au [203.31.81.10]) by mx1.freebsd.org (Postfix) with ESMTP id DC9F88FC18 for ; Sun, 23 Jan 2011 00:15:49 +0000 (UTC) Received: from ur.dons.net.au (ppp203-122-198-42.lns6.adl6.internode.on.net [203.122.198.42]) (authenticated bits=0) by cain.gsoft.com.au (8.14.4/8.14.3) with ESMTP id p0N0FZb2007664 (version=TLSv1/SSLv3 cipher=AES128-SHA bits=128 verify=NO); Sun, 23 Jan 2011 10:45:36 +1030 (CST) (envelope-from doconnor@gsoft.com.au) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: "Daniel O'Connor" In-Reply-To: <201101221433.23194.hselasky@c2i.net> Date: Sun, 23 Jan 2011 10:45:35 +1030 Content-Transfer-Encoding: quoted-printable Message-Id: <6B2C00E3-1BDB-48D5-AC3E-E2ED7091E194@gsoft.com.au> References: <9CF6C32F-E230-446B-94FC-C57F0F02B0E4@gsoft.com.au> <201101221433.23194.hselasky@c2i.net> To: Hans Petter Selasky X-Mailer: Apple Mail (2.1082) X-Spam-Score: 0.163 () BAYES_00,RDNS_DYNAMIC X-Scanned-By: MIMEDefang 2.67 on 203.31.81.10 Cc: freebsd-usb@freebsd.org 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: Sun, 23 Jan 2011 00:15:50 -0000 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. >=20 > 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 to=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. >=20 > In general during hardware design: >=20 > 1) Avoid short packets. > 2) Make sure transfer buffers are matched between host and device. >=20 > =46rom my experience it is very possible to reach +30Mbyte/second with = LibUSB=20 > under FreeBSD 8.2+, given the buffering is optimal for the kernel. >=20 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