From owner-freebsd-usb@freebsd.org Mon Nov 2 12:40:10 2015 Return-Path: Delivered-To: freebsd-usb@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 564ECA24BCC for ; Mon, 2 Nov 2015 12:40:10 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (mail.turbocat.net [IPv6:2a01:4f8:d16:4514::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 1F5D4197C for ; Mon, 2 Nov 2015 12:40:09 +0000 (UTC) (envelope-from hps@selasky.org) Received: from laptop015.home.selasky.org (cm-176.74.213.204.customer.telag.net [176.74.213.204]) (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 BF44F1FE023; Mon, 2 Nov 2015 13:40:07 +0100 (CET) Subject: Re: [PATCH] dwc_otg: Reduce interrupt load To: Sebastian Huber , freebsd-usb@freebsd.org References: <1446212307-4660-1-git-send-email-sebastian.huber@embedded-brains.de> <56338480.3090607@selasky.org> <5637557A.1070007@embedded-brains.de> From: Hans Petter Selasky Message-ID: <56375A12.9060000@selasky.org> Date: Mon, 2 Nov 2015 13:41:54 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:38.0) Gecko/20100101 Thunderbird/38.2.0 MIME-Version: 1.0 In-Reply-To: <5637557A.1070007@embedded-brains.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-BeenThere: freebsd-usb@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FreeBSD support for USB List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 02 Nov 2015 12:40:10 -0000 On 11/02/15 13:22, Sebastian Huber wrote: > > > On 30/10/15 15:53, Hans Petter Selasky wrote: >> On 10/30/15 14:38, Sebastian Huber wrote: >>> Tested on an Altera Cyclone V development kit. Here the controller has >>> 16 host channels. This change significantly reduced the time spent in >>> the dwc_otg_interrupt_poll_locked() function. >> >> Hi, >> >> Thank you for your optimisation patch: >> >> https://svnweb.freebsd.org/changeset/base/290195 > > Thanks. > Hi, > After an update of the USB stack from 9.3 to current it worked out of > the box. Thanks a lot for your great USB stack! > > It seems that this driver doesn't support DMA. I see a quite high CPU > utilization in this area: That's sounds right. Adding DMA support is some extra work, because there are many USB endpoint combinations that needs to work. Also HOST and DEVICE mode needs to be tested. One problem with the DWC OTG is that you cannot switch individual so-called channels into DMA mode. It is either all-DMA or no DMA. That makes it more difficult to add. If you want to add DMA support I will be happy to add patches to the tree for that, but the patches must be such that it is possible to select DMA or PIO mode. For some kinds of USB traffic, like USB keyboards, USB audio and USB mice, PIO mode is optimal, because the amount of data transferred per interrupt is minimal. For mass storage and ethernet you would like to have DMA support. Or have a dedicated CPU for USB. Possibly the next USB controller driver to be added to FreeBSD is the DWC OTG v3. It is an all-DMA based controller, which also supports superspeed. --HPS