1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018 6WIND S.A.
3 # Copyright 2018 Mellanox Technologies, Ltd
7 reason = 'only supported on Linux'
11 static_ibverbs = (get_option('ibverbs_link') == 'static')
12 dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen')
13 LIB_GLUE_BASE = 'librte_net_mlx4_glue.so'
14 LIB_GLUE_VERSION = abi_version
15 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
17 dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
19 '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
20 '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
24 libnames = [ 'mlx4', 'ibverbs' ]
26 foreach libname:libnames
27 lib = dependency('lib' + libname, static:static_ibverbs,
28 required:false, method: 'pkg-config')
29 if not lib.found() and not static_ibverbs
30 lib = cc.find_library(libname, required:false)
34 if not static_ibverbs and not dlopen_ibverbs
39 reason = 'missing dependency, "' + libname + '"'
43 if static_ibverbs or dlopen_ibverbs
44 # Build without adding shared libs to Requires.private
45 ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs').stdout()
46 ext_deps += declare_dependency(compile_args: ibv_cflags.split())
49 # Add static deps ldflags to internal apps and Libs.private
50 ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout()
51 ext_deps += declare_dependency(link_args:ibv_ldflags.split())
67 sources += files('mlx4_glue.c')
71 '-Wno-strict-prototypes',
74 '-D_XOPEN_SOURCE=600',
76 foreach option:cflags_options
77 if cc.has_argument(option)
81 if get_option('buildtype').contains('debug')
82 cflags += [ '-pedantic', '-DPEDANTIC' ]
84 cflags += [ '-UPEDANTIC' ]
86 # input array for meson member search:
87 # [ "MACRO to define if found", "header for the search",
88 # "symbol to search", "struct member to search" ]
91 [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
92 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ],
94 # input array for meson symbol search:
95 # [ "MACRO to define if found", "header for the search",
96 # "symbol to search" ]
98 [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h',
99 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ],
100 [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h',
101 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ],
103 config = configuration_data()
104 foreach arg:has_sym_args
105 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
108 foreach arg:has_member_args
109 file_prefix = '#include <' + arg[1] + '>'
110 config.set(arg[0], cc.has_member(arg[2], arg[3],
111 prefix: file_prefix, dependencies: libs))
113 configure_file(output : 'mlx4_autoconf.h', configuration : config)
117 dlopen_name = 'mlx4_glue'
118 dlopen_lib_name = 'rte_net_' + dlopen_name
119 dlopen_so_version = LIB_GLUE_VERSION
120 dlopen_sources = files('mlx4_glue.c')
121 dlopen_install_dir = [ eal_pmd_path + '-glue' ]
122 shared_lib = shared_library(
125 include_directories: global_inc,
129 '-Wl,-export-dynamic',
130 '-Wl,-h,@0@'.format(LIB_GLUE),
132 soversion: dlopen_so_version,
134 install_dir: dlopen_install_dir,