Skip to content
Open

Paste #325

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions README.netmap
Original file line number Diff line number Diff line change
@@ -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,
Expand Down Expand Up @@ -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.
IDLE_POLL_WAIT/IDLE_POLL_COUNT macros while testing blocking mode I/O.
12 changes: 6 additions & 6 deletions config/affinity-netmap.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 <interface name>' % sys.argv[0]
print('usage: %s <interface name>' % 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))
9 changes: 7 additions & 2 deletions mtcp/src/Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) $< > $@

Expand Down
3 changes: 3 additions & 0 deletions mtcp/src/config.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions mtcp/src/io_module.c
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
#include <sys/stat.h>
#include <fcntl.h>
/* for netmap macros */
#include "netmap_user.h"
#include <net/netmap_user.h>
/*----------------------------------------------------------------------------*/
io_module_func *current_iomodule_func = &dpdk_module_func;
#ifndef DISABLE_DPDK
Expand Down Expand Up @@ -741,4 +741,4 @@ CheckIOModuleAccessPermissions()

return 0;
}
/*----------------------------------------------------------------------------*/
/*----------------------------------------------------------------------------*/
6 changes: 3 additions & 3 deletions mtcp/src/netmap_module.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
/* for io_module_func def'ns */
#include "io_module.h"
#ifndef DISABLE_NETMAP
/* for mtcp related def'ns */
Expand All @@ -11,7 +10,8 @@
#include "config.h"
/* for netmap definitions */
#define NETMAP_WITH_LIBS
#include "netmap_user.h"
#define LIBNETMAP_NOTHREADSAFE
#include <libnetmap.h>
/* for poll */
#include <sys/poll.h>
/* for ETHER_CRC_LEN */
Expand Down Expand Up @@ -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 */
Expand Down