Received: by 10.192.165.148 with SMTP id m20csp226163imm; Tue, 1 May 2018 22:03:56 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqC2wTevn/mQQ2oSPk1ojLKJJyjbeCYkYZz62ogIy1xG55QcUQ0B1UI1Ap7GbXRWuwmIFUN X-Received: by 2002:a17:902:b7ca:: with SMTP id v10-v6mr18585426plz.275.1525237436913; Tue, 01 May 2018 22:03:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525237436; cv=none; d=google.com; s=arc-20160816; b=arNywSjUAF7bwhzPipGWPMw7qHv8UxjPk2Qk+tK0uBFXMmhPM5s31j4ZlvWsFzbgg8 AZSeudYS83Du6f34PZ+m8/sGEoilimLMWzOeq/J8Jz2oJsO3qgxEOpSZ+nDNM7fH/oOj TaWWITtKTIzaLhofmo2xbuQ1I74h55gls2claQ0nfeNAGoaspnthRZGMyeFESN3CGGcM 5Vi7mry8BM9Ok7qDp25mz67V2OyYPQbp6EXT6Tv39uLAvRcYEME4Uj7W32m5vKhODX5b AUob9elvdom8HHM6w4Nb/rrqE4m8znX2kZz2uL4+eoqH5kmghVkAEPJ05mEXKFMTXc+y bHAQ== 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=HVpjQsQwDrcnNuryQAZy3uBbmYWP/TU4xwgjXo0lUnE=; b=0TlnYHxfUxyJNnJdnJ2J3e3wQH1gfrtfoQceDIuP4rH344h8p8cB2WihMvlt7Msppu mSLNn7UwgqgEHNTCKlgoCxwRsqSw2zMO8NpEFHdHiS7ZLFCrkvckctMMuzOlxwjkIKt/ 7t21IgWSGfECvXu1kmz089Uiz0fGvuW/WoyhS2VXDwhnJ/aVCs5B0gbryBlvpagRtW8h CPWvSlN5phHYZnsR5rs+/Am/hbsCKBO0NRC/MIuFulX+zW0I9SjMpQ85V5W67qO9UxGw Wzmu0pSms/EUT+9vYYVHq+pSNAeSdqQLEnS/a+BDHwaYZG1PhQuqQ/9E5Glk739ziPOT 8dvg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=fa4f+AGf; 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 d65si11233267pfa.263.2018.05.01.22.03.40; Tue, 01 May 2018 22:03: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; dkim=pass header.i=@google.com header.s=20161025 header.b=fa4f+AGf; 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 S1751116AbeEBFCT (ORCPT + 99 others); Wed, 2 May 2018 01:02:19 -0400 Received: from mail-ua0-f195.google.com ([209.85.217.195]:38648 "EHLO mail-ua0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751078AbeEBFCR (ORCPT ); Wed, 2 May 2018 01:02:17 -0400 Received: by mail-ua0-f195.google.com with SMTP id y8so8663056ual.5 for ; Tue, 01 May 2018 22:02:17 -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=HVpjQsQwDrcnNuryQAZy3uBbmYWP/TU4xwgjXo0lUnE=; b=fa4f+AGfxOzFYjoIDYf7apR0HdLNi++A4jNHObDavod7JZoicAFTt4Nu02VgD49usQ +ngz8Qcd4KIVcxLL17TB+5jLPbi2ilJskcAgRpAlcAKdPxDqa1oGhxYPTKpM74LgpEd6 TakMXT/sMZPHpLztCjwU/S8eh2KAAaFbnW/q7kdyQartaE6ribKeWptcXHX5rYFtedUT JOl2FNb0k+9w4YPAAvBQh+nXBQzjOIsKvo+ziuMQVXD+s3e/Dv3w+oMDh26tpwJRmqis VLZVBU4Xc3dVwY3QDodvKrk1wfE8nc9pKUJx3sWAfcWdh1QbJUZBesCZIAk0QO7CapU8 CNqQ== 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=HVpjQsQwDrcnNuryQAZy3uBbmYWP/TU4xwgjXo0lUnE=; b=ZwQKL1lDCedmnYUkoPY9KcxuKGs0hP5ffxn5YpVsEZN5oT6wydXkNp12nXiGjLrCJX 5mWd1GArSjIezZEtn0ORLtY7Oa8aAwfvHY3Qy7UBE9YRve2waYac7tS4axoA+525Worz C+t1uzgMp1V5khR8OA8KdCD6BjmZc7hGo6YMLpycGwBolEqM4TQh3ECcZ2oiJNChYyxf oWulxGYzSeckQACUeCLnm/aNAp0ikTbSeY5WZ67n9JKdhgrclp6UDAel9gdIsbY/IwS2 sIwqUuCTjCUeAxeEP0xz4Jm2Jlei731pGktL0fIndG0yhj6Jyqx2qkBJXpjqBkdp51UW zsNw== X-Gm-Message-State: ALQs6tC9+HV+26C3K4ZqscKax0Jh9TeKYWytZz4zHtOjt0uw+c8Pp4nV xvVJVEfjyXzyCClL3/AkCE54y6nlnTOBaFRIuropFw== X-Received: by 10.176.73.135 with SMTP id e7mr16904256uad.20.1525237336274; Tue, 01 May 2018 22:02:16 -0700 (PDT) MIME-Version: 1.0 Received: by 10.31.48.82 with HTTP; Tue, 1 May 2018 22:02:14 -0700 (PDT) In-Reply-To: <1525230288-6014-3-git-send-email-william.wu@rock-chips.com> References: <1525230288-6014-1-git-send-email-william.wu@rock-chips.com> <1525230288-6014-3-git-send-email-william.wu@rock-chips.com> From: Doug Anderson Date: Tue, 1 May 2018 22:02:14 -0700 Message-ID: Subject: Re: [PATCH v2 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, Allen.Hsu@quantatw.com, StanTsui@aopen.com, Vincent Palatin 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 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; } ...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