Re: [PATCH/RFC 5/5] usb: Add support for streams alloc/dealloc to devio.c

Hans Petter Selasky
2011-08-17T07:13:36Z

On Wednesday 27 July 2011 08:21:35 Amit Blay wrote:
> Hi Sarah,
>
> A gentle reminder, can you please take a look at the proposed solution
> below for stream alloc/dealloc in devio.c? I responded to your comments
> about the original patch.

Hi,

I'm looking into implementing USB 3.0 streams support for FreeBSD and would
like to have a solution in Linux which is not too far apart, also regarding
API's for userspace.

I would suggest overloading the "unsigned int pipe", instead of breaking
existing API's by adding a new stream ID value. Also for LibUSB.

./linux/usb.h: unsigned int pipe; /* (in) pipe information */

As per definition there are 15 bits available for "pipe". I think it is not
important to support more than 255 streams in the first go, hence I see no
real applications that would benefit from that many streams yet.

#define usb_pipeendpoint(pipe) (((pipe) >> 15) & 0xf)

Then I suggest a new function/IOCTL in libusb which can be used to switch
on/off streams on a given endpoint. This is something which would need to be
done before submitting any URB's on that endpoint. And would be similar to the
clear-stall case.

If an URB is submitted on a stream when streams are disabled then it should
just fail and vice versa.

--HPS