From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 9F5A042D0B; Tue, 20 Jun 2023 21:28:29 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 56A8A410F6; Tue, 20 Jun 2023 21:28:29 +0200 (CEST) Received: from mail-ed1-f51.google.com (mail-ed1-f51.google.com [209.85.208.51]) by mails.dpdk.org (Postfix) with ESMTP id A49E3410D7 for ; Tue, 20 Jun 2023 21:28:27 +0200 (CEST) Received: by mail-ed1-f51.google.com with SMTP id 4fb4d7f45d1cf-518b69d5b5dso6992651a12.1 for ; Tue, 20 Jun 2023 12:28:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687289307; x=1689881307; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=ff7ydZq8MHoYDOOQWdyuQIk6iMMlajyOBZUSAvEfxpM=; b=pj2JTqJSAAfrDdlfVYUs6l6P1hL7n+mvlagK8AQSHs9H2ltTNCVAz3VCvrWzkKg0OG 3S6yWIGoeRHL2yBsvIbDHPxscQ5F2GCpIN26H7KisnRsL9/APvuQh3KXXOaRzUsUhc9G 8udFTT2rYI+vlF3f5dQxhq5WmD5GaP3y1LjJJ3/g5uXo0puCIJIqf5iho48UPMJhRDCS ZN3WDSzhqIjnGjpciaDHwsQDjFtj+474cckwpULcvot3mA0QA0r9MzN4uixOXdynLFtF 2QS+0NCOgJIiZ84NLZ1nHr1ifsAu4AjmGEN1Gws+dnIk9xewBA41Pkn4772op9Be1A12 Llgg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687289307; x=1689881307; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=ff7ydZq8MHoYDOOQWdyuQIk6iMMlajyOBZUSAvEfxpM=; b=Jb62O9eN6YMrWXISI4hT0V++IthtMX7FUR1WI60ECMawh91UsVnOLmkWMx5KbX+p9Q zlGYmdYOZHqWvc+fgwvcvMvrN8DoZqN6cjLsRBV/aoAFpVntL6hjLPkfo6d4WhVPsdCH dBET2qx1hhSoWRBk5pGsjtXIv2Ip2oAkMZV7qmht+Fzf/vjApmEj3eIAZAXkt3COf8YX XFT30AViFR6xNddbCTR79Cou5Z0Zba09hgygI9TWxJBpFMza4OjxBGYS0Mk5ZfNDmaUe niXUGQStTPcm3WlOezOWoqGw30dpzWWAyjCHRHZb8Muz5T+8fT88L6cFD4n3eXWEtvXM UR5A== X-Gm-Message-State: AC+VfDy6RTwHrmzKPL8z8/wYWNpSQYfUbjF6HJD99vbKCgoCgBDEeNrx l6y3TNFZ/SaRXspz5BsVv2WP8sVRMooMqCdhkcbKK6G3qfZlXg== X-Google-Smtp-Source: ACHHUZ4bpM6vJL42xk81IhIAZ0HLX3kEpEK858Prt2+Z9neYOk/B748JRvp5qpmQccH6/1c0qAEmKq+syHbpfBFSfOg= X-Received: by 2002:aa7:c1d3:0:b0:51a:595d:c08e with SMTP id d19-20020aa7c1d3000000b0051a595dc08emr5134853edp.34.1687289306896; Tue, 20 Jun 2023 12:28:26 -0700 (PDT) MIME-Version: 1.0 References: <20230215103041.3861350-1-qobilidop@gmail.com> In-Reply-To: From: Bili Dong Date: Tue, 20 Jun 2023 12:27:50 -0700 Message-ID: Subject: Re: [PATCH] hash: add XOR32 hash function To: Stephen Hemminger Cc: Yipeng Wang , dev , Cristian Dumitrescu Content-Type: multipart/alternative; boundary="000000000000c55fe405fe94a7b8" X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org --000000000000c55fe405fe94a7b8 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable For the HW I have access to, I think so. That is actually one of the major final goals of this patch, so we can model this HW in P4, including all the hash functions it supports, through the DPDK SWX pipeline. Thanks, Bili On Sat, Jun 17, 2023 at 1:59=E2=80=AFPM Stephen Hemminger < stephen@networkplumber.org> wrote: > Does it generate same hash as NIC than do it in HW? > > On Wed, Feb 15, 2023, 3:31 AM 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 >> --- >> .mailmap | 1 + >> app/test/test_hash_functions.c | 33 +++++++++++++++-- >> lib/hash/rte_hash_xor.h | 65 ++++++++++++++++++++++++++++++++++ >> 3 files changed, 96 insertions(+), 3 deletions(-) >> create mode 100644 lib/hash/rte_hash_xor.h >> >> diff --git a/.mailmap b/.mailmap >> index 5015494210..176dd93b66 100644 >> --- a/.mailmap >> +++ b/.mailmap >> @@ -159,6 +159,7 @@ Bernard Iremonger >> Bert van Leeuwen >> Bhagyada Modali >> Bharat Mota >> +Bili Dong >> Bill Hong >> Billy McFall >> Billy O'Mahony >> diff --git a/app/test/test_hash_functions.c >> b/app/test/test_hash_functions.c >> index 76d51b6e71..14d69d90c4 100644 >> --- a/app/test/test_hash_functions.c >> +++ b/app/test/test_hash_functions.c >> @@ -15,6 +15,7 @@ >> #include >> #include >> #include >> +#include >> >> #include "test.h" >> >> @@ -22,8 +23,8 @@ >> * Hash values calculated for key sizes from array "hashtest_key_lens" >> * and for initial values from array "hashtest_initvals. >> * Each key will be formed by increasing each byte by 1: >> - * e.g.: key size =3D 4, key =3D 0x03020100 >> - * key size =3D 8, key =3D 0x0706050403020100 >> + * e.g.: key size =3D 4, key =3D 0x00010203 >> + * key size =3D 8, key =3D 0x0001020304050607 >> */ >> static uint32_t hash_values_jhash[2][12] =3D {{ >> 0x8ba9414b, 0xdf0d39c9, >> @@ -51,6 +52,19 @@ static uint32_t hash_values_crc[2][12] =3D {{ >> 0x789c104f, 0x53028d3e >> } >> }; >> +static uint32_t hash_values_xor[2][12] =3D {{ >> + 0x00000000, 0x00010000, >> + 0x00010203, 0x04040404, 0x00000000, 0x00000000, >> + 0x00000000, 0x00000000, 0x0c040404, 0x000d0e0f, >> + 0x04212223, 0x04040404 >> +}, >> +{ >> + 0xdeadbeef, 0xdeacbeef, >> + 0xdeacbcec, 0xdaa9baeb, 0xdeadbeef, 0xdeadbeef, >> + 0xdeadbeef, 0xdeadbeef, 0xd2a9baeb, 0xdea0b0e0, >> + 0xda8c9ccc, 0xdaa9baeb >> +} >> +}; >> >> >> /**********************************************************************= ********* >> * Hash function performance test configuration section. Each >> performance test >> @@ -61,7 +75,7 @@ static uint32_t hash_values_crc[2][12] =3D {{ >> */ >> #define HASHTEST_ITERATIONS 1000000 >> #define MAX_KEYSIZE 64 >> -static rte_hash_function hashtest_funcs[] =3D {rte_jhash, rte_hash_crc}= ; >> +static rte_hash_function hashtest_funcs[] =3D {rte_jhash, rte_hash_crc, >> rte_hash_xor}; >> static uint32_t hashtest_initvals[] =3D {0, 0xdeadbeef}; >> static uint32_t hashtest_key_lens[] =3D { >> 1, 2, /* Unusual key sizes */ >> @@ -85,6 +99,9 @@ get_hash_name(rte_hash_function f) >> if (f =3D=3D rte_hash_crc) >> return "rte_hash_crc"; >> >> + if (f =3D=3D rte_hash_xor) >> + return "rte_hash_xor"; >> + >> return "UnknownHash"; >> } >> >> @@ -173,6 +190,16 @@ verify_precalculated_hash_func_tests(void) >> hash_values_crc[j][i], hash); >> return -1; >> } >> + >> + hash =3D rte_hash_xor(key, hashtest_key_lens[i], >> + hashtest_initvals[j]); >> + if (hash !=3D hash_values_xor[j][i]) { >> + printf("XOR for %u bytes with initial >> value 0x%x." >> + "Expected 0x%x, but got 0x%x\n", >> + hashtest_key_lens[i], >> hashtest_initvals[j], >> + hash_values_xor[j][i], hash); >> + return -1; >> + } >> } >> } >> >> diff --git a/lib/hash/rte_hash_xor.h b/lib/hash/rte_hash_xor.h >> new file mode 100644 >> index 0000000000..61ca8bee73 >> --- /dev/null >> +++ b/lib/hash/rte_hash_xor.h >> @@ -0,0 +1,65 @@ >> +/* SPDX-License-Identifier: BSD-3-Clause >> + * Copyright(c) 2023 Intel Corporation >> + */ >> + >> +#ifndef _RTE_HASH_XOR_H_ >> +#define _RTE_HASH_XOR_H_ >> + >> +/** >> + * @file >> + * >> + * RTE XOR Hash >> + */ >> + >> +#ifdef __cplusplus >> +extern "C" { >> +#endif >> + >> +#include >> + >> +#include >> + >> +#define LEFT8b_MASK rte_cpu_to_be_32(0xff000000) >> +#define LEFT16b_MASK rte_cpu_to_be_32(0xffff0000) >> + >> +/** >> + * 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) >> +{ >> + unsigned i; >> + uintptr_t pd =3D (uintptr_t) data; >> + init_val =3D rte_cpu_to_be_32(init_val); >> + >> + for (i =3D 0; i < data_len / 4; i++) { >> + init_val ^=3D *(const uint32_t *)pd; >> + pd +=3D 4; >> + } >> + >> + if (data_len & 0x2) { >> + init_val ^=3D *(const uint32_t *)pd & LEFT16b_MASK; >> + pd +=3D 2; >> + } >> + >> + if (data_len & 0x1) >> + init_val ^=3D *(const uint32_t *)pd & LEFT8b_MASK; >> + >> + init_val =3D rte_be_to_cpu_32(init_val); >> + return init_val; >> +} >> + >> +#ifdef __cplusplus >> +} >> +#endif >> + >> +#endif /* _RTE_HASH_XOR_H_ */ >> -- >> 2.34.1 >> >> --000000000000c55fe405fe94a7b8 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
For the HW I have access to, I think so.

