l2fwd 测试

环境如下:

  • Ubuntu 16.04
  • cpu 4 core
  • Intel Corporation 82545EM Gigabit Ethernet Controller * 2个
  • dpdk-17.02.1

提示: 测试需要root权限

一. dpdk 环境搭建

1.1. 编译 dpdk

cd dpdk
make config T=x86_64-native-linuxapp-gcc
make
make install T=x86_64-native-linuxapp-gcc

1.2. 设置环境变量

编辑.profile.bashrc,添加:

export RTE_SDK=/root/dpdk
export RTE_TARGET=x86_64-native-linuxapp-gcc

1.3. 加载内核模块

modprobe uio
insmod x86_64-native-linuxapp-gcc/kmod/igb_uio.ko

1.4. 设置 hugepage

mkdir -p /mnt/huge
mount -t hugetlbfs nodev /mnt/huge
echo 1024 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages

1.5. 绑定网卡

先查看网卡状态,确保网卡处于 down 状态

root@zengxl:/root/dpdk# ./usertools/dpdk-devbind.py --status

Network devices using DPDK-compatible driver
============================================
<none>

Network devices using kernel driver
===================================
0000:02:01.0 '82545EM Gigabit Ethernet Controller (Copper)' if=ens33 drv=e1000 unused=igb_uio *Active*
0000:02:06.0 '82545EM Gigabit Ethernet Controller (Copper)' if=ens38 drv=e1000 unused=igb_uio 
0000:02:07.0 '82545EM Gigabit Ethernet Controller (Copper)' if=ens39 drv=e1000 unused=igb_uio 

Other network devices
=====================
<none>

Crypto devices using DPDK-compatible driver
===========================================
<none>

Crypto devices using kernel driver
==================================
<none>

Other crypto devices
====================
<none>

绑定

root@zengxl:/root/dpdk# ./usertools/dpdk-devbind.py --bind=igb_uio ens38
root@zengxl:/root/dpdk# ./usertools/dpdk-devbind.py --bind=igb_uio ens39

二. 测试

./build/l2fwd -c 0xc -n 2 -- -q 1 -p 0x3
EAL: Detected 4 lcore(s)
EAL: No free hugepages reported in hugepages-1048576kB
EAL: Probing VFIO support...
EAL: PCI device 0000:02:01.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
EAL: PCI device 0000:02:06.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
EAL: PCI device 0000:02:07.0 on NUMA socket -1
EAL:   probe driver: 8086:100f net_e1000_em
MAC updating enabled
Lcore 2: RX port 0
Lcore 3: RX port 1
Initializing port 0... done: 
Port 0, MAC address: 00:0C:29:75:1E:19

Initializing port 1... done: 
Port 1, MAC address: 00:0C:29:75:1E:23


Checking link statusdone
Port 0 Link Up - speed 1000 Mbps - full-duplex
Port 1 Link Up - speed 1000 Mbps - full-duplex
L2FWD: entering main loop on lcore 3
L2FWD:  -- lcoreid=3 portid=1
L2FWD: entering main loop on lcore 2
L2FWD:  -- lcoreid=2 portid=0


Port statistics ====================================
Statistics for port 0 ------------------------------
Packets sent:                   301034
Packets received:               336559
Packets dropped:                     0
Statistics for port 1 ------------------------------
Packets sent:                   336559
Packets received:               301034
Packets dropped:                     0
Aggregate statistics ===============================
Total packets sent:             637593
Total packets received:         637593
Total packets dropped:               0
====================================================
^C

Signal 2 received, preparing to exit...
Closing port 0... Done
Closing port 1... Done
Bye...

参考

http://dpdk.org/doc

©️2020 CSDN 皮肤主题: 大白 设计师: CSDN官方博客 返回首页
实付0元
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、C币套餐、付费专栏及课程。

余额充值