Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 14 Dec 2015 22:02:01 +0000 (UTC)
From:      "Conrad E. Meyer" <cem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r292229 - in head: sys/dev/ioat tools/tools/ioat
Message-ID:  <201512142202.tBEM21Hg050022@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: cem
Date: Mon Dec 14 22:02:01 2015
New Revision: 292229
URL: https://svnweb.freebsd.org/changeset/base/292229

Log:
  ioatcontrol(8): Add support for interrupt coalescing
  
  The new flag, -c <period>, sets the interrupt coalescing period in
  microseconds through the new ioat(4) API ioat_set_interrupt_coalesce().
  
  Also add a -z flag to zero ioat statistics before tests, to make it easy
  to measure results.
  
  Sponsored by:	EMC / Isilon Storage Division

Modified:
  head/sys/dev/ioat/ioat_test.c
  head/sys/dev/ioat/ioat_test.h
  head/tools/tools/ioat/ioatcontrol.8
  head/tools/tools/ioat/ioatcontrol.c

Modified: head/sys/dev/ioat/ioat_test.c
==============================================================================
--- head/sys/dev/ioat/ioat_test.c	Mon Dec 14 22:01:52 2015	(r292228)
+++ head/sys/dev/ioat/ioat_test.c	Mon Dec 14 22:02:01 2015	(r292229)
@@ -337,10 +337,11 @@ ioat_test_submit_1_tx(struct ioat_test *
 static void
 ioat_dma_test(void *arg)
 {
+	struct ioat_softc *ioat;
 	struct ioat_test *test;
 	bus_dmaengine_t dmaengine;
 	uint32_t loops;
-	int index, rc, start, end;
+	int index, rc, start, end, error;
 
 	test = arg;
 	memset(__DEVOLATILE(void *, test->status), 0, sizeof(test->status));
@@ -393,9 +394,10 @@ ioat_dma_test(void *arg)
 		test->status[IOAT_TEST_NO_DMA_ENGINE]++;
 		return;
 	}
+	ioat = to_ioat_softc(dmaengine);
 
 	if (test->testkind == IOAT_TEST_FILL &&
-	    (to_ioat_softc(dmaengine)->capabilities & IOAT_DMACAP_BFILL) == 0)
+	    (ioat->capabilities & IOAT_DMACAP_BFILL) == 0)
 	{
 		ioat_test_log(0,
 		    "Hardware doesn't support block fill, aborting test\n");
@@ -403,6 +405,25 @@ ioat_dma_test(void *arg)
 		goto out;
 	}
 
