1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2010-2015 Intel Corporation.
4 TEP termination Sample Application
5 ==================================
7 The TEP (Tunnel End point) termination sample application simulates a VXLAN
8 Tunnel Endpoint (VTEP) termination in DPDK, which is used to demonstrate
9 the offload and filtering capabilities of Intel® XL710 10/40 Gigabit Ethernet
10 Controller for VXLAN packet.
11 This sample uses the basic virtio devices management mechanism from vhost example,
12 and also uses the us-vHost interface and tunnel filtering mechanism to direct
13 a specified traffic to a specific VM.
14 In addition, this sample is also designed to show how tunneling protocols can be handled.
19 With virtualization, overlay networks allow a network structure to be built
20 or imposed across physical nodes which is abstracted away from the actual
21 underlining physical network connections.
22 This allows network isolation, QOS, etc to be provided on a per client basis.
24 .. _figure_overlay_networking:
26 .. figure:: img/overlay_networking.*
30 In a typical setup, the network overlay tunnel is terminated at the Virtual/Tunnel End Point (VEP/TEP).
31 The TEP is normally located at the physical host level ideally in the software switch.
32 Due to processing constraints and the inevitable bottleneck that the switch
33 becomes, the ability to offload overlay support features becomes an important requirement.
34 Intel® XL710 10/40 Gigabit Ethernet network card provides hardware filtering
35 and offload capabilities to support overlay networks implementations such as MAC in UDP and MAC in GRE.
40 The DPDK TEP termination sample code demonstrates the offload and filtering
41 capabilities of Intel® XL710 10/40 Gigabit Ethernet Controller for VXLAN packet.
43 The sample code is based on vhost library.
44 The vhost library is developed for user space Ethernet switch to easily integrate with vhost functionality.
46 The sample will support the followings:
48 * Tunneling packet recognition.
50 * The port of UDP tunneling is configurable
52 * Directing incoming traffic to the correct queue based on the tunnel filter type.
53 The supported filter type are listed below.
55 * Inner MAC and VLAN and tenant ID
57 * Inner MAC and tenant ID, and Outer MAC
59 * Inner MAC and tenant ID
61 The tenant ID will be assigned from a static internal table based on the us-vhost device ID.
62 Each device will receive a unique device ID.
63 The inner MAC will be learned by the first packet transmitted from a device.
65 * Decapsulation of RX VXLAN traffic. This is a software only operation.
67 * Encapsulation of TX VXLAN traffic. This is a software only operation.
69 * Inner IP and inner L4 checksum offload.
71 * TSO offload support for tunneling packet.
73 The following figure shows the framework of the TEP termination sample
74 application based on DPDK vhost lib.
76 .. _figure_tep_termination_arch:
78 .. figure:: img/tep_termination_arch.*
80 TEP termination Framework Overview
82 Supported Distributions
83 -----------------------
85 The example in this section have been validated with the following distributions:
93 Compiling the Sample Code
94 -------------------------
96 To enable vhost, turn on vhost library in the configure file
97 ``config/common_linux``.
99 .. code-block:: console
101 CONFIG_RTE_LIBRTE_VHOST=y
103 Then following the to compile the sample application shown in
106 Running the Sample Code
107 -----------------------
109 #. Go to the examples directory:
111 .. code-block:: console
113 export RTE_SDK=/path/to/rte_sdk
114 cd ${RTE_SDK}/examples/tep_termination
116 #. Run the tep_termination sample code:
118 .. code-block:: console
120 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
121 -p 0x1 --dev-basename tep-termination --nb-devices 4
122 --udp-port 4789 --filter-type 1
126 Please note the huge-dir parameter instructs the DPDK to allocate its memory from the 2 MB page hugetlbfs.
131 **The same parameters with the vhost sample.**
133 Refer to :ref:`vhost_app_parameters` for detailed explanation.
135 **Number of Devices.**
137 The nb-devices option specifies the number of virtIO device.
138 The default value is 2.
140 .. code-block:: console
142 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
145 **Tunneling UDP port.**
147 The udp-port option is used to specify the destination UDP number for UDP tunneling packet.
148 The default value is 4789.
150 .. code-block:: console
152 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
153 --nb-devices 2 --udp-port 4789
157 The filter-type option is used to specify which filter type is used to
158 filter UDP tunneling packet to a specified queue.
159 The default value is 1, which means the filter type of inner MAC and tenant ID is used.
161 .. code-block:: console
163 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
164 --nb-devices 2 --udp-port 4789 --filter-type 1
168 The tx-checksum option is used to enable or disable the inner header checksum offload.
169 The default value is 0, which means the checksum offload is disabled.
171 .. code-block:: console
173 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
174 --nb-devices 2 --tx-checksum
176 **TCP segment size.**
178 The tso-segsz option specifies the TCP segment size for TSO offload for tunneling packet.
179 The default value is 0, which means TSO offload is disabled.
181 .. code-block:: console
183 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
184 --tx-checksum --tso-segsz 800
186 **Decapsulation option.**
188 The decap option is used to enable or disable decapsulation operation for received VXLAN packet.
189 The default value is 1.
191 .. code-block:: console
193 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
194 --nb-devices 4 --udp-port 4789 --decap 1
196 **Encapsulation option.**
198 The encap option is used to enable or disable encapsulation operation for transmitted packet.
199 The default value is 1.
201 .. code-block:: console
203 user@target:~$ ./build/app/tep_termination -l 0-3 -n 4 --huge-dir /mnt/huge --
204 --nb-devices 4 --udp-port 4789 --encap 1
207 Running the Virtual Machine (QEMU)
208 ----------------------------------
210 Refer to :ref:`vhost_app_run_vm`.
212 Running DPDK in the Virtual Machine
213 -----------------------------------
215 Refer to :ref:`vhost_app_run_dpdk_inside_guest`.
217 Passing Traffic to the Virtual Machine Device
218 ---------------------------------------------
220 For a virtio-net device to receive traffic, the traffic's Layer 2 header must include
221 both the virtio-net device's MAC address.
222 The DPDK sample code behaves in a similar manner to a learning switch in that
223 it learns the MAC address of the virtio-net devices from the first transmitted packet.
224 On learning the MAC address,
225 the DPDK vhost sample code prints a message with the MAC address and tenant ID virtio-net device.
228 .. code-block:: console
230 DATA: (0) MAC_ADDRESS cc:bb:bb:bb:bb:bb and VNI 1000 registered
232 The above message indicates that device 0 has been registered with MAC address cc:bb:bb:bb:bb:bb and VNI 1000.
233 Any packets received on the NIC with these values are placed on the devices receive queue.