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 C38F141CEE; Mon, 20 Feb 2023 18:22:03 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B071D430B5; Mon, 20 Feb 2023 18:22:03 +0100 (CET) Received: from mail-ed1-f41.google.com (mail-ed1-f41.google.com [209.85.208.41]) by mails.dpdk.org (Postfix) with ESMTP id 16FF440395 for ; Mon, 20 Feb 2023 18:22:02 +0100 (CET) Received: by mail-ed1-f41.google.com with SMTP id ck15so8676811edb.0 for ; Mon, 20 Feb 2023 09:22:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=NxtEjOwGLxSLORtIHqUKk0U+3VZaQ3FBt1X2+NjqIFI=; b=FcJ2B+AjaAvb38wNDXuzApWFrLWoLKR3e5bdmYu1UCZqXZ7/G8KZozyHMbcIuwTf5p AtT2iaqtMERKSHsDzrH61r1cqkBqcNb/k0pZ3Fs0++yX5ep/2YoNZjM+y0EGrZ2q/U9S +/7l2GYzQ/+vw5RSfRxF5PzvGgRNq9MYT93/sUkCSsV84ShwxMUj06B0DfhNeWAN+P3m H1pt+ZrptZyX8ngqb7se37u6itFNrDJqzHUcMkC1esDrJLu/m4wYmpNPzeq4E/SxSzsL zSL+DE8qcg2qcGk54ECyd/tYIzvbVsgrYTJJ0p6FqBChtwdCE1BZO5DLFg7P0pWJtCxE UsNQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=NxtEjOwGLxSLORtIHqUKk0U+3VZaQ3FBt1X2+NjqIFI=; b=bFgzAty1580tkZk8CaiElaXJOvH8yORT8Y1Qo5VdN5p3SSJ+922dovqU0EFGHVSuq3 6Gnf68Ts+dl3imY6haWVGTPHvHZDqDMWTRTDtOWAbJhn0+NtMiYaJV0CS7OxftKtt+Y5 7T4qNx2/++zuz3sPgq/WMki2sQWUREf61iq9X/48xrCeIOWQ4qTAhOWVEWnRknKXln+C ADyUJdaAoXhdKiBtc+4QNfHtJDiR8bjBIU1lk1pb6ATn8QoDhC3Igd9GKmVB0GCZlcbx vHR+ApsI7g7r9gvws6c94bwijfdeMTQob4A8GwVk1mDj3FyfNNnLXsf99rCFbW07vSI1 qnVg== X-Gm-Message-State: AO0yUKUB1na6D/eZdMs/eks1TrKoXg6AaLPCqxXsJqK3av9V1eTn+Qqc 5SHE4hSaL7aVH+4I3qHSr4VB235LERosdXAo7Xo= X-Google-Smtp-Source: AK7set8YZ43DTkWxj/MTFPLgfrjP599A4cx+3Cuk5GoDs9aj3N3HSBc6MO3SjhVoETzaxPMlWYcvn4JeNpho1bXvGlw= X-Received: by 2002:a50:a6d3:0:b0:4ac:b442:5a4b with SMTP id f19-20020a50a6d3000000b004acb4425a4bmr504071edc.0.1676913721294; Mon, 20 Feb 2023 09:22:01 -0800 (PST) MIME-Version: 1.0 References: <20230215105442.3878441-1-qobilidop@gmail.com> <20230215110630.3885175-1-qobilidop@gmail.com> <3296424.9LS3J3VOpE@thomas> In-Reply-To: <3296424.9LS3J3VOpE@thomas> From: Bili Dong Date: Mon, 20 Feb 2023 09:21:24 -0800 Message-ID: Subject: Re: [PATCH v3] hash: add XOR32 hash function To: Thomas Monjalon Cc: yipeng1.wang@intel.com, Sameh Gobriel , Bruce Richardson , dev@dpdk.org, cristian.dumitrescu@intel.com Content-Type: multipart/alternative; boundary="000000000000ad454b05f524e680" 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 --000000000000ad454b05f524e680 Content-Type: text/plain; charset="UTF-8" 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 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 > > --- > > +/** > > + * 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? > > > --000000000000ad454b05f524e680 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
The naming is following the existing CRC32 hash:=C2=A0https://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 ad= d "32" here, we probably should also rename=C2=A0rte_hash_crc(). = I'm fine with either option.

On Mon, Feb 20, 2023 at 5:49 AM Thomas Monj= alon <thomas@monjalon.net>= wrote:
15/02/20= 23 12:06, Bili Dong:
> An XOR32 hash is needed in the Software Switch (SWX) Pipeline for its<= br> > 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>
> ---
> +/**
> + * 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)<= br>
Should we add "32" in the function name?


--000000000000ad454b05f524e680--