> 文章列表 > centos 7.6源码编译DPDK 19.11.14

centos 7.6源码编译DPDK 19.11.14

centos 7.6源码编译DPDK 19.11.14

1. 下载DPDK 19.11.14

        下载地址:DPDK

2. 解压

        tar Jxf dpdk-19.11.14.tar.xz

3. 安装编译DPDK依赖

        yum -y install gcc gcc-c++ libstdc++-devel make net-tools  pciutils sudo

        下载匹配的kernel、kernel-devel、kernel-headers rpm包

[root@cdh1 kernel]# uname -r
3.10.0-1062.4.1.el7.x86_64
[root@cdh1 kernel]# ls
kernel-3.10.0-1062.4.1.el7.x86_64.rpm  kernel-devel-3.10.0-1062.4.1.el7.x86_64.rpm  kernel-headers-3.10.0-1062.4.1.el7.x86_64.rpm
[root@cdh1 kernel]# 

         我的机器对应内核版本的下载地址:ftp://ftp.pbone.net/mirror/vault.centos.org/7.7.1908/updates/x86_64/Packages

        安装rpm包:rpm -ivh kernel-*.rpm

4. 编译DPDK

        a. 执行dpdk-setup.sh

        

[root@cdh1 dpdk]# cd dpdk-stable-19.11.14/usertools/
[root@cdh1 usertools]# ./dpdk-setup.sh 
------------------------------------------------------------------------------RTE_SDK exported as /home/dongsongz/dpdk/dpdk-stable-19.11.14
------------------------------------------------------------------------------
----------------------------------------------------------Step 1: Select the DPDK environment to build
----------------------------------------------------------
[1] arm64-armada-linuxapp-gcc
[2] arm64-armada-linux-gcc
[3] arm64-armv8a-linuxapp-clang
[4] arm64-armv8a-linuxapp-gcc
[5] arm64-armv8a-linux-clang
[6] arm64-armv8a-linux-gcc
[7] arm64-bluefield-linuxapp-gcc
[8] arm64-bluefield-linux-gcc
[9] arm64-dpaa-linuxapp-gcc
[10] arm64-dpaa-linux-gcc
[11] arm64-emag-linuxapp-gcc
[12] arm64-emag-linux-gcc
[13] arm64-graviton2-linuxapp-gcc
[14] arm64-graviton2-linux-gcc
[15] arm64-n1sdp-linuxapp-gcc
[16] arm64-n1sdp-linux-gcc
[17] arm64-octeontx2-linuxapp-gcc
[18] arm64-octeontx2-linux-gcc
[19] arm64-stingray-linuxapp-gcc
[20] arm64-stingray-linux-gcc
[21] arm64-thunderx2-linuxapp-gcc
[22] arm64-thunderx2-linux-gcc
[23] arm64-thunderx-linuxapp-gcc
[24] arm64-thunderx-linux-gcc
[25] arm64-xgene1-linuxapp-gcc
[26] arm64-xgene1-linux-gcc
[27] arm-armv7a-linuxapp-gcc
[28] arm-armv7a-linux-gcc
[29] graviton2
[30] i686-native-linuxapp-gcc
[31] i686-native-linuxapp-icc
[32] i686-native-linux-gcc
[33] i686-native-linux-icc
[34] ppc_64-power8-linuxapp-gcc
[35] ppc_64-power8-linux-gcc
[36] x86_64-native-bsdapp-clang
[37] x86_64-native-bsdapp-gcc
[38] x86_64-native-freebsd-clang
[39] x86_64-native-freebsd-gcc
[40] x86_64-native-linuxapp-clang
[41] x86_64-native-linuxapp-gcc
[42] x86_64-native-linuxapp-icc
[43] x86_64-native-linux-clang
[44] x86_64-native-linux-gcc
[45] x86_64-native-linux-icc
[46] x86_x32-native-linuxapp-gcc
[47] x86_x32-native-linux-gcc----------------------------------------------------------Step 2: Setup linux environment
----------------------------------------------------------
[48] Insert IGB UIO module
[49] Insert VFIO module
[50] Insert KNI module
[51] Setup hugepage mappings for non-NUMA systems
[52] Setup hugepage mappings for NUMA systems
[53] Display current Ethernet/Baseband/Crypto device settings
[54] Bind Ethernet/Baseband/Crypto device to IGB UIO module
[55] Bind Ethernet/Baseband/Crypto device to VFIO module
[56] Setup VFIO permissions----------------------------------------------------------Step 3: Run test application for linux environment
----------------------------------------------------------
[57] Run test application ($RTE_TARGET/app/test)
[58] Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)----------------------------------------------------------Step 4: Other tools
----------------------------------------------------------
[59] List hugepage info from /proc/meminfo----------------------------------------------------------Step 5: Uninstall and system cleanup
----------------------------------------------------------
[60] Unbind devices from IGB UIO or VFIO driver
[61] Remove IGB UIO module
[62] Remove VFIO module
[63] Remove KNI module
[64] Remove hugepage mappings[65] Exit ScriptOption: 

        b. 输入41执行编译x86_64平台的DPDK

