1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018 6WIND S.A.
3 # Copyright 2018 Mellanox Technologies, Ltd
5 pmd_dlopen = (get_option('ibverbs_link') == 'dlopen')
6 LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
7 LIB_GLUE_VERSION = '19.02.0'
8 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
10 dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
12 '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
13 '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
17 dependency('libmnl', required:false),
18 dependency('libmlx5', required:false),
19 dependency('libibverbs', required:false),
28 allow_experimental_apis = true
51 if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
52 sources += files('mlx5_rxtx_vec.c')
55 sources += files('mlx5_glue.c')
60 '-Wno-strict-prototypes',
65 foreach option:cflags_options
66 if cc.has_argument(option)
70 if get_option('buildtype').contains('debug')
71 cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
73 cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
75 # To maintain the compatibility with the make build system
76 # mlx5_autoconf.h file is still generated.
77 # input array for meson member search:
78 # [ "MACRO to define if found", "header for the search",
79 # "symbol to search", "struct member to search" ]
81 [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
82 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ],
83 [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h',
84 'struct ibv_counter_set_init_attr', 'counter_set_id' ],
85 [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h',
86 'struct ibv_counters_init_attr', 'comp_mask' ],
88 # input array for meson symbol search:
89 # [ "MACRO to define if found", "header for the search",
90 # "symbol to search" ]
92 [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
93 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
94 [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
95 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
96 [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
97 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
98 [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
99 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
100 [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h',
101 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ],
102 [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h',
103 'mlx5dv_create_flow_action_packet_reformat' ],
104 [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
105 'IBV_FLOW_SPEC_MPLS' ],
106 [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h',
107 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ],
108 [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
109 'IBV_WQ_FLAG_RX_END_PADDING' ],
110 [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h',
111 'mlx5dv_devx_obj_create' ],
112 [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
113 'MLX5DV_FLOW_ACTION_COUNTER_DEVX' ],
114 [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
115 'SUPPORTED_40000baseKR4_Full' ],
116 [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
117 'SUPPORTED_40000baseCR4_Full' ],
118 [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
119 'SUPPORTED_40000baseSR4_Full' ],
120 [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
121 'SUPPORTED_40000baseLR4_Full' ],
122 [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
123 'SUPPORTED_56000baseKR4_Full' ],
124 [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
125 'SUPPORTED_56000baseCR4_Full' ],
126 [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
127 'SUPPORTED_56000baseSR4_Full' ],
128 [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
129 'SUPPORTED_56000baseLR4_Full' ],
130 [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
131 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
132 [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
133 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
134 [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
135 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
136 [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
137 'IFLA_PHYS_SWITCH_ID' ],
138 [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
139 'IFLA_PHYS_PORT_NAME' ],
140 [ 'HAVE_IFLA_VXLAN_COLLECT_METADATA', 'linux/if_link.h',
141 'IFLA_VXLAN_COLLECT_METADATA' ],
142 [ 'HAVE_TCA_CHAIN', 'linux/rtnetlink.h',
144 [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h',
146 [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h',
147 'TCA_FLOWER_FLAGS' ],
148 [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h',
149 'TCA_FLOWER_KEY_ETH_TYPE' ],
150 [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h',
151 'TCA_FLOWER_KEY_ETH_DST' ],
152 [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
153 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
154 [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h',
155 'TCA_FLOWER_KEY_ETH_SRC' ],
156 [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
157 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
158 [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h',
159 'TCA_FLOWER_KEY_IP_PROTO' ],
160 [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h',
161 'TCA_FLOWER_KEY_IPV4_SRC' ],
162 [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
163 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
164 [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h',
165 'TCA_FLOWER_KEY_IPV4_DST' ],
166 [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
167 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
168 [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h',
169 'TCA_FLOWER_KEY_IPV6_SRC' ],
170 [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
171 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
172 [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h',
173 'TCA_FLOWER_KEY_IPV6_DST' ],
174 [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
175 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
176 [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h',
177 'TCA_FLOWER_KEY_TCP_SRC' ],
178 [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
179 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
180 [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h',
181 'TCA_FLOWER_KEY_TCP_DST' ],
182 [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
183 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
184 [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h',
185 'TCA_FLOWER_KEY_UDP_SRC' ],
186 [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
187 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
188 [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h',
189 'TCA_FLOWER_KEY_UDP_DST' ],
190 [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
191 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
192 [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h',
193 'TCA_FLOWER_KEY_VLAN_ID' ],
194 [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h',
195 'TCA_FLOWER_KEY_VLAN_PRIO' ],
196 [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
197 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
198 [ 'HAVE_TCA_FLOWER_KEY_TCP_FLAGS', 'linux/pkt_cls.h',
199 'TCA_FLOWER_KEY_TCP_FLAGS' ],
200 [ 'HAVE_TCA_FLOWER_KEY_TCP_FLAGS_MASK', 'linux/pkt_cls.h',
201 'TCA_FLOWER_KEY_TCP_FLAGS_MASK' ],
202 [ 'HAVE_TCA_FLOWER_KEY_IP_TOS', 'linux/pkt_cls.h',
203 'TCA_FLOWER_KEY_IP_TOS' ],
204 [ 'HAVE_TCA_FLOWER_KEY_IP_TOS_MASK', 'linux/pkt_cls.h',
205 'TCA_FLOWER_KEY_IP_TOS_MASK' ],
206 [ 'HAVE_TCA_FLOWER_KEY_IP_TTL', 'linux/pkt_cls.h',
207 'TCA_FLOWER_KEY_IP_TTL' ],
208 [ 'HAVE_TCA_FLOWER_KEY_IP_TTL_MASK', 'linux/pkt_cls.h',
209 'TCA_FLOWER_KEY_IP_TTL_MASK' ],
210 [ 'HAVE_TC_ACT_GOTO_CHAIN', 'linux/pkt_cls.h',
211 'TC_ACT_GOTO_CHAIN' ],
212 [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h',
213 'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
214 [ 'HAVE_TCA_FLOWER_KEY_ENC_KEY_ID', 'linux/pkt_cls.h',
215 'TCA_FLOWER_KEY_ENC_KEY_ID' ],
216 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC', 'linux/pkt_cls.h',
217 'TCA_FLOWER_KEY_ENC_IPV4_SRC' ],
218 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK', 'linux/pkt_cls.h',
219 'TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK' ],
220 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST', 'linux/pkt_cls.h',
221 'TCA_FLOWER_KEY_ENC_IPV4_DST' ],
222 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST_MASK', 'linux/pkt_cls.h',
223 'TCA_FLOWER_KEY_ENC_IPV4_DST_MASK' ],
224 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC', 'linux/pkt_cls.h',
225 'TCA_FLOWER_KEY_ENC_IPV6_SRC' ],
226 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK', 'linux/pkt_cls.h',
227 'TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK' ],
228 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST', 'linux/pkt_cls.h',
229 'TCA_FLOWER_KEY_ENC_IPV6_DST' ],
230 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST_MASK', 'linux/pkt_cls.h',
231 'TCA_FLOWER_KEY_ENC_IPV6_DST_MASK' ],
232 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT', 'linux/pkt_cls.h',
233 'TCA_FLOWER_KEY_ENC_UDP_SRC_PORT' ],
234 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK', 'linux/pkt_cls.h',
235 'TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK' ],
236 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT', 'linux/pkt_cls.h',
237 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT' ],
238 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK', 'linux/pkt_cls.h',
239 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK' ],
240 [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TOS', 'linux/pkt_cls.h',
241 'TCA_FLOWER_KEY_ENC_IP_TOS' ],
242 [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TOS_MASK', 'linux/pkt_cls.h',
243 'TCA_FLOWER_KEY_ENC_IP_TOS_MASK' ],
244 [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TTL', 'linux/pkt_cls.h',
245 'TCA_FLOWER_KEY_ENC_IP_TTL' ],
246 [ 'HAVE_TCA_FLOWER_KEY_ENC_IP_TTL_MASK', 'linux/pkt_cls.h',
247 'TCA_FLOWER_KEY_ENC_IP_TTL_MASK' ],
248 [ 'HAVE_TC_ACT_TUNNEL_KEY', 'linux/tc_act/tc_tunnel_key.h',
249 'TCA_ACT_TUNNEL_KEY' ],
250 [ 'HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT', 'linux/tc_act/tc_tunnel_key.h',
251 'TCA_TUNNEL_KEY_ENC_DST_PORT' ],
252 [ 'HAVE_TCA_TUNNEL_KEY_ENC_TOS', 'linux/tc_act/tc_tunnel_key.h',
253 'TCA_TUNNEL_KEY_ENC_TOS' ],
254 [ 'HAVE_TCA_TUNNEL_KEY_ENC_TTL', 'linux/tc_act/tc_tunnel_key.h',
255 'TCA_TUNNEL_KEY_ENC_TTL' ],
256 [ 'HAVE_TCA_TUNNEL_KEY_NO_CSUM', 'linux/tc_act/tc_tunnel_key.h',
257 'TCA_TUNNEL_KEY_NO_CSUM' ],
258 [ 'HAVE_TC_ACT_PEDIT', 'linux/tc_act/tc_pedit.h',
259 'TCA_PEDIT_KEY_EX_HDR_TYPE_UDP' ],
260 [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h',
262 [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h',
263 'RDMA_NLDEV_CMD_GET' ],
264 [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
265 'RDMA_NLDEV_CMD_PORT_GET' ],
266 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
267 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
268 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
269 'RDMA_NLDEV_ATTR_DEV_NAME' ],
270 [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
271 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
272 [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
273 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
275 config = configuration_data()
276 foreach arg:has_sym_args
277 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2]))
279 foreach arg:has_member_args
280 file_prefix = '#include<' + arg[1] + '>'
281 config.set(arg[0], cc.has_member(arg[2], arg[3],
282 prefix : file_prefix))
284 configure_file(output : 'mlx5_autoconf.h', configuration : config)
287 if pmd_dlopen and build
288 dlopen_name = 'mlx5_glue'
289 dlopen_lib_name = driver_name_fmt.format(dlopen_name)
290 dlopen_so_version = LIB_GLUE_VERSION
291 dlopen_sources = files('mlx5_glue.c')
292 dlopen_install_dir = [ eal_pmd_path + '-glue' ]
293 shared_lib = shared_library(
296 include_directories: global_inc,
300 '-Wl,-export-dynamic',
301 '-Wl,-h,@0@'.format(LIB_GLUE),
303 soversion: dlopen_so_version,
305 install_dir: dlopen_install_dir,