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 4A9F3606A320 for ; Tue, 1 Dec 2026 15:17:21 +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=L4psgecb Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C68084066C; Tue, 1 Dec 2026 16:16:51 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTPS id 9D809402E1 for ; Tue, 1 Dec 2026 16:16:47 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796138208; x=1827674208; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=tCHkgGA9WCKsphFmAxKwK2MkEjCrwAsH+aFMxR+RInk=; b=L4psgecbZMWb+uK1wn8gyzkA5qUy3H6rl8snup8jSOwwTsNctAh130MK OCj6cnVj07rLBsoEevAkUGDh9vkSGyQJEF5BxLCjpOfEpmUlUPA5TR2HV Fet8hcMvY0d9xn4M7IGpYg2cqmRnHcUGFqil12ZpQedz6Zks2UqPNPRd7 mtZt+KNq6qn2LvnwsOtYWB7/4fTKUgj7y1iHIy3/r72b0Rp+vXe5nUF9w k97VqviqFQ0ha2i8UHapsGfOGsq9kWWHCc65TJkcjUuuUNJ+3/bH41C6L e/Oq674+C7pb+p3oVlEPwBuafSGByjEnELPzzvJ20ei3REbehiPZ11T88 Q==; X-CSE-ConnectionGUID: uNT1qunxQVmokE5Chfed/A== X-CSE-MsgGUID: IFVRf3ITRWCMYPLbyV65EQ== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5023487" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5023487" 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:46 -0800 X-CSE-ConnectionGUID: Xz468mKLTrqnoXyKsN8CJg== X-CSE-MsgGUID: dGlS0JYsS0m5YS8ZVmBhwQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13749395" Received: from silpixa00401385.ir.intel.com ([10.20.224.226]) by fmviesa001.fm.intel.com with ESMTP; 01 Dec 2026 07:16:45 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 04/11] hash: add functions for GFNI RSS hash calculations Date: Tue, 1 Dec 2026 15:16:16 +0000 Message-ID: <20261201151623.2240031-5-bruce.richardson@intel.com> X-Mailer: git-send-email 2.55.0 In-Reply-To: <20261201151623.2240031-1-bruce.richardson@intel.com> References: <20261201151623.2240031-1-bruce.richardson@intel.com> 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=-18.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,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 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 --- 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 + +#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