Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bili Dong
Thanks, I'll check it out. On Mon, Feb 20, 2023 at 3:04 PM Stephen Hemminger < step...@networkplumber.org> wrote: > On Mon, 20 Feb 2023 12:44:06 -0800 > Bili Dong wrote: > > > Hi Cristian, > > > > I agree the 64-bit version could enable better performance, and I will do > > it in the next versio

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bili Dong
Hi Cristian, I agree the 64-bit version could enable better performance, and I will do it in the next version. For endianness, see my comments below (inline): On Mon, Feb 20, 2023 at 12:19 PM Dumitrescu, Cristian < cristian.dumitre...@intel.com> wrote: > HI Bili, > > Comments inline below: > >

RE: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Dumitrescu, Cristian
HI Bili, Comments inline below: > diff --git a/lib/hash/rte_hash_xor.h b/lib/hash/rte_hash_xor.h > new file mode 100644 > index 00..7004f83ec2 > --- /dev/null > +++ b/lib/hash/rte_hash_xor.h > @@ -0,0 +1,65 @@ > +/* SPDX-License-Identifier: BSD-3-Clause > + * Copyright(c) 2023 Intel Cor

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bili Dong
Got it. Will fix. Thanks! On Mon, Feb 20, 2023 at 12:10 PM Medvedkin, Vladimir < vladimir.medved...@intel.com> wrote: > Hi Bill, > > On 15/02/2023 11:06, Bili Dong wrote: > > An XOR32 hash is needed in the Software Switch (SWX) Pipeline for its > > use case in P4. We implement it in this patch so

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Medvedkin, Vladimir
Hi Bill, On 15/02/2023 11:06, Bili Dong wrote: 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 --- +static inline uint32_t +rte_hash_xor(const vo

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bili Dong
I think the endianness conversions are necessary, otherwise, the hash function return value will be host endianness dependent. For example, what should rte_hash_xor32(/*data*/ &{0x00, 0x01, 0x02, 0x03}, /*data_len*/ 4, /*init_val*/ 0x0) return? With the current implementation, it returns 0x0001020

RE: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Dumitrescu, Cristian
Hi Bili, Would it be possible to also remove the endianness conversion from this hash function? What would be the impact if the rte_cpu_to_be() functions are removed? Thanks, Cristian

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bili Dong
Got it. I’ll update the patch. On Mon, Feb 20, 2023 at 9:52 AM Bruce Richardson wrote: > On Mon, Feb 20, 2023 at 06:38:23PM +0100, Thomas Monjalon wrote: > > 20/02/2023 18:21, Bili Dong: > > > The naming is following the existing CRC32 hash: > > > > https://elixir.bootlin.com/dpdk/v22.11.1/sourc

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bruce Richardson
On Mon, Feb 20, 2023 at 06:38:23PM +0100, Thomas Monjalon wrote: > 20/02/2023 18:21, Bili Dong: > > 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 "3

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Thomas Monjalon
20/02/2023 18:21, Bili Dong: > 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

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Bili Dong
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_

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-20 Thread Thomas Monjalon
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 > --- > +/** > + * Calculate XOR32 hash on user-supplied byte

RE: [PATCH v3] hash: add XOR32 hash function

2023-02-16 Thread Morten Brørup
: Re: [PATCH v3] hash: add XOR32 hash function Hi Morten, Thanks for your comments! For endianness conversion, I double-checked my usages. I did use both rte_cpu_to_be_32() and rte_be_to_cpu_32(). I might have missed something but I think I used them (4 occurrences) in a semantically

Re: [PATCH v3] hash: add XOR32 hash function

2023-02-15 Thread Bili Dong
Hi Morten, Thanks for your comments! For endianness conversion, I double-checked my usages. I did use both rte_cpu_to_be_32() and rte_be_to_cpu_32(). I might have missed something but I think I used them (4 occurrences) in a semantically meaningful way. Could you point me to the lines that are co

RE: [PATCH v3] hash: add XOR32 hash function

2023-02-15 Thread Morten Brørup
> From: Bili Dong [mailto:qobili...@gmail.com] > Sent: Wednesday, 15 February 2023 12.07 > > 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

[PATCH v3] hash: add XOR32 hash function

2023-02-15 Thread 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 --- .mailmap | 1 + app/test/test_hash_functions.c | 33 +++-- l