Merge "Qemu: Mechanism to pass extra qemu cpu features and pin vCPU threads"
[vswitchperf.git] / docs / testing / user / userguide / testusage.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. http://creativecommons.org/licenses/by/4.0
3 .. (c) OPNFV, Intel Corporation, AT&T and others.
4
5 vSwitchPerf test suites userguide
6 ---------------------------------
7
8 General
9 ^^^^^^^
10
11 VSPERF requires a traffic generators to run tests, automated traffic gen
12 support in VSPERF includes:
13
14 - IXIA traffic generator (IxNetwork hardware) and a machine that runs the IXIA
15   client software.
16 - Spirent traffic generator (TestCenter hardware chassis or TestCenter virtual
17   in a VM) and a VM to run the Spirent Virtual Deployment Service image,
18   formerly known as "Spirent LabServer".
19 - Xena Network traffic generator (Xena hardware chassis) that houses the Xena
20   Traffic generator modules.
21 - Moongen software traffic generator. Requires a separate machine running
22   moongen to execute packet generation.
23
24 If you want to use another traffic generator, please select the :ref:`trafficgen-dummy`
25 generator.
26
27 VSPERF Installation
28 ^^^^^^^^^^^^^^^^^^^
29
30 To see the supported Operating Systems, vSwitches and system requirements,
31 please follow the `installation instructions <vsperf-installation>`.
32
33 Traffic Generator Setup
34 ^^^^^^^^^^^^^^^^^^^^^^^
35
36 Follow the `Traffic generator instructions <trafficgen-installation>` to
37 install and configure a suitable traffic generator.
38
39 Cloning and building src dependencies
40 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
41
42 In order to run VSPERF, you will need to download DPDK and OVS. You can
43 do this manually and build them in a preferred location, OR you could
44 use vswitchperf/src. The vswitchperf/src directory contains makefiles
45 that will allow you to clone and build the libraries that VSPERF depends
46 on, such as DPDK and OVS. To clone and build simply:
47
48 .. code-block:: console
49
50     $ cd src
51     $ make
52
53 VSPERF can be used with stock OVS (without DPDK support). When build
54 is finished, the libraries are stored in src_vanilla directory.
55
56 The 'make' builds all options in src:
57
58 * Vanilla OVS
59 * OVS with vhost_user as the guest access method (with DPDK support)
60
61 The vhost_user build will reside in src/ovs/
62 The Vanilla OVS build will reside in vswitchperf/src_vanilla
63
64 To delete a src subdirectory and its contents to allow you to re-clone simply
65 use:
66
67 .. code-block:: console
68
69      $ make clobber
70
71 Configure the ``./conf/10_custom.conf`` file
72 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
73
74 The ``10_custom.conf`` file is the configuration file that overrides
75 default configurations in all the other configuration files in ``./conf``
76 The supplied ``10_custom.conf`` file **MUST** be modified, as it contains
77 configuration items for which there are no reasonable default values.
78
79 The configuration items that can be added is not limited to the initial
80 contents. Any configuration item mentioned in any .conf file in
81 ``./conf`` directory can be added and that item will be overridden by
82 the custom configuration value.
83
84 Further details about configuration files evaluation and special behaviour
85 of options with ``GUEST_`` prefix could be found at :ref:`design document
86 <design-configuration>`.
87
88 Using a custom settings file
89 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
90
91 If your ``10_custom.conf`` doesn't reside in the ``./conf`` directory
92 of if you want to use an alternative configuration file, the file can
93 be passed to ``vsperf`` via the ``--conf-file`` argument.
94
95 .. code-block:: console
96
97     $ ./vsperf --conf-file <path_to_custom_conf> ...
98
99 Note that configuration passed in via the environment (``--load-env``)
100 or via another command line argument will override both the default and
101 your custom configuration files. This "priority hierarchy" can be
102 described like so (1 = max priority):
103
104 1. Testcase definition section ``Parameters``
105 2. Command line arguments
106 3. Environment variables
107 4. Configuration file(s)
108
109 Further details about configuration files evaluation and special behaviour
110 of options with ``GUEST_`` prefix could be found at :ref:`design document
111 <design-configuration>`.
112
113 .. _overriding-parameters-documentation:
114
115 Overriding values defined in configuration files
116 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
117
118 The configuration items can be overridden by command line argument
119 ``--test-params``. In this case, the configuration items and
120 their values should be passed in form of ``item=value`` and separated
121 by semicolon.
122
123 Example:
124
125 .. code:: console
126
127     $ ./vsperf --test-params "TRAFFICGEN_DURATION=10;TRAFFICGEN_PKT_SIZES=(128,);" \
128                              "GUEST_LOOPBACK=['testpmd','l2fwd']" pvvp_tput
129
130 The second option is to override configuration items by ``Parameters`` section
131 of the test case definition. The configuration items can be added into ``Parameters``
132 dictionary with their new values. These values will override values defined in
133 configuration files or specified by ``--test-params`` command line argument.
134
135 Example:
136
137 .. code:: python
138
139     "Parameters" : {'TRAFFICGEN_PKT_SIZES' : (128,),
140                     'TRAFFICGEN_DURATION' : 10,
141                     'GUEST_LOOPBACK' : ['testpmd','l2fwd'],
142                    }
143
144 **NOTE:** In both cases, configuration item names and their values must be specified
145 in the same form as they are defined inside configuration files. Parameter names
146 must be specified in uppercase and data types of original and new value must match.
147 Python syntax rules related to data types and structures must be followed.
148 For example, parameter ``TRAFFICGEN_PKT_SIZES`` above is defined as a tuple
149 with a single value ``128``. In this case trailing comma is mandatory, otherwise
150 value can be wrongly interpreted as a number instead of a tuple and vsperf
151 execution would fail. Please check configuration files for default values and their
152 types and use them as a basis for any customized values. In case of any doubt, please
153 check official python documentation related to data structures like tuples, lists
154 and dictionaries.
155
156 **NOTE:** Vsperf execution will terminate with runtime error in case, that unknown
157 parameter name is passed via ``--test-params`` CLI argument or defined in ``Parameters``
158 section of test case definition. It is also forbidden to redefine a value of
159 ``TEST_PARAMS`` configuration item via CLI or ``Parameters`` section.
160
161 vloop_vnf
162 ^^^^^^^^^
163
164 VSPERF uses a VM image called vloop_vnf for looping traffic in the deployment
165 scenarios involving VMs. The image can be downloaded from
166 `<http://artifacts.opnfv.org/>`__.
167
168 Please see the installation instructions for information on :ref:`vloop-vnf`
169 images.
170
171 .. _l2fwd-module:
172
173 l2fwd Kernel Module
174 ^^^^^^^^^^^^^^^^^^^
175
176 A Kernel Module that provides OSI Layer 2 Ipv4 termination or forwarding with
177 support for Destination Network Address Translation (DNAT) for both the MAC and
178 IP addresses. l2fwd can be found in <vswitchperf_dir>/src/l2fwd
179
180 Executing tests
181 ^^^^^^^^^^^^^^^
182
183 All examples inside these docs assume, that user is inside the VSPERF
184 directory. VSPERF can be executed from any directory.
185
186 Before running any tests make sure you have root permissions by adding
187 the following line to /etc/sudoers:
188
189 .. code-block:: console
190
191     username ALL=(ALL)       NOPASSWD: ALL
192
193 username in the example above should be replaced with a real username.
194
195 To list the available tests:
196
197 .. code-block:: console
198
199     $ ./vsperf --list
200
201 To run a single test:
202
203 .. code-block:: console
204
205     $ ./vsperf $TESTNAME
206
207 Where $TESTNAME is the name of the vsperf test you would like to run.
208
209 To run a group of tests, for example all tests with a name containing
210 'RFC2544':
211
212 .. code-block:: console
213
214     $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf --tests="RFC2544"
215
216 To run all tests:
217
218 .. code-block:: console
219
220     $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
221
222 Some tests allow for configurable parameters, including test duration
223 (in seconds) as well as packet sizes (in bytes).
224
225 .. code:: bash
226
227     $ ./vsperf --conf-file user_settings.py \
228         --tests RFC2544Tput \
229         --test-params "TRAFFICGEN_DURATION=10;TRAFFICGEN_PKT_SIZES=(128,)"
230
231 For all available options, check out the help dialog:
232
233 .. code-block:: console
234
235     $ ./vsperf --help
236
237 Executing Vanilla OVS tests
238 ^^^^^^^^^^^^^^^^^^^^^^^^^^^
239
240 1. If needed, recompile src for all OVS variants
241
242    .. code-block:: console
243
244        $ cd src
245        $ make distclean
246        $ make
247
248 2. Update your ``10_custom.conf`` file to use Vanilla OVS:
249
250    .. code-block:: python
251
252        VSWITCH = 'OvsVanilla'
253
254 3. Run test:
255
256    .. code-block:: console
257
258        $ ./vsperf --conf-file=<path_to_custom_conf>
259
260    Please note if you don't want to configure Vanilla OVS through the
261    configuration file, you can pass it as a CLI argument.
262
263    .. code-block:: console
264
265        $ ./vsperf --vswitch OvsVanilla
266
267
268 Executing tests with VMs
269 ^^^^^^^^^^^^^^^^^^^^^^^^
270
271 To run tests using vhost-user as guest access method:
272
273 1. Set VHOST_METHOD and VNF of your settings file to:
274
275    .. code-block:: python
276
277        VSWITCH = 'OvsDpdkVhost'
278        VNF = 'QemuDpdkVhost'
279
280 2. If needed, recompile src for all OVS variants
281
282    .. code-block:: console
283
284        $ cd src
285        $ make distclean
286        $ make
287
288 3. Run test:
289
290    .. code-block:: console
291
292        $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
293
294 Executing tests with VMs using Vanilla OVS
295 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
296
297 To run tests using Vanilla OVS:
298
299 1. Set the following variables:
300
301    .. code-block:: python
302
303        VSWITCH = 'OvsVanilla'
304        VNF = 'QemuVirtioNet'
305
306        VANILLA_TGEN_PORT1_IP = n.n.n.n
307        VANILLA_TGEN_PORT1_MAC = nn:nn:nn:nn:nn:nn
308
309        VANILLA_TGEN_PORT2_IP = n.n.n.n
310        VANILLA_TGEN_PORT2_MAC = nn:nn:nn:nn:nn:nn
311
312        VANILLA_BRIDGE_IP = n.n.n.n
313
314    or use ``--test-params`` option
315
316    .. code-block:: console
317
318        $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf \
319                   --test-params "VANILLA_TGEN_PORT1_IP=n.n.n.n;" \
320                                 "VANILLA_TGEN_PORT1_MAC=nn:nn:nn:nn:nn:nn;" \
321                                 "VANILLA_TGEN_PORT2_IP=n.n.n.n;" \
322                                 "VANILLA_TGEN_PORT2_MAC=nn:nn:nn:nn:nn:nn"
323
324 2. If needed, recompile src for all OVS variants
325
326    .. code-block:: console
327
328        $ cd src
329        $ make distclean
330        $ make
331
332 3. Run test:
333
334    .. code-block:: console
335
336        $ ./vsperf --conf-file<path_to_custom_conf>/10_custom.conf
337
338 .. _vpp-test:
339
340 Executing VPP tests
341 ^^^^^^^^^^^^^^^^^^^
342
343 Currently it is not possible to use standard scenario deployments for execution of
344 tests with VPP. It means, that deployments ``p2p``, ``pvp``, ``pvvp`` and in general any
345 :ref:`pxp-deployment` won't work with VPP. However it is possible to use VPP in
346 :ref:`step-driven-tests`. A basic set of VPP testcases covering ``phy2phy``, ``pvp``
347 and ``pvvp`` tests are already prepared.
348
349 List of performance tests with VPP support follows:
350
351 * phy2phy_tput_vpp:              VPP: LTD.Throughput.RFC2544.PacketLossRatio
352 * phy2phy_cont_vpp:              VPP: Phy2Phy Continuous Stream
353 * phy2phy_back2back_vpp:         VPP: LTD.Throughput.RFC2544.BackToBackFrames
354 * pvp_tput_vpp:                  VPP: LTD.Throughput.RFC2544.PacketLossRatio
355 * pvp_cont_vpp:                  VPP: PVP Continuous Stream
356 * pvp_back2back_vpp:             VPP: LTD.Throughput.RFC2544.BackToBackFrames
357 * pvvp_tput_vpp:                 VPP: LTD.Throughput.RFC2544.PacketLossRatio
358 * pvvp_cont_vpp:                 VPP: PVP Continuous Stream
359 * pvvp_back2back_vpp:            VPP: LTD.Throughput.RFC2544.BackToBackFrames
360
361 In order to execute testcases with VPP it is required to:
362
363 * install VPP manually, see :ref:`vpp-installation`
364 * configure ``WHITELIST_NICS``, with two physical NICs connected to the traffic generator
365 * configure traffic generator, see :ref:`trafficgen-installation`
366
367 After that it is possible to execute VPP testcases listed above.
368
369 For example:
370
371 .. code-block:: console
372
373     $ ./vsperf --conf-file=<path_to_custom_conf> phy2phy_tput_vpp
374
375 .. _vfio-pci:
376
377 Using vfio_pci with DPDK
378 ^^^^^^^^^^^^^^^^^^^^^^^^^
379
380 To use vfio with DPDK instead of igb_uio add into your custom configuration
381 file the following parameter:
382
383 .. code-block:: python
384
385     PATHS['dpdk']['src']['modules'] = ['uio', 'vfio-pci']
386
387
388 **NOTE:** In case, that DPDK is installed from binary package, then please
389 set ``PATHS['dpdk']['bin']['modules']`` instead.
390
391 **NOTE:** Please ensure that Intel VT-d is enabled in BIOS.
392
393 **NOTE:** Please ensure your boot/grub parameters include
394 the following:
395
396 **NOTE:** In case of VPP, it is required to explicitly define, that vfio-pci
397 DPDK driver should be used. It means to update dpdk part of VSWITCH_VPP_ARGS
398 dictionary with uio-driver section, e.g. VSWITCH_VPP_ARGS['dpdk'] = 'uio-driver vfio-pci'
399
400 .. code-block:: console
401
402     iommu=pt intel_iommu=on
403
404 To check that IOMMU is enabled on your platform:
405
406 .. code-block:: console
407
408     $ dmesg | grep IOMMU
409     [    0.000000] Intel-IOMMU: enabled
410     [    0.139882] dmar: IOMMU 0: reg_base_addr fbffe000 ver 1:0 cap d2078c106f0466 ecap f020de
411     [    0.139888] dmar: IOMMU 1: reg_base_addr ebffc000 ver 1:0 cap d2078c106f0466 ecap f020de
412     [    0.139893] IOAPIC id 2 under DRHD base  0xfbffe000 IOMMU 0
413     [    0.139894] IOAPIC id 0 under DRHD base  0xebffc000 IOMMU 1
414     [    0.139895] IOAPIC id 1 under DRHD base  0xebffc000 IOMMU 1
415     [    3.335744] IOMMU: dmar0 using Queued invalidation
416     [    3.335746] IOMMU: dmar1 using Queued invalidation
417     ....
418
419 .. _SRIOV-support:
420
421 Using SRIOV support
422 ^^^^^^^^^^^^^^^^^^^
423
424 To use virtual functions of NIC with SRIOV support, use extended form
425 of NIC PCI slot definition:
426
427 .. code-block:: python
428
429     WHITELIST_NICS = ['0000:05:00.0|vf0', '0000:05:00.1|vf3']
430
431 Where 'vf' is an indication of virtual function usage and following
432 number defines a VF to be used. In case that VF usage is detected,
433 then vswitchperf will enable SRIOV support for given card and it will
434 detect PCI slot numbers of selected VFs.
435
436 So in example above, one VF will be configured for NIC '0000:05:00.0'
437 and four VFs will be configured for NIC '0000:05:00.1'. Vswitchperf
438 will detect PCI addresses of selected VFs and it will use them during
439 test execution.
440
441 At the end of vswitchperf execution, SRIOV support will be disabled.
442
443 SRIOV support is generic and it can be used in different testing scenarios.
444 For example:
445
446 * vSwitch tests with DPDK or without DPDK support to verify impact
447   of VF usage on vSwitch performance
448 * tests without vSwitch, where traffic is forwared directly
449   between VF interfaces by packet forwarder (e.g. testpmd application)
450 * tests without vSwitch, where VM accesses VF interfaces directly
451   by PCI-passthrough_ to measure raw VM throughput performance.
452
453 .. _PCI-passthrough:
454
455 Using QEMU with PCI passthrough support
456 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
457
458 Raw virtual machine throughput performance can be measured by execution of PVP
459 test with direct access to NICs by PCI passthrough. To execute VM with direct
460 access to PCI devices, enable vfio-pci_. In order to use virtual functions,
461 SRIOV-support_ must be enabled.
462
463 Execution of test with PCI passthrough with vswitch disabled:
464
465 .. code-block:: console
466
467     $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf \
468                --vswitch none --vnf QemuPciPassthrough pvp_tput
469
470 Any of supported guest-loopback-application_ can be used inside VM with
471 PCI passthrough support.
472
473 Note: Qemu with PCI passthrough support can be used only with PVP test
474 deployment.
475
476 .. _guest-loopback-application:
477
478 Selection of loopback application for tests with VMs
479 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
480
481 To select the loopback applications which will forward packets inside VMs,
482 the following parameter should be configured:
483
484 .. code-block:: python
485
486      GUEST_LOOPBACK = ['testpmd']
487
488 or use ``--test-params`` CLI argument:
489
490 .. code-block:: console
491
492         $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf \
493               --test-params "GUEST_LOOPBACK=['testpmd']"
494
495 Supported loopback applications are:
496
497 .. code-block:: console
498
499      'testpmd'       - testpmd from dpdk will be built and used
500      'l2fwd'         - l2fwd module provided by Huawei will be built and used
501      'linux_bridge'  - linux bridge will be configured
502      'buildin'       - nothing will be configured by vsperf; VM image must
503                        ensure traffic forwarding between its interfaces
504
505 Guest loopback application must be configured, otherwise traffic
506 will not be forwarded by VM and testcases with VM related deployments
507 will fail. Guest loopback application is set to 'testpmd' by default.
508
509 **NOTE:** In case that only 1 or more than 2 NICs are configured for VM,
510 then 'testpmd' should be used. As it is able to forward traffic between
511 multiple VM NIC pairs.
512
513 **NOTE:** In case of linux_bridge, all guest NICs are connected to the same
514 bridge inside the guest.
515
516 Mergable Buffers Options with QEMU
517 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
518
519 Mergable buffers can be disabled with VSPerf within QEMU. This option can
520 increase performance significantly when not using jumbo frame sized packets.
521 By default VSPerf disables mergable buffers. If you wish to enable it you
522 can modify the setting in the a custom conf file.
523
524 .. code-block:: python
525
526     GUEST_NIC_MERGE_BUFFERS_DISABLE = [False]
527
528 Then execute using the custom conf file.
529
530 .. code-block:: console
531
532         $ ./vsperf --conf-file=<path_to_custom_conf>/10_custom.conf
533
534 Alternatively you can just pass the param during execution.
535
536 .. code-block:: console
537
538         $ ./vsperf --test-params "GUEST_NIC_MERGE_BUFFERS_DISABLE=[False]"
539
540
541 Selection of dpdk binding driver for tests with VMs
542 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
543
544 To select dpdk binding driver, which will specify which driver the vm NICs will
545 use for dpdk bind, the following configuration parameter should be configured:
546
547 .. code-block:: console
548
549      GUEST_DPDK_BIND_DRIVER = ['igb_uio_from_src']
550
551 The supported dpdk guest bind drivers are:
552
553 .. code-block:: console
554
555     'uio_pci_generic'      - Use uio_pci_generic driver
556     'igb_uio_from_src'     - Build and use the igb_uio driver from the dpdk src
557                              files
558     'vfio_no_iommu'        - Use vfio with no iommu option. This requires custom
559                              guest images that support this option. The default
560                              vloop image does not support this driver.
561
562 Note: uio_pci_generic does not support sr-iov testcases with guests attached.
563 This is because uio_pci_generic only supports legacy interrupts. In case
564 uio_pci_generic is selected with the vnf as QemuPciPassthrough it will be
565 modified to use igb_uio_from_src instead.
566
567 Note: vfio_no_iommu requires kernels equal to or greater than 4.5 and dpdk
568 16.04 or greater. Using this option will also taint the kernel.
569
570 Please refer to the dpdk documents at http://dpdk.org/doc/guides for more
571 information on these drivers.
572
573 Guest Core and Thread Binding
574 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
575
576 VSPERF provides options to achieve better performance by guest core binding and
577 guest vCPU thread binding as well. Core binding is to bind all the qemu threads.
578 Thread binding is to bind the house keeping threads to some CPU and vCPU thread to
579 some other CPU, this helps to reduce the noise from qemu house keeping threads.
580
581
582 .. code-block:: python
583
584    GUEST_CORE_BINDING = [('#EVAL(6+2*#VMINDEX)', '#EVAL(7+2*#VMINDEX)')]
585
586 **NOTE** By default the GUEST_THREAD_BINDING will be none, which means same as
587 the GUEST_CORE_BINDING, i.e. the vcpu threads are sharing the physical CPUs with
588 the house keeping threads. Better performance using vCPU thread binding can be
589 achieved by enabling affinity in the custom configuration file.
590
591 For example, if an environment requires 32,33 to be core binded and 29,30&31 for
592 guest thread binding to achieve better performance.
593
594 .. code-block:: python
595
596    VNF_AFFINITIZATION_ON = True
597    GUEST_CORE_BINDING = [('32','33')]
598    GUEST_THREAD_BINDING = [('29', '30', '31')]
599
600 Qemu CPU features
601 ^^^^^^^^^^^^^^^^^
602
603 QEMU default to a compatible subset of performance enhancing cpu features.
604 To pass all available host processor features to the guest.
605
606 .. code-block:: python
607
608    GUEST_CPU_OPTIONS = ['host,migratable=off']
609
610 **NOTE** To enhance the performance, cpu features tsc deadline timer for guest,
611 the guest PMU, the invariant TSC can be provided in the custom configuration file.
612
613 Multi-Queue Configuration
614 ^^^^^^^^^^^^^^^^^^^^^^^^^
615
616 VSPerf currently supports multi-queue with the following limitations:
617
618 1.  Requires QEMU 2.5 or greater and any OVS version higher than 2.5. The
619     default upstream package versions installed by VSPerf satisfies this
620     requirement.
621
622 2.  Guest image must have ethtool utility installed if using l2fwd or linux
623     bridge inside guest for loopback.
624
625 3.  If using OVS versions 2.5.0 or less enable old style multi-queue as shown
626     in the ''02_vswitch.conf'' file.
627
628     .. code-block:: python
629
630         OVS_OLD_STYLE_MQ = True
631
632 To enable multi-queue for dpdk modify the ''02_vswitch.conf'' file.
633
634 .. code-block:: python
635
636     VSWITCH_DPDK_MULTI_QUEUES = 2
637
638 **NOTE:** you should consider using the switch affinity to set a pmd cpu mask
639 that can optimize your performance. Consider the numa of the NIC in use if this
640 applies by checking /sys/class/net/<eth_name>/device/numa_node and setting an
641 appropriate mask to create PMD threads on the same numa node.
642
643 When multi-queue is enabled, each dpdk or dpdkvhostuser port that is created
644 on the switch will set the option for multiple queues. If old style multi queue
645 has been enabled a global option for multi queue will be used instead of the
646 port by port option.
647
648 To enable multi-queue on the guest modify the ''04_vnf.conf'' file.
649
650 .. code-block:: python
651
652     GUEST_NIC_QUEUES = [2]
653
654 Enabling multi-queue at the guest will add multiple queues to each NIC port when
655 qemu launches the guest.
656
657 In case of Vanilla OVS, multi-queue is enabled on the tuntap ports and nic
658 queues will be enabled inside the guest with ethtool. Simply enabling the
659 multi-queue on the guest is sufficient for Vanilla OVS multi-queue.
660
661 Testpmd should be configured to take advantage of multi-queue on the guest if
662 using DPDKVhostUser. This can be done by modifying the ''04_vnf.conf'' file.
663
664 .. code-block:: python
665
666     GUEST_TESTPMD_PARAMS = ['-l 0,1,2,3,4  -n 4 --socket-mem 512 -- '
667                             '--burst=64 -i --txqflags=0xf00 '
668                             '--nb-cores=4 --rxq=2 --txq=2 '
669                             '--disable-hw-vlan']
670
671 **NOTE:** The guest SMP cores must be configured to allow for testpmd to use the
672 optimal number of cores to take advantage of the multiple guest queues.
673
674 In case of using Vanilla OVS and qemu virtio-net you can increase performance
675 by binding vhost-net threads to cpus. This can be done by enabling the affinity
676 in the ''04_vnf.conf'' file. This can be done to non multi-queue enabled
677 configurations as well as there will be 2 vhost-net threads.
678
679 .. code-block:: python
680
681     VSWITCH_VHOST_NET_AFFINITIZATION = True
682
683     VSWITCH_VHOST_CPU_MAP = [4,5,8,11]
684
685 **NOTE:** This method of binding would require a custom script in a real
686 environment.
687
688 **NOTE:** For optimal performance guest SMPs and/or vhost-net threads should be
689 on the same numa as the NIC in use if possible/applicable. Testpmd should be
690 assigned at least (nb_cores +1) total cores with the cpu mask.
691
692 Jumbo Frame Testing
693 ^^^^^^^^^^^^^^^^^^^
694
695 VSPERF provides options to support jumbo frame testing with a jumbo frame supported
696 NIC and traffic generator for the following vswitches:
697
698 1.  OVSVanilla
699
700 2.  OvsDpdkVhostUser
701
702 3.  TestPMD loopback with or without a guest
703
704 **NOTE:** There is currently no support for SR-IOV or VPP at this time with jumbo
705 frames.
706
707 All packet forwarding applications for pxp testing is supported.
708
709 To enable jumbo frame testing simply enable the option in the conf files and set the
710 maximum size that will be used.
711
712 .. code-block:: python
713
714     VSWITCH_JUMBO_FRAMES_ENABLED = True
715     VSWITCH_JUMBO_FRAMES_SIZE = 9000
716
717 To enable jumbo frame testing with OVSVanilla the NIC in test on the host must have
718 its mtu size changed manually using ifconfig or applicable tools:
719
720 .. code-block:: console
721
722     ifconfig eth1 mtu 9000 up
723
724 **NOTE:** To make the setting consistent across reboots you should reference the OS
725 documents as it differs from distribution to distribution.
726
727 To start a test for jumbo frames modify the conf file packet sizes or pass the option
728 through the VSPERF command line.
729
730 .. code-block:: python
731
732     TEST_PARAMS = {'TRAFFICGEN_PKT_SIZES':(2000,9000)}
733
734 .. code-block:: python
735
736     ./vsperf --test-params "TRAFFICGEN_PKT_SIZES=2000,9000"
737
738 It is recommended to increase the memory size for OvsDpdkVhostUser testing from the default
739 1024. Your size required may vary depending on the number of guests in your testing. 4096
740 appears to work well for most typical testing scenarios.
741
742 .. code-block:: python
743
744     DPDK_SOCKET_MEM = ['4096', '0']
745
746 **NOTE:** For Jumbo frames to work with DpdkVhostUser, mergable buffers will be enabled by
747 default. If testing with mergable buffers in QEMU is desired, disable Jumbo Frames and only
748 test non jumbo frame sizes. Test Jumbo Frames sizes separately to avoid this collision.
749
750
751 Executing Packet Forwarding tests
752 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
753
754 To select the applications which will forward packets,
755 the following parameters should be configured:
756
757 .. code-block:: python
758
759     VSWITCH = 'none'
760     PKTFWD = 'TestPMD'
761
762 or use ``--vswitch`` and ``--fwdapp`` CLI arguments:
763
764 .. code-block:: console
765
766     $ ./vsperf phy2phy_cont --conf-file user_settings.py \
767                --vswitch none \
768                --fwdapp TestPMD
769
770 Supported Packet Forwarding applications are:
771
772 .. code-block:: console
773
774     'testpmd'       - testpmd from dpdk
775
776
777 1. Update your ''10_custom.conf'' file to use the appropriate variables
778    for selected Packet Forwarder:
779
780    .. code-block:: python
781
782       # testpmd configuration
783       TESTPMD_ARGS = []
784       # packet forwarding mode supported by testpmd; Please see DPDK documentation
785       # for comprehensive list of modes supported by your version.
786       # e.g. io|mac|mac_retry|macswap|flowgen|rxonly|txonly|csum|icmpecho|...
787       # Note: Option "mac_retry" has been changed to "mac retry" since DPDK v16.07
788       TESTPMD_FWD_MODE = 'csum'
789       # checksum calculation layer: ip|udp|tcp|sctp|outer-ip
790       TESTPMD_CSUM_LAYER = 'ip'
791       # checksum calculation place: hw (hardware) | sw (software)
792       TESTPMD_CSUM_CALC = 'sw'
793       # recognize tunnel headers: on|off
794       TESTPMD_CSUM_PARSE_TUNNEL = 'off'
795
796 2. Run test:
797
798    .. code-block:: console
799
800       $ ./vsperf phy2phy_tput --conf-file <path_to_settings_py>
801
802 Executing Packet Forwarding tests with one guest
803 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
804
805 TestPMD with DPDK 16.11 or greater can be used to forward packets as a switch to a single guest using TestPMD vdev
806 option. To set this configuration the following parameters should be used.
807
808     .. code-block:: python
809
810         VSWITCH = 'none'
811         PKTFWD = 'TestPMD'
812
813 or use ``--vswitch`` and ``--fwdapp`` CLI arguments:
814
815     .. code-block:: console
816
817         $ ./vsperf pvp_tput --conf-file user_settings.py \
818                    --vswitch none \
819                    --fwdapp TestPMD
820
821 Guest forwarding application only supports TestPMD in this configuration.
822
823     .. code-block:: python
824
825         GUEST_LOOPBACK = ['testpmd']
826
827 For optimal performance one cpu per port +1 should be used for TestPMD. Also set additional params for packet forwarding
828 application to use the correct number of nb-cores.
829
830     .. code-block:: python
831
832         DPDK_SOCKET_MEM = ['1024', '0']
833         VSWITCHD_DPDK_ARGS = ['-l', '46,44,42,40,38', '-n', '4']
834         TESTPMD_ARGS = ['--nb-cores=4', '--txq=1', '--rxq=1']
835
836 For guest TestPMD 3 VCpus should be assigned with the following TestPMD params.
837
838     .. code-block:: python
839
840         GUEST_TESTPMD_PARAMS = ['-l 0,1,2 -n 4 --socket-mem 1024 -- '
841                                 '--burst=64 -i --txqflags=0xf00 '
842                                 '--disable-hw-vlan --nb-cores=2 --txq=1 --rxq=1']
843
844 Execution of TestPMD can be run with the following command line
845
846     .. code-block:: console
847
848         ./vsperf pvp_tput --vswitch=none --fwdapp=TestPMD --conf-file <path_to_settings_py>
849
850 **NOTE:** To achieve the best 0% loss numbers with rfc2544 throughput testing, other tunings should be applied to host
851 and guest such as tuned profiles and CPU tunings to prevent possible interrupts to worker threads.
852
853 VSPERF modes of operation
854 ^^^^^^^^^^^^^^^^^^^^^^^^^
855
856 VSPERF can be run in different modes. By default it will configure vSwitch,
857 traffic generator and VNF. However it can be used just for configuration
858 and execution of traffic generator. Another option is execution of all
859 components except traffic generator itself.
860
861 Mode of operation is driven by configuration parameter -m or --mode
862
863 .. code-block:: console
864
865     -m MODE, --mode MODE  vsperf mode of operation;
866         Values:
867             "normal" - execute vSwitch, VNF and traffic generator
868             "trafficgen" - execute only traffic generator
869             "trafficgen-off" - execute vSwitch and VNF
870             "trafficgen-pause" - execute vSwitch and VNF but wait before traffic transmission
871
872 In case, that VSPERF is executed in "trafficgen" mode, then configuration
873 of traffic generator can be modified through ``TRAFFIC`` dictionary passed to the
874 ``--test-params`` option. It is not needed to specify all values of ``TRAFFIC``
875 dictionary. It is sufficient to specify only values, which should be changed.
876 Detailed description of ``TRAFFIC`` dictionary can be found at
877 :ref:`configuration-of-traffic-dictionary`.
878
879 Example of execution of VSPERF in "trafficgen" mode:
880
881 .. code-block:: console
882
883     $ ./vsperf -m trafficgen --trafficgen IxNet --conf-file vsperf.conf \
884         --test-params "TRAFFIC={'traffic_type':'rfc2544_continuous','bidir':'False','framerate':60}"
885
886 Code change verification by pylint
887 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
888
889 Every developer participating in VSPERF project should run
890 pylint before his python code is submitted for review. Project
891 specific configuration for pylint is available at 'pylint.rc'.
892
893 Example of manual pylint invocation:
894
895 .. code-block:: console
896
897           $ pylint --rcfile ./pylintrc ./vsperf
898
899 GOTCHAs:
900 ^^^^^^^^
901
902 Custom image fails to boot
903 ~~~~~~~~~~~~~~~~~~~~~~~~~~
904
905 Using custom VM images may not boot within VSPerf pxp testing because of
906 the drive boot and shared type which could be caused by a missing scsi
907 driver inside the image. In case of issues you can try changing the drive
908 boot type to ide.
909
910 .. code-block:: python
911
912     GUEST_BOOT_DRIVE_TYPE = ['ide']
913     GUEST_SHARED_DRIVE_TYPE = ['ide']
914
915 OVS with DPDK and QEMU
916 ~~~~~~~~~~~~~~~~~~~~~~~
917
918 If you encounter the following error: "before (last 100 chars):
919 '-path=/dev/hugepages,share=on: unable to map backing store for
920 hugepages: Cannot allocate memory\r\n\r\n" during qemu initialization,
921 check the amount of hugepages on your system:
922
923 .. code-block:: console
924
925     $ cat /proc/meminfo | grep HugePages
926
927
928 By default the vswitchd is launched with 1Gb of memory, to  change
929 this, modify --socket-mem parameter in conf/02_vswitch.conf to allocate
930 an appropriate amount of memory:
931
932 .. code-block:: python
933
934     DPDK_SOCKET_MEM = ['1024', '0']
935     VSWITCHD_DPDK_ARGS = ['-c', '0x4', '-n', '4']
936     VSWITCHD_DPDK_CONFIG = {
937         'dpdk-init' : 'true',
938         'dpdk-lcore-mask' : '0x4',
939         'dpdk-socket-mem' : '1024,0',
940     }
941
942 Note: Option ``VSWITCHD_DPDK_ARGS`` is used for vswitchd, which supports ``--dpdk``
943 parameter. In recent vswitchd versions, option ``VSWITCHD_DPDK_CONFIG`` will be
944 used to configure vswitchd via ``ovs-vsctl`` calls.
945
946
947 More information
948 ^^^^^^^^^^^^^^^^
949
950 For more information and details refer to the rest of vSwitchPerfuser documentation.
951