summaryrefslogtreecommitdiffstats
path: root/doc/book-enea-nfv-access-guide/doc/ovs.xml
diff options
context:
space:
mode:
Diffstat (limited to 'doc/book-enea-nfv-access-guide/doc/ovs.xml')
-rw-r--r--doc/book-enea-nfv-access-guide/doc/ovs.xml162
1 files changed, 0 insertions, 162 deletions
diff --git a/doc/book-enea-nfv-access-guide/doc/ovs.xml b/doc/book-enea-nfv-access-guide/doc/ovs.xml
deleted file mode 100644
index de14f76..0000000
--- a/doc/book-enea-nfv-access-guide/doc/ovs.xml
+++ /dev/null
@@ -1,162 +0,0 @@
1<?xml version="1.0" encoding="ISO-8859-1"?>
2<!DOCTYPE chapter PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
3"http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
4<chapter id="ovs">
5 <title>Open Virtual Switch</title>
6
7 <para>Open vSwitch (OVS) is an open-source multilayer virtual switch
8 designed to be used in virtualized environments to forward traffic between
9 different VMs on the same host, and also between VMs and the physical
10 network.</para>
11
12 <para>Native OVS forwarding is handled by two major components: a user-space
13 daemon called <literal>ovs-vswitchd</literal> and a
14 <literal>fastpath</literal> kernel module used to accelerate the data path.
15 The fastpath kernel module will handle packets received on the NIC by simply
16 consulting a flow table with corresponding action rules (e.g to forward the
17 packet or modify its headers). If no matching entry is found in the flow
18 table, the packet is copied to the user-space and sent to the ovs-vswitchd
19 deamon which determines how it should be handled ("slowpath").</para>
20
21 <para>The packet is then passed back to the kernel module together with the
22 desired action and the flow table is updated, so that subsequent packets in
23 the same flow can be handled in fastpath without any user-space interaction.
24 In this way, OVS eliminates a lot of the context switching between
25 kernel-space and user-space, but the throughput is still limited by the
26 capacity of the Linux kernel stack.</para>
27
28 <section id="ovs-dpdk">
29 <title>OVS-DPDK</title>
30
31 <para>To improve performance, OVS supports integration with Intel DPDK
32 libraries to operate entirely in user-space (OVS-DPDK). DPDK Poll Mode
33 Drivers (PMDs) enable direct transfers of packets between the physical NIC
34 and user-space, thereby eliminating the overhead of interrupt handling and
35 Linux kernel network stack processing. OVS-DPDK provides DPDK-backed
36 vhost-user ports as the primary way to connect guests to this datapath.
37 The vhost-user interfaces are transparent to the guest.</para>
38 </section>
39
40 <section id="ovs-commands">
41 <title>OVS commands</title>
42
43 <para>OVS provides a rich set of command line management tools, most
44 importantly:</para>
45
46 <itemizedlist>
47 <listitem>
48 <para>ovs-vsctl: Used to manage and inspect switch configurations,
49 e.g. to create bridges and to add/remove ports.</para>
50 </listitem>
51
52 <listitem>
53 <para>ovs-ofctl: Used to configure and monitor flows.</para>
54 </listitem>
55 </itemizedlist>
56
57 <para>For more information about Open vSwitch, see <ulink
58 url="http://openvswitch.org">http://openvswitch.org</ulink>.</para>
59 </section>
60
61 <section id="config-ovs-dpdk">
62 <title>Configuring OVS-DPDK for improved performance</title>
63
64 <section id="dpdk-lcore-mask">
65 <title>dpdk-lcore-mask</title>
66
67 <para>Specifies the CPU core affinity for DPDK lcore threads. The lcore
68 threads are used for DPDK library tasks. For performance it is best to
69 set this to a single core on the system, and it should not overlap the
70 pmd-cpu-mask, as seen in the example below.</para>
71
72 <para>Example: To use core 1:</para>
73
74 <programlisting>ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=0x1</programlisting>
75 </section>
76
77 <section id="pmd-cpu-mask">
78 <title>pmd-cpu-mask</title>
79
80 <para>The DPDK PMD threads polling for incoming packets are CPU bound
81 and should be pinned to isolated cores for optimal performance.</para>
82
83 <para>If OVS-DPDK receives traffic on multiple ports, for example when
84 DPDK and vhost-user ports are used for bi-directional traffic, the
85 performance can be significantly improved by creating multiple PMD
86 threads and affinitizing them to separate cores in order to share the
87 workload, by each being responsible for an individual port. The cores
88 should not be hyperthreads on the same CPU.</para>
89
90 <para>The PMD core affinity is specified by setting an appropriate core
91 mask. Example: using cores 2 and 3:</para>
92
93 <programlisting>ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0xc</programlisting>
94 </section>
95 </section>
96
97 <section id="setup-ovs-dpdk">
98 <title>How to set up OVS-DPDK</title>
99
100 <para>The DPDK must be configured prior to setting up OVS-DPDK. See <xref
101 linkend="dpdk-setup" /> for DPDK setup instructions, then follow these
102 steps:</para>
103
104 <orderedlist>
105 <listitem>
106 <para>Clean up the environment:</para>
107
108 <programlisting>killall ovsdb-server ovs-vswitchd
109rm -f /var/run/openvswitch/vhost-user*
110rm -f /etc/openvswitch/conf.db</programlisting>
111 </listitem>
112
113 <listitem>
114 <para>Start the ovsdb-server:</para>
115
116 <programlisting>export DB_SOCK=/var/run/openvswitch/db.sock
117ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema
118ovsdb-server --remote=punix:$DB_SOCK \
119--remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detach</programlisting>
120 </listitem>
121
122 <listitem>
123 <para>Start ovs-vswitchd with DPDK support enabled:</para>
124
125 <programlisting>ovs-vsctl --no-wait init
126ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=0x1
127ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0xc
128ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true
129ovs-vswitchd unix:$DB_SOCK --pidfile --detach \
130--log-file=/var/log/openvswitch/ovs-vswitchd.log</programlisting>
131 </listitem>
132
133 <listitem>
134 <para>Create the OVS bridge and attach ports:</para>
135
136 <programlisting>ovs-vsctl add-br ovsbr0 -- set bridge ovsbr0 datapath_type=netdev
137ovs-vsctl add-port ovsbr0 dpdk0 -- set Interface dpdk0 type=dpdk \
138:dpdk-devargs=&lt;PCI device&gt;</programlisting>
139 </listitem>
140
141 <listitem>
142 <para>Add DPDK vhost-user ports:</para>
143
144 <programlisting>ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuser</programlisting>
145
146 <para>This command creates a socket at
147 <literal>/var/run/openvswitch/vhost-user1</literal>, which can be
148 provided to the VM on the QEMU command line. See <xref
149 linkend="net_in_guest" /> for details.</para>
150 </listitem>
151
152 <listitem>
153 <para>Define flows:</para>
154
155 <programlisting>ovs-ofctl del-flows ovsbr0
156ovs-ofctl show ovsbr0
157ovs-ofctl add-flow ovsbr0 in_port=1,action=output:2
158ovs-ofctl add-flow ovsbr0 in_port=2,action=output:1</programlisting>
159 </listitem>
160 </orderedlist>
161 </section>
162</chapter> \ No newline at end of file