1 .. SPDX-License-Identifier: BSD-3-Clause
2 Copyright(c) 2017 Intel Corporation.
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.
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.
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.
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
36 .. _VF_daemon_overview:
38 .. figure:: img/vf_daemon_overview.*
40 VF daemon (VFd) Overview
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.
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.
55 The following sections describe the VFd functionality.
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.
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.
70 The typical procedure to achieve this is as follows:
72 #. Boot the system without iommu, or with ``iommu=pt``.
74 #. Bind the PF port to ``igb_uio``, for example::
76 dpdk-devbind.py -b igb_uio 01:00.0
78 #. Create a Virtual Function::
80 echo 1 > /sys/bus/pci/devices/0000:01:00.0/max_vfs
82 #. Start a VM with the new VF port bypassed to it.
84 #. Run a DPDK application on the PF in the host::
86 testpmd -l 0-7 -n 4 -- -i --txqflags=0
88 #. Bind the VF port to ``igb_uio`` in the VM::
90 dpdk-devbind.py -b igb_uio 03:00.0
92 #. Run a DPDK application on the VF in the VM::
94 testpmd -l 0-7 -n 4 -- -i --txqflags=0
97 Common functions of IXGBE and I40E
98 ----------------------------------
100 The following sections show how to enable PF/VF functionality based on the
107 Run a testpmd runtime command on the PF to set TX loopback::
109 set tx loopback 0 on|off
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.
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.
119 VF MAC address setting
120 ~~~~~~~~~~~~~~~~~~~~~~
122 Run a testpmd runtime command on the PF to set the MAC address for a VF port::
124 set vf mac addr 0 0 A0:36:9F:7B:C3:51
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
134 Run a testpmd runtime command on the PF to enable/disable the MAC
135 anti-spoofing for a VF port::
137 set vf mac antispoof 0 0 on|off
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.
143 VF VLAN anti-spoofing
144 ~~~~~~~~~~~~~~~~~~~~~
146 Run a testpmd runtime command on the PF to enable/disable the VLAN
147 anti-spoofing for a VF port::
149 set vf vlan antispoof 0 0 on|off
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.
158 Run a testpmd runtime command on the PF to set the VLAN insertion for a VF
161 set vf vlan insert 0 0 1
163 When using this testpmd runtime command, an assigned VLAN ID can be inserted
164 to the transmitted packets by the hardware.
166 The assigned VLAN ID can be 0. It means disabling the VLAN insertion.
172 Run a testpmd runtime command on the PF to enable/disable the VLAN stripping
175 set vf vlan stripq 0 0 on|off
177 This testpmd runtime command is used to enable/disable the RX VLAN stripping
178 for a specific VF port.
184 Run a testpmd runtime command on the PF to set the VLAN filtering for a VF
187 rx_vlan add 1 port 0 vf 1
188 rx_vlan rm 1 port 0 vf 1
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
196 The IXGBE specific VFd functions
197 --------------------------------
199 The functions in this section are specific to the ixgbe driver.
205 Run a testpmd runtime command on the PF to enable/disable the all queues
208 set all queues drop on|off
210 This is a global setting for the PF and all the VF ports of the physical port.
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.
220 Run a testpmd runtime command on the PF to enable/disable the packet drop for
223 set vf split drop 0 0 on|off
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.
232 Run a testpmd runtime command on the PF to all queues' rate limit for a
235 set port 0 vf 0 rate 10 queue_mask 1
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
246 Run a testpmd runtime command on the PF to enable/disable packet receiving for
249 set port 0 vf 0 rx on|off
251 This function can be used to stop/start packet receiving on a VF.
257 Run a testpmd runtime command on the PF to enable/disable packet transmitting
260 set port 0 vf 0 tx on|off
262 This function can be used to stop/start packet transmitting on a VF.
268 Run a testpmd runtime command on the PF to set the RX mode for a specific VF::
270 set port 0 vf 0 rxmode AUPE|ROPE|BAM|MPE on|off
272 This function can be used to enable/disable some RX modes on the VF, including:
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.
280 The I40E specific VFd functions
281 -------------------------------
283 The functions in this section are specific to the i40e driver.
289 This provides an API to get the a specific VF's statistic from PF.
292 VF statistics resetting
293 ~~~~~~~~~~~~~~~~~~~~~~~
295 This provides an API to rest the a specific VF's statistic from PF.
298 VF link status change notification
299 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
301 This provide an API to let a specific VF know if the physical link status
304 Normally if a VF received this notification, the driver should notify the
305 application to reset the VF port.
308 VF MAC broadcast setting
309 ~~~~~~~~~~~~~~~~~~~~~~~~
311 Run a testpmd runtime command on the PF to enable/disable MAC broadcast packet
312 receiving for a specific VF::
314 set vf broadcast 0 0 on|off
317 VF MAC multicast promiscuous mode
318 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
320 Run a testpmd runtime command on the PF to enable/disable MAC multicast
321 promiscuous mode for a specific VF::
323 set vf allmulti 0 0 on|off
326 VF MAC unicast promiscuous mode
327 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 Run a testpmd runtime command on the PF to enable/disable MAC unicast
330 promiscuous mode for a specific VF::
332 set vf promisc 0 0 on|off
338 Run a testpmd runtime command on the PF to set the TX maximum bandwidth for a
341 set vf tx max-bandwidth 0 0 2000
343 The maximum bandwidth is an absolute value in Mbps.
346 VF TC bandwidth allocation
347 ~~~~~~~~~~~~~~~~~~~~~~~~~~
349 Run a testpmd runtime command on the PF to set the TCs (traffic class) TX
350 bandwidth allocation for a specific VF::
352 set vf tc tx min-bandwidth 0 0 (20,20,20,40)
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
362 Run a testpmd runtime command on the PF to set the TCs TX maximum bandwidth
365 set vf tc tx max-bandwidth 0 0 0 10000
367 The maximum bandwidth is an absolute value in Mbps.
370 TC strict priority scheduling
371 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
373 Run a testpmd runtime command on the PF to enable/disable several TCs TX
374 strict priority scheduling::
376 set tx strict-link-priority 0 0x3
378 The 0 in the TC bitmap means disabling the strict priority scheduling for this
379 TC. To enable use a value of 1.