aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/ehci-sched.c
diff options
context:
space:
mode:
authorThomas Poussevin <thomas.poussevin@parrot.com>2011-10-27 12:46:48 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-11-14 16:47:48 -0500
commit811c926c538f7e8d3c08b630dd5844efd7e000f6 (patch)
tree97ee9d1bc674ce1d24acb8e7d2518da0b1cc2cc1 /drivers/usb/host/ehci-sched.c
parentf69e3120df82391a0ee8118e0a156239a06b2afb (diff)
USB: EHCI: fix HUB TT scheduling issue with iso transfer
The current TT scheduling doesn't allow to play and then record on a full-speed device connected to a high speed hub. The IN iso stream can only start on the first uframe (0-2 for a 165 us) because of CSPLIT transactions. For the OUT iso stream there no such restriction. uframe 0-5 are possible. The idea of this patch is that the first uframe are precious (for IN TT iso stream) and we should allocate the last uframes first if possible. For that we reverse the order of uframe allocation (last uframe first). Here an example : hid interrupt stream ---------------------------------------------------------------------- uframe | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ---------------------------------------------------------------------- max_tt_usecs | 125 | 125 | 125 | 125 | 125 | 125 | 30 | 0 | ---------------------------------------------------------------------- used usecs on a frame | 13 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | ---------------------------------------------------------------------- iso OUT stream ---------------------------------------------------------------------- uframe | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ---------------------------------------------------------------------- max_tt_usecs | 125 | 125 | 125 | 125 | 125 | 125 | 30 | 0 | ---------------------------------------------------------------------- used usecs on a frame | 13 | 125 | 39 | 0 | 0 | 0 | 0 | 0 | ---------------------------------------------------------------------- There no place for iso IN stream (uframe 0-2 are used) and we got "cannot submit datapipe for urb 0, error -28: not enough bandwidth" error. With the patch this become. iso OUT stream ---------------------------------------------------------------------- uframe | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ---------------------------------------------------------------------- max_tt_usecs | 125 | 125 | 125 | 125 | 125 | 125 | 30 | 0 | ---------------------------------------------------------------------- used usecs on a frame | 13 | 0 | 0 | 0 | 125 | 39 | 0 | 0 | ---------------------------------------------------------------------- iso IN stream ---------------------------------------------------------------------- uframe | 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | ---------------------------------------------------------------------- max_tt_usecs | 125 | 125 | 125 | 125 | 125 | 125 | 30 | 0 | ---------------------------------------------------------------------- used usecs on a frame | 13 | 0 | 125 | 40 | 125 | 39 | 0 | 0 | ---------------------------------------------------------------------- Signed-off-by: Matthieu Castet <matthieu.castet@parrot.com> Signed-off-by: Thomas Poussevin <thomas.poussevin@parrot.com> Signed-off-by: Alan Stern <stern@rowland.harvard.edu> Cc: stable <stable@vger.kernel.org> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/host/ehci-sched.c')
-rw-r--r--drivers/usb/host/ehci-sched.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/drivers/usb/host/ehci-sched.c b/drivers/usb/host/ehci-sched.c
index 2e829fae6482..56a32033adb3 100644
--- a/drivers/usb/host/ehci-sched.c
+++ b/drivers/usb/host/ehci-sched.c
@@ -1479,10 +1479,15 @@ iso_stream_schedule (
1479 1479
1480 /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */ 1480 /* NOTE: assumes URB_ISO_ASAP, to limit complexity/bugs */
1481 1481
1482 /* find a uframe slot with enough bandwidth */ 1482 /* find a uframe slot with enough bandwidth.
1483 next = start + period; 1483 * Early uframes are more precious because full-speed
1484 for (; start < next; start++) { 1484 * iso IN transfers can't use late uframes,
1485 1485 * and therefore they should be allocated last.
1486 */
1487 next = start;
1488 start += period;
1489 do {
1490 start--;
1486 /* check schedule: enough space? */ 1491 /* check schedule: enough space? */
1487 if (stream->highspeed) { 1492 if (stream->highspeed) {
1488 if (itd_slot_ok(ehci, mod, start, 1493 if (itd_slot_ok(ehci, mod, start,
@@ -1495,7 +1500,7 @@ iso_stream_schedule (
1495 start, sched, period)) 1500 start, sched, period))
1496 break; 1501 break;
1497 } 1502 }
1498 } 1503 } while (start > next);
1499 1504
1500 /* no room in the schedule */ 1505 /* no room in the schedule */
1501 if (start == next) { 1506 if (start == next) {