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 8B438606A31A for ; Tue, 1 Dec 2026 15:17:29 +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=bi+hJWi0 Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id ACB1A4067D; Tue, 1 Dec 2026 16:16:52 +0100 (CET) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.16]) by mails.dpdk.org (Postfix) with ESMTPS id 1C018402E3 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=1796138209; x=1827674209; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=onewUiuqyZ0+rDLstjiQn8YqEN6wsgJt1TZ4hVXbsf8=; b=bi+hJWi0C/B0HRlEOOgyeTQVbXeeGvyDiZ1Gyko3J8dVWO1gbFfQoVEL SAQHD0Da1gbtdFU0qVq5PVX3v15JIkVSY1sQ3C+h5ELrg2x64RUF+9FPM Stv6munQ6dQI2zJYUVEDORpcOOmUJjrxodxUg62V50JA5aOifbeACr1ze Ok1aU6viRQkFU1SNF1GOnMZz9vz7v1gS34og5X+HVLGUB5BwwX4nOhkN0 Mfr9gXXM/8X1k9xMu1MN9tHai3U2tJ7RuTtiWpN3oHkxVCT0ujs+j6Ffm ecG2VVDDBW/pEgpTvohofyYJPMfVFBYRj1fz42EdBH2/P8zC0lPICEHJI Q==; X-CSE-ConnectionGUID: Jg4WGwazRzydGPKmsfLcOQ== X-CSE-MsgGUID: cJyZP+8FSqavH0CDPI1LbQ== X-IronPort-AV: E=McAfee;i="6800,10657,11983"; a="5023490" X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="5023490" 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:47 -0800 X-CSE-ConnectionGUID: 52LNR9suRcmhsMDuEQWusg== X-CSE-MsgGUID: SD1fbaqsTFKshqX3NAcY3Q== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,245,1787036400"; d="scan'208";a="13749399" Received: from silpixa00401385.ir.intel.com ([10.20.224.226]) by fmviesa001.fm.intel.com with ESMTP; 01 Dec 2026 07:16:46 -0800 From: Bruce Richardson To: dev@dpdk.org Cc: Bruce Richardson Subject: [PATCH 05/11] hash: add fixed-size scalar RSS hash calculations Date: Tue, 1 Dec 2026 15:16:17 +0000 Message-ID: <20261201151623.2240031-6-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 To match the GFNI RSS hash computation functions, add scalar equivalents. Signed-off-by: Bruce Richardson --- lib/hash/meson.build | 1 + lib/hash/thash_private.h | 12 ++++++++++ lib/hash/thash_rss.c | 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 */ diff --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 + +#include +#include + +#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