usbfs: Increase arbitrary limit for USB 3 isopkt length
PATCH 1/1 usbfs: Increase arbitrary limit for USB 3 isopkt length
Increase the current arbitrary limit for isocronous packet size to a value large enough to account for USB 3.0 super bandwidth streams, bMaxBurst (0~15 allowed, 1~16 packets)
bmAttributes (bit 1:0, mult 0~2, 1~3 packets)
so the size max for one USB 3 isocronous transfer is
1024 byte * 16 * 3 = 49152 byte
--- drivers/usb/core/devio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/usb/core/devio.c +5 -3
@@ -1287,9 +1287,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, goto error; }for (totlen = u =0 ; u < uurb->number_of_packets; u++) { -/* arbitrary limit, -* sufficient for USB 2.0 high-bandwidth iso */ -if (isopkt[u].length >8192 ) { +/* arbitrary limit need for USB 3.0 +* bMaxBurst (0~15 allowed, 1~16 packets) +* bmAttributes (bit 1:0, mult 0~2, 1~3 packets) +* sizemax: 1024 * 16 * 3 = 49152*/ +if (isopkt[u].length >65536 ) { ret = -EINVAL ; goto error; }
Signature · 1 line
1.7.10.4
Quoted 8 lines · Federico Manzan
Increase the current arbitrary limit for isocronous packet size to a value large enough to account for USB 3.0 super bandwidth streams, bMaxBurst (0~15 allowed, 1~16 packets)
bmAttributes (bit 1:0, mult 0~2, 1~3 packets)
so the size max for one USB 3 isocronous transfer is
1024 byte * 16 * 3 = 49152 byteSigned-off-by Federico Manzan <[email protected]>
So you decided to take matters into your own hands. Good for you!
Quoted 9 lines
drivers/usb/core/devio.c +0
-1@@ -1287,9 +1287,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, goto error; }for (totlen = u =0 ; u < uurb->number_of_packets; u++) { -/* arbitrary limit,
drivers/usb/core/devio.c static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, · line 1297
Quoted 10 lines
drivers/usb/core/devio.c +5
-2-* sufficient for USB 2.0 high-bandwidth iso */ -if (isopkt[u].length >8192 ) { +/* arbitrary limit need for USB 3.0 +* bMaxBurst (0~15 allowed, 1~16 packets) +* bmAttributes (bit 1:0, mult 0~2, 1~3 packets) +* sizemax: 1024 * 16 * 3 = 49152*/ +if (isopkt[u].length >65536 ) { ret = -EINVAL ; goto error; }
A couple of suggestions for improvements:
First, new or updated multi-line comments should follow the accepted formatting standard:
/* * Start comment here... * and end here. */
Second, it's confusing for the comment to mention that the limit is 49152 and the code to set the limit to 65536. They should agree on a single value (probably 49152).
If you make those two changes, you can add
Alan Stern
Quoted 21 lines · Alan Stern
Quoted 9 lines
drivers/usb/core/devio.c +0
-1@@ -1287,9 +1287,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, goto error; }for (totlen = u =0 ; u< uurb->number_of_packets; u++) { -/* arbitrary limit, drivers/usb/core/devio.c static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, · line 1297
Quoted 10 lines
drivers/usb/core/devio.c +5
-2-* sufficient for USB 2.0 high-bandwidth iso */ -if (isopkt[u].length>8192 ) { +/* arbitrary limit need for USB 3.0 +* bMaxBurst (0~15 allowed, 1~16 packets) +* bmAttributes (bit 1:0, mult 0~2, 1~3 packets) +* sizemax: 1024 * 16 * 3 = 49152*/ +if (isopkt[u].length>65536 ) { ret = -EINVAL ; goto error; }A couple of suggestions for improvements:
Quoted 7 lines
First, new or updated multi-line comments should follow the accepted formatting standard:
/* * Start comment here... * and end here. */
ok, I change the comment in the suggested way
Quoted 4 lines
Second, it's confusing for the comment to mention that the limit is 49152 and the code to set the limit to 65536. They should agree on a single value (probably 49152).
In the USB 2 isochronous the limit is 1024 byte x 3 pkts = 3072, but in the code is write 8192. I don't understand why, for the memory page size? for have a tolerant limits? for rounding to a nice number? So I wrote a limit some more big and round, but I agree with you the best way is write the correct limit, so I modify in this way, soon.
Federico Manzan
Hello.
Quoted 17 lines · Federico Manzan
Increase the current arbitrary limit for isocronous packet size to a value large enough to account for USB 3.0 super bandwidth streams, bMaxBurst (0~15 allowed, 1~16 packets)
bmAttributes (bit 1:0, mult 0~2, 1~3 packets)
so the size max for one USB 3 isocronous transfer is
1024 byte * 16 * 3 = 49152 byteSigned-off-by Federico Manzan <[email protected]>--- drivers/usb/core/devio.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)drivers/usb/core/devio.c +0
-0
drivers/usb/core/devio.c static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, · line 1293
Quoted 10 lines
drivers/usb/core/devio.c +4
-3@@ -1287,9 +1287,11 @@ static int proc_do_submiturb(struct dev_state *ps, struct usbdevfs_urb *uurb, goto error; }for (totlen = u =0 ; u < uurb->number_of_packets; u++) { -/* arbitrary limit, -* sufficient for USB 2.0 high-bandwidth iso */ -if (isopkt[u].length >8192 ) { +/* arbitrary limit need for USB 3.0 +* bMaxBurst (0~15 allowed, 1~16 packets) +* bmAttributes (bit 1:0, mult 0~2, 1~3 packets) +* sizemax: 1024 * 16 * 3 = 49152*/
The preferred style of the multi-line comments is this:
/*
* bla
* bla
*/
WBR, Sergei