patch to add a tunable that disables ORDERED tag emission

mjacob at freebsd.org mjacob at freebsd.org
Tue Oct 31 03:17:23 UTC 2006


I could have sworn we talked about this some time back - ordered tag 
usage really kills performance in a lot of cases, so let's have a 
tunable where we can disable the emission of ORDERED tags at regular 
intervals.
-------------- next part --------------
==== //depot/projects/newisp/cam/scsi/scsi_da.c#3 - /home/FreeBSD/p4/newisp/cam/scsi/scsi_da.c ====
@@ -491,8 +491,14 @@
 #define	DA_DEFAULT_RETRY	4
 #endif
 
+#ifndef	DA_DEFAULT_SEND_ORDERED
+#define	DA_DEFAULT_SEND_ORDERED	1
+#endif
+
+
 static int da_retry_count = DA_DEFAULT_RETRY;
 static int da_default_timeout = DA_DEFAULT_TIMEOUT;
+static int da_send_ordered = DA_DEFAULT_SEND_ORDERED;
 
 SYSCTL_NODE(_kern_cam, OID_AUTO, da, CTLFLAG_RD, 0,
             "CAM Direct Access Disk driver");
@@ -502,6 +508,9 @@
 SYSCTL_INT(_kern_cam_da, OID_AUTO, default_timeout, CTLFLAG_RW,
            &da_default_timeout, 0, "Normal I/O timeout (in seconds)");
 TUNABLE_INT("kern.cam.da.default_timeout", &da_default_timeout);
+SYSCTL_INT(_kern_cam_da, OID_AUTO, da_send_ordered, CTLFLAG_RW,
+           &da_send_ordered, 0, "Send Ordered Tags");
+TUNABLE_INT("kern.cam.da.da_send_ordered", &da_send_ordered);
 
 /*
  * DA_ORDEREDTAG_INTERVAL determines how often, relative
@@ -851,7 +860,7 @@
 	if (status != CAM_REQ_CMP) {
 		printf("da: Failed to attach master async callback "
 		       "due to status 0x%x!\n", status);
-	} else {
+	} else if (da_send_ordered) {
 
 		/*
 		 * Schedule a periodic event to occasionally send an
@@ -1921,24 +1930,25 @@
 {
 	struct da_softc *softc;
 	int s;
+	if (da_send_ordered) {
+		for (softc = SLIST_FIRST(&softc_list);
+		     softc != NULL;
+		     softc = SLIST_NEXT(softc, links)) {
+			s = splsoftcam();
+			if ((softc->ordered_tag_count == 0) 
+			 && ((softc->flags & DA_FLAG_WENT_IDLE) == 0)) {
+				softc->flags |= DA_FLAG_NEED_OTAG;
+			}
+			if (softc->outstanding_cmds > 0)
+				softc->flags &= ~DA_FLAG_WENT_IDLE;
 
-	for (softc = SLIST_FIRST(&softc_list);
-	     softc != NULL;
-	     softc = SLIST_NEXT(softc, links)) {
-		s = splsoftcam();
-		if ((softc->ordered_tag_count == 0) 
-		 && ((softc->flags & DA_FLAG_WENT_IDLE) == 0)) {
-			softc->flags |= DA_FLAG_NEED_OTAG;
+			softc->ordered_tag_count = 0;
+			splx(s);
 		}
-		if (softc->outstanding_cmds > 0)
-			softc->flags &= ~DA_FLAG_WENT_IDLE;
-
-		softc->ordered_tag_count = 0;
-		splx(s);
+		/* Queue us up again */
+		timeout(dasendorderedtag, NULL,
+			(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL);
 	}
-	/* Queue us up again */
-	timeout(dasendorderedtag, NULL,
-		(da_default_timeout * hz) / DA_ORDEREDTAG_INTERVAL);
 }
 
 /*
==== //depot/projects/newisp/dev/bge/if_bge.c#8 - /home/FreeBSD/p4/newisp/dev/bge/if_bge.c ====
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.150 2006/10/03 09:31:49 glebius Exp $");
+__FBSDID("$FreeBSD: src/sys/dev/bge/if_bge.c,v 1.151 2006/10/19 08:03:22 scottl Exp $");
 
 /*
  * Broadcom BCM570x family gigabit ethernet driver for FreeBSD.
@@ -1823,7 +1823,7 @@
 	 * Allocate the parent bus DMA tag appropriate for PCI.
 	 */
 	error = bus_dma_tag_create(bus_get_dma_tag(sc->bge_dev),/* parent */
-			PAGE_SIZE, 0,		/* alignment, boundary */
+			1, 0,			/* alignment, boundary */
 			BUS_SPACE_MAXADDR,	/* lowaddr */
 			BUS_SPACE_MAXADDR,	/* highaddr */
 			NULL, NULL,		/* filter, filterarg */
@@ -2499,6 +2499,12 @@
 		}
 	}
 
+	/*
+	 * Write the magic number to the firmware mailbox at 0xb50
+         * so that the driver can synchronize with the firmware.
+	 */
+	bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
+
 	/* Issue global reset */
 	bge_writereg_ind(sc, BGE_MISC_CFG, reset);
 
@@ -2535,11 +2541,6 @@
 		CSR_WRITE_4(sc, BGE_MARB_MODE, BGE_MARBMODE_ENABLE);
 
 	/*
-	 * Prevent PXE restart: write a magic number to the
-	 * general communications memory at 0xB50.
-	 */
-	bge_writemem_ind(sc, BGE_SOFTWARE_GENCOMM, BGE_MAGIC_NUMBER);
-	/*
 	 * Poll the value location we just wrote until
 	 * we see the 1's complement of the magic number.
 	 * This indicates that the firmware initialization


More information about the freebsd-scsi mailing list