aboutsummaryrefslogtreecommitdiffstats
path: root/doc/guides/howto/vfd.rst
blob: 0ec0a0478d8ecd6f287bf087cf8e7fe521bc7623 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
..  SPDX-License-Identifier: BSD-3-Clause
    Copyright(c) 2017 Intel Corporation.

VF daemon (VFd)
===============

VFd (the VF daemon) is a mechanism which can be used to configure features on
a VF (SR-IOV Virtual Function) without direct access to the PF (SR-IOV
Physical Function). VFd is an *EXPERIMENTAL* feature which can only be used in
the scenario of DPDK PF with a DPDK VF. If the PF port is driven by the Linux
kernel driver then the VFd feature will not work. Currently VFd is only
supported by the ixgbe and i40e drivers.

In general VF features cannot be configured directly by an end user
application since they are under the control of the PF. The normal approach to
configuring a feature on a VF is that an application would call the APIs
provided by the VF driver. If the required feature cannot be configured by the
VF directly (the most common case) the VF sends a message to the PF through
the mailbox on ixgbe and i40e. This means that the availability of the feature
depends on whether the appropriate mailbox messages are defined.

DPDK leverages the mailbox interface defined by the Linux kernel driver so
that compatibility with the kernel driver can be guaranteed. The downside of
this approach is that the availability of messages supported by the kernel
become a limitation when the user wants to configure features on the VF.

VFd is a new method of controlling the features on a VF. The VF driver doesn't
talk directly to the PF driver when configuring a feature on the VF. When a VF
application (i.e., an application using the VF ports) wants to enable a VF
feature, it can send a message to the PF application (i.e., the application
using the PF port, which can be the same as the VF application). The PF
application will configure the feature for the VF. Obviously, the PF
application can also configure the VF features without a request from the VF
application.

.. _VF_daemon_overview:

.. figure:: img/vf_daemon_overview.*

   VF daemon (VFd) Overview

Compared with the traditional approach the VFd moves the negotiation between
VF and PF from the driver level to application level. So the application
should define how the negotiation between the VF and PF works, or even if the
control should be limited to the PF.

It is the application's responsibility to use VFd. Consider for example a KVM
migration, the VF application may transfer from one VM to another. It is
recommended in this case that the PF control the VF features without
participation from the VF. Then the VF application has no capability to
configure the features. So the user doesn't need to define the interface
between the VF application and the PF application. The service provider should
take the control of all the features.

The following sections describe the VFd functionality.

.. Note::

   Although VFd is supported by both ixgbe and i40e, please be aware that
   since the hardware capability is different, the functions supported by
   ixgbe and i40e are not the same.


Preparing
---------

VFd only can be used in the scenario of DPDK PF + DPDK VF. Users should bind
the PF port to ``igb_uio``, then create the VFs based on the DPDK PF host.

The typical procedure to achieve this is as follows:

#. Boot the system without iommu, or with ``iommu=pt``.

#. Bind the PF port to ``igb_uio``, for example::

      dpdk-devbind.py -b igb_uio 01:00.0

#. Create a Virtual Function::

      echo 1 > /sys/bus/pci/devices/0000:01:00.0/max_vfs

#. Start a VM with the new VF port bypassed to it.

#. Run a DPDK application on the PF in the host::

      testpmd -l 0-7 -n 4 -- -i --txqflags=0

#. Bind the VF port to ``igb_uio`` in the VM::

      dpdk-devbind.py -b igb_uio 03:00.0

#. Run a DPDK application on the VF in the VM::

      testpmd -l 0-7 -n 4 -- -i --txqflags=0


Common functions of IXGBE and I40E
----------------------------------

The following sections show how to enable PF/VF functionality based on the
above testpmd setup.


TX loopback
~~~~~~~~~~~

Run a testpmd runtime command on the PF to set TX loopback::

   set tx loopback 0 on|off

This sets whether the PF port and all the VF ports that belong to it are
allowed to send the packets to other virtual ports.

Although it is a VFd function, it is the global setting for the whole
physical port. When using this function, the PF and all the VFs TX loopback
will be enabled/disabled.


VF MAC address setting
~~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the MAC address for a VF port::

   set vf mac addr 0 0 A0:36:9F:7B:C3:51

This testpmd runtime command will change the MAC address of the VF port to
this new address. If any other addresses are set before, they will be
overwritten.


VF MAC anti-spoofing
~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable the MAC
anti-spoofing for a VF port::

   set vf mac antispoof 0 0 on|off

When enabling the MAC anti-spoofing, the port will not forward packets whose
source MAC address is not the same as the port.


VF VLAN anti-spoofing
~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable the VLAN
anti-spoofing for a VF port::

   set vf vlan antispoof 0 0 on|off

