From owner-freebsd-usb@FreeBSD.ORG Mon Dec 22 14:49:13 2014 Return-Path: Delivered-To: freebsd-usb@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 28C7D7BC for ; Mon, 22 Dec 2014 14:49:13 +0000 (UTC) Received: from mho-02-ewr.mailhop.org (mho-02-ewr.mailhop.org [204.13.248.72]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id F016A22E for ; Mon, 22 Dec 2014 14:49:12 +0000 (UTC) Received: from [73.34.117.227] (helo=ilsoft.org) by mho-02-ewr.mailhop.org with esmtpsa (TLSv1:AES256-SHA:256) (Exim 4.72) (envelope-from ) id 1Y34IJ-000CzO-50; Mon, 22 Dec 2014 14:49:11 +0000 Received: from revolution.hippie.lan (revolution.hippie.lan [172.22.42.240]) by ilsoft.org (8.14.9/8.14.9) with ESMTP id sBMEn5FN027476; Mon, 22 Dec 2014 07:49:07 -0700 (MST) (envelope-from ian@freebsd.org) X-Mail-Handler: Dyn Standard SMTP by Dyn X-Originating-IP: 73.34.117.227 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/sendlabs/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1/lfOyBY0UVB3eksZQNUnLt Message-ID: <1419259745.1018.113.camel@freebsd.org> Subject: Re: About XHCI_TD_PAGE_SIZE. From: Ian Lepore To: Hans Petter Selasky Date: Mon, 22 Dec 2014 07:49:05 -0700 In-Reply-To: <5497E8F2.5080800@selasky.org> References: <549541BC.6070505@selasky.org> <20141222.103833.2105768702793613386.okuno.kohji@jp.panasonic.com> <5497E016.7020809@selasky.org> <20141222.183157.253796126986510571.okuno.kohji@jp.panasonic.com> <5497E8F2.5080800@selasky.org> Content-Type: text/plain; charset="us-ascii" X-Mailer: Evolution 3.12.8 FreeBSD GNOME Team Port Mime-Version: 1.0 Content-Transfer-Encoding: 7bit Cc: freebsd-usb@freebsd.org X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.18-1 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 22 Dec 2014 14:49:13 -0000 On Mon, 2014-12-22 at 10:48 +0100, Hans Petter Selasky wrote: > On 12/22/14 10:31, Kohji Okuno wrote: > > In an optimisation, we should reduce the number of LINK_TRB, too. > > I heard from a LSI engineer that, > > Generally xhci controler has the cache of TRB array. But, LINK_TRB > > may make the cache miss. > > Hi, > > One reason for the additional link TRB's is that I think there is > different behaviour among the XHCI implementations how and when they > generate a completion event. Any changes we make in that area needs to > be tested with different XHCI controllers. > > Currently only the umass driver will use transfers greater than 64KBytes > in case of USB 3.0. Else the most common case is transfers below > 64KBytes, except for custom apps. > > I have another idea pending, which is related to performance, but not > the XHCI. I was thinking that the FreeBSD libusb could be extended to > allocate a data buffer in the kernel which then gets mmapped to > userspace, to save copying/copyout of USB transfer data. The problem > about mmap() is that the buffers cannot be freed afterwards, and must > remain in the kernel. > > What do you think? So you're going to be doing DMA directly in and out of buffers mapped into userspace? I think that will fail on ARM and MIPS at least, and maybe others (any platform that does cache maintenance based on virtual addresses will be unable to do the maintenance reliably if the DMA memory is mapped to multiple virtual addresses). The solution for that is bounce buffers, which just gets you right back into copying the data. -- Ian