From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id EB16E45B17; Fri, 11 Oct 2024 20:17:11 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 227C740E35; Fri, 11 Oct 2024 20:17:10 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by mails.dpdk.org (Postfix) with ESMTP id D3DC740268 for ; Fri, 11 Oct 2024 20:17:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728670627; x=1760206627; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=YVm8ij1K9Xz+2407eFnaBPWJi5RQ4x8sEPkTLuruVbE=; b=Y4MA6E/Aeh9FLkOPOJ6ex6Xi/MlTDyqcBkci5cR6kKmd9un0Y8ePvSwX j1Fbnl8M/VzLX8sIZKrAtnqSLzrbRxhT+Tjtd6k9899ecNX8UMxda4w5W WEaFUSWSC3reJd7QiAYCb7ESpzpW2SnzQJDJLB3nz9OQntoCFDHM8+FlQ vBNoVzebqhEdu9c/kB4JM9VTsIs17ltfCCLteX7dw9eqg3RBzxdqKjOwr 8UARu+LWlXIY2U5xpcYMlowwRyyb8ioFGnkRFchq//bvfESmqPfbtk53k mY/wrXznbj4iD2atUteCeYoq78nJ4RvWydax0n6K4rWldwCizs+Ep95cS g==; X-CSE-ConnectionGUID: JWTHeVVRReWgKCp6yDdGKg== X-CSE-MsgGUID: zNer1cvGSI2X8HeAoOsHSw== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="31778798" X-IronPort-AV: E=Sophos;i="6.11,196,1725346800"; d="scan'208";a="31778798" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa107.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Oct 2024 11:17:06 -0700 X-CSE-ConnectionGUID: DWCAfjRiTA2UBe8B69bTAg== X-CSE-MsgGUID: Gv05Fab2S2K2/i0nVnRDVw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,196,1725346800"; d="scan'208";a="77793234" Received: from unknown (HELO silpixa00401176.ir.intel.com) ([10.243.22.76]) by orviesa008.jf.intel.com with ESMTP; 11 Oct 2024 11:17:05 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: stephen@networkplumber.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [PATCH v3 1/4] thash: add RSS hash key generation API Date: Fri, 11 Oct 2024 18:16:59 +0000 Message-ID: <20241011181703.236985-2-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241011181703.236985-1-vladimir.medvedkin@intel.com> References: <20241010123331.749004-1-vladimir.medvedkin@intel.com> <20241011181703.236985-1-vladimir.medvedkin@intel.com> 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-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Currently the only way to have non static Toeplitz hash key is to generate it randomly. Such a key may not guarantee good packets distribution, especially if there are small number of flows. This patch adds stub implementation of the Toeplitz hash key generation function, which may improve Toeplitz hash key with respect to hash values distribution. Signed-off-by: Vladimir Medvedkin --- lib/hash/rte_thash.c | 13 +++++++++++++ lib/hash/rte_thash.h | 24 ++++++++++++++++++++++++ lib/hash/version.map | 2 ++ 3 files changed, 39 insertions(+) diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 10721effe6..894b4d9197 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -832,3 +832,16 @@ rte_thash_adjust_tuple(struct rte_thash_ctx *ctx, return ret; } + +int +rte_thash_gen_key(uint8_t *key, size_t key_len, size_t reta_sz_log, + uint32_t entropy_start, size_t entropy_sz) +{ + RTE_SET_USED(key); + RTE_SET_USED(key_len); + RTE_SET_USED(reta_sz_log); + RTE_SET_USED(entropy_start); + RTE_SET_USED(entropy_sz); + + return 0; +} diff --git a/lib/hash/rte_thash.h b/lib/hash/rte_thash.h index 30b657e67a..ab534aea2f 100644 --- a/lib/hash/rte_thash.h +++ b/lib/hash/rte_thash.h @@ -447,6 +447,30 @@ rte_thash_adjust_tuple(struct rte_thash_ctx *ctx, uint32_t desired_value, unsigned int attempts, rte_thash_check_tuple_t fn, void *userdata); +/** + * @warning + * @b EXPERIMENTAL: this API may change without prior notice + * + * Modify RSS hash key such that subtuple bits corresponding to `entropy_sz` + * bits starting from `entropy_start` will have the most even distribution with + * this key with a given ReTa size. + * + * @param key pointer to the RSS hash key + * @param key_len length of the key + * @param reta_sz_log log2 of the size of RSS redirection table. i.e. number of + * bits of the rss hash value used to identify RSS ReTa entry + * @param entropy_start bit offset from the beginning of the tuple where user + * expects best distribution of the subtuple values. + * @param entropy_sz size in bits of the part of subtuple + * + * @return + * 0 on success negative otherwise + */ +__rte_experimental +int +rte_thash_gen_key(uint8_t *key, size_t key_len, size_t reta_sz_log, + uint32_t entropy_start, size_t entropy_sz); + #ifdef __cplusplus } #endif diff --git a/lib/hash/version.map b/lib/hash/version.map index 11a5394a45..4f13f1d5aa 100644 --- a/lib/hash/version.map +++ b/lib/hash/version.map @@ -52,6 +52,8 @@ EXPERIMENTAL { # added in 24.07 rte_hash_rcu_qsbr_dq_reclaim; + # added in 24.11 + rte_thash_gen_key; }; INTERNAL { -- 2.43.0