add static ibverbs in meson
Subsystems (2)
cover add static ibverbs in meson
This is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second implementation works with "make" and "meson".
Thomas Monjalon (3):
buildtools: rework static pkg-config script
build: allow to hide dependencies from pkg-config net/mlx: support static ibverbs linkage with meson
buildtools/meson.build | 2 ++ buildtools/options-ibverbs-static.sh | 14 ------------- buildtools/pkg-config-static.sh | 31 ++++++++++++++++++++++++++++ doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/meson.build | 9 +++++--- drivers/net/mlx4/Makefile | 2 +- drivers/net/mlx4/meson.build | 20 ++++++++++++++---- drivers/net/mlx5/Makefile | 2 +- drivers/net/mlx5/meson.build | 20 ++++++++++++++---- meson_options.txt | 4 ++-- mk/rte.app.mk | 3 ++- 12 files changed, 85 insertions(+), 30 deletions(-) delete mode 100755 buildtools/options-ibverbs-static.sh create mode 100755 buildtools/pkg-config-static.sh
Signature · 1 line
2.24.1
PATCH 1/3 buildtools: rework static pkg-config script
The shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs dependency.
It is now renamed pkg-config-static.sh and it is made generic, i.e. it can work with any .pc library file.
The idea is to distinguish its own libraries and the dependencies by looking at the -L directory.
Only the found static libraries are forced to static.
The -L path is added in this new version in order to fill the .pc file generated in DPDK.
--- buildtools/options-ibverbs-static.sh | 14 ------------- buildtools/pkg-config-static.sh | 31 ++++++++++++++++++++++++++++ drivers/net/mlx4/Makefile | 2 +- drivers/net/mlx5/Makefile | 2 +- mk/rte.app.mk | 3 ++- 5 files changed, 35 insertions(+), 17 deletions(-) delete mode 100755 buildtools/options-ibverbs-static.sh create mode 100755 buildtools/pkg-config-static.sh
buildtools/options-ibverbs-static.sh deleted +0 -14
@@ -1,14 +0,0 @@ -#! /bin/sh -# SPDX-License-Identifier: BSD-3-Clause -# -# Print link options -l for static link of ibverbs. -# -# Static flavour of ibverbs and the providers libs are explicitly picked, -# thanks to the syntax -l:libfoo.a -# Other libs (pthread and nl) are unchanged, i.e. linked dynamically by default. -# -# PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. - -pkg-config --libs-only-l --static libibverbs | - tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,'
buildtools/pkg-config-static.sh new file +31 -0
@@ -0,0 +1,31 @@ +#! /bin/sh +# SPDX-License-Identifier: BSD-3-Clause +# Copyright 2020 Mellanox Technologies, Ltd +# +# Convert pkg-config link options for static linkage. +# +# Static flavour of provided libs are explicitly picked, +# thanks to the syntax -l:libfoo.a +# Other libs (dependencies) are unchanged, i.e. linked dynamically by default. +# +# Syntax: pkg-config-static.sh <libname> +# +# PKG_CONFIG_PATH may be required to be set if the .pc file is not installed. + +ldflags=$(pkg-config --libs --static $1 | tr '[:space:]' '\n') +dir=$(echo "$ldflags" | sed -rn 's,^-L(.*),\1,p' | head -n1) +IFS=' +' +for arg in $ldflags ; do + prefix=$(echo $arg | sed -rn 's/^(-Wl,).*/\1/p') + option=$(echo $arg | sed -rn "s/^$prefix-(.*=|.*,|.).*/\1/p") + [ "$option" = 'l' -o "$option" = 'L' ] || continue + value=$(echo $arg | sed "s/^$prefix-$option//") + staticlib="lib$value.a" + printf -- -$option + if [ -f $dir/$staticlib ] ; then + echo :$staticlib + else + echo $value + fi +done | tr '\n' ' '
drivers/net/mlx4/Makefile +1 -1
@@ -45,7 +45,7 @@ CFLAGS += -DMLX4_GLUE_VERSION='"$(LIB_GLUE_VERSION)"' CFLAGS_mlx4_glue.o += -fPIC LDLIBS += -ldl else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y) -LDLIBS += $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh) +LDLIBS += $(shell $(RTE_SDK)/buildtools/pkg-config-static.sh libibverbs) else LDLIBS += -libverbs -lmlx4 endif
drivers/net/mlx5/Makefile +1 -1
@@ -60,7 +60,7 @@ CFLAGS += -DMLX5_GLUE_VERSION='"$(LIB_GLUE_VERSION)"' CFLAGS_mlx5_glue.o += -fPIC LDLIBS += -ldl else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y) -LDLIBS += $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh) +LDLIBS += $(shell $(RTE_SDK)/buildtools/pkg-config-static.sh libibverbs) else LDLIBS += -libverbs -lmlx5 endif
mk/rte.app.mk +2 -1
@@ -195,7 +195,8 @@ ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y) _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += -ldl _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += -ldl else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y) -LIBS_IBVERBS_STATIC = $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh) +LIBS_IBVERBS_STATIC = $(shell $(RTE_SDK)/buildtools/pkg-config-static.sh \ + libibverbs | sed 's/-Wl,//') _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX4_PMD) += $(LIBS_IBVERBS_STATIC) _LDLIBS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += $(LIBS_IBVERBS_STATIC) else
Signature · 1 line
2.24.1
PATCH 2/3 build: allow to hide dependencies from pkg-config
In reply to Thomas MonjalonIf a dependency is required for a driver build,
but should not be exposed to the application (via pkg-config), it can be declared in the array hidden_deps.
The hidden_deps are used as internal dependencies,
when building the shared library and the first stage of static library. The final static library does not include the hidden_deps because this library object is used to generate the .pc file.
--- drivers/meson.build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)
drivers/meson.build +6 -3
@@ -56,6 +56,7 @@ foreach class:dpdk_driver_classes # too, so that it can be reflected in the pkgconfig output for # static builds. ext_deps = [] + hidden_deps = [] pkgconfig_extra_libs = [] # pull in driver directory which should assign to each of the above
@@ -71,8 +72,9 @@ foreach class:dpdk_driver_classes endforeach if build # get dependency objs from strings - shared_deps = ext_deps - static_deps = ext_deps + shared_deps = ext_deps + hidden_deps + static_deps = ext_deps + hidden_deps + static_pub_deps = ext_deps foreach d:deps if not is_variable('shared_rte_' + d) build = false
@@ -82,6 +84,7 @@ foreach class:dpdk_driver_classes else shared_deps += [get_variable('shared_rte_' + d)] static_deps += [get_variable('static_rte_' + d)] + static_pub_deps += [get_variable('static_rte_' + d)] endif endforeach endif
@@ -144,7 +147,7 @@ foreach class:dpdk_driver_classes sources, objects: objs, include_directories: includes, - dependencies: static_deps, + dependencies: static_pub_deps, # skip hidden_deps c_args: cflags, install: true)
Signature · 1 line
2.24.1
Re: [dpdk-dev] [PATCH 2/3] build: allow to hide dependencies from pkg-config
Quoted 19 lines · Thomas Monjalon
If a dependency is required for a driver build,
but should not be exposed to the application (via pkg-config), it can be declared in the arrayhidden_deps.The
hidden_depsare used as internal dependencies,
when building the shared library and the first stage of static library. The final static library does not include thehidden_depsbecause this library object is used to generate the .pc file.Signed-off-by Thomas Monjalon <[email protected]>--- drivers/meson.build | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-)drivers/meson.build +0
-0
drivers/meson.build foreach class:dpdk_driver_classes · line 61
Quoted 6 lines
drivers/meson.build +1
-0@@ -56,6 +56,7 @@ foreach class:dpdk_driver_classes # too, so that it can be reflected in the pkgconfig output for # static builds. ext_deps = [] + hidden_deps = [] pkgconfig_extra_libs = []
All parameters for drivers and libs need to be documented in the docs.
Thanks,
/Bruce
PATCH 3/3 net/mlx: support static ibverbs linkage with meson
In reply to Thomas MonjalonThe libibverbs (and libmlx4/5) can be statically embedded in the shared PMD library, or in the application with the static PMD. It was supported with make build system in
commit 2c0dd7b69fb0 ("config: add static linkage of mlx dependency").
The same feature is enabled with meson.
The main difference, in meson build system, is the generated .pc file giving arguments to link DPDK with the application.
Forcing meson to link with static dependencies is not really handled in meson and especially when generating a .pc file.
A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
First, the static flavour must be explicitly picked thanks to the syntax
-l:libfoo.a
Second, in case DPDK is statically linked, the .pc file must not advertise the simple syntax -lfoo which would pick the shared library when linking the application.
--- buildtools/meson.build | 2 ++ doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/net/mlx4/meson.build | 20 ++++++++++++++++---- drivers/net/mlx5/meson.build | 20 ++++++++++++++++---- meson_options.txt | 4 ++-- 6 files changed, 44 insertions(+), 10 deletions(-)
buildtools/meson.build +2 -0
@@ -7,6 +7,8 @@ pmdinfo = find_program('gen-pmdinfo-cfile.sh') check_experimental_syms = find_program('check-experimental-syms.sh') +pkg_config_static = find_program('pkg-config-static.sh') + # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false) if python3.found()
doc/guides/nics/mlx4.rst +4 -0
@@ -92,6 +92,10 @@ These options can be modified in the ``.config`` file. adds additional run-time checks and debugging messages at the cost of lower performance. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
doc/guides/nics/mlx5.rst +4 -0
@@ -270,6 +270,10 @@ These options can be modified in the ``.config`` file. 64. Default armv8a configuration of make build and meson build set it to 128 then brings performance degradation. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
drivers/net/mlx4/meson.build +16 -4
@@ -9,6 +9,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0'
@@ -24,12 +25,24 @@ endif libnames = [ 'mlx4', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if static_ibverbs + # Workaround static dependency handling miss of meson + # See https://github.com/mesonbuild/meson/pull/6393 + # Build without adding shared libs to Requires.private + hidden_deps += lib.partial_dependency(compile_args:true) + # Add static lib deps to internal apps and Libs.private + ldflags = run_command(pkg_config_static, + 'lib' + libname, check:true).stdout() + ext_deps += declare_dependency(link_args:ldflags.split()) + else + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"'
@@ -38,7 +51,6 @@ endforeach if build allow_experimental_apis = true - ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c',
drivers/net/mlx5/meson.build +16 -4
@@ -9,6 +9,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '19.08.0'
@@ -24,12 +25,24 @@ endif libnames = [ 'mlx5', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if static_ibverbs + # Workaround static dependency handling miss of meson + # See https://github.com/mesonbuild/meson/pull/6393 + # Build without adding shared libs to Requires.private + hidden_deps += lib.partial_dependency(compile_args:true) + # Add static lib deps to internal apps and Libs.private + ldflags = run_command(pkg_config_static, + 'lib' + libname, check:true).stdout() + ext_deps += declare_dependency(link_args:ldflags.split()) + else + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"'
@@ -39,7 +52,6 @@ endforeach if build allow_experimental_apis = true deps += ['hash'] - ext_deps += libs sources = files( 'mlx5.c', 'mlx5_ethdev.c',
meson_options.txt +2 -2
@@ -12,8 +12,8 @@ option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('flexran_sdk', type: 'string', value: '', description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') -option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', - description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') +option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', + description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('include_subdir_arch', type: 'string', value: '', description: 'subdirectory where to install arch-dependent headers') option('kernel_dir', type: 'string', value: '',
Signature · 1 line
2.24.1
v2 cover add static ibverbs in meson
In reply to Thomas MonjalonThis is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".
changes in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc for hidden_deps
- improve explanations in commit logs
Thomas Monjalon (4):
net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson
build: allow hiding dependencies from pkg-config net/mlx: workaround static linkage with meson
buildtools/meson.build | 2 ++ buildtools/options-ibverbs-static.sh | 10 ++++++++-- doc/guides/contributing/coding_style.rst | 6 ++++++ doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/meson.build | 9 ++++++--- drivers/net/mlx4/meson.build | 19 +++++++++++++++---- drivers/net/mlx5/meson.build | 19 +++++++++++++++---- meson_options.txt | 4 ++-- 9 files changed, 62 insertions(+), 15 deletions(-)
Signature · 1 line
2.24.1
PATCH v2 1/4 net/mlx: add static ibverbs linkage with meson
The libibverbs (and libmlx4/5) can be statically embedded in the shared PMD library, or in the application with the static PMD. It was supported with make build system in
commit 2c0dd7b69fb0 ("config: add static linkage of mlx dependency").
The same feature is enabled with meson when using pkg-config (i.e. only if the call to dependency() is successful). The fallback method for searching library with cc.find_library() is not supported because the dependencies of the found library would not be linked (no such info in .a file unlike .so).
The main difference, in meson build system, is the generated .pc file giving arguments to link DPDK with the application. Unfortunately the .pc file will not keep memory of the static linkage option for libibverbs.
--- doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/net/mlx4/meson.build | 5 +++-- drivers/net/mlx5/meson.build | 5 +++-- meson_options.txt | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-)
doc/guides/nics/mlx4.rst +4 -0
@@ -92,6 +92,10 @@ These options can be modified in the ``.config`` file. adds additional run-time checks and debugging messages at the cost of lower performance. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
doc/guides/nics/mlx5.rst +4 -0
@@ -278,6 +278,10 @@ These options can be modified in the ``.config`` file. 64. Default armv8a configuration of make build and meson build set it to 128 then brings performance degradation. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
drivers/net/mlx4/meson.build +3 -2
@@ -9,6 +9,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0'
@@ -24,8 +25,8 @@ endif libnames = [ 'mlx4', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
drivers/net/mlx5/meson.build +3 -2
@@ -9,6 +9,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0'
@@ -24,8 +25,8 @@ endif libnames = [ 'mlx5', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
meson_options.txt +2 -2
@@ -12,8 +12,8 @@ option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('flexran_sdk', type: 'string', value: '', description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') -option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', - description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') +option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', + description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('include_subdir_arch', type: 'string', value: '', description: 'subdirectory where to install arch-dependent headers') option('kernel_dir', type: 'string', value: '',
Signature · 1 line
2.24.1
PATCH v2 2/4 buildtools: get static mlx dependencies for meson
In reply to Thomas MonjalonThe shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs libraries.
When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson.
If linking with libraries installed in a non-standard path, an option -L is provided via EXTRA_LDFLAGS in case of using make. With meson, tuning PKG_CONFIG_PATH for pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make.
The other change in this script is to move the main library file (libiverbs.a) at the end of the list of dependencies.
It fixes some undefined references when linking a static application using libdpdk.pc.
--- buildtools/options-ibverbs-static.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
buildtools/options-ibverbs-static.sh +8 -2
@@ -9,6 +9,12 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs | +lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + sed "/$lib/d" # move main lib at the end +echo -l:$lib.a
Signature · 1 line
2.24.1
Re: [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson
Quoted 35 lines · Thomas Monjalon
The shell script
options-ibverbs-static.shwas used with make in forcing static linkage of ibverbs libraries.When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson.
If linking with libraries installed in a non-standard path, an option -L is provided via
EXTRA_LDFLAGSin case of using make. With meson, tuningPKG_CONFIG_PATHfor pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make.The other change in this script is to move the main library file (libiverbs.a) at the end of the list of dependencies.
It fixes some undefined references when linking a static application using libdpdk.pc.Signed-off-by Thomas Monjalon <[email protected]>--- buildtools/options-ibverbs-static.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)buildtools/options-ibverbs-static.sh +0
-1@@ -9,6 +9,12 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs |
buildtools/options-ibverbs-static.sh line 20
Quoted 10 lines
buildtools/options-ibverbs-static.sh +8
-1+lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + sed "/$lib/d" # move main lib at the end +echo -l:$lib.a
To improve my understanding of the desired end result with this patchset applied, I tried running different build configs with make with this patch applied. I get a build error on my system with the following settings adjusted from default (i.e. shared build with static link of ibverbs):
diff .config.orig .config
32c32
< CONFIG_RTE_BUILD_SHARED_LIB=n
---
Quoted 1 line
CONFIG_RTE_BUILD_SHARED_LIB=y
219c219
< CONFIG_RTE_LIBRTE_MLX5_PMD=n
---
Quoted 1 line
CONFIG_RTE_LIBRTE_MLX5_PMD=y
225c225
< CONFIG_RTE_IBVERBS_LINK_STATIC=n
---
Quoted 1 line
CONFIG_RTE_IBVERBS_LINK_STATIC=y
Error message I got is below. This is on Ubuntu 19.10 with gcc 9.2:
LD librte_pmd_mlx5.so.20.0.1/usr/bin/ld: /lib/x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocation R_X86_64_PC32 against symbol `stderr@@GL /usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[5]: *** [/home/bruce/dpdk.org/mk/rte.lib.mk:100: librte_pmd_mlx5.so.20.0.1] Error 1 make[4]: *** [/home/bruce/dpdk.org/mk/rte.subdir.mk:35: mlx5] Error 2
make[3]: *** [/home/bruce/dpdk.org/mk/rte.subdir.mk:35: net] Error 2
make[2]: *** [/home/bruce/dpdk.org/mk/rte.sdkbuild.mk:48: drivers] Error 2
make[1]: *** [/home/bruce/dpdk.org/mk/rte.sdkroot.mk:99: all] Error 2
make: *** [Makefile:12: all] Error 2
Re: [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson
29/01/2020 16:37, Bruce Richardson:
Quoted 4 lines
Error message I got is below. This is on Ubuntu 19.10 with gcc 9.2:
LD librte_pmd_mlx5.so.20.0.1
/usr/bin/ld: /lib/x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocationR_X86_64_PC32against symbol `stderr@@GL
I think -fPIC is missing.
Which version of rdma-core is it?
As documented, you may have to build the static libraries yourself:
http://doc.dpdk.org/guides/nics/mlx5.html#installation CFLAGS=-fPIC cmake -DIN_PLACE=1 -DENABLE_STATIC=1 -GNinja .. && ninja
Re: [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson
Quoted 12 lines · Thomas Monjalon
29/01/2020 16:37, Bruce Richardson:
Quoted 4 lines
Error message I got is below. This is on Ubuntu 19.10 with gcc 9.2:
LD librte_pmd_mlx5.so.20.0.1
/usr/bin/ld: /lib/x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocationR_X86_64_PC32against symbol `stderr@@GLI think -fPIC is missing.
Which version of rdma-core is it?
As documented, you may have to build the static libraries yourself:http://doc.dpdk.org/guides/nics/mlx5.html#installation CFLAGS=-fPIC cmake -DIN_PLACE=1 -DENABLE_STATIC=1 -GNinja .. && ninja
Yes, that appears to be necessary. :-(
What is the big advantage of doing this over default linking using standard packages, especially since for end apps the pkg-config file is taking care of providing all the correct linker args?
/Bruce
Re: [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson
29/01/2020 18:50, Bruce Richardson:
Quoted 13 lines · Thomas Monjalon
Quoted 12 lines
29/01/2020 16:37, Bruce Richardson:
Quoted 4 lines
Error message I got is below. This is on Ubuntu 19.10 with gcc 9.2:
LD librte_pmd_mlx5.so.20.0.1
/usr/bin/ld: /lib/x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocationR_X86_64_PC32against symbol `stderr@@GLI think -fPIC is missing.
Which version of rdma-core is it?
As documented, you may have to build the static libraries yourself:http://doc.dpdk.org/guides/nics/mlx5.html#installation CFLAGS=-fPIC cmake -DIN_PLACE=1 -DENABLE_STATIC=1 -GNinja .. && ninja
Quoted 5 lines
Yes, that appears to be necessary. :-(
What is the big advantage of doing this over default linking using standard packages, especially since for end apps the pkg-config file is taking care of providing all the correct linker args?
It does not change anything for compilation. It's all about packaging. It may be easier to package in some environments, by removing one dependency.
Re: [dpdk-dev] [PATCH v2 2/4] buildtools: get static mlx dependencies for meson
In reply to Bruce RichardsonQuoted 68 lines · Bruce Richardson
Quoted 35 lines · Thomas Monjalon
The shell script
options-ibverbs-static.shwas used with make in forcing static linkage of ibverbs libraries.When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson.
If linking with libraries installed in a non-standard path, an option -L is provided via
EXTRA_LDFLAGSin case of using make. With meson, tuningPKG_CONFIG_PATHfor pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make.The other change in this script is to move the main library file (libiverbs.a) at the end of the list of dependencies.
It fixes some undefined references when linking a static application using libdpdk.pc.Signed-off-by Thomas Monjalon <[email protected]>--- buildtools/options-ibverbs-static.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)buildtools/options-ibverbs-static.sh +0
-1@@ -9,6 +9,12 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs |buildtools/options-ibverbs-static.sh line 20
Quoted 10 lines
buildtools/options-ibverbs-static.sh +8
-1+lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + sed "/$lib/d" # move main lib at the end +echo -l:$lib.aTo improve my understanding of the desired end result with this patchset applied, I tried running different build configs with make with this patch applied. I get a build error on my system with the following settings adjusted from default (i.e. shared build with static link of ibverbs):
diff .config.orig .config
32c32
<CONFIG_RTE_BUILD_SHARED_LIB=n
---Quoted 1 line
CONFIG_RTE_BUILD_SHARED_LIB=y219c219
<CONFIG_RTE_LIBRTE_MLX5_PMD=n
---Quoted 1 line
CONFIG_RTE_LIBRTE_MLX5_PMD=y225c225
<CONFIG_RTE_IBVERBS_LINK_STATIC=n
---Quoted 1 line
CONFIG_RTE_IBVERBS_LINK_STATIC=yError message I got is below. This is on Ubuntu 19.10 with gcc 9.2:
Quoted 11 lines
LD librte_pmd_mlx5.so.20.0.1
/usr/bin/ld: /lib/x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocationR_X86_64_PC32against symbol `stderr@@GL/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
make[5]: *** [/home/bruce/dpdk.org/mk/rte.lib.mk:100: librte_pmd_mlx5.so.20.0.1] Error 1 make[4]: *** [/home/bruce/dpdk.org/mk/rte.subdir.mk:35: mlx5] Error 2
make[3]: *** [/home/bruce/dpdk.org/mk/rte.subdir.mk:35: net] Error 2
make[2]: *** [/home/bruce/dpdk.org/mk/rte.sdkbuild.mk:48: drivers] Error 2
make[1]: *** [/home/bruce/dpdk.org/mk/rte.sdkroot.mk:99: all] Error 2
make: *** [Makefile:12: all] Error 2
After applying all 4 patches, and testing with meson, I see the same issue. It appears that the mlx4/5.a files in Ubuntu are not relocatable for including in a shared library.
/Bruce
[1/2] Linking target drivers/librte_pmd_mlx4.so.20.0.1.
FAILED: drivers/librte_pmd_mlx4.so.20.0.1
cc -o drivers/librte_pmd_mlx4.so.20.0.1 'drivers/a715181@@rte_pmd_mlx4@sha/meson-generated_.._rte_pmd_mlx4.pmd.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_ethdev.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_flow.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_intr.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_mp.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_mr.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_rxq.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_rxtx.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_txq.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_utils.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx4@sta/net_mlx4_mlx4_glue.c.o' -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librte_pmd_mlx4.so.20.0 -Wl,--no-as-needed -pthread -lm -ldl -lnuma lib/librte_ethdev.so.20.0.1 lib/librte_eal.so.20.0.1 lib/librte_kvargs.so.20.0.1 lib/librte_net.so.20.0.1 lib/librte_mbuf.so.20.0.1 lib/librte_mempool.so.20.0.1 lib/librte_ring.so.20.0.1 lib/librte_meter.so.20.0.1 drivers/librte_bus_pci.so.20.0.1 lib/librte_pci.so.20.0.1 drivers/librte_bus_vdev.so.20.0.1 -Wl,--version-script=/home/bruce/dpdk.org/drivers/net/mlx4/rte_pmd_mlx4_version.map -lpthread -l:libbnxt_re-rdmav22.a -l:libcxgb3-rdmav22.a -l:libcxgb4-rdmav22.a -l:libefa.a -l:libhns-rdmav22.a -l:libi40iw-rdmav22.a -l:libmlx4.a -l:libmlx5.a -l:libmthca-rdmav22.a -l:libnes-rdmav22.a -l:libocrdma-rdmav22.a -l:libqedr-rdmav22.a -l:libvmw_pvrdma-rdmav22.a -l:libhfi1verbs-rdmav22.a -l:libipathverbs-rdmav22.a -l:librxe-rdmav22.a -lnl-route-3 -lnl-3 -l:libibverbs.a /usr/lib/x86_64-linux-gnu/libbsd.so -Wl,--end-group '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/' -Wl,-rpath-link,/home/bruce/dpdk.org/build/lib -Wl,-rpath-link,/home/bruce/dpdk.org/build/drivers/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libmlx4.a(mlx4.c.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
[2/2] Linking target drivers/librte_pmd_mlx5.so.20.0.1.
FAILED: drivers/librte_pmd_mlx5.so.20.0.1
cc -o drivers/librte_pmd_mlx5.so.20.0.1 'drivers/a715181@@rte_pmd_mlx5@sha/meson-generated_.._rte_pmd_mlx5.pmd.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_ethdev.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_flow.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_flow_meter.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_flow_dv.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_flow_verbs.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_mac.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_mr.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_nl.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_rss.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_rxmode.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_rxq.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_rxtx.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_mp.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_stats.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_trigger.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_txq.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_vlan.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_devx_cmds.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_utils.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_socket.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_rxtx_vec.c.o' 'drivers/a715181@@tmp_rte_pmd_mlx5@sta/net_mlx5_mlx5_glue.c.o' -Wl,--as-needed -Wl,--no-undefined -Wl,-O1 -shared -fPIC -Wl,--start-group -Wl,-soname,librte_pmd_mlx5.so.20.0 -Wl,--no-as-needed -pthread -lm -ldl -lnuma lib/librte_ethdev.so.20.0.1 lib/librte_eal.so.20.0.1 lib/librte_kvargs.so.20.0.1 lib/librte_net.so.20.0.1 lib/librte_mbuf.so.20.0.1 lib/librte_mempool.so.20.0.1 lib/librte_ring.so.20.0.1 lib/librte_meter.so.20.0.1 drivers/librte_bus_pci.so.20.0.1 lib/librte_pci.so.20.0.1 drivers/librte_bus_vdev.so.20.0.1 lib/librte_hash.so.20.0.1 -Wl,--version-script=/home/bruce/dpdk.org/drivers/net/mlx5/rte_pmd_mlx5_version.map -lpthread -l:libbnxt_re-rdmav22.a -l:libcxgb3-rdmav22.a -l:libcxgb4-rdmav22.a -l:libefa.a -l:libhns-rdmav22.a -l:libi40iw-rdmav22.a -l:libmlx4.a -l:libmlx5.a -l:libmthca-rdmav22.a -l:libnes-rdmav22.a -l:libocrdma-rdmav22.a -l:libqedr-rdmav22.a -l:libvmw_pvrdma-rdmav22.a -l:libhfi1verbs-rdmav22.a -l:libipathverbs-rdmav22.a -l:librxe-rdmav22.a -lnl-route-3 -lnl-3 -l:libibverbs.a /usr/lib/x86_64-linux-gnu/libbsd.so -Wl,--end-group '-Wl,-rpath,$ORIGIN/../lib:$ORIGIN/' -Wl,-rpath-link,/home/bruce/dpdk.org/build/lib -Wl,-rpath-link,/home/bruce/dpdk.org/build/drivers /usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/libmlx5.a(mlx5.c.o): relocation R_X86_64_PC32 against symbol `stderr@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status
ninja: build stopped: subcommand failed.
PATCH v2 3/4 build: allow hiding dependencies from pkg-config
In reply to Thomas MonjalonIf a dependency is required for a driver build,
but should not be exposed to the application (via pkg-config), it can be declared in the array hidden_deps.
The hidden_deps are used as internal dependencies,
when building the shared library and the first stage of static library. The final static library does not include the hidden_deps because this library object is used to generate the .pc file.
--- doc/guides/contributing/coding_style.rst | 6 ++++++ drivers/meson.build | 9 ++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
doc/guides/contributing/coding_style.rst +6 -0
@@ -975,6 +975,12 @@ deps ext_deps As above. +hidden_deps + **Default Value = []**. + Used to specify external dependencies, same as ``ext_deps``, except + the libraries won't be exposed as requirements of the static driver, + in the section ``Requires.private`` of the generated ``.pc`` file. + includes **Default Value = <driver directory>** Some drivers include a base directory for additional source files and headers, so we have this
drivers/meson.build +6 -3
@@ -56,6 +56,7 @@ foreach class:dpdk_driver_classes # too, so that it can be reflected in the pkgconfig output for # static builds. ext_deps = [] + hidden_deps = [] pkgconfig_extra_libs = [] # pull in driver directory which should assign to each of the above
@@ -71,8 +72,9 @@ foreach class:dpdk_driver_classes endforeach if build # get dependency objs from strings - shared_deps = ext_deps - static_deps = ext_deps + shared_deps = ext_deps + hidden_deps + static_deps = ext_deps + hidden_deps + static_pub_deps = ext_deps foreach d:deps if not is_variable('shared_rte_' + d) build = false
@@ -82,6 +84,7 @@ foreach class:dpdk_driver_classes else shared_deps += [get_variable('shared_rte_' + d)] static_deps += [get_variable('static_rte_' + d)] + static_pub_deps += [get_variable('static_rte_' + d)] endif endforeach endif
@@ -144,7 +147,7 @@ foreach class:dpdk_driver_classes sources, objects: objs, include_directories: includes, - dependencies: static_deps, + dependencies: static_pub_deps, # skip hidden_deps c_args: cflags, install: true)
Signature · 1 line
2.24.1
PATCH v2 4/4 net/mlx: workaround static linkage with meson
In reply to Thomas MonjalonIf ibverbs_link is static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.
Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.
A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
In order to not allow meson suggesting shared libraries in the section Requires.private of the .pc file, the cflags are passed as hidden_deps. The list of required dependencies is replaced with ldflags, forcing static flavor of ibverbs libraries thanks to this syntax:
-l:libfoo.a
--- buildtools/meson.build | 2 ++ drivers/net/mlx4/meson.build | 14 ++++++++++++-- drivers/net/mlx5/meson.build | 14 ++++++++++++-- 3 files changed, 26 insertions(+), 4 deletions(-)
buildtools/meson.build +2 -0
@@ -7,6 +7,8 @@ pmdinfo = find_program('gen-pmdinfo-cfile.sh') check_experimental_syms = find_program('check-experimental-syms.sh') +ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') + # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false) if python3.found()
drivers/net/mlx4/meson.build +12 -2
@@ -30,16 +30,26 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if static_ibverbs + # Build without adding shared libs to Requires.private + hidden_deps += lib.partial_dependency(compile_args:true) + else + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif endforeach +if build and static_ibverbs + # Add static deps ldflags to internal apps and Libs.private + ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ldflags.split()) +endif if build allow_experimental_apis = true - ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c',
drivers/net/mlx5/meson.build +12 -2
@@ -30,17 +30,27 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if static_ibverbs + # Build without adding shared libs to Requires.private + hidden_deps += lib.partial_dependency(compile_args:true) + else + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif endforeach +if build and static_ibverbs + # Add static deps ldflags to internal apps and Libs.private + ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ldflags.split()) +endif if build allow_experimental_apis = true deps += ['hash'] - ext_deps += libs sources = files( 'mlx5.c', 'mlx5_ethdev.c',
Signature · 1 line
2.24.1
Quoted 14 lines · Thomas Monjalon
This is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".changes in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc forhidden_deps
- improve explanations in commit logs
Quoted 7 lines
Thomas Monjalon (4):
net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson
build: allow hiding dependencies from pkg-config net/mlx: workaround static linkage with meson
Hi Thomas,
as we discussed offline, I really don't like the necessity of the hidden_deps part of this, so I've tried coming up with some other solutions. For example, in my testing I get the same result with the following diff instead of the second two patches (just showing for mlx5 - changes for mlx4 are identical):
drivers/net/mlx5/meson.build +5 -6
@@ -31,10 +31,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if static_ibverbs - # Build without adding shared libs to Requires.private - hidden_deps += lib.partial_dependency(compile_args:true) - else + if not static_ibverbs ext_deps += lib endif else
@@ -44,8 +41,10 @@ foreach libname:libnames endforeach if build and static_ibverbs # Add static deps ldflags to internal apps and Libs.private - ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() - ext_deps += declare_dependency(link_args:ldflags.split()) + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ibv_cflags = run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split(), + link_args:ibv_ldflags.split()) endif if build
By doing things this way - assuming it works in your tests too - we avoid any need to change anything in the common drivers code.
How I tested this was by:
* doing a local rdma-core build as described in the docs and exporting PKG_CONFIG_PATH to point to the .pc file
* doing builds with all 4 of your patches applied (one static linking of apps, one shared, just in case)
* doing builds with the first two patches and the above diff.
* compare the meson.build files and libdpdk.pc files for the two cases. In my tests the second case as additional -I flags, but otherwise identical.
Regards,
/Bruce
04/02/2020 12:48, Bruce Richardson:
Quoted 3 lines
as we discussed offline, I really don't like the necessity of the
hidden_depspart of this, so I've tried coming up with some other solutions.
Thanks for looking closely at these patches.
Quoted 3 lines
For example, in my testing I get the same result with the following diff instead of the second two patches (just showing for mlx5 - changes for mlx4 are identical):
[...]
Quoted 2 lines
drivers/net/mlx5/meson.build +0
-2- # Build without adding shared libs to Requires.private - hidden_deps += lib.partial_dependency(compile_args:true)
[...]
Quoted 1 line
+
ibv_cflags=run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout()
[...]
Quoted 2 lines
By doing things this way - assuming it works in your tests too - we avoid any need to change anything in the common drivers code.
Yes, you hide the dependency by getting cflags directly with pkg-config. I wanted to avoid such solution because I was trying to use as much as possible the meson infrastructure.
I think your solution relying on one more call to pkg-config is acceptable. I will test it and will review whether we get all corner cases.
In the meantime I discovered we are overlinking with meson when using the dlopen linking option.
I will try to fix it as well with the same method.
Thanks
Quoted 19 lines · Thomas Monjalon
04/02/2020 12:48, Bruce Richardson:
Quoted 3 lines
as we discussed offline, I really don't like the necessity of the
hidden_depspart of this, so I've tried coming up with some other solutions.Thanks for looking closely at these patches.
Quoted 3 lines
For example, in my testing I get the same result with the following diff instead of the second two patches (just showing for mlx5 - changes for mlx4 are identical):
[...]
Quoted 2 lines
drivers/net/mlx5/meson.build +0
-2- # Build without adding shared libs to Requires.private - hidden_deps += lib.partial_dependency(compile_args:true)[...]
Quoted 1 line
+
ibv_cflags=run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout()[...]
Quoted 2 lines
By doing things this way - assuming it works in your tests too - we avoid any need to change anything in the common drivers code.
Quoted 7 lines
Yes, you hide the dependency by getting cflags directly with pkg-config. I wanted to avoid such solution because I was trying to use as much as possible the meson infrastructure.
I think your solution relying on one more call to pkg-config is acceptable. I will test it and will review whether we get all corner cases.
Thanks.
It's not really ideal, but this is likely always going to be a bit flakey since we can't use distro-supplied .a files, and your scripting is needed to prevent even accidentally taking a non-custom-build rdma-core file. Furthermore, I see that while meson tracks PKG_CONFIG_PATH value itself for finding things, this does not get tracked between runs for shell calls. This can catch one out, for example:
PKG_CONFIG_PATH=/path/to/pc/files meson build
will work correctly for everything. However, if one does a reconfigure subsequently doing e.g. ninja reconfigure, meson will correctly pick up the .pc files, but the ibverbs-static script, or any run_command calls to pkg-config won't as it's not actually in the environment :-(
Quoted 4 lines
In the meantime I discovered we are overlinking with meson when using the dlopen linking option.
I will try to fix it as well with the same method.
Right. Overlinking is probably less serious an issue though. Does it cause any real-world problems?
/Bruce
04/02/2020 15:33, Bruce Richardson:
Quoted 36 lines · Thomas Monjalon
Quoted 19 lines
04/02/2020 12:48, Bruce Richardson:
Quoted 3 lines
as we discussed offline, I really don't like the necessity of the
hidden_depspart of this, so I've tried coming up with some other solutions.Thanks for looking closely at these patches.
Quoted 3 lines
For example, in my testing I get the same result with the following diff instead of the second two patches (just showing for mlx5 - changes for mlx4 are identical):
[...]
Quoted 2 lines
drivers/net/mlx5/meson.build +0
-2- # Build without adding shared libs to Requires.private - hidden_deps += lib.partial_dependency(compile_args:true)[...]
Quoted 1 line
+
ibv_cflags=run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout()[...]
Quoted 2 lines
By doing things this way - assuming it works in your tests too - we avoid any need to change anything in the common drivers code.
Quoted 7 lines
Yes, you hide the dependency by getting cflags directly with pkg-config. I wanted to avoid such solution because I was trying to use as much as possible the meson infrastructure.
I think your solution relying on one more call to pkg-config is acceptable. I will test it and will review whether we get all corner cases.
Thanks.
It's not really ideal, but this is likely always going to be a bit flakey since we can't use distro-supplied .a files, and your scripting is needed to prevent even accidentally taking a non-custom-build rdma-core file. Furthermore, I see that while meson tracksPKG_CONFIG_PATHvalue itself for finding things, this does not get tracked between runs for shell calls. This can catch one out, for example:
Quoted 6 lines
PKG_CONFIG_PATH=/path/to/pc/files meson build
will work correctly for everything. However, if one does a reconfigure subsequently doing e.g. ninja reconfigure, meson will correctly pick up the .pc files, but the ibverbs-static script, or any
run_commandcalls to pkg-config won't as it's not actually in the environment :-(
In my setup, I export PKG_CONFIG_PATH, so it is not an issue. But I understand your point that we may hit the issue. That's why I will work in meson upstream to avoid all of this in future.
Quoted 6 lines
Quoted 4 lines
In the meantime I discovered we are overlinking with meson when using the dlopen linking option.
I will try to fix it as well with the same method.Right. Overlinking is probably less serious an issue though. Does it cause any real-world problems?
Overlinking defeats the benefit of dlopen.
The idea of dlopen is to avoid having ibverbs as mandatory DPDK dependency. The ibverbs lib is loaded with dlopen only if probing a Mellanox device. The dlopen solution makes the PMD really like an optional plugin, same as for static linkage in the PMD.
Quoted 39 lines · Thomas Monjalon
04/02/2020 15:33, Bruce Richardson:
Quoted 38 lines · Thomas Monjalon
Quoted 19 lines
04/02/2020 12:48, Bruce Richardson:
Quoted 3 lines
as we discussed offline, I really don't like the necessity of the
hidden_depspart of this, so I've tried coming up with some other solutions.Thanks for looking closely at these patches.
Quoted 3 lines
For example, in my testing I get the same result with the following diff instead of the second two patches (just showing for mlx5 - changes for mlx4 are identical):
[...]
Quoted 2 lines
drivers/net/mlx5/meson.build +0
-2- # Build without adding shared libs to Requires.private - hidden_deps += lib.partial_dependency(compile_args:true)[...]
Quoted 1 line
+
ibv_cflags=run_command(find_program('pkg-config'), '--cflags', 'libibverbs').stdout()[...]
Quoted 2 lines
By doing things this way - assuming it works in your tests too - we avoid any need to change anything in the common drivers code.
Quoted 7 lines
Yes, you hide the dependency by getting cflags directly with pkg-config. I wanted to avoid such solution because I was trying to use as much as possible the meson infrastructure.
I think your solution relying on one more call to pkg-config is acceptable. I will test it and will review whether we get all corner cases.
Thanks.
It's not really ideal, but this is likely always going to be a bit flakey since we can't use distro-supplied .a files, and your scripting is needed to prevent even accidentally taking a non-custom-build rdma-core file. Furthermore, I see that while meson tracksPKG_CONFIG_PATHvalue itself for finding things, this does not get tracked between runs for shell calls. This can catch one out, for example:PKG_CONFIG_PATH=/path/to/pc/files meson build
Quoted 9 lines
Quoted 4 lines
will work correctly for everything. However, if one does a reconfigure subsequently doing e.g. ninja reconfigure, meson will correctly pick up the .pc files, but the ibverbs-static script, or any
run_commandcalls to pkg-config won't as it's not actually in the environment :-(In my setup, I export
PKG_CONFIG_PATH, so it is not an issue. But I understand your point that we may hit the issue. That's why I will work in meson upstream to avoid all of this in future.
+1
Quoted 5 lines
Quoted 5 lines
Quoted 5 lines
In the meantime I discovered we are overlinking with meson when using the dlopen linking option.
I will try to fix it as well with the same method.
Quoted 9 lines
Quoted 2 lines
Right. Overlinking is probably less serious an issue though. Does it cause any real-world problems?
Overlinking defeats the benefit of dlopen.
The idea of dlopen is to avoid having ibverbs as mandatory DPDK dependency. The ibverbs lib is loaded with dlopen only if probing a Mellanox device. The dlopen solution makes the PMD really like an optional plugin, same as for static linkage in the PMD.
Right, I understand the issue now.
v3 cover mlx ibverbs linking in meson
In reply to Thomas MonjalonThis is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".
With the meson option ibverbs_link, only the mode "shared" was working correctly.
This patchset adds the mode "static" and fixes the mode "dlopen".
changes in v3:
- get cflags with pkg-config invocation
- drop addition of global variable hidden_deps
- remove overlinking in dlopen mode
changes in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc for hidden_deps
- improve explanations in commit logs
Thomas Monjalon (5):
net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson net/mlx: workaround static linkage with meson net/mlx: rename meson variable for dlopen option net/mlx: fix overlinking with meson and glue dlopen
buildtools/meson.build | 2 ++ buildtools/options-ibverbs-static.sh | 10 ++++++++-- doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/common/mlx5/meson.build | 27 +++++++++++++++++++------- drivers/net/mlx4/meson.build | 29 ++++++++++++++++++++-------- meson_options.txt | 4 ++-- 7 files changed, 61 insertions(+), 19 deletions(-)
Signature · 1 line
2.25.0
PATCH v3 1/5 net/mlx: add static ibverbs linkage with meson
The libibverbs (and libmlx4/5) can be statically embedded in the shared PMD library, or in the application with the static PMD. It was supported with make build system in
commit 2c0dd7b69fb0 ("config: add static linkage of mlx dependency").
The same feature is enabled with meson when using pkg-config (i.e. only if the call to dependency() is successful). The fallback method for searching library with cc.find_library() is not supported because the dependencies of the found library would not be linked (no such info in .a file unlike .so).
The main difference, in meson build system, is the generated .pc file giving arguments to link DPDK with the application. Unfortunately the .pc file will not keep memory of the static linkage option for libibverbs.
--- doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/common/mlx5/meson.build | 5 +++-- drivers/net/mlx4/meson.build | 5 +++-- meson_options.txt | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-)
doc/guides/nics/mlx4.rst +4 -0
@@ -92,6 +92,10 @@ These options can be modified in the ``.config`` file. adds additional run-time checks and debugging messages at the cost of lower performance. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
doc/guides/nics/mlx5.rst +4 -0
@@ -278,6 +278,10 @@ These options can be modified in the ``.config`` file. 64. Default armv8a configuration of make build and meson build set it to 128 then brings performance degradation. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
drivers/common/mlx5/meson.build +3 -2
@@ -8,6 +8,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0'
@@ -23,8 +24,8 @@ endif libnames = [ 'mlx5', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
drivers/net/mlx4/meson.build +3 -2
@@ -9,6 +9,7 @@ if not is_linux endif build = true +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0'
@@ -24,8 +25,8 @@ endif libnames = [ 'mlx4', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
meson_options.txt +2 -2
@@ -14,8 +14,8 @@ option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('flexran_sdk', type: 'string', value: '', description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') -option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', - description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') +option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', + description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('include_subdir_arch', type: 'string', value: '', description: 'subdirectory where to install arch-dependent headers') option('kernel_dir', type: 'string', value: '',
Signature · 1 line
2.25.0
PATCH v3 2/5 buildtools: get static mlx dependencies for meson
In reply to Thomas MonjalonThe shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs libraries.
When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson.
If linking with libraries installed in a non-standard path, an option -L is provided via EXTRA_LDFLAGS in case of using make. With meson, tuning PKG_CONFIG_PATH for pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make.
The other change in this script is to move the main library file (libiverbs.a) at the end of the list of dependencies.
It fixes some undefined references when linking a static application using libdpdk.pc.
--- buildtools/options-ibverbs-static.sh | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
buildtools/options-ibverbs-static.sh +8 -2
@@ -9,6 +9,12 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs | +lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + sed "/$lib/d" # move main lib at the end +echo -l:$lib.a
Signature · 1 line
2.25.0
PATCH v3 3/5 net/mlx: workaround static linkage with meson
In reply to Thomas MonjalonIf ibverbs_link is static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.
Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.
A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
In order to avoid meson suggesting shared libraries in the section Requires.private of the .pc file, the dependency object is recreated with declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.a
--- buildtools/meson.build | 2 ++ drivers/common/mlx5/meson.build | 12 +++++++++++- drivers/net/mlx4/meson.build | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-)
buildtools/meson.build +2 -0
@@ -3,9 +3,11 @@ subdir('pmdinfogen') +pkgconf = find_program('pkg-config', 'pkgconf') pmdinfo = find_program('gen-pmdinfo-cfile.sh') list_dir_globs = find_program('list-dir-globs.py') check_experimental_syms = find_program('check-experimental-syms.sh') +ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false)
drivers/common/mlx5/meson.build +11 -1
@@ -30,16 +30,26 @@ foreach libname:libnames endif if lib.found() libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif endforeach +if build and static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif if build allow_experimental_apis = true deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] - ext_deps += libs sources = files( 'mlx5_devx_cmds.c', 'mlx5_common.c',
drivers/net/mlx4/meson.build +12 -2
@@ -30,16 +30,26 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif endforeach +if build and static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif if build allow_experimental_apis = true - ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c',
Signature · 1 line
2.25.0
Re: [dpdk-dev] [PATCH v3 3/5] net/mlx: workaround static linkage with meson
Quoted 63 lines · Thomas Monjalon
If
ibverbs_linkis static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393In order to avoid meson suggesting shared libraries in the section Requires.private of the .pc file, the dependency object is recreated with
declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.aFixes 83fff714bd27 ("net/mlx: add static ibverbs linkage with meson")Signed-off-by Thomas Monjalon <[email protected]>Signed-off-by Bruce Richardson <[email protected]>--- buildtools/meson.build | 2 ++ drivers/common/mlx5/meson.build | 12 +++++++++++- drivers/net/mlx4/meson.build | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-)buildtools/meson.build +2
-0@@ -3,9 +3,11 @@ subdir('pmdinfogen') +pkgconf = find_program('pkg-config', 'pkgconf') pmdinfo = find_program('gen-pmdinfo-cfile.sh') list_dir_globs = find_program('list-dir-globs.py') check_experimental_syms = find_program('check-experimental-syms.sh') +ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false)drivers/common/mlx5/meson.build +3
-0@@ -30,16 +30,26 @@ foreach libname:libnames endif if lib.found() libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' endif
drivers/common/mlx5/meson.build foreach libname:libnames · line 49
Quoted 10 lines
drivers/common/mlx5/meson.build +8
-0endforeach +if build and static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif
Is there a reason for specfiying two dependencies, rather than putting both cflags and ldflags into the one dependency object?
Re: [dpdk-dev] [PATCH v3 3/5] net/mlx: workaround static linkage with meson
11/02/2020 12:29, Bruce Richardson:
Quoted 25 lines · Thomas Monjalon
Quoted 24 lines
If
ibverbs_linkis static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393In order to avoid meson suggesting shared libraries in the section Requires.private of the .pc file, the dependency object is recreated with
declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.aFixes 83fff714bd27 ("net/mlx: add static ibverbs linkage with meson")
Quoted 14 lines
drivers/common/mlx5/meson.build foreach libname:libnames · line 48
Quoted 11 lines
Signed-off-by Thomas Monjalon <[email protected]>Signed-off-by Bruce Richardson <[email protected]>---
drivers/common/mlx5/meson.build +8
-0+if build and static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endifIs there a reason for specfiying two dependencies, rather than putting both cflags and ldflags into the one dependency object?
Yes, the reason is the patch for dlopen which needs cflags only.
Re: [dpdk-dev] [PATCH v3 3/5] net/mlx: workaround static linkage with meson
Quoted 41 lines · Thomas Monjalon
11/02/2020 12:29, Bruce Richardson:
Quoted 25 lines · Thomas Monjalon
Quoted 24 lines
If
ibverbs_linkis static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393In order to avoid meson suggesting shared libraries in the section Requires.private of the .pc file, the dependency object is recreated with
declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.aFixes 83fff714bd27 ("net/mlx: add static ibverbs linkage with meson")Quoted 14 lines
drivers/common/mlx5/meson.build foreach libname:libnames · line 48
Quoted 11 lines
Signed-off-by Thomas Monjalon <[email protected]>Signed-off-by Bruce Richardson <[email protected]>---
drivers/common/mlx5/meson.build +8
-0+if build and static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endifIs there a reason for specfiying two dependencies, rather than putting both cflags and ldflags into the one dependency object?
Quoted 2 lines
Yes, the reason is the patch for dlopen which needs cflags only.
Ah, ok, thanks for clarifying.
PATCH v3 4/5 net/mlx: rename meson variable for dlopen option
In reply to Thomas MonjalonThe name of the variable pmd_dlopen is confusing because it can be understood as true if the PMD is dlopen, whereas it means the ibverbs glue layer is a dlopen library. That's why it is renamed dlopen_ibverbs.
--- drivers/common/mlx5/meson.build | 8 ++++---- drivers/net/mlx4/meson.build | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/common/mlx5/meson.build +4 -4
@@ -9,11 +9,11 @@ endif build = true static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
@@ -55,7 +55,7 @@ if build 'mlx5_common.c', 'mlx5_nl.c', ) - if not pmd_dlopen + if not dlopen_ibverbs sources += files('mlx5_glue.c') endif cflags_options = [
@@ -194,7 +194,7 @@ if build configure_file(output : 'mlx5_autoconf.h', configuration : config) endif # Build Glue Library -if pmd_dlopen and build +if dlopen_ibverbs and build dlopen_name = 'mlx5_glue' dlopen_lib_name = 'rte_pmd_@0@'.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
drivers/net/mlx4/meson.build +4 -4
@@ -10,11 +10,11 @@ endif build = true static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
@@ -62,7 +62,7 @@ if build 'mlx4_txq.c', 'mlx4_utils.c', ) - if not pmd_dlopen + if not dlopen_ibverbs sources += files('mlx4_glue.c') endif cflags_options = [
@@ -114,7 +114,7 @@ if build configure_file(output : 'mlx4_autoconf.h', configuration : config) endif # Build Glue Library -if pmd_dlopen and build +if dlopen_ibverbs and build dlopen_name = 'mlx4_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
Signature · 1 line
2.25.0
PATCH v3 5/5 net/mlx: fix overlinking with meson and glue dlopen
In reply to Thomas MonjalonIf ibverbs_link is dlopen, the PMD and application should not be linked with ibverbs, but the glue library is. Unfortunately the ibverbs dependency was exported in the variable ext_deps, so there were overlinking.
It is fixed by not exporting the dependency in ext_deps, and recreating a limited dependency object for cflags only.
--- drivers/common/mlx5/meson.build | 6 ++++-- drivers/net/mlx4/meson.build | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/common/mlx5/meson.build +4 -2
@@ -30,7 +30,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else
@@ -38,10 +38,12 @@ foreach libname:libnames reason = 'missing dependency, "' + libname + '"' endif endforeach -if build and static_ibverbs +if build and (static_ibverbs or dlopen_ibverbs) # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if build and static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
drivers/net/mlx4/meson.build +4 -2
@@ -31,7 +31,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else
@@ -39,10 +39,12 @@ foreach libname:libnames reason = 'missing dependency, "' + libname + '"' endif endforeach -if build and static_ibverbs +if build and (static_ibverbs or dlopen_ibverbs) # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if build and static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
Signature · 1 line
2.25.0
Re: [dpdk-dev] [PATCH v3 5/5] net/mlx: fix overlinking with meson and glue dlopen
Quoted 35 lines · Thomas Monjalon
If
ibverbs_linkis dlopen, the PMD and application should not be linked with ibverbs, but the glue library is. Unfortunately the ibverbs dependency was exported in the variableext_deps, so there were overlinking.It is fixed by not exporting the dependency in
ext_deps, and recreating a limited dependency object for cflags only.Fixes 1dd7c7e38c19 ("net/mlx4: support meson build")Fixes 96d7c62a70c7 ("net/mlx5: support meson build")Signed-off-by Thomas Monjalon <[email protected]>--- drivers/common/mlx5/meson.build | 6 ++++-- drivers/net/mlx4/meson.build | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)drivers/common/mlx5/meson.build +1
-1@@ -30,7 +30,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else@@ -38,10 +38,12 @@ foreach libname:libnames reason = 'missing dependency, "' + libname + '"' endif endforeach
drivers/common/mlx5/meson.build foreach libname:libnames · line 49
Quoted 10 lines
drivers/common/mlx5/meson.build +3
-1-if build and static_ibverbs +if build and (static_ibverbs or dlopen_ibverbs) # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if build and static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
One small suggestion:
Since out minimum version of meson is 0.47.1, we can use subdir_done() function. Putting subdir_done() immediately after build=false will simplify things as you won't need to continually check the build variable in each if statement.
/Bruce
Re: [dpdk-dev] [PATCH v3 5/5] net/mlx: fix overlinking with meson and glue dlopen
11/02/2020 12:32, Bruce Richardson:
Quoted 44 lines · Thomas Monjalon
Quoted 43 lines
If
ibverbs_linkis dlopen, the PMD and application should not be linked with ibverbs, but the glue library is. Unfortunately the ibverbs dependency was exported in the variableext_deps, so there were overlinking.It is fixed by not exporting the dependency in
ext_deps, and recreating a limited dependency object for cflags only.Fixes 1dd7c7e38c19 ("net/mlx4: support meson build")Fixes 96d7c62a70c7 ("net/mlx5: support meson build")Signed-off-by Thomas Monjalon <[email protected]>--- drivers/common/mlx5/meson.build | 6 ++++-- drivers/net/mlx4/meson.build | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)drivers/common/mlx5/meson.build +4
-2@@ -30,7 +30,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else@@ -38,10 +38,12 @@ foreach libname:libnames reason = 'missing dependency, "' + libname + '"' endif endforeach -if build and static_ibverbs +if build and (static_ibverbs or dlopen_ibverbs) # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if build and static_ibverbs # Add static deps ldflags to internal apps and Libs.private
Quoted 8 lines
drivers/common/mlx5/meson.build foreach libname:libnames · line 49
Quoted 2 lines
drivers/common/mlx5/meson.build +0
-0ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())One small suggestion:
Since out minimum version of meson is 0.47.1, we can usesubdir_done()function. Puttingsubdir_done()immediately after build=false will simplify things as you won't need to continually check the build variable in each if statement.
Great, thank you!
Re: [dpdk-dev] [PATCH v3 0/5] mlx ibverbs linking in meson
In reply to Thomas MonjalonQuoted 23 lines · Thomas Monjalon
This is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".With the meson option
ibverbs_link, only the mode "shared" was working correctly.
This patchset adds the mode "static" and fixes the mode "dlopen".changes in v3:
- get cflags with pkg-config invocation
- drop addition of global variablehidden_deps
- remove overlinking in dlopen modechanges in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc forhidden_deps
- improve explanations in commit logs
Quoted 7 lines
Thomas Monjalon (5):
net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson net/mlx: workaround static linkage with meson net/mlx: rename meson variable for dlopen option net/mlx: fix overlinking with meson and glue dlopen
Send a couple of improvement suggestions for two of the patches, but otherwise looks ok to me.
v4 cover mlx ibverbs linking in meson
In reply to Thomas MonjalonThis is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".
With the meson option ibverbs_link, only the mode "shared" was working correctly.
This patchset adds the mode "static" and fixes the mode "dlopen".
changes in v4:
- fix lib ordering
- simplify conditions by using subdir_done()
changes in v3:
- get cflags with pkg-config invocation
- drop addition of global variable hidden_deps
- remove overlinking in dlopen mode
changes in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc for hidden_deps
- improve explanations in commit logs
Thomas Monjalon (6):
drivers: cleanup meson build variable net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson net/mlx: workaround static linkage with meson net/mlx: rename meson variable for dlopen option net/mlx: fix overlinking with meson and glue dlopen
buildtools/meson.build | 2 + buildtools/options-ibverbs-static.sh | 11 +- doc/guides/nics/mlx4.rst | 4 + doc/guides/nics/mlx5.rst | 4 + drivers/common/mlx5/meson.build | 314 ++++++++++++++------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 154 +++++++------ drivers/raw/ifpga/meson.build | 23 +- meson_options.txt | 4 +- 9 files changed, 286 insertions(+), 247 deletions(-)
Signature · 1 line
2.25.0
PATCH v4 1/6 drivers: cleanup meson build variable
The variable build is already initialized as true in drivers/meson.build. Duplicate initializations can be removed from mlx.
When the variable build is set to false, it is easier to call subdir_done() than branch the rest of the code on build condition.
--- drivers/common/mlx5/meson.build | 293 ++++++++++++++++---------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 131 +++++++------- drivers/raw/ifpga/meson.build | 23 ++- 4 files changed, 230 insertions(+), 234 deletions(-)
drivers/common/mlx5/meson.build +146 -147
@@ -6,7 +6,6 @@ if not is_linux reason = 'only supported on Linux' subdir_done() endif -build = true pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
@@ -32,158 +31,158 @@ foreach libname:libnames else build = false reason = 'missing dependency, "' + libname + '"' + subdir_done() endif endforeach -if build - allow_experimental_apis = true - deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] - ext_deps += libs - sources = files( - 'mlx5_devx_cmds.c', - 'mlx5_common.c', - 'mlx5_nl.c', - ) - if not pmd_dlopen - sources += files('mlx5_glue.c') - endif - cflags_options = [ - '-std=c11', - '-Wno-strict-prototypes', - '-D_BSD_SOURCE', - '-D_DEFAULT_SOURCE', - '-D_XOPEN_SOURCE=600' - ] - foreach option:cflags_options - if cc.has_argument(option) - cflags += option - endif - endforeach - if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-DPEDANTIC' ] - else - cflags += [ '-UPEDANTIC' ] +allow_experimental_apis = true +deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] +ext_deps += libs +sources = files( + 'mlx5_devx_cmds.c', + 'mlx5_common.c', + 'mlx5_nl.c', +) +if not pmd_dlopen + sources += files('mlx5_glue.c') +endif +cflags_options = [ + '-std=c11', + '-Wno-strict-prototypes', + '-D_BSD_SOURCE', + '-D_DEFAULT_SOURCE', + '-D_XOPEN_SOURCE=600' +] +foreach option:cflags_options + if cc.has_argument(option) + cflags += option endif - # To maintain the compatibility with the make build system - # mlx5_autoconf.h file is still generated. - # input array for meson member search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search", "struct member to search" ] - has_member_args = [ - [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', - 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', - 'struct ibv_counter_set_init_attr', 'counter_set_id' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', - 'struct ibv_counters_init_attr', 'comp_mask' ], - ] - # input array for meson symbol search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search" ] - has_sym_args = [ - [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], - [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], - [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', - 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], - [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', - 'mlx5dv_create_flow_action_packet_reformat' ], - [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', - 'IBV_FLOW_SPEC_MPLS' ], - [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], - [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAG_RX_END_PADDING' ], - [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', - 'mlx5dv_query_devx_port' ], - [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_create' ], - [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', - 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], - [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_query_async' ], - [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_dest_devx_tir' ], - [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_get_event' ], - [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_flow_meter' ], - [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h', - 'MLX5_MMAP_GET_NC_PAGES_CMD' ], - [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], - [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], - [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_push_vlan' ], - [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], - [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseLR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseLR4_Full' ], - [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], - [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', - 'IFLA_NUM_VF' ], - [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', - 'IFLA_EXT_MASK' ], - [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', - 'IFLA_PHYS_SWITCH_ID' ], - [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', - 'IFLA_PHYS_PORT_NAME' ], - [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', - 'RDMA_NL_NLDEV' ], - [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_GET' ], - [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_PORT_GET' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_NAME' ], - [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_PORT_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], - [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', - 'mlx5dv_dump_dr_domain'], - [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], - ] - config = configuration_data() - foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) - endforeach - foreach arg:has_member_args - file_prefix = '#include <' + arg[1] + '>' - config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix : file_prefix, dependencies: libs)) - endforeach - configure_file(output : 'mlx5_autoconf.h', configuration : config) +endforeach +if get_option('buildtype').contains('debug') + cflags += [ '-pedantic', '-DPEDANTIC' ] +else + cflags += [ '-UPEDANTIC' ] endif +# To maintain the compatibility with the make build system +# mlx5_autoconf.h file is still generated. +# input array for meson member search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search", "struct member to search" ] +has_member_args = [ + [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', + 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', + 'struct ibv_counter_set_init_attr', 'counter_set_id' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', + 'struct ibv_counters_init_attr', 'comp_mask' ], +] +# input array for meson symbol search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search" ] +has_sym_args = [ + [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h', + 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], + [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], + [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', + 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], + [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', + 'mlx5dv_create_flow_action_packet_reformat' ], + [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', + 'IBV_FLOW_SPEC_MPLS' ], + [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h', + 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], + [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', + 'IBV_WQ_FLAG_RX_END_PADDING' ], + [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', + 'mlx5dv_query_devx_port' ], + [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_create' ], + [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', + 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], + [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_query_async' ], + [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_dest_devx_tir' ], + [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_get_event' ], + [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_flow_meter' ], + [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h', + 'MLX5_MMAP_GET_NC_PAGES_CMD' ], + [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], + [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], + [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_push_vlan' ], + [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], + [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseLR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseLR4_Full' ], + [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], + [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', + 'IFLA_NUM_VF' ], + [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', + 'IFLA_EXT_MASK' ], + [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', + 'IFLA_PHYS_SWITCH_ID' ], + [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', + 'IFLA_PHYS_PORT_NAME' ], + [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', + 'RDMA_NL_NLDEV' ], + [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_GET' ], + [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_PORT_GET' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_NAME' ], + [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_PORT_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_domain'], + [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], +] +config = configuration_data() +foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) +endforeach +foreach arg:has_member_args + file_prefix = '#include <' + arg[1] + '>' + config.set(arg[0], cc.has_member(arg[2], arg[3], + prefix : file_prefix, dependencies: libs)) +endforeach +configure_file(output : 'mlx5_autoconf.h', configuration : config) + # Build Glue Library -if pmd_dlopen and build +if pmd_dlopen dlopen_name = 'mlx5_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
drivers/net/ipn3ke/meson.build +8 -9
@@ -16,16 +16,15 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - allow_experimental_apis = true +allow_experimental_apis = true - includes += include_directories('../../raw/ifpga') +includes += include_directories('../../raw/ifpga') - sources += files('ipn3ke_ethdev.c', - 'ipn3ke_representor.c', - 'ipn3ke_tm.c', - 'ipn3ke_flow.c') - deps += ['bus_ifpga', 'ethdev', 'sched'] -endif +sources += files('ipn3ke_ethdev.c', + 'ipn3ke_representor.c', + 'ipn3ke_tm.c', + 'ipn3ke_flow.c') +deps += ['bus_ifpga', 'ethdev', 'sched']
drivers/net/mlx4/meson.build +65 -66
149 lines not on this page · raw message
drivers/raw/ifpga/meson.build +11 -12
@@ -8,21 +8,20 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - subdir('base') - objs = [base_objs] +subdir('base') +objs = [base_objs] - deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', - 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] - ext_deps += dep +deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', + 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] +ext_deps += dep - sources = files('ifpga_rawdev.c') +sources = files('ifpga_rawdev.c') - includes += include_directories('base') - includes += include_directories('../../net/ipn3ke') - includes += include_directories('../../net/i40e') +includes += include_directories('base') +includes += include_directories('../../net/ipn3ke') +includes += include_directories('../../net/i40e') - allow_experimental_apis = true -endif +allow_experimental_apis = true
Signature · 1 line
2.25.0
Re: [dpdk-dev] [PATCH v4 1/6] drivers: cleanup meson build variable
Hi,
I find some build error in patchwork.
Quoted 582 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, February 12, 2020 10:00
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>; Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>
Subject: [PATCH v4 1/6] drivers: cleanup meson build variableThe variable build is already initialized as true in
drivers/meson.build. Duplicate initializations can be removed from mlx.When the variable build is set to false, it is easier to call
subdir_done()than branch the rest of the code on build condition.Suggested-by Bruce Richardson <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- drivers/common/mlx5/meson.build | 293 ++++++++++++++++---------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 131 +++++++------- drivers/raw/ifpga/meson.build | 23 ++- 4 files changed, 230 insertions(+), 234 deletions(-)(quoted diff) +0
-0b/drivers/common/mlx5/meson.build index
2b704107cd..be57558267100644drivers/common/mlx5/meson.build +0
-1@@ -6,7 +6,6 @@ if not is_linux reason = 'only supported on Linux' subdir_done() endif -build = true pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE ='librte_pmd_mlx5_glue.so'
drivers/common/mlx5/meson.build +42
-145@@ -32,158 +31,158 @@ foreach libname:libnames else build = false reason = 'missing dependency, "' + libname + '"' + subdir_done() endif endforeach -if build - allow_experimental_apis = true - deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] - ext_deps += libs - sources = files( - 'mlx5_devx_cmds.c', - 'mlx5_common.c', - 'mlx5_nl.c', - ) - if not pmd_dlopen - sources += files('mlx5_glue.c') - endif - cflags_options = [ - '-std=c11', - '-Wno-strict-prototypes', - '-D_BSD_SOURCE', - '-D_DEFAULT_SOURCE', - '-D_XOPEN_SOURCE=600' - ] - foreach option:cflags_options - if cc.has_argument(option) - cflags += option - endif - endforeach - if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-DPEDANTIC' ] - else - cflags += [ '-UPEDANTIC' ] +allow_experimental_apis = true +deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] ext_deps += libs +sources = files( + 'mlx5_devx_cmds.c', + 'mlx5_common.c', + 'mlx5_nl.c', +) +if not pmd_dlopen + sources += files('mlx5_glue.c') +endif +cflags_options = [ + '-std=c11', + '-Wno-strict-prototypes', + '-D_BSD_SOURCE', + '-D_DEFAULT_SOURCE', + '-D_XOPEN_SOURCE=600' +] +foreach option:cflags_options + if cc.has_argument(option) + cflags += option endif - # To maintain the compatibility with the make build system - # mlx5_autoconf.h file is still generated. - # input array for meson member search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search", "struct member to search" ] - has_member_args = [ - [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', - 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', - 'struct ibv_counter_set_init_attr', 'counter_set_id' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', - 'struct ibv_counters_init_attr', 'comp_mask' ], - ] - # input array for meson symbol search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search" ] - has_sym_args = [ - [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], - [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], - [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', - 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], - [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', - 'mlx5dv_create_flow_action_packet_reformat' ], - [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', - 'IBV_FLOW_SPEC_MPLS' ], - [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], - [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAG_RX_END_PADDING' ], - [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', - 'mlx5dv_query_devx_port' ], - [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_create' ], - [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', - 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], - [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_query_async' ], - [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_dest_devx_tir' ], - [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_get_event' ], - [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_flow_meter' ], - [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h', - 'MLX5_MMAP_GET_NC_PAGES_CMD' ], - [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], - [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], - [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_push_vlan' ], - [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], - [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseLR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseLR4_Full' ], - [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], - [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', - 'IFLA_NUM_VF' ], - [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', - 'IFLA_EXT_MASK' ], - [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', - 'IFLA_PHYS_SWITCH_ID' ], - [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', - 'IFLA_PHYS_PORT_NAME' ], - [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', - 'RDMA_NL_NLDEV' ], - [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_GET' ], - [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_PORT_GET' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_NAME' ], - [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_PORT_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], - [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', - 'mlx5dv_dump_dr_domain'], - [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], - ] - config = configuration_data() - foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) - endforeach - foreach arg:has_member_args - file_prefix = '#include <' + arg[1] + '>' - config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix : file_prefix, dependencies: libs)) - endforeach - configure_file(output : 'mlx5_autoconf.h', configuration : config) +endforeach +if get_option('buildtype').contains('debug') + cflags += [ '-pedantic', '-DPEDANTIC' ] else + cflags += [ '-UPEDANTIC' ] endif +# To maintain the compatibility with the make build system # +mlx5_autoconf.h file is still generated. +# input array for meson member search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search", "struct member to search" ] +has_member_args = [ + [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', + 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', + 'struct ibv_counter_set_init_attr', 'counter_set_id' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', + 'struct ibv_counters_init_attr', 'comp_mask' ], ] # input array for +meson symbol search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search" ] +has_sym_args = [ + [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +14
-0+ 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], + [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], + [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', + 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], + [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', + 'mlx5dv_create_flow_action_packet_reformat' ], + [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', + 'IBV_FLOW_SPEC_MPLS' ], + [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING','
infiniband/verbs.h',drivers/common/mlx5/meson.build +12
-0+ 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], + [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', + 'IBV_WQ_FLAG_RX_END_PADDING' ], + [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', + 'mlx5dv_query_devx_port' ], + [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_create' ], + [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', + 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], + [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_query_async' ], + [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +4
-0+ 'mlx5dv_dr_action_create_dest_devx_tir' ], + [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_get_event' ], + [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +2
-0+ 'mlx5dv_dr_action_create_flow_meter' ], + [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +55
-0+ 'MLX5_MMAP_GET_NC_PAGES_CMD' ], + [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], + [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], + [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_push_vlan' ], + [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], + [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseLR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseLR4_Full' ], + [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], + [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', + 'IFLA_NUM_VF' ], + [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', + 'IFLA_EXT_MASK' ], + [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', + 'IFLA_PHYS_SWITCH_ID' ], + [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', + 'IFLA_PHYS_PORT_NAME' ], + [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', + 'RDMA_NL_NLDEV' ], + [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_GET' ], + [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_PORT_GET' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_NAME' ], + [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_PORT_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_domain'], + [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], ]config =
drivers/common/mlx5/meson.build +11
-1+configuration_data() foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) +endforeach +foreach arg:has_member_args + file_prefix = '#include <' + arg[1] + '>' + config.set(arg[0], cc.has_member(arg[2], arg[3], + prefix : file_prefix, dependencies: libs)) endforeach +configure_file(output : 'mlx5_autoconf.h', configuration : config) + # Build Glue Library -if pmd_dlopen and build +if pmd_dlopen dlopen_name = 'mlx5_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION(quoted diff) +0
-0b/drivers/net/ipn3ke/meson.build index
bfec592aba..f19083af15100644drivers/net/ipn3ke/meson.build +8
-9@@ -16,16 +16,15 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - allow_experimental_apis = true +allow_experimental_apis = true - includes += include_directories('../../raw/ifpga') +includes += include_directories('../../raw/ifpga') - sources += files('ipn3ke_ethdev.c', - 'ipn3ke_representor.c', - 'ipn3ke_tm.c', - 'ipn3ke_flow.c') - deps += ['bus_ifpga', 'ethdev', 'sched'] -endif +sources += files('ipn3ke_ethdev.c', + 'ipn3ke_representor.c', + 'ipn3ke_tm.c', + 'ipn3ke_flow.c') +deps += ['bus_ifpga', 'ethdev', 'sched']drivers/net/mlx4/meson.build +0
-1@@ -7,7 +7,6 @@ if not is_linux reason = 'only supported on Linux' subdir_done() endif -build = true pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE ='librte_pmd_mlx4_glue.so'
drivers/net/mlx4/meson.build +41
-64@@ -33,77 +32,77 @@ foreach libname:libnames else build = false reason = 'missing dependency, "' + libname + '"' + subdir_done() endif endforeach -if build - allow_experimental_apis = true - ext_deps += libs - sources = files( - 'mlx4.c', - 'mlx4_ethdev.c', - 'mlx4_flow.c', - 'mlx4_intr.c', - 'mlx4_mp.c', - 'mlx4_mr.c', - 'mlx4_rxq.c', - 'mlx4_rxtx.c', - 'mlx4_txq.c', - 'mlx4_utils.c', - ) - if not pmd_dlopen - sources += files('mlx4_glue.c') - endif - cflags_options = [ - '-std=c11', - '-Wno-strict-prototypes', - '-D_BSD_SOURCE', - '-D_DEFAULT_SOURCE', - '-D_XOPEN_SOURCE=600' - ] - foreach option:cflags_options - if cc.has_argument(option) - cflags += option - endif - endforeach - if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-DPEDANTIC' ] - else - cflags += [ '-UPEDANTIC' ] +allow_experimental_apis = true +ext_deps += libs +sources = files( + 'mlx4.c', + 'mlx4_ethdev.c', + 'mlx4_flow.c', + 'mlx4_intr.c', + 'mlx4_mp.c', + 'mlx4_mr.c', + 'mlx4_rxq.c', + 'mlx4_rxtx.c', + 'mlx4_txq.c', + 'mlx4_utils.c', +) +if not pmd_dlopen + sources += files('mlx4_glue.c') +endif +cflags_options = [ + '-std=c11', + '-Wno-strict-prototypes', + '-D_BSD_SOURCE', + '-D_DEFAULT_SOURCE', + '-D_XOPEN_SOURCE=600' +] +foreach option:cflags_options + if cc.has_argument(option) + cflags += option endif - # To maintain the compatibility with the make build system - # mlx4_autoconf.h file is still generated. - # input array for meson member search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search", "struct member to search" ] - # - has_member_args = [ - [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h', - 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ], - ] - # input array for meson symbol search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search" ] - has_sym_args = [ - [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h', - 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ], - [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h', - 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ], - ] - config = configuration_data() - foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) - endforeach - foreach arg:has_member_args - file_prefix = '#include <' + arg[1] + '>' - config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix: file_prefix, dependencies: libs)) - endforeach - configure_file(output : 'mlx4_autoconf.h', configuration : config) +endforeach +if get_option('buildtype').contains('debug') + cflags += [ '-pedantic', '-DPEDANTIC' ] else + cflags += [ '-UPEDANTIC' ] endif +# To maintain the compatibility with the make build system # +mlx4_autoconf.h file is still generated. +# input array for meson member search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search", "struct member to search" ] +# +has_member_args = [ + [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h', + 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ], ] # input array formeson
drivers/net/mlx4/meson.build +21
-1+symbol search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search" ] +has_sym_args = [ + [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h', + 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ], + [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h', + 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ], +] +config = configuration_data() +foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) +endforeach +foreach arg:has_member_args + file_prefix = '#include <' + arg[1] + '>' + config.set(arg[0], cc.has_member(arg[2], arg[3], + prefix: file_prefix, dependencies: libs)) endforeach +configure_file(output : 'mlx4_autoconf.h', configuration : config) + # Build Glue Library -if pmd_dlopen and build +if pmd_dlopen dlopen_name = 'mlx4_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSIONdrivers/raw/ifpga/meson.build +11
-13@@ -8,21 +8,20 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - subdir('base') - objs = [base_objs] +subdir('base') +objs = [base_objs] - deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', - 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] - ext_deps += dep +deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', + 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] ext_deps += +dep - sources = files('ifpga_rawdev.c') +sources = files('ifpga_rawdev.c') - includes += include_directories('base') - includes += include_directories('../../net/ipn3ke') - includes += include_directories('../../net/i40e') +includes += include_directories('base') includes += +include_directories('../../net/ipn3ke') +includes += include_directories('../../net/i40e') - allow_experimental_apis = true -endif +allow_experimental_apis = true --2.25.0
Re: [dpdk-dev] [PATCH v4 1/6] drivers: cleanup meson build variable
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/
This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executable
I think we can ignore, this is clearly an issue in the setup.
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
Quoted 4 lines · Thomas Monjalon
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
Quoted 10 lines
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executableI think we can ignore, this is clearly an issue in the setup.
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.html
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
Quoted 13 lines · Jeremy Plsek
Quoted 11 lines · Thomas Monjalon
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executable
Quoted 6 lines
Quoted 3 lines
I think we can ignore, this is clearly an issue in the setup.
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.html
As an update, installing pkgconfiglite does make the build pass.
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
12/02/2020 16:18, Jeremy Plsek:
Quoted 14 lines · Jeremy Plsek
Quoted 13 lines · Thomas Monjalon
Quoted 11 lines
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executable
Quoted 8 lines
Quoted 6 lines
Quoted 3 lines
I think we can ignore, this is clearly an issue in the setup.
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.htmlAs an update, installing pkgconfiglite does make the build pass.
I don't understand Jeremy; the issue is seen in Ubuntu. Please check the link above.
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
Quoted 19 lines · Thomas Monjalon
12/02/2020 16:18, Jeremy Plsek:
Quoted 17 lines · Jeremy Plsek
Quoted 16 lines · Thomas Monjalon
Quoted 14 lines
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executableI think we can ignore, this is clearly an issue in the setup.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.htmlAs an update, installing pkgconfiglite does make the build pass.
I don't understand Jeremy; the issue is seen in Ubuntu. Please check the link above.
Oh, I only looked at the windows build fail, not the unit tests. Apparently they both had the same issue. I will fix the unit test system.
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
12/02/2020 17:36, Jeremy Plsek:
Quoted 26 lines · Thomas Monjalon
Quoted 25 lines
12/02/2020 16:18, Jeremy Plsek:
Quoted 22 lines · Jeremy Plsek
Quoted 13 lines · Thomas Monjalon
Quoted 11 lines
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executableQuoted 6 lines
Quoted 3 lines
I think we can ignore, this is clearly an issue in the setup.
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.htmlAs an update, installing pkgconfiglite does make the build pass.
Quoted 7 lines
Quoted 4 lines
I don't understand Jeremy; the issue is seen in Ubuntu. Please check the link above.
Oh, I only looked at the windows build fail, not the unit tests. Apparently they both had the same issue. I will fix the unit test system.
Please could you show where is the error on Windows? There is maybe something to fix here.
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
Quoted 32 lines · Thomas Monjalon
12/02/2020 17:36, Jeremy Plsek:
Quoted 30 lines · Thomas Monjalon
Quoted 29 lines
12/02/2020 16:18, Jeremy Plsek:
Quoted 14 lines · Jeremy Plsek
Quoted 13 lines · Thomas Monjalon
Quoted 11 lines
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executableQuoted 8 lines
Quoted 6 lines
Quoted 3 lines
I think we can ignore, this is clearly an issue in the setup.
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.htmlAs an update, installing pkgconfiglite does make the build pass.
I don't understand Jeremy; the issue is seen in Ubuntu. Please check the link above.
Quoted 8 lines
Quoted 3 lines
Oh, I only looked at the windows build fail, not the unit tests. Apparently they both had the same issue. I will fix the unit test system.
Please could you show where is the error on Windows? There is maybe something to fix here.
See "Run 1" under:
https://lab.dpdk.org/results/dashboard/patchsets/9573/#env-27
Direct download:
https://lab.dpdk.org/results/dashboard/results/results-uploads/test_runs/74f515cb64bd47f698cc2290ebaea571/log_upload_file/2020/2/dpdk_43e34a229d3e_9573_2020-02-12_03-00-39_NA.zip
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
12/02/2020 17:46, Jeremy Plsek:
Quoted 37 lines · Thomas Monjalon
Quoted 36 lines
12/02/2020 17:36, Jeremy Plsek:
Quoted 33 lines · Thomas Monjalon
Quoted 19 lines
12/02/2020 16:18, Jeremy Plsek:
Quoted 17 lines · Jeremy Plsek
Quoted 16 lines · Thomas Monjalon
Quoted 14 lines
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executableI think we can ignore, this is clearly an issue in the setup.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.htmlAs an update, installing pkgconfiglite does make the build pass.
I don't understand Jeremy; the issue is seen in Ubuntu. Please check the link above.
Oh, I only looked at the windows build fail, not the unit tests. Apparently they both had the same issue. I will fix the unit test system.
Quoted 8 lines
Quoted 4 lines
Please could you show where is the error on Windows? There is maybe something to fix here.
See "Run 1" under:
https://lab.dpdk.org/results/dashboard/patchsets/9573/#env-27
Direct download:
https://lab.dpdk.org/results/dashboard/results/results-uploads/test_runs/74f515cb64bd47f698cc2290ebaea571/log_upload_file/2020/2/dpdk_43e34a229d3e_9573_2020-02-12_03-00-39_NA.zip
I see, thanks
If pkg-config is not required so far, please do not intall it. I will fix this patch for Windows.
Re: [dpdk-dev] [dpdklab] Re: [PATCH v4 1/6] drivers: cleanup meson build variable
Quoted 48 lines · Thomas Monjalon
12/02/2020 17:46, Jeremy Plsek:
Quoted 37 lines · Thomas Monjalon
Quoted 36 lines
12/02/2020 17:36, Jeremy Plsek:
Quoted 33 lines · Thomas Monjalon
Quoted 19 lines
12/02/2020 16:18, Jeremy Plsek:
Quoted 17 lines · Jeremy Plsek
Quoted 16 lines · Thomas Monjalon
Quoted 14 lines
12/02/2020 10:26, Xu, Rosen:
Quoted 1 line
I find some build error in patchwork.
This is a failure in the unit tests, probably unrelated:
https://lab.dpdk.org/results/dashboard/patchsets/9573/This is the error message:
buildtools/meson.build:6:0: ERROR:
Program(s) ['pkg-config', 'pkgconf'] not found or not executableI think we can ignore, this is clearly an issue in the setup.
Quoted 10 lines
Quoted 5 lines
Quoted 3 lines
The windows guide does not mention needing pkgconfig to build dpdk on windows. The guide should be updated if this is the case.
https://doc.dpdk.org/guides/windows_gsg/build_dpdk.htmlAs an update, installing pkgconfiglite does make the build pass.
I don't understand Jeremy; the issue is seen in Ubuntu. Please check the link above.
Oh, I only looked at the windows build fail, not the unit tests. Apparently they both had the same issue. I will fix the unit test system.
Quoted 8 lines
Quoted 4 lines
Please could you show where is the error on Windows? There is maybe something to fix here.
See "Run 1" under:
https://lab.dpdk.org/results/dashboard/patchsets/9573/#env-27
Direct download:
https://lab.dpdk.org/results/dashboard/results/results-uploads/test_runs/74f515cb64bd47f698cc2290ebaea571/log_upload_file/2020/2/dpdk_43e34a229d3e_9573_2020-02-12_03-00-39_NA.zip
Quoted 6 lines
I see, thanks
If pkg-config is not required so far, please do not intall it. I will fix this patch for Windows.
Ok, I've removed pkg-config from the windows build server.
PATCH v4 2/6 net/mlx: add static ibverbs linkage with meson
In reply to Thomas MonjalonThe libibverbs (and libmlx4/5) can be statically embedded in the shared PMD library, or in the application with the static PMD. It was supported with make build system in
commit 2c0dd7b69fb0 ("config: add static linkage of mlx dependency").
The same feature is enabled with meson when using pkg-config (i.e. only if the call to dependency() is successful). The fallback method for searching library with cc.find_library() is not supported because the dependencies of the found library would not be linked (no such info in .a file unlike .so).
The main difference, in meson build system, is the generated .pc file giving arguments to link DPDK with the application. Unfortunately the .pc file will not keep memory of the static linkage option for libibverbs.
--- doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/common/mlx5/meson.build | 5 +++-- drivers/net/mlx4/meson.build | 5 +++-- meson_options.txt | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-)
doc/guides/nics/mlx4.rst +4 -0
@@ -92,6 +92,10 @@ These options can be modified in the ``.config`` file. adds additional run-time checks and debugging messages at the cost of lower performance. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
doc/guides/nics/mlx5.rst +4 -0
@@ -278,6 +278,10 @@ These options can be modified in the ``.config`` file. 64. Default armv8a configuration of make build and meson build set it to 128 then brings performance degradation. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
drivers/common/mlx5/meson.build +3 -2
@@ -7,6 +7,7 @@ if not is_linux subdir_done() endif +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0'
@@ -22,8 +23,8 @@ endif libnames = [ 'mlx5', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
drivers/net/mlx4/meson.build +3 -2
@@ -8,6 +8,7 @@ if not is_linux subdir_done() endif +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0'
@@ -23,8 +24,8 @@ endif libnames = [ 'mlx4', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
meson_options.txt +2 -2
@@ -14,8 +14,8 @@ option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('flexran_sdk', type: 'string', value: '', description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') -option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', - description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') +option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', + description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('include_subdir_arch', type: 'string', value: '', description: 'subdirectory where to install arch-dependent headers') option('kernel_dir', type: 'string', value: '',
Signature · 1 line
2.25.0
PATCH v4 3/6 buildtools: get static mlx dependencies for meson
In reply to Thomas MonjalonThe shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs libraries.
When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson.
If linking with libraries installed in a non-standard path, an option -L is provided via EXTRA_LDFLAGS in case of using make. With meson, tuning PKG_CONFIG_PATH for pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make.
The other change in this script is to drop the first occurrences of the main library file (libiverbs.a). Only the last occurrence is kept. It fixes some undefined references when linking a static application using libdpdk.pc.
--- buildtools/options-ibverbs-static.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
buildtools/options-ibverbs-static.sh +9 -2
@@ -9,6 +9,13 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs | +lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + tac | + awk "/^-l:$lib.a/&&c++ {next} 1" | # drop first duplicates of main lib + tac
Signature · 1 line
2.25.0
PATCH v4 4/6 net/mlx: workaround static linkage with meson
In reply to Thomas MonjalonIf ibverbs_link is static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.
Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.
A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
In order to avoid meson suggesting shared libraries in the section Requires.private of the .pc file, the dependency object is recreated with declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.a
--- buildtools/meson.build | 2 ++ drivers/common/mlx5/meson.build | 12 +++++++++++- drivers/net/mlx4/meson.build | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-)
buildtools/meson.build +2 -0
@@ -3,9 +3,11 @@ subdir('pmdinfogen') +pkgconf = find_program('pkg-config', 'pkgconf') pmdinfo = find_program('gen-pmdinfo-cfile.sh') list_dir_globs = find_program('list-dir-globs.py') check_experimental_syms = find_program('check-experimental-syms.sh') +ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false)
drivers/common/mlx5/meson.build +11 -1
@@ -29,16 +29,26 @@ foreach libname:libnames endif if lib.found() libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' subdir_done() endif endforeach +if static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif allow_experimental_apis = true deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] -ext_deps += libs sources = files( 'mlx5_devx_cmds.c', 'mlx5_common.c',
drivers/net/mlx4/meson.build +12 -2
@@ -29,16 +29,26 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' subdir_done() endif endforeach +if static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif allow_experimental_apis = true -ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c',
Signature · 1 line
2.25.0
PATCH v4 5/6 net/mlx: rename meson variable for dlopen option
In reply to Thomas MonjalonThe name of the variable pmd_dlopen is confusing because it can be understood as true if the PMD is dlopen, whereas it means the ibverbs glue layer is a dlopen library. That's why it is renamed dlopen_ibverbs.
--- drivers/common/mlx5/meson.build | 8 ++++---- drivers/net/mlx4/meson.build | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/common/mlx5/meson.build +4 -4
@@ -8,11 +8,11 @@ if not is_linux endif static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
@@ -54,7 +54,7 @@ sources = files( 'mlx5_common.c', 'mlx5_nl.c', ) -if not pmd_dlopen +if not dlopen_ibverbs sources += files('mlx5_glue.c') endif cflags_options = [
@@ -193,7 +193,7 @@ endforeach configure_file(output : 'mlx5_autoconf.h', configuration : config) # Build Glue Library -if pmd_dlopen +if dlopen_ibverbs dlopen_name = 'mlx5_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
drivers/net/mlx4/meson.build +4 -4
@@ -9,11 +9,11 @@ if not is_linux endif static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
@@ -61,7 +61,7 @@ sources = files( 'mlx4_txq.c', 'mlx4_utils.c', ) -if not pmd_dlopen +if not dlopen_ibverbs sources += files('mlx4_glue.c') endif cflags_options = [
@@ -113,7 +113,7 @@ endforeach configure_file(output : 'mlx4_autoconf.h', configuration : config) # Build Glue Library -if pmd_dlopen +if dlopen_ibverbs dlopen_name = 'mlx4_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
Signature · 1 line
2.25.0
PATCH v4 6/6 net/mlx: fix overlinking with meson and glue dlopen
In reply to Thomas MonjalonIf ibverbs_link is dlopen, the PMD and application should not be linked with ibverbs, but the glue library is. Unfortunately the ibverbs dependency was exported in the variable ext_deps, so there were overlinking.
It is fixed by not exporting the dependency in ext_deps, and recreating a limited dependency object for cflags only.
--- drivers/common/mlx5/meson.build | 6 ++++-- drivers/net/mlx4/meson.build | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/common/mlx5/meson.build +4 -2
@@ -29,7 +29,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else
@@ -38,10 +38,12 @@ foreach libname:libnames subdir_done() endif endforeach -if static_ibverbs +if static_ibverbs or dlopen_ibverbs # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
drivers/net/mlx4/meson.build +4 -2
@@ -30,7 +30,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else
@@ -39,10 +39,12 @@ foreach libname:libnames subdir_done() endif endforeach -if static_ibverbs +if static_ibverbs or dlopen_ibverbs # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
Signature · 1 line
2.25.0
Re: [dpdk-dev] [PATCH v4 0/6] mlx ibverbs linking in meson
In reply to Thomas MonjalonQuoted 7 lines
Thomas Monjalon (6):
drivers: cleanup meson build variable net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson net/mlx: workaround static linkage with meson net/mlx: rename meson variable for dlopen option net/mlx: fix overlinking with meson and glue dlopen
Patches 2 to 6 were already Acked-by: Bruce Richardson <[email protected]>
v5 cover mlx ibverbs linking in meson
In reply to Thomas MonjalonThis is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".
With the meson option ibverbs_link, only the mode "shared" was working correctly.
This patchset adds the mode "static" and fixes the mode "dlopen".
changes in v5:
- fix build if pkg-config/pkgconf is missing (e.g. Windows)
changes in v4:
- fix lib ordering
- simplify conditions by using subdir_done()
changes in v3:
- get cflags with pkg-config invocation
- drop addition of global variable hidden_deps
- remove overlinking in dlopen mode
changes in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc for hidden_deps
- improve explanations in commit logs
Thomas Monjalon (6):
drivers: cleanup meson build variable net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson net/mlx: workaround static linkage with meson net/mlx: rename meson variable for dlopen option net/mlx: fix overlinking with meson and glue dlopen
buildtools/meson.build | 2 + buildtools/options-ibverbs-static.sh | 11 +- doc/guides/nics/mlx4.rst | 4 + doc/guides/nics/mlx5.rst | 4 + drivers/common/mlx5/meson.build | 314 ++++++++++++++------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 154 +++++++------ drivers/raw/ifpga/meson.build | 23 +- meson_options.txt | 4 +- 9 files changed, 286 insertions(+), 247 deletions(-)
Signature · 1 line
2.25.0
PATCH v5 1/6 drivers: cleanup meson build variable
The variable build is already initialized as true in drivers/meson.build. Duplicate initializations can be removed from mlx.
When the variable build is set to false, it is easier to call subdir_done() than branch the rest of the code on build condition.
--- drivers/common/mlx5/meson.build | 293 ++++++++++++++++---------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 131 +++++++------- drivers/raw/ifpga/meson.build | 23 ++- 4 files changed, 230 insertions(+), 234 deletions(-)
drivers/common/mlx5/meson.build +146 -147
@@ -6,7 +6,6 @@ if not is_linux reason = 'only supported on Linux' subdir_done() endif -build = true pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
@@ -32,158 +31,158 @@ foreach libname:libnames else build = false reason = 'missing dependency, "' + libname + '"' + subdir_done() endif endforeach -if build - allow_experimental_apis = true - deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] - ext_deps += libs - sources = files( - 'mlx5_devx_cmds.c', - 'mlx5_common.c', - 'mlx5_nl.c', - ) - if not pmd_dlopen - sources += files('mlx5_glue.c') - endif - cflags_options = [ - '-std=c11', - '-Wno-strict-prototypes', - '-D_BSD_SOURCE', - '-D_DEFAULT_SOURCE', - '-D_XOPEN_SOURCE=600' - ] - foreach option:cflags_options - if cc.has_argument(option) - cflags += option - endif - endforeach - if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-DPEDANTIC' ] - else - cflags += [ '-UPEDANTIC' ] +allow_experimental_apis = true +deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] +ext_deps += libs +sources = files( + 'mlx5_devx_cmds.c', + 'mlx5_common.c', + 'mlx5_nl.c', +) +if not pmd_dlopen + sources += files('mlx5_glue.c') +endif +cflags_options = [ + '-std=c11', + '-Wno-strict-prototypes', + '-D_BSD_SOURCE', + '-D_DEFAULT_SOURCE', + '-D_XOPEN_SOURCE=600' +] +foreach option:cflags_options + if cc.has_argument(option) + cflags += option endif - # To maintain the compatibility with the make build system - # mlx5_autoconf.h file is still generated. - # input array for meson member search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search", "struct member to search" ] - has_member_args = [ - [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', - 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', - 'struct ibv_counter_set_init_attr', 'counter_set_id' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', - 'struct ibv_counters_init_attr', 'comp_mask' ], - ] - # input array for meson symbol search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search" ] - has_sym_args = [ - [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], - [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], - [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', - 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], - [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', - 'mlx5dv_create_flow_action_packet_reformat' ], - [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', - 'IBV_FLOW_SPEC_MPLS' ], - [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], - [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAG_RX_END_PADDING' ], - [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', - 'mlx5dv_query_devx_port' ], - [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_create' ], - [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', - 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], - [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_query_async' ], - [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_dest_devx_tir' ], - [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_get_event' ], - [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_flow_meter' ], - [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h', - 'MLX5_MMAP_GET_NC_PAGES_CMD' ], - [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], - [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], - [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_push_vlan' ], - [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], - [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseLR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseLR4_Full' ], - [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], - [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', - 'IFLA_NUM_VF' ], - [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', - 'IFLA_EXT_MASK' ], - [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', - 'IFLA_PHYS_SWITCH_ID' ], - [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', - 'IFLA_PHYS_PORT_NAME' ], - [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', - 'RDMA_NL_NLDEV' ], - [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_GET' ], - [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_PORT_GET' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_NAME' ], - [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_PORT_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], - [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', - 'mlx5dv_dump_dr_domain'], - [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], - ] - config = configuration_data() - foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) - endforeach - foreach arg:has_member_args - file_prefix = '#include <' + arg[1] + '>' - config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix : file_prefix, dependencies: libs)) - endforeach - configure_file(output : 'mlx5_autoconf.h', configuration : config) +endforeach +if get_option('buildtype').contains('debug') + cflags += [ '-pedantic', '-DPEDANTIC' ] +else + cflags += [ '-UPEDANTIC' ] endif +# To maintain the compatibility with the make build system +# mlx5_autoconf.h file is still generated. +# input array for meson member search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search", "struct member to search" ] +has_member_args = [ + [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', + 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', + 'struct ibv_counter_set_init_attr', 'counter_set_id' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', + 'struct ibv_counters_init_attr', 'comp_mask' ], +] +# input array for meson symbol search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search" ] +has_sym_args = [ + [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h', + 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], + [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], + [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', + 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], + [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', + 'mlx5dv_create_flow_action_packet_reformat' ], + [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', + 'IBV_FLOW_SPEC_MPLS' ], + [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h', + 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], + [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', + 'IBV_WQ_FLAG_RX_END_PADDING' ], + [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', + 'mlx5dv_query_devx_port' ], + [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_create' ], + [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', + 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], + [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_query_async' ], + [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_dest_devx_tir' ], + [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_get_event' ], + [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_flow_meter' ], + [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h', + 'MLX5_MMAP_GET_NC_PAGES_CMD' ], + [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], + [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], + [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_push_vlan' ], + [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], + [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseLR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseLR4_Full' ], + [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], + [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', + 'IFLA_NUM_VF' ], + [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', + 'IFLA_EXT_MASK' ], + [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', + 'IFLA_PHYS_SWITCH_ID' ], + [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', + 'IFLA_PHYS_PORT_NAME' ], + [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', + 'RDMA_NL_NLDEV' ], + [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_GET' ], + [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_PORT_GET' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_NAME' ], + [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_PORT_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_domain'], + [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], +] +config = configuration_data() +foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) +endforeach +foreach arg:has_member_args + file_prefix = '#include <' + arg[1] + '>' + config.set(arg[0], cc.has_member(arg[2], arg[3], + prefix : file_prefix, dependencies: libs)) +endforeach +configure_file(output : 'mlx5_autoconf.h', configuration : config) + # Build Glue Library -if pmd_dlopen and build +if pmd_dlopen dlopen_name = 'mlx5_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
drivers/net/ipn3ke/meson.build +8 -9
@@ -16,16 +16,15 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - allow_experimental_apis = true +allow_experimental_apis = true - includes += include_directories('../../raw/ifpga') +includes += include_directories('../../raw/ifpga') - sources += files('ipn3ke_ethdev.c', - 'ipn3ke_representor.c', - 'ipn3ke_tm.c', - 'ipn3ke_flow.c') - deps += ['bus_ifpga', 'ethdev', 'sched'] -endif +sources += files('ipn3ke_ethdev.c', + 'ipn3ke_representor.c', + 'ipn3ke_tm.c', + 'ipn3ke_flow.c') +deps += ['bus_ifpga', 'ethdev', 'sched']
drivers/net/mlx4/meson.build +65 -66
149 lines not on this page · raw message
drivers/raw/ifpga/meson.build +11 -12
@@ -8,21 +8,20 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - subdir('base') - objs = [base_objs] +subdir('base') +objs = [base_objs] - deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', - 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] - ext_deps += dep +deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', + 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] +ext_deps += dep - sources = files('ifpga_rawdev.c') +sources = files('ifpga_rawdev.c') - includes += include_directories('base') - includes += include_directories('../../net/ipn3ke') - includes += include_directories('../../net/i40e') +includes += include_directories('base') +includes += include_directories('../../net/ipn3ke') +includes += include_directories('../../net/i40e') - allow_experimental_apis = true -endif +allow_experimental_apis = true
Signature · 1 line
2.25.0
Re: [dpdk-dev] [PATCH v5 1/6] drivers: cleanup meson build variable
Hi,
Quoted 581 lines
-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Thursday, February 13, 2020 6:07
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Matan Azrad <[email protected]>; Shahaf Shuler <[email protected]>; Viacheslav Ovsiienko <[email protected]>; Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>
Subject: [PATCH v5 1/6] drivers: cleanup meson build variableThe variable build is already initialized as true in
drivers/meson.build. Duplicate initializations can be removed from mlx.When the variable build is set to false, it is easier to call
subdir_done()than branch the rest of the code on build condition.Suggested-by Bruce Richardson <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>--- drivers/common/mlx5/meson.build | 293 ++++++++++++++++---------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 131 +++++++------- drivers/raw/ifpga/meson.build | 23 ++- 4 files changed, 230 insertions(+), 234 deletions(-)(quoted diff) +0
-0b/drivers/common/mlx5/meson.build index
2b704107cd..be57558267100644drivers/common/mlx5/meson.build +0
-1@@ -6,7 +6,6 @@ if not is_linux reason = 'only supported on Linux' subdir_done() endif -build = true pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE ='librte_pmd_mlx5_glue.so'
drivers/common/mlx5/meson.build +42
-145@@ -32,158 +31,158 @@ foreach libname:libnames else build = false reason = 'missing dependency, "' + libname + '"' + subdir_done() endif endforeach -if build - allow_experimental_apis = true - deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] - ext_deps += libs - sources = files( - 'mlx5_devx_cmds.c', - 'mlx5_common.c', - 'mlx5_nl.c', - ) - if not pmd_dlopen - sources += files('mlx5_glue.c') - endif - cflags_options = [ - '-std=c11', - '-Wno-strict-prototypes', - '-D_BSD_SOURCE', - '-D_DEFAULT_SOURCE', - '-D_XOPEN_SOURCE=600' - ] - foreach option:cflags_options - if cc.has_argument(option) - cflags += option - endif - endforeach - if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-DPEDANTIC' ] - else - cflags += [ '-UPEDANTIC' ] +allow_experimental_apis = true +deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] ext_deps += libs +sources = files( + 'mlx5_devx_cmds.c', + 'mlx5_common.c', + 'mlx5_nl.c', +) +if not pmd_dlopen + sources += files('mlx5_glue.c') +endif +cflags_options = [ + '-std=c11', + '-Wno-strict-prototypes', + '-D_BSD_SOURCE', + '-D_DEFAULT_SOURCE', + '-D_XOPEN_SOURCE=600' +] +foreach option:cflags_options + if cc.has_argument(option) + cflags += option endif - # To maintain the compatibility with the make build system - # mlx5_autoconf.h file is still generated. - # input array for meson member search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search", "struct member to search" ] - has_member_args = [ - [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', - 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', - 'struct ibv_counter_set_init_attr', 'counter_set_id' ], - [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', - 'struct ibv_counters_init_attr', 'comp_mask' ], - ] - # input array for meson symbol search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search" ] - has_sym_args = [ - [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], - [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], - [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', - 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], - [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', - 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], - [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', - 'mlx5dv_create_flow_action_packet_reformat' ], - [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', - 'IBV_FLOW_SPEC_MPLS' ], - [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], - [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', - 'IBV_WQ_FLAG_RX_END_PADDING' ], - [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', - 'mlx5dv_query_devx_port' ], - [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_create' ], - [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', - 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], - [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_obj_query_async' ], - [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_dest_devx_tir' ], - [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', - 'mlx5dv_devx_get_event' ], - [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_flow_meter' ], - [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h', - 'MLX5_MMAP_GET_NC_PAGES_CMD' ], - [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], - [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', - 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], - [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', - 'mlx5dv_dr_action_create_push_vlan' ], - [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], - [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_40000baseLR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseKR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseCR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseSR4_Full' ], - [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', - 'SUPPORTED_56000baseLR4_Full' ], - [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], - [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', - 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], - [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', - 'IFLA_NUM_VF' ], - [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', - 'IFLA_EXT_MASK' ], - [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', - 'IFLA_PHYS_SWITCH_ID' ], - [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', - 'IFLA_PHYS_PORT_NAME' ], - [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', - 'RDMA_NL_NLDEV' ], - [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_GET' ], - [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_CMD_PORT_GET' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_DEV_NAME' ], - [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_PORT_INDEX' ], - [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', - 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], - [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', - 'mlx5dv_dump_dr_domain'], - [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], - ] - config = configuration_data() - foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) - endforeach - foreach arg:has_member_args - file_prefix = '#include <' + arg[1] + '>' - config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix : file_prefix, dependencies: libs)) - endforeach - configure_file(output : 'mlx5_autoconf.h', configuration : config) +endforeach +if get_option('buildtype').contains('debug') + cflags += [ '-pedantic', '-DPEDANTIC' ] else + cflags += [ '-UPEDANTIC' ] endif +# To maintain the compatibility with the make build system # +mlx5_autoconf.h file is still generated. +# input array for meson member search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search", "struct member to search" ] +has_member_args = [ + [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h', + 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h', + 'struct ibv_counter_set_init_attr', 'counter_set_id' ], + [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h', + 'struct ibv_counters_init_attr', 'comp_mask' ], ] # input array for +meson symbol search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search" ] +has_sym_args = [ + [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +14
-0+ 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ], + [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ], + [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h', + 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ], + [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h', + 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ], + [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h', + 'mlx5dv_create_flow_action_packet_reformat' ], + [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h', + 'IBV_FLOW_SPEC_MPLS' ], + [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING','
infiniband/verbs.h',drivers/common/mlx5/meson.build +12
-0+ 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ], + [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h', + 'IBV_WQ_FLAG_RX_END_PADDING' ], + [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h', + 'mlx5dv_query_devx_port' ], + [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_create' ], + [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h', + 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ], + [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_obj_query_async' ], + [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +4
-0+ 'mlx5dv_dr_action_create_dest_devx_tir' ], + [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h', + 'mlx5dv_devx_get_event' ], + [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +2
-0+ 'mlx5dv_dr_action_create_flow_meter' ], + [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD','
infiniband/mlx5dv.h',drivers/common/mlx5/meson.build +55
-0+ 'MLX5_MMAP_GET_NC_PAGES_CMD' ], + [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ], + [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h', + 'MLX5DV_DR_DOMAIN_TYPE_FDB' ], + [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h', + 'mlx5dv_dr_action_create_push_vlan' ], + [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ], + [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_40000baseLR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseKR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseCR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseSR4_Full' ], + [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h', + 'SUPPORTED_56000baseLR4_Full' ], + [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ], + [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h', + 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ], + [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h', + 'IFLA_NUM_VF' ], + [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h', + 'IFLA_EXT_MASK' ], + [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h', + 'IFLA_PHYS_SWITCH_ID' ], + [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h', + 'IFLA_PHYS_PORT_NAME' ], + [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h', + 'RDMA_NL_NLDEV' ], + [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_GET' ], + [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_CMD_PORT_GET' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_DEV_NAME' ], + [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_PORT_INDEX' ], + [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h', + 'RDMA_NLDEV_ATTR_NDEV_INDEX' ], + [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h', + 'mlx5dv_dump_dr_domain'], + [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ], ]config =
drivers/common/mlx5/meson.build +11
-1+configuration_data() foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) +endforeach +foreach arg:has_member_args + file_prefix = '#include <' + arg[1] + '>' + config.set(arg[0], cc.has_member(arg[2], arg[3], + prefix : file_prefix, dependencies: libs)) endforeach +configure_file(output : 'mlx5_autoconf.h', configuration : config) + # Build Glue Library -if pmd_dlopen and build +if pmd_dlopen dlopen_name = 'mlx5_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION(quoted diff) +0
-0b/drivers/net/ipn3ke/meson.build index
bfec592aba..f19083af15100644drivers/net/ipn3ke/meson.build +8
-9@@ -16,16 +16,15 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - allow_experimental_apis = true +allow_experimental_apis = true - includes += include_directories('../../raw/ifpga') +includes += include_directories('../../raw/ifpga') - sources += files('ipn3ke_ethdev.c', - 'ipn3ke_representor.c', - 'ipn3ke_tm.c', - 'ipn3ke_flow.c') - deps += ['bus_ifpga', 'ethdev', 'sched'] -endif +sources += files('ipn3ke_ethdev.c', + 'ipn3ke_representor.c', + 'ipn3ke_tm.c', + 'ipn3ke_flow.c') +deps += ['bus_ifpga', 'ethdev', 'sched']drivers/net/mlx4/meson.build +0
-1@@ -7,7 +7,6 @@ if not is_linux reason = 'only supported on Linux' subdir_done() endif -build = true pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE ='librte_pmd_mlx4_glue.so'
drivers/net/mlx4/meson.build +41
-64@@ -33,77 +32,77 @@ foreach libname:libnames else build = false reason = 'missing dependency, "' + libname + '"' + subdir_done() endif endforeach -if build - allow_experimental_apis = true - ext_deps += libs - sources = files( - 'mlx4.c', - 'mlx4_ethdev.c', - 'mlx4_flow.c', - 'mlx4_intr.c', - 'mlx4_mp.c', - 'mlx4_mr.c', - 'mlx4_rxq.c', - 'mlx4_rxtx.c', - 'mlx4_txq.c', - 'mlx4_utils.c', - ) - if not pmd_dlopen - sources += files('mlx4_glue.c') - endif - cflags_options = [ - '-std=c11', - '-Wno-strict-prototypes', - '-D_BSD_SOURCE', - '-D_DEFAULT_SOURCE', - '-D_XOPEN_SOURCE=600' - ] - foreach option:cflags_options - if cc.has_argument(option) - cflags += option - endif - endforeach - if get_option('buildtype').contains('debug') - cflags += [ '-pedantic', '-DPEDANTIC' ] - else - cflags += [ '-UPEDANTIC' ] +allow_experimental_apis = true +ext_deps += libs +sources = files( + 'mlx4.c', + 'mlx4_ethdev.c', + 'mlx4_flow.c', + 'mlx4_intr.c', + 'mlx4_mp.c', + 'mlx4_mr.c', + 'mlx4_rxq.c', + 'mlx4_rxtx.c', + 'mlx4_txq.c', + 'mlx4_utils.c', +) +if not pmd_dlopen + sources += files('mlx4_glue.c') +endif +cflags_options = [ + '-std=c11', + '-Wno-strict-prototypes', + '-D_BSD_SOURCE', + '-D_DEFAULT_SOURCE', + '-D_XOPEN_SOURCE=600' +] +foreach option:cflags_options + if cc.has_argument(option) + cflags += option endif - # To maintain the compatibility with the make build system - # mlx4_autoconf.h file is still generated. - # input array for meson member search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search", "struct member to search" ] - # - has_member_args = [ - [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h', - 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ], - ] - # input array for meson symbol search: - # [ "MACRO to define if found", "header for the search", - # "symbol to search" ] - has_sym_args = [ - [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h', - 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ], - [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h', - 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ], - ] - config = configuration_data() - foreach arg:has_sym_args - config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], - dependencies: libs)) - endforeach - foreach arg:has_member_args - file_prefix = '#include <' + arg[1] + '>' - config.set(arg[0], cc.has_member(arg[2], arg[3], - prefix: file_prefix, dependencies: libs)) - endforeach - configure_file(output : 'mlx4_autoconf.h', configuration : config) +endforeach +if get_option('buildtype').contains('debug') + cflags += [ '-pedantic', '-DPEDANTIC' ] else + cflags += [ '-UPEDANTIC' ] endif +# To maintain the compatibility with the make build system # +mlx4_autoconf.h file is still generated. +# input array for meson member search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search", "struct member to search" ] +# +has_member_args = [ + [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h', + 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ], ] # input array formeson
drivers/net/mlx4/meson.build +21
-1+symbol search: +# [ "MACRO to define if found", "header for the search", +# "symbol to search" ] +has_sym_args = [ + [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h', + 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ], + [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h', + 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ], +] +config = configuration_data() +foreach arg:has_sym_args + config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], + dependencies: libs)) +endforeach +foreach arg:has_member_args + file_prefix = '#include <' + arg[1] + '>' + config.set(arg[0], cc.has_member(arg[2], arg[3], + prefix: file_prefix, dependencies: libs)) endforeach +configure_file(output : 'mlx4_autoconf.h', configuration : config) + # Build Glue Library -if pmd_dlopen and build +if pmd_dlopen dlopen_name = 'mlx4_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSIONdrivers/raw/ifpga/meson.build +11
-13@@ -8,21 +8,20 @@ endif if not dep.found() build = false reason = 'missing dependency, "libfdt"' + subdir_done() endif -if build - subdir('base') - objs = [base_objs] +subdir('base') +objs = [base_objs] - deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', - 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] - ext_deps += dep +deps += ['ethdev', 'rawdev', 'pci', 'bus_pci', 'kvargs', + 'bus_vdev', 'bus_ifpga', 'net', 'pmd_i40e', 'pmd_ipn3ke'] ext_deps += +dep - sources = files('ifpga_rawdev.c') +sources = files('ifpga_rawdev.c') - includes += include_directories('base') - includes += include_directories('../../net/ipn3ke') - includes += include_directories('../../net/i40e') +includes += include_directories('base') includes += +include_directories('../../net/ipn3ke') +includes += include_directories('../../net/i40e') - allow_experimental_apis = true -endif +allow_experimental_apis = true --
Quoted 1 line
2.25.0
PATCH v5 2/6 net/mlx: add static ibverbs linkage with meson
In reply to Thomas MonjalonThe libibverbs (and libmlx4/5) can be statically embedded in the shared PMD library, or in the application with the static PMD. It was supported with make build system in
commit 2c0dd7b69fb0 ("config: add static linkage of mlx dependency").
The same feature is enabled with meson when using pkg-config (i.e. only if the call to dependency() is successful). The fallback method for searching library with cc.find_library() is not supported because the dependencies of the found library would not be linked (no such info in .a file unlike .so).
The main difference, in meson build system, is the generated .pc file giving arguments to link DPDK with the application. Unfortunately the .pc file will not keep memory of the static linkage option for libibverbs.
--- doc/guides/nics/mlx4.rst | 4 ++++ doc/guides/nics/mlx5.rst | 4 ++++ drivers/common/mlx5/meson.build | 5 +++-- drivers/net/mlx4/meson.build | 5 +++-- meson_options.txt | 4 ++-- 5 files changed, 16 insertions(+), 6 deletions(-)
doc/guides/nics/mlx4.rst +4 -0
@@ -92,6 +92,10 @@ These options can be modified in the ``.config`` file. adds additional run-time checks and debugging messages at the cost of lower performance. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
doc/guides/nics/mlx5.rst +4 -0
@@ -278,6 +278,10 @@ These options can be modified in the ``.config`` file. 64. Default armv8a configuration of make build and meson build set it to 128 then brings performance degradation. +This option is available in meson: + +- ``ibverbs_link`` can be ``static``, ``shared``, or ``dlopen``. + Environment variables ~~~~~~~~~~~~~~~~~~~~~
drivers/common/mlx5/meson.build +3 -2
@@ -7,6 +7,7 @@ if not is_linux subdir_done() endif +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0'
@@ -22,8 +23,8 @@ endif libnames = [ 'mlx5', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
drivers/net/mlx4/meson.build +3 -2
@@ -8,6 +8,7 @@ if not is_linux subdir_done() endif +static_ibverbs = (get_option('ibverbs_link') == 'static') pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0'
@@ -23,8 +24,8 @@ endif libnames = [ 'mlx4', 'ibverbs' ] libs = [] foreach libname:libnames - lib = dependency('lib' + libname, required:false) - if not lib.found() + lib = dependency('lib' + libname, static:static_ibverbs, required:false) + if not lib.found() and not static_ibverbs lib = cc.find_library(libname, required:false) endif if lib.found()
meson_options.txt +2 -2
@@ -14,8 +14,8 @@ option('examples', type: 'string', value: '', description: 'Comma-separated list of examples to build by default') option('flexran_sdk', type: 'string', value: '', description: 'Path to FlexRAN SDK optional Libraries for BBDEV device') -option('ibverbs_link', type: 'combo', choices : ['shared', 'dlopen'], value: 'shared', - description: 'Linkage method (shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') +option('ibverbs_link', type: 'combo', choices : ['static', 'shared', 'dlopen'], value: 'shared', + description: 'Linkage method (static/shared/dlopen) for Mellanox PMDs with ibverbs dependencies.') option('include_subdir_arch', type: 'string', value: '', description: 'subdirectory where to install arch-dependent headers') option('kernel_dir', type: 'string', value: '',
Signature · 1 line
2.25.0
PATCH v5 3/6 buildtools: get static mlx dependencies for meson
In reply to Thomas MonjalonThe shell script options-ibverbs-static.sh was used with make in forcing static linkage of ibverbs libraries.
When choosing to link with a static dependency in meson, the generated .pc file will not force such static linkage. The solution will rely on using this script in meson.
If linking with libraries installed in a non-standard path, an option -L is provided via EXTRA_LDFLAGS in case of using make. With meson, tuning PKG_CONFIG_PATH for pkg-config should be enough. When statically linking an application, the .pc file must save the -L path so the application link will work without any extra option. That's why --libs-only-l is replaced with --libs which includes -L. Options which are neither -l or -L are filtered out because not needed and can cause compilation issues with the legacy system using make.
The other change in this script is to drop the first occurrences of the main library file (libiverbs.a). Only the last occurrence is kept. It fixes some undefined references when linking a static application using libdpdk.pc.
--- buildtools/options-ibverbs-static.sh | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-)
buildtools/options-ibverbs-static.sh +9 -2
@@ -9,6 +9,13 @@ # # PKG_CONFIG_PATH may be required to be set if libibverbs.pc is not installed. -pkg-config --libs-only-l --static libibverbs | +lib='libibverbs' +deps='pthread|nl' + +pkg-config --libs --static $lib | tr '[:space:]' '\n' | - sed -r '/^-l(pthread|nl)/! s,(^-l)(.*),\1:lib\2.a,' + sed -r "/^-l($deps)/! s,(^-l)(.*),\1:lib\2.a," | # explicit .a + sed -n '/^-[Ll]/p' | # extra link options may break with make + tac | + awk "/^-l:$lib.a/&&c++ {next} 1" | # drop first duplicates of main lib + tac
Signature · 1 line
2.25.0
PATCH v5 4/6 net/mlx: workaround static linkage with meson
In reply to Thomas MonjalonIf ibverbs_link is static and the application choose to link DPDK as static libraries, both PMD and ibverbs libraries must be linked as static libraries. And the dependencies of ibverbs (netlink) must still be linked as shared libraries.
Unfortunately, meson forget about the static requirement for ibverbs when generating the .pc file.
As a result, libibverbs, libmlx4, libmlx5 are listed in Requires.private section (allowing to be linked as shared libraries) and libnl is missing.
A fix is in progress for meson, but anyway we will have to live without such a fix until a better version of meson is widely available:
https://github.com/mesonbuild/meson/pull/6393
In order to avoid meson suggesting shared libraries in the section Requires.private of the .pc file, the dependency object is recreated with declare_dependency():
- cflags are extracted the libibverbs.pc
- ldflags, from libibverbs.pc, are processed to force static flavor of ibverbs libraries, thanks to this syntax:
-l:libfoo.a
--- buildtools/meson.build | 2 ++ drivers/common/mlx5/meson.build | 12 +++++++++++- drivers/net/mlx4/meson.build | 14 ++++++++++++-- 3 files changed, 25 insertions(+), 3 deletions(-)
buildtools/meson.build +2 -0
@@ -3,9 +3,11 @@ subdir('pmdinfogen') +pkgconf = find_program('pkg-config', 'pkgconf', required: false) pmdinfo = find_program('gen-pmdinfo-cfile.sh') list_dir_globs = find_program('list-dir-globs.py') check_experimental_syms = find_program('check-experimental-syms.sh') +ldflags_ibverbs_static = find_program('options-ibverbs-static.sh') # set up map-to-def script using python, either built-in or external python3 = import('python').find_installation(required: false)
drivers/common/mlx5/meson.build +11 -1
@@ -29,16 +29,26 @@ foreach libname:libnames endif if lib.found() libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' subdir_done() endif endforeach +if static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif allow_experimental_apis = true deps += ['hash', 'pci', 'net', 'eal', 'kvargs'] -ext_deps += libs sources = files( 'mlx5_devx_cmds.c', 'mlx5_common.c',
drivers/net/mlx4/meson.build +12 -2
@@ -29,16 +29,26 @@ foreach libname:libnames lib = cc.find_library(libname, required:false) endif if lib.found() - libs += [ lib ] + libs += lib + if not static_ibverbs + ext_deps += lib + endif else build = false reason = 'missing dependency, "' + libname + '"' subdir_done() endif endforeach +if static_ibverbs + # Build without adding shared libs to Requires.private + ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() + ext_deps += declare_dependency(compile_args: ibv_cflags.split()) + # Add static deps ldflags to internal apps and Libs.private + ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() + ext_deps += declare_dependency(link_args:ibv_ldflags.split()) +endif allow_experimental_apis = true -ext_deps += libs sources = files( 'mlx4.c', 'mlx4_ethdev.c',
Signature · 1 line
2.25.0
PATCH v5 5/6 net/mlx: rename meson variable for dlopen option
In reply to Thomas MonjalonThe name of the variable pmd_dlopen is confusing because it can be understood as true if the PMD is dlopen, whereas it means the ibverbs glue layer is a dlopen library. That's why it is renamed dlopen_ibverbs.
--- drivers/common/mlx5/meson.build | 8 ++++---- drivers/net/mlx4/meson.build | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-)
drivers/common/mlx5/meson.build +4 -4
@@ -8,11 +8,11 @@ if not is_linux endif static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so' LIB_GLUE_VERSION = '20.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
@@ -54,7 +54,7 @@ sources = files( 'mlx5_common.c', 'mlx5_nl.c', ) -if not pmd_dlopen +if not dlopen_ibverbs sources += files('mlx5_glue.c') endif cflags_options = [
@@ -193,7 +193,7 @@ endforeach configure_file(output : 'mlx5_autoconf.h', configuration : config) # Build Glue Library -if pmd_dlopen +if dlopen_ibverbs dlopen_name = 'mlx5_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
drivers/net/mlx4/meson.build +4 -4
@@ -9,11 +9,11 @@ if not is_linux endif static_ibverbs = (get_option('ibverbs_link') == 'static') -pmd_dlopen = (get_option('ibverbs_link') == 'dlopen') +dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen') LIB_GLUE_BASE = 'librte_pmd_mlx4_glue.so' LIB_GLUE_VERSION = '18.02.0' LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION -if pmd_dlopen +if dlopen_ibverbs dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1) cflags += [ '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
@@ -61,7 +61,7 @@ sources = files( 'mlx4_txq.c', 'mlx4_utils.c', ) -if not pmd_dlopen +if not dlopen_ibverbs sources += files('mlx4_glue.c') endif cflags_options = [
@@ -113,7 +113,7 @@ endforeach configure_file(output : 'mlx4_autoconf.h', configuration : config) # Build Glue Library -if pmd_dlopen +if dlopen_ibverbs dlopen_name = 'mlx4_glue' dlopen_lib_name = driver_name_fmt.format(dlopen_name) dlopen_so_version = LIB_GLUE_VERSION
Signature · 1 line
2.25.0
PATCH v5 6/6 net/mlx: fix overlinking with meson and glue dlopen
In reply to Thomas MonjalonIf ibverbs_link is dlopen, the PMD and application should not be linked with ibverbs, but the glue library is. Unfortunately the ibverbs dependency was exported in the variable ext_deps, so there were overlinking.
It is fixed by not exporting the dependency in ext_deps, and recreating a limited dependency object for cflags only.
--- drivers/common/mlx5/meson.build | 6 ++++-- drivers/net/mlx4/meson.build | 6 ++++-- 2 files changed, 8 insertions(+), 4 deletions(-)
drivers/common/mlx5/meson.build +4 -2
@@ -29,7 +29,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else
@@ -38,10 +38,12 @@ foreach libname:libnames subdir_done() endif endforeach -if static_ibverbs +if static_ibverbs or dlopen_ibverbs # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
drivers/net/mlx4/meson.build +4 -2
@@ -30,7 +30,7 @@ foreach libname:libnames endif if lib.found() libs += lib - if not static_ibverbs + if not static_ibverbs and not dlopen_ibverbs ext_deps += lib endif else
@@ -39,10 +39,12 @@ foreach libname:libnames subdir_done() endif endforeach -if static_ibverbs +if static_ibverbs or dlopen_ibverbs # Build without adding shared libs to Requires.private ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout() ext_deps += declare_dependency(compile_args: ibv_cflags.split()) +endif +if static_ibverbs # Add static deps ldflags to internal apps and Libs.private ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout() ext_deps += declare_dependency(link_args:ibv_ldflags.split())
Signature · 1 line
2.25.0
Re: [dpdk-dev] [PATCH v5 0/6] mlx ibverbs linking in meson
In reply to Thomas MonjalonHi,
Quoted 56 lines
-----Original Message-----
From: dev <[email protected]> On Behalf Of Thomas Monjalon
Sent: Thursday, February 13, 2020 12:07 AM
To: [email protected]
Cc: [email protected]
Subject: [dpdk-dev] [PATCH v5 0/6] mlx ibverbs linking in mesonThis is the follow-up of the feature I added one year ago:
static linkage of libibverbs in mlx PMDs.
The first implementation was focused on "make". This second round does the same with "meson".With the meson option
ibverbs_link, only the mode "shared" was working correctly.
This patchset adds the mode "static" and fixes the mode "dlopen".changes in v5:
- fix build if pkg-config/pkgconf is missing (e.g. Windows)changes in v4:
- fix lib ordering
- simplify conditions by usingsubdir_done()changes in v3:
- get cflags with pkg-config invocation
- drop addition of global variablehidden_deps
- remove overlinking in dlopen modechanges in v2:
- split mlx patch for normal addition and workarounds
- fix ldflags for ibverbs installed in a standard directory
- fix libs order leading to undefined references
- add doc forhidden_deps
- improve explanations in commit logsThomas Monjalon (6):
drivers: cleanup meson build variable net/mlx: add static ibverbs linkage with meson
buildtools: get static mlx dependencies for meson net/mlx: workaround static linkage with meson net/mlx: rename meson variable for dlopen option net/mlx: fix overlinking with meson and glue dlopenbuildtools/meson.build | 2 + buildtools/options-ibverbs-static.sh | 11 +- doc/guides/nics/mlx4.rst | 4 + doc/guides/nics/mlx5.rst | 4 + drivers/common/mlx5/meson.build | 314 ++++++++++++++------------- drivers/net/ipn3ke/meson.build | 17 +- drivers/net/mlx4/meson.build | 154 +++++++------ drivers/raw/ifpga/meson.build | 23 +- meson_options.txt | 4 +- 9 files changed, 286 insertions(+), 247 deletions(-)
Quoted 2 lines
--
2.25.0
Series applied to next-net-mlx,
Kindest regards,
Raslan Darawsheh