Ubuntu18.04 install dpdk20 11.1 first step! Super detailed!

Posted by jnutter on Wed, 09 Feb 2022 07:55:24 +0100

I Content installation

1.GCC

sudo apt install build-essential
// Verify gcc version
gcc --version
 gcc --version
gcc (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

2.pip3 installation ninja

pip3 install meson ninja

3. Install numa dependency

apt-get install libnuma-dev

4. Use large pages in linux

Retention of large pages can be performed at run time. By echoing the NR in the directory corresponding to a specific page size (in KB)_ The large number of pages required by the hugepages file can complete this operation. / sys/kernel /. For a single node system, the commands to be used are as follows (assuming a 1024 MB 2MB page is required):
Problem:

echo 1024 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
bash: /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages: insufficient privilege

resolvent

echo 1024 | sudo tee /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
echo 1024 > sudo /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
echo 1024 > sudo /sys/devices/system/node/node1/hugepages/hugepages-2048kB/nr_hugepages

If you need auxiliary process support, you need to create installation points for large pages. In modern Linux distributions, the system provides a default installation point for large pages, which is located in / dev/hugepages. As mentioned above, this mount point will use the default large page size set by the kernel parameters.
However, in order to use large page sizes other than the default size, it is necessary to manually create installation points for these large page sizes (for example, 1GB pages).
To make a huge 1GB page available to DPDK, you must perform the following steps:
In dev/hugepages

mkdir /mnt/huge
sudo mount -t hugetlbfs pagesize=1GB /mnt/huge

You can make the mount point persistent during the / fstab file reboot by adding it on the following line:

sudo vim /etc/fstab

5. Kernel version > = 3.16

uname -r
#4.15.0-29-generic

6.glibc>=2.7

ldd --version

Upgrading glibc requires version 2.7, which is currently 2.27

wget http://ftp.gnu.org/gnu/glibc/glibc-2.7.tar.gz
tar -zxvf glibc-2.7.tar.gz
../glibc-2.7/configure --prefix=/usr --disable-profile --enable-add-ons --with-headers=/usr/include --with-binutils=/usr/bin

An error occurred while configuring configure

These critical programs are missing or too old: as ld gcc make *** Check the INSTALL file for required versions
wget http://ftp.gnu.org/gnu/binutils/binutils-2.35.tar.gz

I can't use it at present. I don't care about it for the time being

II Install DPDK and source code

tar xJf dpdk-20.11.1.tar.xz
cd dpdk-stable-20.11.1

The DPDK source file consists of several directories:

lib: DPDK library file
drivers: DPDK polls driver source files
app: DPDK application (automatic test) source file
examples: DPDK application routine
config, buildtools, mk: framework related makefile s, scripts and configuration files
! [insert picture description here]( https://img-blog.csdnimg.cn/20210520100037122.png

III Compile and install DPDK system wide

DPDK can be configured, built and installed using the tools meson and ninja on the system.

1.dpdk configuration

meson <options> build

An error occurred

The Meson build system
Version: 0.45.1
Source dir: /home/dpdk-stable-20.11.1
Build dir: /home/dpdk-stable-20.11.1/build
Build type: native build
Program cat found: YES (/bin/cat)

meson.build:4:0: ERROR: Meson version is 0.45.1 but project requires >= 0.47.1.

A full log can be found at /home/dpdk-stable-20.11.1/build/meson-logs/meson-log.txt

Modification method:

pip3 install --user meson
//You can install the latest version, but version still displays the previous lower version

Continue searching and find that pip3 will install the software to / home / user / local/bin
The system defaults to / usr/bin/meson
Therefore, by modifying the path path, the meson installed by pip is searched prior to the system meson

export PATH=~/.local/bin:$PATH

After the configuration is completed, the DPDK can be built and installed and used in the system scope:

cd build
ninja
//[2415/2415] Linking target app/test/dpdk-test
sudo  ninja install
sudo ldconfig
build/app/dpdk-testpmd -c7 --vdev=net_pcap0,iface=eth0 --vdev=net_pcap1,iface=eth1 -- -i --nb-cores=2 --nb-ports=2 --total-num-mbufs=2048

IV Linux driver

Different PMDS may require different kernel drivers to work properly. According to the PMD used, the corresponding kernel driver shall be loaded and the network port shall be bound to the driver.

1. Audio output

sudo modprobe vfio-pci

3.UIO

When VFIO cannot be used, other drivers can be used. In many cases, UIO_ pci_ The standard modules contained in the generic Linux kernel can replace VFIO. You can load the module using the following command:

sudo modprobe uio_pci_generic

As an alternative, you can find UIO in the repository dpdk kmods_ pci_ Generic igb_uio module. You can load it as follows:

sudo modprobe uio
sudo insmod igb_uio.ko

4. Bind and unbind network ports with kernel modules

./usertools/dpdk-devbind.py --status

Unbound

sudo ifconfig ens33 down
//To bind device eth1``04:00.1 'to uio_pci_generic driver
./usertools/dpdk-devbind.py --bind=uio_pci_generic ens33

4.1 problem: binding failed

Try using vfio pic driver, UIO_ pci_ The generic driver failed to bind the network card. The binding failed. Why

Error: unbind failed for 0000:02:06.0 - Cannot open /sys/bus/pci/drivers/e1000/unbind

No suitable solution has been found
Idea: change igb_uio driver
succeed!!!!

sudo ./usertools/dpdk-devbind.py --bind=igb_uio 0000:02:06.0

Remember sudo!

4.2 question: does dpdk support this network card

#Query the devid number of the network card
lspci -nn | grep Ethernet
02:01.0 Ethernet controller [0200]: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) [8086:100f] (rev 01)
02:06.0 Ethernet controller [0200]: Intel Corporation 82545EM Gigabit Ethernet Controller (Copper) [8086:100f] (rev 01)

#Search for this devid number in the dpdk code,
grep --include=*.h -rn -e '100f'

dpdk-stable-20.11.1/drivers/net/bnx2x/ecore_reg.h:1274:#define NIG_REG_BRB0_OUT_EN					 0x100f8
dpdk-stable-20.11.1/drivers/net/bnx2x/ecore_reg.h:2112:#define NIG_REG_XCM0_OUT_EN					 0x100f0
dpdk-stable-20.11.1/drivers/net/bnx2x/ecore_reg.h:2114:#define NIG_REG_XCM1_OUT_EN					 0x100f4
dpdk-stable-20.11.1/drivers/net/bnx2x/ecore_hsi.h:2669:	#define SHMEM_AFEX_VERSION_MASK                  0x100f
dpdk-stable-20.11.1/drivers/common/sfc_efx/base/efx_regs_mcdi.h:349:#define	MC_CMD_ERR_NO_MAC_ADDR 0x100f

It is a virtual network card supported by Intel and can be bound!

4.3 installing igb_uio driver

Download address given on the official website http://git.dpdk.org/dpdk-kmods

make

sudo apt install libelf-dev

5. Finally, take a successful screenshot to commemorate the two days I worked hard for it

Topics: Linux Ubuntu kernel