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