From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id E1B5143C62;
	Wed,  6 Mar 2024 22:47:41 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id C776E42DBD;
	Wed,  6 Mar 2024 22:47:41 +0100 (CET)
Received: from mail-il1-f173.google.com (mail-il1-f173.google.com
 [209.85.166.173])
 by mails.dpdk.org (Postfix) with ESMTP id 8F2B5400EF
 for <dev@dpdk.org>; Wed,  6 Mar 2024 22:47:40 +0100 (CET)
Received: by mail-il1-f173.google.com with SMTP id
 e9e14a558f8ab-3651c1e1022so719165ab.0
 for <dev@dpdk.org>; Wed, 06 Mar 2024 13:47:40 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20230601.gappssmtp.com; s=20230601; t=1709761659;
 x=1710366459; darn=dpdk.org; 
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=MYb0SAL5pLhhFw5GxsuJ5TWj+yPiIbmmKmsHh8YZgVA=;
 b=ouCjUDzW8LBPzHhR48nBOTNYtN7lfPKXR4VMNaiVw5fV1qmaf4H8txqgvaEUEnsEWk
 TVcJs2WFN/I89fbqJlz9gNfts0vF0RK12NFcScJ2H8T6fjXW/f6He7cZ0CKAERvMltHQ
 zkdXrDX1VqgPYPfuIBIbOZn9snMOnpyjmA8h4/6Ch0u5/pM/HRjdioopYKNEH1gn+H54
 I5n5oUIzZmg7E6hcgEdiGaheBVmgXD7ysYJgQB5QefpPwcDtECW4Bv3wxY4rFIaEQTjh
 xBlM8Tx/CTy6d2BV6kZ7ntC5sYE/ADprEGTNwAFbXqZtSTXWscelotrjmRrSA1W3AAus
 knyQ==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20230601; t=1709761659; x=1710366459;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=MYb0SAL5pLhhFw5GxsuJ5TWj+yPiIbmmKmsHh8YZgVA=;
 b=rjRSXN71hO55K/tQVMJe1oOunJrws25G3Uh4sYjIEuFr/L2G+wX0FoorV4PDpcU7Ie
 j2HKrqpbEvmTnATkYHnTiWrLbJnHt4B/5epBSKZZGcCpnzhnGCjE9XVJZcm8V7jCHCoj
 Rk6+0DxTum/gXDowVgQIrW87AaVQm9Zovj0bDoCoLXax+RJWcXFFukuPWesIGNOkU04y
 Ocxz/p3HhOfUQzYrhgqqBPbIT+UOAKfy10k9d0wNdym/4ofPE/sZjc4rEduECb1LfL9m
 QkdtQR3wnji0hQPBAuNILyuVbOXFpzkzKV2oQNPPXG9iCjGBtw6+J7/TN30ziyYIbkNk
 HhlQ==
X-Gm-Message-State: AOJu0YyVnUPPemytwY510N0OcVGR14JKO1KIcqjaNFRPNhOC4BVjLjmV
 88Jn79PTLEXSdlAa4rrDlrAAaISqHH8MbPIHf4cV4TW2eRV1QGGLdDYougGAtzEicSykXOk/Ajb
 BILg=
X-Google-Smtp-Source: AGHT+IEvWVlTh/qjc8OeM80NBgpj5QmRobJNpv9kFr1xNKfbs2uaTLJHSt2cI34mmPLAfIO0Lu8awg==
X-Received: by 2002:a05:6e02:1d18:b0:365:696:2817 with SMTP id
 i24-20020a056e021d1800b0036506962817mr19512014ila.3.1709761659700; 
 Wed, 06 Mar 2024 13:47:39 -0800 (PST)
Received: from hermes.local (204-195-123-141.wavecable.com. [204.195.123.141])
 by smtp.gmail.com with ESMTPSA id
 v184-20020a6389c1000000b005e43cb66a7asm11483643pgd.87.2024.03.06.13.47.38
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Wed, 06 Mar 2024 13:47:39 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
 Yipeng Wang <yipeng1.wang@intel.com>,
 Sameh Gobriel <sameh.gobriel@intel.com>,
 Bruce Richardson <bruce.richardson@intel.com>,
 Vladimir Medvedkin <vladimir.medvedkin@intel.com>
Subject: [PATCH v3] hash: put GFNI stubs back
Date: Wed,  6 Mar 2024 13:47:13 -0800
Message-ID: <20240306214729.70048-1-stephen@networkplumber.org>
X-Mailer: git-send-email 2.43.0
In-Reply-To: <20240304184508.89956-1-stephen@networkplumber.org>
References: <20240304184508.89956-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

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(-)

diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c
index f1525f9838de..5ead51dd3426 100644
--- a/lib/hash/rte_thash_gfni.c
+++ b/lib/hash/rte_thash_gfni.c
@@ -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
diff --git a/lib/hash/rte_thash_gfni.h b/lib/hash/rte_thash_gfni.h
index eed55fc86c86..ebc531817b87 100644
--- a/lib/hash/rte_thash_gfni.h
+++ b/lib/hash/rte_thash_gfni.h
@@ -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 */
 
diff --git a/lib/hash/version.map b/lib/hash/version.map
index 6b2afebf6b46..942e2998578f 100644
--- a/lib/hash/version.map
+++ b/lib/hash/version.map
@@ -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;
+};
-- 
2.43.0