That is actually one of the major final goals of this patch, so we can mo= del this HW in P4, including all the hash functions it supports,=C2=A0throu= gh the DPDK SWX pipeline.

Thanks,
Bili

On Sat, Jun 17, 2023 at 1:59=E2=80=AFPM Stephen Hemminger <stephen@networkplumber.org> w= rote:
Does it generate same hash as NIC than do it in HW?

On Wed, Feb 15= , 2023, 3:31 AM Bili Dong <qobilidop@gmail.com> wrote:
An XOR32 hash is needed in the Software Sw= itch (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@gmail.com>
---
=C2=A0.mailmap=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0|=C2=A0 1 +
=C2=A0app/test/test_hash_functions.c | 33 +++++++++++++++--
=C2=A0lib/hash/rte_hash_xor.h=C2=A0 =C2=A0 =C2=A0 =C2=A0 | 65 +++++++++++++= +++++++++++++++++++++
=C2=A03 files changed, 96 insertions(+), 3 deletions(-)
=C2=A0create mode 100644 lib/hash/rte_hash_xor.h

diff --git a/.mailmap b/.mailmap
index 5015494210..176dd93b66 100644
--- a/.mailmap
+++ b/.mailmap
@@ -159,6 +159,7 @@ Bernard Iremonger <bernard.iremonger@intel.= com>
=C2=A0Bert van Leeuwen <bert.vanleeuwen@netronome.com>=
=C2=A0Bhagyada Modali <bhagyada.modali@amd.com>
=C2=A0Bharat Mota <bmota@vmware.com>
+Bili Dong <qobilidop@gmail.com>
=C2=A0Bill Hong <bhong@brocade.com>
=C2=A0Billy McFall <bmcfall@redhat.com>
=C2=A0Billy O'Mahony <billy.o.mahony@intel.com>
diff --git a/app/test/test_hash_functions.c b/app/test/test_hash_functions.= c
index 76d51b6e71..14d69d90c4 100644
--- a/app/test/test_hash_functions.c
+++ b/app/test/test_hash_functions.c
@@ -15,6 +15,7 @@
=C2=A0#include <rte_hash.h>
=C2=A0#include <rte_jhash.h>
=C2=A0#include <rte_hash_crc.h>
+#include <rte_hash_xor.h>

=C2=A0#include "test.h"

@@ -22,8 +23,8 @@
=C2=A0 * Hash values calculated for key sizes from array "hashtest_key= _lens"
=C2=A0 * and for initial values from array "hashtest_initvals.
=C2=A0 * Each key will be formed by increasing each byte by 1:
- * e.g.: key size =3D 4, key =3D 0x03020100
- *=C2=A0 =C2=A0 =C2=A0 =C2=A0key size =3D 8, key =3D 0x0706050403020100 + * e.g.: key size =3D 4, key =3D 0x00010203
+ *=C2=A0 =C2=A0 =C2=A0 =C2=A0key size =3D 8, key =3D 0x0001020304050607 =C2=A0 */
=C2=A0static uint32_t hash_values_jhash[2][12] =3D {{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 0x8ba9414b, 0xdf0d39c9,
@@ -51,6 +52,19 @@ static uint32_t hash_values_crc[2][12] =3D {{
=C2=A0 =C2=A0 =C2=A0 =C2=A0 0x789c104f, 0x53028d3e
=C2=A0}
=C2=A0};
+static uint32_t hash_values_xor[2][12] =3D {{
+=C2=A0 =C2=A0 =C2=A0 =C2=A00x00000000, 0x00010000,
+=C2=A0 =C2=A0 =C2=A0 =C2=A00x00010203, 0x04040404, 0x00000000, 0x00000000,=
+=C2=A0 =C2=A0 =C2=A0 =C2=A00x00000000, 0x00000000, 0x0c040404, 0x000d0e0f,=
+=C2=A0 =C2=A0 =C2=A0 =C2=A00x04212223, 0x04040404
+},
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A00xdeadbeef, 0xdeacbeef,
+=C2=A0 =C2=A0 =C2=A0 =C2=A00xdeacbcec, 0xdaa9baeb, 0xdeadbeef, 0xdeadbeef,=
+=C2=A0 =C2=A0 =C2=A0 =C2=A00xdeadbeef, 0xdeadbeef, 0xd2a9baeb, 0xdea0b0e0,=
+=C2=A0 =C2=A0 =C2=A0 =C2=A00xda8c9ccc, 0xdaa9baeb
+}
+};

=C2=A0/********************************************************************= ***********
=C2=A0 * Hash function performance test configuration section. Each perform= ance test
@@ -61,7 +75,7 @@ static uint32_t hash_values_crc[2][12] =3D {{
=C2=A0 */
=C2=A0#define HASHTEST_ITERATIONS 1000000
=C2=A0#define MAX_KEYSIZE 64
-static rte_hash_function hashtest_funcs[] =3D {rte_jhash, rte_hash_crc}; +static rte_hash_function hashtest_funcs[] =3D {rte_jhash, rte_hash_crc, rt= e_hash_xor};
=C2=A0static uint32_t hashtest_initvals[] =3D {0, 0xdeadbeef};
=C2=A0static uint32_t hashtest_key_lens[] =3D {
=C2=A0 =C2=A0 =C2=A0 =C2=A0 1, 2,=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 = =C2=A0 =C2=A0 =C2=A0/* Unusual key sizes */
@@ -85,6 +99,9 @@ get_hash_name(rte_hash_function f)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 if (f =3D=3D rte_hash_crc)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return "rte_ha= sh_crc";

+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (f =3D=3D rte_hash_xor)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return "rte_ha= sh_xor";
+
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return "UnknownHash";
=C2=A0}

@@ -173,6 +190,16 @@ verify_precalculated_hash_func_tests(void)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hash_valu= es_crc[j][i], hash);
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 return -1;
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 }
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0hash =3D rte_hash_xor(key, hashtest_key_lens[i],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0hashtest_= initvals[j]);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0if (hash !=3D hash_values_xor[j][i]) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0printf("XOR for %u bytes with in= itial value 0x%x."
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 "Expected = 0x%x, but got 0x%x\n",
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hashtest_key_le= ns[i], hashtest_initvals[j],
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 hash_values_xor= [j][i], hash);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0return -1;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0}
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 }
=C2=A0 =C2=A0 =C2=A0 =C2=A0 }

