From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH 05/11] hash: add fixed-size scalar RSS hash calculations
Date: Tue, 1 Dec 2026 15:16:17 +0000 [thread overview]
Message-ID: <20261201151623.2240031-6-bruce.richardson@intel.com> (raw)
In-Reply-To: <20261201151623.2240031-1-bruce.richardson@intel.com>
To match the GFNI RSS hash computation functions, add scalar
equivalents.
Signed-off-by: Bruce Richardson <bruce.richardson@intel.com>
---
lib/hash/meson.build | 1 +
lib/hash/thash_private.h | 12 ++++++++++
| 49 ++++++++++++++++++++++++++++++++++++++++
3 files changed, 62 insertions(+)
create mode 100644 lib/hash/thash_rss.c
diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index de21cfac50..abee43fa2a 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -24,6 +24,7 @@ sources = files(
'rte_thash.c',
'rte_thash_gfni.c',
'rte_thash_gf2_poly_math.c',
+ 'thash_rss.c',
)
deps += ['net']
diff --git a/lib/hash/thash_private.h b/lib/hash/thash_private.h
index 520d156d1d..f9187536aa 100644
--- a/lib/hash/thash_private.h
+++ b/lib/hash/thash_private.h
@@ -25,4 +25,16 @@ 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);
+uint32_t
+thash_scalar_8B(const uint8_t *key, const uint8_t *tuple);
+
+uint32_t
+thash_scalar_12B(const uint8_t *key, const uint8_t *tuple);
+
+uint32_t
+thash_scalar_32B(const uint8_t *key, const uint8_t *tuple);
+
+uint32_t
+thash_scalar_36B(const uint8_t *key, const uint8_t *tuple);
+
#endif /* THASH_PRIVATE_H */
--git a/lib/hash/thash_rss.c b/lib/hash/thash_rss.c
new file mode 100644
index 0000000000..65c109e1b0
--- /dev/null
+++ b/lib/hash/thash_rss.c
@@ -0,0 +1,49 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2026 Intel Corporation
+ */
+
+#include <string.h>
+
+#include <rte_byteorder.h>
+#include <rte_thash.h>
+
+#include "thash_private.h"
+
+static inline uint32_t
+thash_scalar(const uint8_t *key, const uint8_t *tuple, uint32_t len)
+{
+ uint32_t input[RTE_THASH_V6_L4_LEN];
+
+ for (uint32_t i = 0; i < len / sizeof(input[0]); i++) {
+ uint32_t word;
+
+ memcpy(&word, &tuple[i * sizeof(word)], sizeof(word));
+ input[i] = rte_be_to_cpu_32(word);
+ }
+
+ return rte_softrss_be(input, len / sizeof(input[0]), key);
+}
+
+uint32_t
+thash_scalar_8B(const uint8_t *key, const uint8_t *tuple)
+{
+ return thash_scalar(key, tuple, 8);
+}
+
+uint32_t
+thash_scalar_12B(const uint8_t *key, const uint8_t *tuple)
+{
+ return thash_scalar(key, tuple, 12);
+}
+
+uint32_t
+thash_scalar_32B(const uint8_t *key, const uint8_t *tuple)
+{
+ return thash_scalar(key, tuple, 32);
+}
+
+uint32_t
+thash_scalar_36B(const uint8_t *key, const uint8_t *tuple)
+{
+ return thash_scalar(key, tuple, 36);
+}
--
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 ` [PATCH 04/11] hash: add functions for GFNI RSS hash calculations Bruce Richardson
2026-12-01 15:16 ` Bruce Richardson [this message]
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-6-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