.. | .. |
---|
182 | 182 | case USB_ENDPOINT_XFER_ISOC: |
---|
183 | 183 | if (dev->info->iso) |
---|
184 | 184 | endpoint_update(edi, &iso_in, &iso_out, e); |
---|
185 | | - /* FALLTHROUGH */ |
---|
| 185 | + fallthrough; |
---|
186 | 186 | default: |
---|
187 | 187 | continue; |
---|
188 | 188 | } |
---|
.. | .. |
---|
347 | 347 | return le16_to_cpup(&ep->desc.wMaxPacketSize); |
---|
348 | 348 | } |
---|
349 | 349 | |
---|
| 350 | +static int ss_isoc_get_packet_num(struct usb_device *udev, int pipe) |
---|
| 351 | +{ |
---|
| 352 | + struct usb_host_endpoint *ep = usb_pipe_endpoint(udev, pipe); |
---|
| 353 | + |
---|
| 354 | + return USB_SS_MULT(ep->ss_ep_comp.bmAttributes) |
---|
| 355 | + * (1 + ep->ss_ep_comp.bMaxBurst); |
---|
| 356 | +} |
---|
| 357 | + |
---|
350 | 358 | static void simple_fill_buf(struct urb *urb) |
---|
351 | 359 | { |
---|
352 | 360 | unsigned i; |
---|
.. | .. |
---|
356 | 364 | |
---|
357 | 365 | switch (pattern) { |
---|
358 | 366 | default: |
---|
359 | | - /* FALLTHROUGH */ |
---|
| 367 | + fallthrough; |
---|
360 | 368 | case 0: |
---|
361 | 369 | memset(buf, 0, len); |
---|
362 | 370 | break; |
---|
.. | .. |
---|
673 | 681 | return dev->buf[0]; |
---|
674 | 682 | case 0: |
---|
675 | 683 | retval = -ERANGE; |
---|
676 | | - /* FALLTHROUGH */ |
---|
| 684 | + fallthrough; |
---|
677 | 685 | default: |
---|
678 | 686 | return retval; |
---|
679 | 687 | } |
---|
.. | .. |
---|
1943 | 1951 | dev_err(&ctx->dev->intf->dev, |
---|
1944 | 1952 | "resubmit err %d\n", |
---|
1945 | 1953 | status); |
---|
1946 | | - /* FALLTHROUGH */ |
---|
| 1954 | + fallthrough; |
---|
1947 | 1955 | case -ENODEV: /* disconnected */ |
---|
1948 | 1956 | case -ESHUTDOWN: /* endpoint disabled */ |
---|
1949 | 1957 | ctx->submit_error = 1; |
---|
.. | .. |
---|
1976 | 1984 | |
---|
1977 | 1985 | if (bytes < 0 || !desc) |
---|
1978 | 1986 | return NULL; |
---|
| 1987 | + |
---|
1979 | 1988 | maxp = usb_endpoint_maxp(desc); |
---|
1980 | | - maxp *= usb_endpoint_maxp_mult(desc); |
---|
| 1989 | + if (udev->speed >= USB_SPEED_SUPER) |
---|
| 1990 | + maxp *= ss_isoc_get_packet_num(udev, pipe); |
---|
| 1991 | + else |
---|
| 1992 | + maxp *= usb_endpoint_maxp_mult(desc); |
---|
| 1993 | + |
---|
1981 | 1994 | packets = DIV_ROUND_UP(bytes, maxp); |
---|
1982 | 1995 | |
---|
1983 | 1996 | urb = usb_alloc_urb(packets, GFP_KERNEL); |
---|
.. | .. |
---|
2030 | 2043 | unsigned i; |
---|
2031 | 2044 | unsigned long packets = 0; |
---|
2032 | 2045 | int status = 0; |
---|
2033 | | - struct urb *urbs[MAX_SGLEN]; |
---|
| 2046 | + struct urb **urbs; |
---|
2034 | 2047 | |
---|
2035 | 2048 | if (!param->sglen || param->iterations > UINT_MAX / param->sglen) |
---|
2036 | 2049 | return -EINVAL; |
---|
2037 | 2050 | |
---|
2038 | 2051 | if (param->sglen > MAX_SGLEN) |
---|
2039 | 2052 | return -EINVAL; |
---|
| 2053 | + |
---|
| 2054 | + urbs = kcalloc(param->sglen, sizeof(*urbs), GFP_KERNEL); |
---|
| 2055 | + if (!urbs) |
---|
| 2056 | + return -ENOMEM; |
---|
2040 | 2057 | |
---|
2041 | 2058 | memset(&context, 0, sizeof(context)); |
---|
2042 | 2059 | context.count = param->iterations * param->sglen; |
---|
.. | .. |
---|
2065 | 2082 | packets *= param->iterations; |
---|
2066 | 2083 | |
---|
2067 | 2084 | if (context.is_iso) { |
---|
| 2085 | + int transaction_num; |
---|
| 2086 | + |
---|
| 2087 | + if (udev->speed >= USB_SPEED_SUPER) |
---|
| 2088 | + transaction_num = ss_isoc_get_packet_num(udev, pipe); |
---|
| 2089 | + else |
---|
| 2090 | + transaction_num = usb_endpoint_maxp_mult(desc); |
---|
| 2091 | + |
---|
2068 | 2092 | dev_info(&dev->intf->dev, |
---|
2069 | 2093 | "iso period %d %sframes, wMaxPacket %d, transactions: %d\n", |
---|
2070 | 2094 | 1 << (desc->bInterval - 1), |
---|
2071 | | - (udev->speed == USB_SPEED_HIGH) ? "micro" : "", |
---|
| 2095 | + (udev->speed >= USB_SPEED_HIGH) ? "micro" : "", |
---|
2072 | 2096 | usb_endpoint_maxp(desc), |
---|
2073 | | - usb_endpoint_maxp_mult(desc)); |
---|
| 2097 | + transaction_num); |
---|
2074 | 2098 | |
---|
2075 | 2099 | dev_info(&dev->intf->dev, |
---|
2076 | 2100 | "total %lu msec (%lu packets)\n", |
---|
2077 | 2101 | (packets * (1 << (desc->bInterval - 1))) |
---|
2078 | | - / ((udev->speed == USB_SPEED_HIGH) ? 8 : 1), |
---|
| 2102 | + / ((udev->speed >= USB_SPEED_HIGH) ? 8 : 1), |
---|
2079 | 2103 | packets); |
---|
2080 | 2104 | } |
---|
2081 | 2105 | |
---|
.. | .. |
---|
2117 | 2141 | else if (context.errors > |
---|
2118 | 2142 | (context.is_iso ? context.packet_count / 10 : 0)) |
---|
2119 | 2143 | status = -EIO; |
---|
| 2144 | + |
---|
| 2145 | + kfree(urbs); |
---|
2120 | 2146 | return status; |
---|
2121 | 2147 | |
---|
2122 | 2148 | fail: |
---|
.. | .. |
---|
2124 | 2150 | if (urbs[i]) |
---|
2125 | 2151 | simple_free_urb(urbs[i]); |
---|
2126 | 2152 | } |
---|
| 2153 | + |
---|
| 2154 | + kfree(urbs); |
---|
2127 | 2155 | return status; |
---|
2128 | 2156 | } |
---|
2129 | 2157 | |
---|