[PATCH 13/18] sched: convert RTE_LOGTYPE_SCHED to dynamic type

Stephen Hemminger stephen at networkplumber.org
Tue Dec 5 03:09:51 CET 2023


Also can remove unused RTE_LOGTYPE_METER

Signed-off-by: Stephen Hemminger <stephen at networkplumber.org>
---
 lib/log/log.c             | 2 --
 lib/log/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

diff --git a/lib/log/log.c b/lib/log/log.c
index 95e0ba1c6b51..56877d42e6b9 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -354,8 +354,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/log/rte_log.h b/lib/log/rte_log.h
index 8d34ac902b39..189ad2bbd2cf 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/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 1a6beb14f4ab..76dd8dd7388c 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
@@ -2999,3 +3002,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
-- 
2.42.0



More information about the dev mailing list