Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp354180pxb; Thu, 26 Aug 2021 04:55:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxR7sYzyYXooH+Sd9L9A/X94+0MTKfRI+8xqwYVcuESR7NBtnRm+PJeELigpqBU57G3HZ90 X-Received: by 2002:a05:6602:2597:: with SMTP id p23mr2688436ioo.195.1629978932741; Thu, 26 Aug 2021 04:55:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629978932; cv=none; d=google.com; s=arc-20160816; b=O6sVunty3Oyk+TU1hHHUY7L+cEplY/9iWZsqAqGI/BAefiHdcUinh9DQGxYrx+5d2u Wul0UKk6IYTTCrk7Zu0UzYIpyo2Qj8B89N7LhaSO2WKEf2cq3sd2Kl41Lgj5410CFGQD Iqkev9ko9mhbp+RHVldbzC0EyRY9QKLJpXJMBr0puzD5qGu03lqi50bu367z68TN9SOY 5GX7uHBn105UCAPsCakaPgnlr+k9QxrWFOFOteG2L2F+NC/qb3S5Vv9HfaaDfiwNjRZZ WL1XnCXx0dVnySiEAiPco0LOsRK/5DV25ekwxhPO6+hxFGUjg4EJgbR8QIkdoRbQqtj6 UuTQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=GF9cA6HWm73PdcnhQrBWb0JMD23t4eWrYuwcNebBzhg=; b=KXg0jv4ggxokvrpBQYwBWg1txRidMn813OSc7ZxC3Z7BqxxKlnefBfja5GtxUJ9cCb JcDldeTxtJl9qbuBqTAh2u+825hNTHa+0Ccd046FZHB/GzKiIu2nzmOyY46lkwDZT77i hw2SbprKP1KpO2SdkcTZKmcowrRrfQ8EClDOhrZ1juatWeloXLYgWakCsLfqgP7nz88G zeLF3YvGhnVMptOAtIlNFEujvETWVY2ZbpGv/hB2eWTgHTB4uejrDGZSGCXpIoZ1c2VH xyAlQISZTNbaIVXZl/Ae05Ou94NcSISJHQN69tzxBQ4Ia4wQkakmzkvnlqPdeHME/BXP nSCA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=BOLP6Ete; 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=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id g8si2648261jal.26.2021.08.26.04.55.21; Thu, 26 Aug 2021 04:55:32 -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=@chromium.org header.s=google header.b=BOLP6Ete; 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=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S242365AbhHZLzF (ORCPT + 99 others); Thu, 26 Aug 2021 07:55:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51422 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S242366AbhHZLzD (ORCPT ); Thu, 26 Aug 2021 07:55:03 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9E8E8C0613C1 for ; Thu, 26 Aug 2021 04:54:16 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id mq3so2020998pjb.5 for ; Thu, 26 Aug 2021 04:54:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=GF9cA6HWm73PdcnhQrBWb0JMD23t4eWrYuwcNebBzhg=; b=BOLP6Ete/5M3jts/uWuAymRzOu8DrhtLuaCJjWI6HJPL7OVKD5Sswq0Ir/Ml8zxiWp sRpiHOy5vrltsG0dygRRhglM4AN+Tp8c5s0LpKJOFDYjOpRpq3jZK8SgY5u5aNdP+sUk kPoAzc+OBpyviSNC3b3vRX0ZXey/cvs089ptA= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=GF9cA6HWm73PdcnhQrBWb0JMD23t4eWrYuwcNebBzhg=; b=tu3rU3rwa7rBw7UXcMQNbyE2mMCTUgGx2JU7MfLzStWoHN2D1FTawpYIA7X4LyEWup jZFmcIUA9aDmCjpFfX2mvBEeX+POY5xXFZx8qvBsrZ9VFquqHMHeHbDgWZiKAbEQWScA m7Qi1PBu9Ex6zMrvUbg65PN+lwWUy3SQ3Y3CHuS0JoQKXbAHGtU/J8dpktoZBr2SuJfq KR4wx8c2nzIWWlLjlPB4S+IOhB2Q5mMOoCpEWsgM7YbpkTb2H3HX1dGNbTFpjhbkg/gg A+3q1Jifold+ljMr0Ct4hpHwmcJilw10jF/uunW+rvBylTN5nO7Ch3OF+GP4/6OeZkk2 zNCQ== X-Gm-Message-State: AOAM533IPiNG6eVp12OvGuB+pX9/SGY6yHVz30GunoZKL/ALJxR+F7RQ 5T/utSp79uKAR1oTdYa9diIyWpi6cFQiMMlzZJJa/w== X-Received: by 2002:a17:903:32ce:b0:138:7c09:1178 with SMTP id i14-20020a17090332ce00b001387c091178mr3215013plr.60.1629978855791; Thu, 26 Aug 2021 04:54:15 -0700 (PDT) MIME-Version: 1.0 References: <20210826025144.51992-1-chunfeng.yun@mediatek.com> <20210826025144.51992-3-chunfeng.yun@mediatek.com> In-Reply-To: <20210826025144.51992-3-chunfeng.yun@mediatek.com> From: Ikjoon Jang Date: Thu, 26 Aug 2021 19:54:04 +0800 Message-ID: Subject: Re: [PATCH next v2 3/6] usb: xhci-mtk: update fs bus bandwidth by bw_budget_table To: Chunfeng Yun Cc: Mathias Nyman , Greg Kroah-Hartman , Matthias Brugger , "open list:USB XHCI DRIVER" , "moderated list:ARM/Mediatek SoC support" , "moderated list:ARM/Mediatek SoC support" , open list , Eddie Hung , Yaqii wu Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Chunfeng, On Thu, Aug 26, 2021 at 10:52 AM Chunfeng Yun wrote: > > Use @bw_budget_table[] to update fs bus bandwidth due to > not all microframes consume @bw_cost_per_microframe, see > setup_sch_info(). > > Signed-off-by: Chunfeng Yun > --- > v2: new patch, move from another series > --- > drivers/usb/host/xhci-mtk-sch.c | 17 +++++++---------- > 1 file changed, 7 insertions(+), 10 deletions(-) > > diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c > index cffcaf4dfa9f..83abd28269ca 100644 > --- a/drivers/usb/host/xhci-mtk-sch.c > +++ b/drivers/usb/host/xhci-mtk-sch.c > @@ -458,8 +458,8 @@ static int check_fs_bus_bw(struct mu3h_sch_ep_info *sch_ep, int offset) > * Compared with hs bus, no matter what ep type, > * the hub will always delay one uframe to send data > */ > - for (j = 0; j < sch_ep->cs_count; j++) { > - tmp = tt->fs_bus_bw[base + j] + sch_ep->bw_cost_per_microframe; > + for (j = 0; j < sch_ep->num_budget_microframes; j++) { > + tmp = tt->fs_bus_bw[base + j] + sch_ep->bw_budget_table[j]; I'm worrying about this case with two endpoints, * EP1OUT: isochronous, maxpacket=192: bw_budget_table[] = { 188, 188, 0, ... } * EP2IN: interrupt, maxpacket=64: bw_budget_table[] = { 0, 0, 64, 64, ... } (Is this correct bw_budget_table contents for those eps?) I'm not sure if it's okay for those two endpoints to be allocated on the same u-frame slot. Can you please check if this is okay for xhci-mtk? (I feel like I already asked the same questions many times.) > if (tmp > FS_PAYLOAD_MAX) > return -ESCH_BW_OVERFLOW; > } > @@ -534,21 +534,18 @@ static void update_sch_tt(struct mu3h_sch_ep_info *sch_ep, bool used) > { > struct mu3h_sch_tt *tt = sch_ep->sch_tt; > u32 base, num_esit; > - int bw_updated; > int i, j; > > num_esit = XHCI_MTK_MAX_ESIT / sch_ep->esit; > > - if (used) > - bw_updated = sch_ep->bw_cost_per_microframe; > - else > - bw_updated = -sch_ep->bw_cost_per_microframe; > - > for (i = 0; i < num_esit; i++) { > base = sch_ep->offset + i * sch_ep->esit; > > - for (j = 0; j < sch_ep->cs_count; j++) > - tt->fs_bus_bw[base + j] += bw_updated; > + for (j = 0; j < sch_ep->num_budget_microframes; j++) > + if (used) > + tt->fs_bus_bw[base + j] += sch_ep->bw_budget_table[j]; > + else > + tt->fs_bus_bw[base + j] -= sch_ep->bw_budget_table[j]; > } > > if (used) > -- > 2.18.0 >