From: Armin Kuster <[email protected]>

this adds netmap, the fast packet I/O framework
http://info.iet.unipi.it/~luigi/netmap/

v2:
fix config opt typo
fix compile on non x86 targets
exclude ppc and arm from builds do to issues with kernel headers

Signed-off-by: Armin Kuster <[email protected]>
---
 .../netmap/files/makefile_fixup.patch              | 79 ++++++++++++++++++++++
 .../recipes-kernel/netmap/netmap-modules_git.bb    | 51 ++++++++++++++
 meta-networking/recipes-kernel/netmap/netmap.inc   | 17 +++++
 .../recipes-kernel/netmap/netmap_git.bb            | 34 ++++++++++
 4 files changed, 181 insertions(+)
 create mode 100644 
meta-networking/recipes-kernel/netmap/files/makefile_fixup.patch
 create mode 100644 meta-networking/recipes-kernel/netmap/netmap-modules_git.bb
 create mode 100644 meta-networking/recipes-kernel/netmap/netmap.inc
 create mode 100644 meta-networking/recipes-kernel/netmap/netmap_git.bb

diff --git a/meta-networking/recipes-kernel/netmap/files/makefile_fixup.patch 
b/meta-networking/recipes-kernel/netmap/files/makefile_fixup.patch
new file mode 100644
index 0000000..e838653
--- /dev/null
+++ b/meta-networking/recipes-kernel/netmap/files/makefile_fixup.patch
@@ -0,0 +1,79 @@
+The makefile assumes building locally.
+
+Upstream Status: Inappropriate [Native]
+
+The configure is not auto-make based
+
+Signed-of-by: Armin Kuster <[email protected]>
+
+Index: LINUX/netmap.mak.in
+===================================================================
+--- a/LINUX/netmap.mak.in
++++ b/LINUX/netmap.mak.in
+@@ -12,10 +12,8 @@ SRCDIR:=@SRCDIR@
+ # The following commands are needed to build the modules as out-of-tree,
+ # in fact the kernel sources path must be specified.
+ 
+-PWD ?= $(CURDIR)
+-
+ # Additional compile flags (e.g. header location)
+-EXTRA_CFLAGS := -I$(PWD) -I$(SRCDIR) -I$(SRCDIR)/../sys 
-I$(SRCDIR)/../sys/dev -DCONFIG_NETMAP
++EXTRA_CFLAGS := -I$(SRCDIR) -I$(SRCDIR)/../sys -I$(SRCDIR)/../sys/dev 
-DCONFIG_NETMAP
+ EXTRA_CFLAGS += -Wno-unused-but-set-variable
+ EXTRA_CFLAGS += $(foreach s,$(SUBSYS),-DCONFIG_NETMAP_$(shell echo $s|tr a-z 
A-Z))
+ 
+Index: LINUX/configure
+===================================================================
+--- a/LINUX/configure
++++ b/LINUX/configure
+@@ -311,34 +311,6 @@ reset_tests() {
+       NEXTTEST=1
+ }
+ 
+-# run_tests: run all accumulated tests and exec the pertinent
+-#   success/failure actions for each one.
+-run_tests() {
+-      local t=        # prevent -EOF to eat the make TAB
+-      cat > $TMPDIR/Makefile <<-EOF
+-              ifneq (\$(KERNELRELEASE),)
+-              obj-m := $TESTOBJS
+-              else
+-              S_DRIVERS := $(drv print)
+-              all: \$(S_DRIVERS:%=get-%)
+-              $t      \$(MAKE) -C $ksrc M=\$\$PWD $kopts
+-
+-              -include $TOPDIR/drivers.mak
+-      EOF
+-      for d in $(drv print); do
+-              cat >> $TMPDIR/Makefile <<-EOF
+-                      get-$d:
+-                      $t      [ -z "\$($d-src)" ] || cp -Rp \$($d-src) \$(if 
\$($d-dst),\$($d-dst),.)
+-              EOF
+-      done
+-      echo endif >> $TMPDIR/Makefile
+-      (
+-              cd $TMPDIR
+-              make -k -j $(grep -c processor /proc/cpuinfo)
+-      ) >> config.log
+-      eval "$TESTPOSTPROC"
+-}
+-
+ configh=netmap_linux_config.h
+ # succes/failure actions are expected to write some macros
+ # in netma_linux_config.h. The following functions can be
+@@ -555,7 +527,6 @@ configuration. Please check 'config.log'
+ 
+ reset_tests
+ add_test true broken_buildsystem < /dev/null
+-run_tests
+ 
+ drvname2config() {
+       local name=$1
+@@ -1087,7 +1058,6 @@ cat > $configh <<-EOF
+ EOF
+ 
+ # the TESTPOSTPROC script will add macros to $configh
+-run_tests
+ 
+ define DRIVER_SUFFIX \"$drvsuffix\"
+ 
diff --git a/meta-networking/recipes-kernel/netmap/netmap-modules_git.bb 
b/meta-networking/recipes-kernel/netmap/netmap-modules_git.bb
new file mode 100644
index 0000000..00d334f
--- /dev/null
+++ b/meta-networking/recipes-kernel/netmap/netmap-modules_git.bb
@@ -0,0 +1,51 @@
+require netmap.inc
+
+DEPENDS = "virtual/kernel"
+do_configure[depends] += "virtual/kernel:do_shared_workdir"
+
+inherit module
+
+CLEANBROKEN = "1"
+
+export INSTALL_MOD_DIR="kernel/netmap-modules"
+
+EXTRA_OECONF = "--kernel-dir=${STAGING_KERNEL_BUILDDIR} \
+                --kernel-sources=${STAGING_KERNEL_DIR} \
+                --install-mod-path=${D} \
+                --driver-suffix="-netmap" \
+                "
+
+LDFLAGS := "${@'${LDFLAGS}'.replace('-Wl,-O1', '')}"
+LDFLAGS := "${@'${LDFLAGS}'.replace('-Wl,--as-needed', '')}"
+
+do_configure () {
+    cd ${S}/LINUX
+    ./configure ${EXTRA_OECONF}
+}
+
+do_configure_append () {
+    cat >>  ${S}/LINUX/netmap_linux_config.h <<EOF
+#define NETMAP_LINUX_HAVE_HRTIMER_MODE_REL
+#define NETMAP_LINUX_HAVE_HRTIMER_FORWARD_NOW
+#define NETMAP_LINUX_HAVE_PHYS_ADDR_T
+#define NETMAP_LINUX_HAVE_ACCESS_ONCE
+#define NETMAP_LINUX_HAVE_NETDEV_OPS
+#define NETMAP_LINUX_ALLOC_NETDEV_4ARGS
+#define NETMAP_LINUX_HAVE_INIT_NET
+#define NETMAP_LINUX_HAVE_LIVE_ADDR_CHANGE
+#define NETMAP_LINUX_HAVE_TX_SKB_SHARING
+#define NETMAP_LINUX_HAVE_UNLOCKED_IOCTL
+#define NETMAP_LINUX_HAVE_PERNET_OPS_ID
+#define NETMAP_LINUX_TIMER_RTYPE static enum hrtimer_restart
+EOF
+}
+
+do_compile () {
+    cd ${S}/LINUX
+    oe_runmake 
+}
+
+do_install () {
+    cd ${S}/LINUX
+    oe_runmake install
+}
diff --git a/meta-networking/recipes-kernel/netmap/netmap.inc 
b/meta-networking/recipes-kernel/netmap/netmap.inc
new file mode 100644
index 0000000..9083c69
--- /dev/null
+++ b/meta-networking/recipes-kernel/netmap/netmap.inc
@@ -0,0 +1,17 @@
+SUMMARY = "netmap and VALE - very fast packet I/O from userspace 
(FreeBSD/Linux)"
+DESCRIPTION= "NETMAP is a framework for very fast packet I/O from userspace.  
VALE is an equally fast in-kernel software switch using the netmap API.  Both 
are implemented as a single kernel module for FreeBSD and Linux, and can deal 
with line rate on real or emulated 10 Gbit ports."
+SECTION = "networking"
+HOMEPAGE = "http://code.google.com/p/netmap/";
+LICENSE = "GPLv2+"
+
+LIC_FILES_CHKSUM = 
"file://README;beginline=13;endline=14;md5=f64f2b172fe6903ff7b6272c6edde588"
+
+SRCREV = "a14a35b839fe7ab6855f25f1e86e306ee7ad8123"
+PV = "master+git${SRCPV}"
+
+SRC_URI = "git://github.com/luigirizzo/netmap.git"
+SRC_URI += "file://makefile_fixup.patch"
+
+S = "${WORKDIR}/git"
+
+COMPATIBLE_HOST = '(x86_64|i.86|mips|arm).*-linux'
diff --git a/meta-networking/recipes-kernel/netmap/netmap_git.bb 
b/meta-networking/recipes-kernel/netmap/netmap_git.bb
new file mode 100644
index 0000000..0ee19d4
--- /dev/null
+++ b/meta-networking/recipes-kernel/netmap/netmap_git.bb
@@ -0,0 +1,34 @@
+require netmap.inc
+
+DEPENDS = "netmap-modules"
+
+EXTRA_OECONF = "--kernel-dir=${STAGING_KERNEL_BUILDDIR} \
+                --kernel-sources=${STAGING_KERNEL_DIR} \
+                --no-drivers \
+                --disable-generic \
+                --prefix=${prefix} \
+                --destdir=${D} \
+                --cc='${CC}' \
+                --ld='${LD}' \
+                "
+
+do_fetch[depends] += "netmap-modules:do_fetch"
+
+do_configure () {
+    cd ${S}/LINUX
+    ./configure ${EXTRA_OECONF}
+}
+
+do_compile () {
+    cd ${S}/LINUX
+    make apps
+}
+
+do_install () {
+    cd ${S}/LINUX
+    make install-apps DESTDIR=${D}
+}
+
+FILES_${PN} += "${bindir}"
+RDEPENDS_${PN} = "kernel-module-netmap"
+RRECOMMENDS_${PN} = "kernel-module-netmap"
-- 
2.3.5

-- 
_______________________________________________
Openembedded-devel mailing list
[email protected]
http://lists.openembedded.org/mailman/listinfo/openembedded-devel

Reply via email to