Received: by 2002:a05:6a10:1287:0:0:0:0 with SMTP id d7csp3679136pxv; Mon, 26 Jul 2021 09:14:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw9YqBbSNmj+YpJndM2zZZenetQ4tWO/GrEtz/2LeMb90G6M+J/u3DGksEy7TuPRo30SC/O X-Received: by 2002:a05:6638:1350:: with SMTP id u16mr17152108jad.19.1627316069773; Mon, 26 Jul 2021 09:14:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627316069; cv=none; d=google.com; s=arc-20160816; b=vxKEIuNLvoSgIgTiVKt0/evWt5VJjOd8FiH+P/CLu7lSjIZVtb0bEcSTzuaNiwfW87 S3UF1Vvnw59Ku/fjLLjBSYDRX9mMvBpj7WzRCFfgsWyWs5EJg6yGRgr4o02TizI+hCoq 1wqAhgzeY9chrE2D++TcNjyjezuNoEwyw5pkIJG1JnIGC7z57Ynx3p5TGWPDBQkBX6gE TlubdPDSnTnRI03/nANrU5D4zBYsBz8Aq10HUfkPPp5be7mgIRJc1NXYGL9tNf9aPFdv u8OrMN68rj46Q2FEvX7Cud06dNnXeV/GERQ3YaiUB6WY+6zwIAGpQF9VEqSG8xjp92XY g7rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=NteQfVYjCsUhFY5ZG1a5KwtDUU4OfwimE/8WVtFqS60=; b=UpPjm7VbAtkHV8SDPS/H4zktDt2goRRhIc6QtI9VLjLu41eYBGgNj7ciQSpjkr+v4b 7KrgA9CBz4ooFEKZ0y0lMFv7fKAT/NzNutQiYgxUEpqYbXnuCHC/wbJu9etucnSrgVhe uOQDzUBTnhgTzkKwFtsZvBLwQUBHMgD4zF/zIu+33s+TcN70uoFjvKJymECqRs/Dqzdk ABYYso8Y9HtGNBJMzqoZwIiOANnat7KxoZw+A4M16NmTXOKGCTRYnnvaqzAm/ejXKVsU 7S8vkNjSM54xotPH3ejgpKbUfNGWaido3mYUBk43WSwXpFl14KK3qBm2BiqcMeE4s6Em ULnw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zAO0p4WE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id x6si267857ilj.25.2021.07.26.09.14.16; Mon, 26 Jul 2021 09:14:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=zAO0p4WE; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233295AbhGZPcf (ORCPT + 99 others); Mon, 26 Jul 2021 11:32:35 -0400 Received: from mail.kernel.org ([198.145.29.99]:58956 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236441AbhGZPSU (ORCPT ); Mon, 26 Jul 2021 11:18:20 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id A601160FD8; Mon, 26 Jul 2021 15:58:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1627315129; bh=8u3p3adKE1jvx3fFGSIpHXNj3AnbKGy4Awh7LZfQCwc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=zAO0p4WEpXaVykLINgMhz+aKN7mWlMs8KiazocCn0/qnoNppDfAk17my95romP7OD SzIKREDFRT1pEnjwEUeUu1DJ+BrKhLZYGXpG27iLXYIxuXWHc0+tOByZEpTQd8FfyI 61dJCMfjq0zsEMw2lekyOWIKfhbK6Xw65xtJC53M= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Minas Harutyunyan Subject: [PATCH 5.4 087/108] usb: dwc2: gadget: Fix sending zero length packet in DDMA mode. Date: Mon, 26 Jul 2021 17:39:28 +0200 Message-Id: <20210726153834.468412085@linuxfoundation.org> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210726153831.696295003@linuxfoundation.org> References: <20210726153831.696295003@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Minas Harutyunyan commit d53dc38857f6dbefabd9eecfcbf67b6eac9a1ef4 upstream. Sending zero length packet in DDMA mode perform by DMA descriptor by setting SP (short packet) flag. For DDMA in function dwc2_hsotg_complete_in() does not need to send zlp. Tested by USBCV MSC tests. Fixes: f71b5e2533de ("usb: dwc2: gadget: fix zero length packet transfers") Cc: stable Signed-off-by: Minas Harutyunyan Link: https://lore.kernel.org/r/967bad78c55dd2db1c19714eee3d0a17cf99d74a.1626777738.git.Minas.Harutyunyan@synopsys.com Signed-off-by: Greg Kroah-Hartman --- drivers/usb/dwc2/gadget.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) --- a/drivers/usb/dwc2/gadget.c +++ b/drivers/usb/dwc2/gadget.c @@ -2748,12 +2748,14 @@ static void dwc2_hsotg_complete_in(struc return; } - /* Zlp for all endpoints, for ep0 only in DATA IN stage */ + /* Zlp for all endpoints in non DDMA, for ep0 only in DATA IN stage */ if (hs_ep->send_zlp) { - dwc2_hsotg_program_zlp(hsotg, hs_ep); hs_ep->send_zlp = 0; - /* transfer will be completed on next complete interrupt */ - return; + if (!using_desc_dma(hsotg)) { + dwc2_hsotg_program_zlp(hsotg, hs_ep); + /* transfer will be completed on next complete interrupt */ + return; + } } if (hs_ep->index == 0 && hsotg->ep0_state == DWC2_EP0_DATA_IN) {