Received: by 2002:a05:6359:c8b:b0:c7:702f:21d4 with SMTP id go11csp796237rwb; Mon, 26 Sep 2022 06:05:10 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7v0a1vkbSxj1WED7puBAaIz18V/IV/nlWmdoX1Shfz1VFm7f2i7n6wPWiRWI5fLUavD0tx X-Received: by 2002:aa7:859a:0:b0:549:e89d:5ead with SMTP id w26-20020aa7859a000000b00549e89d5eadmr24137813pfn.63.1664197510103; Mon, 26 Sep 2022 06:05:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1664197510; cv=none; d=google.com; s=arc-20160816; b=qByzvG2UXhje6Bz2F1t4W+zpfsPR6WZN0TdSYWHcQ/Bf6dTZVCbp1lBjmhXYh905LW Qwhb5q6SZ4uTKthMh0IN5PhSFgncyXfHZ2a/3H/C1naQ9GBQJFxpaW0H/5RcxHJ0LT2T 0i/bAl8CRfkpCGfwAgAXqSNT4d0kYM9OlMqYDme92reUG/MJ1S9sJNQ9T9AiyFcxGsPn ZDhyhIFSp9PYrGi0ji2EeDUDm5vDZOcE1IwMrsk8elvJ96myPIBAxeJ6Hopa6fDn9hWt OP7vVwDNXYMakankZu0GKZZHIX3ZOy+CyDfo1ybcYBHffIQ3H850R941o/SBh0SLvQFp avbQ== 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=fwagKzT/mqd0k/1+9O28mCjKO6yVul15CkojUd1wRBo=; b=hAY4qcodtQxjjKfAHvl89Ho8LGU3ldMV+0uXJ2rSwRR/czXF0GW5jvdry0kA2K5Uzx UC8/bi9dyO4oVUXQhzbfU1ZdURcNI7tI5V+QJcZ+giTdiNPSsCrgKyr5qFeS3DKbx6LR twYjX37cg6HCme2eL82hN02ZRPn0XieEwWnfzEoI6UBZUl9phI7sQGHis+x1ukgxyNIn uyIhYay/OusB3saqsBIren6EyuXwyoa3M2wNlz1nXMqTH3lCXDUCt1YrOqkA55tqXnQQ rm7Cbmnu4HVfQDOyaBm6ezQv59uOyJgWqVCiy8T3wxStfgwYLIOz+2NdPM88IpLxVubc SLYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dE6DB3Oj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q22-20020a635c16000000b00438fe64c793si18834935pgb.499.2022.09.26.06.04.58; Mon, 26 Sep 2022 06:05:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=dE6DB3Oj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236731AbiIZKwO (ORCPT + 99 others); Mon, 26 Sep 2022 06:52:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60710 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236894AbiIZKtp (ORCPT ); Mon, 26 Sep 2022 06:49:45 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A973C580B7; Mon, 26 Sep 2022 03:26:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id AA6A360B9A; Mon, 26 Sep 2022 10:26:57 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id AE84AC433C1; Mon, 26 Sep 2022 10:26:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1664188017; bh=uL7SlwwZZ5lf4O8RXBnrMmtiQSNrVMXo+2zGJvQVkFk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=dE6DB3OjlJbe25t4PnuvSRiVDekZ3qUIWdl9csqoiZPp0Ksgs/mUQdBfSPo2ki/l/ w3SMVs0P3xuXN4Tf+fIN977gnLQDUII1z4VYoFh+nfCMAN1q93nurNoNP0SCYchGCO EXN7P5EBjCwYnoIoMqqyQ0gTGuqfF3mEI4ww3Ajg= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Chunfeng Yun , Sasha Levin Subject: [PATCH 5.10 014/141] usb: xhci-mtk: add only one extra CS for FS/LS INTR Date: Mon, 26 Sep 2022 12:10:40 +0200 Message-Id: <20220926100755.099825650@linuxfoundation.org> X-Mailer: git-send-email 2.37.3 In-Reply-To: <20220926100754.639112000@linuxfoundation.org> References: <20220926100754.639112000@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.2 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Chunfeng Yun [ Upstream commit 1bf661daf6b084bc4d753f55b54f35dc98709685 ] In USB2 Spec: "11.18.5 TT Response Generation In general, there will be two (or more) complete-split transactions scheduled for a periodic endpoint. However, for interrupt endpoints, the maximum size of the full-/low-speed transaction guarantees that it can never require more than two complete-split transactions. Two complete-split transactions are only required when the transaction spans a microframe boundary." Due to the maxp is 64, and less then 188 (at most in one microframe), seems never span boundary, so use only one CS for FS/LS interrupt transfer, this will save some bandwidth. Signed-off-by: Chunfeng Yun Link: https://lore.kernel.org/r/5b9ff09f53d23cf9e5c5437db4ffc18b798bf60c.1615170625.git.chunfeng.yun@mediatek.com Signed-off-by: Greg Kroah-Hartman Stable-dep-of: 548011957d1d ("usb: xhci-mtk: relax TT periodic bandwidth allocation") Signed-off-by: Sasha Levin --- drivers/usb/host/xhci-mtk-sch.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index 450fa22b7dc7..59ba25ca018d 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -408,13 +408,11 @@ static int check_sch_tt(struct usb_device *udev, { struct mu3h_sch_tt *tt = sch_ep->sch_tt; u32 extra_cs_count; - u32 fs_budget_start; u32 start_ss, last_ss; u32 start_cs, last_cs; int i; start_ss = offset % 8; - fs_budget_start = (start_ss + 1) % 8; if (sch_ep->ep_type == ISOC_OUT_EP) { last_ss = start_ss + sch_ep->cs_count - 1; @@ -450,16 +448,14 @@ static int check_sch_tt(struct usb_device *udev, if (sch_ep->ep_type == ISOC_IN_EP) extra_cs_count = (last_cs == 7) ? 1 : 2; else /* ep_type : INTR IN / INTR OUT */ - extra_cs_count = (fs_budget_start == 6) ? 1 : 2; + extra_cs_count = 1; cs_count += extra_cs_count; if (cs_count > 7) cs_count = 7; /* HW limit */ - for (i = 0; i < cs_count + 2; i++) { - if (test_bit(offset + i, tt->ss_bit_map)) - return -ERANGE; - } + if (test_bit(offset, tt->ss_bit_map)) + return -ERANGE; sch_ep->cs_count = cs_count; /* one for ss, the other for idle */ -- 2.35.1