Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1858266pxb; Fri, 5 Mar 2021 01:05:53 -0800 (PST) X-Google-Smtp-Source: ABdhPJzxm6R6rcAZTp7cJnDWIhYREDZ97YjWMgRz0I6R58Rv055AzGW78tx2sqZTX0ZdPrkpITb1 X-Received: by 2002:a17:906:ada:: with SMTP id z26mr1388450ejf.438.1614935153100; Fri, 05 Mar 2021 01:05:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1614935153; cv=none; d=google.com; s=arc-20160816; b=VkrosWqV/nqXu4mGpePRQfKBwovLW5XNGJpYbPPbgC0FTDY1RcsMTMSv3+MlcknQue ZmWN0jChXvTvoQ/yioovJVFah2IdzMx7XG7yE6QaM+a6WKGIIdDWt0rMbnhRo5KMrMsR X0IN9ldlLG0PYsZSaHoOUJlqxWpc7cdN68TtVOX6wl0EdLeu0bpOjahFh8UteZEIGjsU argHhWkw3EXLNyg9jh/aECaK5h9nReWk0GuJRPFXlm+Vc7yiSbBOSpjZ2eyTxWBEzOv7 Mj03v55faNXzocub40MT4mJQqLoIXG75Yh/ePVJnF/g0EHCSqLOhG+ZnKDqu2V3iJF6x wxYQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=ZUyfrD4JWyE+DWv5/w6OIq1DxXHHSwMuZ1vEoq1gMRs=; b=ILR+3zQC2ifV4GS3BTMS23ZUKYa8HQjxmgurj3nGdqSFBk7jtBFklhYeHAdnGETPKQ 0IDHF7fuYjoVraCXWvqz+1lUCgrMK77uyZhQKP+e9RVXuzvy1LfIwrLZrZ2TsAepM0HF W6azljJRZJuoxmkuMb4mfa4QZE2i8l9hpH4Rz3LzaI4VTmTMgs/s5sy+jbo3qndKfZZU tWHjlQ+bWYH+kbo8bLKSCo7R/cwp+eTvLPhxO1odU8E9b2Jv42QhpgD3wcwmPNkXiZM5 1g5Xf/W+7xS75JxVGvIBAKFl0FsrCEc0hgpLs8PA2ZW9UkJjcqi/3ZEm7VdEdSFdNg5Y MpHQ== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id s15si1272930edj.492.2021.03.05.01.05.30; Fri, 05 Mar 2021 01:05:53 -0800 (PST) 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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230093AbhCEJEE (ORCPT + 99 others); Fri, 5 Mar 2021 04:04:04 -0500 Received: from mailgw02.mediatek.com ([210.61.82.184]:44286 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S229500AbhCEJDa (ORCPT ); Fri, 5 Mar 2021 04:03:30 -0500 X-UUID: 6b2d76f5a1e740db8d142cae367eb447-20210305 X-UUID: 6b2d76f5a1e740db8d142cae367eb447-20210305 Received: from mtkexhb01.mediatek.inc [(172.21.101.102)] by mailgw02.mediatek.com (envelope-from ) (Cellopoint E-mail Firewall v4.1.14 Build 0819 with TLSv1.2 ECDHE-RSA-AES256-SHA384 256/256) with ESMTP id 731222678; Fri, 05 Mar 2021 17:03:28 +0800 Received: from MTKCAS06.mediatek.inc (172.21.101.30) by mtkmbs06n1.mediatek.inc (172.21.101.129) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Fri, 5 Mar 2021 17:03:27 +0800 Received: from localhost.localdomain (10.17.3.153) by MTKCAS06.mediatek.inc (172.21.101.73) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Fri, 5 Mar 2021 17:03:26 +0800 From: Chunfeng Yun To: Mathias Nyman , Greg Kroah-Hartman , Ikjoon Jang CC: Chunfeng Yun , Matthias Brugger , , , , , Nicolas Boichat , Eddie Hung Subject: [PATCH 17/17] usb: xhci-mtk: print debug info of endpoint interval Date: Fri, 5 Mar 2021 17:02:55 +0800 Message-ID: <1614934975-15188-17-git-send-email-chunfeng.yun@mediatek.com> X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: <1614934975-15188-1-git-send-email-chunfeng.yun@mediatek.com> References: <1614934975-15188-1-git-send-email-chunfeng.yun@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain X-MTK: N Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Print bInterval and convert it into the time expressed in us or ms unit, this is the key info when allocate bandwidth failed. Signed-off-by: Chunfeng Yun --- drivers/usb/host/xhci-mtk-sch.c | 37 ++++++++++++++++++++++++++------- 1 file changed, 29 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-mtk-sch.c b/drivers/usb/host/xhci-mtk-sch.c index 4f6b86131820..03da55bc7f9b 100644 --- a/drivers/usb/host/xhci-mtk-sch.c +++ b/drivers/usb/host/xhci-mtk-sch.c @@ -25,6 +25,8 @@ */ #define TT_MICROFRAMES_MAX 9 +#define DBG_BUF_EN 64 + /* schedule error type */ #define ESCH_SS_Y6 1001 #define ESCH_SS_OVERLAP 1002 @@ -62,6 +64,31 @@ static int is_fs_or_ls(enum usb_device_speed speed) return speed == USB_SPEED_FULL || speed == USB_SPEED_LOW; } +static const char * +decode_ep(struct usb_host_endpoint *ep, enum usb_device_speed speed) +{ + static char buf[DBG_BUF_EN]; + struct usb_endpoint_descriptor *epd = &ep->desc; + unsigned int interval; + const char *unit; + + interval = usb_decode_interval(epd, speed); + if (interval % 1000) { + unit = "us"; + } else { + unit = "ms"; + interval /= 1000; + } + + snprintf(buf, DBG_BUF_EN, "%s ep%d%s %s, mpkt:%d, interval:%d/%d%s\n", + usb_speed_string(speed), usb_endpoint_num(epd), + usb_endpoint_dir_in(epd) ? "in" : "out", + usb_ep_type_string(usb_endpoint_type(epd)), + usb_endpoint_maxp(epd), epd->bInterval, interval, unit); + + return buf; +} + static u32 get_bw_boundary(enum usb_device_speed speed) { u32 boundary; @@ -711,10 +738,7 @@ static int add_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev, ep_index = xhci_get_endpoint_index(&ep->desc); ep_ctx = xhci_get_ep_ctx(xhci, virt_dev->in_ctx, ep_index); - xhci_dbg(xhci, "%s() type:%d, speed:%d, mpkt:%d, dir:%d, ep:%p\n", - __func__, usb_endpoint_type(&ep->desc), udev->speed, - usb_endpoint_maxp(&ep->desc), - usb_endpoint_dir_in(&ep->desc), ep); + xhci_dbg(xhci, "%s %s\n", __func__, decode_ep(ep, udev->speed)); if (!need_bw_sch(ep, udev->speed, !!virt_dev->tt_info)) { /* @@ -750,10 +774,7 @@ static void drop_ep_quirk(struct usb_hcd *hcd, struct usb_device *udev, virt_dev = xhci->devs[udev->slot_id]; - xhci_dbg(xhci, "%s() type:%d, speed:%d, mpks:%d, dir:%d, ep:%p\n", - __func__, usb_endpoint_type(&ep->desc), udev->speed, - usb_endpoint_maxp(&ep->desc), - usb_endpoint_dir_in(&ep->desc), ep); + xhci_dbg(xhci, "%s %s\n", __func__, decode_ep(ep, udev->speed)); if (!need_bw_sch(ep, udev->speed, !!virt_dev->tt_info)) return; -- 2.18.0