linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length
@ 2013-05-24  8:47 Federico Manzan
  2013-05-24 13:51 ` Alan Stern
  2013-05-24 14:46 ` Sergei Shtylyov
  0 siblings, 2 replies; 4+ messages in thread
From: Federico Manzan @ 2013-05-24  8:47 UTC (permalink / raw)
  To: gregkh; +Cc: sarah.a.sharp, stern, linux-usb, linux-kernel, 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 byte

Signed-off-by: Federico Manzan <f.manzan@gmail.com>
---
 drivers/usb/core/devio.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
index caefc80..7ac137e 100644
--- a/drivers/usb/core/devio.c
+++ b/drivers/usb/core/devio.c
@@ -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;
 			}
-- 
1.7.10.4


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length
  2013-05-24  8:47 [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length Federico Manzan
@ 2013-05-24 13:51 ` Alan Stern
  2013-05-24 15:36   ` Federico Manzan
  2013-05-24 14:46 ` Sergei Shtylyov
  1 sibling, 1 reply; 4+ messages in thread
From: Alan Stern @ 2013-05-24 13:51 UTC (permalink / raw)
  To: Federico Manzan; +Cc: gregkh, sarah.a.sharp, linux-usb, linux-kernel

On Fri, 24 May 2013, Federico Manzan wrote:

> 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
> 
> Signed-off-by: Federico Manzan <f.manzan@gmail.com>

So you decided to take matters into your own hands.  Good for you!

> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index caefc80..7ac137e 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -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;
>  			}

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

Acked-by: Alan Stern <stern@rowland.harvard.edu>

Alan Stern


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length
  2013-05-24  8:47 [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length Federico Manzan
  2013-05-24 13:51 ` Alan Stern
@ 2013-05-24 14:46 ` Sergei Shtylyov
  1 sibling, 0 replies; 4+ messages in thread
From: Sergei Shtylyov @ 2013-05-24 14:46 UTC (permalink / raw)
  To: Federico Manzan; +Cc: gregkh, sarah.a.sharp, stern, linux-usb, linux-kernel

Hello.

On 24-05-2013 12:47, Federico Manzan wrote:

> 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

> Signed-off-by: Federico Manzan <f.manzan@gmail.com>
> ---
>   drivers/usb/core/devio.c |    8 +++++---
>   1 file changed, 5 insertions(+), 3 deletions(-)

> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
> index caefc80..7ac137e 100644
> --- a/drivers/usb/core/devio.c
> +++ b/drivers/usb/core/devio.c
> @@ -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


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length
  2013-05-24 13:51 ` Alan Stern
@ 2013-05-24 15:36   ` Federico Manzan
  0 siblings, 0 replies; 4+ messages in thread
From: Federico Manzan @ 2013-05-24 15:36 UTC (permalink / raw)
  To: Alan Stern; +Cc: gregkh, sarah.a.sharp, linux-usb, linux-kernel

On 05/24/2013 03:51 PM, Alan Stern wrote:
>> diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c
>> index caefc80..7ac137e 100644
>> --- a/drivers/usb/core/devio.c
>> +++ b/drivers/usb/core/devio.c
>> @@ -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;
>>   			}
> 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.
> 	 */
ok, I change the comment in the suggested way
> 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


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-05-24 15:35 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-05-24  8:47 [PATCH] usbfs: Increase arbitrary limit for USB 3 isopkt length Federico Manzan
2013-05-24 13:51 ` Alan Stern
2013-05-24 15:36   ` Federico Manzan
2013-05-24 14:46 ` Sergei Shtylyov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).