1、 Introduction
This document contains instructions for installing and configuring the Data Plane Development Kit (DPDK) software. It is designed to get customers up and running quickly. The document describes how to compile and run a DPDK application in a Linux application (linux) environment, without going deeply into detail.
2、Compilation of the DPDK
For Ubuntu/Debian systems these can be installed using apt install build-essential
Python 3.5 or later.
pip3 install meson ninja
For Ubuntu/Debian it can be installed using apt install python3-pyelftools
libnuma-dev in Debian/Ubuntu;
3、Running DPDK Applications
3.1、System Software
3.1.1、Kernel version >= 4.4
The kernel version in use can be checked using the command: uname -r
3.1.2、glibc >= 2.7
The version can be checked using the ldd --version command.
3.2、Use of Hugepages in the Linux Environment
Hugepage support is required for the large memory pool allocation used for packet buffers (the HUGETLBFS option must be enabled in the running kernel as indicated the previous section). By using hugepage allocations, performance is increased since fewer pages are needed, and therefore less Translation Lookaside Buffers (TLBs, high speed translation caches), which reduce the time it takes to translate a virtual page address to a physical page address. Without hugepages, high TLB miss rates would occur with the standard 4k page size, slowing performance.
3.2.1、 Reserving Hugepages for DPDK Use
This is done by echoing the number of hugepages required to a nr_hugepages file in the /sys/kernel/ directory corresponding to a specific page size (in Kilobytes). For a single-node system, the command to use is as follows (assuming that 1024 of 2MB pages are required):
echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 1024 > /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages
it is preferable to reserve hugepages at boot time
To reserve hugepages at boot time, a parameter is passed to the Linux kernel on the kernel command line.
For example, to reserve 4G of hugepage memory in the form of four 1G pages, the following options should be passed to the kernel:
default_hugepagesz=1G hugepagesz=1G hugepages=4
3.2.2、Using Hugepages with the DPDK
If secondary process support is required, mount points for hugepages need to be created. On modern Linux distributions, a default mount point for hugepages is provided by the system and is located at /dev/hugepages. This mount point will use the default hugepage size(2M) set by the kernel parameters as described above.
However, in order to use hugepage sizes other than the default, it is necessary to manually create mount points for those hugepage sizes (e.g. 1GB pages).
To make the hugepages of size 1GB available for DPDK use, following steps must be performed:
mkdir /mnt/huge
mount -t hugetlbfs pagesize=1GB /mnt/huge
The mount point can be made permanent across reboots, by adding the following line to the /etc/fstab file:
nodev /mnt/huge hugetlbfs pagesize=1GB 0 0
cat /proc/meminfo