----------------------------------------------------------Step 4: Other tools
----------------------------------------------------------
[59] List hugepage info from /proc/meminfo----------------------------------------------------------Step 5: Uninstall and system cleanup
----------------------------------------------------------
[60] Unbind devices from IGB UIO or VFIO driver
[61] Remove IGB UIO module
[62] Remove VFIO module
[63] Remove KNI module
[64] Remove hugepage mappings[65] Exit ScriptOption: 41Configuration done using x86_64-native-linuxapp-gcc
== Build lib
== Build lib/librte_kvargsSYMLINK-FILE include/rte_kvargs.hCC rte_kvargs.oAR librte_kvargs.aINSTALL-LIB librte_kvargs.a
== Build lib/librte_eal
== Build lib/librte_eal/commonSYMLINK-FILE include/rte_branch_prediction.hSYMLINK-FILE include/rte_common.hSYMLINK-FILE include/rte_compat.hSYMLINK-FILE include/rte_function_versioning.hSYMLINK-FILE include/rte_debug.hSYMLINK-FILE include/rte_eal.hSYMLINK-FILE include/rte_eal_interrupts.h
.
.
.
LD dpdk-test-eventdevINSTALL-APP dpdk-test-eventdevINSTALL-MAP dpdk-test-eventdev.map
Build complete [x86_64-native-linuxapp-gcc]
Installation cannot run with T defined and DESTDIR undefined
------------------------------------------------------------------------------RTE_TARGET exported as x86_64-native-linuxapp-gcc
------------------------------------------------------------------------------Press enter to continue ...

        c. 选择48安装DPDK UIO驱动

​
Option: 48Unloading any existing DPDK UIO module
Loading DPDK UIO modulePress enter to continue ...​

        d. 选择52设置hugepage

Option: 52Removing currently reserved hugepages
Unmounting /mnt/huge and removing directoryInput the number of 2048kB hugepages for each nodeExample: to have 128MB of hugepages available per node in a 2MB huge page system,enter '64' to reserve 64 * 2MB pages on each node
Number of pages for node0: 512
Reserving hugepages
Creating /mnt/huge and mounting as hugetlbfsPress enter to continue ...

        e. 选择54绑定网卡使用DPDK UIO驱动,注意机器要有多块网卡,不要绑定管理口网卡(不要绑定ssh登录的网卡)

Option: 54Network devices using kernel driver
===================================
0000:02:00.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' if=ens32 drv=e1000 unused=igb_uio,uio_pci_generic *Active*
0000:02:01.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' if=ens33 drv=e1000 unused=igb_uio,uio_pci_generic Other Network devices
=====================
0000:02:03.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' unused=e1000,igb_uio,uio_pci_genericNo 'Baseband' devices detected
==============================No 'Crypto' devices detected
============================No 'Eventdev' devices detected
==============================No 'Mempool' devices detected
=============================No 'Compress' devices detected
==============================No 'Misc (rawdev)' devices detected
===================================Enter PCI address of device to bind to IGB UIO driver: 0000:02:01.0
OKPress enter to continue ...

        f. 选择53确认绑定DPDK网卡驱动成功,看“Network devices using DPDK-compatible driver”下应有选择绑定对应的网卡

Option: 53Network devices using DPDK-compatible driver
============================================
0000:02:01.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' drv=igb_uio unused=e1000,uio_pci_genericNetwork devices using kernel driver
===================================
0000:02:00.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' if=ens32 drv=e1000 unused=igb_uio,uio_pci_generic *Active*Other Network devices
=====================
0000:02:03.0 '82545EM Gigabit Ethernet Controller (Copper) 100f' unused=e1000,igb_uio,uio_pci_genericNo 'Baseband' devices detected
==============================No 'Crypto' devices detected
============================No 'Eventdev' devices detected
==============================No 'Mempool' devices detected
=============================No 'Compress' devices detected
==============================No 'Misc (rawdev)' devices detected
===================================Press enter to continue ...

        h. 选择57测试网卡驱动

Option: 57Enter hex bitmask of cores to execute test app onExample: to execute app on cores 0 to 7, enter 0xff
bitmask: 0xf
Launching app
EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: PCI device 0000:02:00.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
EAL: PCI device 0000:02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
EAL: Cannot open /dev/uio0: No such file or directory
EAL: Requested device 0000:02:01.0 cannot be used
EAL: PCI device 0000:02:03.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
APP: HPET is not enabled, using TSC as default timer
RTE>>quitPress enter to continue ...

        i. 编译运行hellword测试

cd examples/helloworld/
[root@cdh1 helloworld]# export  RTE_SDK=/home/dongsongz/dpdk/dpdk-stable-19.11.14
[root@cdh1 helloworld]# export  RTE_TARGET=x86_64-native-linuxapp-gcc
[root@cdh1 helloworld]# 
[root@cdh1 helloworld]# makeCC main.oLD helloworldINSTALL-APP helloworldINSTALL-MAP helloworld.map
[root@cdh1 helloworld]# ./build/helloworld 
EAL: Detected 4 lcore(s)
EAL: Detected 1 NUMA nodes
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: PCI device 0000:02:00.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
EAL: PCI device 0000:02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
EAL: Cannot open /dev/uio0: No such file or directory
EAL: Requested device 0000:02:01.0 cannot be used
EAL: PCI device 0000:02:03.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
hello from core 1
hello from core 2
hello from core 3
hello from core 0
[root@cdh1 helloworld]#