[PATCH] usb: xhci: Fix debugfs bandwidth reporting
From: Michal Pecio
Date: Wed Mar 04 2026 - 05:49:39 EST
Replace kernel USB speed numbers with xHCI protocol IDs expected by HW.
They are numerically equal up to high speed, but instead of SuperSpeed
we were querying SuperSpeed+.
Gen1 hardware rejects such commands with TRB Error, which resulted in
zero available bandwidth being shown.
While at that, report command failure as IO error, not zero bandwidth.
Signed-off-by: Michal Pecio <michal.pecio@xxxxxxxxx>
---
drivers/usb/host/xhci-debugfs.c | 6 +++---
drivers/usb/host/xhci.c | 2 ++
2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/drivers/usb/host/xhci-debugfs.c b/drivers/usb/host/xhci-debugfs.c
index c2080ee4df50..d45fa29a9691 100644
--- a/drivers/usb/host/xhci-debugfs.c
+++ b/drivers/usb/host/xhci-debugfs.c
@@ -709,7 +709,7 @@ static int xhci_ss_bw_show(struct seq_file *s, void *unused)
int ret;
struct xhci_hcd *xhci = (struct xhci_hcd *)s->private;
- ret = xhci_port_bw_show(xhci, USB_SPEED_SUPER, s);
+ ret = xhci_port_bw_show(xhci, DEV_PORT_SPEED(XDEV_SS), s);
return ret;
}
@@ -718,7 +718,7 @@ static int xhci_hs_bw_show(struct seq_file *s, void *unused)
int ret;
struct xhci_hcd *xhci = (struct xhci_hcd *)s->private;
- ret = xhci_port_bw_show(xhci, USB_SPEED_HIGH, s);
+ ret = xhci_port_bw_show(xhci, DEV_PORT_SPEED(XDEV_HS), s);
return ret;
}
@@ -727,7 +727,7 @@ static int xhci_fs_bw_show(struct seq_file *s, void *unused)
int ret;
struct xhci_hcd *xhci = (struct xhci_hcd *)s->private;
- ret = xhci_port_bw_show(xhci, USB_SPEED_FULL, s);
+ ret = xhci_port_bw_show(xhci, DEV_PORT_SPEED(XDEV_FS), s);
return ret;
}
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c
index 6b312966c103..2f23b796ca12 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -3277,6 +3277,8 @@ int xhci_get_port_bandwidth(struct xhci_hcd *xhci, struct xhci_container_ctx *ct
spin_unlock_irqrestore(&xhci->lock, flags);
wait_for_completion(cmd->completion);
+ if (cmd->status != COMP_SUCCESS)
+ ret = -EIO;
err_out:
kfree(cmd->completion);
kfree(cmd);
--
2.48.1