diff --git a/lib/hash/rte_hash_xor.h b/lib/hash/rte_hash_xor.h
new file mode 100644
index 0000000000..61ca8bee73
--- /dev/null
+++ b/lib/hash/rte_hash_xor.h
@@ -0,0 +1,65 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2023 Intel Corporation
+ */
+
+#ifndef _RTE_HASH_XOR_H_
+#define _RTE_HASH_XOR_H_
+
+/**
+ * @file
+ *
+ * RTE XOR Hash
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include <stdint.h>
+
+#include <rte_byteorder.h>
+
+#define LEFT8b_MASK rte_cpu_to_be_32(0xff000000)
+#define LEFT16b_MASK rte_cpu_to_be_32(0xffff0000)
+
+/**
+ * Calculate XOR32 hash on user-supplied byte array.
+ *
+ * @param data
+ *=C2=A0 =C2=A0Data to perform hash on.
+ * @param data_len
+ *=C2=A0 =C2=A0How many bytes to use to calculate hash value.
+ * @param init_val
+ *=C2=A0 =C2=A0Value to initialise hash generator.
+ * @return
+ *=C2=A0 =C2=A032bit calculated hash value.
+ */
+static inline uint32_t
+rte_hash_xor(const void *data, uint32_t data_len, uint32_t init_val)
+{
+=C2=A0 =C2=A0 =C2=A0 =C2=A0unsigned i;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0uintptr_t pd =3D (uintptr_t) data;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0init_val =3D rte_cpu_to_be_32(init_val);
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0for (i =3D 0; i < data_len / 4; i++) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0init_val ^=3D *(con= st uint32_t *)pd;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pd +=3D 4;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (data_len & 0x2) {
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0init_val ^=3D *(con= st uint32_t *)pd & LEFT16b_MASK;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0pd +=3D 2;
+=C2=A0 =C2=A0 =C2=A0 =C2=A0}
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0if (data_len & 0x1)
+=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0init_val ^=3D *(con= st uint32_t *)pd & LEFT8b_MASK;
+
+=C2=A0 =C2=A0 =C2=A0 =C2=A0init_val =3D rte_be_to_cpu_32(init_val);
+=C2=A0 =C2=A0 =C2=A0 =C2=A0return init_val;
+}
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _RTE_HASH_XOR_H_ */
--
2.34.1

--000000000000c55fe405fe94a7b8--