DPDK patches and discussions
 help / color / mirror / Atom feed
From: <jerinj@marvell.com>
To: <dev@dpdk.org>, Hemant Agrawal <hemant.agrawal@nxp.com>,
	Sachin Saxena <sachin.saxena@nxp.com>,
	Jingjing Wu <jingjing.wu@intel.com>,
	Beilei Xing <beilei.xing@intel.com>,
	Harman Kalra <hkalra@marvell.com>,
	Jerin Jacob <jerinj@marvell.com>,
	Nithin Dabilpuram <ndabilpuram@marvell.com>,
	"John Griffin" <john.griffin@intel.com>,
	Fiona Trahe <fiona.trahe@intel.com>,
	"Deepak Kumar Jain" <deepak.k.jain@intel.com>
Cc: <thomas@monjalon.net>, <olivier.matz@6wind.com>,
	<david.marchand@redhat.com>, <sachin.saxena@oss.nxp.com>,
	<adamx.dybkowski@intel.com>
Subject: [dpdk-dev] [PATCH v4 10/13] drivers/common: use log register macro
Date: Wed, 1 Jul 2020 16:14:25 +0530	[thread overview]
Message-ID: <20200701104428.4149689-11-jerinj@marvell.com> (raw)
In-Reply-To: <20200701104428.4149689-1-jerinj@marvell.com>

From: Jerin Jacob <jerinj@marvell.com>

Use log register macro to avoid the code duplication
in the log registration process.

Signed-off-by: Jerin Jacob <jerinj@marvell.com>
Acked-by: Sachin Saxena <sachin.saxena@oss.nxp.com>
Acked-by: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 drivers/common/dpaax/dpaax_iova_table.c | 10 +--
 drivers/common/iavf/iavf_impl.c         |  9 +--
 drivers/common/octeontx/octeontx_mbox.c |  9 +--
 drivers/common/octeontx2/otx2_common.c  | 96 +++----------------------
 drivers/common/qat/qat_logs.c           | 17 +----
 5 files changed, 15 insertions(+), 126 deletions(-)

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index 98b076e09..5ba8ed193 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -7,9 +7,6 @@
 #include "dpaax_iova_table.h"
 #include "dpaax_logs.h"
 
-/* Global dpaax logger identifier */
-int dpaax_logger;
-
 /* Global table reference */
 struct dpaax_iova_table *dpaax_iova_table_p;
 
@@ -463,9 +460,4 @@ dpaax_handle_memevents(void)
 					       dpaax_memevent_cb, NULL);
 }
 
-RTE_INIT(dpaax_log)
-{
-	dpaax_logger = rte_log_register("pmd.common.dpaax");
-	if (dpaax_logger >= 0)
-		rte_log_set_level(dpaax_logger, RTE_LOG_ERR);
-}
+RTE_LOG_REGISTER(dpaax_logger, pmd.common.dpaax, ERR);
diff --git a/drivers/common/iavf/iavf_impl.c b/drivers/common/iavf/iavf_impl.c
index 6174a9144..fc0da3175 100644
--- a/drivers/common/iavf/iavf_impl.c
+++ b/drivers/common/iavf/iavf_impl.c
@@ -13,8 +13,6 @@
 #include "iavf_type.h"
 #include "iavf_prototype.h"
 
