Received: by 10.192.165.148 with SMTP id m20csp5327718imm; Wed, 9 May 2018 03:16:50 -0700 (PDT) X-Google-Smtp-Source: AB8JxZquXIsHoccL9uXf8SGXqGxj1R+VEAa0vfF/8geS05v8/zL5NC7YHgDgJTguu3esPtbB7dwZ X-Received: by 2002:a63:5fd2:: with SMTP id t201-v6mr36190101pgb.315.1525861010889; Wed, 09 May 2018 03:16:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1525861010; cv=none; d=google.com; s=arc-20160816; b=WNiDD/9UIU3bJiBwgWq1BgzLXNWowrrmQJgLoIK0mcSjk/swdq7Yc70kyfHWod9svX ZF211uREc7T8GGzenFCCihF1JDjfNpuY5HN+8i+/RGBLmkuySRgQ9BsdF8Lg8qw0El72 ybdB7QrchZdzYIdJA17R+SBthRyz8oYmBR3ev/PoRWojyvO7jxGIxs6FRmaCw1zUqhZq ljV8OZY7OPa3b3KCWjzS7wcFDNHEZkC8nKxRZbprCDU5y5ZHYCiiCh1cs3Jd8wJYYHKP B3aeKEKbDpbgaq1KOQMX6iDyiivRyI1d0eSmvpTd+idity5UvdVFTUEg8h1m8bO1sfRx 7lng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=jdD7mH3Lsa/ezfj6V1BE2S8tnXRdV576eHa3/v4UkE4=; b=yl3xWUV67XtEeg4IDpBPzbeRJbakuLG4YgutPCG4vWdfpsSi0Ok4+VKLXfd25u/s01 z+1Zo9fRrTdE6C5JLSY43QXkHfe0CZe3v7zc+yX+bqSCSy007kZ0A14QK0+m4Q+cuEs/ UP/zoD6/9XSdWdAoAcb+NVP636t8I/aFU/emTP78LQC6m5vUuXGiaIYt7zYR3CNr9Rse Lyu2fBHo3+CQvDmY3O8Oe5qDY0JSBEaTAt6Msmqp1+6qRkz5b7O9MxsEDPCqOgais3Vk ldVfMRpK+y6P/UoqRmfoXJMuoABmldNxlbQ+8oXPmZ5MMM3sy/kuq6/r0ddeQGyQN14F xXSg== 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 a5-v6si28129613pla.117.2018.05.09.03.16.36; Wed, 09 May 2018 03:16:50 -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 S934519AbeEIKMl (ORCPT + 99 others); Wed, 9 May 2018 06:12:41 -0400 Received: from regular1.263xmail.com ([211.150.99.132]:36414 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934288AbeEIKMc (ORCPT ); Wed, 9 May 2018 06:12:32 -0400 Received: from william.wu?rock-chips.com (unknown [192.168.167.232]) by regular1.263xmail.com (Postfix) with ESMTP id 3BBB99415; Wed, 9 May 2018 18:12:28 +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 localhost.localdomain (localhost [127.0.0.1]) by smtp.263.net (Postfix) with ESMTPA id E6D82360; Wed, 9 May 2018 18:12:22 +0800 (CST) X-RL-SENDER: william.wu@rock-chips.com X-FST-TO: hminas@synopsys.com X-SENDER-IP: 58.22.7.114 X-LOGIN-NAME: william.wu@rock-chips.com X-UNIQUE-TAG: <2d80648360591190056a8074192f86fd> X-ATTACHMENT-NUM: 0 X-SENDER: wulf@rock-chips.com X-DNS-TYPE: 0 Received: from unknown (unknown [58.22.7.114]) by smtp.263.net (Postfix) whith SMTP id 10947HNRLNJ; Wed, 09 May 2018 18:12:28 +0800 (CST) From: William Wu To: hminas@synopsys.com, felipe.balbi@linux.intel.com, gregkh@linuxfoundation.org Cc: sergei.shtylyov@cogentembedded.com, heiko@sntech.de, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-rockchip@lists.infradead.org, frank.wang@rock-chips.com, huangtao@rock-chips.com, dianders@google.com, daniel.meng@rock-chips.com, John.Youn@synopsys.com, william.wu@rock-chips.com, wzz@rock-chips.com, zsq@rock-chips.com, Allen.Hsu@quantatw.com, StanTsui@AOPEN.com, Spruce.Wu@quantatw.com, Martin.Tsai@quantatw.com, Kevin.Shai@quantatw.com, Mon-Jer.Wu@quantatw.com, Claud.Chang@quantatw.com, San.Lin@quantatw.com, Ren.Kuo@quantatw.com, davidhtwang@aopen.com, fonglin@aopen.com, stevencheng@aopen.com, tomchen@aopen.com, donchang@aopen.com, milesschofield@aopen.com Subject: [PATCH v4 2/2] usb: dwc2: fix isoc split in transfer with no data Date: Wed, 9 May 2018 18:11:01 +0800 Message-Id: <1525860661-18619-3-git-send-email-william.wu@rock-chips.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1525860661-18619-1-git-send-email-william.wu@rock-chips.com> References: <1525860661-18619-1-git-send-email-william.wu@rock-chips.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 v4: - None 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 ba6229e..9751785 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; } -- 2.0.0