[patch 2.6.29] usb: ehci-sched.c: EHCI SITD scheduling bugfix

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, Mar 27, 2009 at 5:02 AM, Kung James <kong1191@xxxxxxxxx> wrote:
> Hi, Dan
>
> I have a question about the "tt_available()" function in
> drivers/usb/host/ehci-sched.c
...

It's been a while since I was into the EHCI code, but I think that you are 
right, that looks like a bug there.  You can see that my first draft of the 
patch didn't include the - 1
http://marc.info/?l=linux-usb-devel&m=112319318001393&w=2
but then my second (and final) draft had it added.  I don't remember why.
http://marc.info/?l=linux-usb-devel&m=113510731024887&w=2

David, does removing the - 1 look right to you also?  The -1 appears to be a bug 
that prevents checking the last fully used uframe for a split isoc transfer.

Signed-off-by: Dan Streetman <ddstreet@xxxxxxxx>


--- linux-2.6.29/drivers/usb/host/ehci-sched.c	2009-03-23 19:12:14.000000000 -0400
+++ b/drivers/usb/host/ehci-sched.c	2009-03-27 17:11:07.000000000 -0400
@@ -323,7 +323,7 @@ static int tt_available (
 		 * already scheduled transactions
 		 */
 		if (125 < usecs) {
-			int ufs = (usecs / 125) - 1;
+			int ufs = (usecs / 125);
 			int i;
 			for (i = uframe; i < (uframe + ufs) && i < 8; i++)
 				if (0 < tt_usecs[i]) {




> The following source code is part of "tt_available()" function.
>
> [kernel 2.6.29]
> ============================================
> 320    /* special case for isoc transfers larger than 125us:
> 321     * the first and each subsequent fully used uframe
> 322     * must be empty, so as to not illegally delay
> 323     * already scheduled transactions
> 324     */
> 325    if (125 < usecs) {
> 326       int ufs = (usecs / 125) - 1;
> 327       int i;
> 328       for (i = uframe; i < (uframe + ufs) && i < 8; i++)
> 329          if (0 < tt_usecs[i]) {
> 330              ehci_vdbg(ehci,
> 331                      "multi-uframe xfer can't fit "
> 332                      "in frame %d uframe %d\n",
> 333                      frame, i);
> 334              return 0;
> 335          }
> 336    }
> ============================================
>
> My question is described as follow:
>
> I have an full-speed USB audio device connected on a USB HUB.
> When I play music via the USB audio device, the SITD of the
> isoc. out endpoint will be scheduled via EHCI HCD driver.  The
> max. packet size of the isoc. out endpoint is 200 bytes. So
> the bus transaction time (tt_usecs) is equal to 165 us.
>
> The 165 us contains a fully used uframe, so the for loop need to be
> executed one time theoretically. But the for loop does not to be
> executed, because the value of 'ufs' is zero. Why the value of 'ufs'
> need to "minus one" ?
>
>
> Best Regard,
> James Kung
>


--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux