From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <dev-bounces@dpdk.org>
Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124])
	by inbox.dpdk.org (Postfix) with ESMTP id C110641CF1;
	Tue, 21 Feb 2023 00:37:12 +0100 (CET)
Received: from mails.dpdk.org (localhost [127.0.0.1])
	by mails.dpdk.org (Postfix) with ESMTP id D28CD43154;
	Tue, 21 Feb 2023 00:36:26 +0100 (CET)
Received: from mail-pg1-f169.google.com (mail-pg1-f169.google.com
 [209.85.215.169])
 by mails.dpdk.org (Postfix) with ESMTP id 3DC2643130
 for <dev@dpdk.org>; Tue, 21 Feb 2023 00:36:10 +0100 (CET)
Received: by mail-pg1-f169.google.com with SMTP id k29so1796470pgm.3
 for <dev@dpdk.org>; Mon, 20 Feb 2023 15:36:10 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=networkplumber-org.20210112.gappssmtp.com; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:from:to:cc:subject:date
 :message-id:reply-to;
 bh=Bxb5uefAC8sqO7rt+ILDAJRxu/qHVtoXVH3T56wvEmo=;
 b=DkcWRuLhIsO4fP8sjxymufYWwOFvFS1ve/RZaUZh6zrR7cargWIjYoEn7N5Vwu0Jj8
 kxmWmfZD0IeS4Uc0kaOOR58AuJHYl7T8vSYUMwaOJ1w0mDzeokViDmRKhnW3PHirO4s3
 9XSd0WofWWkL8aHuHkSy9qrDHR2AMvZR1YxYObeYg/C9AjZoC+9sxUS6ebDAdt/wXL1E
 MFuZWBbVcPJQtgUJBUvhSmT70h6bxcStLFIvD/SE9ejUYUJp4YTHqjwqnvGWCkabAlPb
 VClB6avJ/k2Xyy9wpDgSiuNcdmVGTr+zMphxEOhcag1BKKRbt89d0CTcKqUFF5d8Rxp6
 Ox1w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
 d=1e100.net; s=20210112;
 h=content-transfer-encoding:mime-version:references:in-reply-to
 :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc
 :subject:date:message-id:reply-to;
 bh=Bxb5uefAC8sqO7rt+ILDAJRxu/qHVtoXVH3T56wvEmo=;
 b=S/Zh2KgIMOhUMdihY0g5sE/y4ew2r740FY0AV2AcFE0/STIvYdZd3Qd3pA4osuiajq
 07DtKN2IrcmoIYJ0nXB8v2tGxg1rcoIpHdLznGjkBsWM4zOfiVWm/LEmH17bDkl34jvS
 uZ2OJNpOlMhU9X5DAUcdzWwZH7dDClP71SPHfsiPF9zvcenPIXEJ8w4+WLwe1z9zddLd
 e/V6ceDOZlDfYbeOmnYgvf5lAAyFhuCyma9gTBTSzUWuErGHWhTU2B8OqXg2yTPkHQGh
 NdfZPkNAIpwLG+/SU5kqNY3eWdaoUTCwHCbFGjwfpuVn/vvyeO6fxH/OeYOraOFpz9BW
 KVkQ==
X-Gm-Message-State: AO0yUKVKSiV5nr809/P4Xcrn2YbXpY2RVBHGb54VGWOfwyuAfnLV5x4o
 zgNmoO++UMQhKUAWN0WNYRYhDVO9HPB6cG01b+o=
X-Google-Smtp-Source: AK7set9vy95L9bFz8omh5pjQB1xqSV7dTboJa2ctS+l/iHShhyImxW9NW3T/SYEWD9mzvI9QKdMfCQ==
X-Received: by 2002:aa7:96ee:0:b0:5aa:9ef7:4f7f with SMTP id
 i14-20020aa796ee000000b005aa9ef74f7fmr1989437pfq.9.1676936169096; 
 Mon, 20 Feb 2023 15:36:09 -0800 (PST)
Received: from hermes.local (204-195-120-218.wavecable.com. [204.195.120.218])
 by smtp.gmail.com with ESMTPSA id
 q19-20020a62e113000000b005a8dc935ec1sm8215908pfh.62.2023.02.20.15.36.08
 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);
 Mon, 20 Feb 2023 15:36:08 -0800 (PST)
