[05/11] drivers/common: use new logtype wrapper
diff mbox series

Message ID 1566214919-32250-6-git-send-email-david.marchand@redhat.com
State Superseded
Delegated to: Thomas Monjalon
Headers show
Series
  • Fixing log levels for dynamically loaded drivers
Related show

Checks

Context Check Description
ci/checkpatch success coding style OK
ci/Intel-compilation fail Compilation issues

Commit Message

David Marchand Aug. 19, 2019, 11:41 a.m. UTC
Make use of the newly introduced wrapper.

Signed-off-by: David Marchand <david.marchand@redhat.com>
---
 drivers/common/dpaax/dpaax_iova_table.c |  8 ++---
 drivers/common/octeontx/octeontx_mbox.c |  8 ++---
 drivers/common/octeontx2/otx2_common.c  | 62 ++++++++++++---------------------
 drivers/common/qat/qat_logs.c           | 18 ++++------
 4 files changed, 32 insertions(+), 64 deletions(-)

Patch
diff mbox series

diff --git a/drivers/common/dpaax/dpaax_iova_table.c b/drivers/common/dpaax/dpaax_iova_table.c
index ae0af09..9bc2a4b 100644
--- a/drivers/common/dpaax/dpaax_iova_table.c
+++ b/drivers/common/dpaax/dpaax_iova_table.c
@@ -457,9 +457,5 @@  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",
+	RTE_LOG_ERR, RTE_LOGTYPE_PMD);
diff --git a/drivers/common/octeontx/octeontx_mbox.c b/drivers/common/octeontx/octeontx_mbox.c
index 880f8a4..825a5ac 100644
--- a/drivers/common/octeontx/octeontx_mbox.c
+++ b/drivers/common/octeontx/octeontx_mbox.c
@@ -61,12 +61,8 @@  struct mbox_ram_hdr {
 
 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",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
 
 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 7e45366..a7d5387 100644
--- a/drivers/common/octeontx2/otx2_common.c
+++ b/drivers/common/octeontx2/otx2_common.c
@@ -206,43 +206,25 @@  int otx2_logtype_tim;
  */
 int otx2_logtype_dpi;
 
-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);
-}
+RTE_LOG_REGISTER(otx2_logtype_base, "pmd.octeontx2.base",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+RTE_LOG_REGISTER(otx2_logtype_mbox, "pmd.octeontx2.mbox",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+
+RTE_LOG_REGISTER(otx2_logtype_npa, "pmd.mempool.octeontx2",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_MEMPOOL);
+
+RTE_LOG_REGISTER(otx2_logtype_nix, "pmd.net.octeontx2",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+RTE_LOG_REGISTER(otx2_logtype_npc, "pmd.net.octeontx2.flow",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+RTE_LOG_REGISTER(otx2_logtype_tm, "pmd.net.octeontx2.tm",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+
+RTE_LOG_REGISTER(otx2_logtype_sso, "pmd.event.octeontx2",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+RTE_LOG_REGISTER(otx2_logtype_tim, "pmd.event.octeontx2.timer",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+
+RTE_LOG_REGISTER(otx2_logtype_dpi, "pmd.raw.octeontx2.dpi",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
diff --git a/drivers/common/qat/qat_logs.c b/drivers/common/qat/qat_logs.c
index 7a86170..a8d1e84 100644
--- a/drivers/common/qat/qat_logs.c
+++ b/drivers/common/qat/qat_logs.c
@@ -24,15 +24,9 @@  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);
-}
+/* Non-data-path logging for pci device and all services */
+RTE_LOG_REGISTER(qat_gen_logtype, "pmd.qat_general",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);
+/* data-path logging for all services */
+RTE_LOG_REGISTER(qat_dp_logtype, "pmd.qat_dp",
+	RTE_LOG_NOTICE, RTE_LOGTYPE_PMD);