提交 e58dcebc 编写于 作者: A Alan Stern 提交者: Greg Kroah-Hartman

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: NAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: NGreg Kroah-Hartman <gregkh@suse.de>
上级 925dff5d
...@@ -1065,13 +1065,18 @@ static int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb, ...@@ -1065,13 +1065,18 @@ static int uhci_submit_interrupt(struct uhci_hcd *uhci, struct urb *urb,
} }
if (exponent < 0) if (exponent < 0)
return -EINVAL; return -EINVAL;
/* If the slot is full, try a lower period */
do {
qh->period = 1 << exponent; qh->period = 1 << exponent;
qh->skel = SKEL_INDEX(exponent); qh->skel = SKEL_INDEX(exponent);
/* For now, interrupt phase is fixed by the layout /* For now, interrupt phase is fixed by the layout
* of the QH lists. */ * of the QH lists.
*/
qh->phase = (qh->period / 2) & (MAX_PHASE - 1); qh->phase = (qh->period / 2) & (MAX_PHASE - 1);
ret = uhci_check_bandwidth(uhci, qh); ret = uhci_check_bandwidth(uhci, qh);
} while (ret != 0 && --exponent >= 0);
if (ret) if (ret)
return ret; return ret;
} else if (qh->period > urb->interval) } else if (qh->period > urb->interval)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册