From patchwork Wed May 9 00:02:22 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christoph Fritz X-Patchwork-Id: 157845 Return-Path: X-Original-To: patchwork-incoming@ozlabs.org Delivered-To: patchwork-incoming@ozlabs.org Received: from ozlabs.org (localhost [IPv6:::1]) by ozlabs.org (Postfix) with ESMTP id 9A57DB709F for ; Wed, 9 May 2012 11:43:49 +1000 (EST) Received: from mail-wi0-f173.google.com (mail-wi0-f173.google.com [209.85.212.173]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority" (not verified)) by ozlabs.org (Postfix) with ESMTPS id 21DC6B6F6E for ; Wed, 9 May 2012 10:02:32 +1000 (EST) Received: by wibhn9 with SMTP id hn9so1121603wib.14 for ; Tue, 08 May 2012 17:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=fW8O78jM9srX5Pu0aDWhcbcgJeUlpUdVeB3qynUiDR0=; b=iH/+GEq5l+pn2VJf2G6VK5dIgKI/m7pSab3FGepDGkFCaeH24OnbaxuqZzTAvOp72b vPulqUMetN0gaUxIqQo23cPmwRy0tU84cBbZJ52cOL+/NxxiIGcjLzhJ8Uxc3XMJIzTD /a5xfXjvYv95WtJDOJm4vuPmnF9UIaqGZFV8P+uR7Eaa8PeIA1VDOR7UQ/Q5k7/cgvSl DNeZd9CssUZseHWq1FY3ktIMR97Kkh9kUAeHjqGgaV91/6gDmYjEXF7b9BmUuO4I/Run JrN+eonK+n5Elo60ThLr8t6v/bd7Bu4H9zz2SSlz5bKZptOzdcaVwYuOkiduyg2TxJCR 5I3g== Received: by 10.180.82.136 with SMTP id i8mr48909305wiy.19.1336521747869; Tue, 08 May 2012 17:02:27 -0700 (PDT) Received: from lovely.krouter (fritzc.com. [78.47.220.26]) by mx.google.com with ESMTPS id b3sm32536924wib.4.2012.05.08.17.02.24 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 08 May 2012 17:02:26 -0700 (PDT) Date: Wed, 9 May 2012 02:02:22 +0200 From: Christoph Fritz To: Fabio Estevam , Neil Zhang , Li Yang , Felipe Balbi , Greg Kroah-Hartman , linux-usb@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, "Hans J. Koch" , Daniel Mack Subject: [RFC] [PATCH] usb: gadget: fix dtd dma confusion Message-ID: <20120509000221.GA19525@lovely.krouter> References: <1333796272.3450.92.camel@lovely> <20120409200656.GD2640@local> <20120410001017.GF2640@local> <20120410021151.GB23044@lovely.krouter> <20120411073918.GA9180@lovely.krouter> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-Mailman-Approved-At: Wed, 09 May 2012 11:42:55 +1000 Cc: Oliver Neukum , Kukjin Kim , Eric Miao , Chen Peter-B29397 , Sascha Hauer , Nicolas Ferre , Haojian Zhuang , Estevam Fabio-R49496 , Ido Shayevitz , Ben Dooks , Thomas Dahlmann , Russell King X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org Sender: linuxppc-dev-bounces+patchwork-incoming=ozlabs.org@lists.ozlabs.org On Wed, Apr 11, 2012 at 10:15:49AM -0300, Fabio Estevam wrote: > On Wed, Apr 11, 2012 at 4:39 AM, Christoph Fritz > wrote: > > > Can you approve this behaviour of g_ether/usbnet when using iperf? > > I am not very familiar with iperf, so I will let others comment. Hi to All, after a while of testing and searching I can come up with a patch that fixes g_ether <-> iperf for fsl_udc on ARM i.MX35. The sad part is that this kind of fix is already implemented for marvell mv_udc driver since last year but still _not_ in the ~15 other *udc.c drivers. See here: daec765da767e4a6a30e1298862b28f2cae9a73f usb: gadget: mv_udc: fix dtd dma confusion So hereby I'm CC-ing all *udc.c maintainers to point out that this issue maybe affects you too. And maybe someone can explain if this: + if (curr_td->next_td_ptr == EP_QUEUE_HEAD_NEXT_TERMINATE) { is necessary and why (please see below). Thanks, -- Christoph --- Subject: [PATCH] usb: gadget: fsl_udc: fix dtd dma confusion The controller will hang when doing testings with g_ether and iperf (tool for measuring maximum TCP and UDP bandwidth). This patch adds a delay to wait for controller to release dtd dma before freeing it. Signed-off-by: Christoph Fritz --- drivers/usb/gadget/fsl_udc_core.c | 9 +++++++++ 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c index 55abfb6..fc86108 100644 --- a/drivers/usb/gadget/fsl_udc_core.c +++ b/drivers/usb/gadget/fsl_udc_core.c @@ -1638,6 +1638,15 @@ static int process_ep_req(struct fsl_udc *udc, int pipe, status = REQ_UNCOMPLETE; return status; } else if (remaining_length) { + /* wait controller release dtd dma */ + while ((curr_qh->curr_dtd_ptr == curr_td->td_dma)) { + if (curr_td->next_td_ptr == + EP_QUEUE_HEAD_NEXT_TERMINATE) { + udelay(100); + break; + } + udelay(1); + } if (direction) { VDBG("Transmit dTD remaining length not zero"); status = -EPROTO;