linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Chunfeng Yun <chunfeng.yun@mediatek.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Ikjoon Jang <ikjn@chromium.org>
Cc: Chunfeng Yun <chunfeng.yun@mediatek.com>,
	Matthias Brugger <matthias.bgg@gmail.com>,
	<linux-usb@vger.kernel.org>,
	<linux-arm-kernel@lists.infradead.org>,
	<linux-mediatek@lists.infradead.org>,
	<linux-kernel@vger.kernel.org>,
	Nicolas Boichat <drinkcat@chromium.org>,
	Eddie Hung <eddie.hung@mediatek.com>,
	Sergei Shtylyov <sergei.shtylyov@gmail.com>,
	Alan Stern <stern@rowland.harvard.edu>
Subject: [PATCH v2 17/18] usb: xhci-mtk: print debug info of endpoint interval
Date: Mon, 8 Mar 2021 10:52:06 +0800	[thread overview]
Message-ID: <f7a9fa7a812296fcd6c603bfa9853076144018d6.1615170625.git.chunfeng.yun@mediatek.com> (raw)
In-Reply-To: <d287899e6beb2fc1bfb8900c75a872f628ecde55.1615170625.git.chunfeng.yun@mediatek.com>

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 <chunfeng.yun@mediatek.com>
---
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


  parent reply	other threads:[~2021-03-08  2:54 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-03-08  2:51 [PATCH v2 01/18] usb: xhci-mtk: remove or operator for setting schedule parameters Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 02/18] usb: xhci-mtk: improve bandwidth scheduling with TT Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 03/18] usb: xhci-mtk: get the microframe boundary for ESIT Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 04/18] usb: xhci-mtk: add only one extra CS for FS/LS INTR Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 05/18] usb: xhci-mtk: use @sch_tt to check whether need do TT schedule Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 06/18] usb: xhci-mtk: add a function to (un)load bandwidth info Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 07/18] usb: xhci-mtk: add a function to get bandwidth boundary Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 08/18] usb: xhci-mtk: remove unnecessary members of mu3h_sch_tt struct Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 09/18] usb: xhci-mtk: use clear type instead of void Chunfeng Yun
2021-03-08  2:51 ` [PATCH v2 10/18] usb: xhci-mtk: add a member @speed in mu3h_sch_ep_info struct Chunfeng Yun
2021-03-08  2:52 ` [PATCH v2 11/18] usb: xhci-mtk: use @tt_info to check the FS/LS device is under a HS hub Chunfeng Yun
2021-03-08  2:52 ` [PATCH v2 12/18] usb: xhci-mtk: rebuild the way to get bandwidth domain Chunfeng Yun
2021-03-08  2:52 ` [PATCH v2 13/18] usb: xhci-mtk: add some schedule error number Chunfeng Yun
2021-03-08  2:52 ` [PATCH v2 14/18] usb: xhci-mtk: remove declaration of xhci_mtk_setup() Chunfeng Yun
2021-03-08  2:52 ` [PATCH v2 15/18] usb: xhci-mtk: support to build xhci-mtk-hcd.ko Chunfeng Yun
2021-03-08 11:06   ` Mathias Nyman
2021-03-08  2:52 ` [PATCH v2 16/18] usb: common: add function to get interval expressed in us unit Chunfeng Yun
2021-03-08 16:22   ` Alan Stern
2021-03-08  2:52 ` Chunfeng Yun [this message]
2021-03-08  2:52 ` [PATCH v2 18/18] usb: common: move function's kerneldoc next to its definition Chunfeng Yun
2021-03-08 13:25   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f7a9fa7a812296fcd6c603bfa9853076144018d6.1615170625.git.chunfeng.yun@mediatek.com \
    --to=chunfeng.yun@mediatek.com \
    --cc=drinkcat@chromium.org \
    --cc=eddie.hung@mediatek.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=ikjn@chromium.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mediatek@lists.infradead.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=matthias.bgg@gmail.com \
    --cc=sergei.shtylyov@gmail.com \
    --cc=stern@rowland.harvard.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).