15129044dSC.J. Collier#   BSD LICENSE
25129044dSC.J. Collier#
35129044dSC.J. Collier#   Copyright 2015 6WIND S.A.
45129044dSC.J. Collier#   Copyright 2015 Mellanox.
55129044dSC.J. Collier#
65129044dSC.J. Collier#   Redistribution and use in source and binary forms, with or without
75129044dSC.J. Collier#   modification, are permitted provided that the following conditions
85129044dSC.J. Collier#   are met:
95129044dSC.J. Collier#
105129044dSC.J. Collier#     * Redistributions of source code must retain the above copyright
115129044dSC.J. Collier#       notice, this list of conditions and the following disclaimer.
125129044dSC.J. Collier#     * Redistributions in binary form must reproduce the above copyright
135129044dSC.J. Collier#       notice, this list of conditions and the following disclaimer in
145129044dSC.J. Collier#       the documentation and/or other materials provided with the
155129044dSC.J. Collier#       distribution.
165129044dSC.J. Collier#     * Neither the name of 6WIND S.A. nor the names of its
175129044dSC.J. Collier#       contributors may be used to endorse or promote products derived
185129044dSC.J. Collier#       from this software without specific prior written permission.
195129044dSC.J. Collier#
205129044dSC.J. Collier#   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
215129044dSC.J. Collier#   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
225129044dSC.J. Collier#   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
235129044dSC.J. Collier#   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
245129044dSC.J. Collier#   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
255129044dSC.J. Collier#   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
265129044dSC.J. Collier#   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
275129044dSC.J. Collier#   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
285129044dSC.J. Collier#   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
295129044dSC.J. Collier#   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
305129044dSC.J. Collier#   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
315129044dSC.J. Collier
325129044dSC.J. Collierinclude $(RTE_SDK)/mk/rte.vars.mk
335129044dSC.J. Collier
345129044dSC.J. Collier# Library name.
355129044dSC.J. CollierLIB = librte_pmd_mlx5.a
365129044dSC.J. Collier
375129044dSC.J. Collier# Sources.
385129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5.c
395129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxq.c
405129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_txq.c
415129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxtx.c
425129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_trigger.c
435129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_ethdev.c
445129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mac.c
455129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rxmode.c
465129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_vlan.c
475129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_stats.c
485129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_rss.c
495129044dSC.J. CollierSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_fdir.c
50809f0800SChristian EhrhardtSRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += mlx5_mr.c
515129044dSC.J. Collier
525129044dSC.J. Collier# Dependencies.
535129044dSC.J. CollierDEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_ether
545129044dSC.J. CollierDEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mbuf
555129044dSC.J. CollierDEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_eal
565129044dSC.J. CollierDEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_mempool
57809f0800SChristian EhrhardtDEPDIRS-$(CONFIG_RTE_LIBRTE_MLX5_PMD) += lib/librte_kvargs
585129044dSC.J. Collier
595129044dSC.J. Collier# Basic CFLAGS.
605129044dSC.J. CollierCFLAGS += -O3
615129044dSC.J. CollierCFLAGS += -std=gnu99 -Wall -Wextra
625129044dSC.J. CollierCFLAGS += -g
635129044dSC.J. CollierCFLAGS += -I.
64809f0800SChristian EhrhardtCFLAGS += -D_BSD_SOURCE
65809f0800SChristian EhrhardtCFLAGS += -D_DEFAULT_SOURCE
665129044dSC.J. CollierCFLAGS += -D_XOPEN_SOURCE=600
675129044dSC.J. CollierCFLAGS += $(WERROR_FLAGS)
685129044dSC.J. CollierCFLAGS += -Wno-strict-prototypes
695129044dSC.J. CollierLDLIBS += -libverbs
705129044dSC.J. Collier
715129044dSC.J. Collier# A few warnings cannot be avoided in external headers.
725129044dSC.J. CollierCFLAGS += -Wno-error=cast-qual
735129044dSC.J. Collier
745129044dSC.J. CollierEXPORT_MAP := rte_pmd_mlx5_version.map
755129044dSC.J. CollierLIBABIVER := 1
765129044dSC.J. Collier
775129044dSC.J. Collier# DEBUG which is usually provided on the command-line may enable
785129044dSC.J. Collier# CONFIG_RTE_LIBRTE_MLX5_DEBUG.
795129044dSC.J. Collierifeq ($(DEBUG),1)
805129044dSC.J. CollierCONFIG_RTE_LIBRTE_MLX5_DEBUG := y
815129044dSC.J. Collierendif
825129044dSC.J. Collier
835129044dSC.J. Collier# User-defined CFLAGS.
845129044dSC.J. Collierifeq ($(CONFIG_RTE_LIBRTE_MLX5_DEBUG),y)
855129044dSC.J. CollierCFLAGS += -pedantic -UNDEBUG -DPEDANTIC
865129044dSC.J. Collierelse
875129044dSC.J. CollierCFLAGS += -DNDEBUG -UPEDANTIC
885129044dSC.J. Collierendif
895129044dSC.J. Collier
905129044dSC.J. Collierifdef CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE
915129044dSC.J. CollierCFLAGS += -DMLX5_PMD_TX_MP_CACHE=$(CONFIG_RTE_LIBRTE_MLX5_TX_MP_CACHE)
925129044dSC.J. Collierendif
935129044dSC.J. Collier
945129044dSC.J. Collierinclude $(RTE_SDK)/mk/rte.lib.mk
955129044dSC.J. Collier
965129044dSC.J. Collier# Generate and clean-up mlx5_autoconf.h.
975129044dSC.J. Collier
985129044dSC.J. Collierexport CC CFLAGS CPPFLAGS EXTRA_CFLAGS EXTRA_CPPFLAGS
995129044dSC.J. Collierexport AUTO_CONFIG_CFLAGS = -Wno-error
1005129044dSC.J. Collier
1015129044dSC.J. Collierifndef V
1025129044dSC.J. CollierAUTOCONF_OUTPUT := >/dev/null
1035129044dSC.J. Collierendif
1045129044dSC.J. Collier
105809f0800SChristian Ehrhardtmlx5_autoconf.h.new: FORCE
106809f0800SChristian Ehrhardt
107809f0800SChristian Ehrhardtmlx5_autoconf.h.new: $(RTE_SDK)/scripts/auto-config-h.sh
1085129044dSC.J. Collier	$Q $(RM) -f -- '$@'
1095129044dSC.J. Collier	$Q sh -- '$<' '$@' \
110809f0800SChristian Ehrhardt		HAVE_VERBS_IBV_EXP_CQ_COMPRESSED_CQE \
111809f0800SChristian Ehrhardt		infiniband/verbs_exp.h \
112809f0800SChristian Ehrhardt		enum IBV_EXP_CQ_COMPRESSED_CQE \
1135129044dSC.J. Collier		$(AUTOCONF_OUTPUT)
1145129044dSC.J. Collier	$Q sh -- '$<' '$@' \
115809f0800SChristian Ehrhardt		HAVE_VERBS_MLX5_ETH_VLAN_INLINE_HEADER_SIZE \
116809f0800SChristian Ehrhardt		infiniband/mlx5_hw.h \
117809f0800SChristian Ehrhardt		enum MLX5_ETH_VLAN_INLINE_HEADER_SIZE \
1185129044dSC.J. Collier		$(AUTOCONF_OUTPUT)
119c300e355SChristian Ehrhardt	$Q sh -- '$<' '$@' \
120c300e355SChristian Ehrhardt		HAVE_VERBS_MLX5_OPCODE_TSO \
121c300e355SChristian Ehrhardt		infiniband/mlx5_hw.h \
122c300e355SChristian Ehrhardt		enum MLX5_OPCODE_TSO \
123c300e355SChristian Ehrhardt		$(AUTOCONF_OUTPUT)
124c300e355SChristian Ehrhardt	$Q sh -- '$<' '$@' \
125c300e355SChristian Ehrhardt		HAVE_ETHTOOL_LINK_MODE_25G \
126c300e355SChristian Ehrhardt		/usr/include/linux/ethtool.h \
127c300e355SChristian Ehrhardt		enum ETHTOOL_LINK_MODE_25000baseCR_Full_BIT \
128c300e355SChristian Ehrhardt		$(AUTOCONF_OUTPUT)
129c300e355SChristian Ehrhardt	$Q sh -- '$<' '$@' \
130c300e355SChristian Ehrhardt		HAVE_ETHTOOL_LINK_MODE_50G \
131c300e355SChristian Ehrhardt		/usr/include/linux/ethtool.h \
132c300e355SChristian Ehrhardt		enum ETHTOOL_LINK_MODE_50000baseCR2_Full_BIT \
133c300e355SChristian Ehrhardt		$(AUTOCONF_OUTPUT)
134c300e355SChristian Ehrhardt	$Q sh -- '$<' '$@' \
135c300e355SChristian Ehrhardt		HAVE_ETHTOOL_LINK_MODE_100G \
136c300e355SChristian Ehrhardt		/usr/include/linux/ethtool.h \
137c300e355SChristian Ehrhardt		enum ETHTOOL_LINK_MODE_100000baseKR4_Full_BIT \
138c300e355SChristian Ehrhardt		$(AUTOCONF_OUTPUT)
1395129044dSC.J. Collier
140809f0800SChristian Ehrhardt# Create mlx5_autoconf.h or update it in case it differs from the new one.
141809f0800SChristian Ehrhardt
142809f0800SChristian Ehrhardtmlx5_autoconf.h: mlx5_autoconf.h.new
143809f0800SChristian Ehrhardt	$Q [ -f '$@' ] && \
144809f0800SChristian Ehrhardt		cmp '$<' '$@' $(AUTOCONF_OUTPUT) || \
145809f0800SChristian Ehrhardt		mv '$<' '$@'
146809f0800SChristian Ehrhardt
1475129044dSC.J. Collier$(SRCS-$(CONFIG_RTE_LIBRTE_MLX5_PMD):.c=.o): mlx5_autoconf.h
1485129044dSC.J. Collier
1495129044dSC.J. Collierclean_mlx5: FORCE
150809f0800SChristian Ehrhardt	$Q rm -f -- mlx5_autoconf.h mlx5_autoconf.h.new
1515129044dSC.J. Collier
1525129044dSC.J. Collierclean: clean_mlx5
153