diff mbox

[NETMAP,2/2] Update to netmap v11.1

Message ID 1415034330-29819-3-git-send-email-ciprian.barbu@linaro.org
State New
Headers show

Commit Message

Ciprian Barbu Nov. 3, 2014, 5:05 p.m. UTC
Signed-off-by: Ciprian Barbu <ciprian.barbu@linaro.org>
---
 platform/linux-netmap/README              | 22 +++++++++++++---------
 platform/linux-netmap/odp_packet_netmap.c |  7 +++++--
 platform/linux-netmap/odp_packet_netmap.h |  4 ++--
 3 files changed, 20 insertions(+), 13 deletions(-)
diff mbox

Patch

diff --git a/platform/linux-netmap/README b/platform/linux-netmap/README
index 64ee3bd..5148091 100644
--- a/platform/linux-netmap/README
+++ b/platform/linux-netmap/README
@@ -25,20 +25,18 @@  at runtime.
 2.1 Building netmap
 --------------------
 
-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.
+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
 
 Netmap consists of a core kernel module (netmap_lin.ko) and optional 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
 
@@ -56,12 +54,14 @@  You will need to locate it and extract it to a convenient place.
 Now compile netmap:
 
     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
 
     cd LINUX
-    make KSRC=<path_to_kernel_source>
+    ./configure --kernel-dir=<path_to_kernel_tree>
+    make
 
 2.2 Building ODP
 ----------------
@@ -69,13 +69,17 @@  Now compile netmap:
 The default platform is linux-netmap, if you want linux-generic you need to
 specify it to configure --with-platform.
 
+ODP works with the latest release version of netmap, which is currently at API
+version 11.1. There is one problem though, the default CFLAGS that ODP is built
+with contains -Werror=cast-qual. A temporary fix would be to disable this flag.
+
 The --with-sdk-install-path can be used to point to the netmap sources.
 
     ./bootstrap
 
-    ./configure
+    ./configure CFLAGS='-Wno-cast-qual'
 or
-    ./configure --with-sdk-install-path=<netmap>
+    ./configure --with-sdk-install-path=<netmap> CFLAGS='-Wno-cast-qual'
 
 To configure ODP for linux-generic:
     ./configure --with-platform=linux-generic
diff --git a/platform/linux-netmap/odp_packet_netmap.c b/platform/linux-netmap/odp_packet_netmap.c
index 6b9b120..2e35aec 100644
--- a/platform/linux-netmap/odp_packet_netmap.c
+++ b/platform/linux-netmap/odp_packet_netmap.c
@@ -142,8 +142,11 @@  int setup_pkt_netmap(pkt_netmap_t * const pkt_nm, const char *netdev,
 	else
 		ringid = nm_params->ringid;
 
-	strncpy(pkt_nm->ifname, netdev, sizeof(pkt_nm->ifname));
-	snprintf(ifname, sizeof(ifname), "netmap:%s", netdev);
+	snprintf(pkt_nm->ifname, sizeof(pkt_nm->ifname), "%s", netdev);
+	if (nm_params->netmap_mode == ODP_NETMAP_RING_SW)
+		snprintf(ifname, sizeof(ifname), "netmap:%s^", netdev);
+	else
+		snprintf(ifname, sizeof(ifname), "netmap:%s", netdev);
 	pkt_nm->nm_desc = nm_open(ifname, NULL, ringid, 0);
 
 	if (pkt_nm->nm_desc == NULL) {
diff --git a/platform/linux-netmap/odp_packet_netmap.h b/platform/linux-netmap/odp_packet_netmap.h
index 4b66d3d..4334b9e 100644
--- a/platform/linux-netmap/odp_packet_netmap.h
+++ b/platform/linux-netmap/odp_packet_netmap.h
@@ -32,14 +32,14 @@  typedef struct {
 	size_t frame_offset; /**< frame start offset from start of pkt buf */
 	size_t buf_size; /**< size of buffer payload in 'pool' */
 	int netmap_mode;
-	struct nm_desc_t *nm_desc;
+	struct nm_desc *nm_desc;
 	uint32_t begin;
 	uint32_t end;
 	struct netmap_ring *rxring;
 	struct netmap_ring *txring;
 	odp_queue_t tx_access; /* Used for exclusive access to send packets */
 	uint32_t if_flags;
-	char ifname[32];
+	char ifname[IFNAMSIZ];
 } pkt_netmap_t;
 
 /**