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 C603B45B04; Thu, 10 Oct 2024 14:33:39 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 937B04065A; Thu, 10 Oct 2024 14:33:37 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) by mails.dpdk.org (Postfix) with ESMTP id 4DCAB402D8 for ; Thu, 10 Oct 2024 14:33:34 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728563615; x=1760099615; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=uPz1i+jNHZAbn6gZLwe6W6ihW/cGY78kU71Bv8u0q6s=; b=f6cWBLP71ft9jVFN8NeRF7kcOOtTtQ+jA0nd8a4mD/BRPw0gf0RxTq5i jWrThOu3i4nf6StoISdc+7sJ5ebIPEuDI/i03Sw8puOjbMtYdF1Q47EI1 LS6JoyR1MJXIXtb0fWL6+2BiycRPX2JYXHS3XXw9eeNuLwX3JRscFlyo+ 3MHnec+gygzlrT2gNR8DihrBupHhsri3Sq8FNZv4lBn33Sqd3+YYAUhA0 kbSREAcitOH8OPZLXpbG3QkLhp1KfHE+4wrNmsIgNEUL1kFC8FVvdXx1g BXwhE3vyO0CoIMso9CBbL5mAuMphi7EdWCTqYaS5ZTda9Q+lfyhKattgz g==; X-CSE-ConnectionGUID: A8WN06HYRFqPJm5K8hDPxQ== X-CSE-MsgGUID: o0YBa/bJSiiRG7mIdMarMA== X-IronPort-AV: E=McAfee;i="6700,10204,11220"; a="31712319" X-IronPort-AV: E=Sophos;i="6.11,193,1725346800"; d="scan'208";a="31712319" Received: from fmviesa005.fm.intel.com ([10.60.135.145]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Oct 2024 05:33:34 -0700 X-CSE-ConnectionGUID: Rs82HGokQg+k56THGtJ7cA== X-CSE-MsgGUID: ji9tXNN3RwmoWX92xVMt+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,193,1725346800"; d="scan'208";a="81101881" Received: from unknown (HELO silpixa00401176.ir.intel.com) ([10.243.22.170]) by fmviesa005.fm.intel.com with ESMTP; 10 Oct 2024 05:33:32 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: stephen@networkplumber.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [PATCH v2 1/4] thash: add RSS hash key generation API Date: Thu, 10 Oct 2024 12:33:28 +0000 Message-Id: <20241010123331.749004-2-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241010123331.749004-1-vladimir.medvedkin@intel.com> References: <20241010123331.749004-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..df9b4960ce 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, int key_len, int reta_sz_log, + int entropy_start, int 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..560fc1de73 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, int key_len, int reta_sz_log, + int entropy_start, int 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.34.1