blob: 5dcb6dd5f664f02eaa75c881d6040cef4af6f6b9 [file] [log] [blame]
Nathan Skrzypczak9ad39c02021-08-19 11:38:06 +02001Creating VPP Startup Configuration
2==================================
3
4This document describes how to create the VPP startup configuration file
5located at ``/etc/vpp/contiv-vswitch.conf``.
6
7Hardware Interface Configuration
8--------------------------------
9
10Single-NIC Configuration
11~~~~~~~~~~~~~~~~~~~~~~~~
12
13You need to configure hardware interfaces for use by VPP. First, find
14out the PCI address of the hosts network interface. On Debian-based
15distributions, you can use ``lshw``:
16
17::
18
19 sudo lshw -class network -businfo
20 Bus info Device Class Description
21 ========================================================
22 pci@0000:03:00.0 ens160 network VMXNET3 Ethernet Controller
23
24In our case, it would be the ``ens3`` interface with the PCI address
25``0000:00:03.0``
26
27Now, add or modify the VPP startup config file
28(``/etc/vpp/contiv-vswitch.conf``) to contain the proper PCI address:
29
30::
31
32 unix {
33 nodaemon
34 cli-listen /run/vpp/cli.sock
35 cli-no-pager
36 coredump-size unlimited
37 full-coredump
38 poll-sleep-usec 100
39 }
40 nat {
41 endpoint-dependent
42 }
43 dpdk {
44 dev 0000:00:03.0
45 }
46 api-trace {
47 on
48 nitems 500
49 }
50
51Multi-NIC Configuration
52~~~~~~~~~~~~~~~~~~~~~~~
53
54Similar to the single-NIC configuration, use command *lshw* to find the
55PCI addresses of all the NICs in the system, for example:
56
57::
58
59 $ sudo lshw -class network -businfo
60 Bus info Device Class Description
61 ====================================================
62 pci@0000:00:03.0 ens3 network Virtio network device
63 pci@0000:00:04.0 ens4 network Virtio network device
64
65In the example above, ``ens3`` would be the primary interface and
66``ens4`` would be the interface that would be used by VPP. The PCI
67address of the ``ens4`` interface would be ``0000:00:04.0``.
68
69Make sure the selected interface is *shut down*, otherwise VPP will not
70grab it:
71
72::
73
74 sudo ip link set ens4 down
75
76Now, add or modify the VPP startup config file in
77``/etc/vpp/contiv-vswitch.conf`` to contain the proper PCI address:
78
79::
80
81 unix {
82 nodaemon
83 cli-listen /run/vpp/cli.sock
84 cli-no-pager
85 coredump-size unlimited
86 full-coredump
87 poll-sleep-usec 100
88 }
89 nat {
90 endpoint-dependent
91 }
92 dpdk {
93 dev 0000:00:04.0
94 }
95 api-trace {
96 on
97 nitems 500
98 }
99
100If assigning multiple NICs to VPP you will need to include each NICs
101PCI address in the dpdk stanza in ``/etc/vpp/contiv-vswitch.conf``.
102
103Assigning all NICs to VPP
104^^^^^^^^^^^^^^^^^^^^^^^^^
105
106On a multi-NIC node, it is also possible to assign all NICs from the
107kernel for use by VPP. First, you need to install the STN daemon, as
108described [here][1], since you will want the NICs to revert to the
109kernel if VPP crashes.
110
111You also need to configure the NICs in the VPP startup config file in
112``/etc/vpp/contiv-vswitch.conf``. For example, to use both the primary
113and secondary NIC, in a two-NIC node, your VPP startup config file would
114look something like this:
115
116::
117
118 unix {
119 nodaemon
120 cli-listen /run/vpp/cli.sock
121 cli-no-pager
122 coredump-size unlimited
123 full-coredump
124 poll-sleep-usec 100
125 }
126 nat {
127 endpoint-dependent
128 }
129 dpdk {
130 dev 0000:00:03.0
131 dev 0000:00:04.0
132 }
133 api-trace {
134 on
135 nitems 500
136 }
137
138Installing ``lshw`` on CentOS/RedHat/Fedora
139~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
140
141Note: On CentOS/RedHat/Fedora distributions, ``lshw`` may not be
142available by default, install it by
143
144::
145
146 sudo yum -y install lshw
147
148Power-saving Mode
149-----------------
150
151In regular operation, VPP takes 100% of one CPU core at all times (poll
152loop). If high performance and low latency is not required you can
153slow-down the poll-loop and drastically reduce CPU utilization by
154adding the following stanza to the ``unix`` section of the VPP startup
155config file:
156
157::
158
159 unix {
160 ...
161 poll-sleep-usec 100
162 ...
163 }
164
165The power-saving mode is especially useful in VM-based development
166environments running on laptops or less powerful servers.
167
168VPP API Trace
169-------------
170
171To troubleshoot VPP configuration issues in production environments, it
172is strongly recommended to configure VPP API trace. This is done by
173adding the following stanza to the VPP startup config file:
174
175::
176
177 api-trace {
178 on
179 nitems 500
180 }
181
182You can set the size of the trace buffer with the attribute.
183