When enabling the VLAN anti-spoofing, the port will not send packets whose
VLAN ID does not belong to VLAN IDs that this port can receive.


VF VLAN insertion
~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the VLAN insertion for a VF
port::

   set vf vlan insert 0 0 1

When using this testpmd runtime command, an assigned VLAN ID can be inserted
to the transmitted packets by the hardware.

The assigned VLAN ID can be 0. It means disabling the VLAN insertion.


VF VLAN stripping
~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable the VLAN stripping
for a VF port::

   set vf vlan stripq 0 0 on|off

This testpmd runtime command is used to enable/disable the RX VLAN stripping
for a specific VF port.


VF VLAN filtering
~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the VLAN filtering for a VF
port::

   rx_vlan add 1 port 0 vf 1
   rx_vlan rm  1 port 0 vf 1

These two testpmd runtime commands can be used to add or remove the VLAN
filter for several VF ports. When the VLAN filters are added only the packets
that have the assigned VLAN IDs can be received. Other packets will be dropped
by hardware.


The IXGBE specific VFd functions
--------------------------------

The functions in this section are specific to the ixgbe driver.


All queues drop
~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable the all queues
drop::

   set all queues drop on|off

This is a global setting for the PF and all the VF ports of the physical port.

Enabling the ``all queues drop`` feature means that when there is no available
descriptor for the received packets they are dropped. The ``all queues drop``
feature should be enabled in SR-IOV mode to avoid one queue blocking others.


VF packet drop
~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable the packet drop for
a specific VF::

   set vf split drop 0 0 on|off

This is a similar function as ``all queues drop``. The difference is that this
function is per VF setting and the previous function is a global setting.


VF rate limit
~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to all queues' rate limit for a
specific VF::

   set port 0 vf 0 rate 10 queue_mask 1

This is a function to set the rate limit for all the queues in the
``queue_mask`` bitmap. It is not used to set the summary of the rate
limit. The rate limit of every queue will be set equally to the assigned rate
limit.


VF RX enabling
~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable packet receiving for
a specific VF::

   set port 0 vf 0 rx on|off

This function can be used to stop/start packet receiving on a VF.


VF TX enabling
~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable packet transmitting
for a specific VF::

   set port 0 vf 0 tx on|off

This function can be used to stop/start packet transmitting on a VF.


VF RX mode setting
~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the RX mode for a specific VF::

   set port 0 vf 0 rxmode AUPE|ROPE|BAM|MPE on|off

This function can be used to enable/disable some RX modes on the VF, including:

* If it accept untagged packets.
* If it accepts packets matching the MAC filters.
* If it accept MAC broadcast packets,
* If it enables MAC multicast promiscuous mode.


The I40E specific VFd functions
-------------------------------

The functions in this section are specific to the i40e driver.


VF statistics
~~~~~~~~~~~~~

This provides an API to get the a specific VF's statistic from PF.


VF statistics resetting
~~~~~~~~~~~~~~~~~~~~~~~

This provides an API to rest the a specific VF's statistic from PF.


VF link status change notification
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This provide an API to let a specific VF know if the physical link status
changed.

Normally if a VF received this notification, the driver should notify the
application to reset the VF port.


VF MAC broadcast setting
~~~~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable MAC broadcast packet
receiving for a specific VF::

   set vf broadcast 0 0 on|off


VF MAC multicast promiscuous mode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable MAC multicast
promiscuous mode for a specific VF::

   set vf allmulti 0 0 on|off


VF MAC unicast promiscuous mode
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable MAC unicast
promiscuous mode for a specific VF::

   set vf promisc 0 0 on|off


VF max bandwidth
~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the TX maximum bandwidth for a
specific VF::

   set vf tx max-bandwidth 0 0 2000

The maximum bandwidth is an absolute value in Mbps.


VF TC bandwidth allocation
~~~~~~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the TCs (traffic class) TX
bandwidth allocation for a specific VF::

   set vf tc tx min-bandwidth 0 0 (20,20,20,40)

The allocated bandwidth should be set for all the TCs. The allocated bandwidth
is a relative value as a percentage. The sum of all the bandwidth should
be 100.


VF TC max bandwidth
~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to set the TCs TX maximum bandwidth
for a specific VF::

   set vf tc tx max-bandwidth 0 0 0 10000

The maximum bandwidth is an absolute value in Mbps.


TC strict priority scheduling
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

Run a testpmd runtime command on the PF to enable/disable several TCs TX
strict priority scheduling::

   set tx strict-link-priority 0 0x3

The 0 in the TC bitmap means disabling the strict priority scheduling for this
TC. To enable use a value of 1.