1- From 6e4cf6d3f2d096cefa7af66e511769b027979a51 Mon Sep 17 00:00:00 2001
2- From: Michio Honda <micchie@sfc.wide.ad.jp>
3- Date: Fri, 22 Aug 2014 17:25:29 +0200
4- Subject: [PATCH] datapath: Add support for netmap/VALE
5-
6- This patch implements a datapath that exploits a VALE software
7- switch at packet I/O and switching.
8-
9- This is tested with packet forwarding between two native netmap-mode
10- NICs and it accelerates packet forwarding rates by approx. 3 times.
11- ---
12- INSTALL.NETMAP | 46 +++++++++
13- Makefile.am | 1 +
14- acinclude.m4 | 18 ++++
15- configure.ac | 1 +
16- datapath/Modules.mk | 3 +-
17- datapath/dp-vale.c | 193 +++++++++++++++++++++++++++++++++++
18- datapath/dp-vale.h | 67 ++++++++++++
19- datapath/linux/Kbuild.in | 7 ++
20- datapath/vport-internal_dev.c | 33 +++++-
21- datapath/vport-internal_dev_netmap.h | 66 ++++++++++++
22- datapath/vport-netdev.c | 21 ++++
23- datapath/vport-vxlan.c | 7 ++
24- datapath/vport.c | 12 +++
25- utilities/ovs-dev.py | 5 +
26- 14 files changed, 477 insertions(+), 3 deletions(-)
27- create mode 100644 INSTALL.NETMAP
28- create mode 100644 datapath/dp-vale.c
29- create mode 100644 datapath/dp-vale.h
30- create mode 100644 datapath/vport-internal_dev_netmap.h
31-
321diff --git a/INSTALL.NETMAP b/INSTALL.NETMAP
332new file mode 100644
34- index 0000000..b3e95c2
3+ index 000000000..57d796715
354--- /dev/null
365+++ b/INSTALL.NETMAP
37- @@ -0,0 +1,46 @@
6+ @@ -0,0 +1,95 @@
387+ Using Open vSwitch with netmap (VALE)
398+ ============================
409+
4110+ Open vSwitch can use VALE, a software switch that runs in a kernel
42- + to accelerate its datapath.
11+ + to accelerate its datapath.
4312+ Thanks to efficient packet I/O based on netmap API and a novel
4413+ packet forwarding algorithm, VALE accelerates Open vSwitch datapath
4514+ by three times when forwarding short packets between 10 Gbps NICs.
4615+ This file explains how to install and use the Open vSwitch with VALE.
4716+
48- + The VALE support of Open vSwitch is experimental.
49- + It has not been throughly tested.
17+ + The VALE support for Open vSwitch is ** experimental**: it has not
18+ + been throughly tested.
5019+ It currently supports only netdev (including internal one) and VXLAN
51- + vport types.
20+ + vport types.
5221+
5322+ HOW TO BUILD CODE
5423+ -----------------
55- + This patch is created for Open vSwitch 2.4.0 .
24+ + This patch applies to Open vSwitch 2.4.1 .
5625+
5726+ We assume that an up-to-date version of netmap
58- + (http ://info.iet.unipi.it/~luigi /netmap/ ) is already installed.
27+ + (https ://github.com/luigirizzo /netmap) is already installed.
5928+
6029+ Installation steps are same with one written in a file INSTALL,
61- + except for specifying a path to netmap source in configure process:
30+ + except for specifying a path to netmap source in configure process:
6231+
63- + * `./configure --with-netmap=/home/micchie /netmap`
32+ + * `./configure --with-netmap=/path/to /netmap/repo `
6433+
6534+ This is necessary because the VALE-accelerated version of
6635+ Open vswitch datapath (kernel module) leverages utility functions
67- + provided by netmap (defined in
68- + sys/dev/netmap/netmap_kern.h, sys/net/netmap.h etc.),
69- + and refers to symbols exported from a netmap kernel module
70- + (LINUX/Module.symvers).
36+ + provided by netmap (defined in sys/dev/netmap/netmap_kern.h,
37+ + sys/net/netmap.h etc.), and refers to symbols exported from a
38+ + netmap kernel module (LINUX/Module.symvers).
7139+
72- + Thus, you need to have compiled the netmap kernel module but don't need
73- + to have loaded it before running the Open vSwitch.
40+ + Before being able to build OVS, therefore, you need to build netmap.
7441+
75- + To quickly build and run, ovs-dev.py script can also be used like :
42+ + To quickly build and run, ovs-dev.py script can also be used:
7643+
7744+ * `python utilities/ovs-dev.py env && python utilities/ovs-dev.py conf \
78- + --with-netmap=/home/micchie /netmap make`
45+ + --with-netmap=/path/to /netmap/repo make`
7946+
8047+ See ovs-dev.py itself for detailed information.
8148+
82- + To use netmap API 4, pass -DNETMAP_API_4 to EXTRA_CFLAGS
83- + in datapath/linux/Kbuild.in
49+ +
50+ + HOW TO TRY THE PATCHED OVS
51+ + --------------------------
52+ +
53+ + (1) Load netmap openvswitch kernel modules (assuming you have installed netmap
54+ + and openvswitch system-wide)
55+ +
56+ + # modprobe netmap
57+ + # modprobe openvswitch
58+ +
59+ + (2) Run the openvswitch deamon. This step may be performed differently on
60+ + different distributions. Refer to the OVS documentation.
61+ +
62+ + (3) Create an OVS bridge:
63+ +
64+ + # ovs-vsctl add-br vale0
65+ +
66+ + (4) Create two persistent VALE ports:
67+ +
68+ + # vale-ctl -n vi0
69+ + # vale-ctl -n vi1
70+ +
71+ + (5) Attach the two ports to the bridge:
72+ +
73+ + # ovs-vsctl add-port vale0 vi0
74+ + # ovs-vsctl add-port vale0 vi1
75+ +
76+ + (6) Add some OpenFlow rules, to forward traffic betweeen vi0 and vi1
77+ + (assuming the port identifiers are 1 and 2):
78+ +
79+ + # ovs-ofctl add-flow vale0 in_port=1,actions=output:2
80+ + # ovs-ofctl add-flow vale0 in_port=2,actions=output:1
81+ +
82+ + (7) Bring the various interfaces up:
83+ +
84+ + # ip link set vi0 up
85+ + # ip link set vi1 up
86+ + # ip link set vale0 up
87+ +
88+ + (8) Run pkt-gen in receive mode on vi0:
89+ +
90+ + # pkt-gen -i vi0 -f rx
91+ +
92+ + (9) On a different terminal, run pkt-gen in transmit mode on vi1:
93+ +
94+ + # pkt-gen -i vi1 -f tx
95+ +
96+ + (10) You should see traffic received by the receiving pkt-gen.
97+ + You can also attach other interfaces to the switches, provided
98+ + they have netmap support (e.g. Intel NIC veth interfaces,
99+ + etc.):
100+ +
101+ + # ovs-vsctl add-port vale0 eth2
84102diff --git a/Makefile.am b/Makefile.am
85- index 59a1466..1f59e74 100644
103+ index 59a14667d..1f59e74fa 100644
86104--- a/Makefile.am
87105+++ b/Makefile.am
88106@@ -87,6 +87,7 @@ docs = \
@@ -94,7 +112,7 @@ index 59a1466..1f59e74 100644
94112 OPENFLOW-1.1+.md \
95113 PORTING.md \
96114diff --git a/acinclude.m4 b/acinclude.m4
97- index 45cfaf6..ef668f4 100644
115+ index 45cfaf660..ef668f410 100644
98116--- a/acinclude.m4
99117+++ b/acinclude.m4
100118@@ -159,6 +159,24 @@ AC_DEFUN([OVS_CHECK_LINUX], [
@@ -123,7 +141,7 @@ index 45cfaf6..ef668f4 100644
123141 dnl
124142 dnl Configure DPDK source tree
125143diff --git a/configure.ac b/configure.ac
126- index e6a23a6..8ff2397 100644
144+ index e6a23a692..8ff23972d 100644
127145--- a/configure.ac
128146+++ b/configure.ac
129147@@ -164,6 +164,7 @@ AC_ARG_VAR(KARCH, [Kernel Architecture String])
@@ -135,7 +153,7 @@ index e6a23a6..8ff2397 100644
135153 AC_SUBST([OVS_CFLAGS])
136154 AC_SUBST([OVS_LDFLAGS])
137155diff --git a/datapath/Modules.mk b/datapath/Modules.mk
138- index 8dc3415..f5d4a26 100644
156+ index 8dc3415c6..f5d4a2682 100644
139157--- a/datapath/Modules.mk
140158+++ b/datapath/Modules.mk
141159@@ -25,7 +25,8 @@ openvswitch_sources = \
@@ -148,9 +166,26 @@ index 8dc3415..f5d4a26 100644
148166
149167 vport_geneve_sources = vport-geneve.c
150168 vport_vxlan_sources = vport-vxlan.c
169+ diff --git a/datapath/datapath.c b/datapath/datapath.c
170+ index 3c97b86df..c0307dd22 100644
171+ --- a/datapath/datapath.c
172+ +++ b/datapath/datapath.c
173+ @@ -2270,7 +2270,11 @@ static int __init dp_init(void)
174+
175+ BUILD_BUG_ON(sizeof(struct ovs_skb_cb) > FIELD_SIZEOF(struct sk_buff, cb));
176+
177+ - pr_info("Open vSwitch switching datapath %s\n", VERSION);
178+ + pr_info("Open vSwitch switching datapath %s"
179+ + #ifdef DEV_NETMAP
180+ + " [patched for NETMAP]"
181+ + #endif
182+ + "\n", VERSION);
183+
184+ err = action_fifos_init();
185+ if (err)
151186diff --git a/datapath/dp-vale.c b/datapath/dp-vale.c
152187new file mode 100644
153- index 0000000..41cb433
188+ index 000000000..41cb43337
154189--- /dev/null
155190+++ b/datapath/dp-vale.c
156191@@ -0,0 +1,193 @@
@@ -349,7 +384,7 @@ index 0000000..41cb433
349384+ #endif /* DEV_NETMAP */
350385diff --git a/datapath/dp-vale.h b/datapath/dp-vale.h
351386new file mode 100644
352- index 0000000..3ace110
387+ index 000000000..3ace110ce
353388--- /dev/null
354389+++ b/datapath/dp-vale.h
355390@@ -0,0 +1,67 @@
@@ -421,7 +456,7 @@ index 0000000..3ace110
421456+ int ovs_vale_ctl(const char *, int, int);
422457+ int ovs_vale_send(struct net_device *, struct sk_buff *skb);
423458diff --git a/datapath/linux/Kbuild.in b/datapath/linux/Kbuild.in
424- index 9e3259f..c5ab75a 100644
459+ index 9e3259f19..c5ab75a81 100644
425460--- a/datapath/linux/Kbuild.in
426461+++ b/datapath/linux/Kbuild.in
427462@@ -13,6 +13,13 @@ ccflags-y += -I$(builddir)/..
@@ -439,7 +474,7 @@ index 9e3259f..c5ab75a 100644
439474 # NOSTDINC_FLAGS just happens to be a variable that goes in the
440475 # right place, even though it's conceptually incorrect.
441476diff --git a/datapath/vport-internal_dev.c b/datapath/vport-internal_dev.c
442- index f38f9be..f5b7915 100644
477+ index f38f9be07..f5b7915a0 100644
443478--- a/datapath/vport-internal_dev.c
444479+++ b/datapath/vport-internal_dev.c
445480@@ -33,10 +33,16 @@
@@ -528,7 +563,7 @@ index f38f9be..f5b7915 100644
528563 struct vport *ovs_internal_dev_get_vport(struct net_device *netdev)
529564diff --git a/datapath/vport-internal_dev_netmap.h b/datapath/vport-internal_dev_netmap.h
530565new file mode 100644
531- index 0000000..bab25c7
566+ index 000000000..bab25c7c9
532567--- /dev/null
533568+++ b/datapath/vport-internal_dev_netmap.h
534569@@ -0,0 +1,66 @@
@@ -599,7 +634,7 @@ index 0000000..bab25c7
599634+ /* do we need these ?*/
600635+ }
601636diff --git a/datapath/vport-netdev.c b/datapath/vport-netdev.c
602- index de85087..769e1cc 100644
637+ index de8508756..769e1cc64 100644
603638--- a/datapath/vport-netdev.c
604639+++ b/datapath/vport-netdev.c
605640@@ -34,6 +34,9 @@
@@ -652,7 +687,7 @@ index de85087..769e1cc 100644
652687
653688 return len;
654689diff --git a/datapath/vport-vxlan.c b/datapath/vport-vxlan.c
655- index eff7ca2..87d087c 100644
690+ index eff7ca23c..87d087cc1 100644
656691--- a/datapath/vport-vxlan.c
657692+++ b/datapath/vport-vxlan.c
658693@@ -43,6 +43,9 @@
@@ -677,7 +712,7 @@ index eff7ca2..87d087c 100644
677712 /* Route lookup */
678713 saddr = tun_key->ipv4_src;
679714diff --git a/datapath/vport.c b/datapath/vport.c
680- index 4486d06..86fc1de 100644
715+ index 4486d06cd..86fc1de4f 100644
681716--- a/datapath/vport.c
682717+++ b/datapath/vport.c
683718@@ -35,7 +35,10 @@
@@ -708,7 +743,7 @@ index 4486d06..86fc1de 100644
708743 if (ops) {
709744 struct hlist_head *bucket;
710745diff --git a/utilities/ovs-dev.py b/utilities/ovs-dev.py
711- index 8128b08..34f8944 100755
746+ index 8128b08f9..34f894406 100755
712747--- a/utilities/ovs-dev.py
713748+++ b/utilities/ovs-dev.py
714749@@ -79,6 +79,9 @@ def conf():
@@ -730,6 +765,3 @@ index 8128b08..34f8944 100755
730765 parser.add_option_group(group)
731766
732767 group = optparse.OptionGroup(parser, "Optimization Flags")
733- - -
734- 2.5.4 (Apple Git-61)
735-
0 commit comments