On Thu, 22 Jul 2004, Oliver Neukum wrote:

>  
> > Here's another possibility.  For each usb_device we include a
> > pre-allocated URB, together with a usb_ctrlrequest and a 64-byte buffer.  
> > This URB could be used while holding the device lock, for things like
> > get_descriptor, suspend, or reset.
> 
> Good idea.
> 
> > > An URB with its buffer preallocated is bound to a device, respectively
> > > an endpoint, so it cannot complete without triggering the same irq the
> > > completion handler is running in.
> > 
> > Ah yes.  Although I would prefer to make each URB & buffer bound to a 
> > HC/bus, not to a device or endpoint -- but that doesn't affect your point.
> 
> Why? Drivers cannot share URBs among interfaces, unless you export
> the concept of busses, which would violate layering.
> Furthermore to a driver the interface is the natural unit of operation.
> And the more specific an URB is the less usb_submit_urb() has to do.

The reason is simple enough; it's connected with the per-device URB 
mentioned above.  When used for get_descriptor or related requests it must 
be sent to the device's ep0.  But when used for suspend, resume, or reset 
it must be sent to the parent hub's ep0.

> > This would allow us to replace an atomic_t with an unsigned long and use 
> > bit-operations rather than atomic_inc/atomic_dec.  It would improve 
> > performance on the Sparc platform and wouldn't make much difference 
> > anywhere else.
> 
> Indeed one bit would be enough.

No it wouldn't.  The minimum is two bits, since we need to be able to 
distinguish three separate states:

        (1) Idle;

        (2) In progress or in completion handler (no need to keep those 
                two substates separate);

        (3) Resubmitted with completion handler still running.

The difference between (2) and (3) is that when the completion handler 
returns, (2) moves to (1) whereas (3) moves to (2).

Alan Stern




-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to