EHCI: improved logic for isochronous scheduling
This patch (as1608) reworks the logic used by ehci-hcd for scheduling
isochronous transfers. Now the modular calculations are all based on
a window that starts at the last frame scanned for isochronous
completions. No transfer descriptors for any earlier frames can
possibly remain on the schedule, so there can be no confusion from
schedule wrap-around. This removes the need for a "slop" region of
arbitrary size.
There's no need to check for URBs that are longer than the schedule
length. With the old code they could throw things off by wrapping
around and appearing to end in the near future rather than the distant
future. Now such confusion isn't possible, and the existing test for
submissions that extend too far into the future will also catch those
that exceed the schedule length. (But there still has to be an
initial test to handle the case where the schedule already extends as
far into the future as possible.)
Delays caused by IRQ latency won't confuse the algorithm unless they
are ridiculously long (over 250 ms); they will merely reduce how far
into the future new transfers can be scheduled. A few people have
reported problems caused by delays of 50 ms or so. Now instead of
failing completely, isochronous transfers will experience a brief
glitch and then continue normally.
(Whether this is truly a good thing is debatable. A latency as large
as 50 ms generally indicates a bug is present, and complete failure of
audio or video transfers draws people's attention pretty vividly.
Making the transfers more robust also makes it easier for such bugs to
remain undetected.)
Finally, ehci->next_frame is renamed to ehci->last_iso_frame, because
that better describes what it is: the last frame to have been scanned
for isochronous completions.
Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2 files changed