Commit 68335e81 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

USB: EHCI: stagger frames for interrupt transfers

This patch (as1243) tries to improve ehci-hcd's scheduling of
interrupt transfers.  Instead of trying to cram all transfers with the
same period into the same frame, the new code will spread the
transfers out among lots of different frames.  This should reduce the
periodic schedule load in any one frame -- some host controllers have
trouble when there's too much work to do.

A more thorough approach would stagger the uframe values as well.  But
this is enough to make a big improvement.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Tested-by: default avatarDwayne Fontenot <dwayne.fontenot@att.net>
Cc: David Brownell <david-b@pacbell.net>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent be475d90
...@@ -760,8 +760,10 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -760,8 +760,10 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh)
if (status) { if (status) {
/* "normal" case, uframing flexible except with splits */ /* "normal" case, uframing flexible except with splits */
if (qh->period) { if (qh->period) {
frame = qh->period - 1; int i;
do {
for (i = qh->period; status && i > 0; --i) {
frame = ++ehci->random_frame % qh->period;
for (uframe = 0; uframe < 8; uframe++) { for (uframe = 0; uframe < 8; uframe++) {
status = check_intr_schedule (ehci, status = check_intr_schedule (ehci,
frame, uframe, qh, frame, uframe, qh,
...@@ -769,7 +771,7 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh) ...@@ -769,7 +771,7 @@ static int qh_schedule(struct ehci_hcd *ehci, struct ehci_qh *qh)
if (status == 0) if (status == 0)
break; break;
} }
} while (status && frame--); }
/* qh->period == 0 means every uframe */ /* qh->period == 0 means every uframe */
} else { } else {
......
...@@ -116,6 +116,7 @@ struct ehci_hcd { /* one per controller */ ...@@ -116,6 +116,7 @@ struct ehci_hcd { /* one per controller */
struct timer_list watchdog; struct timer_list watchdog;
unsigned long actions; unsigned long actions;
unsigned stamp; unsigned stamp;
unsigned random_frame;
unsigned long next_statechange; unsigned long next_statechange;
u32 command; u32 command;
......
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