DPDK-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/11] Add optimized path selection for thash
@ 2026-12-01 15:16 Bruce Richardson
  2026-12-01 15:16 ` [PATCH 01/11] hash: improve build-time instruction set checks " Bruce Richardson
                   ` (10 more replies)
  0 siblings, 11 replies; 12+ messages in thread
From: Bruce Richardson @ 2026-12-01 15:16 UTC (permalink / raw)
  To: dev; +Cc: Bruce Richardson

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


^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2026-12-01 15:18 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
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 ` [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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox