From patchwork Thu Aug 18 11:44:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Cristian Dumitrescu X-Patchwork-Id: 115237 X-Patchwork-Delegate: thomas@monjalon.net Return-Path: X-Original-To: patchwork@inbox.dpdk.org Delivered-To: patchwork@inbox.dpdk.org Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id B2D1BA034C; Thu, 18 Aug 2022 13:45:14 +0200 (CEST) Received: from [217.70.189.124] (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id CE24141181; Thu, 18 Aug 2022 13:45:05 +0200 (CEST) Received: from mga14.intel.com (mga14.intel.com [192.55.52.115]) by mails.dpdk.org (Postfix) with ESMTP id 1105B40694 for ; Thu, 18 Aug 2022 13:45:02 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1660823103; x=1692359103; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=fPn5GeKeW9fufNyf0xbK/alnePqc6UIEFaEZpjPodtc=; b=LqveqxSbjC53q6czLnVwPhuogJ3NUY5btVoK4nVyJ0GuXjhFuK70ZZFI 0iZ47mJblq1ghrFvBZ+cSfA/A6Fsw6UhVUdnVWCjB5Yjr/3K4SXe2aI5V bLDCYj9KJsigi8XPNm4cnNI3ykUV2RrCKkOAyve0UYK7bmR8yJSWu1cqD 8NebGaeKoJb3/qRRdhDa5nHcDYHQmU5i4rvW/4hbeoF3uFH5kU8/6Kr75 QR7d6YScrUcoR19R+ESmEH1UScifn4ia3e2XB9fL1mUwkYCqhU05BpRTI fh262sciEJi7R0q19RAY6eqlB4x/qoUyRAxTILFxLF4yqvYsY5mUbOhft w==; X-IronPort-AV: E=McAfee;i="6500,9779,10442"; a="292735206" X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="292735206" Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga103.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 18 Aug 2022 04:44:51 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.93,246,1654585200"; d="scan'208";a="668069697" Received: from silpixa00400573.ir.intel.com (HELO silpixa00400573.ger.corp.intel.com.) ([10.237.223.157]) by fmsmga008.fm.intel.com with ESMTP; 18 Aug 2022 04:44:50 -0700 From: Cristian Dumitrescu To: dev@dpdk.org Cc: "Kamalakannan R ." Subject: [PATCH 1/6] table: add hash function prototype Date: Thu, 18 Aug 2022 11:44:44 +0000 Message-Id: <20220818114449.1408226-2-cristian.dumitrescu@intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20220818114449.1408226-1-cristian.dumitrescu@intel.com> References: <20220818114449.1408226-1-cristian.dumitrescu@intel.com> MIME-Version: 1.0 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