[2/3] table: convert to dynamic logtype
Checks
Commit Message
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
@@ -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"},
@@ -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 */
new file mode 100644
@@ -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);
@@ -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',
new file mode 100644
@@ -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);
@@ -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__)
-