Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 30 Oct 2006 19:52:15 GMT
From:      Hans Petter Selasky <hselasky@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 108774 for review
Message-ID:  <200610301952.k9UJqFsL013445@repoman.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://perforce.freebsd.org/chv.cgi?CH=108774

Change 108774 by hselasky@hselasky_mini_itx on 2006/10/30 19:51:29

	Emphasize why the doorbell is inline. Only wait for the doorbell
	for non-root transfers. Change a variable from uint32_t to
	bus_size_t. It should not make any difference, unless 64-bit
	addressing is used, which is currently not the case.

Affected files ...

.. //depot/projects/usb/src/sys/dev/usb/ehci.c#14 edit

Differences ...

==== //depot/projects/usb/src/sys/dev/usb/ehci.c#14 (text+ko) ====

@@ -1966,12 +1966,33 @@
 	/* remove interrupt info (if any) */
 	ehci_remove_interrupt_info(xfer);
 
-	if(((xfer->pipe->methods == &ehci_device_ctrl_methods) ||
-	    (xfer->pipe->methods == &ehci_device_bulk_methods)) &&
-	   (sc->sc_doorbell_disable == 0))
-	{
+	if ((xfer->pipe->methods != &ehci_root_ctrl_methods) &&
+	    (xfer->pipe->methods != &ehci_root_intr_methods)) {
+
+	  if(((xfer->pipe->methods == &ehci_device_ctrl_methods) ||
+	      (xfer->pipe->methods == &ehci_device_bulk_methods)) &&
+	     (sc->sc_doorbell_disable == 0)) {
+
 		u_int32_t to = 100*1000;
 
+		/*
+		 * This implementation does not use the doorbell
+		 * interrupt. The reason is that one gets more
+		 * throughput by waiting for the doorbell inline,
+		 * than by using the doorbell interrupt. A typical
+		 * result reading from an USB mass storage disk:
+		 *
+		 * With doorbell interrupt: 27 seconds for 512MB
+		 * With inline doorbell: 21 seconds for 512MB
+		 *
+		 * Although the inline version causes a slightly
+		 * higher CPU usage, it does not block the system
+		 * in any way, because this USB driver uses its
+		 * own mutex.
+		 *
+		 * --hps
+		 */
+
 		/* wait for doorbell ~32us */
 		EOWRITE4(sc, EHCI_USBCMD, 
 			 EOREAD4(sc, EHCI_USBCMD) | EHCI_CMD_IAAD);
@@ -1987,10 +2008,13 @@
 		    }
 		    DELAY(1);
 		}
-		need_delay = 0;
-	}
-	else
-	{
+
+		/* acknowledge any doorbell interrupt 
+		 * (SiS chipsets require this)
+		 */
+		EOWRITE4(sc, EHCI_USBSTS, EHCI_STS_IAA);
+
+	  } else {
 		/* wait until the hardware has finished any possible
 		 * use of the transfer descriptor and QH
 		 *
@@ -1999,13 +2023,9 @@
 		 * frame is started
 		 */
 		DELAY(need_delay ? ((3*1000)/(2*8)) : (5));
+	  }
 	}
 
-	/* acknowledge any doorbell interrupt 
-	 * (SiS chipsets require this)
-	 */
-	EOWRITE4(sc, EHCI_USBSTS, EHCI_STS_IAA);
-
 	if(error)
 	{
 		/* next transfer needs to clear stall */
@@ -2516,8 +2536,8 @@
 {
 	struct usbd_page_search buf_res;
 	ehci_softc_t *sc = xfer->usb_sc;
+	bus_size_t page_addr;
 	u_int32_t status;
-	u_int32_t page_addr;
 	u_int32_t buf_offset;
 	u_int32_t nframes;
 	u_int16_t *plen;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200610301952.k9UJqFsL013445>