diff options
Diffstat (limited to 'doc/book-enea-nfv-access-reference-guide-intel/doc/ovs.xml')
-rw-r--r-- | doc/book-enea-nfv-access-reference-guide-intel/doc/ovs.xml | 161 |
1 files changed, 0 insertions, 161 deletions
diff --git a/doc/book-enea-nfv-access-reference-guide-intel/doc/ovs.xml b/doc/book-enea-nfv-access-reference-guide-intel/doc/ovs.xml deleted file mode 100644 index fdbd692..0000000 --- a/doc/book-enea-nfv-access-reference-guide-intel/doc/ovs.xml +++ /dev/null | |||
@@ -1,161 +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 | ||
101 | <xref linkend="dpdk-setup"/> for DPDK setup instructions, then follow these steps:</para> | ||
102 | |||
103 | <orderedlist> | ||
104 | <listitem> | ||
105 | <para>Clean up the environment:</para> | ||
106 | |||
107 | <programlisting>killall ovsdb-server ovs-vswitchd | ||
108 | rm -f /var/run/openvswitch/vhost-user* | ||
109 | rm -f /etc/openvswitch/conf.db</programlisting> | ||
110 | </listitem> | ||
111 | |||
112 | <listitem> | ||
113 | <para>Start the ovsdb-server:</para> | ||
114 | |||
115 | <programlisting>export DB_SOCK=/var/run/openvswitch/db.sock | ||
116 | ovsdb-tool create /etc/openvswitch/conf.db /usr/share/openvswitch/vswitch.ovsschema | ||
117 | ovsdb-server --remote=punix:$DB_SOCK / | ||
118 | --remote=db:Open_vSwitch,Open_vSwitch,manager_options --pidfile --detach</programlisting> | ||
119 | </listitem> | ||
120 | |||
121 | <listitem> | ||
122 | <para>Start ovs-vswitchd with DPDK support enabled:</para> | ||
123 | |||
124 | <programlisting>ovs-vsctl --no-wait init | ||
125 | ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-lcore-mask=0x1 | ||
126 | ovs-vsctl --no-wait set Open_vSwitch . other_config:pmd-cpu-mask=0xc | ||
127 | ovs-vsctl --no-wait set Open_vSwitch . other_config:dpdk-init=true | ||
128 | ovs-vswitchd unix:$DB_SOCK --pidfile --detach / | ||
129 | --log-file=/var/log/openvswitch/ovs-vswitchd.log</programlisting> | ||
130 | </listitem> | ||
131 | |||
132 | <listitem> | ||
133 | <para>Create the OVS bridge and attach ports:</para> | ||
134 | |||
135 | <programlisting>ovs-vsctl add-br ovsbr0 -- set bridge ovsbr0 datapath_type=netdev | ||
136 | ovs-vsctl add-port ovsbr0 dpdk0 -- set Interface dpdk0 type=dpdk / | ||
137 | :dpdk-devargs=<PCI device></programlisting> | ||
138 | </listitem> | ||
139 | |||
140 | <listitem> | ||
141 | <para>Add DPDK vhost-user ports:</para> | ||
142 | |||
143 | <programlisting>ovs-vsctl add-port ovsbr0 vhost-user1 -- set Interface vhost-user1 type=dpdkvhostuser</programlisting> | ||
144 | |||
145 | <para>This command creates a socket at | ||
146 | <literal>/var/run/openvswitch/vhost-user1</literal>, which can be | ||
147 | provided to the VM on the QEMU command line. See <xref linkend="net_in_guest"/> for | ||
148 | details.</para> | ||
149 | </listitem> | ||
150 | |||
151 | <listitem> | ||
152 | <para>Define flows:</para> | ||
153 | |||
154 | <programlisting>ovs-ofctl del-flows ovsbr0 | ||
155 | ovs-ofctl show ovsbr0 | ||
156 | ovs-ofctl add-flow ovsbr0 in_port=1,action=output:2 | ||
157 | ovs-ofctl add-flow ovsbr0 in_port=2,action=output:1</programlisting> | ||
158 | </listitem> | ||
159 | </orderedlist> | ||
160 | </section> | ||
161 | </chapter> \ No newline at end of file | ||