2 Copyright(c) 2017 Intel Corporation. All rights reserved.
5 Redistribution and use in source and binary forms, with or without
6 modification, are permitted provided that the following conditions
9 * Redistributions of source code must retain the above copyright
10 notice, this list of conditions and the following disclaimer.
11 * Redistributions in binary form must reproduce the above copyright
12 notice, this list of conditions and the following disclaimer in
13 the documentation and/or other materials provided with the
15 * Neither the name of Intel Corporation nor the names of its
16 contributors may be used to endorse or promote products derived
17 from this software without specific prior written permission.
19 THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
20 "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
21 LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
22 A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
23 OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
24 SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
25 LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
26 DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
27 THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 VFd (the VF daemon) is a mechanism which can be used to configure features on
36 a VF (SR-IOV Virtual Function) without direct access to the PF (SR-IOV
37 Physical Function). VFd is an *EXPERIMENTAL* feature which can only be used in
38 the scenario of DPDK PF with a DPDK VF. If the PF port is driven by the Linux
39 kernel driver then the VFd feature will not work. Currently VFd is only
40 supported by the ixgbe and i40e drivers.
42 In general VF features cannot be configured directly by an end user
43 application since they are under the control of the PF. The normal approach to
44 configuring a feature on a VF is that an application would call the APIs
45 provided by the VF driver. If the required feature cannot be configured by the
46 VF directly (the most common case) the VF sends a message to the PF through
47 the mailbox on ixgbe and i40e. This means that the availability of the feature
48 depends on whether the appropriate mailbox messages are defined.
50 DPDK leverages the mailbox interface defined by the Linux kernel driver so
51 that compatibility with the kernel driver can be guaranteed. The downside of
52 this approach is that the availability of messages supported by the kernel
53 become a limitation when the user wants to configure features on the VF.
55 VFd is a new method of controlling the features on a VF. The VF driver doesn't
56 talk directly to the PF driver when configuring a feature on the VF. When a VF
57 application (i.e., an application using the VF ports) wants to enable a VF
58 feature, it can send a message to the PF application (i.e., the application
59 using the PF port, which can be the same as the VF application). The PF
60 application will configure the feature for the VF. Obviously, the PF
61 application can also configure the VF features without a request from the VF
64 .. _VF_daemon_overview:
66 .. figure:: img/vf_daemon_overview.*
68 VF daemon (VFd) Overview
70 Compared with the traditional approach the VFd moves the negotiation between
71 VF and PF from the driver level to application level. So the application
72 should define how the negotiation between the VF and PF works, or even if the
73 control should be limited to the PF.
75 It is the application's responsibility to use VFd. Consider for example a KVM
76 migration, the VF application may transfer from one VM to another. It is
77 recommended in this case that the PF control the VF features without
78 participation from the VF. Then the VF application has no capability to
79 configure the features. So the user doesn't need to define the interface
80 between the VF application and the PF application. The service provider should
81 take the control of all the features.
83 The following sections describe the VFd functionality.
87 Although VFd is supported by both ixgbe and i40e, please be aware that
88 since the hardware capability is different, the functions supported by
89 ixgbe and i40e are not the same.
95 VFd only can be used in the scenario of DPDK PF + DPDK VF. Users should bind
96 the PF port to ``igb_uio``, then create the VFs based on the DPDK PF host.
98 The typical procedure to achieve this is as follows:
100 #. Boot the system without iommu, or with ``iommu=pt``.
102 #. Bind the PF port to ``igb_uio``, for example::
104 dpdk-devbind.py -b igb_uio 01:00.0
106 #. Create a Virtual Function::
108 echo 1 > /sys/bus/pci/devices/0000:01:00.0/max_vfs
110 #. Start a VM with the new VF port bypassed to it.
112 #. Run a DPDK application on the PF in the host::
114 testpmd -l 0-7 -n 4 -- -i --txqflags=0
116 #. Bind the VF port to ``igb_uio`` in the VM::
118 dpdk-devbind.py -b igb_uio 03:00.0
120 #. Run a DPDK application on the VF in the VM::
122 testpmd -l 0-7 -n 4 -- -i --txqflags=0
125 Common functions of IXGBE and I40E
126 ----------------------------------
128 The following sections show how to enable PF/VF functionality based on the
135 Run a testpmd runtime command on the PF to set TX loopback::
137 set tx loopback 0 on|off
139 This sets whether the PF port and all the VF ports that belong to it are
140 allowed to send the packets to other virtual ports.
142 Although it is a VFd function, it is the global setting for the whole
143 physical port. When using this function, the PF and all the VFs TX loopback
144 will be enabled/disabled.
147 VF MAC address setting
148 ~~~~~~~~~~~~~~~~~~~~~~
150 Run a testpmd runtime command on the PF to set the MAC address for a VF port::
152 set vf mac addr 0 0 A0:36:9F:7B:C3:51
154 This testpmd runtime command will change the MAC address of the VF port to
155 this new address. If any other addresses are set before, they will be
162 Run a testpmd runtime command on the PF to enable/disable the MAC
163 anti-spoofing for a VF port::
165 set vf mac antispoof 0 0 on|off
167 When enabling the MAC anti-spoofing, the port will not forward packets whose
168 source MAC address is not the same as the port.
171 VF VLAN anti-spoofing
172 ~~~~~~~~~~~~~~~~~~~~~
174 Run a testpmd runtime command on the PF to enable/disable the VLAN
175 anti-spoofing for a VF port::
177 set vf vlan antispoof 0 0 on|off
179 When enabling the VLAN anti-spoofing, the port will not send packets whose
180 VLAN ID does not belong to VLAN IDs that this port can receive.
186 Run a testpmd runtime command on the PF to set the VLAN insertion for a VF
189 set vf vlan insert 0 0 1
191 When using this testpmd runtime command, an assigned VLAN ID can be inserted
192 to the transmitted packets by the hardware.
194 The assigned VLAN ID can be 0. It means disabling the VLAN insertion.
200 Run a testpmd runtime command on the PF to enable/disable the VLAN stripping
203 set vf vlan stripq 0 0 on|off
205 This testpmd runtime command is used to enable/disable the RX VLAN stripping
206 for a specific VF port.
212 Run a testpmd runtime command on the PF to set the VLAN filtering for a VF
215 rx_vlan add 1 port 0 vf 1
216 rx_vlan rm 1 port 0 vf 1
218 These two testpmd runtime commands can be used to add or remove the VLAN
219 filter for several VF ports. When the VLAN filters are added only the packets
220 that have the assigned VLAN IDs can be received. Other packets will be dropped
224 The IXGBE specific VFd functions
225 --------------------------------
227 The functions in this section are specific to the ixgbe driver.
233 Run a testpmd runtime command on the PF to enable/disable the all queues
236 set all queues drop on|off
238 This is a global setting for the PF and all the VF ports of the physical port.
240 Enabling the ``all queues drop`` feature means that when there is no available
241 descriptor for the received packets they are dropped. The ``all queues drop``
242 feature should be enabled in SR-IOV mode to avoid one queue blocking others.
248 Run a testpmd runtime command on the PF to enable/disable the packet drop for
251 set vf split drop 0 0 on|off
253 This is a similar function as ``all queues drop``. The difference is that this
254 function is per VF setting and the previous function is a global setting.
260 Run a testpmd runtime command on the PF to all queues' rate limit for a
263 set port 0 vf 0 rate 10 queue_mask 1
265 This is a function to set the rate limit for all the queues in the
266 ``queue_mask`` bitmap. It is not used to set the summary of the rate
267 limit. The rate limit of every queue will be set equally to the assigned rate
274 Run a testpmd runtime command on the PF to enable/disable packet receiving for
277 set port 0 vf 0 rx on|off
279 This function can be used to stop/start packet receiving on a VF.
285 Run a testpmd runtime command on the PF to enable/disable packet transmitting
288 set port 0 vf 0 tx on|off
290 This function can be used to stop/start packet transmitting on a VF.
296 Run a testpmd runtime command on the PF to set the RX mode for a specific VF::
298 set port 0 vf 0 rxmode AUPE|ROPE|BAM|MPE on|off
300 This function can be used to enable/disable some RX modes on the VF, including:
302 * If it accept untagged packets.
303 * If it accepts packets matching the MAC filters.
304 * If it accept MAC broadcast packets,
305 * If it enables MAC multicast promiscuous mode.
308 The I40E specific VFd functions
309 -------------------------------
311 The functions in this section are specific to the i40e driver.
317 This provides an API to get the a specific VF's statistic from PF.
320 VF statistics resetting
321 ~~~~~~~~~~~~~~~~~~~~~~~
323 This provides an API to rest the a specific VF's statistic from PF.
326 VF link status change notification
327 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
329 This provide an API to let a specific VF know if the physical link status
332 Normally if a VF received this notification, the driver should notify the
333 application to reset the VF port.
336 VF MAC broadcast setting
337 ~~~~~~~~~~~~~~~~~~~~~~~~
339 Run a testpmd runtime command on the PF to enable/disable MAC broadcast packet
340 receiving for a specific VF::
342 set vf broadcast 0 0 on|off
345 VF MAC multicast promiscuous mode
346 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
348 Run a testpmd runtime command on the PF to enable/disable MAC multicast
349 promiscuous mode for a specific VF::
351 set vf allmulti 0 0 on|off
354 VF MAC unicast promiscuous mode
355 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
357 Run a testpmd runtime command on the PF to enable/disable MAC unicast
358 promiscuous mode for a specific VF::
360 set vf promisc 0 0 on|off
366 Run a testpmd runtime command on the PF to set the TX maximum bandwidth for a
369 set vf tx max-bandwidth 0 0 2000
371 The maximum bandwidth is an absolute value in Mbps.
374 VF TC bandwidth allocation
375 ~~~~~~~~~~~~~~~~~~~~~~~~~~
377 Run a testpmd runtime command on the PF to set the TCs (traffic class) TX
378 bandwidth allocation for a specific VF::
380 set vf tc tx min-bandwidth 0 0 (20,20,20,40)
382 The allocated bandwidth should be set for all the TCs. The allocated bandwidth
383 is a relative value as a percentage. The sum of all the bandwidth should
390 Run a testpmd runtime command on the PF to set the TCs TX maximum bandwidth
393 set vf tc tx max-bandwidth 0 0 0 10000
395 The maximum bandwidth is an absolute value in Mbps.
398 TC strict priority scheduling
399 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
401 Run a testpmd runtime command on the PF to enable/disable several TCs TX
402 strict priority scheduling::
404 set tx strict-link-priority 0 0x3
406 The 0 in the TC bitmap means disabling the strict priority scheduling for this
407 TC. To enable use a value of 1.