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 71D1245BC3; Thu, 24 Oct 2024 20:47:09 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 7F02143539; Thu, 24 Oct 2024 20:47:05 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id C4BE540156 for ; Thu, 24 Oct 2024 20:47:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729795623; x=1761331623; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I3Fhz7QAa3vjc49eaUmGdP+MW1i/RdPbUK+ttFLRqa4=; b=VM6vOcM0LElzYpADe99715SGgYCQGQ8l97koaj5QN5XbypmSuiWI93q9 0JUhFCHCz2BerFF2mkOObp6FZ4lzlwj91UhZvLHbG8N/hlKjX/JaoCi5c kCGYjAP0Ys3Xx43LBcwz0AigTN5PyfuaP5dHxOnlnZOGYudOb4fAcWy63 8B3xxtLXWTFkavwAPZRApqgmn7dNit11b0QFDn/cZdYIxopWlHVAxGBzN zfvA56KEjq+Iw/RVcqqiXwe2IWkv5Mn7BPu85zTnhF6LMsV27pVITHRjU g2oozCKP/3lC1Tsz3jXR2S47KrIb1URDcQamEDHbHKyO/45g2iM2/bWha Q==; X-CSE-ConnectionGUID: 7oe1zw2eQNG9yfetjO2mFA== X-CSE-MsgGUID: Mw/bppFtQVy+Wpy3U2WY0g== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="29607971" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="29607971" Received: from fmviesa004.fm.intel.com ([10.60.135.144]) by orvoesa110.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2024 11:47:03 -0700 X-CSE-ConnectionGUID: nrAjLNviSYqKR14GWoRAaw== X-CSE-MsgGUID: f6O6ErdpQEWmDh39BuYeMg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85280460" Received: from silpixa00401176.ir.intel.com ([10.243.23.21]) by fmviesa004.fm.intel.com with ESMTP; 24 Oct 2024 11:47:01 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: stephen@networkplumber.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [PATCH v4 1/4] thash: add RSS hash key generation API Date: Thu, 24 Oct 2024 18:46:53 +0000 Message-ID: <20241024184657.901099-2-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241024184657.901099-1-vladimir.medvedkin@intel.com> References: <20241011181703.236985-1-vladimir.medvedkin@intel.com> <20241024184657.901099-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 99a685f0c8..463992368a 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -856,3 +856,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 e8fdb89530..80313705a1 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