[v13,10/21] ring: convert RTE_LOGTYPE_RING to dynamic type

Message ID 20230821160921.383832-11-stephen@networkplumber.org (mailing list archive)
State Changes Requested, archived
Delegated to: David Marchand
Headers
Series Convert static log types in libraries to dynamic types |

Checks

Context Check Description
ci/checkpatch success coding style OK

Commit Message

Stephen Hemminger Aug. 21, 2023, 4:09 p.m. UTC
  The logtype for ring only used in library.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/log/log.c       | 1 -
 lib/log/rte_log.h   | 2 +-
 lib/ring/rte_ring.c | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)
  

Patch

diff --git a/lib/log/log.c b/lib/log/log.c
index 5ec3c16250f5..212c5d7b8669 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -352,7 +352,6 @@  struct logtype {
 
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
-	{RTE_LOGTYPE_RING,       "lib.ring"},
 	{RTE_LOGTYPE_MEMPOOL,    "lib.mempool"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index a1949e606395..4a1310385cf4 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -28,7 +28,7 @@  extern "C" {
 /* SDK log type */
 #define RTE_LOGTYPE_EAL        0 /**< Log related to eal. */
 				 /* was RTE_LOGTYPE_MALLOC */
-#define RTE_LOGTYPE_RING       2 /**< Log related to ring. */
+				 /* was RTE_LOGTYPE_RING */
 #define RTE_LOGTYPE_MEMPOOL    3 /**< Log related to mempool. */
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c
index 057d25ff6f2f..12046419f194 100644
--- a/lib/ring/rte_ring.c
+++ b/lib/ring/rte_ring.c
@@ -26,6 +26,9 @@ 
 #include "rte_ring.h"
 #include "rte_ring_elem.h"
 
+RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO);
+#define RTE_LOGTYPE_RING ring_logtype
+
 TAILQ_HEAD(rte_ring_list, rte_tailq_entry);
 
 static struct rte_tailq_elem rte_ring_tailq = {