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 50E1745BC3; Thu, 24 Oct 2024 20:47:24 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 2812D4354D; Thu, 24 Oct 2024 20:47:20 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.18]) by mails.dpdk.org (Postfix) with ESMTP id EA5EB43543 for ; Thu, 24 Oct 2024 20:47:05 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1729795626; x=1761331626; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=huGZsSbXyFbTgJgdHBSJ2AlT4+OwqF/Ynf/73rqUIYE=; b=VpdaO/I0g/sQQM0v6nr1LoYOszFsQTcJEQqYWSMEv07i8/GMJ8zCXXlj t+262+U8evTWwHJlb5dMr0yV+t7BaH8F88lMk+Si8CG5g6bkR3mV9UYVV i0SYg34WEV3EcF7rJt0XduCvZLQeBxnUeKniTKnXdFNmOim5YPxsoG4bm A/RASjH/vqZz0GV4d3GxfljAYjNDhO7PGrAHMp4kA12t93DFdPCTsLWSD 2CazQ1SSeLE9zq7+YeWK/3UQOP8xAaMghyaodqkc9rjf+eKzpEcMxe20B 6ohptjkNLnsmjyiDfxfOM0cfk/nlpNjkAR4ldvaKk3sSoUexikvgu+u84 Q==; X-CSE-ConnectionGUID: HuUVXHhDRnWzYltSca27Mw== X-CSE-MsgGUID: 0nrablioSFuvDEXQpoQo7w== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="29607980" X-IronPort-AV: E=Sophos;i="6.11,199,1725346800"; d="scan'208";a="29607980" 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:06 -0700 X-CSE-ConnectionGUID: dwWx32E2Sjai/RZTzvBKSQ== X-CSE-MsgGUID: VFQqO5+WRUeGXlVPEH2EJQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,230,1725346800"; d="scan'208";a="85280468" Received: from silpixa00401176.ir.intel.com ([10.243.23.21]) by fmviesa004.fm.intel.com with ESMTP; 24 Oct 2024 11:47:04 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: stephen@networkplumber.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [PATCH v4 3/4] hash: implement RSS hash key generation API Date: Thu, 24 Oct 2024 18:46:55 +0000 Message-ID: <20241024184657.901099-4-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 This patch implements Toeplitz hash key generation function using the new polynomial generation function. Signed-off-by: Vladimir Medvedkin --- doc/guides/rel_notes/release_24_11.rst | 3 +++ lib/hash/rte_thash.c | 23 ++++++++++++++++++----- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/doc/guides/rel_notes/release_24_11.rst b/doc/guides/rel_notes/release_24_11.rst index fa4822d928..9d00a2e1c2 100644 --- a/doc/guides/rel_notes/release_24_11.rst +++ b/doc/guides/rel_notes/release_24_11.rst @@ -247,6 +247,9 @@ New Features Added ability for node to advertise and update multiple xstat counters, that can be retrieved using ``rte_graph_cluster_stats_get``. +* **Added RSS hash key generating API.** + A new function ``rte_thash_gen_key`` is provided to modify the RSS hash key + to achieve better traffic distribution with RSS. Removed Items ------------- diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index da35aec860..336c228e64 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -827,11 +827,24 @@ 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); + size_t i, end, start; + + /* define lfsr sequence range*/ + end = entropy_start + entropy_sz + TOEPLITZ_HASH_LEN - 1; + start = end - (entropy_sz + reta_sz_log - 1); + + if ((key == NULL) || (key_len * CHAR_BIT < entropy_start + entropy_sz) || + (entropy_sz < reta_sz_log) || (reta_sz_log > TOEPLITZ_HASH_LEN)) + return -EINVAL; + + struct thash_lfsr *lfsr = alloc_lfsr(reta_sz_log); + if (lfsr == NULL) + return -ENOMEM; + + for (i = start; i < end; i++) + set_bit(key, get_bit_lfsr(lfsr), i); + + free_lfsr(lfsr); return 0; } -- 2.43.0