net/i40e: Eliminate weak symbols in i40e_rxtx.c
Subsystems (2)
PATCH 1/1 net/i40e: Eliminate weak symbols in i40e_rxtx.c
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.
--- 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(-)
drivers/net/i40e/Makefile +1 -0
@@ -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
drivers/net/i40e/i40e_rxtx.c +28 -24
101 lines not on this page · raw message
drivers/net/i40e/meson.build +2 -0
@@ -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,
Signature · 1 line
2.19.1
Quoted 6 lines · David Harton
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 <[email protected]>---
Looks reasonable to me.
PATCH v2 1/1 net/i40e: Eliminate weak symbols in i40e_rxtx.c
In reply to David HartonUse 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.
---
v2 - added CC_AVX2_SUPPORT check to code enabling avx2 vectors
drivers/net/i40e/Makefile | 1 + drivers/net/i40e/i40e_rxtx.c | 60 +++++++++++++++++++----------------- drivers/net/i40e/meson.build | 2 ++ 3 files changed, 35 insertions(+), 28 deletions(-)
drivers/net/i40e/Makefile +1 -0
@@ -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
drivers/net/i40e/i40e_rxtx.c +32 -28
133 lines not on this page · raw message
drivers/net/i40e/meson.build +2 -0
@@ -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,
Signature · 1 line
2.19.1
Quoted 9 lines · David Harton
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 <[email protected]>---
v2 - added
CC_AVX2_SUPPORTcheck to code enabling avx2 vectors
Testing a few compiles here, this breaks when vector mode is disabled, because it's possible that CC_AVX2_SUPPORT=1 when VECTOR=n. I'd suggest adding "ifeq ($(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR),y) ... endif" around the block in the makefile checking for AVX2 support, so that we never set AVX2 unless we have vector support.
With this change, you can include my ack in v3.
/Bruce
Quoted 8 lines · Bruce Richardson
Quoted 7 lines · David Harton
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 <[email protected]>---
Quoted 7 lines
Quoted 2 lines
v2 - added
CC_AVX2_SUPPORTcheck to code enabling avx2 vectorsTesting a few compiles here, this breaks when vector mode is disabled, because it's possible that CC_AVX2_SUPPORT=1 when VECTOR=n. I'd suggest adding "ifeq ($(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR),y) ... endif" around the block in the makefile checking for AVX2 support, so that we never set AVX2 unless we have vector support.
Concern is this is pushing vectorization support more to compile time configuration. Do we really have to select if to use vector PMD or not in compile time?
Can't we get rid of the 'CONFIG_RTE_LIBRTE_I40E_INC_VECTOR' config option completely? As done in the ICE driver now.
Isn't it better to compile vectorization support in as much as possible and do the vector or scalar path selection in runtime, this patch may prevent us to do that, weak functions enables us being more dynamic.
Quoted 7 lines
With this change, you can include my ack in v3.
/Bruce
Acked-by Bruce Richardson <[email protected]>
Quoted 31 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, June 04, 2019 12:00 PM
To: Bruce Richardson <[email protected]>; David Harton (dharton) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: Eliminate weak symbols ini40e_rxtx.cQuoted 8 lines · Bruce Richardson
Quoted 7 lines · David Harton
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 <[email protected]>---
Quoted 7 lines
Quoted 2 lines
v2 - added
CC_AVX2_SUPPORTcheck to code enabling avx2 vectorsTesting a few compiles here, this breaks when vector mode is disabled, because it's possible that CC_AVX2_SUPPORT=1 when VECTOR=n. I'd suggest adding "ifeq ($(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR),y) ... endif" around the block in the makefile checking for AVX2 support, so that we never set AVX2 unless we have vector support.
Concern is this is pushing vectorization support more to compile time configuration. Do we really have to select if to use vector PMD or not in compile time?
Quoted 6 lines
Can't we get rid of the '
CONFIG_RTE_LIBRTE_I40E_INC_VECTOR' config option completely? As done in the ICE driver now.Isn't it better to compile vectorization support in as much as possible and do the vector or scalar path selection in runtime, this patch may prevent us to do that, weak functions enables us being more dynamic.
Choosing a vector dynamically can be done without the use of weak symbols.
IMHO, weak symbols should really be used for cross library support where a user wants to override a 3rd party function not within a lib. In fact the weak symbol usage may preclude supporting all the variants you might need/want to select.
Quoted 8 lines
Quoted 8 lines
With this change, you can include my ack in v3.
/Bruce
Acked-by Bruce Richardson <[email protected]>
Quoted 31 lines · David Harton (dharton)
Quoted 31 lines
-----Original Message-----
From: Ferruh Yigit <[email protected]>
Sent: Tuesday, June 04, 2019 12:00 PM
To: Bruce Richardson <[email protected]>; David Harton (dharton) <[email protected]>
Cc: [email protected]; [email protected]; [email protected]
Subject: Re: [dpdk-dev] [PATCH v2] net/i40e: Eliminate weak symbols ini40e_rxtx.cQuoted 8 lines · Bruce Richardson
Quoted 7 lines · David Harton
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 <[email protected]>---
Quoted 7 lines
Quoted 2 lines
v2 - added
CC_AVX2_SUPPORTcheck to code enabling avx2 vectorsTesting a few compiles here, this breaks when vector mode is disabled, because it's possible that CC_AVX2_SUPPORT=1 when VECTOR=n. I'd suggest adding "ifeq ($(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR),y) ... endif" around the block in the makefile checking for AVX2 support, so that we never set AVX2 unless we have vector support.
Concern is this is pushing vectorization support more to compile time configuration. Do we really have to select if to use vector PMD or not in compile time?
Quoted 8 lines
Quoted 6 lines
Can't we get rid of the '
CONFIG_RTE_LIBRTE_I40E_INC_VECTOR' config option completely? As done in the ICE driver now.Isn't it better to compile vectorization support in as much as possible and do the vector or scalar path selection in runtime, this patch may prevent us to do that, weak functions enables us being more dynamic.
Choosing a vector dynamically can be done without the use of weak symbols.
No objection then.
Quoted 12 lines
IMHO, weak symbols should really be used for cross library support where a user wants to override a 3rd party function not within a lib. In fact the weak symbol usage may preclude supporting all the variants you might need/want to select.
Quoted 8 lines
Quoted 8 lines
With this change, you can include my ack in v3.
/Bruce
Acked-by Bruce Richardson <[email protected]>
Quoted 21 lines · Ferruh Yigit
Quoted 8 lines · Bruce Richardson
Quoted 7 lines · David Harton
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 <[email protected]>---
Quoted 7 lines
Quoted 2 lines
v2 - added
CC_AVX2_SUPPORTcheck to code enabling avx2 vectorsTesting a few compiles here, this breaks when vector mode is disabled, because it's possible that CC_AVX2_SUPPORT=1 when VECTOR=n. I'd suggest adding "ifeq ($(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR),y) ... endif" around the block in the makefile checking for AVX2 support, so that we never set AVX2 unless we have vector support.
Concern is this is pushing vectorization support more to compile time configuration. Do we really have to select if to use vector PMD or not in compile time?
Quoted 7 lines
Can't we get rid of the '
CONFIG_RTE_LIBRTE_I40E_INC_VECTOR' config option completely? As done in the ICE driver now.Isn't it better to compile vectorization support in as much as possible and do the vector or scalar path selection in runtime, this patch may prevent us to do that, weak functions enables us being more dynamic.
Weak functions are not needed to do the runtime selection - they are needed for compilation only. They have the downside of potentially causing runtime problems due to a mis-configured compile, which is only seen later by the end user. By using real functions rather than weak functions it means that any mischosen compile paths will flag a compile error rather than silently succeeding and then accidentally using an incorrect function at runtime.
PATCH v3 1/1 net/i40e: Eliminate weak symbols in i40e_rxtx.c
In reply to David HartonUse 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.
---
v3 - added CONFIG_RTE_LIBRTE_I40E_INC_VECTOR to makefile v2 - added CC_AVX2_SUPPORT check to code enabling avx2 vectors
drivers/net/i40e/Makefile | 3 ++ drivers/net/i40e/i40e_rxtx.c | 60 +++++++++++++++++++----------------- drivers/net/i40e/meson.build | 2 ++ 3 files changed, 37 insertions(+), 28 deletions(-)
drivers/net/i40e/Makefile +3 -0
@@ -89,6 +89,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += rte_pmd_i40e.c SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_tm.c SRCS-$(CONFIG_RTE_LIBRTE_I40E_PMD) += i40e_vf_representor.c +ifeq ($(CONFIG_RTE_LIBRTE_I40E_INC_VECTOR),y) ifeq ($(findstring RTE_MACHINE_CPUFLAG_AVX2,$(CFLAGS)),RTE_MACHINE_CPUFLAG_AVX2) CC_AVX2_SUPPORT=1 else
@@ -103,9 +104,11 @@ else endif endif endif +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
drivers/net/i40e/i40e_rxtx.c +32 -28
133 lines not on this page · raw message
drivers/net/i40e/meson.build +2 -0
@@ -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,
Signature · 1 line
2.19.1
Quoted 10 lines · David Harton
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 <[email protected]>---
v3 - added
CONFIG_RTE_LIBRTE_I40E_INC_VECTORto makefile v2 - addedCC_AVX2_SUPPORTcheck to code enabling avx2 vectors
Zhang, Qi Z
AppliedQuoted 15 lines
-----Original Message-----
From: Richardson, Bruce
Sent: Friday, May 17, 2019 3:21 AM
To: David Harton <[email protected]>
Cc: [email protected]; Xing, Beilei <[email protected]>; Zhang, Qi Z <[email protected]>
Subject: Re: [PATCH v3] net/i40e: Eliminate weak symbols ini40e_rxtx.cQuoted 4 lines · David Harton
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.
Quoted 7 lines
Quoted 6 lines
Signed-off-by David Harton <[email protected]>---
v3 - added
CONFIG_RTE_LIBRTE_I40E_INC_VECTORto makefile v2 - addedCC_AVX2_SUPPORTcheck to code enabling avx2 vectorsAcked-by Bruce Richardson <[email protected]>
Applied to dpdk-next-net-intel.
Thanks
Qi