From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 67F2A7D4A for ; Wed, 10 Apr 2019 15:45:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 06:45:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="141569335" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 10 Apr 2019 06:45:26 -0700 From: Bruce Richardson To: konstantin.ananyev@intel.com, aconole@redhat.com Cc: dev@dpdk.org, Bruce Richardson Date: Wed, 10 Apr 2019 14:45:16 +0100 Message-Id: <20190410134517.63896-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410134517.63896-1-bruce.richardson@intel.com> References: <20190410134517.63896-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/2] acl: remove use of weak functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 10 Apr 2019 13:45:29 -0000 Weak functions don't work well with static libraries and require the use of "whole-archive" flag to ensure that the correct function is used when linking. Since the weak functions are only used as placeholders within this library alone, we can replace them with non-weak functions using preprocessor ifdefs. Signed-off-by: Bruce Richardson --- lib/librte_acl/meson.build | 7 ++++++- lib/librte_acl/rte_acl.c | 18 ++++++++++++++---- mk/rte.app.mk | 3 --- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/librte_acl/meson.build b/lib/librte_acl/meson.build index 2207dbafe..98ece7d85 100644 --- a/lib/librte_acl/meson.build +++ b/lib/librte_acl/meson.build @@ -6,7 +6,7 @@ sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c', 'rte_acl.c', 'tb_mem.c') headers = files('rte_acl.h', 'rte_acl_osdep.h') -if arch_subdir == 'x86' +if dpdk_conf.has('RTE_ARCH_X86') sources += files('acl_run_sse.c') # compile AVX2 version if either: @@ -28,4 +28,9 @@ if arch_subdir == 'x86' cflags += '-DCC_AVX2_SUPPORT' endif +elif dpdk_conf.has('RTE_ARCH_ARM') or dpdk_conf.has('RTE_ARCH_ARM64') + cflags += '-flax-vector-conversions' + sources += files('acl_run_neon.c') +elif dpdk_conf.has('RTE_ARCH_PPC_64') + sources += files('acl_run_altivec.c') endif diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c index c436a9bfd..fd5bd5e4e 100644 --- a/lib/librte_acl/rte_acl.c +++ b/lib/librte_acl/rte_acl.c @@ -13,11 +13,13 @@ static struct rte_tailq_elem rte_acl_tailq = { }; EAL_REGISTER_TAILQ(rte_acl_tailq) +#ifndef RTE_ARCH_X86 +#ifndef CC_AVX2_SUPPORT /* * If the compiler doesn't support AVX2 instructions, * then the dummy one would be used instead for AVX2 classify method. */ -__rte_weak int +int rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -26,8 +28,9 @@ rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif -__rte_weak int +int rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -36,8 +39,11 @@ rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif -__rte_weak int +#ifndef RTE_ARCH_ARM +#ifndef RTE_ARCH_ARM64 +int rte_acl_classify_neon(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -46,8 +52,11 @@ rte_acl_classify_neon(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif +#endif -__rte_weak int +#ifndef RTE_ARCH_PPC_64 +int rte_acl_classify_altivec(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -56,6 +65,7 @@ rte_acl_classify_altivec(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif static const rte_acl_classify_t classify_fns[] = { [RTE_ACL_CLASSIFY_DEFAULT] = rte_acl_classify_scalar, diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 7d994bece..fdec636b4 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -46,10 +46,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm -# librte_acl needs --whole-archive because of weak functions -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --no-whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += --no-as-needed _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += -lrte_telemetry -ljansson -- 2.20.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by dpdk.space (Postfix) with ESMTP id 50616A0096 for ; Wed, 10 Apr 2019 15:45:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id F22A21B0F7; Wed, 10 Apr 2019 15:45:30 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by dpdk.org (Postfix) with ESMTP id 67F2A7D4A for ; Wed, 10 Apr 2019 15:45:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga003.jf.intel.com ([10.7.209.27]) by orsmga101.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 10 Apr 2019 06:45:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="141569335" Received: from silpixa00399126.ir.intel.com (HELO silpixa00399126.ger.corp.intel.com) ([10.237.222.236]) by orsmga003.jf.intel.com with ESMTP; 10 Apr 2019 06:45:26 -0700 From: Bruce Richardson To: konstantin.ananyev@intel.com, aconole@redhat.com Cc: dev@dpdk.org, Bruce Richardson Date: Wed, 10 Apr 2019 14:45:16 +0100 Message-Id: <20190410134517.63896-2-bruce.richardson@intel.com> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190410134517.63896-1-bruce.richardson@intel.com> References: <20190410134517.63896-1-bruce.richardson@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/2] acl: remove use of weak functions X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" Content-Type: text/plain; charset="UTF-8" Message-ID: <20190410134516.WftcKvDflNHnEE8lvKmsQZXg2Lf-uvxPisWo7lKZw1g@z> Weak functions don't work well with static libraries and require the use of "whole-archive" flag to ensure that the correct function is used when linking. Since the weak functions are only used as placeholders within this library alone, we can replace them with non-weak functions using preprocessor ifdefs. Signed-off-by: Bruce Richardson --- lib/librte_acl/meson.build | 7 ++++++- lib/librte_acl/rte_acl.c | 18 ++++++++++++++---- mk/rte.app.mk | 3 --- 3 files changed, 20 insertions(+), 8 deletions(-) diff --git a/lib/librte_acl/meson.build b/lib/librte_acl/meson.build index 2207dbafe..98ece7d85 100644 --- a/lib/librte_acl/meson.build +++ b/lib/librte_acl/meson.build @@ -6,7 +6,7 @@ sources = files('acl_bld.c', 'acl_gen.c', 'acl_run_scalar.c', 'rte_acl.c', 'tb_mem.c') headers = files('rte_acl.h', 'rte_acl_osdep.h') -if arch_subdir == 'x86' +if dpdk_conf.has('RTE_ARCH_X86') sources += files('acl_run_sse.c') # compile AVX2 version if either: @@ -28,4 +28,9 @@ if arch_subdir == 'x86' cflags += '-DCC_AVX2_SUPPORT' endif +elif dpdk_conf.has('RTE_ARCH_ARM') or dpdk_conf.has('RTE_ARCH_ARM64') + cflags += '-flax-vector-conversions' + sources += files('acl_run_neon.c') +elif dpdk_conf.has('RTE_ARCH_PPC_64') + sources += files('acl_run_altivec.c') endif diff --git a/lib/librte_acl/rte_acl.c b/lib/librte_acl/rte_acl.c index c436a9bfd..fd5bd5e4e 100644 --- a/lib/librte_acl/rte_acl.c +++ b/lib/librte_acl/rte_acl.c @@ -13,11 +13,13 @@ static struct rte_tailq_elem rte_acl_tailq = { }; EAL_REGISTER_TAILQ(rte_acl_tailq) +#ifndef RTE_ARCH_X86 +#ifndef CC_AVX2_SUPPORT /* * If the compiler doesn't support AVX2 instructions, * then the dummy one would be used instead for AVX2 classify method. */ -__rte_weak int +int rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -26,8 +28,9 @@ rte_acl_classify_avx2(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif -__rte_weak int +int rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -36,8 +39,11 @@ rte_acl_classify_sse(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif -__rte_weak int +#ifndef RTE_ARCH_ARM +#ifndef RTE_ARCH_ARM64 +int rte_acl_classify_neon(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -46,8 +52,11 @@ rte_acl_classify_neon(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif +#endif -__rte_weak int +#ifndef RTE_ARCH_PPC_64 +int rte_acl_classify_altivec(__rte_unused const struct rte_acl_ctx *ctx, __rte_unused const uint8_t **data, __rte_unused uint32_t *results, @@ -56,6 +65,7 @@ rte_acl_classify_altivec(__rte_unused const struct rte_acl_ctx *ctx, { return -ENOTSUP; } +#endif static const rte_acl_classify_t classify_fns[] = { [RTE_ACL_CLASSIFY_DEFAULT] = rte_acl_classify_scalar, diff --git a/mk/rte.app.mk b/mk/rte.app.mk index 7d994bece..fdec636b4 100644 --- a/mk/rte.app.mk +++ b/mk/rte.app.mk @@ -46,10 +46,7 @@ _LDLIBS-$(CONFIG_RTE_LIBRTE_DISTRIBUTOR) += -lrte_distributor _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG) += -lrte_ip_frag _LDLIBS-$(CONFIG_RTE_LIBRTE_METER) += -lrte_meter _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM) += -lrte_lpm -# librte_acl needs --whole-archive because of weak functions -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += -lrte_acl -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL) += --no-whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += --no-as-needed _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += --whole-archive _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY) += -lrte_telemetry -ljansson -- 2.20.1