ChangeSet 1.1371.759.20, 2004/04/23 16:39:38-07:00, stern@rowland.harvard.edu

[PATCH] USB: Ignore URB_NO_INTERRUPT flag in UHCI

Following a suggestion of David Brownell's I have decided to remove
support for the URB_NO_INTERRUPT flag in the UHCI driver.  The overall
effect of the flag is to reduce the number of interrupts, thereby
improving throughput somewhat while increasing the duration of the
remaining IRQ handlers quite a lot (i.e., increasing interrupt variance).
So I think we're better off without it.  Mind you, this is all in the
absence of any firm measurements.

A common case where this will come up is during usb-storage bulk
transfers.  Such transfers are generally divided into scatter-gather
components each corresponding to a single URB and transferring one memory
page (4 KB).  While generating an interrupt for each one is a little
faster than ideal -- about every 3 ms -- it's better than waiting until 64
KB has been transferred and there are 1024 individual TDs to clean up
during the IRQ.


 drivers/usb/host/uhci-hcd.c |   10 +++++++---
 1 files changed, 7 insertions(+), 3 deletions(-)


diff -Nru a/drivers/usb/host/uhci-hcd.c b/drivers/usb/host/uhci-hcd.c
--- a/drivers/usb/host/uhci-hcd.c	Fri May 14 15:33:15 2004
+++ b/drivers/usb/host/uhci-hcd.c	Fri May 14 15:33:15 2004
@@ -1034,9 +1034,13 @@
 			usb_pipeout(urb->pipe));
 	}
 
-	/* Set the flag on the last packet */
-	if (!(urb->transfer_flags & URB_NO_INTERRUPT))
-		td->status |= cpu_to_le32(TD_CTRL_IOC);
+	/* Set the interrupt-on-completion flag on the last packet.
+	 * A more-or-less typical 4 KB URB (= size of one memory page)
+	 * will require about 3 ms to transfer; that's a little on the
+	 * fast side but not enough to justify delaying an interrupt
+	 * more than 2 or 3 URBs, so we will ignore the URB_NO_INTERRUPT
+	 * flag setting. */
+	td->status |= cpu_to_le32(TD_CTRL_IOC);
 
 	qh = uhci_alloc_qh(uhci, urb->dev);
 	if (!qh)
