net/mlx: fix debug build with icc
[dpdk.git] / drivers / net / mlx5 / Makefile
1 #   SPDX-License-Identifier: BSD-3-Clause
2 #   Copyright 2015 6WIND S.A.
3 #   Copyright 2015 Mellanox Technologies, Ltd
4
5 include $(RTE_SDK)/mk/rte.vars.mk
6
7 # Library name.
8 LIB = librte_pmd_mlx5.a
9 LIB_GLUE = $(LIB_GLUE_BASE).$(LIB_GLUE_VERSION)
10 LIB_GLUE_BASE = librte_pmd_mlx5_glue.so
11 LIB_GLUE_VERSION = 19.08.0
12
13 # Sources.
14 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5.c
15 ifneq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
16 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_glue.c
17 endif
18 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxq.c
19 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_txq.c
20 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxtx.c
21 ifneq ($(filter y,$(CONFIG_RTE_ARCH_X86_64) \
22                         $(CONFIG_RTE_ARCH_PPC_64) \
23                   $(CONFIG_RTE_ARCH_ARM64)),)
24 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxtx_vec.c
25 endif
26 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_trigger.c
27 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_ethdev.c
28 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mac.c
29 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxmode.c
30 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_vlan.c
31 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_stats.c
32 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rss.c
33 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mr.c
34 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow.c
35 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow_dv.c
36 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_flow_verbs.c
37 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mp.c
38 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_nl.c
39 SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_devx_cmds.c
40
41 ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
42 INSTALL-$(CONFIG_RTE_LIBRTE_MLX5_PMD)-lib += $(LIB_GLUE)
43 endif
44
45 # Basic CFLAGS.
46 CFLAGS += -O3
47 CFLAGS += -std=c11 -Wall -Wextra
48 CFLAGS += -g
49 CFLAGS += -I.
50 CFLAGS += -D_BSD_SOURCE
51 CFLAGS += -D_DEFAULT_SOURCE
52 CFLAGS += -D_XOPEN_SOURCE=600
53 CFLAGS += $(WERROR_FLAGS)
54 CFLAGS += -Wno-strict-prototypes
55 ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
56 CFLAGS += -DMLX5_GLUE='"$(LIB_GLUE)"'
57 CFLAGS += -DMLX5_GLUE_VERSION='"$(LIB_GLUE_VERSION)"'
58 CFLAGS_mlx5_glue.o += -fPIC
59 LDLIBS += -ldl
60 else ifeq ($(CONFIG_RTE_IBVERBS_LINK_STATIC),y)
61 LDLIBS += $(shell $(RTE_SDK)/buildtools/options-ibverbs-static.sh)
62 else
63 LDLIBS += -libverbs -lmlx5
64 endif
65 LDLIBS += -lrte_eal -lrte_mbuf -lrte_mempool -lrte_ring
66 LDLIBS += -lrte_ethdev -lrte_net -lrte_kvargs
67 LDLIBS += -lrte_bus_pci
68
69 # A few warnings cannot be avoided in external headers.
70 CFLAGS += -Wno-error=cast-qual
71
72 EXPORT_MAP := rte_pmd_mlx5_version.map
73 LIBABIVER := 1
74
75 # memseg walk is not part of stable API
76 CFLAGS += -DALLOW_EXPERIMENTAL_API
77
78 # DEBUG which is usually provided on the command-line may enable
79 # CONFIG_RTE_LIBRTE_MLX5_DEBUG.
80 ifeq ($(DEBUG),1)
81 CONFIG_RTE_LIBRTE_MLX5_DEBUG := y
82 endif
83
84 # User-defined CFLAGS.
85 ifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y)
86 CFLAGS += -pedantic -UNDEBUG
87 ifneq ($(CONFIG_RTE_TOOLCHAIN_ICC),y)
88 CFLAGS += -DPEDANTIC
89 endif
90 AUTO_CONFIG_CFLAGS += -Wno-pedantic
91 else
92 CFLAGS += -DNDEBUG -UPEDANTIC
93 endif
94
95 include $(RTE_SDK)/mk/rte.lib.mk
96
97 # Generate and clean-up mlx5_autoconf.h.
98
99 export CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS
100 export AUTO_CONFIG_CFLAGS += -Wno-error
101
102 ifndef V
103 AUTOCONF_OUTPUT := >/dev/null
104 endif
105
106 mlx5_autoconf.h.new: FORCE
107
108 mlx5_autoconf.h.new: $(RTE_SDK)/buildtools/auto-config-h.sh
109         $Q $(RM) -f -- '$@'
110         $Q sh -- '$<' '$@' \
111                 HAVE_IBV_DEVICE_STRIDING_RQ_SUPPORT \
112                 infiniband/mlx5dv.h \
113                 enum MLX5DV_CQE_RES_FORMAT_CSUM_STRIDX \
114                 $(AUTOCONF_OUTPUT)
115         $Q sh -- '$<' '$@' \
116                 HAVE_IBV_DEVICE_TUNNEL_SUPPORT \
117                 infiniband/mlx5dv.h \
118                 enum MLX5DV_CONTEXT_MASK_TUNNEL_OFFLOADS \
119                 $(AUTOCONF_OUTPUT)
120         $Q sh -- '$<' '$@' \
121                 HAVE_IBV_DEVICE_MPLS_SUPPORT \
122                 infiniband/verbs.h \
123                 enum IBV_FLOW_SPEC_MPLS \
124                 $(AUTOCONF_OUTPUT)
125         $Q sh -- '$<' '$@' \
126                 HAVE_IBV_WQ_FLAGS_PCI_WRITE_END_PADDING \
127                 infiniband/verbs.h \
128                 enum IBV_WQ_FLAGS_PCI_WRITE_END_PADDING \
129                 $(AUTOCONF_OUTPUT)
130         $Q sh -- '$<' '$@' \
131                 HAVE_IBV_WQ_FLAG_RX_END_PADDING \
132                 infiniband/verbs.h \
133                 enum IBV_WQ_FLAG_RX_END_PADDING \
134                 $(AUTOCONF_OUTPUT)
135         $Q sh -- '$<' '$@' \
136                 HAVE_IBV_MLX5_MOD_SWP \
137                 infiniband/mlx5dv.h \
138                 type 'struct mlx5dv_sw_parsing_caps' \
139                 $(AUTOCONF_OUTPUT)
140         $Q sh -- '$<' '$@' \
141                 HAVE_IBV_MLX5_MOD_MPW \
142                 infiniband/mlx5dv.h \
143                 enum MLX5DV_CONTEXT_FLAGS_MPW_ALLOWED \
144                 $(AUTOCONF_OUTPUT)
145         $Q sh -- '$<' '$@' \
146                 HAVE_IBV_MLX5_MOD_CQE_128B_COMP \
147                 infiniband/mlx5dv.h \
148                 enum MLX5DV_CONTEXT_FLAGS_CQE_128B_COMP \
149                 $(AUTOCONF_OUTPUT)
150         $Q sh -- '$<' '$@' \
151                 HAVE_IBV_MLX5_MOD_CQE_128B_PAD \
152                 infiniband/mlx5dv.h \
153                 enum MLX5DV_CQ_INIT_ATTR_FLAGS_CQE_PAD \
154                 $(AUTOCONF_OUTPUT)
155         $Q sh -- '$<' '$@' \
156                 HAVE_IBV_FLOW_DV_SUPPORT \
157                 infiniband/mlx5dv.h \
158                 func mlx5dv_create_flow_action_packet_reformat \
159                 $(AUTOCONF_OUTPUT)
160         $Q sh -- '$<' '$@' \
161                 HAVE_MLX5DV_DR \
162                 infiniband/mlx5dv.h \
163                 enum MLX5DV_DR_DOMAIN_TYPE_NIC_RX \
164                 $(AUTOCONF_OUTPUT)
165         $Q sh -- '$<' '$@' \
166                 HAVE_MLX5DV_DR_ESWITCH \
167                 infiniband/mlx5dv.h \
168                 enum MLX5DV_DR_DOMAIN_TYPE_FDB \
169                 $(AUTOCONF_OUTPUT)
170         $Q sh -- '$<' '$@' \
171                 HAVE_MLX5DV_DR_VLAN \
172                 infiniband/mlx5dv.h \
173                 func mlx5dv_dr_action_create_push_vlan \
174                 $(AUTOCONF_OUTPUT)
175         $Q sh -- '$<' '$@' \
176                 HAVE_MLX5DV_DR_DEVX_PORT \
177                 infiniband/mlx5dv.h \
178                 func mlx5dv_query_devx_port \
179                 $(AUTOCONF_OUTPUT)
180         $Q sh -- '$<' '$@' \
181                 HAVE_IBV_DEVX_OBJ \
182                 infiniband/mlx5dv.h \
183                 func mlx5dv_devx_obj_create \
184                 $(AUTOCONF_OUTPUT)
185         $Q sh -- '$<' '$@' \
186                 HAVE_IBV_FLOW_DEVX_COUNTERS \
187                 infiniband/mlx5dv.h \
188                 enum MLX5DV_FLOW_ACTION_COUNTERS_DEVX \
189                 $(AUTOCONF_OUTPUT)
190         $Q sh -- '$<' '$@' \
191                 HAVE_IBV_DEVX_ASYNC \
192                 infiniband/mlx5dv.h \
193                 func mlx5dv_devx_obj_query_async \
194                 $(AUTOCONF_OUTPUT)
195         $Q sh -- '$<' '$@' \
196                 HAVE_MLX5DV_DR_ACTION_DEST_DEVX_TIR \
197                 infiniband/mlx5dv.h \
198                 func mlx5dv_dr_action_create_dest_devx_tir \
199                 $(AUTOCONF_OUTPUT)
200         $Q sh -- '$<' '$@' \
201                 HAVE_ETHTOOL_LINK_MODE_25G \
202                 /usr/include/linux/ethtool.h \
203                 enum ETHTOOL_LINK_MODE_25000baseCR_Full_BIT \
204                 $(AUTOCONF_OUTPUT)
205         $Q sh -- '$<' '$@' \
206                 HAVE_ETHTOOL_LINK_MODE_50G \
207                 /usr/include/linux/ethtool.h \
208                 enum ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT \
209                 $(AUTOCONF_OUTPUT)
210         $Q sh -- '$<' '$@' \
211                 HAVE_ETHTOOL_LINK_MODE_100G \
212                 /usr/include/linux/ethtool.h \
213                 enum ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT \
214                 $(AUTOCONF_OUTPUT)
215         $Q sh -- '$<' '$@' \
216                 HAVE_IBV_DEVICE_COUNTERS_SET_V42 \
217                 infiniband/verbs.h \
218                 type 'struct ibv_counter_set_init_attr' \
219                 $(AUTOCONF_OUTPUT)
220         $Q sh -- '$<' '$@' \
221                 HAVE_IBV_DEVICE_COUNTERS_SET_V45 \
222                 infiniband/verbs.h \
223                 type 'struct ibv_counters_init_attr' \
224                 $(AUTOCONF_OUTPUT)
225         $Q sh -- '$<' '$@' \
226                 HAVE_RDMA_NL_NLDEV \
227                 rdma/rdma_netlink.h \
228                 enum RDMA_NL_NLDEV \
229                 $(AUTOCONF_OUTPUT)
230         $Q sh -- '$<' '$@' \
231                 HAVE_RDMA_NLDEV_CMD_GET \
232                 rdma/rdma_netlink.h \
233                 enum RDMA_NLDEV_CMD_GET \
234                 $(AUTOCONF_OUTPUT)
235         $Q sh -- '$<' '$@' \
236                 HAVE_RDMA_NLDEV_CMD_PORT_GET \
237                 rdma/rdma_netlink.h \
238                 enum RDMA_NLDEV_CMD_PORT_GET \
239                 $(AUTOCONF_OUTPUT)
240         $Q sh -- '$<' '$@' \
241                 HAVE_RDMA_NLDEV_ATTR_DEV_INDEX \
242                 rdma/rdma_netlink.h \
243                 enum RDMA_NLDEV_ATTR_DEV_INDEX \
244                 $(AUTOCONF_OUTPUT)
245         $Q sh -- '$<' '$@' \
246                 HAVE_RDMA_NLDEV_ATTR_DEV_NAME \
247                 rdma/rdma_netlink.h \
248                 enum RDMA_NLDEV_ATTR_DEV_NAME \
249                 $(AUTOCONF_OUTPUT)
250         $Q sh -- '$<' '$@' \
251                 HAVE_RDMA_NLDEV_ATTR_PORT_INDEX \
252                 rdma/rdma_netlink.h \
253                 enum RDMA_NLDEV_ATTR_PORT_INDEX \
254                 $(AUTOCONF_OUTPUT)
255         $Q sh -- '$<' '$@' \
256                 HAVE_RDMA_NLDEV_ATTR_NDEV_INDEX \
257                 rdma/rdma_netlink.h \
258                 enum RDMA_NLDEV_ATTR_NDEV_INDEX \
259                 $(AUTOCONF_OUTPUT)
260         $Q sh -- '$<' '$@' \
261                 HAVE_IFLA_NUM_VF \
262                 linux/if_link.h \
263                 enum IFLA_NUM_VF \
264                 $(AUTOCONF_OUTPUT)
265         $Q sh -- '$<' '$@' \
266                 HAVE_IFLA_EXT_MASK \
267                 linux/if_link.h \
268                 enum IFLA_EXT_MASK \
269                 $(AUTOCONF_OUTPUT)
270         $Q sh -- '$<' '$@' \
271                 HAVE_IFLA_PHYS_SWITCH_ID \
272                 linux/if_link.h \
273                 enum IFLA_PHYS_SWITCH_ID \
274                 $(AUTOCONF_OUTPUT)
275         $Q sh -- '$<' '$@' \
276                 HAVE_IFLA_PHYS_PORT_NAME \
277                 linux/if_link.h \
278                 enum IFLA_PHYS_PORT_NAME \
279                 $(AUTOCONF_OUTPUT)
280         $Q sh -- '$<' '$@' \
281                 HAVE_SUPPORTED_40000baseKR4_Full \
282                 /usr/include/linux/ethtool.h \
283                 define SUPPORTED_40000baseKR4_Full \
284                 $(AUTOCONF_OUTPUT)
285         $Q sh -- '$<' '$@' \
286                 HAVE_SUPPORTED_40000baseCR4_Full \
287                 /usr/include/linux/ethtool.h \
288                 define SUPPORTED_40000baseCR4_Full \
289                 $(AUTOCONF_OUTPUT)
290         $Q sh -- '$<' '$@' \
291                 HAVE_SUPPORTED_40000baseSR4_Full \
292                 /usr/include/linux/ethtool.h \
293                 define SUPPORTED_40000baseSR4_Full \
294                 $(AUTOCONF_OUTPUT)
295         $Q sh -- '$<' '$@' \
296                 HAVE_SUPPORTED_40000baseLR4_Full \
297                 /usr/include/linux/ethtool.h \
298                 define SUPPORTED_40000baseLR4_Full \
299                 $(AUTOCONF_OUTPUT)
300         $Q sh -- '$<' '$@' \
301                 HAVE_SUPPORTED_56000baseKR4_Full \
302                 /usr/include/linux/ethtool.h \
303                 define SUPPORTED_56000baseKR4_Full \
304                 $(AUTOCONF_OUTPUT)
305         $Q sh -- '$<' '$@' \
306                 HAVE_SUPPORTED_56000baseCR4_Full \
307                 /usr/include/linux/ethtool.h \
308                 define SUPPORTED_56000baseCR4_Full \
309                 $(AUTOCONF_OUTPUT)
310         $Q sh -- '$<' '$@' \
311                 HAVE_SUPPORTED_56000baseSR4_Full \
312                 /usr/include/linux/ethtool.h \
313                 define SUPPORTED_56000baseSR4_Full \
314                 $(AUTOCONF_OUTPUT)
315         $Q sh -- '$<' '$@' \
316                 HAVE_SUPPORTED_56000baseLR4_Full \
317                 /usr/include/linux/ethtool.h \
318                 define SUPPORTED_56000baseLR4_Full \
319                 $(AUTOCONF_OUTPUT)
320         $Q sh -- '$<' '$@' \
321                 HAVE_STATIC_ASSERT \
322                 /usr/include/assert.h \
323                 define static_assert \
324                 $(AUTOCONF_OUTPUT)
325
326 # Create mlx5_autoconf.h or update it in case it differs from the new one.
327
328 mlx5_autoconf.h: mlx5_autoconf.h.new
329         $Q [ -f '$@' ] && \
330                 cmp '$<' '$@' $(AUTOCONF_OUTPUT) || \
331                 mv '$<' '$@'
332
333 $(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h
334
335 # Generate dependency plug-in for rdma-core when the PMD must not be linked
336 # directly, so that applications do not inherit this dependency.
337
338 ifeq ($(CONFIG_RTE_IBVERBS_LINK_DLOPEN),y)
339
340 $(LIB): $(LIB_GLUE)
341
342 ifeq ($(LINK_USING_CC),1)
343 GLUE_LDFLAGS := $(call linkerprefix,$(LDFLAGS))
344 else
345 GLUE_LDFLAGS := $(LDFLAGS)
346 endif
347 $(LIB_GLUE): mlx5_glue.o
348         $Q $(LD) $(GLUE_LDFLAGS) $(EXTRA_LDFLAGS) \
349                 -Wl,-h,$(LIB_GLUE) \
350                 -shared -o $@ $< -libverbs -lmlx5
351
352 mlx5_glue.o: mlx5_autoconf.h
353
354 endif
355
356 clean_mlx5: FORCE
357         $Q rm -f -- mlx5_autoconf.h mlx5_autoconf.h.new
358         $Q rm -f -- mlx5_glue.o $(LIB_GLUE_BASE)*
359
360 clean: clean_mlx5