From owner-freebsd-usb@freebsd.org Thu May 2 08:37:23 2019 Return-Path: Delivered-To: freebsd-usb@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 01017158D4B3 for ; Thu, 2 May 2019 08:37:23 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (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 D6FE283B10 for ; Thu, 2 May 2019 08:37:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2016.home.selasky.org (unknown [176.74.212.121]) (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 1454E26026E; Thu, 2 May 2019 10:37:20 +0200 (CEST) Subject: Re: USB transfers in device drivers To: "O'Connor, Daniel" Cc: freebsd-usb@freebsd.org References: <3B922C60-32E5-484E-8AFA-28FF7255CF2C@dons.net.au> From: Hans Petter Selasky Message-ID: Date: Thu, 2 May 2019 10:36:52 +0200 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: D6FE283B10 X-Spamd-Bar: ------ Authentication-Results: mx1.freebsd.org; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-6.44 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; TO_MATCH_ENVRCPT_SOME(0.00)[]; MX_GOOD(-0.01)[cached: mail.turbocat.net]; RCPT_COUNT_TWO(0.00)[2]; NEURAL_HAM_SHORT(-0.97)[-0.969,0]; IP_SCORE(-3.16)[ip: (-9.38), ipnet: 88.99.0.0/16(-4.72), asn: 24940(-1.69), country: DE(-0.01)]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; MID_RHS_MATCH_FROM(0.00)[]; RCVD_TLS_ALL(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 May 2019 08:37:23 -0000 On 2019-05-02 10:22, O'Connor, Daniel wrote: > > >> On 2 May 2019, at 06:15, Hans Petter Selasky wrote: >> On 2019-05-01 10:34, O'Connor, Daniel wrote: >>> I don't have a solid hypothesis for the failures as yes but one thing I'd like to make sure is that the USB stack is keeping the USB hardware busy with pending requests - does anyone know if the USB FIFO code does that automatically? >> >> Only the XHCI driver supports HW based double buffering of BULK transfers. > > Ahh interesting - is that a ECHI hardware limitation or a driver one? Hi, It is an EHCI hardware "limitation". It is possible to queue up more jobs with the EHCI, but it ends that you get a race with the hardware you'll need to catch. I think it is related to how receiving short packets are handled. > >> I suppose you are using BULK. Else you will need to use ISOCHRONOUS transfers. > > Yes it's using bulk transfers. > > I did consider isochronous transfers when I started this project but I wasn't sure if there would be enough bandwidth (but perhaps I read the spec wrong). I imagine there would be enough for this data rate but we have others at higher speeds (eg 35MB/sec). If you want reliable data transfer, BULK is the best. > > Related to bandwidth - are there any statistics gathered about how busy a port is? No, but I wanted to add a text-graph frontent to usbdump to collect this info realtime. Else use a USB wire-analyzer. --HPS