Skip to content

Commit

Permalink
Merge pull request #233 from appneta/Enhancement_#93_netmap_performance
Browse files Browse the repository at this point in the history
#93 send performance upgrades as per discussions with Luggi Rizzo
  • Loading branch information
fklassen committed Dec 26, 2015
2 parents 2c24cac + 48b2a50 commit 6157689
Show file tree
Hide file tree
Showing 11 changed files with 224 additions and 380 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ AC_CONFIG_MACRO_DIR([m4])
dnl Set version info here!
MAJOR_VERSION=4
MINOR_VERSION=1
MICRO_VERSION=1-beta3
MICRO_VERSION=1-beta4
TCPREPLAY_VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION
PACKAGE_URL=http://tcpreplay.appneta.com/

Expand Down
33 changes: 18 additions & 15 deletions docs/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
--/--/---- Version 4.1.1-beta4
- netmap optimizations (#93)

12/19/2015 Version 4.1.1-beta3
- Option --unique-ip accepts --duration (#227)
- RFC1624 incremental checksums (#225)
Expand Down Expand Up @@ -38,7 +41,7 @@
- Fix cross compiling (#140)
- Add Quick TX module for Linux (#136)
- Better recovery for missing static libpcap libs (#128)

09/05/2014 Version 4.0.5
- Fix build failure with latest netmap 11 (#123)
- Fix unable to use Zero Copy interfaces on PF_RING (#118)
Expand Down Expand Up @@ -70,17 +73,17 @@
02/04/2014 Version 4.0.3
- Fix build errors when ENABLE_VERBOSE is not set (#60)
- Build error on host without tcpdump (#59)

01/17/2014 Version 4.0.2
- Fix hangs with --mbps command (#54)

01/16/2014 Version 4.0.1
- Support for netmap version 10 API (#53)
- Remove deprecated "absolute time" for OS X (#52)
- Make dosleep() rentrant to support API concurrency (#51)
- Make dosleep() rentrant to support API concurrency (#51)
- Remove compiler warnings (#50)
- Fix slow netmap in Intel GigE "igb" server NICS (#49)

01/05/2014 Version 4.0.0
- Implemented wiki page for 4.X - http://tcpreplay.appneta.com
- Support for ARM aarch64 (appneta #43)
Expand All @@ -101,7 +104,7 @@
- Remove unreliable RDTSC option (appneta #16)
- Switch from BSD to GPLv3 license (appneta #5)
- Add --unique-ip option to tcpreplay (appneta #4)
- Removed sleep-accel option (appneta #2)
- Removed sleep-accel option (appneta #2)
- Enhance accuracy and performance of --mbps option (appneta #2)
- Add netmap injector (appneta #1)
- Properly process IPv6 extension headers (#396)
Expand Down Expand Up @@ -211,7 +214,7 @@
- Re-enable tcpreplay --listnics (#319)
- Fix sendpacket always reporting using PF_PACKET, even when it doesn't (#322)
- Fix major packet timing issue under old versions of glibc (#324)

05/17/2008: Version 3.3.1
- Fix limitation of PF_PACKET only supporting Ethernet (#123)
- Fix (again) /dev/bpf detection in FreeBSD 8.0 (#292)
Expand Down Expand Up @@ -246,7 +249,7 @@

11/01/2007: Version 3.2.3
- Fix compile issue under Linux and other OS's (#275)

10/31/2007: Version 3.2.2
- Enable source MAC spoofing for OS X (#142, #151)
* Tcpreplay now requires OS X 10.5 (Leopard)
Expand All @@ -260,15 +263,15 @@
- Remove flowreplay code (#262)
- Fix DLT rewrite code causing corrupted ethernet protocol type (#268)
- Try to fix inet_aton() issue under Solaris (#260)

08/26/2007: Version 3.2
- Return a more useful error message when tcpprep fails (#187)
- Add Tomahawk test tool client/server detection algorithm (#186)
- Improved AutoGen support (#191)
- Improved documentation (#164, #198)
- Added Doxygen markup (#176)
- configure now honors --with-tcpdump flag (#192)
- configure now defaults to --enable-64bits which breaks backwards
- configure now defaults to --enable-64bits which breaks backwards
compatibility in certain situations. Use --disable-64bits if this
concerns you (#195)
- Use safe_free() to detect bugs earlier in development (#197)
Expand Down Expand Up @@ -333,8 +336,8 @@
- Add tcpbridge --verbose mode (#28)
- Fix compile issues under HP-UX & strictly aligned systems (#141)
- --enable-dynamic-link supports 64bit libraries (#143)


03/22/2007: Version 3.0.beta13
- Fixed detection of IPv4 packets in libtcpedit on little-endian boxes (#115, #116)
- Fixed TCP/UDP checksum calculation on little-endian boxes (#126)
Expand Down Expand Up @@ -366,7 +369,7 @@
- Fix tcpprep --include/exclude (#96)
- Upgrade AutoGen tearoff (libopts) to latest version (5.9.0) (#97)
- Don't do L4 checksums for non-fragment offset == 0 (#107)

08/07/2006: Version 3.0.beta11
- Fix distribution to ship missing src/tcpr.h (#73)
- Add support to tcprewrite to alter output file DLT (#74)
Expand Down Expand Up @@ -401,7 +404,7 @@
- Improve tcpbridge man page
- Massive tcprewrite fixes & cleanup (#50)
- Much improved README document
- Reorganize packet editing code into a standalone module (tcpedit)
- Reorganize packet editing code into a standalone module (tcpedit)
which has been librarized. (#5)
- Strict code cleanup (#27)
- Fix tcpprep from generating bad cache files (#48)
Expand Down Expand Up @@ -503,8 +506,8 @@
- tcprewrite

- Removed Applications: (Ethereal has better utilities)
- capinfo
- pcapmerge
- capinfo
- pcapmerge

- Merge fixes from 2.x/stable branch:
- portmap.c endian bugs
Expand Down
6 changes: 3 additions & 3 deletions src/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -62,15 +62,15 @@ endif

tcpreplay_edit_CFLAGS = $(LIBOPTS_CFLAGS) -I.. -Itcpedit $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY -DTCPREPLAY_EDIT -DHAVE_CACHEFILE_SUPPORT
tcpreplay_edit_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c sleep.c tcpreplay_api.c replay.c
tcpreplay_edit_SOURCES = tcpreplay_edit_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
tcpreplay_edit_OBJECTS: tcpreplay_opts.h
tcpreplay_edit_opts.h: tcpreplay_edit_opts.c

tcpreplay_edit_opts.c: tcpreplay_opts.def
@AUTOGEN@ $(opts_list) @NETMAPFLAGS@ -DTCPREPLAY_EDIT -b tcpreplay_edit_opts tcpreplay_opts.def

tcpreplay_CFLAGS = $(LIBOPTS_CFLAGS) -I.. $(LNAV_CFLAGS) @LDNETINC@ -DTCPREPLAY
tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c sleep.c tcpreplay_api.c replay.c
tcpreplay_SOURCES = tcpreplay_opts.c send_packets.c signal_handler.c tcpreplay.c tcpreplay_api.c replay.c
tcpreplay_LDADD = ./common/libcommon.a $(LIBSTRL) @LPCAPLIB@ @LDNETLIB@ $(LIBOPTS_LDADD)
tcpreplay_OBJECTS: tcpreplay_opts.h
tcpreplay_opts.h: tcpreplay_opts.c
Expand Down Expand Up @@ -127,7 +127,7 @@ tcpbridge_LDADD = ./tcpedit/libtcpedit.a ./common/libcommon.a \
if ENABLE_OSX_FRAMEWORKS
tcpbridge_LDFLAGS = -framework CoreServices -framework Carbon
endif
tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c sleep.c
tcpbridge_SOURCES = tcpbridge_opts.c tcpbridge.c bridge.c
tcpbridge_OBJECTS: tcpbridge_opts.h
tcpbridge_opts.h: tcpbridge_opts.c
tcpbridge_opts.c: tcpbridge_opts.def tcpedit/tcpedit_opts.def
Expand Down
28 changes: 10 additions & 18 deletions src/common/netmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ sendpacket_open_netmap(const char *device, char *errbuf, void *arg) {
}
}

dbg(2, "Waiting 4 seconds for phy reset...");
dbgx(2, "Waiting %d seconds for phy reset...", ctx->options->netmap_delay);
sleep(ctx->options->netmap_delay);
dbg(2, "Ready!");

Expand Down Expand Up @@ -573,27 +573,19 @@ int sendpacket_send_netmap(void *p, const u_char *data, size_t len)
*/
ioctl(sp->handle.fd, NIOCTXSYNC, NULL);

pfd.fd = sp->handle.fd;
pfd.events = POLLOUT;
pfd.revents = 0;
if (poll(&pfd, 1, 1000) <= 0) {
if (++sp->tx_timeouts == NETMAP_TX_TIMEOUT_SEC) {
return -1;
if ((avail = nm_ring_space(txring)) == 0) {
pfd.fd = sp->handle.fd;
pfd.events = POLLOUT;
pfd.revents = 0;
if (poll(&pfd, 1, 1000) <= 0) {
if (++sp->tx_timeouts == NETMAP_TX_TIMEOUT_SEC) {
return -1;
}
return -2;
}
return -2;
}

sp->tx_timeouts = 0;

/*
* Do not remove this even though it looks redundant.
* Overall performance is increased with this restart
* of the TX queue.
*
* This call increases the number of available slots from
* 1 to all that are truly available.
*/
ioctl(sp->handle.fd, NIOCTXSYNC, NULL);
}

txring = NETMAP_TXRING(sp->nm_if, sp->cur_tx_ring);
Expand Down
10 changes: 0 additions & 10 deletions src/common/timer.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,16 +170,6 @@ void timesdiv(struct timespec *tvs, COUNTER div);

typedef struct timeval timestamp_t;

/*
* starts a timer so we can figure out how long we have
* been transmitting
*/
static inline void
get_packet_timestamp(timestamp_t *ctx)
{
gettimeofday(ctx, NULL);
}

void init_timestamp(timestamp_t *ctx);


Expand Down
Loading

0 comments on commit 6157689

Please sign in to comment.