Skip to contentSkip to conversation

Remove last library static logtypes

PATCH Applied Stephen Hemminger 2 participants 5 messages Dec 22, 2023 – Jan 12, 2024 Arm/Amlogic Meson SoC support

lore
Share & tools
lore
#0 lore raw

cover Remove last library static logtypes

These three libraries were depending on static logtypes.

Stephen Hemminger (3):
port: convert to dynamic log type
table: convert to dynamic logtype
pipeline: convert to a dynamic logtype

 lib/log/log.c               | 3 ---
 lib/log/rte_log.h           | 6 +++---
 lib/pipeline/rte_pipeline.c | 3 +++
 lib/port/meson.build        | 1 +
 lib/port/port_log.c         | 7 +++++++
 lib/port/port_log.h         | 4 +++-
 lib/table/meson.build       | 2 ++
 lib/table/table_log.c       | 7 +++++++
 lib/table/table_log.h       | 4 +++-
 9 files changed, 29 insertions(+), 8 deletions(-)
 create mode 100644 lib/port/port_log.c
 create mode 100644 lib/table/table_log.c
Signature · 1 line
2.43.0
#1 lore raw

PATCH 1/3 port: convert to dynamic log type

Replace static RTE_LOGTYPE_PORT with dynamic type. Since there are several types of port do initialization in a short standalone file.

---
 lib/log/log.c        | 1 -
 lib/log/rte_log.h    | 2 +-
 lib/port/meson.build | 1 +
 lib/port/port_log.h  | 4 +++-
 4 files changed, 5 insertions(+), 3 deletions(-)
lib/log/log.c +0 -1
index ab06132a98a1..853acaf07eb2 100644
@@ -353,7 +353,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_PORT,       "lib.port"},
 	{RTE_LOGTYPE_TABLE,      "lib.table"},
 	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
lib/log/rte_log.h +1 -1
index 5ba198ba2484..5c73e689e8aa 100644
@@ -40,7 +40,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_POWER */
 				 /* was RTE_LOGTYPE_METER */
 				 /* was RTE_LOGTYPE_SCHED */
-#define RTE_LOGTYPE_PORT      13 /**< Log related to port. */
+				 /* was RTE_LOGTYPE_PORT */
 #define RTE_LOGTYPE_TABLE     14 /**< Log related to table. */
 #define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
 				 /* was RTE_LOGTYPE_MBUF */
