Alan Stern wrote:
On Tue, 22 Jul 2003, David Brownell wrote:


I'd put it the other way around, if I understand you correctly.

As in:  The UHCI code is so optimistic that it doesn't handle
queue faults correctly, by stopping queue processing.

The USB spec requires that on certain faults the queue gets
scrubbed.  It doesn't say what component does that.  It turned
out to be rather messy to have each HCD do that ... but regardless
of what component scrubs out queues after faults, if the queue
is "live" and advancing, it can't be cleaned out correctly.  So
the HCD clearly must stop the queue after faults.


That sounds like a worthwhile change.


If the queue stops on all faults, and the HCD makes sure the
device (interface) driver has a chance to clean things up
before that queue is re-activated, there should be no problems.


How do you know when the driver has had a chance to clean up? Assume that everything is okay once giveback_urb() returns?

Yes ... the urb completion callback cleans up.



Also, how come both usb_operations and hc_driver have an
endpoint_disable() entry point but not an endpoint_enable()? It seems to
me that if the HCD is tracking the state of each endpoint that both
operations are needed. Or do you simply intend endpoint_disable() to tell the HCD to stop tracking that particular endpoint and dequeue any pending URBs?

Since about the very earliest USB code, the HCDs have had some automagic to enable endpoints when urbs get submitted to them ... trusting the endpoint data stored in the URB, although arguably it should use actual endpoint descriptor (unless intervals for periodic endpoints need tweaking).

We have the endpoint disable logic since otherwise there was
no way to reverse the automagic.


Oh yes, I was wondering about this last night:  How should an HC that has
died be handled?  Clearly all its URBs need to be returned with an error
code like -ESHUTDOWN.  But the UHCI driver's dequeueing code is
interrupt-driven, and those interrupts won't arrive if the HC is stopped.

Which is a problem. What OHCI does is to have an alternative for the dequeue logic in the case that the HC has halted: it just cleans up the data structure without hardware synch. And the EHCI code does the same.

Doing that cleaned up a bunch of problems with OHCI.  The
obvious one was the (rare) controller halt.  But having
that infrastructure in place is what now lets us clean up
properly on device disconnect and config change events;
and the relevant cleanup also got rid of some mem leaks
on D3cold system PM resume scenarios.

Many of those things really didn't work well on 2.4, for
any HC.


Does the driver need additional code to handle this situation? Bear in mind that even if the HC is merely suspended, unlinking URBs won't work.

Yes, additional code; shouldn't be much. I'm not sure it should be possible to suspend the HC if an urb is pending; does that really make sense?

- Dave



Alan Stern







-------------------------------------------------------
This SF.net email is sponsored by: VM Ware
With VMware you can run multiple operating systems on a single machine.
WITHOUT REBOOTING! Mix Linux / Windows / Novell virtual machines at the
same time. Free trial click here: http://www.vmware.com/wl/offer/345/0
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel

Reply via email to