[dpdk-dev] [PATCH] net: add support for AVX512 when generating CRC

Bruce Richardson bruce.richardson at intel.com
Thu Sep 10 14:27:41 CEST 2020


On Thu, Sep 10, 2020 at 01:01:11PM +0100, Mairtin o Loingsigh wrote:
> This patch enables the generation of CRC using AVX512 instruction
> set when available on the host platform.
> 
> Signed-off-by: Mairtin o Loingsigh <mairtin.oloingsigh at intel.com>
> ---
> 
> v1:
> * Initial version, with AVX512 support for CRC32 Ethernet only
>  (requires further updates)
>   * AVX512 support for CRC16-CCITT and final implementation of
>     CRC32 Ethernet will be added in v2
> ---
>  doc/guides/rel_notes/release_20_11.rst |    4 +
>  lib/librte_net/net_crc_avx.h           |  331 ++++++++++++++++++++++++++++++++
>  lib/librte_net/rte_net_crc.c           |   23 ++-
>  lib/librte_net/rte_net_crc.h           |    1 +
>  4 files changed, 358 insertions(+), 1 deletions(-)
>  create mode 100644 lib/librte_net/net_crc_avx.h
> 
<snip>
> --- a/lib/librte_net/rte_net_crc.c
> +++ b/lib/librte_net/rte_net_crc.c
> @@ -10,12 +10,18 @@
>  #include <rte_common.h>
>  #include <rte_net_crc.h>
>  
> -#if defined(RTE_ARCH_X86_64) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ)
> +#if defined(RTE_ARCH_X86_64) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ) \
> +	&& defined(RTE_MACHINE_CPUFLAG_AVX512F)
> +#define X86_64_AVX512F_PCLMULQDQ     1
> +#elif defined(RTE_ARCH_X86_64) && defined(RTE_MACHINE_CPUFLAG_PCLMULQDQ)

This all seems to be build-time selection of path. Can you perhaps
investigate adding runtime selection instead, so that this can be used from
distro packages, or DPDK compiled on older systems but used on newer.
See also patchset: http://patches.dpdk.org/project/dpdk/list/?series=11831
which is relevant to this too.

/Bruce


More information about the dev mailing list