提交 65b8e5cb 编写于 作者: A Alan Stern 提交者: 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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 61af9c3f
...@@ -1331,34 +1331,36 @@ sitd_slot_ok ( ...@@ -1331,34 +1331,36 @@ sitd_slot_ok (
if (mask & ~0xffff) if (mask & ~0xffff)
return 0; return 0;
/* check bandwidth */
uframe %= period_uframes;
frame = uframe >> 3;
#ifdef CONFIG_USB_EHCI_TT_NEWSCHED
/* The tt's fullspeed bus bandwidth must be available.
* tt_available scheduling guarantees 10+% for control/bulk.
*/
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,
stream->udev, frame, mask))
return 0;
#endif
/* this multi-pass logic is simple, but performance may /* this multi-pass logic is simple, but performance may
* suffer when the schedule data isn't cached. * suffer when the schedule data isn't cached.
*/ */
/* check bandwidth */
uframe %= period_uframes;
do { do {
u32 max_used; u32 max_used;
frame = uframe >> 3; frame = uframe >> 3;
uf = uframe & 7; 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,
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,
stream->udev, frame, mask))
return 0;
#endif
/* check starts (OUT uses more than one) */ /* check starts (OUT uses more than one) */
max_used = ehci->uframe_periodic_max - stream->usecs; max_used = ehci->uframe_periodic_max - stream->usecs;
for (tmp = stream->raw_mask & 0xff; tmp; tmp >>= 1, uf++) { for (tmp = stream->raw_mask & 0xff; tmp; tmp >>= 1, uf++) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册