-int iavf_common_logger;
-
 enum iavf_status
 iavf_allocate_dma_mem_d(__rte_unused struct iavf_hw *hw,
 			struct iavf_dma_mem *mem,
@@ -87,9 +85,4 @@ iavf_free_virt_mem_d(__rte_unused struct iavf_hw *hw,
 	return IAVF_SUCCESS;
 }
 
-RTE_INIT(iavf_common_init_log)
-{
-	iavf_common_logger = rte_log_register("pmd.common.iavf");
-	if (iavf_common_logger >= 0)
-		rte_log_set_level(iavf_common_logger, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(iavf_common_logger, pmd.common.iavf, NOTICE);
diff --git a/drivers/common/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c
index effe0b267..f414267e4 100644
--- a/drivers/common/octeontx/octeontx_mbox.c
+++ b/drivers/common/octeontx/octeontx_mbox.c
@@ -68,14 +68,7 @@ struct mbox_intf_ver {
 	uint32_t minor:10;
 };
 
-int octeontx_logtype_mbox;
-
-RTE_INIT(otx_init_log)
-{
-	octeontx_logtype_mbox = rte_log_register("pmd.octeontx.mbox");
-	if (octeontx_logtype_mbox >= 0)
-		rte_log_set_level(octeontx_logtype_mbox, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(octeontx_logtype_mbox, pmd.octeontx.mbox, NOTICE);
 
 static inline void
 mbox_msgcpy(volatile uint8_t *d, volatile const uint8_t *s, uint16_t size)
diff --git a/drivers/common/octeontx2/otx2_common.c b/drivers/common/octeontx2/otx2_common.c
index 5e7272f69..b292e999a 100644
--- a/drivers/common/octeontx2/otx2_common.c
+++ b/drivers/common/octeontx2/otx2_common.c
@@ -203,89 +203,13 @@ void otx2_parse_common_devargs(struct rte_kvargs *kvlist)
 	idev->npa_lock_mask = npa_lock_mask;
 }
 
-/**
- * @internal
- */
-int otx2_logtype_base;
-/**
- * @internal
- */
-int otx2_logtype_mbox;
-/**
- * @internal
- */
-int otx2_logtype_npa;
-/**
- * @internal
- */
-int otx2_logtype_nix;
-/**
- * @internal
- */
-int otx2_logtype_npc;
-/**
- * @internal
- */
-int otx2_logtype_tm;
-/**
- * @internal
- */
-int otx2_logtype_sso;
-/**
- * @internal
- */
-int otx2_logtype_tim;
-/**
- * @internal
- */
-int otx2_logtype_dpi;
-/**
- * @internal
- */
-int otx2_logtype_ep;
-
-RTE_INIT(otx2_log_init);
-static void
-otx2_log_init(void)
-{
-	otx2_logtype_base = rte_log_register("pmd.octeontx2.base");
-	if (otx2_logtype_base >= 0)
-		rte_log_set_level(otx2_logtype_base, RTE_LOG_NOTICE);
-
-	otx2_logtype_mbox = rte_log_register("pmd.octeontx2.mbox");
-	if (otx2_logtype_mbox >= 0)
-		rte_log_set_level(otx2_logtype_mbox, RTE_LOG_NOTICE);
-
-	otx2_logtype_npa = rte_log_register("pmd.mempool.octeontx2");
-	if (otx2_logtype_npa >= 0)
-		rte_log_set_level(otx2_logtype_npa, RTE_LOG_NOTICE);
-
-	otx2_logtype_nix = rte_log_register("pmd.net.octeontx2");
-	if (otx2_logtype_nix >= 0)
-		rte_log_set_level(otx2_logtype_nix, RTE_LOG_NOTICE);
-
-	otx2_logtype_npc = rte_log_register("pmd.net.octeontx2.flow");
-	if (otx2_logtype_npc >= 0)
-		rte_log_set_level(otx2_logtype_npc, RTE_LOG_NOTICE);
-
-	otx2_logtype_tm = rte_log_register("pmd.net.octeontx2.tm");
-	if (otx2_logtype_tm >= 0)
-		rte_log_set_level(otx2_logtype_tm, RTE_LOG_NOTICE);
-
-	otx2_logtype_sso = rte_log_register("pmd.event.octeontx2");
-	if (otx2_logtype_sso >= 0)
-		rte_log_set_level(otx2_logtype_sso, RTE_LOG_NOTICE);
-
-	otx2_logtype_tim = rte_log_register("pmd.event.octeontx2.timer");
-	if (otx2_logtype_tim >= 0)
-		rte_log_set_level(otx2_logtype_tim, RTE_LOG_NOTICE);
-
-	otx2_logtype_dpi = rte_log_register("pmd.raw.octeontx2.dpi");
-	if (otx2_logtype_dpi >= 0)
-		rte_log_set_level(otx2_logtype_dpi, RTE_LOG_NOTICE);
-
-	otx2_logtype_ep = rte_log_register("pmd.raw.octeontx2.ep");
-	if (otx2_logtype_ep >= 0)
-		rte_log_set_level(otx2_logtype_ep, RTE_LOG_NOTICE);
-
-}
+RTE_LOG_REGISTER(otx2_logtype_base, pmd.octeontx2.base, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_mbox, pmd.octeontx2.mbox, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_npa, pmd.mempool.octeontx2, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_nix, pmd.net.octeontx2, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_npc, pmd.net.octeontx2.flow, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_tm, pmd.net.octeontx2.tm, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_sso, pmd.event.octeontx2, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_tim, pmd.event.octeontx2.timer, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_dpi, pmd.raw.octeontx2.dpi, NOTICE);
+RTE_LOG_REGISTER(otx2_logtype_ep, pmd.raw.octeontx2.ep, NOTICE);
diff --git a/drivers/common/qat/qat_logs.c b/drivers/common/qat/qat_logs.c
index dfd0cbe5d..fa48be53c 100644
--- a/drivers/common/qat/qat_logs.c
+++ b/drivers/common/qat/qat_logs.c
@@ -7,9 +7,6 @@
 
 #include "qat_logs.h"
 
-int qat_gen_logtype;
-int qat_dp_logtype;
-
 int
 qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 		const void *buf, unsigned int len)
@@ -20,15 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_INIT(qat_pci_init_log)
-{
-	/* Non-data-path logging for pci device and all services */
-	qat_gen_logtype = rte_log_register("pmd.qat_general");
-	if (qat_gen_logtype >= 0)
-		rte_log_set_level(qat_gen_logtype, RTE_LOG_NOTICE);
-
-	/* data-path logging for all services */
-	qat_dp_logtype = rte_log_register("pmd.qat_dp");
-	if (qat_dp_logtype >= 0)
-		rte_log_set_level(qat_dp_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
-- 
2.27.0


  parent reply	other threads:[~2020-07-01 10:46 UTC|newest]

Thread overview: 98+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-17  6:30 [dpdk-dev] [PATCH 00/13] rte_log registration usage improvement jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 01/13] eal/log: introduce log register macro jerinj
2020-06-17 10:00   ` Thomas Monjalon
2020-06-17 10:26     ` Andrew Rybchenko
2020-06-24 13:08       ` Jerin Jacob
2020-06-17 10:02   ` David Marchand
2020-06-17 10:21     ` Andrew Rybchenko
2020-06-24 13:11       ` Jerin Jacob
2020-06-24 15:26         ` Andrew Rybchenko
2020-06-24 15:32           ` Jerin Jacob
2020-06-24 15:43             ` Andrew Rybchenko
2020-06-24 18:10               ` Jerin Jacob
2020-06-26 11:16                 ` Jerin Jacob
2020-06-26 11:42                   ` David Marchand
2020-06-26 12:06                     ` Jerin Jacob
2020-06-26 12:13                       ` David Marchand
2020-06-26 12:16                       ` David Marchand
2020-06-26 12:37                         ` Jerin Jacob
2020-06-29 13:39                           ` Jerin Jacob
2020-06-30 13:39                           ` David Marchand
2020-06-30 14:42                             ` Jerin Jacob
2020-06-21  9:30   ` Sachin Saxena (OSS)
2020-06-17  6:30 ` [dpdk-dev] [PATCH 02/13] lib: use " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 03/13] drivers/vdpa: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 04/13] drivers/raw: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 05/13] drivers/net: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 06/13] drivers/mempool: " jerinj
2020-06-21  9:46   ` Sachin Saxena (OSS)
2020-06-17  6:30 ` [dpdk-dev] [PATCH 07/13] drivers/event: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 08/13] drivers/crypto: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 09/13] drivers/compress: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 10/13] drivers/common: " jerinj
2020-06-21  9:48   ` Sachin Saxena (OSS)
2020-06-17  6:30 ` [dpdk-dev] [PATCH 11/13] drivers/bus: " jerinj
2020-06-21  9:52   ` Sachin Saxena (OSS)
2020-06-17  6:30 ` [dpdk-dev] [PATCH 12/13] drivers/baseband: " jerinj
2020-06-17  6:30 ` [dpdk-dev] [PATCH 13/13] app/test: " jerinj
2020-06-25 16:18 ` [dpdk-dev] [PATCH 00/13] rte_log registration usage improvement Dybkowski, AdamX
2020-06-25 16:20   ` Dybkowski, AdamX
2020-07-01  3:58 ` [dpdk-dev] [PATCH v2 " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 01/13] eal/log: introduce log register macro jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 02/13] lib: use " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 03/13] drivers/vdpa: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 04/13] drivers/raw: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 05/13] drivers/net: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 06/13] drivers/mempool: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 07/13] drivers/event: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 08/13] drivers/crypto: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 09/13] drivers/compress: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 10/13] drivers/common: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 11/13] drivers/bus: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 12/13] drivers/baseband: " jerinj
2020-07-01  3:58   ` [dpdk-dev] [PATCH v2 13/13] app/test: " jerinj
2020-07-01  6:48   ` [dpdk-dev] [PATCH v3 00/13] rte_log registration usage improvement jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 01/13] eal/log: introduce log register macro jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 02/13] lib: use " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 03/13] drivers/vdpa: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 04/13] drivers/raw: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 05/13] drivers/net: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 06/13] drivers/mempool: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 07/13] drivers/event: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 08/13] drivers/crypto: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 09/13] drivers/compress: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 10/13] drivers/common: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 11/13] drivers/bus: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 12/13] drivers/baseband: " jerinj
2020-07-01  6:48     ` [dpdk-dev] [PATCH v3 13/13] app/test: " jerinj
2020-07-01 10:44     ` [dpdk-dev] [PATCH v4 00/13] rte_log registration usage improvement jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 01/13] eal/log: introduce log register macro jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 02/13] lib: use " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 03/13] drivers/vdpa: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 04/13] drivers/raw: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 05/13] drivers/net: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 06/13] drivers/mempool: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 07/13] drivers/event: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 08/13] drivers/crypto: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 09/13] drivers/compress: " jerinj
2020-07-01 10:44       ` jerinj [this message]
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 11/13] drivers/bus: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 12/13] drivers/baseband: " jerinj
2020-07-01 10:44       ` [dpdk-dev] [PATCH v4 13/13] app/test: " jerinj
2020-07-01 12:33       ` [dpdk-dev] [PATCH v5 00/13] rte_log registration usage improvement jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 01/13] eal/log: introduce log register macro jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 02/13] lib: use " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 03/13] drivers/vdpa: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 04/13] drivers/raw: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 05/13] drivers/net: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 06/13] drivers/mempool: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 07/13] drivers/event: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 08/13] drivers/crypto: " jerinj
2020-07-02 17:59           ` Akhil Goyal
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 09/13] drivers/compress: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 10/13] drivers/common: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 11/13] drivers/bus: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 12/13] drivers/baseband: " jerinj
2020-07-01 12:33         ` [dpdk-dev] [PATCH v5 13/13] app/test: " jerinj
2020-07-03 13:55         ` [dpdk-dev] [PATCH v5 00/13] rte_log registration usage improvement David Marchand
2020-07-06  9:31           ` Jerin Jacob

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=20200701104428.4149689-11-jerinj@marvell.com \
    --to=jerinj@marvell.com \
    --cc=adamx.dybkowski@intel.com \
    --cc=beilei.xing@intel.com \
    --cc=david.marchand@redhat.com \
    --cc=deepak.k.jain@intel.com \
    --cc=dev@dpdk.org \
    --cc=fiona.trahe@intel.com \
    --cc=hemant.agrawal@nxp.com \
    --cc=hkalra@marvell.com \
    --cc=jingjing.wu@intel.com \
    --cc=john.griffin@intel.com \
    --cc=ndabilpuram@marvell.com \
    --cc=olivier.matz@6wind.com \
    --cc=sachin.saxena@nxp.com \
    --cc=sachin.saxena@oss.nxp.com \
    --cc=thomas@monjalon.net \
    /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).