From owner-freebsd-multimedia@freebsd.org Mon Mar 6 10:26:05 2017 Return-Path: Delivered-To: freebsd-multimedia@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id A4254CFA583 for ; Mon, 6 Mar 2017 10:26:05 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 70D741723 for ; Mon, 6 Mar 2017 10:26:05 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [62.141.129.119]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 631F61FE086; Mon, 6 Mar 2017 11:25:34 +0100 (CET) Subject: Re: What is wrong with FreeBSD and USB Support To: Markus Rechberger , freebsd-multimedia@freebsd.org References: From: Hans Petter Selasky Message-ID: <89e2eac5-5b95-ab42-a0ae-2ccb0b7483af@selasky.org> Date: Mon, 6 Mar 2017 11:25:17 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:45.0) Gecko/20100101 Thunderbird/45.7.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-multimedia@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Multimedia discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Mar 2017 10:26:05 -0000 On 03/06/17 06:19, Markus Rechberger wrote: > Hi, > > I have been trying to port a driver to freebsd for a day now and the > result is quite negative. > > So my feedback about libusb20 and the FreeBSD USB Kernel Stack: > > 1. the documentation is not clear how to set up asynchronous bulk > transfers (please explain the architecture of this API) > > 2. the errors returned by libusb20 (and probably from the kernel) are > not detailed enough (in certain cases I'm able to get libusb20 unknown > error, to my understanding every error should have some meaning). > > 3. the FreeBSD USB Stack messes around with the transfer itself > damaging the entire result (eg resulting in stalled USB bulk > transfers). > > 4. The FreeBSD data transfer implementation itself is a disaster, I'm > able to transfer data at a rate of 2 MB/sec, anything higher results > in a stalled usb transfer?! > > 5. USB Control messages are 100% slower than with other operating > systems (eg. it took 14 seconds to load a driver with FreeBSD while it > only takes 7 seconds on other systems). > > Since I have been using USB stacks with Linux, Mac and some other > systems I can say that FreeBSD has the most irritating implementation > of all. > > So finally I wonder what is wrong with FreeBSD's USB support? Hi, Can you share some code and/or USB traces from "usbdump" for the slow traffic pattern. I'm pretty sure this isn't a FreeBSD problem, but how you use the APIs in FreeBSD's USB stack improperly. Further, which version of FreeBSD is this? Last but not least, if you are not observing 100% CPU usage on a CPU core during testing, it is for sure not a problem with the USB stack and/or IOCTL APIs. --HPS