Received: by 10.192.165.148 with SMTP id m20csp883727imm; Wed, 2 May 2018 10:16:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpsiVYXSXV753gwSgpaQkOHvVi1+0ta8UN+pHLuBUa6k/4GctJfXXq0flfqKTHJ1pCgywTm X-Received: by 2002:a63:7c01:: with SMTP id x1-v6mr16746192pgc.286.1525281416474; Wed, 02 May 2018 10:16:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525281416; cv=none; d=google.com; s=arc-20160816; b=tQbQx12JfXOIbkUWB3oCqWo01riEWMoBlraEhlyPvK2Vgr09P50251EpcM7Z1MRL0B jaHa+BDux5syve4ip9Gga+gMsUkjZcgfKfa4phlr4RLSwgK/B4w94YECBhoyr2LIWGx9 ehoMZT4EIjbIjNevHJ9OhlYhwYCbLGHzzUjPFnl68rI9hYV57JfGJ4XShA1VwIZqyAY5 lraZaBX3Bk0bBz/DrmA3g5CY5kycKCRgSvmtbk1AbsX//q9bCEI2e4ViNnO1FEnioJAl wh5aHk+JIVxu9FB1crXHLMyJN4O3jpUUmMBKoaUiga2a7gf7I3zesLrKsi5Q5AtqsLtr n2dg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-language :content-transfer-encoding:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject:arc-authentication-results; bh=7tAb8WujLdeg2BoCom4Iiqo85CGnESChuFaskMt1JZA=; b=j0kgsl4HqDqH9VjVZQ7HH2vhm6vkvU6fkpc/DoyrwbR2HRnc4KmaweQ8qbwBbSSU9W tbBWQIB8829xWdvu5XezOnCnOfkca216XLnA9o/hXo8Rv8xwbiu+Hy3t/Cf8g37YI6v/ qo1WBomS/PfxEyF96uPy3jfwsZhdvyayQKSqUv9oe4xbm+UmRrUOcE5tihAhq/Gnn1nL q3Rfd3BaLVr4vsGR1knyO76BI5KQpweHKajJ3zrQh/Qw6NFnYWg4XG5s8WBZb+sjjSvH 4Lu2YzA+ykmJY018FCFMsiXmQBaVgIguGWM09LI0mw8whBftq0ra3p60+Ivk6WgxZKzg QVyA== ARC-Authentication-Results: i=1; mx.google.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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b1-v6si11667881plc.403.2018.05.02.10.16.42; Wed, 02 May 2018 10:16:56 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751724AbeEBRQd (ORCPT + 99 others); Wed, 2 May 2018 13:16:33 -0400 Received: from regular1.263xmail.com ([211.150.99.137]:51357 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751140AbeEBRQc (ORCPT ); Wed, 2 May 2018 13:16:32 -0400 Received: from wulf?rock-chips.com (unknown [192.168.167.208]) by regular1.263xmail.com (Postfix) with ESMTP id 30502DBE8; Thu, 3 May 2018 01:16:26 +0800 (CST) X-263anti-spam: KSV:0; X-MAIL-GRAY: 0 X-MAIL-DELIVERY: 1 X-KSVirus-check: 0 X-ABS-CHECKED: 4 Received: from [192.168.1.3] (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id 5EB9E3B5; Thu, 3 May 2018 01:16:27 +0800 (CST) X-RL-SENDER: wulf@rock-chips.com X-FST-TO: vpalatin@chromium.org X-SENDER-IP: 111.146.46.34 X-LOGIN-NAME: wulf@rock-chips.com X-UNIQUE-TAG: <555ee9ead0c36a46bb7da8e59bca7027> X-ATTACHMENT-NUM: 0 X-SENDER: wulf@rock-chips.com X-DNS-TYPE: 0 Received: from [192.168.1.3] (unknown [111.146.46.34]) by smtp.263.net (Postfix) whith ESMTP id 105482GGZN2; Thu, 03 May 2018 01:16:29 +0800 (CST) Subject: Re: [PATCH v2 2/2] usb: dwc2: fix isoc split in transfer with no data To: Doug Anderson , William Wu Cc: hminas@synopsys.com, felipe.balbi@linux.intel.com, Greg Kroah-Hartman , Sergei Shtylyov , =?UTF-8?Q?Heiko_St=c3=bcbner?= , LKML , linux-usb@vger.kernel.org, "open list:ARM/Rockchip SoC..." , Frank Wang , =?UTF-8?B?6buE5rab?= , "daniel.meng" , John Youn , =?UTF-8?B?546L5b6B5aKe?= , zsq@rock-chips.com, Allen.Hsu@quantatw.com, StanTsui@aopen.com, Vincent Palatin References: <1525230288-6014-1-git-send-email-william.wu@rock-chips.com> <1525230288-6014-3-git-send-email-william.wu@rock-chips.com> From: wlf Message-ID: Date: Thu, 3 May 2018 01:16:26 +0800 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.7.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 8bit Content-Language: en-US Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Dear Doug, 在 2018年05月02日 13:02, Doug Anderson 写道: > Hi, > > On Tue, May 1, 2018 at 8:04 PM, William Wu wrote: >> If isoc split in transfer with no data (the length of DATA0 >> packet is zero), we can't simply return immediately. Because >> the DATA0 can be the first transaction or the second transaction >> for the isoc split in transaction. If the DATA0 packet with no >> data is in the first transaction, we can return immediately. >> But if the DATA0 packet with no data is in the second transaction >> of isoc split in transaction sequence, we need to increase the >> qtd->isoc_frame_index and giveback urb to device driver if needed, >> otherwise, the MDATA packet will be lost. >> >> A typical test case is that connect the dwc2 controller with an >> usb hs Hub (GL852G-12), and plug an usb fs audio device (Plantronics >> headset) into the downstream port of Hub. Then use the usb mic >> to record, we can find noise when playback. >> >> In the case, the isoc split in transaction sequence like this: >> >> - SSPLIT IN transaction >> - CSPLIT IN transaction >> - MDATA packet (176 bytes) >> - CSPLIT IN transaction >> - DATA0 packet (0 byte) >> >> This patch use both the length of DATA0 and qtd->isoc_split_offset >> to check if the DATA0 is in the second transaction. >> >> Signed-off-by: William Wu >> --- >> Changes in v2: >> - Modify the commit message >> >> drivers/usb/dwc2/hcd_intr.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c >> index 5e2378f..479f628 100644 >> --- a/drivers/usb/dwc2/hcd_intr.c >> +++ b/drivers/usb/dwc2/hcd_intr.c >> @@ -930,7 +930,7 @@ static int dwc2_xfercomp_isoc_split_in(struct dwc2_hsotg *hsotg, >> frame_desc = &qtd->urb->iso_descs[qtd->isoc_frame_index]; >> len = dwc2_get_actual_xfer_length(hsotg, chan, chnum, qtd, >> DWC2_HC_XFER_COMPLETE, NULL); >> - if (!len) { >> + if (!len && !qtd->isoc_split_offset) { >> qtd->complete_split = 0; >> qtd->isoc_split_offset = 0; >> return 0; > I don't think my USB-fu is strong enough to do a real review of this > patch, but one small nitpick is that you can remove > "qtd->isoc_split_offset = 0" in the if test now. AKA: > > if (!len && !qtd->isoc_split_offset) { > qtd->complete_split = 0; > return 0; > } Yes, good idea! I will fix it in next patch. Thank you! > > ...since you only enter the "if" test now when isoc_split_offset is > already 0... Hopefully John Youn will have some time to comment on > this patch with more real USB knowledge... > > > -Doug > Best regards,      wulf >