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 <cristian.dumitre...@intel.com> Signed-off-by: Kamalakannan R. <kamalakanna...@intel.com> --- 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 <stdint.h> + +/** + * 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