Re: [PATCH 4/4] OHCI: implement new semantics for URB_ISO_ASAP

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

 



Hello.

On 01-10-2012 16:32, Alan Stern wrote:

This patch (as1614) updates the isochronous scheduling in ohci-hcd to
match the new semantics for URB_ISO_ASAP.  Testing revealed a hardware
bug in the way my OHCI controller handles expired isochronous TDs;
consequently the patch tries hard to avoid creating them (unlike the
ehci-hcd and uhci-hcd drivers).

Signed-off-by: Alan Stern<stern@xxxxxxxxxxxxxxxxxxx>

---

  drivers/usb/host/ohci-hcd.c |   36 ++++++++++++++++++++++++++++++++----
  drivers/usb/host/ohci-q.c   |    4 ++--
  2 files changed, 34 insertions(+), 6 deletions(-)

Index: usb-3.6/drivers/usb/host/ohci-hcd.c
===================================================================
--- usb-3.6.orig/drivers/usb/host/ohci-hcd.c
+++ usb-3.6/drivers/usb/host/ohci-hcd.c
@@ -231,13 +231,41 @@ static int ohci_urb_enqueue (
  			frame&= ~(ed->interval - 1);
  			frame |= ed->branch;
  			urb->start_frame = frame;
+		}
+	} else if (ed->type == PIPE_ISOCHRONOUS) {
+		u16	next = ohci_frame_no(ohci) + 2;
+		u16	frame = ed->last_iso + ed->interval;
+
+		/* Behind the scheduling threshold? */
+		if (unlikely(tick_before(frame, next))) {
+
+			/* USB_ISO_ASAP: Round up to the first available slot */
+			if (urb->transfer_flags&  URB_ISO_ASAP)
+				frame += (next - frame + ed->interval - 1)&
+						-ed->interval;
+
+			/*
+			 * Not ASAP: Use the next slot in the stream.  If
+			 * the entire URB falls before the threshold, fail.
+			 */
+			else if (tick_before(frame + ed->interval *
+					(urb->number_of_packets - 1), next)) {

   Erm, both arms of *if* should have {}, according to CodingStyle...

+				retval = -EXDEV;
+				usb_hcd_unlink_urb_from_ep(hcd, urb);
+				goto fail;
+			}


WBR, Sergei

--
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