New upstream version 18.02
[deb_dpdk.git] / doc / guides / howto / vfd.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2017 Intel Corporation.
3
4 VF daemon (VFd)
5 ===============
6
7 VFd (the VF daemon) is a mechanism which can be used to configure features on
8 a VF (SR-IOV Virtual Function) without direct access to the PF (SR-IOV
9 Physical Function). VFd is an *EXPERIMENTAL* feature which can only be used in
10 the scenario of DPDK PF with a DPDK VF. If the PF port is driven by the Linux
11 kernel driver then the VFd feature will not work. Currently VFd is only
12 supported by the ixgbe and i40e drivers.
13
14 In general VF features cannot be configured directly by an end user
15 application since they are under the control of the PF. The normal approach to
16 configuring a feature on a VF is that an application would call the APIs
17 provided by the VF driver. If the required feature cannot be configured by the
18 VF directly (the most common case) the VF sends a message to the PF through
19 the mailbox on ixgbe and i40e. This means that the availability of the feature
20 depends on whether the appropriate mailbox messages are defined.
21
22 DPDK leverages the mailbox interface defined by the Linux kernel driver so
23 that compatibility with the kernel driver can be guaranteed. The downside of
24 this approach is that the availability of messages supported by the kernel
25 become a limitation when the user wants to configure features on the VF.
26
27 VFd is a new method of controlling the features on a VF. The VF driver doesn't
28 talk directly to the PF driver when configuring a feature on the VF. When a VF
29 application (i.e., an application using the VF ports) wants to enable a VF
30 feature, it can send a message to the PF application (i.e., the application
31 using the PF port, which can be the same as the VF application). The PF
32 application will configure the feature for the VF. Obviously, the PF
33 application can also configure the VF features without a request from the VF
34 application.
35
36 .. _VF_daemon_overview:
37
38 .. figure:: img/vf_daemon_overview.*
39
40    VF daemon (VFd) Overview
41
42 Compared with the traditional approach the VFd moves the negotiation between
43 VF and PF from the driver level to application level. So the application
44 should define how the negotiation between the VF and PF works, or even if the
45 control should be limited to the PF.
46
47 It is the application's responsibility to use VFd. Consider for example a KVM
48 migration, the VF application may transfer from one VM to another. It is
49 recommended in this case that the PF control the VF features without
50 participation from the VF. Then the VF application has no capability to
51 configure the features. So the user doesn't need to define the interface
52 between the VF application and the PF application. The service provider should
53 take the control of all the features.
54
55 The following sections describe the VFd functionality.
56
57 .. Note::
58
59    Although VFd is supported by both ixgbe and i40e, please be aware that
60    since the hardware capability is different, the functions supported by
61    ixgbe and i40e are not the same.
62
63
64 Preparing
65 ---------
66
67 VFd only can be used in the scenario of DPDK PF + DPDK VF. Users should bind
68 the PF port to ``igb_uio``, then create the VFs based on the DPDK PF host.
69
70 The typical procedure to achieve this is as follows:
71
72 #. Boot the system without iommu, or with ``iommu=pt``.
73
74 #. Bind the PF port to ``igb_uio``, for example::
75
76       dpdk-devbind.py -b igb_uio 01:00.0
77
78 #. Create a Virtual Function::
79
80       echo 1 > /sys/bus/pci/devices/0000:01:00.0/max_vfs
81
82 #. Start a VM with the new VF port bypassed to it.
83
84 #. Run a DPDK application on the PF in the host::
85
86       testpmd -l 0-7 -n 4 -- -i --txqflags=0
87
88 #. Bind the VF port to ``igb_uio`` in the VM::
89
90       dpdk-devbind.py -b igb_uio 03:00.0
91
92 #. Run a DPDK application on the VF in the VM::
93
94       testpmd -l 0-7 -n 4 -- -i --txqflags=0
95
96
97 Common functions of IXGBE and I40E
98 ----------------------------------
99
100 The following sections show how to enable PF/VF functionality based on the
101 above testpmd setup.
102
103
104 TX loopback
105 ~~~~~~~~~~~
106
107 Run a testpmd runtime command on the PF to set TX loopback::
108
109    set tx loopback 0 on|off
110
111 This sets whether the PF port and all the VF ports that belong to it are
112 allowed to send the packets to other virtual ports.
113
114 Although it is a VFd function, it is the global setting for the whole
115 physical port. When using this function, the PF and all the VFs TX loopback
116 will be enabled/disabled.
117
118
119 VF MAC address setting
120 ~~~~~~~~~~~~~~~~~~~~~~
121
122 Run a testpmd runtime command on the PF to set the MAC address for a VF port::
123
124    set vf mac addr 0 0 A0:36:9F:7B:C3:51
125
126 This testpmd runtime command will change the MAC address of the VF port to
127 this new address. If any other addresses are set before, they will be
128 overwritten.
129
130
131 VF MAC anti-spoofing
132 ~~~~~~~~~~~~~~~~~~~~
133
134 Run a testpmd runtime command on the PF to enable/disable the MAC
135 anti-spoofing for a VF port::
136
137    set vf mac antispoof 0 0 on|off
138
139 When enabling the MAC anti-spoofing, the port will not forward packets whose
140 source MAC address is not the same as the port.
141
142
143 VF VLAN anti-spoofing
144 ~~~~~~~~~~~~~~~~~~~~~
145
146 Run a testpmd runtime command on the PF to enable/disable the VLAN
147 anti-spoofing for a VF port::
148
149    set vf vlan antispoof 0 0 on|off
150
151 When enabling the VLAN anti-spoofing, the port will not send packets whose
152 VLAN ID does not belong to VLAN IDs that this port can receive.
153
154
155 VF VLAN insertion
156 ~~~~~~~~~~~~~~~~~
157
158 Run a testpmd runtime command on the PF to set the VLAN insertion for a VF
159 port::
160
161    set vf vlan insert 0 0 1
162
163 When using this testpmd runtime command, an assigned VLAN ID can be inserted
164 to the transmitted packets by the hardware.
165
166 The assigned VLAN ID can be 0. It means disabling the VLAN insertion.
167
168
169 VF VLAN stripping
170 ~~~~~~~~~~~~~~~~~
171
172 Run a testpmd runtime command on the PF to enable/disable the VLAN stripping
173 for a VF port::
174
175    set vf vlan stripq 0 0 on|off
176
177 This testpmd runtime command is used to enable/disable the RX VLAN stripping
178 for a specific VF port.
179
180
181 VF VLAN filtering
182 ~~~~~~~~~~~~~~~~~
183
184 Run a testpmd runtime command on the PF to set the VLAN filtering for a VF
185 port::
186
187    rx_vlan add 1 port 0 vf 1
188    rx_vlan rm  1 port 0 vf 1
189
190 These two testpmd runtime commands can be used to add or remove the VLAN
191 filter for several VF ports. When the VLAN filters are added only the packets
192 that have the assigned VLAN IDs can be received. Other packets will be dropped
193 by hardware.
194
195
196 The IXGBE specific VFd functions
197 --------------------------------
198
199 The functions in this section are specific to the ixgbe driver.
200
201
202 All queues drop
203 ~~~~~~~~~~~~~~~
204
205 Run a testpmd runtime command on the PF to enable/disable the all queues
206 drop::
207
208    set all queues drop on|off
209
210 This is a global setting for the PF and all the VF ports of the physical port.
211
212 Enabling the ``all queues drop`` feature means that when there is no available
213 descriptor for the received packets they are dropped. The ``all queues drop``
214 feature should be enabled in SR-IOV mode to avoid one queue blocking others.
215
216
217 VF packet drop
218 ~~~~~~~~~~~~~~
219
220 Run a testpmd runtime command on the PF to enable/disable the packet drop for
221 a specific VF::
222
223    set vf split drop 0 0 on|off
224
225 This is a similar function as ``all queues drop``. The difference is that this
226 function is per VF setting and the previous function is a global setting.
227
228
229 VF rate limit
230 ~~~~~~~~~~~~~
231
232 Run a testpmd runtime command on the PF to all queues' rate limit for a
233 specific VF::
234
235    set port 0 vf 0 rate 10 queue_mask 1
236
237 This is a function to set the rate limit for all the queues in the
238 ``queue_mask`` bitmap. It is not used to set the summary of the rate
239 limit. The rate limit of every queue will be set equally to the assigned rate
240 limit.
241
242
243 VF RX enabling
244 ~~~~~~~~~~~~~~
245
246 Run a testpmd runtime command on the PF to enable/disable packet receiving for
247 a specific VF::
248
249    set port 0 vf 0 rx on|off
250
251 This function can be used to stop/start packet receiving on a VF.
252
253
254 VF TX enabling
255 ~~~~~~~~~~~~~~
256
257 Run a testpmd runtime command on the PF to enable/disable packet transmitting
258 for a specific VF::
259
260    set port 0 vf 0 tx on|off
261
262 This function can be used to stop/start packet transmitting on a VF.
263
264
265 VF RX mode setting
266 ~~~~~~~~~~~~~~~~~~
267
268 Run a testpmd runtime command on the PF to set the RX mode for a specific VF::
269
270    set port 0 vf 0 rxmode AUPE|ROPE|BAM|MPE on|off
271
272 This function can be used to enable/disable some RX modes on the VF, including:
273
274 * If it accept untagged packets.
275 * If it accepts packets matching the MAC filters.
276 * If it accept MAC broadcast packets,
277 * If it enables MAC multicast promiscuous mode.
278
279
280 The I40E specific VFd functions
281 -------------------------------
282
283 The functions in this section are specific to the i40e driver.
284
285
286 VF statistics
287 ~~~~~~~~~~~~~
288
289 This provides an API to get the a specific VF's statistic from PF.
290
291
292 VF statistics resetting
293 ~~~~~~~~~~~~~~~~~~~~~~~
294
295 This provides an API to rest the a specific VF's statistic from PF.
296
297
298 VF link status change notification
299 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
300
301 This provide an API to let a specific VF know if the physical link status
302 changed.
303
304 Normally if a VF received this notification, the driver should notify the
305 application to reset the VF port.
306
307
308 VF MAC broadcast setting
309 ~~~~~~~~~~~~~~~~~~~~~~~~
310
311 Run a testpmd runtime command on the PF to enable/disable MAC broadcast packet
312 receiving for a specific VF::
313
314    set vf broadcast 0 0 on|off
315
316
317 VF MAC multicast promiscuous mode
318 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
319
320 Run a testpmd runtime command on the PF to enable/disable MAC multicast
321 promiscuous mode for a specific VF::
322
323    set vf allmulti 0 0 on|off
324
325
326 VF MAC unicast promiscuous mode
327 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
328
329 Run a testpmd runtime command on the PF to enable/disable MAC unicast
330 promiscuous mode for a specific VF::
331
332    set vf promisc 0 0 on|off
333
334
335 VF max bandwidth
336 ~~~~~~~~~~~~~~~~
337
338 Run a testpmd runtime command on the PF to set the TX maximum bandwidth for a
339 specific VF::
340
341    set vf tx max-bandwidth 0 0 2000
342
343 The maximum bandwidth is an absolute value in Mbps.
344
345
346 VF TC bandwidth allocation
347 ~~~~~~~~~~~~~~~~~~~~~~~~~~
348
349 Run a testpmd runtime command on the PF to set the TCs (traffic class) TX
350 bandwidth allocation for a specific VF::
351
352    set vf tc tx min-bandwidth 0 0 (20,20,20,40)
353
354 The allocated bandwidth should be set for all the TCs. The allocated bandwidth
355 is a relative value as a percentage. The sum of all the bandwidth should
356 be 100.
357
358
359 VF TC max bandwidth
360 ~~~~~~~~~~~~~~~~~~~
361
362 Run a testpmd runtime command on the PF to set the TCs TX maximum bandwidth
363 for a specific VF::
364
365    set vf tc tx max-bandwidth 0 0 0 10000
366
367 The maximum bandwidth is an absolute value in Mbps.
368
369
370 TC strict priority scheduling
371 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
372
373 Run a testpmd runtime command on the PF to enable/disable several TCs TX
374 strict priority scheduling::
375
376    set tx strict-link-priority 0 0x3
377
378 The 0 in the TC bitmap means disabling the strict priority scheduling for this
379 TC. To enable use a value of 1.