USB: UHCI: improve scheduling of interrupt URBs

Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]
From: Linux Kernel Mailing List
Date: Friday, October 17, 2008 - 5:05 pm

Gitweb:     http://git.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=e58dce...
Commit:     e58dcebcd83b5902411e747ee7807219dee6bcf2
Parent:     925dff5dee04fb46d2e67c088c54b331f97672ee
Author:     Alan Stern <stern@rowland.harvard.edu>
AuthorDate: Thu Sep 25 16:59:57 2008 -0400
Committer:  Greg Kroah-Hartman <gregkh@suse.de>
CommitDate: Fri Oct 17 14:41:01 2008 -0700

    USB: UHCI: improve scheduling of interrupt URBs
    
    This patch (as1140) adds a little intelligence to the interrupt-URB
    scheduler in uhci-hcd.  Right now the scheduler is stupid; every URB
    having the same period is assigned to the same slot.  Thus a large
    group of period-N URBs can fill their slot and cause -ENOSPC errors
    even when all the lower-period slots are empty.
    
    With the patch, if an URB doesn't fit in its assigned slot then the
    scheduler will try using lower-period slots.  This will provide
    greater flexibility.  As an example, the driver will be able to handle
    more than just three or four mice, which the current driver cannot.
    
    Signed-off-by: Alan Stern <stern@rowland.harvard.edu>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
---
 drivers/usb/host/uhci-q.c |   17 +++++++++++------
 1 files changed, 11 insertions(+), 6 deletions(-)

diff --git a/drivers/usb/host/uhci-q.c b/drivers/usb/host/uhci-q.c
index 1f0c2cf..5631d89 100644
--- a/drivers/usb/host/uhci-q.c
+++ b/drivers/usb/host/uhci-q.c
@@ -1065,13 +1065,18 @@ static int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb,
 		}
 		if (exponent < 0)
 			return -EINVAL;
-		qh->period = 1 << exponent;
-		qh->skel = SKEL_INDEX(exponent);
 
-		/* For now, interrupt phase is fixed by the layout
-		 * of the QH lists. */
-		qh->phase = (qh->period / 2) & (MAX_PHASE - 1);
-		ret = uhci_check_bandwidth(uhci, qh);
+		/* If the slot is full, try a lower period */
+		do {
+			qh->period = 1 << exponent;
+			qh->skel = SKEL_INDEX(exponent);
+
+			/* For now, interrupt phase is fixed by the layout
+			 * of the QH lists.
+			 */
+			qh->phase = (qh->period / 2) & (MAX_PHASE - 1);
+			ret = uhci_check_bandwidth(uhci, qh);
+		} while (ret != 0 && --exponent >= 0);
 		if (ret)
 			return ret;
 	} else if (qh->period > urb->interval)
--
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Previous message: [thread] [date] [author]
Next message: [thread] [date] [author]

Messages in current thread:
USB: UHCI: improve scheduling of interrupt URBs, Linux Kernel Mailing ..., (Fri Oct 17, 5:05 pm)