On Tue, 22 Jul 2003, David Brownell wrote:
The setting of SPD is not directly related to the URB_SHORT_NOT_OK flag. All that flag means is that a short read transfer should return with status -EREMOTEIO rather than status 0. This is already tested for
Basically right -- there's also an effect on queueing behavior.
In particular, since "real faults" should stop the queue (so that drivers can clean up), I think that URB_SHORT_NOT_OK puts short reads into the category of "real faults" rather than the "expected behavior" category.
I recall that EHCI and OHCI do block queue advances after a SHORT_NOT_OK short read, but continue it for other IN endpoints ... but of course, UHCI transfers so little data with each TD that it might not be able to do that so well.
The big difference is that the UHCI driver isn't truly endpoint-oriented.
True -- though it could be simpler if it were, since USB itself is endpoint-oriented.
Also it never really stops a queue from advancing, regardless of the type of error. That is, the queue blocks only until the offending URB is dequeued, and then it is allowed to proceed.
This is potentially troublesome ... and isn't what the other HCDs do.
If a driver wants to submit several URBs, but the values of the later ones
will depend on the result of the first, then the URBs must not be queued. They should be submitted one-at-a-time. Unfortunately, this prohibits the
benefits of optimistic queueing ("Success is the most probable result, so
assume it will work"). Maybe that behavior should be changed.
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.
and handled properly in uhci_result_control() and uhci_result_common(). The flag doesn't mean that SPD should or should not be set.
Taken together, these arguments show that SPD should always be set for every queued (i.e., not isochronous) input TD that's not the last one in its URB.
Why the "not the last" exception?
The last TD always has its IOC (Interrupt On Completion) bit set, so an interrupt request would be generated in any case. However, if the queue should also be blocked from advancing, then SPD should be set for those TDs as well. The lack of proper specification in the Design Guide also argues for that course.
I'll let you figure out those details ... :)
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.
A short read, when SHORT_NOT_OK is clear (the default), won't ever need that cleanup ... and it'll be faster not to stop the queue in such cases. But stopping the queue would only be a slowdown, not a correctness issue.
- 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