+	if (test->coalesce_period > ioat->intrdelay_max) {
+		ioat_test_log(0,
+		    "Hardware doesn't support intrdelay of %u us.\n",
+		    (unsigned)test->coalesce_period);
+		test->status[IOAT_TEST_INVALID_INPUT]++;
+		goto out;
+	}
+	error = ioat_set_interrupt_coalesce(dmaengine, test->coalesce_period);
+	if (error == ENODEV && test->coalesce_period == 0)
+		error = 0;
+	if (error != 0) {
+		ioat_test_log(0, "ioat_set_interrupt_coalesce: %d\n", error);
+		test->status[IOAT_TEST_INVALID_INPUT]++;
+		goto out;
+	}
+
+	if (test->zero_stats)
+		memset(&ioat->stats, 0, sizeof(ioat->stats));
+
 	if (test->testkind == IOAT_TEST_RAW_DMA) {
 		if (test->raw_is_virtual) {
 			test->raw_vtarget = (void *)test->raw_target;

Modified: head/sys/dev/ioat/ioat_test.h
==============================================================================
--- head/sys/dev/ioat/ioat_test.h	Mon Dec 14 22:01:52 2015	(r292228)
+++ head/sys/dev/ioat/ioat_test.h	Mon Dec 14 22:02:01 2015	(r292229)
@@ -75,6 +75,10 @@ struct ioat_test {
 	bool raw_write;
 	bool raw_is_virtual;
 
+	bool zero_stats;
+	/* Configure coalesce period */
+	uint16_t coalesce_period;
+
 	/* Internal usage -- not test inputs */
 	TAILQ_HEAD(, test_transaction) free_q;
 	TAILQ_HEAD(, test_transaction) pend_q;

Modified: head/tools/tools/ioat/ioatcontrol.8
==============================================================================
--- head/tools/tools/ioat/ioatcontrol.8	Mon Dec 14 22:01:52 2015	(r292228)
+++ head/tools/tools/ioat/ioatcontrol.8	Mon Dec 14 22:02:01 2015	(r292229)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd December 9, 2015
+.Dd December 14, 2015
 .Dt IOATCONTROL 8
 .Os
 .Sh NAME
@@ -33,10 +33,12 @@
 .Xr ioat 4
 .Sh SYNOPSIS
 .Nm
+.Op Fl c Ar period
 .Op Fl E
 .Op Fl f
 .Op Fl m
 .Op Fl V
+.Op Fl z
 .Ar channel_number
 .Ar num_txns
 .Ar [ bufsize
@@ -44,9 +46,11 @@
 .Ar [ duration ] ] ]
 .Nm
 .Fl r
+.Op Fl c Ar period
 .Op Fl v
 .Op Fl V
 .Op Fl w
+.Op Fl z
 .Ar channel_number
 .Ar address
 .Ar [ bufsize ]
@@ -57,6 +61,8 @@ allows one to issue some number of test 
 driver on a specific hardware channel.
 The arguments are as follows:
 .Bl -tag -width Ds
+.It Fl c Ar period
+Configure the channel's interrupt coalescing period, in microseconds.
 .It Fl E
 Test non-contiguous 8k copy.
 .It Fl f
@@ -67,6 +73,8 @@ tests copy)
 Test memcpy instead of DMA.
 .It Fl V
 Verify copies/fills for accuracy
+.It Fl z
+Zero device statistics before running test.
 .El
 .Pp
 Alternatively one can use
@@ -76,6 +84,8 @@ to issue DMA to or from a specific
 .Ar address .
 The arguments in "raw" mode are:
 .Bl -tag -width Ds
+.It Fl c Ar period
+As above.
 .It Fl v
 .Ar address
 is a kernel virtual address (by default,
@@ -90,6 +100,8 @@ Write to the specified
 .Nm
 .Fl r
 reads)
+.It Fl z
+As above.
 .El
 .Pp
 .Nm

Modified: head/tools/tools/ioat/ioatcontrol.c
==============================================================================
--- head/tools/tools/ioat/ioatcontrol.c	Mon Dec 14 22:01:52 2015	(r292228)
+++ head/tools/tools/ioat/ioatcontrol.c	Mon Dec 14 22:02:01 2015	(r292229)
@@ -48,10 +48,14 @@ static void
 usage(void)
 {
 
-	printf("Usage: %s [-E|-f|-m] [-V] <channel #> <txns> [<bufsize> "
+	printf("Usage: %s [-E|-f|-m] OPTIONS <channel #> <txns> [<bufsize> "
 	    "[<chain-len> [duration]]]\n", getprogname());
-	printf("       %s -r [-vV] <channel #> <addr> [<bufsize>]\n",
+	printf("       %s -r [-v] OPTIONS <channel #> <addr> [<bufsize>]\n\n",
 	    getprogname());
+	printf("       OPTIONS:\n");
+	printf("           -c <period> - Enable interrupt coalescing (us)\n");
+	printf("           -V          - Enable verification\n");
+	printf("           -z          - Zero device stats before test\n");
 	exit(EX_USAGE);
 }
 
@@ -103,8 +107,11 @@ main(int argc, char **argv)
 	fflag = rflag = Eflag = mflag = false;
 	modeflags = 0;
 
-	while ((ch = getopt(argc, argv, "EfmrvVw")) != -1) {
+	while ((ch = getopt(argc, argv, "c:EfmrvVwz")) != -1) {
 		switch (ch) {
+		case 'c':
+			t.coalesce_period = atoi(optarg);
+			break;
 		case 'E':
 			Eflag = true;
 			modeflags++;
@@ -130,6 +137,9 @@ main(int argc, char **argv)
 		case 'w':
 			t.raw_write = true;
 			break;
+		case 'z':
+			t.zero_stats = true;
+			break;
 		default:
 			usage();
 		}



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