docs: Add VPP with iperf and trex
[vpp.git] / docs / usecases / simpleperf / iperf31.rst
1 .. _iperf31:
2
3 Using VPP with Iperf3
4 =====================
5
6 First, disable kernel IP forward in *csp2s22c03* to ensure the host cannot use
7 kernel forwarding (all the settings in *net2s22c05* and *csp2s22c04* remain unchanged):
8
9 .. code-block:: console
10
11    csp2s22c03$ echo 0 | sudo tee /proc/sys/net/ipv4/ip_forward
12    0
13    csp2s22c03$ sysctl net.ipv4.ip_forward
14    net.ipv4.ip_forward = 0
15
16 You can use DPDK’s device binding utility (./install-vpp-native/dpdk/sbin/dpdk-devbind)
17 to list network devices and bind/unbind them from specific drivers. The flag “-s/--status”
18 shows the status of devices; the flag “-b/--bind” selects the driver to bind. The
19 status of devices in our system indicates that the two 40-GbE XL710 devices are located
20 at 82:00.0 and 82:00.1. Use the device’s slots to bind them to the driver uio_pci_generic:
21
22 .. code-block:: console
23
24    csp2s22c03$ ./install-vpp-native/dpdk/sbin/dpdk-devbind -s
25    
26    Network devices using DPDK-compatible driver
27    ============================================
28    <none>
29    
30    Network devices using kernel driver
31    ===================================
32    0000:03:00.0 'Ethernet Controller 10-Gigabit X540-AT2' if=enp3s0f0 drv=ixgbe unused=vfio-pci,uio_pci_generic *Active*
33    0000:03:00.1 'Ethernet Controller 10-Gigabit X540-AT2' if=enp3s0f1 drv=ixgbe unused=vfio-pci,uio_pci_generic *Active*
34    0000:82:00.0 'Ethernet Controller XL710 for 40GbE QSFP+' if=ens802f0d1,ens802f0 drv=i40e unused=uio_pci_generic                       
35    0000:82:00.1 'Ethernet Controller XL710 for 40GbE QSFP+' if=ens802f1d1,ens802f1 drv=i40e unused=uio_pci_generic                        
36    
37    Other network devices
38    =====================
39    <none>
40    
41    csp2s22c03$ sudo modprobe uio_pci_generic
42    csp2s22c03$ sudo ./install-vpp-native/dpdk/sbin/dpdk-devbind --bind uio_pci_generic 82:00.0
43    csp2s22c03$ sudo ./install-vpp-native/dpdk/sbin/dpdk-devbind --bind uio_pci_generic 82:00.1
44
45    csp2s22c03$ sudo ./install-vpp-native/dpdk/sbin/dpdk-devbind -s
46    
47    Network devices using DPDK-compatible driver
48    ============================================
49    0000:82:00.0 'Ethernet Controller XL710 for 40GbE QSFP+' drv=uio_pci_generic unused=i40e,vfio-pci
50    0000:82:00.1 'Ethernet Controller XL710 for 40GbE QSFP+' drv=uio_pci_generic unused=i40e,vfio-pci
51    
52    Network devices using kernel driver
53    ===================================
54    0000:03:00.0 'Ethernet Controller 10-Gigabit X540-AT2' if=enp3s0f0 drv=ixgbe unused=vfio-pci,uio_pci_generic *Active*
55    0000:03:00.1 'Ethernet Controller 10-Gigabit X540-AT2' if=enp3s0f1 drv=ixgbe unused=vfio-pci,uio_pci_generic *Active*
56    
57 Start the VPP service, and verify that VPP is running:
58
59 .. code-block:: console
60
61    csp2s22c03$ sudo service vpp start
62    csp2s22c03$ ps -ef | grep vpp
63    root     105655      1 98 17:34 ?        00:00:02 /usr/bin/vpp -c /etc/vpp/startup.conf
64    :w
65             105675 105512  0 17:34 pts/4    00:00:00 grep --color=auto vpp
66    
67 To access the VPP CLI, issue the command sudo vppctl . From the VPP interface, list
68 all interfaces that are bound to DPDK using the command show interface:
69
70 VPP shows that the two 40-Gbps ports located at 82:0:0 and 82:0:1 are bound. Next,
71 you need to assign IP addresses to those interfaces, bring them up, and verify:
72
73 .. code-block:: console
74
75    vpp# set interface ip address FortyGigabitEthernet82/0/0 10.10.1.1/24
76    vpp# set interface ip address FortyGigabitEthernet82/0/1 10.10.2.1/24
77    vpp# set interface state FortyGigabitEthernet82/0/0 up
78    vpp# set interface state FortyGigabitEthernet82/0/1 up
79    vpp# show interface address
80    FortyGigabitEthernet82/0/0 (up):
81      10.10.1.1/24
82    FortyGigabitEthernet82/0/1 (up):
83      10.10.2.1/24
84    local0 (dn):
85
86 At this point VPP is operational. You can ping these interfaces either from *net2s22c05*
87 or *csp2s22c04*. Moreover, VPP can forward packets whose IP address are 10.10.1.0/24 and
88 10.10.2.0/24, so you can ping between *net2s22c05* and *csp2s22c04*. Also, you can
89 run iperf3 as illustrated in the previous example, and the result from running iperf3
90 between *net2s22c05* and *csp2s22c04* increases to 20.3 Gbits per second.
91
92 .. code-block:: console
93
94    ET2S22C05$ iperf3 -c 10.10.1.2
95    Connecting to host 10.10.1.2, port 5201
96    [  4] local 10.10.2.2 port 54078 connected to 10.10.1.2 port 5201
97    [ ID] Interval           Transfer     Bandwidth       Retr  Cwnd
98    [  4]   0.00-1.00   sec  2.02 GBytes  17.4 Gbits/sec  460   1.01 MBytes
99    [  4]   1.00-2.00   sec  3.28 GBytes  28.2 Gbits/sec    0   1.53 MBytes
100    [  4]   2.00-3.00   sec  2.38 GBytes  20.4 Gbits/sec  486    693 KBytes
101    [  4]   3.00-4.00   sec  2.06 GBytes  17.7 Gbits/sec  1099   816 KBytes
102    [  4]   4.00-5.00   sec  2.07 GBytes  17.8 Gbits/sec  614   1.04 MBytes
103    [  4]   5.00-6.00   sec  2.25 GBytes  19.3 Gbits/sec  2869   716 KBytes
104    [  4]   6.00-7.00   sec  2.26 GBytes  19.4 Gbits/sec  3321   683 KBytes
105    [  4]   7.00-8.00   sec  2.33 GBytes  20.0 Gbits/sec  2322   594 KBytes
106    [  4]   8.00-9.00   sec  2.28 GBytes  19.6 Gbits/sec  1690  1.23 MBytes
107    [  4]   9.00-10.00  sec  2.73 GBytes  23.5 Gbits/sec  573    680 KBytes
108    - - - - - - - - - - - - - - - - - - - - - - - - -
109    [ ID] Interval           Transfer     Bandwidth       Retr
110    [  4]   0.00-10.00  sec  23.7 GBytes  20.3 Gbits/sec  13434             sender
111    [  4]   0.00-10.00  sec  23.7 GBytes  20.3 Gbits/sec                  receiver
112    
113    iperf Done.
114
115 The **show run** command displays the graph runtime statistics. Observe that the
116 average vector per node is 6.76, which means on average, a vector of 6.76 packets
117 is handled in a graph node.
118
119 .. figure:: /_images/build-a-fast-network-stack-terminal.png