net/qede: fix odd number of queues usage in 100G mode
[dpdk.git] / drivers / net / mlx5 / meson.build
1 # SPDX-License-Identifier: BSD-3-Clause
2 # Copyright 2018 6WIND S.A.
3 # Copyright 2018 Mellanox Technologies, Ltd
4
5 if not is_linux
6         build = false
7         reason = 'only supported on Linux'
8         subdir_done()
9 endif
10 build = true
11
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
16 if pmd_dlopen
17         dpdk_conf.set('RTE_IBVERBS_LINK_DLOPEN', 1)
18         cflags += [
19                 '-DMLX5_GLUE="@0@"'.format(LIB_GLUE),
20                 '-DMLX5_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
21         ]
22 endif
23
24 libnames = [ 'mlx5', 'ibverbs' ]
25 libs = []
26 foreach libname:libnames
27         lib = dependency('lib' + libname, required:false)
28         if not lib.found()
29                 lib = cc.find_library(libname, required:false)
30         endif
31         if lib.found()
32                 libs += [ lib ]
33         else
34                 build = false
35                 reason = 'missing dependency, "' + libname + '"'
36         endif
37 endforeach
38
39 if build
40         allow_experimental_apis = true
41         ext_deps += libs
42         sources = files(
43                 'mlx5.c',
44                 'mlx5_ethdev.c',
45                 'mlx5_flow.c',
46                 'mlx5_flow_dv.c',
47                 'mlx5_flow_verbs.c',
48                 'mlx5_mac.c',
49                 'mlx5_mr.c',
50                 'mlx5_nl.c',
51                 'mlx5_rss.c',
52                 'mlx5_rxmode.c',
53                 'mlx5_rxq.c',
54                 'mlx5_rxtx.c',
55                 'mlx5_mp.c',
56                 'mlx5_stats.c',
57                 'mlx5_trigger.c',
58                 'mlx5_txq.c',
59                 'mlx5_vlan.c',
60                 'mlx5_devx_cmds.c',
61         )
62         if dpdk_conf.has('RTE_ARCH_X86_64') or dpdk_conf.has('RTE_ARCH_ARM64')
63                 sources += files('mlx5_rxtx_vec.c')
64         endif
65         if not pmd_dlopen
66                 sources += files('mlx5_glue.c')
67         endif
68         cflags_options = [
69                 '-Wextra',
70                 '-std=c11',
71                 '-Wno-strict-prototypes',
72                 '-D_BSD_SOURCE',
73                 '-D_DEFAULT_SOURCE',
74                 '-D_XOPEN_SOURCE=600'
75         ]
76         foreach option:cflags_options
77                 if cc.has_argument(option)
78                         cflags += option
79                 endif
80         endforeach
81         if get_option('buildtype').contains('debug')
82                 cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
83         else
84                 cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
85         endif
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" ]
91         has_member_args = [
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' ],
98         ]
99         # input array for meson symbol search:
100         # [ "MACRO to define if found", "header for the search",
101         #   "symbol to search" ]
102         has_sym_args = [
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',
158                 'IFLA_NUM_VF' ],
159                 [ 'HAVE_IFLA_EXT_MASK', 'linux/if_link.h',
160                 'IFLA_EXT_MASK' ],
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',
166                 'RDMA_NL_NLDEV' ],
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' ],
179         ]
180         config = configuration_data()
181         foreach arg:has_sym_args
182                 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
183                         dependencies: libs))
184         endforeach
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))
189         endforeach
190         configure_file(output : 'mlx5_autoconf.h', configuration : config)
191 endif
192 # Build Glue Library
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(
200                 dlopen_lib_name,
201                 dlopen_sources,
202                 include_directories: global_inc,
203                 c_args: cflags,
204                 dependencies: libs,
205                 link_args: [
206                 '-Wl,-export-dynamic',
207                 '-Wl,-h,@0@'.format(LIB_GLUE),
208                 ],
209                 soversion: dlopen_so_version,
210                 install: true,
211                 install_dir: dlopen_install_dir,
212         )
213 endif