summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorluigi <luigi@FreeBSD.org>2011-12-05 12:06:53 +0000
committerluigi <luigi@FreeBSD.org>2011-12-05 12:06:53 +0000
commit298ffde66596a12229df0898bab02aa491f70535 (patch)
treea556ee936d46b8051dced8959c9019517fa2c641 /tools
parent07781bc7da6c5ba99f27277e39b9a1a47d52ce0e (diff)
downloadFreeBSD-src-298ffde66596a12229df0898bab02aa491f70535.zip
FreeBSD-src-298ffde66596a12229df0898bab02aa491f70535.tar.gz
1. Fix the handling of link reset while in netmap more.
A link reset now is completely transparent for the netmap client: even if the NIC resets its own ring (e.g. restarting from 0), the client will not see any change in the current rx/tx positions, because the driver will keep track of the offset between the two. 2. make the device-specific code more uniform across different drivers There were some inconsistencies in the implementation of the netmap support routines, now drivers have been aligned to a common code structure. 3. import netmap support for ixgbe . This is implemented as a very small patch for ixgbe.c (233 lines, 11 chunks, mostly comments: in total the patch has only 54 lines of new code) , as most of the code is in an external file sys/dev/netmap/ixgbe_netmap.h , following some initial comments from Jack Vogel about making changes less intrusive. (Note, i have emailed Jack multiple times asking if he had comments on this structure of the code; i got no reply so i assume he is fine with it). Support for other drivers (em, lem, re, igb) will come later. "ixgbe" is now the reference driver for netmap support. Both the external file (sys/dev/netmap/ixgbe_netmap.h) and the device-specific patches (in sys/dev/ixgbe/ixgbe.c) are heavily commented and should serve as a reference for other device drivers. Tested on i386 and amd64 with the pkt-gen program in tools/tools/netmap, the sender does 14.88 Mpps at 1050 Mhz and 14.2 Mpps at 900 MHz on an i7-860 with 4 cores and 82599 card. Haven't tried yet more aggressive optimizations such as adding 'prefetch' instructions in the time-critical parts of the code.
Diffstat (limited to 'tools')
-rw-r--r--tools/tools/netmap/pkt-gen.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c
index 747bd9d..21dc8de 100644
--- a/tools/tools/netmap/pkt-gen.c
+++ b/tools/tools/netmap/pkt-gen.c
@@ -4,10 +4,10 @@
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
- * 1. Redistributions of source code must retain the above copyright
- * notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- * notice, this list of conditions and the following disclaimer in the
+ * 1. Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
@@ -25,7 +25,7 @@
/*
* $FreeBSD$
- * $Id: pkt-gen.c 9638 2011-11-07 18:07:43Z luigi $
+ * $Id: pkt-gen.c 9827 2011-12-05 11:29:34Z luigi $
*
* Example program to show how to build a multithreaded packet
* source/sink using the netmap device.
@@ -45,6 +45,7 @@ const char *default_payload="netmap pkt-gen Luigi Rizzo and Matteo Landi\n"
#include <signal.h> /* signal */
#include <stdlib.h>
#include <stdio.h>
+#include <inttypes.h> /* PRI* macros */
#include <string.h> /* strcmp */
#include <fcntl.h> /* open */
#include <unistd.h> /* close */
@@ -616,7 +617,7 @@ tx_output(uint64_t sent, int size, double delta)
punit += 1;
}
- printf("Sent %llu packets, %d bytes each, in %.2f seconds.\n",
+ printf("Sent %" PRIu64 " packets, %d bytes each, in %.2f seconds.\n",
sent, size, delta);
printf("Speed: %.2f%cpps. Bandwidth: %.2f%cbps.\n",
pps, units[punit], amount, units[aunit]);
@@ -636,7 +637,7 @@ rx_output(uint64_t received, double delta)
punit += 1;
}
- printf("Received %llu packets, in %.2f seconds.\n", received, delta);
+ printf("Received %" PRIu64 " packets, in %.2f seconds.\n", received, delta);
printf("Speed: %.2f%cpps.\n", pps, units[punit]);
}
@@ -971,7 +972,7 @@ main(int arc, char **argv)
if (pps < 10000)
continue;
pps = (my_count - prev)*1000000 / pps;
- D("%llu pps", pps);
+ D("%" PRIu64 " pps", pps);
prev = my_count;
toc = now;
if (done == g.nthreads)
OpenPOWER on IntegriCloud