美文网首页
ubuntu17.10下testpmd-dpdk pktgen-

ubuntu17.10下testpmd-dpdk pktgen-

作者: 严炎2016 | 来源:发表于2018-03-13 14:46 被阅读0次

安装依赖关系

apt install make -y

apt install make-guile -y

apt install gcc build-essential -y

apt install libnuma-dev -y

编辑sysctl.conf,设置2M大页的数量

vm.nr_hugepages=1024

下载并安装dpdk最新版

mkdir -p /root/dpdk

cd /root/dpdk/

wget http://fast.dpdk.org/rel/dpdk-17.11.tar.xz

tar xf dpdk-17.11.tar.xz

export DPDK_DIR=/root/dpdk/dpdk-17.11

export DPDK_TARGET=x86_64-native-linuxapp-gcc

export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET

cd $DPDK_DIR

make install T=$DPDK_TARGET DESTDIR=install

编译testpmd

Build the test-pmd application:

cd app/test-pmd

export RTE_SDK=$DPDK_DIR

export RTE_TARGET=$DPDK_TARGET

make

cp  /root/dpdk/dpdk-17.11/app/test-pmd/testpmd /root/dpdk/

编译pktgen-dpdk

apt-get install libpcap-dev -y

export DPDK_DIR=/root/dpdk/dpdk-17.11

export DPDK_TARGET=x86_64-native-linuxapp-gcc

export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET

mkdir -p /dev/hugepages

mount -t hugetlbfs hugetlbfs /dev/hugepages

modprobe uio

insmod $DPDK_BUILD/kmod/igb_uio.ko

export RTE_SDK=$DPDK_DIR

export RTE_TARGET=$DPDK_TARGET

wget  http://dpdk.org/browse/apps/pktgen-dpdk/snapshot/pktgen-3.4.9.tar.gz

cd /root/

tar zxvf  pktgen-3.4.9.tar.gz

cd /root/pktgen-3.4.9

make

cd /root/pktgen-3.4.9/tools

./setup.sh

cp  /root/pktgen-3.4.9/app/x86_64-native-linuxapp-gcc/pktgen  /root/pktgen-3.4.9/

如何使用testpmd

testpmd的测试脚本

root@ubuntu241-192-168-10-241:~# cat start-test.sh

export DPDK_DIR=/root/dpdk/dpdk-17.11

export DPDK_TARGET=x86_64-native-linuxapp-gcc

export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET

export RTE_SDK=$DPDK_DIR

export RTE_TARGET=$DPDK_TARGET

mkdir -p /dev/hugepages

mount -t hugetlbfs hugetlbfs /dev/hugepages

modprobe uio

insmod $DPDK_BUILD/kmod/igb_uio.ko

$DPDK_DIR/usertools/dpdk-devbind.py --status

$DPDK_DIR/usertools/dpdk-devbind.py -b igb_uio 0000:00:03.0

cd /root/dpdk/dpdk-17.11/app/test-pmd

./testpmd -l 1,2,3 -n 2  -- -i --rxq=4 --txq=4

启动后的配置与查看

testpmd> set fwd txonly

testpmd> start

查看模式

testpmd> show config fwd

启动

testpmd> start

停止

testpmd> stop

查看结果

testpmd> show port stats all

设置模式

set fwd rxonly

set fwd txonly

set fwd io

如何使用pktgen-dpdk

pktgen-dpdk1测试脚本

root@ubuntu241-192-168-10-241:~# cat  start-pktgen-test.sh 

export DPDK_DIR=/root/dpdk/dpdk-17.11

export DPDK_TARGET=x86_64-native-linuxapp-gcc

export DPDK_BUILD=$DPDK_DIR/$DPDK_TARGET

export RTE_SDK=$DPDK_DIR

export RTE_TARGET=$DPDK_TARGET

export RTE_SDK=$DPDK_DIR

export RTE_TARGET=$DPDK_TARGET

mkdir -p /dev/hugepages

mount -t hugetlbfs hugetlbfs /dev/hugepages

modprobe uio

insmod $DPDK_BUILD/kmod/igb_uio.ko

$DPDK_DIR/usertools/dpdk-devbind.py --status

$DPDK_DIR/usertools/dpdk-devbind.py -b igb_uio 0000:00:03.0

cd /root/pktgen-3.4.9

./pktgen  -l 0,2,3  -n 2 --proc-type auto --socket-mem 1024  --huge-dir /dev/hugepages  --file-prefix pg1  -b 00:09.0 -- -P -T -m '[2:3].0'

启动后的配置

0 port发包,收包是默认动作

start 0

0 port停止发包

stop 0

set 0 dst ip 192.168.10.242

set 0 src ip 192.168.10.241/24

set 0 dst mac 52:54:aa:01:01:01

set 0 src mac 52:54:bb:01:01:01

设置vlan

vlan 0 on

vlanid 0 1000

设置包大小

set 0 size 512

相关文章

网友评论

      本文标题:ubuntu17.10下testpmd-dpdk pktgen-

      本文链接:https://www.haomeiwen.com/subject/gajzfftx.html