文档简介:
操作场景
操作步骤
编译安装 DPDK
yum install -y sysstat wget tar automake make gcc
wget http://git.dpdk.org/dpdk/snapshot/dpdk-17.11.tar.gz
tar -xf dpdk-17.11.tar.gz
mv dpdk-17.11 dpdk
vim dpdk/app/test-pmd/txonly.c
RTE_DEFINE_PER_LCORE(struct udp_hdr, lcore_udp_hdr);RTE_DEFINE_PER_LCORE(uint16_t, test_port);

/* dummy test udp port */memcpy(&RTE_PER_LCORE(lcore_udp_hdr), &pkt_udp_hdr, sizeof(pkt_udp_hdr));
RTE_PER_LCORE(test_port)++;RTE_PER_LCORE(lcore_udp_hdr).src_port = rte_cpu_to_be_16(2222);RTE_PER_LCORE(lcore_udp_hdr).dst_port = rte_cpu_to_be_16(rte_lcore_id() * 2000 + RTE_PER_LCORE(test_port) % 64);

copy_buf_to_pkt(&RTE_PER_LCORE(lcore_udp_hdr), sizeof(RTE_PER_LCORE(lcore_udp_hdr)), pkt,

vim dpdk/config/common_base


scp -P 22 /root/dpdk/app/test-pmd/txonly.c root@<IP地址>:/root/dpdk/app/test-pmd/scp -P 22 /root/dpdk/config/common_base root@<IP地址>:/root/dpdk/config
vim dpdk/app/test-pmd/txonly.c
#define IP_SRC_ADDR (198U << 24) | (18 << 16) | (0 << 8) | 1;#define IP_DST_ADDR (198U << 24) | (18 << 16) | (0 << 8) | 2;
yum install numactl-devel
apt-get install libnuma-dev
sed -i "s/\(^CONFIG_.*KNI.*\)=y/\1=n/g" ./config/*
sed -i "s/\(^WERROR_FLAGS += -Wundef -Wwrite-strings$\)/\1 -Wno-address-of-packed-member/g" ./mk/toolchain/gcc/rte.vars.mk
sed -i "s/fall back/falls through -/g" ./lib/librte_eal/linuxapp/igb_uio/igb_uio.c
make defconfig
make -j
配置大页内存
echo 4096 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
echo 2048 > /sys/kernel/mm/hugepages/hugepages-2048kB/nr_hugepages
装载内核模块及绑定接口
ifconfig eth0 0
ifconfig eth0 down
modprobe uio
insmod /root/dpdk/build/kmod/igb_uio.ko
cd /root/dpdk/usertools/
python3 dpdk-devbind.py --bind=igb_uio 00:05.0
python3 dpdk-devbind.py -s
cd /root/dpdk/usertools/
python3 dpdk-devbind.py --bind=virtio-pci 00:05.0
ifconfig eth0 up
测试带宽及吞吐量
/root/dpdk/build/app/testpmd -l 8-191 -w 0000:00:05.0 -- --burst=128 --nb-cores=32
--txd=512 --rxd=512 --txq=16 --rxq=16 --forward-mode=txonly --txpkts=1430 --stats-period=1
/root/dpdk/build/app/testpmd -l 8-191 -w 0000:00:05.0 -- --burst=128 --nb-cores=32
--txd=512 --rxd=512 --txq=16 --rxq=16 --forward-mode=rxonly --stats-period=1
/root/dpdk/build/app/testpmd -l 8-191 -w 0000:00:05.0 -- --burst=128 --nb-cores=32
--txd=512 --rxd=512 --txq=16 --rxq=16 --forward-mode=txonly --txpkts=64 --stats-period=1
/root/dpdk/build/app/testpmd -l 8-191 -w 0000:00:05.0 -- --burst=128 --nb-cores=32
--txd=512 --rxd=512 --txq=16 --rxq=16 --forward-mode=rxonly --stats-period=1
