Having stubs in header file makes it harder to update
RTE_LOG(). Also modify to only print warning once.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/hash/meson.build | 8 ++++++-
lib/hash/rte_thash_gfni.c | 47 +++++++++++++++++++++++++++++++++++++++
lib/hash/rte_thash_gfni.h | 23 +++++--------------
lib/hash/version.map | 2 ++
4 files changed, 61 insertions(+), 19 deletions(-)
create mode 100644 lib/hash/rte_thash_gfni.c
@@ -17,7 +17,13 @@ indirect_headers += files(
'rte_thash_x86_gfni.h',
)
-sources = files('rte_cuckoo_hash.c', 'rte_fbk_hash.c', 'rte_thash.c')
+sources = files(
+ 'rte_cuckoo_hash.c',
+ 'rte_fbk_hash.c',
+ 'rte_thash.c',
+ 'rte_thash_gfni.c'
+)
+
deps += ['net']
deps += ['ring']
deps += ['rcu']
new file mode 100644
@@ -0,0 +1,47 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <stdbool.h>
+
+#include <rte_compat.h>
+#include <rte_log.h>
+#include <rte_thash_gfni.h>
+
+#ifndef RTE_THASH_GFNI_DEFINED
+
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx __rte_unused,
+ const uint8_t *key __rte_unused, int len __rte_unused)
+{
+ static bool warned;
+
+ if (!warned) {
+ warned = true;
+ RTE_LOG(ERR, HASH,
+ "%s is undefined under given arch\n", __func__);
+ }
+
+ return 0;
+}
+
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
+ int len __rte_unused, uint8_t *tuple[] __rte_unused,
+ uint32_t val[], uint32_t num)
+{
+ unsigned int i;
+
+ static bool warned;
+
+ if (!warned) {
+ warned = true;
+ RTE_LOG(ERR, HASH,
+ "%s is undefined under given arch\n", __func__);
+ }
+
+ for (i = 0; i < num; i++)
+ val[i] = 0;
+}
+
+#endif
@@ -33,13 +33,8 @@ extern "C" {
* @return
* Calculated Toeplitz hash value.
*/
-static inline uint32_t
-rte_thash_gfni(const uint64_t *mtrx __rte_unused,
- const uint8_t *key __rte_unused, int len __rte_unused)
-{
- RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
- return 0;
-}
+uint32_t
+rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
/**
* Bulk implementation for Toeplitz hash.
@@ -58,17 +53,9 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,
* @param num
* Number of tuples to hash.
*/
-static inline void
-rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
- int len __rte_unused, uint8_t *tuple[] __rte_unused,
- uint32_t val[], uint32_t num)
-{
- unsigned int i;
-
- RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
- for (i = 0; i < num; i++)
- val[i] = 0;
-}
+void
+rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
+ uint32_t val[], uint32_t num);
#endif /* RTE_THASH_GFNI_DEFINED */
@@ -39,6 +39,8 @@ DPDK_24 {
rte_thash_get_gfni_matrices;
rte_thash_get_helper;
rte_thash_get_key;
+ rte_thash_gfni;
+ rte_thash_gfni_bulk;
rte_thash_gfni_supported;
rte_thash_init_ctx;