DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>,
	Cristian Dumitrescu <cristian.dumitrescu@intel.com>
Subject: [PATCH 2/3] table: convert to dynamic logtype
Date: Fri, 22 Dec 2023 09:44:03 -0800	[thread overview]
Message-ID: <20231222174539.13431-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20231222174539.13431-1-stephen@networkplumber.org>

Replace static RTE_LOGTYPE_TABLE with dynamic type.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 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

diff --git a/lib/log/log.c b/lib/log/log.c
index 853acaf07eb2..7ae798493e51 100644
--- a/lib/log/log.c
+++ b/lib/log/log.c
@@ -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"},
diff --git a/lib/log/rte_log.h b/lib/log/rte_log.h
index 5c73e689e8aa..6bfa66dc8986 100644
--- a/lib/log/rte_log.h
+++ b/lib/log/rte_log.h
@@ -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 */
diff --git a/lib/port/port_log.c b/lib/port/port_log.c
new file mode 100644
index 000000000000..1984b17bc4f7
--- /dev/null
+++ b/lib/port/port_log.c
@@ -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);
diff --git a/lib/table/meson.build b/lib/table/meson.build
index f8cef24b5918..9b3d9ac759eb 100644
--- a/lib/table/meson.build
+++ b/lib/table/meson.build
@@ -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',
diff --git a/lib/table/table_log.c b/lib/table/table_log.c
new file mode 100644
index 000000000000..8c84ed84671c
--- /dev/null
+++ b/lib/table/table_log.c
@@ -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);
diff --git a/lib/table/table_log.h b/lib/table/table_log.h
index 0330f89d4192..b24b8614c227 100644
--- a/lib/table/table_log.h
+++ b/lib/table/table_log.h
@@ -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__)
-
-- 
2.43.0


  parent reply	other threads:[~2023-12-22 17:45 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-12-22 17:44 [PATCH 0/3] Remove last library static logtypes Stephen Hemminger
2023-12-22 17:44 ` [PATCH 1/3] port: convert to dynamic log type Stephen Hemminger
2023-12-22 17:44 ` Stephen Hemminger [this message]
2023-12-22 17:44 ` [PATCH 3/3] pipeline: convert to a dynamic logtype Stephen Hemminger
2024-01-12 11:03 ` [PATCH 0/3] Remove last library static logtypes David Marchand

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231222174539.13431-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=cristian.dumitrescu@intel.com \
    --cc=dev@dpdk.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).