Received: by 10.192.165.148 with SMTP id m20csp3884012imm; Mon, 7 May 2018 22:15:11 -0700 (PDT) X-Google-Smtp-Source: AB8JxZpiFJnz8jN5x60poLf4USPjqpeOJZRDZp2ary4EwhG/3zsQuY7IljzwVu1bgSET/2zQmATN X-Received: by 2002:a63:b60d:: with SMTP id j13-v6mr31664640pgf.451.1525756511687; Mon, 07 May 2018 22:15:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525756511; cv=none; d=google.com; s=arc-20160816; b=KAecECYtseJ1+4jjw+9bQYxXjebktwdBRFVgM/+MsqugiaRbrx7PNxhRaoFI8/PC4w ZQTKT5dBUIimXrc80JLuOvY9taH8piLUfC3DRHt+fMmdNktc/lv4Hjj4iztt3NVO9HOf uZKq/g/zt/hdfe4iBuAdqEfvKKs1nMTIgU+oq/ke8Bl5xjwzNbySp2rxMcF8vQZz+reg SoM2yYxn2Es+kB/ImJTipjYNVu9yuvQpPqGWd0CsiOdCoaAxmVWnJZ7EsNSXLawFz4KE GHEELMxMu6+urfR5Xk63PSwai/rKRdw6LCTuYkcKCpaIJFnwLS7PDjCFA+HVskr8b4Lf Kjqg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=gt1xu1+SzmTgcjiLHcozSI+Vthc7RrHtAj3LICDi+zk=; b=N149gnD/lbImafpDs6yYTPWhxGEOSAoVKfE759DXAVXM4yTHjE76KUTvGl23jEtprc NxMjGON4MTuG02dAcbG+fANqROUne/hgFM2mMoI/KvUWN8SAit8pSt0nxZlxexHfZD3B HWSBjOj5hE0iIpT/HykUeiAK4Iybb2shH/21zKhKT9fqDXXDy1ux7bYyr6yTRbFRiLlU G1OLK1vClXiYaYC0zCJbRsxtEHdyPD5u4R1YK0ej/UkrQKCfAPcNTli26vP1uSX4EB5u 9XYXflG1aHiAMamKTw4dtW6ckfM7G1kIq+vdWBIwanVWddzpkYDK6m5uoB/wwMvhdYQs FeQQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=VSX9lEwM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q23si23412023pfj.8.2018.05.07.22.14.57; Mon, 07 May 2018 22:15:11 -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=@google.com header.s=20161025 header.b=VSX9lEwM; 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=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753848AbeEHFNo (ORCPT + 99 others); Tue, 8 May 2018 01:13:44 -0400 Received: from mail-ua0-f194.google.com ([209.85.217.194]:35817 "EHLO mail-ua0-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750858AbeEHFNn (ORCPT ); Tue, 8 May 2018 01:13:43 -0400 Received: by mail-ua0-f194.google.com with SMTP id a2so19429166uak.2 for ; Mon, 07 May 2018 22:13:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=gt1xu1+SzmTgcjiLHcozSI+Vthc7RrHtAj3LICDi+zk=; b=VSX9lEwMFPWpJUNqi/1cBGzgss7huuEI6+4PW1/71k/OHe5uQ1hXwx8w1c5ogTU+qa slvg+AzQ/Qek7HdvoH9nNBz6sAUkl4BWBL8JYyeALP29ybZwaw4lrAyA/OhPTb6GjjK3 nOXXLYcd0b2hKThLuneCixpAN/3NBwCBzFHeIEkOeG4KUt2YQj884zhF2xyRmkr9emp/ dAPze6ZTjtI1vniSkFAhJYfVXUQooabXnNd2ZLsM/HED9ZFD7mjwO/yMgMCdurPaPeci 1c3uoLiDlbjybJGpHqruIieTuYhqAHDwKenh42UVSP0amCOdV3aHOqah5rSJDQoaKxSF XcRQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=gt1xu1+SzmTgcjiLHcozSI+Vthc7RrHtAj3LICDi+zk=; b=kwaKy2uz/131O6pk+xpgFWPZLfT360GHbo15PPs9oUEZH3mqrjYGBIwZGWFWdsdFej HmUuNfOQYSPYsXt9xejAlF0cDvYaULrbVH68KlCEXmLfF1l/mrLNYHRGDhZDhfQpApqq rB4jTf3skzfcGzrKS0mjleHShCgw5fgL77QLAxjrx9QTrUsxFC0HwLCQUPb5VpY0yEnR IJ3moZCJOmki+vf5OxC54+O4Bp407+YVJtwgPVEECvcyV0JIrxQlHiGhpHx7yzzaKgaS ZJHc67obfVmI+lzPi9z7+81XoGtHt1nTP8ha9ugcVS+A6P4GYodIRywyY7OKm8wB+ipq nd8Q== X-Gm-Message-State: ALQs6tB5V1M3HOU2YCZTXMzL50EeEFMD/JjMZwClTNKExYqRGOFIImzC eH8YD/95k3DHP4Tdh8LInmvTjvJwiV9q/1jwYe3edg== X-Received: by 10.176.112.140 with SMTP id m12mr34109183ual.191.1525756421912; Mon, 07 May 2018 22:13:41 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.48.82 with HTTP; Mon, 7 May 2018 22:13:41 -0700 (PDT) In-Reply-To: <1525748846-7767-3-git-send-email-william.wu@rock-chips.com> References: <1525748846-7767-1-git-send-email-william.wu@rock-chips.com> <1525748846-7767-3-git-send-email-william.wu@rock-chips.com> From: Doug Anderson Date: Mon, 7 May 2018 22:13:41 -0700 Message-ID: Subject: Re: [PATCH v3 2/2] usb: dwc2: fix isoc split in transfer with no data To: 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, =?UTF-8?B?6Kix5ZiJ6YqY?= , Stan Tsui , =?UTF-8?B?U3BydWNlIFd1ICjlkLPlu7rli7Mp?= , Martin.Tsai@quantatw.com, Kevin.Shai@quantatw.com, =?UTF-8?B?TW9uLUplciBXdSAo5ZCz5a2f5ZOyKQ==?= , =?UTF-8?B?Q2xhdWQgQ2hhbmcgKOW8teaBreeviSk=?= , =?UTF-8?B?U2FuIExpbiAo5p6X5bu66I+xKQ==?= , Ren.Kuo@quantatw.com, "David H.T. Wang" , Fong Lin , Steven Cheng , Tom Chen , donchang@aopen.com, milesschofield@aopen.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On Mon, May 7, 2018 at 8:07 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 v3: > - Remove "qtd->isoc_split_offset = 0" in the if test > > Changes in v2: > - Modify the commit message > > drivers/usb/dwc2/hcd_intr.c | 3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) > > diff --git a/drivers/usb/dwc2/hcd_intr.c b/drivers/usb/dwc2/hcd_intr.c > index ba6fd852..3003594 100644 > --- a/drivers/usb/dwc2/hcd_intr.c > +++ b/drivers/usb/dwc2/hcd_intr.c > @@ -930,9 +930,8 @@ 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; > } This looks fine to me now, but as per my comments on the previous version I don't think I've dug through this problem enough to add my Reviewed-by tag. I'll assume that John or someone with more knowledge of the USB protocol than I have will Review / Ack. -Doug