Make the GFNI stub functions always built. This solves the conditional
linking problem. If GFNI is available, they will never get used.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
lib/hash/rte_thash_gfni.c | 9 +++------
lib/hash/rte_thash_gfni.h | 30 +++++++++++++++++++++++-------
lib/hash/version.map | 9 +++++++--
3 files changed, 33 insertions(+), 15 deletions(-)
@@ -4,18 +4,17 @@
#include <stdbool.h>
+#include <rte_compat.h>
#include <rte_log.h>
#include <rte_thash_gfni.h>
-#ifndef RTE_THASH_GFNI_DEFINED
-
RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO);
#define RTE_LOGTYPE_HASH hash_gfni_logtype
#define HASH_LOG(level, ...) \
RTE_LOG_LINE(level, HASH, "" __VA_ARGS__)
uint32_t
-rte_thash_gfni(const uint64_t *mtrx __rte_unused,
+___rte_thash_gfni(const uint64_t *mtrx __rte_unused,
const uint8_t *key __rte_unused, int len __rte_unused)
{
static bool warned;
@@ -30,7 +29,7 @@ rte_thash_gfni(const uint64_t *mtrx __rte_unused,
}
void
-rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
+___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)
{
@@ -47,5 +46,3 @@ rte_thash_gfni_bulk(const uint64_t *mtrx __rte_unused,
for (i = 0; i < num; i++)
val[i] = 0;
}
-
-#endif
@@ -17,11 +17,22 @@ extern "C" {
#endif
-#ifndef RTE_THASH_GFNI_DEFINED
+/*
+ * @internal
+ * Stubs defined for only used when GFNI is not available
+ */
+__rte_internal
+uint32_t
+___rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
+
+__rte_internal
+void
+___rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
+ uint32_t val[], uint32_t num);
+#ifndef RTE_THASH_GFNI_DEFINED
/**
* Calculate Toeplitz hash.
- * Dummy implementation.
*
* @param m
* Pointer to the matrices generated from the corresponding
@@ -33,12 +44,14 @@ extern "C" {
* @return
* Calculated Toeplitz hash value.
*/
-uint32_t
-rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
+static inline uint32_t
+rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len)
+{
+ return ___rte_thash_gfni(mtrx, key, len);
+}
/**
* Bulk implementation for Toeplitz hash.
- * Dummy implementation.
*
* @param m
* Pointer to the matrices generated from the corresponding
@@ -53,9 +66,12 @@ rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
* @param num
* Number of tuples to hash.
*/
-void
+static inline void
rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
- uint32_t val[], uint32_t num);
+ uint32_t val[], uint32_t num)
+{
+ return ___rte_thash_gfni_bulk(mtrx, len, tuple, val);
+}
#endif /* RTE_THASH_GFNI_DEFINED */
@@ -41,10 +41,15 @@ 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;
local: *;
};
+
+INTERNAL {
+ global:
+
+ ___rte_thash_gfni;
+ ___rte_thash_gfni_bulk;
+};