DPDK 20.11 已正式发布, 其中的编译机制做出了很大改动, 不再支持 make 方式, 只支持使用 meson 作为构建工具.
http://mesonbuild.com/Getting-meson.html
https://github.com/mesonbuild/meson/releases
Fedora安装:
dnf install meson
python3 pip 安装:
pip3 install meson
pip3 install --user 安装到 $HOME/.local/bin 目录, 避免权限问题:
pip3 install --user meson
export PATH=$PATH:$HOME/.local/bin
https://ninja-build.org/
Fedora:
dnf install ninja-build
Download binary:
https://github.com/ninja-build/ninja/releases
build from source:
$ git clone git://github.com/ninja-build/ninja.git && cd ninja
$ git checkout release
$ cat README
meson configure
查看当前工程可用配置项:
$ meson configure
Unable to find build file lib/librte_/meson.build --> Skipping
Unable to evaluate subdir([]) in AstInterpreter --> Skipping
Unable to evaluate subdir([]) in AstInterpreter --> Skipping
Unable to evaluate subdir([]) in AstInterpreter --> Skipping
Unable to evaluate subdir([]) in AstInterpreter --> Skipping
Unable to evaluate subdir([]) in AstInterpreter --> Skipping
WARNING: The source directory instead of the build directory was specified.
WARNING: Only the default values for the project are printed, and all command line parameters are ignored.
Core properties:
Source dir /root/DPDK/dpdk-20.11
Core options:
Option Default Value Possible Values Description
------ ------------- --------------- -----------
auto_features auto [enabled, disabled, auto] Override value of all 'auto' features
backend ninja [ninja, vs, vs2010, vs2015, vs2017, vs2019, xcode] Backend to use
buildtype release [plain, debug, debugoptimized, release, minsize, custom] Build type to use
debug false [true, false] Debug
default_library static [shared, static, both] Default library type
install_umask 0022 [preserve, 0000-0777] Default umask to apply on permissions of installed files
layout mirror [mirror, flat] Build directory layout
optimization 3 [0, g, 1, 2, 3, s] Optimization level
strip false [true, false] Strip targets on install
unity off [on, off, subprojects] Unity build
warning_level 1 [0, 1, 2, 3] Compiler warning level to use
werror false [true, false] Treat warnings as errors
wrap_mode default [default, nofallback, nodownload, forcefallback] Wrap mode
Core options (for host machine):
Option Default Value Description
------ ------------- -----------
cmake_prefix_path [] List of additional prefixes for cmake to search
pkg_config_path [] List of additional paths for pkg-config to search
Core options (for build machine):
Option Default Value Description
------ ------------- -----------
build.cmake_prefix_path [] List of additional prefixes for cmake to search
build.pkg_config_path [] List of additional paths for pkg-config to search
Backend options:
Option Default Value Possible Values Description
------ ------------- --------------- -----------
backend_max_links 0 >=0 Maximum number of linker processes to run or 0 for no limit
Base options:
Option Default Value Possible Values Description
------ ------------- --------------- -----------
b_asneeded true [true, false] Use -Wl,--as-needed when linking
b_colorout always [auto, always, never] Use colored output
b_coverage false [true, false] Enable coverage tracking.
b_lto false [true, false] Use link time optimization
b_lundef true [true, false] Use -Wl,--no-undefined when linking
b_ndebug false [true, false, if-release] Disable asserts
b_pch true [true, false] Use precompiled headers
b_pgo off [off, generate, use] Use profile guided optimization
b_pie false [true, false] Build executables as position independent
b_sanitize none [none, address, thread, undefined, memory, address,undefined] Code sanitizer to use
b_staticpic true [true, false] Build static libraries as position independent
Compiler options (for host machine):
Option Default Value Possible Values Description
------ ------------- --------------- -----------
c_args [] Extra arguments passed to the C compiler
c_link_args [] Extra arguments passed to the C linker
c_std none [none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, C language standard to use
gnu18]
Compiler options (for build machine):
Option Default Value Possible Values Description
------ ------------- --------------- -----------
build.c_args [] Extra arguments passed to the C compiler
build.c_link_args [] Extra arguments passed to the C linker
build.c_std none [none, c89, c99, c11, c17, c18, gnu89, gnu99, gnu11, gnu17, C language standard to use
gnu18]
Directories:
Option Default Value Description
------ ------------- -----------
bindir bin Executable directory
datadir share Data file directory
includedir include Header file directory
infodir share/info Info page directory
libdir lib64 Library directory
libexecdir libexec Library executable directory
localedir share/locale Locale data directory
localstatedir var Localstate data directory
mandir share/man Manual page directory
prefix /usr/local Installation prefix
sbindir sbin System executable directory
sharedstatedir com Architecture-independent data directory
sysconfdir etc Sysconf data directory
Project options:
Option Default Value Possible Values Description
------ ------------- --------------- -----------
disable_drivers Comma-separated list of drivers to explicitly disable.
drivers_install_subdir dpdk/pmds-<VERSION> Subdirectory of libdir where to install PMDs. Defaults to using a versioned subdirectory.
enable_docs false [true, false] build documentation
enable_kmods false [true, false] build kernel modules
enable_trace_fp false [true, false] enable fast path trace points.
examples Comma-separated list of examples to build by default
flexran_sdk Path to FlexRAN SDK optional Libraries for BBDEV device
ibverbs_link shared [static, shared, dlopen] Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.
include_subdir_arch subdirectory where to install arch-dependent headers
kernel_dir Path to the kernel for building kernel modules. Headers must be in $kernel_dir/build. Modules will be installed in $DEST_DIR/$kernel_dir/extra/dpdk.
lib_musdk_dir path to the MUSDK library installation directory
machine native set the target machine type
max_ethports 32 maximum number of Ethernet devices
max_lcores 128 maximum number of cores/threads supported by EAL
max_numa_nodes 4 maximum number of NUMA nodes supported by EAL
tests true [true, false] build unit tests
use_hpet false [true, false] use HPET timer in EAL
Testing options:
Option Default Value Possible Values Description
------ ------------- --------------- -----------
errorlogs true [true, false] Whether to print the logs from failing tests
stdsplit true [true, false] Split stdout and stderr in test logs
WARNING: The source directory instead of the build directory was specified.
WARNING: Only the default values for the project are printed, and all command line parameters are ignored.
主要的配置参数:
参数 | 默认值 | 参数范围 | 描叙 |
---|---|---|---|
disable_drivers | 无 | drirver下目录名称, 多个参数使用逗号(-Ddisable_drivers=net/af_xdp,event/dpaa) | 禁用 dpdk driver |
examples | 无 | examples下目录名称, 多个参数使用逗号(-Dexamples=l2fwd,l3fwd) | 启用 dpdk examples |
machine | native | gcc/clang -march= -mtune= | |
max_ethports | 32 | RTE_MAX_ETHPORTS | |
max_lcores | 128 | RTE_MAX_LCORE | |
max_numa_nodes | 4 | RTE_MAX_NUMA_NODES |
示例1:
CC=clang meson -Dmax_lcores=128 -Dmachine=sandybridge -Ddisable_drivers=net/af_xdp,net/dpaa,net/dpaa2,net/bnx2x -Dexamples=l3fwd,l2fwd -Dwerror=false v2011-mlx5-snb
ninja -C v2011-mlx5-snb
示例2 reconfigure
:
CC=clang meson --reconfigure -Dmax_lcores=128 -Dmachine=sandybridge -Ddisable_drivers=net/af_xdp,net/dpaa,net/dpaa2,net/bnx2x -Dexamples=l3fwd,l2fwd -Dwerror=false v2011-mlx5-snb
ninja -C v2011-mlx5-snb
testpmd:
$ app/testpmd -c 0xffff -m 4096 -w 05:00.0 -n 2 -r 2 -- -i -a --forward-mode=icmpecho --rxd=4096 --txd=4096 --rxq=7 --txq=7 --nb-cores=12 --rss-ip
EAL: Detected 32 lcore(s)
EAL: Detected 1 NUMA nodes
Option -w, --pci-whitelist is deprecated, use -a, --allow option instead
EAL: Multi-process socket /var/run/dpdk/rte/mp_socket
EAL: Selected IOVA mode 'PA'
EAL: Probing VFIO support...
EAL: VFIO support initialized
EAL: Invalid NUMA socket, default to 0
EAL: Probe PCI driver: mlx5_pci (15b3:1017) device: 0000:05:00.0 (socket 0)
mlx5_pci: Size 0xFFFF is not power of 2, will be aligned to 0x10000.
EAL: No legacy callbacks, legacy socket not created
Interactive-mode selected
Auto-start selected
Set icmpecho packet forwarding mode
testpmd: create a new mbuf pool <mb_pool_0>: n=267456, size=2176, socket=0
testpmd: preferred mempool ops selected: ring_mp_mc
Configuring Port 0 (socket 0)
Port 0: 98:03:9B:97:50:76
Checking link statuses...
Done
Start automatic packet forwarding
icmpecho packet forwarding - ports=1 - cores=7 - streams=7 - NUMA support enabled, MP allocation mode: native
Logical Core 1 (socket 0) forwards packets on 1 streams:
RX P=0/Q=0 (socket 0) -> TX P=0/Q=0 (socket 0) peer=02:00:00:00:00:00
Logical Core 2 (socket 0) forwards packets on 1 streams:
RX P=0/Q=1 (socket 0) -> TX P=0/Q=1 (socket 0) peer=02:00:00:00:00:00
Logical Core 3 (socket 0) forwards packets on 1 streams:
RX P=0/Q=2 (socket 0) -> TX P=0/Q=2 (socket 0) peer=02:00:00:00:00:00
Logical Core 4 (socket 0) forwards packets on 1 streams:
RX P=0/Q=3 (socket 0) -> TX P=0/Q=3 (socket 0) peer=02:00:00:00:00:00
Logical Core 5 (socket 0) forwards packets on 1 streams:
RX P=0/Q=4 (socket 0) -> TX P=0/Q=4 (socket 0) peer=02:00:00:00:00:00
Logical Core 6 (socket 0) forwards packets on 1 streams:
RX P=0/Q=5 (socket 0) -> TX P=0/Q=5 (socket 0) peer=02:00:00:00:00:00
Logical Core 7 (socket 0) forwards packets on 1 streams:
RX P=0/Q=6 (socket 0) -> TX P=0/Q=6 (socket 0) peer=02:00:00:00:00:00
icmpecho packet forwarding packets/burst=32
nb forwarding cores=12 - nb forwarding ports=1
port 0: RX queue number: 7 Tx queue number: 7
Rx offloads=0x0 Tx offloads=0x0
RX queue: 0
RX desc=4096 - RX free threshold=64
RX threshold registers: pthresh=0 hthresh=0 wthresh=0
RX Offloads=0x0
TX queue: 0
TX desc=4096 - TX free threshold=0
TX threshold registers: pthresh=0 hthresh=0 wthresh=0
TX offloads=0x0 - TX RS bit threshold=0
testpmd>
Fedora:
dnf install -y elfutils-libelf-devel elfutils-libelf-devel-static
CentOS-8:
dnf install -y gcc-toolset-9