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'
12 pmd_dlopen = (get_option('ibverbs_link') == 'dlopen')
13 LIB_GLUE_BASE = 'librte_pmd_mlx5_glue.so'
14 LIB_GLUE_VERSION = '19.08.0'
15 LIB_GLUE = LIB_GLUE_BASE + '.' + LIB_GLUE_VERSION
17 dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
19 '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
20 '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
24 libnames = [ 'mlx5', 'ibverbs' ]
26 foreach libname:libnames
27 lib = dependency('lib' + libname, required:false)
29 lib = cc.find_library(libname, required:false)
35 reason = 'missing dependency, "' + libname + '"'
40 allow_experimental_apis = true
62 if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
63 sources += files('mlx5_rxtx_vec.c')
66 sources += files('mlx5_glue.c')
71 '-Wno-strict-prototypes',
76 foreach option:cflags_options
77 if cc.has_argument(option)
81 if get_option('buildtype').contains('debug')
82 cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
84 cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
86 # To maintain the compatibility with the make build system
87 # mlx5_autoconf.h file is still generated.
88 # input array for meson member search:
89 # [ "MACRO to define if found", "header for the search",
90 # "symbol to search", "struct member to search" ]
92 [ 'HAVE_IBV_MLX5_MOD_SWP', 'infiniband/mlx5dv.h',
93 'struct mlx5dv_sw_parsing_caps', 'sw_parsing_offloads' ],
94 [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V42', 'infiniband/verbs.h',
95 'struct ibv_counter_set_init_attr', 'counter_set_id' ],
96 [ 'HAVE_IBV_DEVICE_COUNTERS_SET_V45', 'infiniband/verbs.h',
97 'struct ibv_counters_init_attr', 'comp_mask' ],
99 # input array for meson symbol search:
100 # [ "MACRO to define if found", "header for the search",
101 # "symbol to search" ]
103 [ 'HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT', 'infiniband/mlx5dv.h',
104 'MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX' ],
105 [ 'HAVE_IBV_DEVICE_TUNNEL_SUPPORT', 'infiniband/mlx5dv.h',
106 'MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS' ],
107 [ 'HAVE_IBV_MLX5_MOD_MPW', 'infiniband/mlx5dv.h',
108 'MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED' ],
109 [ 'HAVE_IBV_MLX5_MOD_CQE_128B_COMP', 'infiniband/mlx5dv.h',
110 'MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP' ],
111 [ 'HAVE_IBV_MLX5_MOD_CQE_128B_PAD', 'infiniband/mlx5dv.h',
112 'MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD' ],
113 [ 'HAVE_IBV_FLOW_DV_SUPPORT', 'infiniband/mlx5dv.h',
114 'mlx5dv_create_flow_action_packet_reformat' ],
115 [ 'HAVE_IBV_DEVICE_MPLS_SUPPORT', 'infiniband/verbs.h',
116 'IBV_FLOW_SPEC_MPLS' ],
117 [ 'HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING', 'infiniband/verbs.h',
118 'IBV_WQ_FLAGS_PCI_WRITE_END_PADDING' ],
119 [ 'HAVE_IBV_WQ_FLAG_RX_END_PADDING', 'infiniband/verbs.h',
120 'IBV_WQ_FLAG_RX_END_PADDING' ],
121 [ 'HAVE_IBV_DEVX_OBJ', 'infiniband/mlx5dv.h',
122 'mlx5dv_devx_obj_create' ],
123 [ 'HAVE_IBV_FLOW_DEVX_COUNTERS', 'infiniband/mlx5dv.h',
124 'MLX5DV_FLOW_ACTION_COUNTERS_DEVX' ],
125 [ 'HAVE_IBV_DEVX_ASYNC', 'infiniband/mlx5dv.h',
126 'mlx5dv_devx_obj_query_async' ],
127 [ 'HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR', 'infiniband/mlx5dv.h',
128 'mlx5dv_dr_action_create_dest_devx_tir' ],
129 [ 'HAVE_MLX5DV_DR', 'infiniband/mlx5dv.h',
130 'MLX5DV_DR_DOMAIN_TYPE_NIC_RX' ],
131 [ 'HAVE_MLX5DV_DR_ESWITCH', 'infiniband/mlx5dv.h',
132 'MLX5DV_DR_DOMAIN_TYPE_FDB' ],
133 [ 'HAVE_MLX5DV_DR_VLAN', 'infiniband/mlx5dv.h',
134 'mlx5dv_dr_action_create_push_vlan' ],
135 [ 'HAVE_SUPPORTED_40000baseKR4_Full', 'linux/ethtool.h',
136 'SUPPORTED_40000baseKR4_Full' ],
137 [ 'HAVE_SUPPORTED_40000baseCR4_Full', 'linux/ethtool.h',
138 'SUPPORTED_40000baseCR4_Full' ],
139 [ 'HAVE_SUPPORTED_40000baseSR4_Full', 'linux/ethtool.h',
140 'SUPPORTED_40000baseSR4_Full' ],
141 [ 'HAVE_SUPPORTED_40000baseLR4_Full', 'linux/ethtool.h',
142 'SUPPORTED_40000baseLR4_Full' ],
143 [ 'HAVE_SUPPORTED_56000baseKR4_Full', 'linux/ethtool.h',
144 'SUPPORTED_56000baseKR4_Full' ],
145 [ 'HAVE_SUPPORTED_56000baseCR4_Full', 'linux/ethtool.h',
146 'SUPPORTED_56000baseCR4_Full' ],
147 [ 'HAVE_SUPPORTED_56000baseSR4_Full', 'linux/ethtool.h',
148 'SUPPORTED_56000baseSR4_Full' ],
149 [ 'HAVE_SUPPORTED_56000baseLR4_Full', 'linux/ethtool.h',
150 'SUPPORTED_56000baseLR4_Full' ],
151 [ 'HAVE_ETHTOOL_LINK_MODE_25G', 'linux/ethtool.h',
152 'ETHTOOL_LINK_MODE_25000baseCR_Full_BIT' ],
153 [ 'HAVE_ETHTOOL_LINK_MODE_50G', 'linux/ethtool.h',
154 'ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT' ],
155 [ 'HAVE_ETHTOOL_LINK_MODE_100G', 'linux/ethtool.h',
156 'ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT' ],
157 [ 'HAVE_IFLA_NUM_VF', 'linux/if_link.h',
159 [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h',
161 [ 'HAVE_IFLA_PHYS_SWITCH_ID', 'linux/if_link.h',
162 'IFLA_PHYS_SWITCH_ID' ],
163 [ 'HAVE_IFLA_PHYS_PORT_NAME', 'linux/if_link.h',
164 'IFLA_PHYS_PORT_NAME' ],
165 [ 'HAVE_RDMA_NL_NLDEV', 'rdma/rdma_netlink.h',
167 [ 'HAVE_RDMA_NLDEV_CMD_GET', 'rdma/rdma_netlink.h',
168 'RDMA_NLDEV_CMD_GET' ],
169 [ 'HAVE_RDMA_NLDEV_CMD_PORT_GET', 'rdma/rdma_netlink.h',
170 'RDMA_NLDEV_CMD_PORT_GET' ],
171 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_INDEX', 'rdma/rdma_netlink.h',
172 'RDMA_NLDEV_ATTR_DEV_INDEX' ],
173 [ 'HAVE_RDMA_NLDEV_ATTR_DEV_NAME', 'rdma/rdma_netlink.h',
174 'RDMA_NLDEV_ATTR_DEV_NAME' ],
175 [ 'HAVE_RDMA_NLDEV_ATTR_PORT_INDEX', 'rdma/rdma_netlink.h',
176 'RDMA_NLDEV_ATTR_PORT_INDEX' ],
177 [ 'HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX', 'rdma/rdma_netlink.h',
178 'RDMA_NLDEV_ATTR_NDEV_INDEX' ],
180 config = configuration_data()
181 foreach arg:has_sym_args
182 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
185 foreach arg:has_member_args
186 file_prefix = '#include <' + arg[1] + '>'
187 config.set(arg[0], cc.has_member(arg[2], arg[3],
188 prefix : file_prefix, dependencies: libs))
190 configure_file(output : 'mlx5_autoconf.h', configuration : config)
193 if pmd_dlopen and build
194 dlopen_name = 'mlx5_glue'
195 dlopen_lib_name = driver_name_fmt.format(dlopen_name)
196 dlopen_so_version = LIB_GLUE_VERSION
197 dlopen_sources = files('mlx5_glue.c')
198 dlopen_install_dir = [ eal_pmd_path + '-glue' ]
199 shared_lib = shared_library(
202 include_directories: global_inc,
206 '-Wl,-export-dynamic',
207 '-Wl,-h,@0@'.format(LIB_GLUE),
209 soversion: dlopen_so_version,
211 install_dir: dlopen_install_dir,