ubuntu18.04 虚拟机上编译DPDK

先去github上下载DPDK源码包:https://github.com/DPDK/dpdk/tree/v19.05-rc1
下载完成后,拷贝dpdk-releases.zip到虚拟机上.
虚拟机命令行输入:

unzip dpdk-releases.zip
cd usertools/

因为是x86电脑,所以选择16。[16] x86_64-native-linuxapp-gcc

./dpdk-setup.sh
16

报错,显示

/home/chenhao/dpdk/dpdk-releases/lib/librte_eal/linuxapp/eal/eal_memory.c:33:10: fatal error: numa.h: No such file or directory
 #include 

安装libnuma-dev即可

apt-get install libnuma-dev

安装qemu

sudo apt install qemu-system-x86

把网卡绑定到dpdk,通过vfio-pci,结果报错:

:~/dpdk/dpdk-releases/usertools$ ./dpdk-devbind.py --bind=vfio-pci 0000:00:08.0
Error - no supported modules(DPDK driver) are loaded

搜索资料,说是没有加载igb_uio。

运行/dpdk-releases/usertools目录下的dpdk-setup.sh,选项[19] Insert IGB UIO module
插入igb_uio,

./dpdk-setup.sh
19

报错,显示

## ERROR: Target does not have the DPDK UIO Kernel Module.
       To fix, please try to rebuild target.

搜索资料,说是没有加载uio。

sudo modprobe uio

插入igb_uio:

cd ~/dpdk-releases/x86_64-native-linuxapp-gcc/kmod
$ sudo insmod igb_uio.ko 

重新绑定网卡到dpdk,结果显示无法绑定:

:~/dpdk/dpdk-releases/usertools$ ./dpdk-devbind.py --bind=vfio-pci 0000:00:08.0
Routing table indicates that interface 0000:00:08.0 is active. Not modifying

关闭网卡:

sudo ifconfig enp0s8 down

重新用脚本绑定到dpdk,报错,显示:

:~/dpdk/dpdk-releases/usertools$ ./dpdk-devbind.py --bind=vfio-pci 0000:00:08.0
Error: unbind failed for 0000:00:08.0 - Cannot open /sys/bus/pci/drivers/e1000/unbind

可以重新打开一个终端,通过dmesg命令打印串口信息查看报错原因。
试过sudo权限后,成功解绑 :

sudo ./dpdk-devbind.py --unbind 0000:00:08.0

绑定vfio-pci失败,改绑igb_uio成功:

VirtualBox:~/dpdk/dpdk-releases/usertools$ sudo ./dpdk-devbind.py --bind=vfio-pci 0000:00:08.0
Error: bind failed for 0000:00:08.0 - Cannot open /sys/bus/pci/drivers/vfio-pci/bind
VirtualBox:~/dpdk/dpdk-releases/usertools$ 
VirtualBox:~/dpdk/dpdk-releases/usertools$ sudo ./dpdk-devbind.py --bind=igb_uio 0000:00:08.0

查看网卡绑定状态如下:

VirtualBox:~/dpdk/dpdk-releases/usertools$ ./dpdk-devbind.py --status

Network devices using DPDK-compatible driver
============================================
0000:00:08.0 '82543GC Gigabit Ethernet Controller (Copper) 1004' drv=igb_uio unused=e1000

Network devices using kernel driver
===================================
0000:00:03.0 '82543GC Gigabit Ethernet Controller (Copper) 1004' if=enp0s3 drv=e1000 unused=igb_uio *Active*
0000:00:09.0 '82543GC Gigabit Ethernet Controller (Copper) 1004' if=enp0s9 drv=e1000 unused=igb_uio *Active*
0000:00:0a.0 '82543GC Gigabit Ethernet Controller (Copper) 1004' if=enp0s10 drv=e1000 unused=igb_uio *Active*

No 'Crypto' devices detected
============================

No 'Eventdev' devices detected
==============================

No 'Mempool' devices detected
=============================

No 'Compress' devices detected
==============================

你可能感兴趣的:(DPDK,DPDK,Ubuntu18.04,x86,编译)