lib/port/meson.build +1 -0
index b0af2b185b39..b5977728723a 100644
@@ -8,6 +8,7 @@ if is_windows
 endif
 
 sources = files(
+        'port_log.c',
         'rte_port_ethdev.c',
         'rte_port_fd.c',
         'rte_port_frag.c',
lib/port/port_log.h +3 -1
index 99332a380323..28d75ee48b3b 100644
@@ -4,6 +4,8 @@
 
 #include <rte_log.h>
 
+extern int port_logtype;
+#define RTE_LOGTYPE_PORT port_logtype
+
 #define PORT_LOG(level, ...) \
 	RTE_LOG_LINE(level, PORT, "" __VA_ARGS__)
-
Signature · 1 line
2.43.0
#2 lore raw

PATCH 2/3 table: convert to dynamic logtype

In reply to Stephen Hemminger

Replace static RTE_LOGTYPE_TABLE with dynamic type.

---
 lib/log/log.c         | 1 -
 lib/log/rte_log.h     | 2 +-
 lib/port/port_log.c   | 7 +++++++
 lib/table/meson.build | 2 ++
 lib/table/table_log.c | 7 +++++++
 lib/table/table_log.h | 4 +++-
 6 files changed, 20 insertions(+), 3 deletions(-)
 create mode 100644 lib/port/port_log.c
 create mode 100644 lib/table/table_log.c
lib/log/log.c +0 -1
index 853acaf07eb2..7ae798493e51 100644
@@ -353,7 +353,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_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
lib/log/rte_log.h +1 -1
index 5c73e689e8aa..6bfa66dc8986 100644
@@ -41,7 +41,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 */
 				 /* was RTE_LOGTYPE_CRYPTODEV */
lib/port/port_log.c new file +7 -0
new file mode 100644
index 000000000000..1984b17bc4f7
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 Red Hat, Inc.
+ */
+
+#include <rte_log.h>
+
+RTE_LOG_REGISTER_DEFAULT(port_logtype, INFO);
lib/table/meson.build +2 -0
index f8cef24b5918..9b3d9ac759eb 100644
@@ -18,7 +18,9 @@ sources = files(
         'rte_table_lpm.c',
         'rte_table_lpm_ipv6.c',
         'rte_table_stub.c',
+        'table_log.c',
 )
+
 headers = files(
         'rte_lru.h',
         'rte_swx_hash_func.h',
lib/table/table_log.c new file +7 -0
new file mode 100644
index 000000000000..8c84ed84671c
@@ -0,0 +1,7 @@
+/* SPDX-License-Identifier: BSD-3-Clause
+ * Copyright (c) 2023 Red Hat, Inc.
+ */
+
+#include <rte_log.h>
+
+RTE_LOG_REGISTER_DEFAULT(table_logtype, INFO);
lib/table/table_log.h +3 -1
index 0330f89d4192..b24b8614c227 100644
@@ -4,6 +4,8 @@
 
 #include <rte_log.h>
 
+extern int table_logtype;
+#define RTE_LOGTYPE_TABLE table_logtype
+
 #define TABLE_LOG(level, ...) \
 	RTE_LOG_LINE(level, TABLE, "" __VA_ARGS__)
-
Signature · 1 line
2.43.0
#3 lore raw

PATCH 3/3 pipeline: convert to a dynamic logtype

In reply to Stephen Hemminger

Replace RTE_LOGTYPE_PIPELINE static type with a dynamic one.

---
 lib/log/log.c               | 1 -
 lib/log/rte_log.h           | 2 +-
 lib/pipeline/rte_pipeline.c | 3 +++
 3 files changed, 4 insertions(+), 2 deletions(-)
lib/log/log.c +0 -1
index 7ae798493e51..123510616455 100644
@@ -353,7 +353,6 @@ struct logtype {
 static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
-	{RTE_LOGTYPE_PIPELINE,   "lib.pipeline"},
 	{RTE_LOGTYPE_EVENTDEV,   "lib.eventdev"},
 	{RTE_LOGTYPE_USER1,      "user1"},
 	{RTE_LOGTYPE_USER2,      "user2"},
lib/log/rte_log.h +1 -1
index 6bfa66dc8986..5f28c3832de9 100644
@@ -42,7 +42,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_SCHED */
 				 /* was RTE_LOGTYPE_PORT */
 				 /* was RTE_LOGTYPE_TABLE */
-#define RTE_LOGTYPE_PIPELINE  15 /**< Log related to pipeline. */
+				 /* was RTE_LOGTYPE_PIPELINE */
 				 /* was RTE_LOGTYPE_MBUF */
 				 /* was RTE_LOGTYPE_CRYPTODEV */
 				 /* was RTE_LOGTYPE_EFD */
lib/pipeline/rte_pipeline.c +3 -0
index b0aea4596daa..c9ed903d716b 100644
@@ -12,6 +12,9 @@
 
 #include "rte_pipeline.h"
 
+RTE_LOG_REGISTER_DEFAULT(pipeline_logtype, INFO);
+#define RTE_LOGTYPE_PIPELINE pipeline_logtype
+
 #define PIPELINE_LOG(level, ...) \
 	RTE_LOG_LINE(level, PIPELINE, "" __VA_ARGS__)
 
Signature · 1 line
2.43.0
#4 lore raw
In reply to Stephen Hemminger
Quoted 8 lines · Stephen Hemminger

These three libraries were depending on static logtypes.

Stephen Hemminger (3):
port: convert to dynamic log type
table: convert to dynamic logtype
pipeline: convert to a dynamic logtype

Quoted 12 lines
 lib/log/log.c               | 3 ---
 lib/log/rte_log.h           | 6 +++---
 lib/pipeline/rte_pipeline.c | 3 +++
 lib/port/meson.build        | 1 +
 lib/port/port_log.c         | 7 +++++++
 lib/port/port_log.h         | 4 +++-
 lib/table/meson.build       | 2 ++
 lib/table/table_log.c       | 7 +++++++
 lib/table/table_log.h       | 4 +++-
 9 files changed, 29 insertions(+), 8 deletions(-)
 create mode 100644 lib/port/port_log.c
 create mode 100644 lib/table/table_log.c

I fixed patch 1 which was missing some bits added in patch 2. I also fixed the copyright notices.

Applied, thanks.

Signature · 1 line
David Marchand