Commit 65b8e5cb authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: EHCI: improve full-speed isochronous scheduling routine

This patch (as1555) improves the code ehci-hcd uses while checking the
periodic schedule for isochronous transfers to full-speed devices.  In
addition to making sure that a new transfer does not violate the
restrictions on the high-speed schedule, it also has to check the
restrictions on the full-speed part of the bus, i.e., the part beyond
the Transaction Translator (TT).

It does this by calling tt_available() (or tt_no_collision() if
CONFIG_USB_EHCI_TT_NEWSCHED isn't enabled).  However it calls that
routine on each pass through a loop over the frames being modified,
which is an unnecessary expense because tt_available() (or
tt_no_collision) already does its own loop over frames.  It is
sufficient to do the check just once, before starting the loop.

In addition, the function calls incorrectly converted the transfer's
period from microframes to frames by doing a left shift instead of a
right shift.  The patch fixes this while moving the calls.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 61af9c3f
......@@ -1331,34 +1331,36 @@ sitd_slot_ok (
if (mask & ~0xffff)
return 0;
/* this multi-pass logic is simple, but performance may
* suffer when the schedule data isn't cached.
*/
/* check bandwidth */
uframe %= period_uframes;
do {
u32 max_used;
frame = uframe >> 3;
uf = uframe & 7;
#ifdef CONFIG_USB_EHCI_TT_NEWSCHED
/* The tt's fullspeed bus bandwidth must be available.
* tt_available scheduling guarantees 10+% for control/bulk.
*/
if (!tt_available (ehci, period_uframes << 3,
uf = uframe & 7;
if (!tt_available(ehci, period_uframes >> 3,
stream->udev, frame, uf, stream->tt_usecs))
return 0;
#else
/* tt must be idle for start(s), any gap, and csplit.
* assume scheduling slop leaves 10+% for control/bulk.
*/
if (!tt_no_collision (ehci, period_uframes << 3,
if (!tt_no_collision(ehci, period_uframes >> 3,
stream->udev, frame, mask))
return 0;
#endif
/* this multi-pass logic is simple, but performance may
* suffer when the schedule data isn't cached.
*/
do {
u32 max_used;
frame = uframe >> 3;
uf = uframe & 7;
/* check starts (OUT uses more than one) */
max_used = ehci->uframe_periodic_max - stream->usecs;
for (tmp = stream->raw_mask & 0xff; tmp; tmp >>= 1, uf++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment