diff options
author | Luigi Rizzo <luigi@FreeBSD.org> | 2011-12-05 12:06:53 +0000 |
---|---|---|
committer | Luigi Rizzo <luigi@FreeBSD.org> | 2011-12-05 12:06:53 +0000 |
commit | 506cc70cce95cb51b029fa4055a38e59b667b76e (patch) | |
tree | a556ee936d46b8051dced8959c9019517fa2c641 /tools/tools/netmap/pkt-gen.c | |
parent | 2b69bb1f27973488452bb60c6587ef3971d0218f (diff) | |
download | src-506cc70cce95cb51b029fa4055a38e59b667b76e.tar.gz src-506cc70cce95cb51b029fa4055a38e59b667b76e.zip |
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.
Notes
Notes:
svn path=/head/; revision=228276
Diffstat (limited to 'tools/tools/netmap/pkt-gen.c')
-rw-r--r-- | tools/tools/netmap/pkt-gen.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/tools/tools/netmap/pkt-gen.c b/tools/tools/netmap/pkt-gen.c index 747bd9dde00b..21dc8de9420c 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) |