DPDK网卡绑定

  • 进入DPDK目录编译环境
# cd ~/DPDK/usertools
# ./dpdk-setup.py

注意,setup脚本需要在root权限下运行,并且每次重启电脑,都需要重新插入模块和绑定网卡。

  • 在step1中选取合适的选项编译DPDK环境:[14] x86_64-native-linuxapp-gcc
----------------------------------------------------------
 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
  • 在step2中选取合适的用户空间I/O模块:[17] Insert IGB UIO module

运行任何DPDK的应用都需要在内核加载合适的用户空间I/O模块(UIO module)

----------------------------------------------------------
 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
  • 点选[22] Display current Ethernet/Crypto device settings 会显示机子的网卡情况
Network devices using DPDK-compatible driver
============================================
0000:01:00.0 'Ethernet Controller 10-Gigabit X540-AT2 1528' drv=igb_uio unused=ixgbe,vfio-pci

Network devices using kernel driver
===================================
0000:01:00.1 'Ethernet Controller 10-Gigabit X540-AT2 1528' if=enp1s0f1 drv=ixgbe unused=igb_uio,vfio-pci *Active*

Other Network devices
=====================
0000:03:00.0 'AR8151 v2.0 Gigabit Ethernet 1083' unused=atl1c,igb_uio,vfio-pci

目前的情况是第一张网卡绑定了DPDK,第二张是使用 Linux Kernel 的网卡,第三张还没有进行绑定。现在我们要绑定第三张网卡到DPDK。

  • 选择[23] Bind Ethernet/Crypto device to IGB UIO module,输入对应的PCI号(0000:后的):
Enter PCI address of device to bind to IGB UIO driver: 03:00.0
OK

再次查看网卡情况,可以看到网卡绑定成功:

Option: 22


Network devices using DPDK-compatible driver
============================================
0000:01:00.0 'Ethernet Controller 10-Gigabit X540-AT2 1528' drv=igb_uio unused=ixgbe,vfio-pci
0000:03:00.0 'AR8151 v2.0 Gigabit Ethernet 1083' drv=igb_uio unused=atl1c,vfio-pci

Network devices using kernel driver
===================================
0000:01:00.1 'Ethernet Controller 10-Gigabit X540-AT2 1528' if=enp1s0f1 drv=ixgbe unused=igb_uio,vfio-pci *Active*

posted @ 2018-07-15 13:22  畅畅1  阅读(1271)  评论(0编辑  收藏  举报