net/iavf: support quanta size configuration
[dpdk.git] / doc / guides / nics / intel_vf.rst
1 ..  SPDX-License-Identifier: BSD-3-Clause
2     Copyright(c) 2010-2014 Intel Corporation.
3
4 Intel Virtual Function Driver
5 =============================
6
7 Supported Intel® Ethernet Controllers (see the *DPDK Release Notes* for details)
8 support the following modes of operation in a virtualized environment:
9
10 *   **SR-IOV mode**: Involves direct assignment of part of the port resources to different guest operating systems
11     using the PCI-SIG Single Root I/O Virtualization (SR IOV) standard,
12     also known as "native mode" or "pass-through" mode.
13     In this chapter, this mode is referred to as IOV mode.
14
15 *   **VMDq mode**: Involves central management of the networking resources by an IO Virtual Machine (IOVM) or
16     a Virtual Machine Monitor (VMM), also known as software switch acceleration mode.
17     In this chapter, this mode is referred to as the Next Generation VMDq mode.
18
19 SR-IOV Mode Utilization in a DPDK Environment
20 ---------------------------------------------
21
22 The DPDK uses the SR-IOV feature for hardware-based I/O sharing in IOV mode.
23 Therefore, it is possible to partition SR-IOV capability on Ethernet controller NIC resources logically and
24 expose them to a virtual machine as a separate PCI function called a "Virtual Function".
25 Refer to :numref:`figure_single_port_nic`.
26
27 Therefore, a NIC is logically distributed among multiple virtual machines (as shown in :numref:`figure_single_port_nic`),
28 while still having global data in common to share with the Physical Function and other Virtual Functions.
29 The DPDK fm10kvf, iavf, igbvf or ixgbevf as a Poll Mode Driver (PMD) serves for the Intel® 82576 Gigabit Ethernet Controller,
30 Intel® Ethernet Controller I350 family, Intel® 82599 10 Gigabit Ethernet Controller NIC,
31 Intel® Fortville 10/40 Gigabit Ethernet Controller NIC's virtual PCI function, or PCIe host-interface of the Intel Ethernet Switch
32 FM10000 Series.
33 Meanwhile the DPDK Poll Mode Driver (PMD) also supports "Physical Function" of such NIC's on the host.
34
35 The DPDK PF/VF Poll Mode Driver (PMD) supports the Layer 2 switch on Intel® 82576 Gigabit Ethernet Controller,
36 Intel® Ethernet Controller I350 family, Intel® 82599 10 Gigabit Ethernet Controller,
37 and Intel® Fortville 10/40 Gigabit Ethernet Controller NICs so that guest can choose it for inter virtual machine traffic in SR-IOV mode.
38
39 For more detail on SR-IOV, please refer to the following documents:
40
41 *   `SR-IOV provides hardware based I/O sharing <http://www.intel.com/network/connectivity/solutions/vmdc.htm>`_
42
43 *   `PCI-SIG-Single Root I/O Virtualization Support on IA
44     <http://www.intel.com/content/www/us/en/pci-express/pci-sig-single-root-io-virtualization-support-in-virtualization-technology-for-connectivity-paper.html>`_
45
46 *   `Scalable I/O Virtualized Servers <http://www.intel.com/content/www/us/en/virtualization/server-virtualization/scalable-i-o-virtualized-servers-paper.html>`_
47
48 .. _figure_single_port_nic:
49
50 .. figure:: img/single_port_nic.*
51
52    Virtualization for a Single Port NIC in SR-IOV Mode
53
54
55 Physical and Virtual Function Infrastructure
56 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
57
58 The following describes the Physical Function and Virtual Functions infrastructure for the supported Ethernet Controller NICs.
59
60 Virtual Functions operate under the respective Physical Function on the same NIC Port and therefore have no access
61 to the global NIC resources that are shared between other functions for the same NIC port.
62
63 A Virtual Function has basic access to the queue resources and control structures of the queues assigned to it.
64 For global resource access, a Virtual Function has to send a request to the Physical Function for that port,
65 and the Physical Function operates on the global resources on behalf of the Virtual Function.
66 For this out-of-band communication, an SR-IOV enabled NIC provides a memory buffer for each Virtual Function,
67 which is called a "Mailbox".
68
69 Intel® Ethernet Adaptive Virtual Function
70 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
71 Adaptive Virtual Function (IAVF) is a SR-IOV Virtual Function with the same device id (8086:1889) on different Intel Ethernet Controller.
72 IAVF Driver is VF driver which supports for all future Intel devices without requiring a VM update. And since this happens to be an adaptive VF driver,
73 every new drop of the VF driver would add more and more advanced features that can be turned on in the VM if the underlying HW device supports those
74 advanced features based on a device agnostic way without ever compromising on the base functionality. IAVF provides generic hardware interface and
75 interface between IAVF driver and a compliant PF driver is specified.
76
77 Intel products starting Ethernet Controller 700 Series to support Adaptive Virtual Function.
78
79 The way to generate Virtual Function is like normal, and the resource of VF assignment depends on the NIC Infrastructure.
80
81 For more detail on SR-IOV, please refer to the following documents:
82
83 *   `Intel® IAVF HAS <https://www.intel.com/content/dam/www/public/us/en/documents/product-specifications/ethernet-adaptive-virtual-function-hardware-spec.pdf>`_
84
85 .. note::
86
87     To use DPDK IAVF PMD on Intel® 700 Series Ethernet Controller, the device id (0x1889) need to specified during device
88     assignment in hypervisor. Take qemu for example, the device assignment should carry the IAVF device id (0x1889) like
89     ``-device vfio-pci,x-pci-device-id=0x1889,host=03:0a.0``.
90
91     When IAVF is backed by an Intel® E810 device, the "Protocol Extraction" feature which is supported by ice PMD is also
92     available for IAVF PMD. The same devargs with the same parameters can be applied to IAVF PMD, for detail please reference
93     the section ``Protocol extraction for per queue`` of ice.rst.
94
95     Quanta size configuration is also supported when IAVF is backed by an Intel® E810 device by setting ``devargs``
96     parameter ``quanta_size`` like ``-a 18:00.0,quanta_size=2048``. The default value is 1024, and quanta size should be
97     set as the product of 64 in legacy host interface mode.
98
99 The PCIE host-interface of Intel Ethernet Switch FM10000 Series VF infrastructure
100 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
101
102 In a virtualized environment, the programmer can enable a maximum of *64 Virtual Functions (VF)*
103 globally per PCIE host-interface of the Intel Ethernet Switch FM10000 Series device.
104 Each VF can have a maximum of 16 queue pairs.
105 The Physical Function in host could be only configured by the Linux* fm10k driver
106 (in the case of the Linux Kernel-based Virtual Machine [KVM]), DPDK PMD PF driver doesn't support it yet.
107
108 For example,
109
110 *   Using Linux* fm10k driver:
111
112     .. code-block:: console
113
114         rmmod fm10k (To remove the fm10k module)
115         insmod fm0k.ko max_vfs=2,2 (To enable two Virtual Functions per port)
116
117 Virtual Function enumeration is performed in the following sequence by the Linux* pci driver for a dual-port NIC.
118 When you enable the four Virtual Functions with the above command, the four enabled functions have a Function#
119 represented by (Bus#, Device#, Function#) in sequence starting from 0 to 3.
120 However:
121
122 *   Virtual Functions 0 and 2 belong to Physical Function 0
123
124 *   Virtual Functions 1 and 3 belong to Physical Function 1
125
126 .. note::
127
128     The above is an important consideration to take into account when targeting specific packets to a selected port.
129
130 Intel® X710/XL710 Gigabit Ethernet Controller VF Infrastructure
131 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
132
133 In a virtualized environment, the programmer can enable a maximum of *128 Virtual Functions (VF)*
134 globally per Intel® X710/XL710 Gigabit Ethernet Controller NIC device.
135 The Physical Function in host could be either configured by the Linux* i40e driver
136 (in the case of the Linux Kernel-based Virtual Machine [KVM]) or by DPDK PMD PF driver.
137 When using both DPDK PMD PF/VF drivers, the whole NIC will be taken over by DPDK based application.
138
139 For example,
140
141 *   Using Linux* i40e  driver:
142
143     .. code-block:: console
144
145         rmmod i40e (To remove the i40e module)
146         insmod i40e.ko max_vfs=2,2 (To enable two Virtual Functions per port)
147
148 *   Using the DPDK PMD PF i40e driver:
149
150     Kernel Params: iommu=pt, intel_iommu=on
151
152     .. code-block:: console
153
154         modprobe uio
155         insmod igb_uio
156         ./dpdk-devbind.py -b igb_uio bb:ss.f
157         echo 2 > /sys/bus/pci/devices/0000\:bb\:ss.f/max_vfs (To enable two VFs on a specific PCI device)
158
159     Launch the DPDK testpmd/example or your own host daemon application using the DPDK PMD library.
160
161 Virtual Function enumeration is performed in the following sequence by the Linux* pci driver for a dual-port NIC.
162 When you enable the four Virtual Functions with the above command, the four enabled functions have a Function#
163 represented by (Bus#, Device#, Function#) in sequence starting from 0 to 3.
164 However:
165
166 *   Virtual Functions 0 and 2 belong to Physical Function 0
167
168 *   Virtual Functions 1 and 3 belong to Physical Function 1
169
170 .. note::
171
172     The above is an important consideration to take into account when targeting specific packets to a selected port.
173
174     For Intel® X710/XL710 Gigabit Ethernet Controller, queues are in pairs. One queue pair means one receive queue and
175     one transmit queue. The default number of queue pairs per VF is 4, and can be 16 in maximum.
176
177 Intel® 82599 10 Gigabit Ethernet Controller VF Infrastructure
178 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
179
180 The programmer can enable a maximum of *63 Virtual Functions* and there must be *one Physical Function* per Intel® 82599
181 10 Gigabit Ethernet Controller NIC port.
182 The reason for this is that the device allows for a maximum of 128 queues per port and a virtual/physical function has to
183 have at least one queue pair (RX/TX).
184 The current implementation of the DPDK ixgbevf driver supports a single queue pair (RX/TX) per Virtual Function.
185 The Physical Function in host could be either configured by the Linux* ixgbe driver
186 (in the case of the Linux Kernel-based Virtual Machine [KVM]) or by DPDK PMD PF driver.
187 When using both DPDK PMD PF/VF drivers, the whole NIC will be taken over by DPDK based application.
188
189 For example,
190
191 *   Using Linux* ixgbe driver:
192
193     .. code-block:: console
194
195         rmmod ixgbe (To remove the ixgbe module)
196         insmod ixgbe max_vfs=2,2 (To enable two Virtual Functions per port)
197
198 *   Using the DPDK PMD PF ixgbe driver:
199
200     Kernel Params: iommu=pt, intel_iommu=on
201
202     .. code-block:: console
203
204         modprobe uio
205         insmod igb_uio
206         ./dpdk-devbind.py -b igb_uio bb:ss.f
207         echo 2 > /sys/bus/pci/devices/0000\:bb\:ss.f/max_vfs (To enable two VFs on a specific PCI device)
208
209     Launch the DPDK testpmd/example or your own host daemon application using the DPDK PMD library.
210
211 *   Using the DPDK PMD PF ixgbe driver to enable VF RSS:
212
213     Same steps as above to install the modules of uio, igb_uio, specify max_vfs for PCI device, and
214     launch the DPDK testpmd/example or your own host daemon application using the DPDK PMD library.
215
216     The available queue number (at most 4) per VF depends on the total number of pool, which is
217     determined by the max number of VF at PF initialization stage and the number of queue specified
218     in config:
219
220     *   If the max number of VFs (max_vfs) is set in the range of 1 to 32:
221
222         If the number of Rx queues is specified as 4 (``--rxq=4`` in testpmd), then there are totally 32
223         pools (RTE_ETH_32_POOLS), and each VF could have 4 Rx queues;
224
225         If the number of Rx queues is specified as 2 (``--rxq=2`` in testpmd), then there are totally 32
226         pools (RTE_ETH_32_POOLS), and each VF could have 2 Rx queues;
227
228     *   If the max number of VFs (max_vfs) is in the range of 33 to 64:
229
230         If the number of Rx queues in specified as 4 (``--rxq=4`` in testpmd), then error message is expected
231         as ``rxq`` is not correct at this case;
232
233         If the number of rxq is 2 (``--rxq=2`` in testpmd), then there is totally 64 pools (RTE_ETH_64_POOLS),
234         and each VF have 2 Rx queues;
235
236     On host, to enable VF RSS functionality, rx mq mode should be set as RTE_ETH_MQ_RX_VMDQ_RSS
237     or RTE_ETH_MQ_RX_RSS mode, and SRIOV mode should be activated (max_vfs >= 1).
238     It also needs config VF RSS information like hash function, RSS key, RSS key length.
239
240 .. note::
241
242     The limitation for VF RSS on Intel® 82599 10 Gigabit Ethernet Controller is:
243     The hash and key are shared among PF and all VF, the RETA table with 128 entries is also shared
244     among PF and all VF; So it could not to provide a method to query the hash and reta content per
245     VF on guest, while, if possible, please query them on host for the shared RETA information.
246
247 Virtual Function enumeration is performed in the following sequence by the Linux* pci driver for a dual-port NIC.
248 When you enable the four Virtual Functions with the above command, the four enabled functions have a Function#
249 represented by (Bus#, Device#, Function#) in sequence starting from 0 to 3.
250 However:
251
252 *   Virtual Functions 0 and 2 belong to Physical Function 0
253
254 *   Virtual Functions 1 and 3 belong to Physical Function 1
255
256 .. note::
257
258     The above is an important consideration to take into account when targeting specific packets to a selected port.
259
260 Intel® 82576 Gigabit Ethernet Controller and Intel® Ethernet Controller I350 Family VF Infrastructure
261 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
262
263 In a virtualized environment, an Intel® 82576 Gigabit Ethernet Controller serves up to eight virtual machines (VMs).
264 The controller has 16 TX and 16 RX queues.
265 They are generally referred to (or thought of) as queue pairs (one TX and one RX queue).
266 This gives the controller 16 queue pairs.
267
268 A pool is a group of queue pairs for assignment to the same VF, used for transmit and receive operations.
269 The controller has eight pools, with each pool containing two queue pairs, that is, two TX and two RX queues assigned to each VF.
270
271 In a virtualized environment, an Intel® Ethernet Controller I350 family device serves up to eight virtual machines (VMs) per port.
272 The eight queues can be accessed by eight different VMs if configured correctly (the i350 has 4x1GbE ports each with 8T X and 8 RX queues),
273 that means, one Transmit and one Receive queue assigned to each VF.
274
275 For example,
276
277 *   Using Linux* igb driver:
278
279     .. code-block:: console
280
281         rmmod igb (To remove the igb module)
282         insmod igb max_vfs=2,2 (To enable two Virtual Functions per port)
283
284 *   Using DPDK PMD PF igb driver:
285
286     Kernel Params: iommu=pt, intel_iommu=on modprobe uio
287
288     .. code-block:: console
289
290         insmod igb_uio
291         ./dpdk-devbind.py -b igb_uio bb:ss.f
292         echo 2 > /sys/bus/pci/devices/0000\:bb\:ss.f/max_vfs (To enable two VFs on a specific pci device)
293
294     Launch DPDK testpmd/example or your own host daemon application using the DPDK PMD library.
295
296 Virtual Function enumeration is performed in the following sequence by the Linux* pci driver for a four-port NIC.
297 When you enable the four Virtual Functions with the above command, the four enabled functions have a Function#
298 represented by (Bus#, Device#, Function#) in sequence, starting from 0 to 7.
299 However:
300
301 *   Virtual Functions 0 and 4 belong to Physical Function 0
302
303 *   Virtual Functions 1 and 5 belong to Physical Function 1
304
305 *   Virtual Functions 2 and 6 belong to Physical Function 2
306
307 *   Virtual Functions 3 and 7 belong to Physical Function 3
308
309 .. note::
310
311     The above is an important consideration to take into account when targeting specific packets to a selected port.
312
313 Validated Hypervisors
314 ~~~~~~~~~~~~~~~~~~~~~
315
316 The validated hypervisor is:
317
318 *   KVM (Kernel Virtual Machine) with  Qemu, version 0.14.0
319
320 However, the hypervisor is bypassed to configure the Virtual Function devices using the Mailbox interface,
321 the solution is hypervisor-agnostic.
322 Xen* and VMware* (when SR- IOV is supported) will also be able to support the DPDK with Virtual Function driver support.
323
324 Expected Guest Operating System in Virtual Machine
325 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
326
327 The expected guest operating systems in a virtualized environment are:
328
329 *   Fedora* 14 (64-bit)
330
331 *   Ubuntu* 10.04 (64-bit)
332
333 For supported kernel versions, refer to the *DPDK Release Notes*.
334
335 .. _intel_vf_kvm:
336
337 Setting Up a KVM Virtual Machine Monitor
338 ----------------------------------------
339
340 The following describes a target environment:
341
342 *   Host Operating System: Fedora 14
343
344 *   Hypervisor: KVM (Kernel Virtual Machine) with Qemu  version 0.14.0
345
346 *   Guest Operating System: Fedora 14
347
348 *   Linux Kernel Version: Refer to the  *DPDK Getting Started Guide*
349
350 *   Target Applications:  l2fwd, l3fwd-vf
351
352 The setup procedure is as follows:
353
354 #.  Before booting the Host OS, open **BIOS setup** and enable **Intel® VT features**.
355
356 #.  While booting the Host OS kernel, pass the intel_iommu=on kernel command line argument using GRUB.
357     When using DPDK PF driver on host, pass the iommu=pt kernel command line argument in GRUB.
358
359 #.  Download qemu-kvm-0.14.0 from
360     `http://sourceforge.net/projects/kvm/files/qemu-kvm/ <http://sourceforge.net/projects/kvm/files/qemu-kvm/>`_
361     and install it in the Host OS using the following steps:
362
363     When using a recent kernel (2.6.25+) with kvm modules included:
364
365     .. code-block:: console
366
367         tar xzf qemu-kvm-release.tar.gz
368         cd qemu-kvm-release
369         ./configure --prefix=/usr/local/kvm
370         make
371         sudo make install
372         sudo /sbin/modprobe kvm-intel
373
374     When using an older kernel, or a kernel from a distribution without the kvm modules,
375     you must download (from the same link), compile and install the modules yourself:
376
377     .. code-block:: console
378
379         tar xjf kvm-kmod-release.tar.bz2
380         cd kvm-kmod-release
381         ./configure
382         make
383         sudo make install
384         sudo /sbin/modprobe kvm-intel
385
386     qemu-kvm installs in the /usr/local/bin directory.
387
388     For more details about KVM configuration and usage, please refer to:
389
390     `http://www.linux-kvm.org/page/HOWTO1 <http://www.linux-kvm.org/page/HOWTO1>`_.
391
392 #.  Create a Virtual Machine and install Fedora 14 on the Virtual Machine.
393     This is referred to as the Guest Operating System (Guest OS).
394
395 #.  Download and install the latest ixgbe driver from
396     `intel.com <https://downloadcenter.intel.com/download/14687>`_.
397
398 #.  In the Host OS
399
400     When using Linux kernel ixgbe driver, unload the Linux ixgbe driver and reload it with the max_vfs=2,2 argument:
401
402     .. code-block:: console
403
404         rmmod ixgbe
405         modprobe ixgbe max_vfs=2,2
406
407     When using DPDK PMD PF driver, insert DPDK kernel module igb_uio and set the number of VF by sysfs max_vfs:
408
409     .. code-block:: console
410
411         modprobe uio
412         insmod igb_uio
413         ./dpdk-devbind.py -b igb_uio 02:00.0 02:00.1 0e:00.0 0e:00.1
414         echo 2 > /sys/bus/pci/devices/0000\:02\:00.0/max_vfs
415         echo 2 > /sys/bus/pci/devices/0000\:02\:00.1/max_vfs
416         echo 2 > /sys/bus/pci/devices/0000\:0e\:00.0/max_vfs
417         echo 2 > /sys/bus/pci/devices/0000\:0e\:00.1/max_vfs
418
419     .. note::
420
421         You need to explicitly specify number of vfs for each port, for example,
422         in the command above, it creates two vfs for the first two ixgbe ports.
423
424     Let say we have a machine with four physical ixgbe ports:
425
426
427         0000:02:00.0
428
429         0000:02:00.1
430
431         0000:0e:00.0
432
433         0000:0e:00.1
434
435     The command above creates two vfs for device 0000:02:00.0:
436
437     .. code-block:: console
438
439         ls -alrt /sys/bus/pci/devices/0000\:02\:00.0/virt*
440         lrwxrwxrwx. 1 root root 0 Apr 13 05:40 /sys/bus/pci/devices/0000:02:00.0/virtfn1 -> ../0000:02:10.2
441         lrwxrwxrwx. 1 root root 0 Apr 13 05:40 /sys/bus/pci/devices/0000:02:00.0/virtfn0 -> ../0000:02:10.0
442
443     It also creates two vfs for device 0000:02:00.1:
444
445     .. code-block:: console
446
447         ls -alrt /sys/bus/pci/devices/0000\:02\:00.1/virt*
448         lrwxrwxrwx. 1 root root 0 Apr 13 05:51 /sys/bus/pci/devices/0000:02:00.1/virtfn1 -> ../0000:02:10.3
449         lrwxrwxrwx. 1 root root 0 Apr 13 05:51 /sys/bus/pci/devices/0000:02:00.1/virtfn0 -> ../0000:02:10.1
450
451 #.  List the PCI devices connected and notice that the Host OS shows two Physical Functions (traditional ports)
452     and four Virtual Functions (two for each port).
453     This is the result of the previous step.
454
455 #.  Insert the pci_stub module to hold the PCI devices that are freed from the default driver using the following command
456     (see http://www.linux-kvm.org/page/How_to_assign_devices_with_VT-d_in_KVM Section 4 for more information):
457
458     .. code-block:: console
459
460         sudo /sbin/modprobe pci-stub
461
462     Unbind the default driver from the PCI devices representing the Virtual Functions.
463     A script to perform this action is as follows:
464
465     .. code-block:: console
466
467         echo "8086 10ed" > /sys/bus/pci/drivers/pci-stub/new_id
468         echo 0000:08:10.0 > /sys/bus/pci/devices/0000:08:10.0/driver/unbind
469         echo 0000:08:10.0 > /sys/bus/pci/drivers/pci-stub/bind
470
471     where, 0000:08:10.0 belongs to the Virtual Function visible in the Host OS.
472
473 #.  Now, start the Virtual Machine by running the following command:
474
475     .. code-block:: console
476
477         /usr/local/kvm/bin/qemu-system-x86_64 -m 4096 -smp 4 -boot c -hda lucid.qcow2 -device pci-assign,host=08:10.0
478
479     where:
480
481         — -m = memory to assign
482
483         — -smp = number of smp cores
484
485         — -boot = boot option
486
487         — -hda = virtual disk image
488
489         — -device = device to attach
490
491     .. note::
492
493         — The pci-assign,host=08:10.0 value indicates that you want to attach a PCI device
494         to a Virtual Machine and the respective (Bus:Device.Function)
495         numbers should be passed for the Virtual Function to be attached.
496
497         — qemu-kvm-0.14.0 allows a maximum of four PCI devices assigned to a VM,
498         but this is qemu-kvm version dependent since qemu-kvm-0.14.1 allows a maximum of five PCI devices.
499
500         — qemu-system-x86_64 also has a -cpu command line option that is used to select the cpu_model
501         to emulate in a Virtual Machine. Therefore, it can be used as:
502
503         .. code-block:: console
504
505             /usr/local/kvm/bin/qemu-system-x86_64 -cpu ?
506
507             (to list all available cpu_models)
508
509             /usr/local/kvm/bin/qemu-system-x86_64 -m 4096 -cpu host -smp 4 -boot c -hda lucid.qcow2 -device pci-assign,host=08:10.0
510
511             (to use the same cpu_model equivalent to the host cpu)
512
513         For more information, please refer to: `http://wiki.qemu.org/Features/CPUModels <http://wiki.qemu.org/Features/CPUModels>`_.
514
515 #.  If use vfio-pci to pass through device instead of pci-assign, steps 8 and 9 need to be updated to bind device to vfio-pci and
516     replace pci-assign with vfio-pci when start virtual machine.
517
518     .. code-block:: console
519
520         sudo /sbin/modprobe vfio-pci
521
522         echo "8086 10ed" > /sys/bus/pci/drivers/vfio-pci/new_id
523         echo 0000:08:10.0 > /sys/bus/pci/devices/0000:08:10.0/driver/unbind
524         echo 0000:08:10.0 > /sys/bus/pci/drivers/vfio-pci/bind
525
526         /usr/local/kvm/bin/qemu-system-x86_64 -m 4096 -smp 4 -boot c -hda lucid.qcow2 -device vfio-pci,host=08:10.0
527
528 #.  Install and run DPDK host app to take  over the Physical Function. Eg.
529
530     .. code-block:: console
531
532         ./<build_dir>/app/dpdk-testpmd -l 0-3 -n 4 -- -i
533
534 #.  Finally, access the Guest OS using vncviewer with the localhost:5900 port and check the lspci command output in the Guest OS.
535     The virtual functions will be listed as available for use.
536
537 #.  Configure and install the DPDK on the Guest OS as normal, that is, there is no change to the normal installation procedure.
538
539 .. note::
540
541     If you are unable to compile the DPDK and you are getting "error: CPU you selected does not support x86-64 instruction set",
542     power off the Guest OS and start the virtual machine with the correct -cpu option in the qemu- system-x86_64 command as shown in step 9.
543     You must select the best x86_64 cpu_model to emulate or you can select host option if available.
544
545 .. note::
546
547     Run the DPDK l2fwd sample application in the Guest OS with Hugepages enabled.
548     For the expected benchmark performance, you must pin the cores from the Guest OS to the Host OS (taskset can be used to do this) and
549     you must also look at the PCI Bus layout on the board to ensure you are not running the traffic over the QPI Interface.
550
551 .. note::
552
553     *   The Virtual Machine Manager (the Fedora package name is virt-manager) is a utility for virtual machine management
554         that can also be used to create, start, stop and delete virtual machines.
555         If this option is used, step 2 and 6 in the instructions provided will be different.
556
557     *   virsh, a command line utility for virtual machine management,
558         can also be used to bind and unbind devices to a virtual machine in Ubuntu.
559         If this option is used, step 6 in the instructions provided will be different.
560
561     *   The Virtual Machine Monitor (see :numref:`figure_perf_benchmark`) is equivalent to a Host OS with KVM installed as described in the instructions.
562
563 .. _figure_perf_benchmark:
564
565 .. figure:: img/perf_benchmark.*
566
567    Performance Benchmark Setup
568
569
570 DPDK SR-IOV PMD PF/VF Driver Usage Model
571 ----------------------------------------
572
573 Fast Host-based Packet Processing
574 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
575
576 Software Defined Network (SDN) trends are demanding fast host-based packet handling.
577 In a virtualization environment,
578 the DPDK VF PMD performs the same throughput result as a non-VT native environment.
579
580 With such host instance fast packet processing, lots of services such as filtering, QoS,
581 DPI can be offloaded on the host fast path.
582
583 :numref:`figure_fast_pkt_proc` shows the scenario where some VMs directly communicate externally via a VFs,
584 while others connect to a virtual switch and share the same uplink bandwidth.
585
586 .. _figure_fast_pkt_proc:
587
588 .. figure:: img/fast_pkt_proc.*
589
590    Fast Host-based Packet Processing
591
592
593 SR-IOV (PF/VF) Approach for Inter-VM Communication
594 --------------------------------------------------
595
596 Inter-VM data communication is one of the traffic bottle necks in virtualization platforms.
597 SR-IOV device assignment helps a VM to attach the real device, taking advantage of the bridge in the NIC.
598 So VF-to-VF traffic within the same physical port (VM0<->VM1) have hardware acceleration.
599 However, when VF crosses physical ports (VM0<->VM2), there is no such hardware bridge.
600 In this case, the DPDK PMD PF driver provides host forwarding between such VMs.
601
602 :numref:`figure_inter_vm_comms` shows an example.
603 In this case an update of the MAC address lookup tables in both the NIC and host DPDK application is required.
604
605 In the NIC, writing the destination of a MAC address belongs to another cross device VM to the PF specific pool.
606 So when a packet comes in, its destination MAC address will match and forward to the host DPDK PMD application.
607
608 In the host DPDK application, the behavior is similar to L2 forwarding,
609 that is, the packet is forwarded to the correct PF pool.
610 The SR-IOV NIC switch forwards the packet to a specific VM according to the MAC destination address
611 which belongs to the destination VF on the VM.
612
613 .. _figure_inter_vm_comms:
614
615 .. figure:: img/inter_vm_comms.*
616
617    Inter-VM Communication
618
619
620 Windows Support
621 ---------------
622
623 *   IAVF PMD currently is supported only inside Windows guest created on Linux host.
624
625 *   Physical PCI resources are exposed as virtual functions
626     into Windows VM using SR-IOV pass-through feature.
627
628 *   Create a Windows guest on Linux host using KVM hypervisor.
629     Refer to the steps mentioned in the above section: :ref:`intel_vf_kvm`.
630
631 *   In the Host machine, download and install the kernel Ethernet driver
632     for `i40e <https://downloadcenter.intel.com/download/24411>`_
633     or `ice <https://downloadcenter.intel.com/download/29746>`_.
634
635 *   For Windows guest, install NetUIO driver
636     in place of existing built-in (inbox) Virtual Function driver.
637
638 *   To load NetUIO driver, follow the steps mentioned in `dpdk-kmods repository
639     <https://git.dpdk.org/dpdk-kmods/tree/windows/netuio/README.rst>`_.
640
641
642 Inline IPsec Support
643 --------------------
644
645 *   IAVF PMD supports inline crypto processing depending on the underlying
646     hardware crypto capabilities. IPsec Security Gateway Sample Application
647     supports inline IPsec processing for IAVF PMD. For more details see the
648     IPsec Security Gateway Sample Application and Security library
649     documentation.