-
DPDK
安装及示例程序使用指南(适用于虚拟机)
--torronto 2016.1.27
关于
p>
dpdk
的介绍不用多说,
主要就是它是<
/p>
intel
开发的一个网络数据包查找转发的套件,
用以分析网络数据的,所以只支持
intel
的网卡
以及极少数除
intel
之外的网卡,具体支持的
型号,官网有说明。因此,大多数时候,我们都是用虚拟机来仿真。
1.
在虚拟机中的
ubuntu
系统上手动设置
2
个网卡(一共
3
个)
,就使用默认的桥接模式,然
后修改处理器个数为
2
个处理器,每个处理器
2
核心。内存分配,
1GB
以
上,
2GB
更好。
2.
去官网下载
dpdk
软件包,
/download
< br>3.
将软件包解压在主目录下,根据个人喜好,因为后面编译和使用示例每次都要
访问的。
4.
从终端进入
文件夹中有一个
方便新手完成
dpdk
的设置初始
化操作:
(当然,配置编译之
前先进入特权模式)
6.
我们可以看到
p>
里的一些选项如下:
------------------------------------------------ ------------------------------
RTE_SDK exported as
/home/torronto/dpdk-2.2.0
-------------
--------------------------------------------------
---------------
-----------------------
-----------------------------------
Step 1: Select the DPDK environment to
build
---------------------------------
-------------------------
[1]
arm64-armv8a-linuxapp-gcc
[2]
arm64-thunderx-linuxapp-gcc
[3]
arm64-xgene1-linuxapp-gcc
[4] arm-
armv7a-linuxapp-gcc
[5] i686-native-
linuxapp-gcc
[6] i686-native-linuxapp-
icc
[7] ppc_64-power8-linuxapp-gcc
[8] tile-tilegx-linuxapp-gcc
[9] x86_64-ivshmem-linuxapp-gcc
[10] x86_64-ivshmem-linuxapp-icc
[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
device settings
[23] Bind Ethernet
device to IGB UIO module
[24] Bind
Ethernet 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 NICs 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:
7.
先
进<
/p>
行
配
置
,
我
的
系
统
是
ubuntu12.04,64
位
,
所
以
应
< br>该
输
入
14
,
选
择
x86_64-nativ
e-linuxapp-gcc
进行编译,如果是
32
位系统则是
x86_x32-native-linuxapp-gcc
,
或者是
i686-native-
linuxapp-gcc
,
因为
i3
86
、
i686
都是
< br>32
位的,
平台选错了会导致后面编译
< br>不成功。编译界面如下,有点长。
< br>如果编译有错,往往是软件包依赖关系不满足,安装相应的软件包,对于
ubun
tu15.10
出的
错可能和内核有关,所以建议使用的
linux3.x
内核的。
8.
编译完成后,载入
IGB
组件
9.
设置页大小
先设置位
128
,即
128*2MB
的页大小
10.
选择
[28] List
hugepage info from /proc/meminfo
可以查看页大小
,以及多少页是空闲的
11.
查看当前网卡状态
通过上图,
我们看出有三块网卡,<
/p>
都是
intel e1000
型号的,<
/p>
下面两块网卡是我们后来手动添
加的,然而都是
< br>active
的状态,要将他们作为
dpdk
的网卡,就必须要先关掉
另开一个终端:
再次查看,网卡状态,可以进行网卡绑定了: