From: Bruce Richardson <bruce.richardson@intel.com>
To: dev@dpdk.org
Cc: Bruce Richardson <bruce.richardson@intel.com>
Subject: [PATCH 00/11] Add optimized path selection for thash
Date: Tue, 1 Dec 2026 15:16:12 +0000 [thread overview]
Message-ID: <20261201151623.2240031-1-bruce.richardson@intel.com> (raw)
The Toeplitz hash function, used in NICs for RSS, may sometimes need to
be computed by software. DPDK already ships a scalar implementation of
this algorithm, and also includes an inline function for x86 optimized
using GFNI and AVX-512. Because the optimized function, which is very
much faster than the scalar one (on my system over an order of magnitude
faster), is an inlne one, it requires the application to itself know
when it is safe to use, i.e. that the application will be deployed on a
system with the necessary GFNI+AVX512 instruction sets. The vector
function and the scalar versions also differ in how the arguments need
to be prepared for use - specifically in terms of data endianness.
While leaving the existing code in place for backward compatibility, we
can provide a higher-level common interface for doing the calculations,
with runtime path selection to choose the best implementation - scalar
GFNI+AVX2 or GFNI+AVX512.
The path selection is managed via a thash context object, and the
decision on which set of functions to use is made once at context
creation time. The API functions to perform the actual calculation are
tied to the standard RSS protocol tuples for IPv4 and IPv6, not to
generic data lengths. While it is possible to have length-based APIs,
having the protocol based functions avoids potential performance
degradation issues in building the tuple array for hashing.
Specifially, copying data in chunks of 4 or 8 bytes to a local array and
then passing that into a vector function can lead to execution
slowdowns due to vector loads stalling on data written by scalar stores
(no store-forwarding). By having the API take the pointers to IP header
and L4 headers, the necessary vector registers can be loaded directly
from source, without any intermediate copying, avoiding any potential
store-forwarding issues in the function.
Bruce Richardson (11):
hash: improve build-time instruction set checks for thash
test/thash_perf: test gfni thash when platform supports
hash: create library internal header file for thash
hash: add functions for GFNI RSS hash calculations
hash: add fixed-size scalar RSS hash calculations
hash: add thash context struct for runtime path selection
hash: implement IPv4 and IPv6 RSS hashing in SW
hash: add explicit handling for RSS with split L3/L4 data
test/thash: add perf tests for new RSS functions
hash: remove extra store-load when performing RSS
hash: add AVX2 RSS hash functions
app/test/test_thash.c | 170 ++++++++++++++++++++
app/test/test_thash_perf.c | 150 +++++++++++++++++-
doc/guides/rel_notes/release_27_03.rst | 6 +
lib/hash/meson.build | 20 +++
lib/hash/rte_thash.c | 37 ++++-
lib/hash/rte_thash.h | 13 --
lib/hash/rte_thash_gf2_poly_math.c | 4 +-
lib/hash/rte_thash_rss.h | 156 +++++++++++++++++++
lib/hash/rte_thash_x86_gfni.h | 4 +-
lib/hash/thash_gfni_avx2.c | 170 ++++++++++++++++++++
lib/hash/thash_gfni_avx512.c | 132 ++++++++++++++++
lib/hash/thash_private.h | 108 +++++++++++++
lib/hash/thash_rss.c | 208 +++++++++++++++++++++++++
lib/meson.build | 3 +-
14 files changed, 1155 insertions(+), 26 deletions(-)
create mode 100644 lib/hash/rte_thash_rss.h
create mode 100644 lib/hash/thash_gfni_avx2.c
create mode 100644 lib/hash/thash_gfni_avx512.c
create mode 100644 lib/hash/thash_private.h
create mode 100644 lib/hash/thash_rss.c
--
2.55.0
next reply other threads:[~2026-12-01 15:16 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-01 15:16 Bruce Richardson [this message]
2026-12-01 15:16 ` [PATCH 01/11] hash: improve build-time instruction set checks for thash 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 ` [PATCH 05/11] hash: add fixed-size scalar " 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-1-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