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 317BDA034C; Fri, 19 Aug 2022 21:52:35 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id A4D32410E8; Fri, 19 Aug 2022 21:52:30 +0200 (CEST) Received: from mga02.intel.com (mga02.intel.com [134.134.136.20]) by mails.dpdk.org (Postfix) with ESMTP id C190E40689 for ; Fri, 19 Aug 2022 21:52:28 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660938749; x=1692474749; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fPn5GeKeW9fufNyf0xbK/alnePqc6UIEFaEZpjPodtc=; b=QQwA2Wk32e8Xxrpq2lRU9ARWy5Oef/4Gn5wZo4BdrHsKO32EyeBcg5ev b+YQacLNj+NZwMdzquhYJjEIrGP70oqN2XMDawqFsEIRRxyqUr9dvgPUE U2pGzU9SZXPgDA7QnIbSfyoU/CNWbFRNbOZoa+lJRfmgdXrmMh3apt4Xx FoJvRYQ6D+UVCDV2RQXTEsoAxxJqtkQAvCx5w99z11cT/1Z+5ACTpbvz/ 1snPk11ZQlzb83cRmgcZfv+iOs9CHh7Ptg2y3gghy1WuFSfu7BWvyvixG wHTo06r7oUnoVxM8M495zJq5mrD+p4f0T0Pp7fyJJM3t/CV1NRcbSo1ac A==; X-IronPort-AV: E=McAfee;i="6500,9779,10444"; a="280047520" X-IronPort-AV: E=Sophos;i="5.93,249,1654585200"; d="scan'208";a="280047520" Received: from orsmga007.jf.intel.com ([10.7.209.58]) by orsmga101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Aug 2022 12:52:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,248,1654585200"; d="scan'208";a="604695941" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by orsmga007.jf.intel.com with ESMTP; 19 Aug 2022 12:52:27 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: "Kamalakannan R ." Subject: [PATCH V2 1/6] table: add hash function prototype Date: Fri, 19 Aug 2022 19:52:20 +0000 Message-Id: <20220819195225.1483020-2-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220819195225.1483020-1-cristian.dumitrescu@intel.com> References: <20220818114449.1408226-1-cristian.dumitrescu@intel.com> <20220819195225.1483020-1-cristian.dumitrescu@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 Add hash function prototype to be used by the exact match and the learner table types. The hash function is not mask-based, so the table key fields have to be contiguous in memory. Signed-off-by: Cristian Dumitrescu Signed-off-by: Kamalakannan R. --- lib/table/meson.build | 1 + lib/table/rte_swx_hash_func.h | 39 +++++++++++++++++++++++++++++++++++ 2 files changed, 40 insertions(+) create mode 100644 lib/table/rte_swx_hash_func.h diff --git a/lib/table/meson.build b/lib/table/meson.build index d1f2f9dcf6..6d4272c4ef 100644 --- a/lib/table/meson.build +++ b/lib/table/meson.build @@ -26,6 +26,7 @@ sources = files( ) headers = files( 'rte_lru.h', + 'rte_swx_hash_func.h', 'rte_swx_table.h', 'rte_swx_table_em.h', 'rte_swx_table_learner.h', diff --git a/lib/table/rte_swx_hash_func.h b/lib/table/rte_swx_hash_func.h new file mode 100644 index 0000000000..04f3d543e7 --- /dev/null +++ b/lib/table/rte_swx_hash_func.h @@ -0,0 +1,39 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2022 Intel Corporation + */ +#ifndef __INCLUDE_RTE_SWX_HASH_FUNC_H__ +#define __INCLUDE_RTE_SWX_HASH_FUNC_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +/** + * @file + * RTE SWX Hash Function + */ + +#include + +/** + * Hash function prototype + * + * @param[in] key + * Key to hash. Must be non-NULL. + * @param[in] length + * Key length in bytes. + * @param[in] seed + * Hash seed. + * @return + * Hash value. + */ +typedef uint32_t +(*rte_swx_hash_func_t)(const void *key, + uint32_t length, + uint32_t seed); + +#ifdef __cplusplus +} +#endif + +#endif -- 2.34.1