1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018 6WIND S.A.
3 # Copyright 2018 Mellanox Technologies, Ltd
5 pmd_dlopen = get_option('enable_driver_mlx_glue')
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_LIBRTE_MLX5_DLOPEN_DEPS', 1)
12 '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
13 '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
17 cc.find_library('mnl', required:false),
18 cc.find_library('mlx5', required:false),
19 cc.find_library('ibverbs', 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_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
107 'IBV_WQ_FLAG_RX_END_PADDING' ],
108 [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h',
109 'mlx5dv_devx_obj_create' ],
110 [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
111 'MLX5DV_FLOW_ACTION_COUNTER_DEVX' ],
112 [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
113 'SUPPORTED_40000baseKR4_Full' ],
114 [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
115 'SUPPORTED_40000baseCR4_Full' ],
116 [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
117 'SUPPORTED_40000baseSR4_Full' ],
118 [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
119 'SUPPORTED_40000baseLR4_Full' ],
120 [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
121 'SUPPORTED_56000baseKR4_Full' ],
122 [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
123 'SUPPORTED_56000baseCR4_Full' ],
124 [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
125 'SUPPORTED_56000baseSR4_Full' ],
126 [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
127 'SUPPORTED_56000baseLR4_Full' ],
128 [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
129 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
130 [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
131 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
132 [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
133 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
134 [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
135 'IFLA_PHYS_SWITCH_ID' ],
136 [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
137 'IFLA_PHYS_PORT_NAME' ],
138 [ 'HAVE_IFLA_VXLAN_COLLECT_METADATA', 'linux/if_link.h',
139 'IFLA_VXLAN_COLLECT_METADATA' ],
140 [ 'HAVE_TCA_CHAIN', 'linux/rtnetlink.h',
142 [ 'HAVE_TCA_FLOWER_ACT', 'linux/pkt_cls.h',
144 [ 'HAVE_TCA_FLOWER_FLAGS', 'linux/pkt_cls.h',
145 'TCA_FLOWER_FLAGS' ],
146 [ 'HAVE_TCA_FLOWER_KEY_ETH_TYPE', 'linux/pkt_cls.h',
147 'TCA_FLOWER_KEY_ETH_TYPE' ],
148 [ 'HAVE_TCA_FLOWER_KEY_ETH_DST', 'linux/pkt_cls.h',
149 'TCA_FLOWER_KEY_ETH_DST' ],
150 [ 'HAVE_TCA_FLOWER_KEY_ETH_DST_MASK', 'linux/pkt_cls.h',
151 'TCA_FLOWER_KEY_ETH_DST_MASK' ],
152 [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC', 'linux/pkt_cls.h',
153 'TCA_FLOWER_KEY_ETH_SRC' ],
154 [ 'HAVE_TCA_FLOWER_KEY_ETH_SRC_MASK', 'linux/pkt_cls.h',
155 'TCA_FLOWER_KEY_ETH_SRC_MASK' ],
156 [ 'HAVE_TCA_FLOWER_KEY_IP_PROTO', 'linux/pkt_cls.h',
157 'TCA_FLOWER_KEY_IP_PROTO' ],
158 [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC', 'linux/pkt_cls.h',
159 'TCA_FLOWER_KEY_IPV4_SRC' ],
160 [ 'HAVE_TCA_FLOWER_KEY_IPV4_SRC_MASK', 'linux/pkt_cls.h',
161 'TCA_FLOWER_KEY_IPV4_SRC_MASK' ],
162 [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST', 'linux/pkt_cls.h',
163 'TCA_FLOWER_KEY_IPV4_DST' ],
164 [ 'HAVE_TCA_FLOWER_KEY_IPV4_DST_MASK', 'linux/pkt_cls.h',
165 'TCA_FLOWER_KEY_IPV4_DST_MASK' ],
166 [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC', 'linux/pkt_cls.h',
167 'TCA_FLOWER_KEY_IPV6_SRC' ],
168 [ 'HAVE_TCA_FLOWER_KEY_IPV6_SRC_MASK', 'linux/pkt_cls.h',
169 'TCA_FLOWER_KEY_IPV6_SRC_MASK' ],
170 [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST', 'linux/pkt_cls.h',
171 'TCA_FLOWER_KEY_IPV6_DST' ],
172 [ 'HAVE_TCA_FLOWER_KEY_IPV6_DST_MASK', 'linux/pkt_cls.h',
173 'TCA_FLOWER_KEY_IPV6_DST_MASK' ],
174 [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC', 'linux/pkt_cls.h',
175 'TCA_FLOWER_KEY_TCP_SRC' ],
176 [ 'HAVE_TCA_FLOWER_KEY_TCP_SRC_MASK', 'linux/pkt_cls.h',
177 'TCA_FLOWER_KEY_TCP_SRC_MASK' ],
178 [ 'HAVE_TCA_FLOWER_KEY_TCP_DST', 'linux/pkt_cls.h',
179 'TCA_FLOWER_KEY_TCP_DST' ],
180 [ 'HAVE_TCA_FLOWER_KEY_TCP_DST_MASK', 'linux/pkt_cls.h',
181 'TCA_FLOWER_KEY_TCP_DST_MASK' ],
182 [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC', 'linux/pkt_cls.h',
183 'TCA_FLOWER_KEY_UDP_SRC' ],
184 [ 'HAVE_TCA_FLOWER_KEY_UDP_SRC_MASK', 'linux/pkt_cls.h',
185 'TCA_FLOWER_KEY_UDP_SRC_MASK' ],
186 [ 'HAVE_TCA_FLOWER_KEY_UDP_DST', 'linux/pkt_cls.h',
187 'TCA_FLOWER_KEY_UDP_DST' ],
188 [ 'HAVE_TCA_FLOWER_KEY_UDP_DST_MASK', 'linux/pkt_cls.h',
189 'TCA_FLOWER_KEY_UDP_DST_MASK' ],
190 [ 'HAVE_TCA_FLOWER_KEY_VLAN_ID', 'linux/pkt_cls.h',
191 'TCA_FLOWER_KEY_VLAN_ID' ],
192 [ 'HAVE_TCA_FLOWER_KEY_VLAN_PRIO', 'linux/pkt_cls.h',
193 'TCA_FLOWER_KEY_VLAN_PRIO' ],
194 [ 'HAVE_TCA_FLOWER_KEY_VLAN_ETH_TYPE', 'linux/pkt_cls.h',
195 'TCA_FLOWER_KEY_VLAN_ETH_TYPE' ],
196 [ 'HAVE_TCA_FLOWER_KEY_TCP_FLAGS', 'linux/pkt_cls.h',
197 'TCA_FLOWER_KEY_TCP_FLAGS' ],
198 [ 'HAVE_TCA_FLOWER_KEY_TCP_FLAGS_MASK', 'linux/pkt_cls.h',
199 'TCA_FLOWER_KEY_TCP_FLAGS_MASK' ],
200 [ 'HAVE_TC_ACT_GOTO_CHAIN', 'linux/pkt_cls.h',
201 'TC_ACT_GOTO_CHAIN' ],
202 [ 'HAVE_TC_ACT_VLAN', 'linux/tc_act/tc_vlan.h',
203 'TCA_VLAN_PUSH_VLAN_PRIORITY' ],
204 [ 'HAVE_TCA_FLOWER_KEY_ENC_KEY_ID', 'linux/pkt_cls.h',
205 'TCA_FLOWER_KEY_ENC_KEY_ID' ],
206 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC', 'linux/pkt_cls.h',
207 'TCA_FLOWER_KEY_ENC_IPV4_SRC' ],
208 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK', 'linux/pkt_cls.h',
209 'TCA_FLOWER_KEY_ENC_IPV4_SRC_MASK' ],
210 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST', 'linux/pkt_cls.h',
211 'TCA_FLOWER_KEY_ENC_IPV4_DST' ],
212 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV4_DST_MASK', 'linux/pkt_cls.h',
213 'TCA_FLOWER_KEY_ENC_IPV4_DST_MASK' ],
214 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC', 'linux/pkt_cls.h',
215 'TCA_FLOWER_KEY_ENC_IPV6_SRC' ],
216 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK', 'linux/pkt_cls.h',
217 'TCA_FLOWER_KEY_ENC_IPV6_SRC_MASK' ],
218 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST', 'linux/pkt_cls.h',
219 'TCA_FLOWER_KEY_ENC_IPV6_DST' ],
220 [ 'HAVE_TCA_FLOWER_KEY_ENC_IPV6_DST_MASK', 'linux/pkt_cls.h',
221 'TCA_FLOWER_KEY_ENC_IPV6_DST_MASK' ],
222 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT', 'linux/pkt_cls.h',
223 'TCA_FLOWER_KEY_ENC_UDP_SRC_PORT' ],
224 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK', 'linux/pkt_cls.h',
225 'TCA_FLOWER_KEY_ENC_UDP_SRC_PORT_MASK' ],
226 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT', 'linux/pkt_cls.h',
227 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT' ],
228 [ 'HAVE_TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK', 'linux/pkt_cls.h',
229 'TCA_FLOWER_KEY_ENC_UDP_DST_PORT_MASK' ],
230 [ 'HAVE_TC_ACT_TUNNEL_KEY', 'linux/tc_act/tc_tunnel_key.h',
231 'TCA_ACT_TUNNEL_KEY' ],
232 [ 'HAVE_TCA_TUNNEL_KEY_ENC_DST_PORT', 'linux/tc_act/tc_tunnel_key.h',
233 'TCA_TUNNEL_KEY_ENC_DST_PORT' ],
234 [ 'HAVE_TCA_TUNNEL_KEY_NO_CSUM', 'linux/tc_act/tc_tunnel_key.h',
235 'TCA_TUNNEL_KEY_NO_CSUM' ],
236 [ 'HAVE_TC_ACT_PEDIT', 'linux/tc_act/tc_pedit.h',
237 'TCA_PEDIT_KEY_EX_HDR_TYPE_UDP' ],
238 [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h',
240 [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h',
241 'RDMA_NLDEV_CMD_GET' ],
242 [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
243 'RDMA_NLDEV_CMD_PORT_GET' ],
244 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
245 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
246 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
247 'RDMA_NLDEV_ATTR_DEV_NAME' ],
248 [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
249 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
250 [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
251 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
253 config = configuration_data()
254 foreach arg:has_sym_args
255 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2]))
257 foreach arg:has_member_args
258 file_prefix = '#include<' + arg[1] + '>'
259 config.set(arg[0], cc.has_member(arg[2], arg[3],
260 prefix : file_prefix))
262 configure_file(output : 'mlx5_autoconf.h', configuration : config)
265 if pmd_dlopen and build
266 dlopen_name = 'mlx5_glue'
267 dlopen_lib_name = driver_name_fmt.format(dlopen_name)
268 dlopen_so_version = LIB_GLUE_VERSION
269 dlopen_sources = files('mlx5_glue.c')
270 dlopen_install_dir = [ eal_pmd_path + '-glue' ]
271 shared_lib = shared_library(
274 include_directories: global_inc,
278 '-Wl,-export-dynamic',
279 '-Wl,-h,@0@'.format(LIB_GLUE),
281 soversion: dlopen_so_version,
283 install_dir: dlopen_install_dir,