net/i40e: Eliminate weak symbols in i40e_rxtx.c

Message ID 20190515130512.6366-1-dharton@cisco.com (mailing list archive)
State Superseded, archived
Headers
Series net/i40e: Eliminate weak symbols in i40e_rxtx.c |

Checks

Context Check Description
ci/checkpatch warning coding style issues
ci/mellanox-Performance-Testing success Performance Testing PASS
ci/intel-Performance-Testing success Performance Testing PASS
ci/Intel-compilation success Compilation OK

Commit Message

David Harton May 15, 2019, 1:05 p.m. UTC
  Use of weak symbols can hide makefile errors especially when
custom makefiles are used.  Removing the use of weak symbols
to avoid a stub function being linked in production code.

Signed-off-by: David Harton <dharton@cisco.com>
---
 drivers/net/i40e/Makefile    |  1 +
 drivers/net/i40e/i40e_rxtx.c | 52 +++++++++++++++++++-----------------
 drivers/net/i40e/meson.build |  2 ++
 3 files changed, 31 insertions(+), 24 deletions(-)
  

Comments

Bruce Richardson May 15, 2019, 2:13 p.m. UTC | #1
On Wed, May 15, 2019 at 09:05:12AM -0400, David Harton wrote:
> Use of weak symbols can hide makefile errors especially when
> custom makefiles are used.  Removing the use of weak symbols
> to avoid a stub function being linked in production code.
> 
> Signed-off-by: David Harton <dharton@cisco.com>
> ---
Looks reasonable to me.

Reviewed-by: Bruce Richardson <bruce.richardson@intel.com>
  

Patch

diff --git a/drivers/net/i40e/Makefile b/drivers/net/i40e/Makefile
index 3f869a8d6..cbcfce099 100644
--- a/drivers/net/i40e/Makefile
+++ b/drivers/net/i40e/Makefile
@@ -106,6 +106,7 @@  endif
 
 ifeq ($(CC_AVX2_SUPPORT), 1)
 	SRCS-$(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR) += i40e_rxtx_vec_avx2.c
+	CFLAGS_i40e_rxtx.o += -DCC_AVX2_SUPPORT
 endif
 
 # install this header file
diff --git a/drivers/net/i40e/i40e_rxtx.c b/drivers/net/i40e/i40e_rxtx.c
index 1489552da..cbf31ec88 100644
--- a/drivers/net/i40e/i40e_rxtx.c
+++ b/drivers/net/i40e/i40e_rxtx.c
@@ -3181,14 +3181,15 @@  i40e_set_default_pctype_table(struct rte_eth_dev *dev)
 	}
 }
 
+#ifndef RTE_LIBRTE_I40E_INC_VECTOR
 /* Stubs needed for linkage when CONFIG_RTE_LIBRTE_I40E_INC_VECTOR is set to 'n' */
-__rte_weak int
+int
 i40e_rx_vec_dev_conf_condition_check(struct rte_eth_dev __rte_unused *dev)
 {
 	return -1;
 }
 
-__rte_weak uint16_t
+uint16_t
 i40e_recv_pkts_vec(
 	void __rte_unused *rx_queue,
 	struct rte_mbuf __rte_unused **rx_pkts,
@@ -3197,7 +3198,7 @@  i40e_recv_pkts_vec(
 	return 0;
 }
 
-__rte_weak uint16_t
+uint16_t
 i40e_recv_scattered_pkts_vec(
 	void __rte_unused *rx_queue,
 	struct rte_mbuf __rte_unused **rx_pkts,
@@ -3206,52 +3207,55 @@  i40e_recv_scattered_pkts_vec(
 	return 0;
 }
 
-__rte_weak uint16_t
-i40e_recv_pkts_vec_avx2(void __rte_unused *rx_queue,
-			struct rte_mbuf __rte_unused **rx_pkts,
-			uint16_t __rte_unused nb_pkts)
-{
-	return 0;
-}
-
-__rte_weak uint16_t
-i40e_recv_scattered_pkts_vec_avx2(void __rte_unused *rx_queue,
-			struct rte_mbuf __rte_unused **rx_pkts,
-			uint16_t __rte_unused nb_pkts)
-{
-	return 0;
-}
-
-__rte_weak int
+int
 i40e_rxq_vec_setup(struct i40e_rx_queue __rte_unused *rxq)
 {
 	return -1;
 }
 
-__rte_weak int
+int
 i40e_txq_vec_setup(struct i40e_tx_queue __rte_unused *txq)
 {
 	return -1;
 }
 
-__rte_weak void
+void
 i40e_rx_queue_release_mbufs_vec(struct i40e_rx_queue __rte_unused*rxq)
 {
 	return;
 }
 
-__rte_weak uint16_t
+uint16_t
 i40e_xmit_fixed_burst_vec(void __rte_unused * tx_queue,
 			  struct rte_mbuf __rte_unused **tx_pkts,
 			  uint16_t __rte_unused nb_pkts)
 {
 	return 0;
 }
+#endif /* ifndef RTE_LIBRTE_I40E_INC_VECTOR */
+
+#ifndef CC_AVX2_SUPPORT
+uint16_t
+i40e_recv_pkts_vec_avx2(void __rte_unused *rx_queue,
+			struct rte_mbuf __rte_unused **rx_pkts,
+			uint16_t __rte_unused nb_pkts)
+{
+	return 0;
+}
 
-__rte_weak uint16_t
+uint16_t
+i40e_recv_scattered_pkts_vec_avx2(void __rte_unused *rx_queue,
+			struct rte_mbuf __rte_unused **rx_pkts,
+			uint16_t __rte_unused nb_pkts)
+{
+	return 0;
+}
+
+uint16_t
 i40e_xmit_pkts_vec_avx2(void __rte_unused * tx_queue,
 			  struct rte_mbuf __rte_unused **tx_pkts,
 			  uint16_t __rte_unused nb_pkts)
 {
 	return 0;
 }
+#endif /* ifndef CC_AVX2_SUPPORT */
diff --git a/drivers/net/i40e/meson.build b/drivers/net/i40e/meson.build
index d783f3626..dcbca39bf 100644
--- a/drivers/net/i40e/meson.build
+++ b/drivers/net/i40e/meson.build
@@ -35,8 +35,10 @@  if arch_subdir == 'x86'
 	# a. we have AVX supported in minimum instruction set baseline
 	# b. it's not minimum instruction set, but supported by compiler
 	if dpdk_conf.has('RTE_MACHINE_CPUFLAG_AVX2')
+		cflags += ['-DCC_AVX2_SUPPORT']
 		sources += files('i40e_rxtx_vec_avx2.c')
 	elif cc.has_argument('-mavx2')
+		cflags += ['-DCC_AVX2_SUPPORT']
 		i40e_avx2_lib = static_library('i40e_avx2_lib',
 				'i40e_rxtx_vec_avx2.c',
 				dependencies: [static_rte_ethdev,