net/mlx5: add VLAN push/pop DR commands to glue
[dpdk.git] / drivers / net / mlx4 / 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_mlx4_glue.so'
14 LIB_GLUE_VERSION = '18.02.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                 '-DMLX4_GLUE="@0@"'.format(LIB_GLUE),
20                 '-DMLX4_GLUE_VERSION="@0@"'.format(LIB_GLUE_VERSION),
21         ]
22 endif
23
24 libnames = [ 'mnl', 'mlx4', '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                 'mlx4.c',
44                 'mlx4_ethdev.c',
45                 'mlx4_flow.c',
46                 'mlx4_intr.c',
47                 'mlx4_mp.c',
48                 'mlx4_mr.c',
49                 'mlx4_rxq.c',
50                 'mlx4_rxtx.c',
51                 'mlx4_txq.c',
52                 'mlx4_utils.c',
53         )
54         if not pmd_dlopen
55                 sources += files('mlx4_glue.c')
56         endif
57         cflags_options = [
58                 '-Wextra',
59                 '-std=c11',
60                 '-Wno-strict-prototypes',
61                 '-D_BSD_SOURCE',
62                 '-D_DEFAULT_SOURCE',
63                 '-D_XOPEN_SOURCE=600'
64         ]
65         foreach option:cflags_options
66                 if cc.has_argument(option)
67                         cflags += option
68                 endif
69         endforeach
70         if get_option('buildtype').contains('debug')
71                 cflags += [ '-pedantic', '-UNDEBUG', '-DPEDANTIC' ]
72         else
73                 cflags += [ '-DNDEBUG', '-UPEDANTIC' ]
74         endif
75         # To maintain the compatibility with the make build system
76         # mlx4_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" ]
80         #
81         has_member_args = [
82                 [ 'HAVE_IBV_MLX4_WQE_LSO_SEG', 'infiniband/mlx4dv.h',
83                 'struct mlx4_wqe_lso_seg', 'mss_hdr_size' ],
84         ]
85         # input array for meson symbol search:
86         # [ "MACRO to define if found", "header for the search",
87         #   "symbol to search" ]
88         has_sym_args = [
89                 [ 'HAVE_IBV_MLX4_BUF_ALLOCATORS', 'infiniband/mlx4dv.h',
90                 'MLX4DV_SET_CTX_ATTR_BUF_ALLOCATORS' ],
91                 [ 'HAVE_IBV_MLX4_UAR_MMAP_OFFSET', 'infiniband/mlx4dv.h',
92                 'MLX4DV_QP_MASK_UAR_MMAP_OFFSET' ],
93         ]
94         config = configuration_data()
95         foreach arg:has_sym_args
96                 config.set(arg[0], cc.has_header_symbol(arg[1], arg[2],
97                         dependencies: libs))
98         endforeach
99         foreach arg:has_member_args
100                 file_prefix = '#include <' + arg[1] + '>'
101                 config.set(arg[0], cc.has_member(arg[2], arg[3],
102                         prefix: file_prefix, dependencies: libs))
103         endforeach
104         configure_file(output : 'mlx4_autoconf.h', configuration : config)
105 endif
106 # Build Glue Library
107 if pmd_dlopen and build
108         dlopen_name = 'mlx4_glue'
109         dlopen_lib_name = driver_name_fmt.format(dlopen_name)
110         dlopen_so_version = LIB_GLUE_VERSION
111         dlopen_sources = files('mlx4_glue.c')
112         dlopen_install_dir = [ eal_pmd_path + '-glue' ]
113         shared_lib = shared_library(
114                 dlopen_lib_name,
115                 dlopen_sources,
116                 include_directories: global_inc,
117                 c_args: cflags,
118                 dependencies: libs,
119                 link_args: [
120                 '-Wl,-export-dynamic',
121                 '-Wl,-h,@0@'.format(LIB_GLUE),
122                 ],
123                 soversion: dlopen_so_version,
124                 install: true,
125                 install_dir: dlopen_install_dir,
126         )
127 endif