Skip to content

Commit fdfe40e

Browse files
P33Mpopcornmix
authored andcommitted
usb: xhci: default to Intel scheme for calculating U1/U2 timeouts
By default, the System Exit Latency and Maximum Exit Latency are used to calculate hub port U1 and U2 timeout values. This has the effect of aggressively power-managing a SuperSpeed link but devices are known to report unfeasibly short device exit latencies in their descriptors, which under certain usage conditions can significantly degrade throughput as the link spends longer retraining than being in a useable state. The Intel heuristic approach calculates a reasonably large endpoint-dependent U1 timeout, and uses a minimum U2 timeout that is several multiples of typical U2 exit latencies. Add a module parameter that defaults to using this scheme. This should have the effect of squelching interop edge-cases where LPM noticeably degrades performance, and avoid the usual workaround where userspace manually disables it. Signed-off-by: Jonathan Bell <jonathan@raspberrypi.com>
1 parent 2f9097f commit fdfe40e

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

drivers/usb/host/xhci.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ static unsigned long long quirks;
4040
module_param(quirks, ullong, S_IRUGO);
4141
MODULE_PARM_DESC(quirks, "Bit flags for quirks to be enabled as default");
4242

43+
static int sandbag_lpm = 1;
44+
module_param(sandbag_lpm, int, S_IRUGO | S_IWUSR);
45+
MODULE_PARM_DESC(sandbag_lpm, "Use relaxed U1/U2 port LPM timeouts");
46+
4347
static bool td_on_ring(struct xhci_td *td, struct xhci_ring *ring)
4448
{
4549
struct xhci_segment *seg;
@@ -4841,7 +4845,7 @@ static u16 xhci_calculate_u1_timeout(struct xhci_hcd *xhci,
48414845
}
48424846
}
48434847

4844-
if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_ZHAOXIN_HOST))
4848+
if (sandbag_lpm || xhci->quirks & (XHCI_INTEL_HOST | XHCI_ZHAOXIN_HOST))
48454849
timeout_ns = xhci_calculate_intel_u1_timeout(udev, desc);
48464850
else
48474851
timeout_ns = udev->u1_params.sel;
@@ -4905,7 +4909,7 @@ static u16 xhci_calculate_u2_timeout(struct xhci_hcd *xhci,
49054909
}
49064910
}
49074911

4908-
if (xhci->quirks & (XHCI_INTEL_HOST | XHCI_ZHAOXIN_HOST))
4912+
if (sandbag_lpm || xhci->quirks & (XHCI_INTEL_HOST | XHCI_ZHAOXIN_HOST))
49094913
timeout_ns = xhci_calculate_intel_u2_timeout(udev, desc);
49104914
else
49114915
timeout_ns = udev->u2_params.sel;

0 commit comments

Comments
 (0)