NFVBENCH-114 SRIOV run fails while creating VM
[nfvbench.git] / docs / testing / user / userguide / sriov.rst
1 .. This work is licensed under a Creative Commons Attribution 4.0 International License.
2 .. SPDX-License-Identifier: CC-BY-4.0
3 .. (c) Cisco Systems, Inc
4
5
6 Testing SR-IOV
7 ==============
8
9 NFVbench supports SR-IOV with the PVP packet flow (PVVP is not supported). SR-IOV support is not applicable for external chains since the networks have to be setup externally (and can themselves be pre-set to use SR-IOV or not).
10
11 Pre-requisites
12 --------------
13 To test SR-IOV you need to have compute nodes configured to support one or more SR-IOV interfaces (also knows as PF or physical function) and you need OpenStack to be configured to support SR-IOV.
14 You will also need to know:
15 - the name of the physical networks associated to your SR-IOV interfaces (this is a configuration in Nova compute)
16 - the VLAN range that can be used on the switch ports that are wired to the SR-IOV ports. Such switch ports are normally configured in trunk mode with a range of VLAN ids enabled on that port
17
18 For example, in the case of 2 SR-IOV ports per compute node, 2 physical networks are generally configured in OpenStack with a distinct name.
19 The VLAN range to use is is also allocated and reserved by the network administrator and in coordination with the corresponding top of rack switch port configuration.
20
21
22 Configuration
23 -------------
24 To enable SR-IOV test, you will need to provide the following configuration options to NFVbench (in the configuration file).
25 This example instructs NFVbench to create the left and right networks of a PVP packet flow to run on 2 SRIOV ports named "phys_sriov0" and "phys_sriov1" using resp. segmentation_id 2000 and 2001:
26
27 .. code-block:: bash
28
29     sriov: true
30     internal_networks:
31        left:
32            segmentation_id: 2000
33            physical_network: phys_sriov0
34        right:
35            segmentation_id: 2001
36            physical_network: phys_sriov1
37
38 The segmentation ID fields must be different.
39 In the case of PVVP, the middle network also needs to be provisioned properly.
40 The same physical network can also be shared by the virtual networks but with different segmentation IDs.
41
42 NFVbench cores with SR-IOV
43 --------------------------
44 The default core count for NFVbench/TRex may not be sufficient for higher throughput line cards (greater than 10Gbps).
45 This will result in warning messages such as:
46
47 .. code-block:: bash
48
49     INFO WARNING: There is a significant difference between requested TX rate (119047618) and actual TX rate (38897379).
50     The traffic generator may not have sufficient CPU to achieve the requested TX rate.
51
52 In that case it is recommended to try allocating more cores to TRex using the cores property in the configuration
53 file, for example to set to 8 cores:
54
55 .. code-block:: bash
56
57     cores: 8
58
59 It is also advisable to increase the number of vcpus in the VMs:
60
61
62 VM Flavor for SR-IOV and NIC NUMA socket placement
63 --------------------------------------------------
64
65 Because SR-IOV throughput uses a lot of CPU in the VM, it is recommended to increase the
66 vcpu count, for example to 4 vcpus:
67
68 .. code-block:: bash
69
70     flavor:
71       # Number of vCPUs for the flavor
72       vcpus: 4
73       # Memory for the flavor in MB
74       ram: 8192
75       # Size of local disk in GB
76       disk: 0
77       extra_specs:
78           "hw:cpu_policy": dedicated
79
80 If the 2 selected ports reside on NICs that are on different NUMA sockets, you will need to explicitly tell Nova to use 2 numa nodes in the flavor used for the VMs in order to satisfy the filters, for example:
81
82 .. code-block:: bash
83
84     flavor:
85       # Number of vCPUs for the flavor
86       vcpus: 4
87       # Memory for the flavor in MB
88       ram: 8192
89       # Size of local disk in GB
90       disk: 0
91       extra_specs:
92           "hw:cpu_policy": dedicated
93           "hw:numa_nodes": 2
94
95 Failure to do so might cause the VM creation to fail with the Nova error
96 "Instance creation error: Insufficient compute resources:
97 Requested instance NUMA topology together with requested PCI devices cannot fit the given host NUMA topology."
98
99 Example of configuration file (summary)
100 ---------------------------------------
101
102 .. code-block:: bash
103
104     flavor:
105        # Number of vCPUs for the flavor
106        vcpus: 4
107        # Memory for the flavor in MB
108        ram: 8192
109        # Size of local disk in GB
110        disk: 0
111        extra_specs:
112           "hw:cpu_policy": dedicated
113     cores: 8
114     sriov: true
115     internal_networks:
116        left:
117           segmentation_id: 3830
118           physical_network: phys_sriov0
119        right:
120           segmentation_id: 3831
121           physical_network: phys_sriov1