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 E328945B17; Fri, 11 Oct 2024 20:17:21 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 1B7EE40E41; Fri, 11 Oct 2024 20:17:14 +0200 (CEST) Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.15]) by mails.dpdk.org (Postfix) with ESMTP id 5FA604064F for ; Fri, 11 Oct 2024 20:17:10 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1728670631; x=1760206631; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=C4mlWvpwZKXnNJJRwaMUf51VWHnMhBxF9wmyfAGWgjY=; b=FYUDdczxgfGJ5bfDoYMxtIu/zRIhMaoMQBRmUxFGpOcDxfrnRdJo+yjC HSC5WohgbTx2ErmsNLpSz+T+emaVV9XUVF7o0lrx4epohPNEBAUh09RF9 TXy1jbTfapPaF5FF9ylhfqaaSsxlCIRaPCkPs0+UCIyUYbL0yUXg1P98Y z0i+foUcueuiPDWsH3xZRA/FNDjpDsv3gC8CP6SS19WdisO6szYOH8K0L 20aUaWRJBIEOJnNh2lzNttde5u4JbgjLIPXNcbbVGTkzF1XkGYGEpy31Q /05E9I5xCXvF98kokvPTdcrVuQYRdIgDNOSDfv8C6swZY21QImaF4414a Q==; X-CSE-ConnectionGUID: H+I8c5s9SRam/DdkL7b4QQ== X-CSE-MsgGUID: 6gaqsuf+Q7qmV6lZ0aShkw== X-IronPort-AV: E=McAfee;i="6700,10204,11222"; a="31778807" X-IronPort-AV: E=Sophos;i="6.11,196,1725346800"; d="scan'208";a="31778807" 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:10 -0700 X-CSE-ConnectionGUID: 9LWgoLAORnm0fX4rycKbwg== X-CSE-MsgGUID: T1aKMaClSjeHU7xgZ0mWmg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.11,196,1725346800"; d="scan'208";a="77793305" Received: from unknown (HELO silpixa00401176.ir.intel.com) ([10.243.22.76]) by orviesa008.jf.intel.com with ESMTP; 11 Oct 2024 11:17:09 -0700 From: Vladimir Medvedkin To: dev@dpdk.org Cc: stephen@networkplumber.org, Yipeng Wang , Sameh Gobriel , Bruce Richardson Subject: [PATCH v3 3/4] hash: implement RSS hash key generation API Date: Fri, 11 Oct 2024 18:17:01 +0000 Message-ID: <20241011181703.236985-4-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 This patch implements Toeplitz hash key generation function using the new polynomial generation function. Signed-off-by: Vladimir Medvedkin --- lib/hash/rte_thash.c | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 5c3d246657..80fcfe866f 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -803,11 +803,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