[1/6] table: add hash function prototype
Checks
Commit Message
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>
---
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
@@ -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',
new file mode 100644
@@ -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