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 9F7E145920; Fri, 6 Sep 2024 18:53:27 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id B099542FD3; Fri, 6 Sep 2024 18:53:23 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.13]) by mails.dpdk.org (Postfix) with ESMTP id 7290142E82 for ; Fri, 6 Sep 2024 18:53:21 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725641602; x=1757177602; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=shgQm+QcPCbC2pORmOXWwSqel1NKaK7Uf0+78G7aFTs=; b=ZAGW/u0CF0Y835kYUB8m6pxbnlEGcTN5yy5ogInYT+iyhphjNnJ4Tn8z hQQJa00Vxk52IU1FIa1FBV+QaAsGxFwzzV+WkLHB6Jj97wIJ0sy70qagJ g2bANh2ik3wB3Flo87mUnW7s2KK1KkBBFd0oeg6RiBgWPQoEgK2M/EXIy BxWqMSPyqishL/6qIBaKSyTWj4wzboa6mNtw2LC21JtAWt/8+wFHKdjGn 5iziV2ThJkV7tg7axD+uBBo9fD9zwqUC1Vc6bWkiW/pBZATazLk3g3tIC fZWQHAvknjKasWGb1utRqyNRdVjxfbJ/MiBN4yQtfWUWUTzMUBp+uJ/Zf Q==; X-CSE-ConnectionGUID: ydXU9eaKRZyTz3wwNEIxNQ== X-CSE-MsgGUID: Q5uIRET6TE6OvEPRkRM26g== X-IronPort-AV: E=McAfee;i="6700,10204,11187"; a="27334100" X-IronPort-AV: E=Sophos;i="6.10,208,1719903600"; d="scan'208";a="27334100" Received: from fmviesa009.fm.intel.com ([10.60.135.149]) by fmvoesa107.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 06 Sep 2024 09:53:21 -0700 X-CSE-ConnectionGUID: GxR+NXjtSsOMvBRQxtYbTg== X-CSE-MsgGUID: 9A5TVWOnTuOL/RYsjR/D1w== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,208,1719903600"; d="scan'208";a="65996772" Received: from silpixa00401176.ir.intel.com ([10.243.22.170]) by fmviesa009.fm.intel.com with ESMTP; 06 Sep 2024 09:53:20 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [RFC 1/4] thash: add RSS hash key generation API Date: Fri, 6 Sep 2024 16:53:15 +0000 Message-Id: <20240906165318.1322550-2-vladimir.medvedkin@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240906165318.1322550-1-vladimir.medvedkin@intel.com> References: <20240906165318.1322550-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 | 4 +++- 3 files changed, 40 insertions(+), 1 deletion(-) 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..7d31fc1ba5 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 { @@ -59,4 +61,4 @@ INTERNAL { rte_thash_gfni_stub; rte_thash_gfni_bulk_stub; -}; +}; \ No newline at end of file -- 2.34.1