DPDK patches and discussions
 help / color / mirror / Atom feed
* [PATCH] hash: make gfni stubs inline
@ 2024-03-04 18:45 Stephen Hemminger
  2024-03-05  3:07 ` [PATCH v2] hash: make GFNI stubs inline (again) Stephen Hemminger
                   ` (4 more replies)
  0 siblings, 5 replies; 16+ messages in thread
From: Stephen Hemminger @ 2024-03-04 18:45 UTC (permalink / raw)
  To: dev
  Cc: Stephen Hemminger, Tyler Retzlaff, Yipeng Wang, Sameh Gobriel,
	Bruce Richardson, Vladimir Medvedkin

This reverts commit 07d836e5929d18ad6640ebae90dd2f81a2cafb71.

Tyler found build issues with MSVC and the thash gfni stubs.
The problem would be link errors from missing symbols.

The purpose of the original commit was to allow local definition of
RTE_LOGTYPE_HASH. Put the thash gfni back as inlines, but require
that the header only be included inside rte_thash.h so that the
log macros are defined.

Reported-by: Tyler Retzlaff <roretzla@linux.microsoft.com>
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/hash/meson.build      |  1 -
 lib/hash/rte_thash_gfni.h | 42 +++++++++++++++++++++++----------------
 lib/hash/version.map      |  2 --
 3 files changed, 25 insertions(+), 20 deletions(-)

diff --git a/lib/hash/meson.build b/lib/hash/meson.build
index 277eb9fa9366..541b1d2790fa 100644
--- a/lib/hash/meson.build
+++ b/lib/hash/meson.build
@@ -22,7 +22,6 @@ sources = files(
         'rte_hash_crc.c',
         'rte_fbk_hash.c',
         'rte_thash.c',
-        'rte_thash_gfni.c',
 )
 
 deps += ['net']
diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
index eed55fc86c86..fba68f7bc250 100644
--- a/lib/hash/rte_thash_gfni.h
+++ b/lib/hash/rte_thash_gfni.h
@@ -2,14 +2,13 @@
  * Copyright(c) 2021 Intel Corporation
  */
 
-#ifndef _RTE_THASH_GFNI_H_
-#define _RTE_THASH_GFNI_H_
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-#include <rte_log.h>
+/*
+ * This header file is not supposed to included directly in application
+ */
+#ifndef _RTE_THASH_H
+#error Do not include rte_thash_gfni.h directly
+#else
 
 #ifdef RTE_ARCH_X86
 
@@ -33,8 +32,13 @@ 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 __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;
+}
 
 /**
  * Bulk implementation for Toeplitz hash.
@@ -53,14 +57,18 @@ rte_thash_gfni(const uint64_t *mtrx, const uint8_t *key, int len);
  * @param num
  *  Number of tuples to hash.
  */
-void
-rte_thash_gfni_bulk(const uint64_t *mtrx, int len, uint8_t *tuple[],
-	uint32_t val[], uint32_t num);
+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;
 
-#endif /* RTE_THASH_GFNI_DEFINED */
-
-#ifdef __cplusplus
+	RTE_LOG(ERR, HASH, "%s is undefined under given arch\n", __func__);
+	for (i = 0; i < num; i++)
+		val[i] = 0;
 }
-#endif
 
-#endif /* _RTE_THASH_GFNI_H_ */
+#endif /* !RTE_THASH_GFNI_DEFINED */
+
+#endif /* !_RTE_HASH__H_ */
diff --git a/lib/hash/version.map b/lib/hash/version.map
index 6b2afebf6b46..6236b24722a2 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -41,8 +41,6 @@ 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;
 
-- 
2.43.0


^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2024-03-07 20:23 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-03-04 18:45 [PATCH] hash: make gfni stubs inline Stephen Hemminger
2024-03-05  3:07 ` [PATCH v2] hash: make GFNI stubs inline (again) Stephen Hemminger
2024-03-05  3:58   ` Tyler Retzlaff
2024-03-06 17:22   ` Thomas Monjalon
2024-03-05 10:14 ` [PATCH] hash: make gfni stubs inline David Marchand
2024-03-05 17:53   ` Tyler Retzlaff
2024-03-05 18:44     ` Stephen Hemminger
2024-03-07 10:32     ` David Marchand
2024-03-07 16:49       ` Stephen Hemminger
2024-03-06 21:47 ` [PATCH v3] hash: put GFNI stubs back Stephen Hemminger
2024-03-07  1:36 ` Stephen Hemminger
2024-03-07 11:05   ` David Marchand
2024-03-07 17:36   ` Tyler Retzlaff
2024-03-07 17:59     ` David Marchand
2024-03-07 20:23       ` Stephen Hemminger
2024-03-07 19:14 ` [PATCH v4] " Stephen Hemminger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).