DPDK-22.11.2 [一] 源码类库编译
下载源码
http://core.dpdk.org/download/
编译
http://core.dpdk.org/doc/quick-start/
安装python3
安装ninja
yum install ninja-build
安装meson
pip3 install meson
安装elftools
pip3 install pyelftools
开始编译
tar xf dpdk.tar.gz
cd dpdk
meson build
ninja -C build
meson使用简介
具体meson有哪些参数,可以通过help查看。
配置meson参数,与cmake类似,-D
开头,后续紧跟配置内容
配置meson需要使用meson setup
,如果不加setup
直接调用meson
也可以,但是不建议。
meson -Dexamples=all build
编译所有的示例meson setup -Dprefix=/home/dpdkinstall build
指定安装目录meson setup --reconfigure -Dexamples=ethtool build
重新配置
ninja使用简介
ninja -C build -j4
多个job同时编译。-C
是进入到指定目录执行ninja install
安装ninja uninstall
卸载ninja reconfigure
重新配置
确定配置好大页内存
mkdir -p /dev/hugepages
mountpoint -q /dev/hugepages || mount -t hugetlbfs nodev /dev/hugepages
echo 64 > /sys/devices/system/node/node0/hugepages/hugepages-2048kB/nr_hugepages
运行测试程序
iface
需要对应机器上支持的网卡名称
--total-num-mbufs
如果是1GB大页,数值为1048576
build/app/dpdk-testpmd -c7 --vdev=net_pcap0,iface=eth0 --vdev=net_pcap1,iface=eth1 -- -i --nb-cores=2 --nb-ports=2 --total-num-mbufs=2048
testpmd> show port stats all
######################## NIC statistics for port 0 ########################
RX-packets: 0 RX-errors: 0 RX-bytes: 0
TX-packets: 0 TX-errors: 0 TX-bytes: 0
############################################################################
######################## NIC statistics for port 1 ########################
RX-packets: 0 RX-errors: 0 RX-bytes: 0
TX-packets: 0 TX-errors: 0 TX-bytes: 0
############################################################################
testpmd> start tx_first
testpmd> stop
---------------------- Forward statistics for port 0 ----------------------
RX-packets: 2377688 RX-dropped: 0 RX-total: 2377688
TX-packets: 2007009 TX-dropped: 0 TX-total: 2007009
----------------------------------------------------------------------------
---------------------- Forward statistics for port 1 ----------------------
RX-packets: 2006977 RX-dropped: 0 RX-total: 2006977
TX-packets: 2377720 TX-dropped: 0 TX-total: 2377720
----------------------------------------------------------------------------
+++++++++++++++ Accumulated forward statistics for all ports+++++++++++++++
RX-packets: 4384665 RX-dropped: 0 RX-total: 4384665
TX-packets: 4384729 TX-dropped: 0 TX-total: 4384729
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
遇到的错误
ERROR: Problem encountered: missing python module: elftools
pip3 install pyelftools
error while loading shared libraries: libatomic.so.1: cannot open shared object file
yum install libatomic
DPDK is running on a NUMA system, but is compiled without NUMA support.
这个不算问题,如果需要dpdk自己支持NUMA,需要在编译前安装对应的开发库
dnf install numactl-devel
在19版本的文档中说明了numa的作用
https://doc.dpdk.org/guides-19.02/linux_gsg/sys_reqs.html
Library for handling NUMA (Non Uniform Memory Access).
numactl-devel in Red Hat/Fedora;
libnuma-dev in Debian/Ubuntu;
Note
On systems with NUMA support, libnuma-dev (aka numactl-devel) is a recommended dependency when –legacy-mem switch is used, and a required dependency if default memory mode is used. While DPDK will compile and run without libnuma even on NUMA-enabled systems, both usability and performance will be degraded.
https://forum.openeuler.org/t/topic/670
http://core.dpdk.org/doc/archives/