From patchwork Fri Apr 21 12:58:08 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Roger Quadros X-Patchwork-Id: 97895 Delivered-To: patch@linaro.org Received: by 10.140.109.52 with SMTP id k49csp312593qgf; Fri, 21 Apr 2017 05:58:55 -0700 (PDT) X-Received: by 10.84.130.36 with SMTP id 33mr16238250plc.111.1492779535185; Fri, 21 Apr 2017 05:58:55 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id d65si10341800pfa.21.2017.04.21.05.58.54; Fri, 21 Apr 2017 05:58:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ti.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=ti.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1039493AbdDUM6m (ORCPT + 12 others); Fri, 21 Apr 2017 08:58:42 -0400 Received: from fllnx209.ext.ti.com ([198.47.19.16]:30625 "EHLO fllnx209.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1035387AbdDUM6k (ORCPT ); Fri, 21 Apr 2017 08:58:40 -0400 Received: from dlelxv90.itg.ti.com ([172.17.2.17]) by fllnx209.ext.ti.com (8.15.1/8.15.1) with ESMTP id v3LCwH7x020809; Fri, 21 Apr 2017 07:58:17 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ti.com; s=ti-com-17Q1; t=1492779497; bh=EFNFdwKL0W2VyJJB0rPT5Ml35edc4yDTFYm/ktba3Fk=; h=From:To:CC:Subject:Date; b=DxyFDZ33P/++9Tfg+SS358FeXqh0tvlqF7QzHjoDKk2nb9EOw/ZT131bfq9i63lMT 0ISry0OgrnHJJdUp7VKHTEa2zhV1t6vFggmfzk3rBIxeU6PlIdKocEAUwiTqFqeI0Q uDaHtxmIbsL5h2BgY+hPRps2BgMSMk2hk0G1jC3c= Received: from DFLE73.ent.ti.com (dfle73.ent.ti.com [128.247.5.110]) by dlelxv90.itg.ti.com (8.14.3/8.13.8) with ESMTP id v3LCwC3l022372; Fri, 21 Apr 2017 07:58:12 -0500 Received: from dflp33.itg.ti.com (10.64.6.16) by DFLE73.ent.ti.com (128.247.5.110) with Microsoft SMTP Server id 14.3.294.0; Fri, 21 Apr 2017 07:58:12 -0500 Received: from lta0400828d.ti.com (ileax41-snat.itg.ti.com [10.172.224.153]) by dflp33.itg.ti.com (8.14.3/8.13.8) with ESMTP id v3LCwAhh003858; Fri, 21 Apr 2017 07:58:10 -0500 From: Roger Quadros To: CC: , , , Roger Quadros Subject: [PATCH] usb: dwc3: gadget: Fix ISO transfer performance Date: Fri, 21 Apr 2017 15:58:08 +0300 Message-ID: <1492779488-15127-1-git-send-email-rogerq@ti.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()") caused a small change in the way ISO transfer is handled in the case when XferInProgress event happens on Isoc EP with an active transfer. This caused a performance degradation of 50%. e.g. using g_webcam on DUT and luvcview on host the video frame rate dropped from 16fps to 8fps @high-speed. Make the ISO transfer handling equivalent to that prior to that commit to get back the original ISO performance numbers. Fixes: 08a36b543803 ("usb: dwc3: gadget: simplify __dwc3_gadget_ep_queue()") Signed-off-by: Roger Quadros --- drivers/usb/dwc3/gadget.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) -- 2.7.4 diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 0d75158..8f71ccc 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -1245,14 +1245,24 @@ static int __dwc3_gadget_ep_queue(struct dwc3_ep *dep, struct dwc3_request *req) __dwc3_gadget_start_isoc(dwc, dep, cur_uf); dep->flags &= ~DWC3_EP_PENDING_REQUEST; } + return 0; } - return 0; + + if ((dep->flags & DWC3_EP_BUSY) && + !(dep->flags & DWC3_EP_MISSED_ISOC)) { + WARN_ON_ONCE(!dep->resource_index); + ret = __dwc3_gadget_kick_transfer(dep, + dep->resource_index); + } + + goto out; } if (!dwc3_calc_trbs_left(dep)) return 0; ret = __dwc3_gadget_kick_transfer(dep, 0); +out: if (ret == -EBUSY) ret = 0;