diff options
author | Alan Stern <stern@rowland.harvard.edu> | 2008-09-25 16:59:57 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-10-17 17:41:01 -0400 |
commit | e58dcebcd83b5902411e747ee7807219dee6bcf2 (patch) | |
tree | 2d37312f1514ad992698f642a8e567c1ffc9c359 /drivers/usb | |
parent | 925dff5dee04fb46d2e67c088c54b331f97672ee (diff) |
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>
Diffstat (limited to 'drivers/usb')
-rw-r--r-- | 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 1f0c2cf26e5d..5631d89c8730 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, | |||
1065 | } | 1065 | } |
1066 | if (exponent < 0) | 1066 | if (exponent < 0) |
1067 | return -EINVAL; | 1067 | return -EINVAL; |
1068 | qh->period = 1 << exponent; | ||
1069 | qh->skel = SKEL_INDEX(exponent); | ||
1070 | 1068 | ||
1071 | /* For now, interrupt phase is fixed by the layout | 1069 | /* If the slot is full, try a lower period */ |
1072 | * of the QH lists. */ | 1070 | do { |
1073 | qh->phase = (qh->period / 2) & (MAX_PHASE - 1); | 1071 | qh->period = 1 << exponent; |
1074 | ret = uhci_check_bandwidth(uhci, qh); | 1072 | qh->skel = SKEL_INDEX(exponent); |
1073 | |||
1074 | /* For now, interrupt phase is fixed by the layout | ||
1075 | * of the QH lists. | ||
1076 | */ | ||
1077 | qh->phase = (qh->period / 2) & (MAX_PHASE - 1); | ||
1078 | ret = uhci_check_bandwidth(uhci, qh); | ||
1079 | } while (ret != 0 && --exponent >= 0); | ||
1075 | if (ret) | 1080 | if (ret) |
1076 | return ret; | 1081 | return ret; |
1077 | } else if (qh->period > urb->interval) | 1082 | } else if (qh->period > urb->interval) |