本文只提供比较简单的testpmd和pktgen的测试步骤,更为详细的请参考DPDK官网内容。如果是自己开发的pmd,那么需要先添加pmd到DPDK中。
目录
2.1.3 Setup hugepage mappings for NUMA systems
2.1.4 Bind Ethernet/Baseband/Crypto device to IGB UIO module
2.2.1 Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)
2.2.3 Start forwarding packets and repeat several times
3.2 Set RTE_SDK and RTE_TARGET (Be careful about RTE_SDK)
1. 解压缩
从官网下载需要版本的DPDK之后,解压缩。
2. Setup以及跑testpmd
2.1 Setup
2.1.1 运行脚本
./usertools/dpdk-setup.sh
2.1.1 Compile dpdk source
选择 x86_64-native-linux-gcc,我这里的编号是 44。
2.1.2 Insert IGB UIO module
我这里的编号是 48。
2.1.3 Setup hugepage mappings for NUMA systems
我这里的编号是52。
Number of pages for node0: 1024
2.1.4 Bind Ethernet/Baseband/Crypto device to IGB UIO module
我这里的编号是54。
Enter PCI address of device to bind to IGB UIO driver: 02:00.0 03:00.0
2.2 Run testpmd
2.2.1 Run testpmd application in interactive mode ($RTE_TARGET/app/testpmd)
我这里的编号是58,bitmask 0xf。
2.2.2 Show port information
testpmd> show port info all
2.2.3 Start forwarding packets and repeat several times
testpmd> start tx_first
/* wait some seconds */
testpmd> stop
3. Pktgen Test
3.1 Build DPDK first
3.2 Set RTE_SDK and RTE_TARGET (Be careful about RTE_SDK)
/* 进入pktgen的目录下 */
# cd pktgen-19.12.0/
/* 设置DPDK源码包的绝对路径。当编译外部应用时,用户必须定义这个环境变量。 */
# export RTE_SDK=/home/Driver/dpdk-stable-19.11.6
/* 设置Target,这个和之前编译时选择的相同 */
# export RTE_TARGET=x86_64-native-linux-gcc
3.3 Make
# make
3.4 Run pktgen
执行下面的命令来运行pktgen,下面的参数可以自己查询然后更改,比如变成彩色的(-T)。
# ./app/x86_64-native-linux-gcc/app/pktgen -l 0-3 -n 3 -- -P -m"1.0,2.1"
建议全屏展示,不然容易出现乱码。等网卡link之后,就可以做下面的动作。
/* 设置需要跑的size大小 */
Pktgen:/> set all size xxx
/* start all的缩写,也可以start 0,即运行port 0 */
Pktgen:/> str
/* stop all的缩写 */
Pktgen:/> stp
/* 退出pktgen */
Pktgen:/> quit
3.5 Result
首先,需要能够稳定运行,之后可以记录速度来测试pmd。
Packet Size | 64 | 128 | 256 | 512 | 1024 | 1280 | 1518 |
Mbit/s |
以上就是全部内容。
如果觉得这篇文章有用的话,可以点赞、评论或者收藏,万分感谢,goodbye~