table: add hash function prototype

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.dumitrescu@intel.com>
Signed-off-by: Kamalakannan R <kamalakannan.r@intel.com>
This commit is contained in:
Cristian Dumitrescu 2022-08-19 19:52:20 +00:00 committed by Thomas Monjalon
parent fbd59c8ecb
commit f5fda6863a
2 changed files with 40 additions and 0 deletions

View File

@ -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',

View File

@ -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