From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH 04/11] hash: add functions for GFNI RSS hash calculations
Date: Tue, 1 Dec 2026 15:16:16 +0000 [thread overview]
Message-ID: <20261201151623.2240031-5-bruce.richardson@intel.com> (raw)
In-Reply-To: <20261201151623.2240031-1-bruce.richardson@intel.com>
The RSS is computed over IPv4 or IPv6 headers using 8 or 32-byte keys
respectively, or over IP + TCP/UDP headers using 12 or 36 byte keys.
Therefore create explicit non-inline functions for those key lengths. By
making these non-inline functions we can compile them using GFNI
instructions for later runtime selection, even when the current target
instruction set does not include all necessary instructions, e.g.
building for a "default" target.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/hash/meson.build | 8 ++++++++
lib/hash/thash_gfni_avx512.c | 35 +++++++++++++++++++++++++++++++++++
lib/hash/thash_private.h | 12 ++++++++++++
3 files changed, 55 insertions(+)
create mode 100644 lib/hash/thash_gfni_avx512.c
diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index 7ce504ee8b..de21cfac50 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -29,3 +29,11 @@ sources = files(
deps += ['net']
deps += ['ring']
deps += ['rcu']
+
+if dpdk_conf.has('RTE_ARCH_X86') and cc_has_avx512
+ thash_gfni_cflags = ['-mgfni', '-mavx512vbmi']
+ if cc.has_multi_arguments(thash_gfni_cflags)
+ sources_avx512 += files('thash_gfni_avx512.c')
+ cflags_avx512 += thash_gfni_cflags
+ endif
+endif
diff --git a/lib/hash/thash_gfni_avx512.c b/lib/hash/thash_gfni_avx512.c
new file mode 100644
index 0000000000..d62b5acc1f
--- /dev/null
+++ b/lib/hash/thash_gfni_avx512.c
@@ -0,0 +1,35 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2026 Intel Corporation
+ */
+
+#include <rte_thash_x86_gfni.h>
+
+#include "thash_private.h"
+
+#ifndef RTE_THASH_GFNI_DEFINED
+#error "GFNI and required AVX512 extensions must be enabled to build this file"
+#endif
+
+uint32_t
+thash_gfni_avx512_8B(const uint64_t *mtrx, const uint8_t *tuple)
+{
+ return rte_thash_gfni(mtrx, tuple, 8);
+}
+
+uint32_t
+thash_gfni_avx512_12B(const uint64_t *mtrx, const uint8_t *tuple)
+{
+ return rte_thash_gfni(mtrx, tuple, 12);
+}
+
+uint32_t
+thash_gfni_avx512_32B(const uint64_t *mtrx, const uint8_t *tuple)
+{
+ return rte_thash_gfni(mtrx, tuple, 32);
+}
+
+uint32_t
+thash_gfni_avx512_36B(const uint64_t *mtrx, const uint8_t *tuple)
+{
+ return rte_thash_gfni(mtrx, tuple, 36);
+}
diff --git a/lib/hash/thash_private.h b/lib/hash/thash_private.h
index ed13b605a3..520d156d1d 100644
--- a/lib/hash/thash_private.h
+++ b/lib/hash/thash_private.h
@@ -13,4 +13,16 @@
uint32_t
thash_get_rand_poly(uint32_t poly_degree);
+uint32_t
+thash_gfni_avx512_8B(const uint64_t *mtrx, const uint8_t *tuple);
+
+uint32_t
+thash_gfni_avx512_12B(const uint64_t *mtrx, const uint8_t *tuple);
+
+uint32_t
+thash_gfni_avx512_32B(const uint64_t *mtrx, const uint8_t *tuple);
+
+uint32_t
+thash_gfni_avx512_36B(const uint64_t *mtrx, const uint8_t *tuple);
+
#endif /* THASH_PRIVATE_H */
--
2.55.0
next prev parent reply other threads:[~2026-12-01 15:17 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 15:16 [PATCH 00/11] Add optimized path selection for thash Bruce Richardson
2026-12-01 15:16 ` [PATCH 01/11] hash: improve build-time instruction set checks " Bruce Richardson
2026-12-01 15:16 ` [PATCH 02/11] test/thash_perf: test gfni thash when platform supports Bruce Richardson
2026-12-01 15:16 ` [PATCH 03/11] hash: create library internal header file for thash Bruce Richardson
2026-12-01 15:16 ` Bruce Richardson [this message]
2026-12-01 15:16 ` [PATCH 05/11] hash: add fixed-size scalar RSS hash calculations Bruce Richardson
2026-12-01 15:16 ` [PATCH 06/11] hash: add thash context struct for runtime path selection Bruce Richardson
2026-12-01 15:16 ` [PATCH 07/11] hash: implement IPv4 and IPv6 RSS hashing in SW Bruce Richardson
2026-12-01 15:16 ` [PATCH 08/11] hash: add explicit handling for RSS with split L3/L4 data Bruce Richardson
2026-12-01 15:16 ` [PATCH 09/11] test/thash: add perf tests for new RSS functions Bruce Richardson
2026-12-01 15:16 ` [PATCH 10/11] hash: remove extra store-load when performing RSS Bruce Richardson
2026-12-01 15:16 ` [PATCH 11/11] hash: add AVX2 RSS hash functions Bruce Richardson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20261201151623.2240031-5-bruce.richardson@intel.com \
--to=bruce.richardson@intel.com \
--cc=dev@dpdk.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox