在网上看很多人在CENTOS上编译DPDK很顺利,而在FSTACK的群里面大部分人运维KNI和内核不配套编译失败,大部分时候我是不编译KNI,今天因要使用KNI绕不过解决记录如下:
1、操作系统版本
[root@localhost x86_64-native-linuxapp-gcc]# uname -a
Linux localhost.localdomain 3.10.0-862.el7.x86_64 #1 SMP Fri Apr 20 16:44:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost x86_64-native-linuxapp-gcc]# cat /etc/redhat-release
CentOS Linux release 7.5.1804 (Core)
2、DPDK版本,有相同的问题:
dpdk-17.11.2
dpdk-17.02.1
3、编译
dpdk根目录下运行./usertools/dpdk-setup.sh,根据相应系统选择:14 x86_64-native-linuxapp-gcc
/usr/src/kernels/3.10.0-862.3.2.el7.x86_64/include/linux/netdevice.h
编译:dpdk-17.02.1时有另外一个编译错误:
‘struct net_device’ has no member named ‘trans_start’
netdev->trans_start = jiffies;
这个问题在dpdk-17.11.2中已经修正:
lib/librte_eal/linuxapp/kni/compat.h
可以同步一下这个宏:
lib/librte_eal/linuxapp/kni/kni_net.c