usb: core: urb: Check SSP isoc ep comp descriptor
authorThinh Nguyen <Thinh.Nguyen@synopsys.com>
Fri, 16 Mar 2018 22:36:17 +0000 (15:36 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 20 Mar 2018 09:13:30 +0000 (10:13 +0100)
The maximum bytes per interval for USB SuperSpeed Plus can be set by
isoc endpoint companion descriptor when it is above 48K. If the
descriptor is provided, then use its value.

USB 3.1 spec 9.6.8

Acked-by: Felipe Balbi <felipe.balbi@linux.intel.com>
Signed-off-by: Thinh Nguyen <thinhn@synopsys.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/urb.c

index 796c9b1..f51750b 100644 (file)
@@ -433,6 +433,14 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
                        max *= mult;
                }
 
+               if (dev->speed == USB_SPEED_SUPER_PLUS &&
+                   USB_SS_SSP_ISOC_COMP(ep->ss_ep_comp.bmAttributes)) {
+                       struct usb_ssp_isoc_ep_comp_descriptor *isoc_ep_comp;
+
+                       isoc_ep_comp = &ep->ssp_isoc_ep_comp;
+                       max = le32_to_cpu(isoc_ep_comp->dwBytesPerInterval);
+               }
+
                /* "high bandwidth" mode, 1-3 packets/uframe? */
                if (dev->speed == USB_SPEED_HIGH)
                        max *= usb_endpoint_maxp_mult(&ep->desc);