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