Intel DPDK官网:http://www.dpdk.org/
操作系统:Ubuntu14.04
DPDK版本:dpdk-2.2.0
准备
1.1 查看网卡状态:
./tools/dpdk_nic_bind.py --status
1.2 禁用网卡:
ifconfig ethxxx down
1.3 配置环境变量:
export RTE_SDK=pwd
export RTE_TARGET=x86_64-native-linuxapp-gcc
1.4 查看大页内存状态:
cat /proc/meminfo | grep Huge
通过setup.sh进行配置
2.1 运行setup脚本:
./tools/setup.sh
2.2 选择编译目标:
x86_64-native-linuxapp-gcc
(选[14])
2.3 插入IGB UIO模块:
Insert IGB UIO module
(选[17])
2.4 设置大页内存:
Setup hugepage mappings for non-NUMA systems
(选[20])
2.5 绑定网卡:
Bind Ethernet device to IGB UIO module
(选[23])
2.6 运行测试程序:
Run testpmd application in interactive mode
(选[27])基于命令进行配置
3.1 进入DPDK主目录输入:
make install T=x86_64-native-linuxapp-gcc
3.2 配置大内存页:
echo 128 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
mkdir /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
3.3 安装igb_uio驱动:
modprobe uio
insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko
3.4 绑定网卡:
./tools/dpdk_nic_bind.py -b igb_uio xxxx:xx:xx.x
3.5 运行testpmd测试程序:
./x86_64-native-linuxapp-gcc/app/testpmd -c 0x3 -n 2 -- -i
错误
4.1Cause: Creation of mbuf pool for socket 0 failed
肯定是hugepage分配少了4.2
EAL: Error reading from file descriptor
这个bug已经由dpdk的开发人员修复,patch内容如下:
diff --git a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
index d1ca26e..c46a00f 100644
--- a/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
+++ b/lib/librte_eal/linuxapp/igb_uio/igb_uio.c
@@ -505,14 +505,11 @@ igbuio_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
}
/* fall back to INTX */
case RTE_INTR_MODE_LEGACY:
- if (pci_intx_mask_supported(dev)) {
- dev_dbg(&dev->dev, "using INTX");
- udev->info.irq_flags = IRQF_SHARED;
- udev->info.irq = dev->irq;
- udev->mode = RTE_INTR_MODE_LEGACY;
- break;
- }
- dev_notice(&dev->dev, "PCI INTX mask not supported\n");
+ dev_dbg(&dev->dev, "using INTX");
+ udev->info.irq_flags = IRQF_SHARED;
+ udev->info.irq = dev->irq;
+ udev->mode = RTE_INTR_MODE_LEGACY;
+ break;
/* fall back to no IRQ */
case RTE_INTR_MODE_NONE:
udev->mode = RTE_INTR_MODE_NONE;