USB: Fix usb_fill_int_urb for SuperSpeed devices

USB 3 and Wireless USB specify a logarithmic encoding of the endpoint
interval that matches the USB 2 specification. usb_fill_int_urb() didn't
know that and was filling in the interval as if it was USB 1.1. Fix
usb_fill_int_urb() for SuperSpeed devices, but leave the wireless case
alone, because David Vrabel wants to keep the old encoding.

Update the struct urb kernel doc to note that SuperSpeed URBs must have
urb->interval specified in microframes.

Add a missing break statement in the usb_submit_urb() interrupt URB
checking, since wireless USB and SuperSpeed USB encode urb->interval
differently. This allows xHCI roothubs to actually register with khubd.

Signed-off-by: Matthew Wilcox <willy@linux.intel.com>
Signed-off-by: Sarah Sharp <sarah.a.sharp@linux.intel.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Matthew Wilcox and committed by
Greg Kroah-Hartman
f09a15e6 e549a17f

+14 -5
+1
drivers/usb/core/urb.c
··· 453 453 if (urb->interval > (1 << 15)) 454 454 return -EINVAL; 455 455 max = 1 << 15; 456 + break; 456 457 case USB_SPEED_WIRELESS: 457 458 if (urb->interval > 16) 458 459 return -EINVAL;
+13 -5
include/linux/usb.h
··· 1055 1055 * @number_of_packets: Lists the number of ISO transfer buffers. 1056 1056 * @interval: Specifies the polling interval for interrupt or isochronous 1057 1057 * transfers. The units are frames (milliseconds) for full and low 1058 - * speed devices, and microframes (1/8 millisecond) for highspeed ones. 1058 + * speed devices, and microframes (1/8 millisecond) for highspeed 1059 + * and SuperSpeed devices. 1059 1060 * @error_count: Returns the number of ISO transfers that reported errors. 1060 1061 * @context: For use in completion functions. This normally points to 1061 1062 * request-specific driver context. ··· 1287 1286 * 1288 1287 * Initializes a interrupt urb with the proper information needed to submit 1289 1288 * it to a device. 1290 - * Note that high speed interrupt endpoints use a logarithmic encoding of 1291 - * the endpoint interval, and express polling intervals in microframes 1292 - * (eight per millisecond) rather than in frames (one per millisecond). 1289 + * 1290 + * Note that High Speed and SuperSpeed interrupt endpoints use a logarithmic 1291 + * encoding of the endpoint interval, and express polling intervals in 1292 + * microframes (eight per millisecond) rather than in frames (one per 1293 + * millisecond). 1294 + * 1295 + * Wireless USB also uses the logarithmic encoding, but specifies it in units of 1296 + * 128us instead of 125us. For Wireless USB devices, the interval is passed 1297 + * through to the host controller, rather than being translated into microframe 1298 + * units. 1293 1299 */ 1294 1300 static inline void usb_fill_int_urb(struct urb *urb, 1295 1301 struct usb_device *dev, ··· 1313 1305 urb->transfer_buffer_length = buffer_length; 1314 1306 urb->complete = complete_fn; 1315 1307 urb->context = context; 1316 - if (dev->speed == USB_SPEED_HIGH) 1308 + if (dev->speed == USB_SPEED_HIGH || dev->speed == USB_SPEED_SUPER) 1317 1309 urb->interval = 1 << (interval - 1); 1318 1310 else 1319 1311 urb->interval = interval;