1- commit d55e43ec530094f2f2b8eb13524de74c0b208ada
2- Author: Vincenzo Maffione <v.maffione@gmail.com>
3- Date: Tue Jan 3 17:47:31 2017 +0100
4-
5- add netmap support
6-
71diff --git a/INSTALL.NETMAP b/INSTALL.NETMAP
82new file mode 100644
9- index 0000000..b3e95c2
3+ index 000000000..314531daf
104--- /dev/null
115+++ b/INSTALL.NETMAP
12- @@ -0,0 +1,46 @@
6+ @@ -0,0 +1,43 @@
137+ Using Open vSwitch with netmap (VALE)
148+ ============================
159+
1610+ Open vSwitch can use VALE, a software switch that runs in a kernel
17- + to accelerate its datapath.
11+ + to accelerate its datapath.
1812+ Thanks to efficient packet I/O based on netmap API and a novel
1913+ packet forwarding algorithm, VALE accelerates Open vSwitch datapath
2014+ by three times when forwarding short packets between 10 Gbps NICs.
@@ -27,7 +21,7 @@ index 0000000..b3e95c2
2721+
2822+ HOW TO BUILD CODE
2923+ -----------------
30- + This patch is created for Open vSwitch 2.4.0 .
24+ + This patch is created for Open vSwitch 2.6.1 .
3125+
3226+ We assume that an up-to-date version of netmap
3327+ (http://info.iet.unipi.it/~luigi/netmap/) is already installed.
@@ -53,11 +47,8 @@ index 0000000..b3e95c2
5347+ --with-netmap=/home/micchie/netmap make`
5448+
5549+ See ovs-dev.py itself for detailed information.
56- +
57- + To use netmap API 4, pass -DNETMAP_API_4 to EXTRA_CFLAGS
58- + in datapath/linux/Kbuild.in
5950diff --git a/Makefile.am b/Makefile.am
60- index 49010b3..56f4f62 100644
51+ index 49010b3b5..56f4f62ef 100644
6152--- a/Makefile.am
6253+++ b/Makefile.am
6354@@ -85,6 +85,7 @@ docs = \
@@ -69,7 +60,7 @@ index 49010b3..56f4f62 100644
6960 MAINTAINERS.md \
7061 OPENFLOW-1.1+.md \
7162diff --git a/acinclude.m4 b/acinclude.m4
72- index 2c500a8..9a792be 100644
63+ index 2c500a8d1..9a792be56 100644
7364--- a/acinclude.m4
7465+++ b/acinclude.m4
7566@@ -155,6 +155,24 @@ AC_DEFUN([OVS_CHECK_LINUX], [
@@ -98,7 +89,7 @@ index 2c500a8..9a792be 100644
9889 dnl
9990 dnl Configure DPDK source tree
10091diff --git a/configure.ac b/configure.ac
101- index da3bbae..6d6a1fd 100644
92+ index da3bbaeb4..6d6a1fdd1 100644
10293--- a/configure.ac
10394+++ b/configure.ac
10495@@ -168,6 +168,7 @@ AC_ARG_VAR(KARCH, [Kernel Architecture String])
@@ -110,7 +101,7 @@ index da3bbae..6d6a1fd 100644
110101 AC_SUBST([OVS_CFLAGS])
111102 AC_SUBST([OVS_LDFLAGS])
112103diff --git a/datapath/Modules.mk b/datapath/Modules.mk
113- index 8e9a169..bc8b651 100644
104+ index 8e9a1697a..bc8b651f1 100644
114105--- a/datapath/Modules.mk
115106+++ b/datapath/Modules.mk
116107@@ -26,7 +26,8 @@ openvswitch_sources = \
@@ -134,12 +125,29 @@ index 8e9a169..bc8b651 100644
134125
135126 openvswitch_extras = \
136127 README.md
128+ diff --git a/datapath/datapath.c b/datapath/datapath.c
129+ index db8a18a13..0352e3d83 100644
130+ --- a/datapath/datapath.c
131+ +++ b/datapath/datapath.c
132+ @@ -2378,7 +2378,11 @@ static int __init dp_init(void)
133+
134+ BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
135+
136+ - pr_info("Open vSwitch switching datapath %s\n", VERSION);
137+ + pr_info("Open vSwitch switching datapath %s"
138+ + #ifdef DEV_NETMAP
139+ + " [patched for NETMAP]"
140+ + #endif
141+ + "\n", VERSION);
142+
143+ err = compat_init();
144+ if (err)
137145diff --git a/datapath/dp-vale.c b/datapath/dp-vale.c
138146new file mode 100644
139- index 0000000..1eb553b
147+ index 000000000..c53fe34f4
140148--- /dev/null
141149+++ b/datapath/dp-vale.c
142- @@ -0,0 +1,194 @@
150+ @@ -0,0 +1,195 @@
143151+ /*
144152+ * Copyright (c) 2014 NEC Europe Ltd.
145153+ *
@@ -268,9 +276,10 @@ index 0000000..1eb553b
268276+ if (onoff && internal)
269277+ nmr.nr_arg1 = NETMAP_BDG_HOST;
270278+ error = netmap_bdg_ctl(&nmr, NULL);
279+ + D("netmap_bdg_ctl(%s, NETMAP_BDG_%s, %s) --> %d", nmr.nr_name,
280+ + onoff ? "ATTACH" : "DETACH",
281+ + internal ? "NETMAP_BDG_HOST" : "", error);
271282+ if (error) {
272- + D("failed to %s %s (internal:%d)",
273- + onoff?"attach":"detach", name, internal);
274283+ return error;
275284+ }
276285+
@@ -284,7 +293,7 @@ index 0000000..1eb553b
284293+ D("error on BDG_DETACH after BDG_REGOPS failure");
285294+ } else {
286295+ vale_dp_initialized = 1;
287- + D("datapath is registered to %s", OVS_VALE_PREFIX);
296+ + D("datapath registered to %s", OVS_VALE_PREFIX);
288297+ }
289298+
290299+ } else if (!onoff && vale_dp_initialized) { /* last interface? */
@@ -293,7 +302,7 @@ index 0000000..1eb553b
293302+ strncpy(nmr.nr_name, OVS_VALE_PREFIX, sizeof(nmr.nr_name));
294303+ if (netmap_bdg_ctl(&nmr, NULL) == ENOENT) {
295304+ vale_dp_initialized = 0;
296- + D("%s is destroyed", OVS_VALE_PREFIX);
305+ + D("%s destroyed", OVS_VALE_PREFIX);
297306+ }
298307+ }
299308+ return error;
@@ -336,7 +345,7 @@ index 0000000..1eb553b
336345+ #endif /* DEV_NETMAP */
337346diff --git a/datapath/dp-vale.h b/datapath/dp-vale.h
338347new file mode 100644
339- index 0000000..faaeb9b
348+ index 000000000..faaeb9b6a
340349--- /dev/null
341350+++ b/datapath/dp-vale.h
342351@@ -0,0 +1,67 @@
@@ -408,25 +417,24 @@ index 0000000..faaeb9b
408417+ int ovs_vale_ctl(const char *, int, int);
409418+ int ovs_vale_send(struct net_device *, struct sk_buff *skb);
410419diff --git a/datapath/linux/Kbuild.in b/datapath/linux/Kbuild.in
411- index 9e3259f..19e5933 100644
420+ index 9e3259f19..a88c33ade 100644
412421--- a/datapath/linux/Kbuild.in
413422+++ b/datapath/linux/Kbuild.in
414- @@ -13,6 +13,13 @@ ccflags-y += -I$(builddir)/..
423+ @@ -13,6 +13,12 @@ ccflags-y += -I$(builddir)/..
415424 ccflags-y += -g
416425 ccflags-y += -include $(builddir)/kcompat.h
417426
418427+ ifneq (@NETMAP_DIR@,)
419428+ NETMAP_DIR := @NETMAP_DIR@
420429+ EXTRA_CFLAGS += -I$(NETMAP_DIR) -I$(NETMAP_DIR)/LINUX -I$(NETMAP_DIR)/sys -I$(NETMAP_DIR)/sys/dev -DDEV_NETMAP -DWITH_VALE
421- + #EXTRA_CFLAGS += -I$(NETMAP_DIR) -I$(NETMAP_DIR)/sys -I$(NETMAP_DIR)/sys/dev -DDEV_NETMAP -DNETMAP_API_4
422430+ KBUILD_EXTRA_SYMBOLS = $(NETMAP_DIR)/Module.symvers
423431+ endif
424432+
425433 # These include directories have to go before -I$(KSRC)/include.
426434 # NOSTDINC_FLAGS just happens to be a variable that goes in the
427435 # right place, even though it's conceptually incorrect.
428436diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
429- index 482af37..1376a03 100644
437+ index 482af37fc..1376a0334 100644
430438--- a/datapath/vport-internal_dev.c
431439+++ b/datapath/vport-internal_dev.c
432440@@ -31,10 +31,16 @@
@@ -512,7 +520,7 @@ index 482af37..1376a03 100644
512520 struct vport *ovs_internal_dev_get_vport(struct net_device *netdev)
513521diff --git a/datapath/vport-internal_dev_netmap.h b/datapath/vport-internal_dev_netmap.h
514522new file mode 100644
515- index 0000000..2f26d90
523+ index 000000000..2f26d906b
516524--- /dev/null
517525+++ b/datapath/vport-internal_dev_netmap.h
518526@@ -0,0 +1,66 @@
@@ -583,7 +591,7 @@ index 0000000..2f26d90
583591+ /* do we need these ?*/
584592+ }
585593diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
586- index 970f7d3..bffcace 100644
594+ index 970f7d3e5..6d0c6e841 100644
587595--- a/datapath/vport-netdev.c
588596+++ b/datapath/vport-netdev.c
589597@@ -36,6 +36,9 @@
@@ -596,13 +604,18 @@ index 970f7d3..bffcace 100644
596604
597605 static struct vport_ops ovs_netdev_vport_ops;
598606
599- @@ -101,6 +104,17 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name)
607+ @@ -101,6 +104,22 @@ struct vport *ovs_netdev_link(struct vport *vport, const char *name)
600608 goto error_free_vport;
601609 }
602610
603611+ #ifdef DEV_NETMAP
604- + /* don't attach a non-netmap interface to a vale datapath */
612+ + /* We only accept interface with native netmap support.
613+ + * The emulated (generic) netmap adapter wouldn't work here,
614+ + * because registering a generic adapter uses
615+ + * netdev_rx_handler_register, which is also needed
616+ + * by OVS. */
605617+ if (!NM_NA_VALID(vport->dev)) {
618+ + D("%s: netmap generic adapter incompatible with OVS", name);
606619+ err = -EINVAL;
607620+ goto error_put;
608621+ }
@@ -614,7 +627,7 @@ index 970f7d3..bffcace 100644
614627 if (vport->dev->flags & IFF_LOOPBACK ||
615628 vport->dev->type != ARPHRD_ETHER ||
616629 ovs_is_internal_dev(vport->dev)) {
617- @@ -175,6 +189 ,9 @@ static void netdev_destroy(struct vport *vport)
630+ @@ -175,6 +194 ,9 @@ static void netdev_destroy(struct vport *vport)
618631 if (vport->dev->priv_flags & IFF_OVS_DATAPATH)
619632 ovs_netdev_detach_dev(vport);
620633 rtnl_unlock();
@@ -624,7 +637,7 @@ index 970f7d3..bffcace 100644
624637
625638 call_rcu(&vport->rcu, vport_netdev_free);
626639 }
627- @@ -209,11 +226 ,21 @@ struct vport *ovs_netdev_get_vport(struct net_device *dev)
640+ @@ -209,11 +231 ,21 @@ struct vport *ovs_netdev_get_vport(struct net_device *dev)
628641 return NULL;
629642 }
630643
@@ -648,7 +661,7 @@ index 970f7d3..bffcace 100644
648661
649662 int __init ovs_netdev_init(void)
650663diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
651- index 11965c0..4599e2b 100644
664+ index 11965c004..4599e2b87 100644
652665--- a/datapath/vport-vxlan.c
653666+++ b/datapath/vport-vxlan.c
654667@@ -30,6 +30,10 @@
@@ -689,7 +702,7 @@ index 11965c0..4599e2b 100644
689702
690703 static int __init ovs_vxlan_tnl_init(void)
691704diff --git a/datapath/vport.c b/datapath/vport.c
692- index c29f0b0..b07c340 100644
705+ index c29f0b0e5..b07c34025 100644
693706--- a/datapath/vport.c
694707+++ b/datapath/vport.c
695708@@ -39,7 +39,10 @@
@@ -720,7 +733,7 @@ index c29f0b0..b07c340 100644
720733 if (ops) {
721734 struct hlist_head *bucket;
722735diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
723- index 31621f4..8e8e135 100755
736+ index 31621f452..8e8e13566 100755
724737--- a/utilities/ovs-dev.py
725738+++ b/utilities/ovs-dev.py
726739@@ -92,6 +92,9 @@ def conf():
0 commit comments