[dpdk-dev] [PATCH v5 2/2] hash: unify crc32 selection for x86 and Arm

David Marchand david.marchand at redhat.com
Fri Apr 8 11:16:38 CEST 2022


On Tue, Jan 4, 2022 at 10:12 AM Ruifeng Wang <Ruifeng.Wang at arm.com> wrote:
> > From: pbhagavatula at marvell.com <pbhagavatula at marvell.com>
[snip]
> > -/**
> > - * Use single crc32 instruction to perform a hash on a 2 bytes value.
> > - * Fall back to software crc32 implementation in case SSE4.2 is
> > - * not supported
> > - *
> > - * @param data
> > - *   Data to perform hash on.
> > - * @param init_val
> > - *   Value to initialise hash generator.
> > - * @return
> > - *   32bit calculated hash value.
> > - */
> > -static inline uint32_t
> > -rte_hash_crc_2byte(uint16_t data, uint32_t init_val) -{ -#if defined
> > RTE_ARCH_X86
> > -     if (likely(crc32_alg & CRC32_SSE42))
> > -             return crc32c_sse42_u16(data, init_val);
> > +#if defined RTE_ARCH_ARM64
> > +             RTE_LOG(WARNING, HASH,
> > +                     "Incorrect CRC32 algorithm requested setting best
> > available algorithm on the architecture\n");
> > +             rte_hash_crc_set_alg(CRC32_ARM64);
> > +#endif
> > +             break;
> > +     case CRC32_ARM64:
> > +#if defined RTE_ARCH_ARM64
> > +             if (rte_cpu_get_flag_enabled(RTE_CPUFLAG_CRC32))
> > +                     crc32_alg = CRC32_ARM64;
> >  #endif
> > + #if defined RTE_ARCH_X86
> > +             RTE_LOG(WARNING, HASH,
> > +                     "Incorrect CRC32 algorithm requested setting best
> > available algorithm on the architecture\n");
> > +             rte_hash_crc_set_alg(CRC32_SSE42_x64);
> >  #endif
> > +             break;
>
> I edited this part for readability.
> The 'break' need to be inside #if, so algorithm can fallback to CRC32_SW  when CRC32 feature is not available on hardware.

I marked this series in patchwork as changes requested.

Thanks.


-- 
David Marchand



More information about the dev mailing list