[v12,20/22] table: convert RTE_LOGTYPE_TABLE to dynamic type

Message ID 20230329234049.11071-21-stephen@networkplumber.org (mailing list archive)
State Superseded, archived
Delegated to: Thomas Monjalon
Headers
Series Covert static log types in libraries to dynamic |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger March 29, 2023, 11:40 p.m. UTC
  Make an alias for RTE_LOGTYPE_TABLE in rte_table.h
and use it.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/table/meson.build           | 1 +
 lib/table/rte_table.c           | 8 ++++++++
 lib/table/rte_table.h           | 4 ++++
 5 files changed, 14 insertions(+), 2 deletions(-)
 create mode 100644 lib/table/rte_table.c
  

Patch

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 58f9c0ce629b..6c2d9bfc1950 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -350,7 +350,6 @@  struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_CRYPTODEV,  "lib.cryptodev"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 4d1b892ab689..6418479ee266 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -40,7 +40,7 @@  extern "C" {
 				 /* was RTE_LOGTYPE_METER */
 				 /* was RTE_LOGTYPE_SCHED */
 				 /* was RTE_LOGTYPE_PORT */
-#define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
+				 /* was RTE_LOGTYPE_TABLE */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
 #define RTE_LOGTYPE_CRYPTODEV 17 /**< Log related to cryptodev. */
diff --git a/lib/table/meson.build b/lib/table/meson.build
index f8cef24b5918..e753b6fb23d8 100644
--- a/lib/table/meson.build
+++ b/lib/table/meson.build
@@ -7,6 +7,7 @@  sources = files(
         'rte_swx_table_learner.c',
         'rte_swx_table_selector.c',
         'rte_swx_table_wm.c',
+        'rte_table.c',
         'rte_table_acl.c',
         'rte_table_array.c',
         'rte_table_hash_cuckoo.c',
diff --git a/lib/table/rte_table.c b/lib/table/rte_table.c
new file mode 100644
index 000000000000..4a083f4aaf0c
--- /dev/null
+++ b/lib/table/rte_table.c
@@ -0,0 +1,8 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright(c) 2010-2014 Intel Corporation
+ */
+
+#include <rte_log.h>
+#include <rte_table.h>
+
+RTE_LOG_REGISTER_DEFAULT(table_logtype, INFO);
diff --git a/lib/table/rte_table.h b/lib/table/rte_table.h
index 096ab8a7c824..42e9b58fbea5 100644
--- a/lib/table/rte_table.h
+++ b/lib/table/rte_table.h
@@ -265,6 +265,10 @@  struct rte_table_ops {
 	rte_table_op_stats_read f_stats;              /**< Stats */
 };
 
+/** Internal Logtype used */
+extern int table_logtype;
+#define RTE_LOGTYPE_TABLE table_logtype
+
 #ifdef __cplusplus
 }
 #endif