From: Stephen Hemminger <stephen@networkplumber.org>
To: dev@dpdk.org
Cc: Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH v8 12/22] lpm: replace RTE_LOGTYPE_LPM with dynamic types
Date: Mon, 20 Feb 2023 15:35:46 -0800
Message-Id: <20230220233556.168553-13-stephen@networkplumber.org>
X-Mailer: git-send-email 2.39.1
In-Reply-To: <20230220233556.168553-1-stephen@networkplumber.org>
References: <20230207204151.1503491-1-stephen@networkplumber.org>
 <20230220233556.168553-1-stephen@networkplumber.org>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-BeenThere: dev@dpdk.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: DPDK patches and discussions <dev.dpdk.org>
List-Unsubscribe: <https://mails.dpdk.org/options/dev>,
 <mailto:dev-request@dpdk.org?subject=unsubscribe>
List-Archive: <http://mails.dpdk.org/archives/dev/>
List-Post: <mailto:dev@dpdk.org>
List-Help: <mailto:dev-request@dpdk.org?subject=help>
List-Subscribe: <https://mails.dpdk.org/listinfo/dev>,
 <mailto:dev-request@dpdk.org?subject=subscribe>
Errors-To: dev-bounces@dpdk.org

Split lpm and lpm6 into separate log types since they
are in different files and user may want to change log
levels for IPv4 vs IPv6.

For rib and fib libraries give them own types as well.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 lib/eal/common/eal_common_log.c | 1 -
 lib/eal/include/rte_log.h       | 2 +-
 lib/fib/fib_log.h               | 4 ++++
 lib/fib/rte_fib.c               | 3 +++
 lib/fib/rte_fib6.c              | 2 ++
 lib/lpm/lpm_log.h               | 4 ++++
 lib/lpm/rte_lpm.c               | 3 +++
 lib/lpm/rte_lpm6.c              | 1 +
 lib/rib/rib_log.h               | 4 ++++
 lib/rib/rte_rib.c               | 3 +++
 lib/rib/rte_rib6.c              | 3 +++
 11 files changed, 28 insertions(+), 2 deletions(-)
 create mode 100644 lib/fib/fib_log.h
 create mode 100644 lib/lpm/lpm_log.h
 create mode 100644 lib/rib/rib_log.h

