[v12,14/22] sched: convert RTE_LOGTYPE_SCHED to dynamic type

Message ID 20230329234049.11071-15-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
  Also can remove unused RTE_LOGTYPE_METER

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 2 --
 lib/eal/include/rte_log.h       | 4 ++--
 lib/sched/rte_pie.c             | 1 +
 lib/sched/rte_sched.c           | 5 +++++
 lib/sched/rte_sched_log.h       | 4 ++++
 5 files changed, 12 insertions(+), 4 deletions(-)
 create mode 100644 lib/sched/rte_sched_log.h
  

Patch

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 70d5bb7b1951..d4b7088b5cbb 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -351,8 +351,6 @@  static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_METER,      "lib.meter"},
-	{RTE_LOGTYPE_SCHED,      "lib.sched"},
 	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index dc2454a0d9de..f185fcbc5a94 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -37,8 +37,8 @@  extern "C" {
 				 /* was RTE_LOGTYPE_KNI */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
-#define RTE_LOGTYPE_METER     11 /**< Log related to QoS meter. */
-#define RTE_LOGTYPE_SCHED     12 /**< Log related to QoS port scheduler. */
+				 /* was RTE_LOGTYPE_METER */
+				 /* was RTE_LOGTYPE_SCHED */
 #define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
diff --git a/lib/sched/rte_pie.c b/lib/sched/rte_pie.c
index 947e2a059f6f..cce0ce762da8 100644
--- a/lib/sched/rte_pie.c
+++ b/lib/sched/rte_pie.c
@@ -6,6 +6,7 @@ 
 #include <stdlib.h>
 #include <string.h>
 
+#include "rte_sched_log.h"
 #include "rte_pie.h"
 
 #ifdef __INTEL_COMPILER
diff --git a/lib/sched/rte_sched.c b/lib/sched/rte_sched.c
index 19768d8c38b0..27e98e46df7a 100644
--- a/lib/sched/rte_sched.c
+++ b/lib/sched/rte_sched.c
@@ -16,9 +16,12 @@ 
 #include <rte_reciprocal.h>
 
 #include "rte_sched.h"
+#include "rte_sched_log.h"
 #include "rte_sched_common.h"
+
 #include "rte_approx.h"
 
+
 #ifdef __INTEL_COMPILER
 #pragma warning(disable:2259) /* conversion may lose significant bits */
 #endif
@@ -3002,3 +3005,5 @@  rte_sched_port_dequeue(struct rte_sched_port *port, struct rte_mbuf **pkts, uint
 
 	return count;
 }
+
+RTE_LOG_REGISTER_DEFAULT(sched_logtype, INFO);
diff --git a/lib/sched/rte_sched_log.h b/lib/sched/rte_sched_log.h
new file mode 100644
index 000000000000..fde051f49d62
--- /dev/null
+++ b/lib/sched/rte_sched_log.h
@@ -0,0 +1,4 @@ 
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int sched_logtype;
+#define RTE_LOGTYPE_SCHED sched_logtype