[PATCH v3] hash: add XOR32 hash function

Bili Dong qobilidop at gmail.com
Mon Feb 20 18:21:24 CET 2023


The naming is following the existing CRC32 hash:
https://elixir.bootlin.com/dpdk/v22.11.1/source/lib/hash/rte_hash_crc.h#L168.
I believe all existing hash functions in DPDK are 32 bits, so "32" didn't
appear in other hash function names. If we add "32" here, we probably
should also rename rte_hash_crc(). I'm fine with either option.

On Mon, Feb 20, 2023 at 5:49 AM Thomas Monjalon <thomas at monjalon.net> wrote:

> 15/02/2023 12:06, Bili Dong:
> > An XOR32 hash is needed in the Software Switch (SWX) Pipeline for its
> > use case in P4. We implement it in this patch so it could be easily
> > registered in the pipeline later.
> >
> > Signed-off-by: Bili Dong <qobilidop at gmail.com>
> > ---
> > +/**
> > + * Calculate XOR32 hash on user-supplied byte array.
> > + *
> > + * @param data
> > + *   Data to perform hash on.
> > + * @param data_len
> > + *   How many bytes to use to calculate hash value.
> > + * @param init_val
> > + *   Value to initialise hash generator.
> > + * @return
> > + *   32bit calculated hash value.
> > + */
> > +static inline uint32_t
> > +rte_hash_xor(const void *data, uint32_t data_len, uint32_t init_val)
>
> Should we add "32" in the function name?
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mails.dpdk.org/archives/dev/attachments/20230220/ef2e2c87/attachment.htm>


More information about the dev mailing list