Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1578549pxb; Mon, 8 Mar 2021 00:40:07 -0800 (PST) X-Google-Smtp-Source: ABdhPJy4qpTYj3SgXgV6ntwdsUjh+hpWq4lIpBOcCywJT5rGbNlzAtIlTvwKHrV4X4Y3juCvzzjw X-Received: by 2002:a17:906:ada:: with SMTP id z26mr13860737ejf.438.1615192806869; Mon, 08 Mar 2021 00:40:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615192806; cv=none; d=google.com; s=arc-20160816; b=vHeTVvhBEI9zfW6Xu4yezTPUAuseEMJDGcQXM14/lAA8u3Ve2hBdA//BE9EtaMy4/n yabIIQWWECpCI/yHpeghj2lVUFIxLYqhqr+VftJn9J9Fk4kKSBnOdV+q2TPqzWriwlP/ NDNGIV6meN+jMFtp3Kms0pDOyYjR0tJ9AL01tXGVIWbtibJ7y6yTg7inpk1zxw6xDi34 EGLk2PzaJOASsKzy0EAVsejO8vSW3DRCK8ydZXwoAPp5TkK130uB61Z61TbXQqfAobk0 lT1t5SoE74j9QZKZXxmkXKz35vAU9v/7MaDrMuD+g0oGBBotSuol3bUP/eP6PzQK/Kb9 p2Hg== 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=y2j+ro9pTYLj3OOD/roUQovxbuNwUCyG/uAyDD02oIE=; b=NtkKUFwDc6dE3qwYlD1q6i+5aXVZmPYdAh2YeZ4H2oa7eGJdE0z9+AQpQeZKUmAd0o wJDvNrPL1hl5vS7bXd6eoHJygfeQWg3RS3ckF+QjW5ubQAlEH5pVukgGTKBIRlM2fQxG HF64oIDMtzQcS/BqqgtQ1t7zDGPehxdfFEBBcOcjRp1MmVnRLFp9811Zac9D5DdqzlnS vfLa6sY8yFVoFMEN+SgcpOOWhq9PCGjv9ZgzfHT8Seujf+fK2VMm+L2xv4o+B4ntE5Ud Td19qU+jZI4M27b2/dhOqwUOuGZmvuaWP3KXKgSr/Fj70jR3cEr+Gzs3J8mrR/yZJxJs 4iqQ== 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 k16si6333446ejd.246.2021.03.08.00.39.44; Mon, 08 Mar 2021 00:40:06 -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 S233848AbhCHCxZ (ORCPT + 99 others); Sun, 7 Mar 2021 21:53:25 -0500 Received: from mailgw01.mediatek.com ([210.61.82.183]:39839 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S233678AbhCHCwd (ORCPT ); Sun, 7 Mar 2021 21:52:33 -0500 X-UUID: 7ce98ea4f15c4597b6899fccc2fd0a4c-20210308 X-UUID: 7ce98ea4f15c4597b6899fccc2fd0a4c-20210308 Received: from mtkcas06.mediatek.inc [(172.21.101.30)] by mailgw01.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 1620518821; Mon, 08 Mar 2021 10:52:29 +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; Mon, 8 Mar 2021 10:52:28 +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; Mon, 8 Mar 2021 10:52:27 +0800 From: Chunfeng Yun To: Mathias Nyman , Greg Kroah-Hartman , Ikjoon Jang CC: Chunfeng Yun , Matthias Brugger , , , , , Nicolas Boichat , Eddie Hung , Sergei Shtylyov , Alan Stern Subject: [PATCH v2 17/18] usb: xhci-mtk: print debug info of endpoint interval Date: Mon, 8 Mar 2021 10:52:06 +0800 Message-ID: X-Mailer: git-send-email 1.8.1.1.dirty In-Reply-To: References: 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 --- v2: no changes --- 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 046b7f1ebf94..a59d1f6d4744 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