From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from dpdk.org (dpdk.org [92.243.14.124])
	by dpdk.space (Postfix) with ESMTP id 52355A0096
	for <public@inbox.dpdk.org>; Wed, 10 Apr 2019 16:57:44 +0200 (CEST)
Received: from [92.243.14.124] (localhost [127.0.0.1])
	by dpdk.org (Postfix) with ESMTP id 127961B1F6;
	Wed, 10 Apr 2019 16:57:43 +0200 (CEST)
Received: from mga06.intel.com (mga06.intel.com [134.134.136.31])
 by dpdk.org (Postfix) with ESMTP id 601B91B1F3
 for <dev@dpdk.org>; Wed, 10 Apr 2019 16:57:41 +0200 (CEST)
X-Amp-Result: SKIPPED(no attachment in message)
X-Amp-File-Uploaded: False
Received: from orsmga004.jf.intel.com ([10.7.209.38])
 by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;
 10 Apr 2019 07:57:40 -0700
X-ExtLoop1: 1
X-IronPort-AV: E=Sophos;i="5.60,332,1549958400"; d="scan'208";a="290361679"
Received: from irsmsx151.ger.corp.intel.com ([163.33.192.59])
 by orsmga004.jf.intel.com with ESMTP; 10 Apr 2019 07:57:39 -0700
Received: from irsmsx105.ger.corp.intel.com ([169.254.7.31]) by
 IRSMSX151.ger.corp.intel.com ([169.254.4.174]) with mapi id 14.03.0415.000;
 Wed, 10 Apr 2019 15:57:38 +0100
From: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>
To: "Richardson, Bruce" <bruce.richardson@intel.com>, "aconole@redhat.com"
 <aconole@redhat.com>
CC: "dev@dpdk.org" <dev@dpdk.org>
Thread-Topic: [PATCH 1/2] acl: remove use of weak functions
Thread-Index: AQHU76PAX/+TkVOBfkqfF2LrBdgneKY1e/NA
Date: Wed, 10 Apr 2019 14:57:38 +0000
Message-ID:
 <2601191342CEEE43887BDE71AB9772580148A9588C@irsmsx105.ger.corp.intel.com>
References: <20190410134517.63896-1-bruce.richardson@intel.com>
 <20190410134517.63896-2-bruce.richardson@intel.com>
In-Reply-To: <20190410134517.63896-2-bruce.richardson@intel.com>
Accept-Language: en-IE, en-US
Content-Language: en-US
X-MS-Has-Attach: 
X-MS-TNEF-Correlator: 
x-titus-metadata-40: eyJDYXRlZ29yeUxhYmVscyI6IiIsIk1ldGFkYXRhIjp7Im5zIjoiaHR0cDpcL1wvd3d3LnRpdHVzLmNvbVwvbnNcL0ludGVsMyIsImlkIjoiMTllYjY5NGMtMjgzNi00ZTRhLWIwN2ItM2ZmODExMTA5MTEzIiwicHJvcHMiOlt7Im4iOiJDVFBDbGFzc2lmaWNhdGlvbiIsInZhbHMiOlt7InZhbHVlIjoiQ1RQX05UIn1dfV19LCJTdWJqZWN0TGFiZWxzIjpbXSwiVE1DVmVyc2lvbiI6IjE3LjEwLjE4MDQuNDkiLCJUcnVzdGVkTGFiZWxIYXNoIjoibzdPcFwvcWpuNnBrMUphNzZXNTUxTWdUeEJUaFliWERQWFRFeStYS0VaZXJLanRneVVcL1VMNXYzQmtNRUZYMGRHIn0=
x-ctpclassification: CTP_NT
dlp-product: dlpe-windows
dlp-version: 11.0.600.7
dlp-reaction: no-action
x-originating-ip: [163.33.239.180]
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Subject: Re: [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 <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org
Sender: "dev" <dev-bounces@dpdk.org>
Message-ID: <20190410145738.PiWbipQ9zPVThutoQbpQwLX-1YIzYt4TXea3-QvKEXI@z>



> -----Original Message-----
> From: Richardson, Bruce
> Sent: Wednesday, April 10, 2019 2:45 PM
> To: Ananyev, Konstantin <konstantin.ananyev@intel.com>; aconole@redhat.co=
m
> Cc: dev@dpdk.org; Richardson, Bruce <bruce.richardson@intel.com>
> Subject: [PATCH 1/2] acl: remove use of weak functions
>=20
> 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.
>=20
> Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
> ---
>  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(-)
>=20
> 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 =3D files('acl_bld.c', 'acl_gen.c', 'acl_run_scal=
ar.c',
>  		'rte_acl.c', 'tb_mem.c')
>  headers =3D files('rte_acl.h', 'rte_acl_osdep.h')
>=20
> -if arch_subdir =3D=3D 'x86'
> +if dpdk_conf.has('RTE_ARCH_X86')
>  	sources +=3D files('acl_run_sse.c')
>=20
>  	# compile AVX2 version if either:
> @@ -28,4 +28,9 @@ if arch_subdir =3D=3D 'x86'
>  		cflags +=3D '-DCC_AVX2_SUPPORT'
>  	endif
>=20
> +elif dpdk_conf.has('RTE_ARCH_ARM') or dpdk_conf.has('RTE_ARCH_ARM64')
> +	cflags +=3D '-flax-vector-conversions'
> +	sources +=3D files('acl_run_neon.c')
> +elif dpdk_conf.has('RTE_ARCH_PPC_64')
> +	sources +=3D 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 =3D {
>  };
>  EAL_REGISTER_TAILQ(rte_acl_tailq)
>=20
> +#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
>=20
> -__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
>=20
> -__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_ac=
l_ctx *ctx,
>  {
>  	return -ENOTSUP;
>  }
> +#endif
> +#endif
>=20
> -__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
>=20
>  static const rte_acl_classify_t classify_fns[] =3D {
>  	[RTE_ACL_CLASSIFY_DEFAULT] =3D 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)    +=3D -lrte=
_distributor
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_IP_FRAG)        +=3D -lrte_ip_frag
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_METER)          +=3D -lrte_meter
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_LPM)            +=3D -lrte_lpm
> -# librte_acl needs --whole-archive because of weak functions
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)            +=3D --whole-archive
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)            +=3D -lrte_acl
> -_LDLIBS-$(CONFIG_RTE_LIBRTE_ACL)            +=3D --no-whole-archive
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY)      +=3D --no-as-needed
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY)      +=3D --whole-archive
>  _LDLIBS-$(CONFIG_RTE_LIBRTE_TELEMETRY)      +=3D -lrte_telemetry -ljanss=
on
> --

Acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
Tested-by: Konstantin Ananyev <konstantin.ananyev@intel.com>

> 2.20.1