centos安装dpdk17

安装dpdk

下载dpdk17

wget  http://fast.dpdk.org/rel/dpdk-17.11.4.tar.xz

cd dpdk-stable-17.11.4/usertools

./dpdk-setup.sh

安装dpdk17

先安装依赖的软件:

yum install numactl
yum install numactl-devel

运行dpdk-setup.sh后,可以看到如下的安装选项

------------------------------------------------------------------------------
 RTE_SDK exported as /home/yeruoxi/dpdk-stable-17.11.4
------------------------------------------------------------------------------
----------------------------------------------------------
 Step 1: Select the DPDK environment to build
----------------------------------------------------------
[1] arm64-armv8a-linuxapp-clang
[2] arm64-armv8a-linuxapp-gcc
[3] arm64-dpaa2-linuxapp-gcc
[4] arm64-dpaa-linuxapp-gcc
[5] arm64-thunderx-linuxapp-gcc
[6] arm64-xgene1-linuxapp-gcc
[7] arm-armv7a-linuxapp-gcc
[8] i686-native-linuxapp-gcc
[9] i686-native-linuxapp-icc
[10] ppc_64-power8-linuxapp-gcc
[11] x86_64-native-bsdapp-clang
[12] x86_64-native-bsdapp-gcc
[13] x86_64-native-linuxapp-clang
[14] x86_64-native-linuxapp-gcc
[15] x86_64-native-linuxapp-icc
[16] x86_x32-native-linuxapp-gcc

----------------------------------------------------------
 Step 2: Setup linuxapp environment
----------------------------------------------------------
[17] Insert IGB UIO module
[18] Insert VFIO module
[19] Insert KNI module
[20] Setup hugepage mappings for non-NUMA systems
[21] Setup hugepage mappings for NUMA systems
[22] Display current Ethernet/Crypto device settings
[23] Bind Ethernet/Crypto device to IGB UIO module
[24] Bind Ethernet/Crypto device to VFIO module
[25] Setup VFIO permissions

----------------------------------------------------------
 Step 3: Run test application for linuxapp environment
----------------------------------------------------------
[26] Run test application ($RTE_TARGET/app/test)
[27] Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)

----------------------------------------------------------
 Step 4: Other tools
----------------------------------------------------------
[28] List hugepage info from /proc/meminfo

----------------------------------------------------------
 Step 5: Uninstall and system cleanup
----------------------------------------------------------
[29] Unbind devices from IGB UIO or VFIO driver
[30] Remove IGB UIO module
[31] Remove VFIO module
[32] Remove KNI module
[33] Remove hugepage mappings

[34] Exit Script

Option: 

step 1,根据自己的系统架构选择相应的编译选项。我是64位机器,使用gcc编译,所以选择14(x86_64-native-linuxapp-gcc)。

step 2,根据自己的硬件类型选择。我是igb网卡,所以选择17(Insert IGB UIO module)。

step2,需要设置一下大内存页。因为我是numa架构的CPU,所以选择21(Setup hugepage mappings for NUMA systems)。我试了一下在我的系统中设置1024个hugepage后面测试helloword程序才不会报错。
设置大内存页:

Option: 21

Removing currently reserved hugepages
Unmounting /mnt/huge and removing directory

  Input the number of 2048kB hugepages for each node
  Example: 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: 1024
Number of pages for node1: 1024
Reserving hugepages
Creating /mnt/huge and mounting as hugetlbfs

step2,显示一下系统中可以用的硬件网卡,选择22(Display current Ethernet/Crypto device settings)。

step2,绑定网卡设备,我是igb网卡,所以选择23(Bind Ethernet/Crypto device to IGB UIO module)。不过这里需要先退出,将绑定的网卡shutdown掉,比如我准备绑定eth3网卡:

ifconfig eth3 down

设置绑定网卡,设备名称是if=后显示的名称:

......
Network devices using kernel driver
===================================
0000:01:00.0 'I350 Gigabit Network Connection 1521' if=eth0 drv=igb unused=igb_uio,uio_pci_generic *Active*
0000:01:00.1 'I350 Gigabit Network Connection 1521' if=eth1 drv=igb unused=igb_uio,uio_pci_generic
0000:07:00.0 '82599ES 10-Gigabit SFI/SFP+ Network Connection 10fb' if=eth3 drv=ixgbe unused=igb_uio,uio_pci_generic
......
Enter PCI address of device to bind to IGB UIO driver:eth3

到此为止,安装配置dpdk的任务已经完成

测试dpdk17

配置环境变量,RTE_TARGET是我们上面step1 中编译选择的目录。

export RTE_SDK=`pwd`
export  RTE_TARGET=x86_64-native-linuxapp-gcc

编译测试的helloworld程序:

cd /home/yeruoxi/dpdk-stable-17.11.4/examples/helloworld
make

如果提示如下错误,应该是大内存页分配少了:

[root@ids01]# ./helloworld
EAL: Detected 40 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: WARNING: Master core has no memory on local socket!
EAL: PCI device 0000:01:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:01:00.1 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:07:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:07:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10fb net_ixgbe
PANIC in rte_eth_dev_data_alloc():
Cannot allocate memzone for ethernet port data
11: [./helloworld() [0x44829f]]
10: [/lib64/libc.so.6(__libc_start_main+0xf5) [0x7fdc86cf8445]]
9: [./helloworld(main+0x6) [0x445306]]
8: [./helloworld(rte_eal_init+0x1195) [0x48db25]]
7: [./helloworld(rte_bus_probe+0x4c) [0x4983bc]]
6: [./helloworld(rte_pci_probe+0xae) [0x4af32e]]
5: [./helloworld() [0x4af1ef]]
4: [./helloworld() [0x5ed3b5]]
3: [./helloworld() [0x4763e8]]
2: [./helloworld(__rte_panic+0xb8) [0x43fe7f]]
1: [./helloworld(rte_dump_stack+0x1a) [0x4933da]]
Aborted

转到上面step2中,设置大内存页的选项,重新设置一下。如果看到hello from core x 说明已经测试成功。

[root@ids01 /home/yeruoxi/dpdk-stable-17.11.4/examples/helloworld/build]# ./helloworld
EAL: Detected 40 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: PCI device 0000:01:00.0 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:01:00.1 on NUMA socket 0
EAL:   probe driver: 8086:1521 net_e1000_igb
EAL: PCI device 0000:07:00.0 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10fb net_ixgbe
EAL: PCI device 0000:07:00.1 on NUMA socket -1
EAL:   Invalid NUMA socket, default to 0
EAL:   probe driver: 8086:10fb net_ixgbe
hello from core 0
hello from core 1
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值