diff --git a/lib/eal/common/eal_common_log.c b/lib/eal/common/eal_common_log.c
index 4025d2039d55..6e2007e6ed4f 100644
--- a/lib/eal/common/eal_common_log.c
+++ b/lib/eal/common/eal_common_log.c
@@ -351,7 +351,6 @@ static const struct logtype logtype_strings[] = {
 	{RTE_LOGTYPE_EAL,        "lib.eal"},
 	{RTE_LOGTYPE_PMD,        "pmd"},
 	{RTE_LOGTYPE_HASH,       "lib.hash"},
-	{RTE_LOGTYPE_LPM,        "lib.lpm"},
 	{RTE_LOGTYPE_KNI,        "lib.kni"},
 	{RTE_LOGTYPE_METER,      "lib.meter"},
 	{RTE_LOGTYPE_SCHED,      "lib.sched"},
diff --git a/lib/eal/include/rte_log.h b/lib/eal/include/rte_log.h
index 9f86bfdd0198..115a48bf05f5 100644
--- a/lib/eal/include/rte_log.h
+++ b/lib/eal/include/rte_log.h
@@ -33,7 +33,7 @@ extern "C" {
 				 /* was RTE_LOGTYPE_TIMER */
 #define RTE_LOGTYPE_PMD        5 /**< Log related to poll mode driver. */
 #define RTE_LOGTYPE_HASH       6 /**< Log related to hash table. */
-#define RTE_LOGTYPE_LPM        7 /**< Log related to LPM. */
+				 /* was RTE_LOGTYPE_LPM */
 #define RTE_LOGTYPE_KNI        8 /**< Log related to KNI. */
 				 /* was RTE_LOGTYPE_ACL */
 				 /* was RTE_LOGTYPE_POWER */
diff --git a/lib/fib/fib_log.h b/lib/fib/fib_log.h
new file mode 100644
index 000000000000..c731c820f621
--- /dev/null
+++ b/lib/fib/fib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int fib_logtype;
+#define RTE_LOGTYPE_LPM fib_logtype
diff --git a/lib/fib/rte_fib.c b/lib/fib/rte_fib.c
index 8af4c4091908..5b1815881415 100644
--- a/lib/fib/rte_fib.c
+++ b/lib/fib/rte_fib.c
@@ -16,6 +16,9 @@
 #include <rte_fib.h>
 
 #include "dir24_8.h"
+#include "fib_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(fib_logtype, INFO);
 
 TAILQ_HEAD(rte_fib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib_tailq = {
diff --git a/lib/fib/rte_fib6.c b/lib/fib/rte_fib6.c
index 4b8e22b142b9..762d195fb798 100644
--- a/lib/fib/rte_fib6.c
+++ b/lib/fib/rte_fib6.c
@@ -9,6 +9,7 @@
 #include <rte_eal_memconfig.h>
 #include <rte_tailq.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_string_fns.h>
 
@@ -16,6 +17,7 @@
 #include <rte_fib6.h>
 
 #include "trie.h"
+#include "fib_log.h"
 
 TAILQ_HEAD(rte_fib6_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_fib6_tailq = {
diff --git a/lib/lpm/lpm_log.h b/lib/lpm/lpm_log.h
new file mode 100644
index 000000000000..a0621b70a5fe
--- /dev/null
+++ b/lib/lpm/lpm_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int lpm_logtype;
+#define RTE_LOGTYPE_LPM lpm_logtype
diff --git a/lib/lpm/rte_lpm.c b/lib/lpm/rte_lpm.c
index cdcd1b7f9e47..0ca82147866a 100644
--- a/lib/lpm/rte_lpm.c
+++ b/lib/lpm/rte_lpm.c
@@ -18,6 +18,9 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm.h"
+#include "lpm_log.h"
+
+RTE_LOG_REGISTER_DEFAULT(lpm_logtype, INFO);
 
 TAILQ_HEAD(rte_lpm_list, rte_tailq_entry);
 
diff --git a/lib/lpm/rte_lpm6.c b/lib/lpm/rte_lpm6.c
index 8d21aeddb83c..873cc8bc267d 100644
--- a/lib/lpm/rte_lpm6.c
+++ b/lib/lpm/rte_lpm6.c
@@ -20,6 +20,7 @@
 #include <rte_tailq.h>
 
 #include "rte_lpm6.h"
+#include "lpm_log.h"
 
 #define RTE_LPM6_TBL24_NUM_ENTRIES        (1 << 24)
 #define RTE_LPM6_TBL8_GROUP_NUM_ENTRIES         256
diff --git a/lib/rib/rib_log.h b/lib/rib/rib_log.h
new file mode 100644
index 000000000000..f3ee513ca854
--- /dev/null
+++ b/lib/rib/rib_log.h
@@ -0,0 +1,4 @@
+/* SPDX-License-Identifier: BSD-3-Clause */
+
+extern int rib_logtype;
+#define RTE_LOGTYPE_LPM rib_logtype
diff --git a/lib/rib/rte_rib.c b/lib/rib/rte_rib.c
index b0794edf66f5..5597c8b899c8 100644
--- a/lib/rib/rte_rib.c
+++ b/lib/rib/rte_rib.c
@@ -15,6 +15,9 @@
 
 #include <rte_rib.h>
 
+RTE_LOG_REGISTER_DEFAULT(rib_logtype, INFO);
+#define RTE_LOGTYPE_LPM rib_logtype
+
 TAILQ_HEAD(rte_rib_list, rte_tailq_entry);
 static struct rte_tailq_elem rte_rib_tailq = {
 	.name = "RTE_RIB",
diff --git a/lib/rib/rte_rib6.c b/lib/rib/rte_rib6.c
index 19e4ff97c479..917bede27d24 100644
--- a/lib/rib/rte_rib6.c
+++ b/lib/rib/rte_rib6.c
@@ -8,6 +8,7 @@
 
 #include <rte_eal_memconfig.h>
 #include <rte_errno.h>
+#include <rte_log.h>
 #include <rte_malloc.h>
 #include <rte_mempool.h>
 #include <rte_string_fns.h>
@@ -15,6 +16,8 @@
 
 #include <rte_rib6.h>
 
+#include "rib_log.h"
+
 #define RTE_RIB_VALID_NODE	1
 #define RIB6_MAXDEPTH		128
 /* Maximum length of a RIB6 name. */
-- 
2.39.1