DPDK patches and discussions
 help / color / mirror / Atom feed
From: "Coyle, David" <david.coyle@intel.com>
To: "Ananyev, Konstantin" <konstantin.ananyev@intel.com>,
	"O'loingsigh, Mairtin" <mairtin.oloingsigh@intel.com>,
	"Singh, Jasvinder" <jasvinder.singh@intel.com>,
	"Richardson, Bruce" <bruce.richardson@intel.com>,
	"De Lara Guarch, Pablo" <pablo.de.lara.guarch@intel.com>
Cc: "dev@dpdk.org" <dev@dpdk.org>,
	"Ryan, Brendan" <brendan.ryan@intel.com>,
	"O'loingsigh, Mairtin" <mairtin.oloingsigh@intel.com>
Subject: Re: [dpdk-dev] [PATCH v4 1/2] net: add run-time architecture specific	CRC selection
Date: Fri, 9 Oct 2020 14:04:50 +0000	[thread overview]
Message-ID: <MN2PR11MB3550D1E9A4AD47F26F1E6DA1E3080@MN2PR11MB3550.namprd11.prod.outlook.com> (raw)
In-Reply-To: <BYAPR11MB3301FF7BC5B7C3750AC6AACF9A0A0@BYAPR11MB3301.namprd11.prod.outlook.com>

Hi Konstantin, thanks for your review

> -----Original Message-----
> From: Ananyev, Konstantin <konstantin.ananyev@intel.com>
> Sent: Wednesday, October 7, 2020 3:59 PM

<snip>

> 
> >
> > This patch adds support for run-time selection of the optimal
> > architecture-specific CRC path, based on the supported instruction
> > set(s) of the CPU.
> >
> > The compiler option checks have been moved from the C files to the
> > meson script. The rte_cpu_get_flag_enabled function is called
> > automatically by the library at process initialization time to
> > determine which instructions the CPU supports, with the most optimal
> > supported CRC path ultimately selected.
> >
> > Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh@intel.com>
> > Signed-off-by: David Coyle <david.coyle@intel.com>
> 
> LGTM, just one nit see below.
> With that:
> Series acked-by: Konstantin Ananyev <konstantin.ananyev@intel.com>
> 
> > ---
> >  doc/guides/rel_notes/release_20_11.rst            |  4 ++
> >  lib/librte_net/meson.build                        | 34 +++++++++++-
> >  lib/librte_net/net_crc.h                          | 34 ++++++++++++
> >  lib/librte_net/{net_crc_neon.h => net_crc_neon.c} | 26 +++------
> >  lib/librte_net/{net_crc_sse.h => net_crc_sse.c}   | 34 ++++--------
> >  lib/librte_net/rte_net_crc.c                      | 67 ++++++++++++++---------
> >  6 files changed, 131 insertions(+), 68 deletions(-)  create mode
> > 100644 lib/librte_net/net_crc.h  rename lib/librte_net/{net_crc_neon.h
> > => net_crc_neon.c} (95%)  rename lib/librte_net/{net_crc_sse.h =>
> > net_crc_sse.c} (94%)
> >
> >

<snip>

