diff mbox

[PATCHv3,NETMAP,1/4] Update to netmap_v11.1

Message ID 1416318981-27188-1-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu Nov. 18, 2014, 1:56 p.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
v3: changes after chat with Anders:
- removed mistakenly added section title from README
- added section about inserting kernel modules
- reformated some paragraphs

 platform/linux-netmap/Makefile.am                 |  2 +
 platform/linux-netmap/README                      | 76 ++++++++++++++++-------
 platform/linux-netmap/include/odp_packet_netmap.h |  2 +-
 3 files changed, 57 insertions(+), 23 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-netmap/Makefile.am b/platform/linux-netmap/Makefile.am
index eae382a..0b08cad 100644
--- a/platform/linux-netmap/Makefile.am
+++ b/platform/linux-netmap/Makefile.am
@@ -12,6 +12,8 @@  AM_CFLAGS +=  -I$(srcdir)/include/api
 AM_CFLAGS +=  -I$(top_srcdir)/platform/linux-generic/include
 AM_CFLAGS +=  -I$(top_srcdir)/platform/linux-generic/include/api
 AM_CFLAGS +=  -I$(top_srcdir)/helper/include
+# Disable cast errors until the problem in netmap_user.h is fixed upstream
+AM_CFLAGS += -Wno-cast-qual
 
 include_HEADERS = \
 		  $(top_srcdir)/platform/linux-generic/include/api/odp.h \
diff --git a/platform/linux-netmap/README b/platform/linux-netmap/README
index abcb187..a45fbfa 100644
--- a/platform/linux-netmap/README
+++ b/platform/linux-netmap/README
@@ -7,43 +7,49 @@  SPDX-License-Identifier:        BSD-3-Clause
 ==================================
 
 OpenDataPlane implementation using netmap accelerated packet I/O.
-The current implementation does not yet take advantage of the full
-performance of netmap I/O, the data is copied between netmap slots and
-ODP buffers.
+The current implementation does not yet take advantage of the full performance
+of netmap I/O, the data is copied between netmap slots and ODP buffers.
 
 The implementation is based almost entirely on the linux-generic platform
 implementation, only the packet I/O differs to work with netmap enabled
 interfaces.
 
-Also the linux-netmap implementation allows hybrid pktio instances, which
-means that the applications can decide to use either sockets or netmap I/O
-at runtime.
+Also the linux-netmap implementation allows hybrid pktio instances, which means
+that applications can choose between sockets and netmap I/O at runtime. The
+netmap I/O has priority by default, if socket I/O is desired instead it can be
+activated by setting the environment variable ODP_PKTIO_DISABLE_NETMAP.
 
 2. Build
 ==================================
 
-2.1 Building netmap
---------------------
+ODP works with the latest release version of netmap, which is currently at API
+version 11.1.
 
-Netmap is currently hosted on https://code.google.com/p/netmap/ but
-ODP only works at this point with netmap API version 10 so you will need
-a specific revision of netmap.
+2.1 Building netmap kernel modules
+----------------------------------
+
+Netmap is currently hosted on https://code.google.com/p/netmap/
 
     git clone https://code.google.com/p/netmap/
     cd netmap
-    git reset --hard 1f462ef
+    git co v11.1
+
+This is enough to build ODP, if you don't want to build netmap kernel modules
+you can jump to section 2.2.
 
-Netmap consists of a core kernel module (netmap_lin.ko) and optional modified
-device drivers.
+Netmap consists of a core kernel module (netmap.ko), optional modified device
+drivers and user space API headers to access the netmap functionality. It is
+recommended to build both the core module and modified device drivers.
 
 Netmap builds as an out-of-tree kernel module, you need matching kernel sources
 to compile it. General build instructions can be found in the packet README:
-http://code.google.com/p/netmap/source/browse/README
+https://code.google.com/p/netmap/source/browse/LINUX/README
 
-2.1.1 Building netmap on Ubuntu with stock kernel
+
+2.1.1 Building netmap kernel modules on Ubuntu with stock kernel
 
 If you are running Ubuntu/Debian with the stock kernel and you want to compile
-both netmap_lin.ko and modified drivers, these steps will guide you through it.
+both netmap.ko and modified drivers, these steps will guide you through it.
 
 You will need the linux-headers and linux-source packages for this.
 
@@ -53,21 +59,27 @@  You will need the linux-headers and linux-source packages for this.
 The source archive will be placed in /usr/src/linux-source-<kernel-version>
 You will need to locate it and extract it to a convenient place.
 
-Now compile netmap:
+To compile:
 
     cd LINUX
-    make SRC=<path_to_kernel_source>
+    ./configure --kernel-sources=<path_to_kernel_src>
+    make
 
-2.1.2 Building netmap for kernel built from sources
+
+2.1.2 Building netmap kernel modules for kernel built from sources
 
     cd LINUX
-    make KSRC=<path_to_kernel_source>
+    ./configure --kernel-dir=<path_to_kernel_tree>
+    make
+
+
 
 2.2 Building ODP
 ----------------
 
 The default platform is linux-netmap, if you want linux-generic you need to
-specify it to configure --with-platform.
+specify it using configure --with-platform.
+
 
 The --with-sdk-install-path can be used to point to the netmap sources.
 
@@ -82,3 +94,23 @@  To configure ODP for linux-generic:
 
     make
 
+
+2.3 Inserting netmap kernel modules
+-----------------------------------
+
+In order to run linux-netmap ODP you need to insert at least the core netmap
+kernel module.
+
+    cd <netmap_dir>/LINUX
+    insmod netmap.ko
+
+To insert the optional modified drivers you first need to remove the original
+drivers, if loaded (and if not linked into the kernel). For example, if using
+igb:
+
+    cd <netmap_path>/LINUX
+    sudo rmmod igb
+    sudo insmod igb/igb.ko
+
+To restore the original drivers you should be able to use modprobe.
+
diff --git a/platform/linux-netmap/include/odp_packet_netmap.h b/platform/linux-netmap/include/odp_packet_netmap.h
index b4c523f..576385d 100644
--- a/platform/linux-netmap/include/odp_packet_netmap.h
+++ b/platform/linux-netmap/include/odp_packet_netmap.h
@@ -29,7 +29,7 @@  typedef struct {
 	size_t max_frame_len; /**< max frame len = buf_size - sizeof(pkt_hdr) */
 	size_t frame_offset; /**< frame start offset from start of pkt buf */
 	size_t buf_size; /**< size of buffer payload in 'pool' */
-	struct nm_desc_t *nm_desc;
+	struct nm_desc *nm_desc;
 	uint32_t begin;
 	uint32_t end;
 	struct netmap_ring *rxring;