summaryrefslogtreecommitdiff
path: root/lib/hash
diff options
context:
space:
mode:
authorStephen Hemminger <[email protected]>2023-12-04 18:09:54 -0800
committerDavid Marchand <[email protected]>2023-12-06 10:11:52 +0100
commit07d836e5929d18ad6640ebae90dd2f81a2cafb71 (patch)
tree5a8f180509198ff6410ee5e559dda354092e22fb /lib/hash
parent17a2bf47c6956d765aa3b202771628097a937879 (diff)
hash: uninline GFNI stubs
Having stubs in header file makes it harder to update RTE_LOG(). Also modify to only print warning once. Signed-off-by: Stephen Hemminger <[email protected]>
Diffstat (limited to 'lib/hash')
-rw-r--r--lib/hash/meson.build8
-rw-r--r--lib/hash/rte_thash_gfni.c46
-rw-r--r--lib/hash/rte_thash_gfni.h23
-rw-r--r--lib/hash/version.map2
4 files changed, 60 insertions, 19 deletions
diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index 2f757d45f9..37f6e01aa3 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -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']
diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
new file mode 100644
index 0000000000..e148fada62
--- /dev/null
+++ b/lib/hash/rte_thash_gfni.c
@@ -0,0 +1,46 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2021 Intel Corporation
+ */
+
+#include <stdbool.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
diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
index cd253459e7..eed55fc86c 100644
--- a/lib/hash/rte_thash_gfni.h
+++ b/lib/hash/rte_thash_gfni.h
@@ -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 */
diff --git a/lib/hash/version.map b/lib/hash/version.map
index b98b64a163..56a0cbd4b8 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -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;