> > +#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT static uint8_t
> > +sse42_pclmulqdq_cpu_supported(void)
> > +{
> > +	return rte_cpu_get_flag_enabled(RTE_CPUFLAG_PCLMULQDQ);
> > +}
> 
> As a nit, I think it would be better to hide #fidef inside the function, and
> return an 0 when define is not set.
> Something like:
> 
> static int
> sse42_pclmulqdq_cpu_supported(void)
> {
> #ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT
> 	return rte_cpu_get_flag_enabled(RTE_CPUFLAG_PCLMULQDQ);
> #else
> 	return 0;
> }
> 
> Same for other cpu_supported functions.
> And then you can remove these ifdefs in set_alg and other palces, i.e.:
> 
> void
> rte_net_crc_set_alg(enum rte_net_crc_alg alg) {
>         switch (alg) {
> #ifdef RTE_ARCH_X86_64
>         case RTE_NET_CRC_AVX512:
>                 if (avx512_vpclmulqdq_cpu_supported()) {
>                         handlers = handlers_avx512;
>                         break;
>                 }
>                 /* fall-through */
>         case RTE_NET_CRC_SSE42:
>                 if (sse42_pclmulqdq_cpu_supported()) {
>                         handlers = handlers_sse42;
>                         break;
>                 }
> #endif
> ...
> 
> Same for rte_net_crc_init()

[DC] I have reworked the ifdefs in this file based on your comments here and off-list discussions.
These are available now in the v5.

All ifdef's have been removed out the API function definitions and moved down into 'helper' type
functions - looks much cleaner now.

Your Ack has been carried through too to v5 as you mentioned

> 
> > +#endif
> > +
> > +#ifdef CC_ARM64_NEON_PMULL_SUPPORT
> > +static uint8_t
> > +neon_pmull_cpu_supported(void)
> > +{
> > +	return rte_cpu_get_flag_enabled(RTE_CPUFLAG_PMULL);
> > +}
> > +#endif
> > +
> >  void
> >  rte_net_crc_set_alg(enum rte_net_crc_alg alg)  {
> >  	switch (alg) {
> > -#ifdef X86_64_SSE42_PCLMULQDQ
> > +#ifdef RTE_ARCH_X86_64
> >  	case RTE_NET_CRC_SSE42:
> > -		handlers = handlers_sse42;
> > -		break;
> > -#elif defined ARM64_NEON_PMULL
> > -		/* fall-through */
> > +#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT
> > +		if (sse42_pclmulqdq_cpu_supported()) {
> > +			handlers = handlers_sse42;
> > +			break;
> > +		}
> > +#endif
> > +#endif /* RTE_ARCH_X86_64 */
> > +#ifdef RTE_ARCH_ARM64
> >  	case RTE_NET_CRC_NEON:
> > -		if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_PMULL)) {
> > +#ifdef CC_ARM64_NEON_PMULL_SUPPORT
> > +		if (neon_pmull_cpu_supported()) {
> >  			handlers = handlers_neon;
> >  			break;
> >  		}
> >  #endif
> > +#endif /* RTE_ARCH_ARM64 */
> >  		/* fall-through */
> >  	case RTE_NET_CRC_SCALAR:
> >  		/* fall-through */
> > @@ -188,11 +200,14 @@ RTE_INIT(rte_net_crc_init)
> >
> >  	rte_net_crc_scalar_init();
> >
> > -#ifdef X86_64_SSE42_PCLMULQDQ
> > -	alg = RTE_NET_CRC_SSE42;
> > -	rte_net_crc_sse42_init();
> > -#elif defined ARM64_NEON_PMULL
> > -	if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_PMULL)) {
> > +#ifdef CC_X86_64_SSE42_PCLMULQDQ_SUPPORT
> > +	if (sse42_pclmulqdq_cpu_supported()) {
> > +		alg = RTE_NET_CRC_SSE42;
> > +		rte_net_crc_sse42_init();
> > +	}
> > +#endif
> > +#ifdef CC_ARM64_NEON_PMULL_SUPPORT
> > +	if (neon_pmull_cpu_supported()) {
> >  		alg = RTE_NET_CRC_NEON;
> >  		rte_net_crc_neon_init();
> >  	}
> > --
> > 2.12.3


  reply	other threads:[~2020-10-09 14:05 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-09-29 15:35 [dpdk-dev] [PATCH v3 0/2] net: add CRC run-time checks and AVX512/VPCLMULQDQ based CRC Mairtin o Loingsigh
2020-09-29 15:36 ` [dpdk-dev] [PATCH v3 1/2] net: add run-time architecture specific CRC selection Mairtin o Loingsigh
2020-10-02 15:17   ` Singh, Jasvinder
2020-10-06 16:38     ` O'loingsigh, Mairtin
2020-09-29 15:36 ` [dpdk-dev] [PATCH v3 2/2] net: add support for AVX512/VPCLMULQDQ based CRC Mairtin o Loingsigh
2020-10-05 13:20   ` De Lara Guarch, Pablo
2020-10-05 13:38     ` O'loingsigh, Mairtin
2020-10-06 16:23 ` [dpdk-dev] [PATCH v4 0/2] net: add CRC run-time checks and " Mairtin o Loingsigh
2020-10-06 16:23   ` [dpdk-dev] [PATCH v4 1/2] net: add run-time architecture specific CRC selection Mairtin o Loingsigh
2020-10-07 14:59     ` Ananyev, Konstantin
2020-10-09 14:04       ` Coyle, David [this message]
2020-10-10 12:42         ` Ananyev, Konstantin
2020-10-06 16:23   ` [dpdk-dev] [PATCH v4 2/2] net: add support for AVX512/VPCLMULQDQ based CRC Mairtin o Loingsigh
2020-10-07  9:26   ` [dpdk-dev] [PATCH v4 0/2] net: add CRC run-time checks and " David Marchand
2020-10-09 13:50   ` [dpdk-dev] [PATCH v5 " Mairtin o Loingsigh
2020-10-09 13:50     ` [dpdk-dev] [PATCH v5 1/2] net: add run-time architecture specific CRC selection Mairtin o Loingsigh
2020-10-09 16:22       ` Singh, Jasvinder
2020-10-10  9:34       ` Ruifeng Wang
2020-10-13  9:07       ` Bruce Richardson
2020-10-09 13:50     ` [dpdk-dev] [PATCH v5 2/2] net: add support for AVX512/VPCLMULQDQ based CRC Mairtin o Loingsigh
2020-10-09 16:24       ` Singh, Jasvinder
2020-10-09 18:35     ` [dpdk-dev] [PATCH v5 0/2] net: add CRC run-time checks and " De Lara Guarch, Pablo
2020-10-13 18:47     ` David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=MN2PR11MB3550D1E9A4AD47F26F1E6DA1E3080@MN2PR11MB3550.namprd11.prod.outlook.com \
    --to=david.coyle@intel.com \
    --cc=brendan.ryan@intel.com \
    --cc=bruce.richardson@intel.com \
    --cc=dev@dpdk.org \
    --cc=jasvinder.singh@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=mairtin.oloingsigh@intel.com \
    --cc=pablo.de.lara.guarch@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).