Configuring the Data Plane Development Kit (DPDK) Integrated with Contrail vRouter
DPDK Support in Contrail
Contrail 3.0 and later supports the Data Plane Development Kit (DPDK).
DPDK is an open source set of libraries and drivers for fast packet processing. DPDK enables fast packet processing by allowing network interface cards (NICs) to send direct memory access (DMA) packets directly into an application’s address space, allowing the application to poll for packets, and thereby avoiding the overhead of interrupts from the NIC.
Integrating with DPDK allows a Contrail vRouter to process more packets per second than is possible when running as a kernel module.
When using DPDK with Contrail Release 5.0, the DPDK configuration
should be defined in
for ansible based provision, or in instances.yaml
for helm-based provision. The AGENT_MODE configuration specifies
whether the hypervisor is provisioned in the DPDK mode of operation.host.yaml
When a Contrail compute node is provisioned with DPDK, the corresponding yaml file specifies the number of CPU cores to use for forwarding packets, the number of huge pages to allocate for DPDK, and the uio driver to use for DPDK.
Preparing the Environment File for Provisioning a Cluster Node with DPDK
The environment file is used at provsioning to specify all of the options necessary for the installation of a Contrail cluster, including whether any node should be configured to use DPDK.
Each node to be configured with the DPDK vRouter must be listed in the provisioning file with a dictionary entry, along with the percentage of memory for DPDK huge pages and the CPUs to be used.
The following are descriptions of the required entries for the server configuration. :
HUGE_PAGES
—Specify the percentage of host memory to be reserved for the DPDK huge pages. The reserved memory will be used by the vRouter and the Quick Emulator (QEMU) for allocating memory resources for the virtual machines (VMs) spawned on that host.Note:The percentage allocated to
HUGE_PAGES
should not be too high, because the host Linux kernel also requires memory.CPU_CORE_MASK
—Specify a CPU affinity mask with which vRouter will run. vRouter will use only the CPUs specified for its threads of execution. These CPU cores will be constantly polling for packets, and they will be displayed as 100% busy in the output of “top”.The supported format is hexadecimal (for example, 0xf).
DPDK_UIO_DRIVER
—Specify the UIO driver to be used with DPDK.The supported values include:
vfio-pci
—Specify that the vfio module in the Linux kernel should be used instead of uio. The vfio module protects memory access using the IOMMU when a SR-IOV virtual function is used as the physical interface of vrouter.uio_pci_generic
—Specify that the UIO driver built into the Linux kernel should be used. This option does not support the use of SR-IOV VFs. This is the default option if DPDK_UIO_DRIVER is not specified.mlnx
– For Mellanox ConnectX-5 NICs. This is available starting from Contrail release 5.0.1.
For RHEL and Intel x710 Fortville-based NIC, use vfio-pci
instead of the default uio_pci_generic.
Use the standard Ansible or helm-based provision procedure. Upon completion, your cluster, with specified nodes using the DPDK vRouter implementation, is ready to use.
Sample configuration in instances.yml for ansible-based provision
Bms1: provider: bms ip: ip-address roles: vrouter: AGENT_MODE: dpdk CPU_CORE_MASK: “0xff” DPDK_UIO_DRIVER: uio_pci_generic HUGE_PAGES: 32000
Sample configuration in host.yml for helm-based provision
... AGENT_MODE: dpdk CPU_CORE_MASK: “0xff” DPDK_UIO_DRIVER: uio_pci_generic HUGE_PAGES: 32000
Creating a Flavor for DPDK
To launch a VM in a DPDK-enabled vRouter hypervisor, the flavor for the VM should be set to use huge pages. The use of huge pages is a requirement for using a DPDK vRouter.
Use the following command to add the flavor, where m1.large
is the name of the flavor. When a VM is created
using this flavor, OpenStack ensures that the VM will only be spawned
on a compute node that has huge pages enabled.
# openstack flavor set m1.large --property hw:mem_page_size=large
Huge pages are enabled for compute nodes where vRouter is provisioned with DPDK.
If a VM is spawned with a flavor that does not have huge pages enabled, the VM should not be created on a compute node on which vRouter is provisioned with DPDK.
You can use OpenStack availability zones or host aggregates to exclude the hosts where vRouter is provisioned with DPDK.
Note: By default, 2MB huge pages are provisioned. If 1GB huge page is required, it must be done by the Administrator.