Received: by 10.192.165.148 with SMTP id m20csp4123160imm; Mon, 23 Apr 2018 19:47:48 -0700 (PDT) X-Google-Smtp-Source: AIpwx4+ohMZWklAT9TU1PxMsLkI8a9nwPwBAJY+aV8uZ+oTyuQZqtNXL/u+uH9Lh2xPjGY0kZHOd X-Received: by 10.98.99.4 with SMTP id x4mr21996687pfb.179.1524538068742; Mon, 23 Apr 2018 19:47:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524538068; cv=none; d=google.com; s=arc-20160816; b=UkrEnv6F6pX2hZy74pskWiVWvqqWOkdHara4edtI/BbkR82urTyKMTQbsc4nh3fNff 5JSw1BAcIH7pXLONXrDUNDTmHWnEKh0mk7X5V+bLHVntvTPAFLcQMI/3yZMrdiG9rud+ dgpv5Pi5q8z3epRsGpv81WO3KHj4ITbMwLds9ZLgSHOrJDQFWSswJI64Ok8UfzUyD3dQ W8Me/Zy0QKRj0jo2p/sJjva0+nlkjP5r3E1+jNPOK7ze94kgVvTH1wu6eaSvG5QUIOgS RvjfG7PMdNEsQJNBb8KCYZhfrQhlIaNW+em6x9AWoKAd7qcLL8g1QSKAjGbIIxsCDlgl 4p8Q== 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=3/Kg1CuQb92LVdbxLNLZQxcaZqELlaEhds1krGUDm5k=; b=0UlNBA2b2tDhuuYXD9thjb6sglzqG3Dqt65toWHDcwdZYTd6iaA8a6JQ/rOaX7o18h a4OCTqoYvKpI1akpfDhZMp/bxR6PQX8I/bDvRL5t3J6hiDmLj0QtMnED3+67z3Fb3gqF Pofey6NPfLLuhVtc7pzrbIn4iQ05rG+WlgtpJa9LGWFpgbCpfV0vCz1nRwCN4x3wgtyx tN/iIoe+Ln30mfrZzJM36jR9a3zWDEKj4hL9Bd0fdsrhB7e6E15XhZHVwK4QHFOwijit iOqxN31KmdgG+tgwGOavP/6IO4Jg6in5bTYbUxvwhmqioPA1UPNSLXpd4pPxtr+S90bf tYjA== 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 u193si6048366pgc.186.2018.04.23.19.47.34; Mon, 23 Apr 2018 19:47:48 -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 S932816AbeDXCpQ (ORCPT + 99 others); Mon, 23 Apr 2018 22:45:16 -0400 Received: from regular1.263xmail.com ([211.150.99.141]:33375 "EHLO regular1.263xmail.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932772AbeDXCpO (ORCPT ); Mon, 23 Apr 2018 22:45:14 -0400 Received: from william.wu?rock-chips.com (unknown [192.168.167.129]) by regular1.263xmail.com (Postfix) with ESMTP id 8114086; Tue, 24 Apr 2018 10:45:11 +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 73F5C3A6; Tue, 24 Apr 2018 10:45:05 +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: <709dd1a09ae247b423eaff771f8a902b> 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 18315ZHW9J; Tue, 24 Apr 2018 10:45:09 +0800 (CST) From: William Wu To: hminas@synopsys.com, felipe.balbi@linux.intel.com, gregkh@linuxfoundation.org Cc: 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 Subject: [PATCH 2/2] usb: dwc2: fix isoc split in transfer with no data Date: Tue, 24 Apr 2018 10:43:44 +0800 Message-Id: <1524537824-22010-3-git-send-email-william.wu@rock-chips.com> X-Mailer: git-send-email 2.0.0 In-Reply-To: <1524537824-22010-1-git-send-email-william.wu@rock-chips.com> References: <1524537824-22010-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 0), 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 on data is in the first transaction, we can return immediately. But if the the DATA0 packet with on 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 --- 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; -- 2.0.0