1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2020 Mellanox Technologies, Ltd
4 includes += include_directories('.')
6 static_ibverbs = (get_option('ibverbs_link') == 'static')
7 dlopen_ibverbs = (get_option('ibverbs_link') == 'dlopen')
8 LIB_GLUE_BASE = 'librte_common_mlx5_glue.so'
9 LIB_GLUE_VERSION = abi_version
10 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
12 dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
14 '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
15 '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
19 libnames = [ 'mlx5', 'ibverbs' ]
21 foreach libname:libnames
22 lib = dependency('lib' + libname, static:static_ibverbs, required:false, method: 'pkg-config')
23 if not lib.found() and not static_ibverbs
24 lib = cc.find_library(libname, required:false)
28 if not static_ibverbs and not dlopen_ibverbs
33 reason = 'missing dependency, "' + libname + '"'
37 if static_ibverbs or dlopen_ibverbs
38 # Build without adding shared libs to Requires.private
39 ibv_cflags = run_command(pkgconf, '--cflags', 'libibverbs', check: true).stdout()
40 ext_deps += declare_dependency(compile_args: ibv_cflags.split())
43 # Add static deps ldflags to internal apps and Libs.private
44 ibv_ldflags = run_command(ldflags_ibverbs_static, check:true).stdout()
45 ext_deps += declare_dependency(link_args:ibv_ldflags.split())
48 sources += files('mlx5_nl.c')
49 sources += files('mlx5_common_auxiliary.c')
50 sources += files('mlx5_common_os.c')
51 sources += files('mlx5_common_verbs.c')
53 sources += files('mlx5_glue.c')
56 deps += ['bus_auxiliary']
58 # input array for meson member search:
59 # [ "MACRO to define if found", "header for the search",
60 # "symbol to search", "struct member to search" ]
62 [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
63 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ],
64 [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h',
65 'struct ibv_counter_set_init_attr', 'counter_set_id' ],
66 [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h',
67 'struct ibv_counters_init_attr', 'comp_mask' ],
68 [ 'HAVE_MLX5DV_DEVX_UAR_OFFSET', 'infiniband/mlx5dv.h',
69 'struct mlx5dv_devx_uar', 'mmap_off' ],
71 # input array for meson symbol search:
72 # [ "MACRO to define if found", "header for the search",
73 # "symbol to search" ]
75 [ 'HAVE_IBV_RELAXED_ORDERING', 'infiniband/verbs.h',
76 'IBV_ACCESS_RELAXED_ORDERING ' ],
77 [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
78 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
79 [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
80 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
81 [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
82 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
83 [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
84 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
85 [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h',
86 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ],
87 [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h',
88 'mlx5dv_create_flow_action_packet_reformat' ],
89 [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
90 'IBV_FLOW_SPEC_MPLS' ],
91 [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h',
92 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ],
93 [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
94 'IBV_WQ_FLAG_RX_END_PADDING' ],
95 [ 'HAVE_MLX5DV_DR_DEVX_PORT', 'infiniband/mlx5dv.h',
96 'mlx5dv_query_devx_port' ],
97 [ 'HAVE_MLX5DV_DR_DEVX_PORT_V35', 'infiniband/mlx5dv.h',
98 'mlx5dv_query_port' ],
99 [ 'HAVE_MLX5DV_DR_CREATE_DEST_IB_PORT', 'infiniband/mlx5dv.h',
100 'mlx5dv_dr_action_create_dest_ib_port' ],
101 [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h',
102 'mlx5dv_devx_obj_create' ],
103 [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
104 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ],
105 [ 'HAVE_MLX5_DR_CREATE_ACTION_DEFAULT_MISS', 'infiniband/mlx5dv.h',
106 'MLX5DV_FLOW_ACTION_DEFAULT_MISS' ],
107 [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h',
108 'mlx5dv_devx_obj_query_async' ],
109 [ 'HAVE_IBV_DEVX_QP', 'infiniband/mlx5dv.h',
110 'mlx5dv_devx_qp_query' ],
111 [ 'HAVE_MLX5DV_PP_ALLOC', 'infiniband/mlx5dv.h',
113 [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h',
114 'mlx5dv_dr_action_create_dest_devx_tir' ],
115 [ 'HAVE_IBV_DEVX_EVENT', 'infiniband/mlx5dv.h',
116 'mlx5dv_devx_get_event' ],
117 [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_METER', 'infiniband/mlx5dv.h',
118 'mlx5dv_dr_action_create_flow_meter' ],
119 [ 'HAVE_MLX5DV_MMAP_GET_NC_PAGES_CMD', 'infiniband/mlx5dv.h',
120 'MLX5_MMAP_GET_NC_PAGES_CMD' ],
121 [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h',
122 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ],
123 [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h',
124 'MLX5DV_DR_DOMAIN_TYPE_FDB' ],
125 [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h',
126 'mlx5dv_dr_action_create_push_vlan' ],
127 [ 'HAVE_IBV_VAR', 'infiniband/mlx5dv.h', 'mlx5dv_alloc_var' ],
128 [ 'HAVE_MLX5_OPCODE_ENHANCED_MPSW', 'infiniband/mlx5dv.h',
129 'MLX5_OPCODE_ENHANCED_MPSW' ],
130 [ 'HAVE_MLX5_OPCODE_SEND_EN', 'infiniband/mlx5dv.h',
131 'MLX5_OPCODE_SEND_EN' ],
132 [ 'HAVE_MLX5_OPCODE_WAIT', 'infiniband/mlx5dv.h',
133 'MLX5_OPCODE_WAIT' ],
134 [ 'HAVE_MLX5_OPCODE_ACCESS_ASO', 'infiniband/mlx5dv.h',
135 'MLX5_OPCODE_ACCESS_ASO' ],
136 [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
137 'SUPPORTED_40000baseKR4_Full' ],
138 [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
139 'SUPPORTED_40000baseCR4_Full' ],
140 [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
141 'SUPPORTED_40000baseSR4_Full' ],
142 [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
143 'SUPPORTED_40000baseLR4_Full' ],
144 [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
145 'SUPPORTED_56000baseKR4_Full' ],
146 [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
147 'SUPPORTED_56000baseCR4_Full' ],
148 [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
149 'SUPPORTED_56000baseSR4_Full' ],
150 [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
151 'SUPPORTED_56000baseLR4_Full' ],
152 [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
153 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
154 [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
155 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
156 [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
157 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
158 [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h',
160 [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h',
162 [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
163 'IFLA_PHYS_SWITCH_ID' ],
164 [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
165 'IFLA_PHYS_PORT_NAME' ],
166 [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h',
168 [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h',
169 'RDMA_NLDEV_CMD_GET' ],
170 [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
171 'RDMA_NLDEV_CMD_PORT_GET' ],
172 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
173 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
174 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
175 'RDMA_NLDEV_ATTR_DEV_NAME' ],
176 [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
177 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
178 [ 'HAVE_RDMA_NLDEV_ATTR_PORT_STATE', 'rdma/rdma_netlink.h',
179 'RDMA_NLDEV_ATTR_PORT_STATE' ],
180 [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
181 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
182 [ 'HAVE_MLX5_DR_FLOW_DUMP', 'infiniband/mlx5dv.h',
183 'mlx5dv_dump_dr_domain'],
184 [ 'HAVE_MLX5_DR_CREATE_ACTION_FLOW_SAMPLE', 'infiniband/mlx5dv.h',
185 'mlx5dv_dr_action_create_flow_sampler'],
186 [ 'HAVE_MLX5DV_DR_MEM_RECLAIM', 'infiniband/mlx5dv.h',
187 'mlx5dv_dr_domain_set_reclaim_device_memory'],
188 [ 'HAVE_MLX5_DR_CREATE_ACTION_DEST_ARRAY', 'infiniband/mlx5dv.h',
189 'mlx5dv_dr_action_create_dest_array'],
190 [ 'HAVE_DEVLINK', 'linux/devlink.h', 'DEVLINK_GENL_NAME' ],
191 [ 'HAVE_MLX5_DR_CREATE_ACTION_ASO', 'infiniband/mlx5dv.h',
192 'mlx5dv_dr_action_create_aso' ],
193 [ 'HAVE_INFINIBAND_VERBS_H', 'infiniband/verbs.h',
194 'INFINIBAND_VERBS_H' ],
195 [ 'HAVE_MLX5_UMR_IMKEY', 'infiniband/mlx5dv.h',
196 'MLX5_WQE_UMR_CTRL_FLAG_INLINE' ],
197 [ 'HAVE_MLX5_DR_FLOW_DUMP_RULE', 'infiniband/mlx5dv.h',
198 'mlx5dv_dump_dr_rule' ],
199 [ 'HAVE_MLX5_DR_ACTION_ASO_CT', 'infiniband/mlx5dv.h',
200 'MLX5DV_DR_ACTION_FLAGS_ASO_CT_DIRECTION_INITIATOR' ],
201 [ 'HAVE_MLX5_DR_ALLOW_DUPLICATE', 'infiniband/mlx5dv.h',
202 'mlx5dv_dr_domain_allow_duplicate_rules' ],
203 [ 'HAVE_MLX5_IBV_REG_MR_IOVA', 'infiniband/verbs.h',
205 [ 'HAVE_MLX5_IBV_IMPORT_CTX_PD_AND_MR', 'infiniband/verbs.h',
206 'ibv_import_device' ],
208 config = configuration_data()
209 foreach arg:has_sym_args
210 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2], dependencies: libs))
212 foreach arg:has_member_args
213 file_prefix = '#include <' + arg[1] + '>'
214 config.set(arg[0], cc.has_member(arg[2], arg[3], prefix : file_prefix, dependencies: libs))
216 configure_file(output : 'mlx5_autoconf.h', configuration : config)
220 dlopen_name = 'mlx5_glue'
221 dlopen_lib_name = 'rte_common_' + dlopen_name
222 dlopen_so_version = LIB_GLUE_VERSION
223 dlopen_sources = files('mlx5_glue.c')
224 dlopen_install_dir = [ eal_pmd_path + '-glue' ]
225 dlopen_includes = [global_inc]
226 dlopen_includes += include_directories('../../../../lib/eal/include/generic')
227 shared_lib = shared_library(
230 include_directories: dlopen_includes,
234 '-Wl,-export-dynamic',
235 '-Wl,-h,@0@'.format(LIB_GLUE),
237 soversion: dlopen_so_version,
239 install_dir: dlopen_install_dir,