diff --git a/README.netmap b/README.netmap index b7dd46e12..cdb38f7c0 100644 --- a/README.netmap +++ b/README.netmap @@ -1,6 +1,10 @@ - NETMAP VERSION - ------------------ - +Addendum for more modern versions of netmap: +Given the change in the netmap library structure, I changed some code to let mTCP work with modern versions of netmap. To run it for Netmap API v >15 you will need +the netmap folder and mtcp folders to be located in the same directory/folder. Once this is done please go into netmap/libnetmap and run make. This should generate a +libnetmap.a file and everything should run fine after this. +------------------ -*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*--*-*-*-*-*-*- -A- Tested with linux-3.13.0-121-generic & netmap commit: 8f3f79e4ca168c6d3220e7a5198a5778b030445e, and, @@ -193,4 +197,4 @@ I/O by default. Most microbenchmarking applications (epserver/epwget) shows best performance with this setup in our testbed. In case the performance is sub-optimal in yours, we recommend that you try polling mode (by enabling CONST_POLLING in line 24). You can also try tweaking -IDLE_POLL_WAIT/IDLE_POLL_COUNT macros while testing blocking mode I/O. \ No newline at end of file +IDLE_POLL_WAIT/IDLE_POLL_COUNT macros while testing blocking mode I/O. diff --git a/config/affinity-netmap.py b/config/affinity-netmap.py index 0e52edd5d..b33f4a25b 100755 --- a/config/affinity-netmap.py +++ b/config/affinity-netmap.py @@ -14,25 +14,25 @@ def execute(cmd): return None if os.getuid() != 0: - print 'You must be root!' + print('You must be root!') sys.exit(1) -num_cpus = len(execute('cat /proc/cpuinfo | grep processor').strip().split('\n')) +num_cpus = len(execute('cat /proc/cpuinfo | grep processor').strip().split(b'\n')) if len(sys.argv) < 2: - print 'usage: %s ' % sys.argv[0] + print('usage: %s ' % sys.argv[0]) sys.exit(1) ifname = sys.argv[1] -intrmap = execute('cat /proc/interrupts | grep %s-TxRx-' % ifname).strip().split('\n') +intrmap = execute('cat /proc/interrupts | grep %s-TxRx-' % ifname).strip().split(b'\n') for intr in intrmap: irq = int(intr.split()[0][:-1]) name = intr.split()[-1] - queue = int(name[name.rfind('-') + 1:]) + queue = int(name[name.rfind(b'-') + 1:]) cpu = queue - print 'echo %x > /proc/irq/%d/smp_affinity' % (1 << cpu, irq) + print ('echo %x > /proc/irq/%d/smp_affinity' % (1 << cpu, irq)) execute('echo %x > /proc/irq/%d/smp_affinity' % (1 << cpu, irq)) diff --git a/mtcp/src/Makefile.in b/mtcp/src/Makefile.in index f81a0c8d7..5a5853e67 100644 --- a/mtcp/src/Makefile.in +++ b/mtcp/src/Makefile.in @@ -75,7 +75,12 @@ INC += -DDISABLE_PSIO endif ifeq ($(NETMAP),1) -# do nothing +#if netmap we set the INC variable to netmap lib location +INC += -I ../../../netmap/libnetmap +#add location of netmap_user.h to INC +INC += -I ../../../netmap/sys +#and then we link LDFLAGS to libnetmap.a +LDFLAGS += ../../../netmap/libnetmap/libnetmap.a else INC += -DDISABLE_NETMAP endif @@ -153,7 +158,7 @@ endif $(OBJS): %.o: %.c Makefile $(MSG) " CC $<" - $(HIDE) $(GCC) $(CFLAGS) $(GCC_OPT) $(INC) -c $< -o $@ + $(HIDE) $(GCC) $(CFLAGS) $(GCC_OPT) $(INC) -c $< -o $@ $(LDFLAGS) $(DEPS): .%.d: %.c Makefile $(HIDE) $(GCC) $(GCC_OPT) $(INC) -MM $(CFLAGS) $< > $@ diff --git a/mtcp/src/config.c b/mtcp/src/config.c index 38188bde4..c1aac8be0 100644 --- a/mtcp/src/config.c +++ b/mtcp/src/config.c @@ -560,6 +560,9 @@ ParseConfiguration(char *line) char *saveptr; + if(strlen(line) > sizeof(optstr) - 1){ + return -1; + } strncpy(optstr, line, MAX_OPTLINE_LEN - 1); saveptr = NULL; diff --git a/mtcp/src/io_module.c b/mtcp/src/io_module.c index 198a98874..a834f4143 100644 --- a/mtcp/src/io_module.c +++ b/mtcp/src/io_module.c @@ -44,7 +44,7 @@ #include #include /* for netmap macros */ -#include "netmap_user.h" +#include /*----------------------------------------------------------------------------*/ io_module_func *current_iomodule_func = &dpdk_module_func; #ifndef DISABLE_DPDK @@ -741,4 +741,4 @@ CheckIOModuleAccessPermissions() return 0; } -/*----------------------------------------------------------------------------*/ +/*----------------------------------------------------------------------------*/ \ No newline at end of file diff --git a/mtcp/src/netmap_module.c b/mtcp/src/netmap_module.c index 38600b90f..a84ffdf49 100644 --- a/mtcp/src/netmap_module.c +++ b/mtcp/src/netmap_module.c @@ -1,4 +1,3 @@ -/* for io_module_func def'ns */ #include "io_module.h" #ifndef DISABLE_NETMAP /* for mtcp related def'ns */ @@ -11,7 +10,8 @@ #include "config.h" /* for netmap definitions */ #define NETMAP_WITH_LIBS -#include "netmap_user.h" +#define LIBNETMAP_NOTHREADSAFE +#include /* for poll */ #include /* for ETHER_CRC_LEN */ @@ -49,7 +49,7 @@ netmap_init_handle(struct mtcp_thread_context *ctxt) { struct netmap_private_context *npc; char ifname[MAX_IFNAMELEN]; - char nifname[MAX_IFNAMELEN]; + char nifname[MAX_IFNAMELEN + 20]; int j; /* create and initialize private I/O module context */