From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D848D606A31A for ; Tue, 1 Dec 2026 15:16:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=Sg2vELi5 Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 0D824402B8; Tue, 1 Dec 2026 16:16:47 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTPS id 279624027A for ; Tue, 1 Dec 2026 16:16:44 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796138206; x=1827674206; h=from:to:cc:subject:date:message-id:mime-version: content-transfer-encoding; bh=7ox41s3oWA/s7P3oGrolqdavSc0bzZXJVyL5cGwNg2g=; b=Sg2vELi5OBm2ha1caY/4tKr8D2fv1msC8TA3hmw6EmOwj7n/BidExvX5 iLPwjif5yumuzMrZy1m7hHOgCzkZ0pPrQNslxRVLnUnkN9jNAU/BaDhVD hG9UNdYM05JBL9FcQb7aADkNOVT05SwK95WwmmJm0NKQ8JJdZo4UWpUJh q9ql27+dKxFlskxOX7I26pi5qa/kinhF3dAth/biKh6rmNsAPKlsN26Tg g+BrEGvp2tW4gv6Ld/fLW1js3LD65ZSq6zmY4jrPDKqHfljQfEc9r333d S5wMhauLAygH279Oadx78l8g1F9R/A4KXjgHWf3dn4Rirdxf4Q4awaqJq A==; X-CSE-ConnectionGUID: 4g03++rNTbuYDjxhhFUVcw== X-CSE-MsgGUID: izxInkb6QpK+F4JZHxMAvA== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5023479" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5023479" Received: from fmviesa001.fm.intel.com ([10.60.135.141]) by fmvoesa110.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 01 Dec 2026 07:16:43 -0800 X-CSE-ConnectionGUID: /9/7Qq9FTTGY+4c3q9lhcw== X-CSE-MsgGUID: RPDtqwUbTCyrUvUO8HqldQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13749373" Received: from silpixa00401385.ir.intel.com ([10.20.224.226]) by fmviesa001.fm.intel.com with ESMTP; 01 Dec 2026 07:16:42 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 00/11] Add optimized path selection for thash Date: Tue, 1 Dec 2026 15:16:12 +0000 Message-ID: <20261201151623.2240031-1-bruce.richardson@intel.com> X-Mailer: git-send-email 2.55.0 X-Archived-By: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Archive: List-Post: List-Help: List-Subscribe: , X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_GIT autolearn=ham autolearn_force=no version=4.0.1 X-Spam-Checker-Version: SpamAssassin 4.0.1 (2024-03-26) on aws-us-west-2-korg-listserv-alma10-1 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