[v4,05/13] drivers/net: use log register macro
diff mbox series

Message ID 20200701104428.4149689-6-jerinj@marvell.com
State Superseded, archived
Delegated to: Thomas Monjalon
Headers show
Series
  • rte_log registration usage improvement
Related show

Checks

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

Commit Message

Jerin Jacob Kollanukkaran July 1, 2020, 10:44 a.m. UTC
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: Adam Dybkowski <adamx.dybkowski@intel.com>
---
 drivers/net/af_packet/rte_eth_af_packet.c |  8 +---
 drivers/net/af_xdp/rte_eth_af_xdp.c       |  8 +---
 drivers/net/ark/ark_ethdev.c              | 10 +----
 drivers/net/atlantic/atl_ethdev.c         | 15 +------
 drivers/net/avp/avp_ethdev.c              | 10 +----
 drivers/net/axgbe/axgbe_ethdev.c          | 15 +------
 drivers/net/bnx2x/bnx2x_ethdev.c          | 15 +------
 drivers/net/bnxt/bnxt_ethdev.c            |  9 +----
 drivers/net/bonding/rte_eth_bond_pmd.c    |  9 +----
 drivers/net/cxgbe/cxgbe_ethdev.c          | 15 +------
 drivers/net/dpaa/dpaa_ethdev.c            |  9 +----
 drivers/net/dpaa2/dpaa2_ethdev.c          |  9 +----
 drivers/net/ena/ena_ethdev.c              | 48 +++--------------------
 drivers/net/enetc/enetc_ethdev.c          | 10 +----
 drivers/net/enic/enic_ethdev.c            |  9 +----
 drivers/net/failsafe/failsafe.c           | 10 +----
 drivers/net/fm10k/fm10k_ethdev.c          | 40 +++----------------
 drivers/net/hinic/hinic_pmd_ethdev.c      | 11 +-----
 drivers/net/hns3/hns3_ethdev.c            | 15 +------
 drivers/net/i40e/i40e_ethdev.c            | 38 +++---------------
 drivers/net/iavf/iavf_ethdev.c            | 40 +++----------------
 drivers/net/ice/ice_ethdev.c              | 38 +++---------------
 drivers/net/igc/igc_logs.c                | 16 +-------
 drivers/net/ionic/ionic_ethdev.c          | 10 +----
 drivers/net/ipn3ke/ipn3ke_ethdev.c        | 10 +----
 drivers/net/ixgbe/ixgbe_ethdev.c          | 39 +++---------------
 drivers/net/kni/rte_eth_kni.c             |  9 +----
 drivers/net/liquidio/lio_ethdev.c         | 15 +------
 drivers/net/memif/rte_eth_memif.c         |  9 +----
 drivers/net/mlx4/mlx4.c                   | 11 ++----
 drivers/net/mlx5/mlx5.c                   | 10 ++---
 drivers/net/mvneta/mvneta_ethdev.c        | 10 +----
 drivers/net/mvpp2/mrvl_ethdev.c           | 10 +----
 drivers/net/netvsc/hn_ethdev.c            | 15 +------
 drivers/net/nfp/nfp_net.c                 | 15 +------
 drivers/net/null/rte_eth_null.c           |  8 +---
 drivers/net/octeontx/octeontx_ethdev.c    | 21 ++--------
 drivers/net/pcap/rte_eth_pcap.c           |  8 +---
 drivers/net/pfe/pfe_ethdev.c              | 10 +----
 drivers/net/qede/qede_ethdev.c            | 16 +-------
 drivers/net/ring/rte_eth_ring.c           |  8 +---
 drivers/net/softnic/rte_eth_softnic.c     | 10 +----
 drivers/net/szedata2/rte_eth_szedata2.c   | 15 +------
 drivers/net/tap/rte_eth_tap.c             |  9 +----
 drivers/net/thunderx/nicvf_ethdev.c       | 21 ++--------
 drivers/net/vdev_netvsc/vdev_netvsc.c     | 13 +-----
 drivers/net/vhost/rte_eth_vhost.c         |  8 +---
 drivers/net/virtio/virtio_ethdev.c        | 15 +------
 drivers/net/vmxnet3/vmxnet3_ethdev.c      | 15 +------
 49 files changed, 97 insertions(+), 650 deletions(-)

Patch
diff mbox series

diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c
index 22feb72e3..300039bbf 100644
--- a/drivers/net/af_packet/rte_eth_af_packet.c
+++ b/drivers/net/af_packet/rte_eth_af_packet.c
@@ -97,7 +97,7 @@  static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-static int af_packet_logtype;
+RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
@@ -1082,9 +1082,3 @@  RTE_PMD_REGISTER_PARAM_STRING(net_af_packet,
 	"framecnt=<int> "
 	"qdisc_bypass=<0|1>");
 
-RTE_INIT(af_packet_init_log)
-{
-	af_packet_logtype = rte_log_register("pmd.net.packet");
-	if (af_packet_logtype >= 0)
-		rte_log_set_level(af_packet_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c
index 06124ba78..98b9cff38 100644
--- a/drivers/net/af_xdp/rte_eth_af_xdp.c
+++ b/drivers/net/af_xdp/rte_eth_af_xdp.c
@@ -50,7 +50,7 @@ 
 #define PF_XDP AF_XDP
 #endif
 
-static int af_xdp_logtype;
+RTE_LOG_REGISTER(af_xdp_logtype, pmd.net.af_xdp, NOTICE);
 
 #define AF_XDP_LOG(level, fmt, args...)			\
 	rte_log(RTE_LOG_ ## level, af_xdp_logtype,	\
@@ -1374,9 +1374,3 @@  RTE_PMD_REGISTER_PARAM_STRING(net_af_xdp,
 			      "start_queue=<int> "
 			      "queue_count=<int> ");
 
-RTE_INIT(af_xdp_init_log)
-{
-	af_xdp_logtype = rte_log_register("pmd.net.af_xdp");
-	if (af_xdp_logtype >= 0)
-		rte_log_set_level(af_xdp_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c
index c3642012d..b32ccd867 100644
--- a/drivers/net/ark/ark_ethdev.c
+++ b/drivers/net/ark/ark_ethdev.c
@@ -78,8 +78,6 @@  static int  eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size);
 #define ARK_TX_MAX_QUEUE (4096 * 4)
 #define ARK_TX_MIN_QUEUE (256)
 
-int ark_logtype;
-
 static const char * const valid_arguments[] = {
 	ARK_PKTGEN_ARG,
 	ARK_PKTCHKR_ARG,
@@ -1018,10 +1016,4 @@  RTE_PMD_REGISTER_PARAM_STRING(net_ark,
 			      ARK_PKTGEN_ARG "=<filename> "
 			      ARK_PKTCHKR_ARG "=<filename> "
 			      ARK_PKTDIR_ARG "=<bitmap>");
-
-RTE_INIT(ark_init_log)
-{
-	ark_logtype = rte_log_register("pmd.net.ark");
-	if (ark_logtype >= 0)
-		rte_log_set_level(ark_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(ark_logtype, pmd.net.ark, NOTICE);
diff --git a/drivers/net/atlantic/atl_ethdev.c b/drivers/net/atlantic/atl_ethdev.c
index b2b3bd36c..d3b00ab29 100644
--- a/drivers/net/atlantic/atl_ethdev.c
+++ b/drivers/net/atlantic/atl_ethdev.c
@@ -120,9 +120,6 @@  static int eth_atl_pci_remove(struct rte_pci_device *pci_dev);
 static int atl_dev_info_get(struct rte_eth_dev *dev,
 				struct rte_eth_dev_info *dev_info);
 
-int atl_logtype_init;
-int atl_logtype_driver;
-
 /*
  * The set of PCI devices this driver supports
  */
@@ -1929,13 +1926,5 @@  is_atlantic_supported(struct rte_eth_dev *dev)
 RTE_PMD_REGISTER_PCI(net_atlantic, rte_atl_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_atlantic, pci_id_atl_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_atlantic, "* igb_uio | uio_pci_generic");
-
-RTE_INIT(atl_init_log)
-{
-	atl_logtype_init = rte_log_register("pmd.net.atlantic.init");
-	if (atl_logtype_init >= 0)
-		rte_log_set_level(atl_logtype_init, RTE_LOG_NOTICE);
-	atl_logtype_driver = rte_log_register("pmd.net.atlantic.driver");
-	if (atl_logtype_driver >= 0)
-		rte_log_set_level(atl_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(atl_logtype_init, pmd.net.atlantic.init, NOTICE);
+RTE_LOG_REGISTER(atl_logtype_driver, pmd.net.atlantic.driver, NOTICE);
diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c
index 1abe96ce5..5b47f0924 100644
--- a/drivers/net/avp/avp_ethdev.c
+++ b/drivers/net/avp/avp_ethdev.c
@@ -32,8 +32,6 @@ 
 
 #include "avp_logs.h"
 
-int avp_logtype_driver;
-
 static int avp_dev_create(struct rte_pci_device *pci_dev,
 			  struct rte_eth_dev *eth_dev);
 
@@ -2306,10 +2304,4 @@  avp_dev_stats_reset(struct rte_eth_dev *eth_dev)
 
 RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_avp, pci_id_avp_map);
-
-RTE_INIT(avp_init_log)
-{
-	avp_logtype_driver = rte_log_register("pmd.net.avp.driver");
-	if (avp_logtype_driver >= 0)
-		rte_log_set_level(avp_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(avp_logtype_driver, pmd.net.avp.driver, NOTICE);
diff --git a/drivers/net/axgbe/axgbe_ethdev.c b/drivers/net/axgbe/axgbe_ethdev.c
index db86b9813..0c25739f8 100644
--- a/drivers/net/axgbe/axgbe_ethdev.c
+++ b/drivers/net/axgbe/axgbe_ethdev.c
@@ -143,9 +143,6 @@  static const struct axgbe_xstats axgbe_xstats_strings[] = {
 #define AMD_PCI_AXGBE_DEVICE_V2A 0x1458
 #define AMD_PCI_AXGBE_DEVICE_V2B 0x1459
 
-int axgbe_logtype_init;
-int axgbe_logtype_driver;
-
 static const struct rte_pci_id pci_id_axgbe_map[] = {
 	{RTE_PCI_DEVICE(AMD_PCI_VENDOR_ID, AMD_PCI_AXGBE_DEVICE_V2A)},
 	{RTE_PCI_DEVICE(AMD_PCI_VENDOR_ID, AMD_PCI_AXGBE_DEVICE_V2B)},
@@ -1842,13 +1839,5 @@  static struct rte_pci_driver rte_axgbe_pmd = {
 RTE_PMD_REGISTER_PCI(net_axgbe, rte_axgbe_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_axgbe, pci_id_axgbe_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_axgbe, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(axgbe_init_log)
-{
-	axgbe_logtype_init = rte_log_register("pmd.net.axgbe.init");
-	if (axgbe_logtype_init >= 0)
-		rte_log_set_level(axgbe_logtype_init, RTE_LOG_NOTICE);
-	axgbe_logtype_driver = rte_log_register("pmd.net.axgbe.driver");
-	if (axgbe_logtype_driver >= 0)
-		rte_log_set_level(axgbe_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(axgbe_logtype_init, pmd.net.axgbe.init, NOTICE);
+RTE_LOG_REGISTER(axgbe_logtype_driver, pmd.net.axgbe.driver, NOTICE);
diff --git a/drivers/net/bnx2x/bnx2x_ethdev.c b/drivers/net/bnx2x/bnx2x_ethdev.c
index adc3690fc..b2ea5fafa 100644
--- a/drivers/net/bnx2x/bnx2x_ethdev.c
+++ b/drivers/net/bnx2x/bnx2x_ethdev.c
@@ -13,9 +13,6 @@ 
 #include <rte_ethdev_pci.h>
 #include <rte_alarm.h>
 
-int bnx2x_logtype_init;
-int bnx2x_logtype_driver;
-
 /*
  * The set of PCI devices this driver supports
  */
@@ -805,13 +802,5 @@  RTE_PMD_REGISTER_KMOD_DEP(net_bnx2x, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PCI(net_bnx2xvf, rte_bnx2xvf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnx2xvf, pci_id_bnx2xvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_bnx2xvf, "* igb_uio | vfio-pci");
-
-RTE_INIT(bnx2x_init_log)
-{
-	bnx2x_logtype_init = rte_log_register("pmd.net.bnx2x.init");
-	if (bnx2x_logtype_init >= 0)
-		rte_log_set_level(bnx2x_logtype_init, RTE_LOG_NOTICE);
-	bnx2x_logtype_driver = rte_log_register("pmd.net.bnx2x.driver");
-	if (bnx2x_logtype_driver >= 0)
-		rte_log_set_level(bnx2x_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(bnx2x_logtype_init, pmd.net.bnx2x.init, NOTICE);
+RTE_LOG_REGISTER(bnx2x_logtype_driver, pmd.net.bnx2x.driver, NOTICE);
diff --git a/drivers/net/bnxt/bnxt_ethdev.c b/drivers/net/bnxt/bnxt_ethdev.c
index e8b4c058a..59c318076 100644
--- a/drivers/net/bnxt/bnxt_ethdev.c
+++ b/drivers/net/bnxt/bnxt_ethdev.c
@@ -31,7 +31,6 @@ 
 #define DRV_MODULE_NAME		"bnxt"
 static const char bnxt_version[] =
 	"Broadcom NetXtreme driver " DRV_MODULE_NAME;
-int bnxt_logtype_driver;
 
 /*
  * The set of PCI devices this driver supports
@@ -5668,13 +5667,7 @@  bool is_bnxt_supported(struct rte_eth_dev *dev)
 	return is_device_supported(dev, &bnxt_rte_pmd);
 }
 
-RTE_INIT(bnxt_init_log)
-{
-	bnxt_logtype_driver = rte_log_register("pmd.net.bnxt.driver");
-	if (bnxt_logtype_driver >= 0)
-		rte_log_set_level(bnxt_logtype_driver, RTE_LOG_NOTICE);
-}
-
+RTE_LOG_REGISTER(bnxt_logtype_driver, pmd.net.bnxt.driver, NOTICE);
 RTE_PMD_REGISTER_PCI(net_bnxt, bnxt_rte_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_bnxt, bnxt_pci_id_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_bnxt, "* igb_uio | uio_pci_generic | vfio-pci");
diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c
index 612a64599..044a1cfbc 100644
--- a/drivers/net/bonding/rte_eth_bond_pmd.c
+++ b/drivers/net/bonding/rte_eth_bond_pmd.c
@@ -3750,11 +3750,4 @@  RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
 	"up_delay=<int> "
 	"down_delay=<int>");
 
-int bond_logtype;
-
-RTE_INIT(bond_init_log)
-{
-	bond_logtype = rte_log_register("pmd.net.bond");
-	if (bond_logtype >= 0)
-		rte_log_set_level(bond_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 1deee2f5c..7c6016d5c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -38,9 +38,6 @@ 
 #include "cxgbe_pfvf.h"
 #include "cxgbe_flow.h"
 
-int cxgbe_logtype;
-int cxgbe_mbox_logtype;
-
 /*
  * Macros needed to support the PCI Device ID Table ...
  */
@@ -1247,13 +1244,5 @@  RTE_PMD_REGISTER_PARAM_STRING(net_cxgbe,
 			      CXGBE_DEVARG_CMN_TX_MODE_LATENCY "=<0|1> "
 			      CXGBE_DEVARG_PF_FILTER_MODE "=<uint32> "
 			      CXGBE_DEVARG_PF_FILTER_MASK "=<uint32> ");
-
-RTE_INIT(cxgbe_init_log)
-{
-	cxgbe_logtype = rte_log_register("pmd.net.cxgbe");
-	if (cxgbe_logtype >= 0)
-		rte_log_set_level(cxgbe_logtype, RTE_LOG_NOTICE);
-	cxgbe_mbox_logtype = rte_log_register("pmd.net.cxgbe.mbox");
-	if (cxgbe_mbox_logtype >= 0)
-		rte_log_set_level(cxgbe_mbox_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(cxgbe_logtype, pmd.net.cxgbe, NOTICE);
+RTE_LOG_REGISTER(cxgbe_mbox_logtype, pmd.net.cxgbe.mbox, NOTICE);
diff --git a/drivers/net/dpaa/dpaa_ethdev.c b/drivers/net/dpaa/dpaa_ethdev.c
index 13d1c6a1f..f1c9a7151 100644
--- a/drivers/net/dpaa/dpaa_ethdev.c
+++ b/drivers/net/dpaa/dpaa_ethdev.c
@@ -46,8 +46,6 @@ 
 #include <fsl_bman.h>
 #include <fsl_fman.h>
 
-int dpaa_logtype_pmd;
-
 /* Supported Rx offloads */
 static uint64_t dev_rx_offloads_sup =
 		DEV_RX_OFFLOAD_JUMBO_FRAME |
@@ -1666,9 +1664,4 @@  static struct rte_dpaa_driver rte_dpaa_pmd = {
 };
 
 RTE_PMD_REGISTER_DPAA(net_dpaa, rte_dpaa_pmd);
-RTE_INIT(dpaa_net_init_log)
-{
-	dpaa_logtype_pmd = rte_log_register("pmd.net.dpaa");
-	if (dpaa_logtype_pmd >= 0)
-		rte_log_set_level(dpaa_logtype_pmd, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(dpaa_logtype_pmd, pmd.net.dpaa, NOTICE);
diff --git a/drivers/net/dpaa2/dpaa2_ethdev.c b/drivers/net/dpaa2/dpaa2_ethdev.c
index 2f031ec5c..a1f19194d 100644
--- a/drivers/net/dpaa2/dpaa2_ethdev.c
+++ b/drivers/net/dpaa2/dpaa2_ethdev.c
@@ -106,8 +106,6 @@  static int dpaa2_dev_set_link_up(struct rte_eth_dev *dev);
 static int dpaa2_dev_set_link_down(struct rte_eth_dev *dev);
 static int dpaa2_dev_mtu_set(struct rte_eth_dev *dev, uint16_t mtu);
 
-int dpaa2_logtype_pmd;
-
 void
 rte_pmd_dpaa2_set_timestamp(enum pmd_dpaa2_ts enable)
 {
@@ -2694,9 +2692,4 @@  RTE_PMD_REGISTER_DPAA2(net_dpaa2, rte_dpaa2_pmd);
 RTE_PMD_REGISTER_PARAM_STRING(net_dpaa2,
 		DRIVER_LOOPBACK_MODE "=<int> "
 		DRIVER_NO_PREFETCH_MODE "=<int>");
-RTE_INIT(dpaa2_pmd_init_log)
-{
-	dpaa2_logtype_pmd = rte_log_register("pmd.net.dpaa2");
-	if (dpaa2_logtype_pmd >= 0)
-		rte_log_set_level(dpaa2_logtype_pmd, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(dpaa2_logtype_pmd, pmd.net.dpaa2, NOTICE);
diff --git a/drivers/net/ena/ena_ethdev.c b/drivers/net/ena/ena_ethdev.c
index fbddc79f7..da8c8ad92 100644
--- a/drivers/net/ena/ena_ethdev.c
+++ b/drivers/net/ena/ena_ethdev.c
@@ -141,22 +141,6 @@  static const struct ena_stats ena_stats_rx_strings[] = {
 #define	ENA_TX_OFFLOAD_NOTSUP_MASK	\
 	(PKT_TX_OFFLOAD_MASK ^ ENA_TX_OFFLOAD_MASK)
 
-int ena_logtype_init;
-int ena_logtype_driver;
-
-#ifdef RTE_LIBRTE_ENA_DEBUG_RX
-int ena_logtype_rx;
-#endif
-#ifdef RTE_LIBRTE_ENA_DEBUG_TX
-int ena_logtype_tx;
-#endif
-#ifdef RTE_LIBRTE_ENA_DEBUG_TX_FREE
-int ena_logtype_tx_free;
-#endif
-#ifdef RTE_LIBRTE_ENA_COM_DEBUG
-int ena_logtype_com;
-#endif
-
 static const struct rte_pci_id pci_id_ena_map[] = {
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_AMAZON, PCI_DEVICE_ID_ENA_VF) },
 	{ RTE_PCI_DEVICE(PCI_VENDOR_ID_AMAZON, PCI_DEVICE_ID_ENA_LLQ_VF) },
@@ -2849,40 +2833,20 @@  RTE_PMD_REGISTER_PCI(net_ena, rte_ena_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ena, pci_id_ena_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ena, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_ena, ENA_DEVARG_LARGE_LLQ_HDR "=<0|1>");
-
-RTE_INIT(ena_init_log)
-{
-	ena_logtype_init = rte_log_register("pmd.net.ena.init");
-	if (ena_logtype_init >= 0)
-		rte_log_set_level(ena_logtype_init, RTE_LOG_NOTICE);
-	ena_logtype_driver = rte_log_register("pmd.net.ena.driver");
-	if (ena_logtype_driver >= 0)
-		rte_log_set_level(ena_logtype_driver, RTE_LOG_NOTICE);
-
+RTE_LOG_REGISTER(ena_logtype_init, pmd.net.ena.init, NOTICE);
+RTE_LOG_REGISTER(ena_logtype_driver, pmd.net.ena.driver, NOTICE);
 #ifdef RTE_LIBRTE_ENA_DEBUG_RX
-	ena_logtype_rx = rte_log_register("pmd.net.ena.rx");
-	if (ena_logtype_rx >= 0)
-		rte_log_set_level(ena_logtype_rx, RTE_LOG_NOTICE);
+RTE_LOG_REGISTER(ena_logtype_rx, pmd.net.ena.rx, NOTICE);
 #endif
-
 #ifdef RTE_LIBRTE_ENA_DEBUG_TX
-	ena_logtype_tx = rte_log_register("pmd.net.ena.tx");
-	if (ena_logtype_tx >= 0)
-		rte_log_set_level(ena_logtype_tx, RTE_LOG_NOTICE);
+RTE_LOG_REGISTER(ena_logtype_tx, pmd.net.ena.tx, NOTICE);
 #endif
-
 #ifdef RTE_LIBRTE_ENA_DEBUG_TX_FREE
-	ena_logtype_tx_free = rte_log_register("pmd.net.ena.tx_free");
-	if (ena_logtype_tx_free >= 0)
-		rte_log_set_level(ena_logtype_tx_free, RTE_LOG_NOTICE);
+RTE_LOG_REGISTER(ena_logtype_tx_free, pmd.net.ena.tx_free, NOTICE);
 #endif
-
 #ifdef RTE_LIBRTE_ENA_COM_DEBUG
-	ena_logtype_com = rte_log_register("pmd.net.ena.com");
-	if (ena_logtype_com >= 0)
-		rte_log_set_level(ena_logtype_com, RTE_LOG_NOTICE);
+RTE_LOG_REGISTER(ena_logtype_com, pmd.net.ena.com, NOTICE);
 #endif
-}
 
 /******************************************************************************
  ******************************** AENQ Handlers *******************************
diff --git a/drivers/net/enetc/enetc_ethdev.c b/drivers/net/enetc/enetc_ethdev.c
index 1716e11dd..c6fb42740 100644
--- a/drivers/net/enetc/enetc_ethdev.c
+++ b/drivers/net/enetc/enetc_ethdev.c
@@ -10,8 +10,6 @@ 
 #include "enetc_logs.h"
 #include "enetc.h"
 
-int enetc_logtype_pmd;
-
 static int
 enetc_dev_start(struct rte_eth_dev *dev)
 {
@@ -951,10 +949,4 @@  static struct rte_pci_driver rte_enetc_pmd = {
 RTE_PMD_REGISTER_PCI(net_enetc, rte_enetc_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_enetc, pci_id_enetc_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_enetc, "* vfio-pci");
-
-RTE_INIT(enetc_pmd_init_log)
-{
-	enetc_logtype_pmd = rte_log_register("pmd.net.enetc");
-	if (enetc_logtype_pmd >= 0)
-		rte_log_set_level(enetc_logtype_pmd, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(enetc_logtype_pmd, pmd.net.enetc, NOTICE);
diff --git a/drivers/net/enic/enic_ethdev.c b/drivers/net/enic/enic_ethdev.c
index 32d5397f8..6a3580fef 100644
--- a/drivers/net/enic/enic_ethdev.c
+++ b/drivers/net/enic/enic_ethdev.c
@@ -21,8 +21,6 @@ 
 #include "vnic_enet.h"
 #include "enic.h"
 
-int enic_pmd_logtype;
-
 /*
  * The set of PCI devices this driver supports
  */
@@ -71,12 +69,7 @@  static const struct vic_speed_capa {
 #define ENIC_DEVARG_GENEVE_OPT "geneve-opt"
 #define ENIC_DEVARG_IG_VLAN_REWRITE "ig-vlan-rewrite"
 
-RTE_INIT(enicpmd_init_log)
-{
-	enic_pmd_logtype = rte_log_register("pmd.net.enic");
-	if (enic_pmd_logtype >= 0)
-		rte_log_set_level(enic_pmd_logtype, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(enic_pmd_logtype, pmd.net.enic, INFO);
 
 static int
 enicpmd_fdir_ctrl_func(struct rte_eth_dev *eth_dev,
diff --git a/drivers/net/failsafe/failsafe.c b/drivers/net/failsafe/failsafe.c
index 72362f35d..4a4b7ceab 100644
--- a/drivers/net/failsafe/failsafe.c
+++ b/drivers/net/failsafe/failsafe.c
@@ -15,8 +15,6 @@ 
 
 #include "failsafe_private.h"
 
-int failsafe_logtype;
-
 const char pmd_failsafe_driver_name[] = FAILSAFE_DRIVER_NAME;
 static const struct rte_eth_link eth_link = {
 	.link_speed = ETH_SPEED_NUM_10G,
@@ -410,10 +408,4 @@  static struct rte_vdev_driver failsafe_drv = {
 
 RTE_PMD_REGISTER_VDEV(net_failsafe, failsafe_drv);
 RTE_PMD_REGISTER_PARAM_STRING(net_failsafe, PMD_FAILSAFE_PARAM_STRING);
-
-RTE_INIT(failsafe_init_log)
-{
-	failsafe_logtype = rte_log_register("pmd.net.failsafe");
-	if (failsafe_logtype >= 0)
-		rte_log_set_level(failsafe_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(failsafe_logtype, pmd.net.failsafe, NOTICE)
diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index f537ab286..cb0dd3bae 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -40,19 +40,6 @@ 
 #define GLORT_FD_MASK    GLORT_PF_MASK
 #define GLORT_FD_INDEX   GLORT_FD_Q_BASE
 
-int fm10k_logtype_init;
-int fm10k_logtype_driver;
-
-#ifdef RTE_LIBRTE_FM10K_DEBUG_RX
-int fm10k_logtype_rx;
-#endif
-#ifdef RTE_LIBRTE_FM10K_DEBUG_TX
-int fm10k_logtype_tx;
-#endif
-#ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
-int fm10k_logtype_tx_free;
-#endif
-
 static void fm10k_close_mbx_service(struct fm10k_hw *hw);
 static int fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
 static int fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
@@ -3318,31 +3305,14 @@  static struct rte_pci_driver rte_pmd_fm10k = {
 RTE_PMD_REGISTER_PCI(net_fm10k, rte_pmd_fm10k);
 RTE_PMD_REGISTER_PCI_TABLE(net_fm10k, pci_id_fm10k_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_fm10k, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(fm10k_init_log)
-{
-	fm10k_logtype_init = rte_log_register("pmd.net.fm10k.init");
-	if (fm10k_logtype_init >= 0)
-		rte_log_set_level(fm10k_logtype_init, RTE_LOG_NOTICE);
-	fm10k_logtype_driver = rte_log_register("pmd.net.fm10k.driver");
-	if (fm10k_logtype_driver >= 0)
-		rte_log_set_level(fm10k_logtype_driver, RTE_LOG_NOTICE);
-
+RTE_LOG_REGISTER(fm10k_logtype_init, pmd.net.fm10k.init, NOTICE);
+RTE_LOG_REGISTER(fm10k_logtype_driver, pmd.net.fm10k.driver, NOTICE);
 #ifdef RTE_LIBRTE_FM10K_DEBUG_RX
-	fm10k_logtype_rx = rte_log_register("pmd.net.fm10k.rx");
-	if (fm10k_logtype_rx >= 0)
-		rte_log_set_level(fm10k_logtype_rx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(fm10k_logtype_rx, pmd.net.fm10k.rx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_FM10K_DEBUG_TX
-	fm10k_logtype_tx = rte_log_register("pmd.net.fm10k.tx");
-	if (fm10k_logtype_tx >= 0)
-		rte_log_set_level(fm10k_logtype_tx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(fm10k_logtype_tx, pmd.net.fm10k.tx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
-	fm10k_logtype_tx_free = rte_log_register("pmd.net.fm10k.tx_free");
-	if (fm10k_logtype_tx_free >= 0)
-		rte_log_set_level(fm10k_logtype_tx_free, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(fm10k_logtype_tx_free, pmd.net.fm10k.tx_free, DEBUG);
 #endif
-}
diff --git a/drivers/net/hinic/hinic_pmd_ethdev.c b/drivers/net/hinic/hinic_pmd_ethdev.c
index 0c3e1c0cd..8f81e2230 100644
--- a/drivers/net/hinic/hinic_pmd_ethdev.c
+++ b/drivers/net/hinic/hinic_pmd_ethdev.c
@@ -78,9 +78,6 @@ 
 /* lro numer limit for one packet */
 #define HINIC_LRO_WQE_NUM_DEFAULT	8
 
-/* Driver-specific log messages type */
-int hinic_logtype;
-
 struct hinic_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
 	u32  offset;
@@ -3250,10 +3247,4 @@  static struct rte_pci_driver rte_hinic_pmd = {
 
 RTE_PMD_REGISTER_PCI(net_hinic, rte_hinic_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_hinic, pci_id_hinic_map);
-
-RTE_INIT(hinic_init_log)
-{
-	hinic_logtype = rte_log_register("pmd.net.hinic");
-	if (hinic_logtype >= 0)
-		rte_log_set_level(hinic_logtype, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(hinic_logtype, pmd.net.hinic, INFO);
diff --git a/drivers/net/hns3/hns3_ethdev.c b/drivers/net/hns3/hns3_ethdev.c
index 62d87582d..309d0483e 100644
--- a/drivers/net/hns3/hns3_ethdev.c
+++ b/drivers/net/hns3/hns3_ethdev.c
@@ -60,9 +60,6 @@ 
 #define HNS3_RESET_WAIT_MS	100
 #define HNS3_RESET_WAIT_CNT	200
 
-int hns3_logtype_init;
-int hns3_logtype_driver;
-
 enum hns3_evt_cause {
 	HNS3_VECTOR0_EVENT_RST,
 	HNS3_VECTOR0_EVENT_MBX,
@@ -5525,13 +5522,5 @@  static struct rte_pci_driver rte_hns3_pmd = {
 RTE_PMD_REGISTER_PCI(net_hns3, rte_hns3_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_hns3, pci_id_hns3_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_hns3, "* igb_uio | vfio-pci");
-
-RTE_INIT(hns3_init_log)
-{
-	hns3_logtype_init = rte_log_register("pmd.net.hns3.init");
-	if (hns3_logtype_init >= 0)
-		rte_log_set_level(hns3_logtype_init, RTE_LOG_NOTICE);
-	hns3_logtype_driver = rte_log_register("pmd.net.hns3.driver");
-	if (hns3_logtype_driver >= 0)
-		rte_log_set_level(hns3_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(hns3_logtype_init, pmd.net.hns3.init, NOTICE);
+RTE_LOG_REGISTER(hns3_logtype_driver, pmd.net.hns3.driver, NOTICE);
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 970a31cb2..472ce2a9e 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -398,18 +398,6 @@  static void i40e_tunnel_filter_restore(struct i40e_pf *pf);
 static void i40e_filter_restore(struct i40e_pf *pf);
 static void i40e_notify_all_vfs_link_status(struct rte_eth_dev *dev);
 
-int i40e_logtype_init;
-int i40e_logtype_driver;
-#ifdef RTE_LIBRTE_I40E_DEBUG_RX
-int i40e_logtype_rx;
-#endif
-#ifdef RTE_LIBRTE_I40E_DEBUG_TX
-int i40e_logtype_tx;
-#endif
-#ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
-int i40e_logtype_tx_free;
-#endif
-
 static const char *const valid_keys[] = {
 	ETH_I40E_FLOATING_VEB_ARG,
 	ETH_I40E_FLOATING_VEB_LIST_ARG,
@@ -13411,33 +13399,17 @@  i40e_config_rss_filter(struct i40e_pf *pf,
 	return 0;
 }
 
-RTE_INIT(i40e_init_log)
-{
-	i40e_logtype_init = rte_log_register("pmd.net.i40e.init");
-	if (i40e_logtype_init >= 0)
-		rte_log_set_level(i40e_logtype_init, RTE_LOG_NOTICE);
-	i40e_logtype_driver = rte_log_register("pmd.net.i40e.driver");
-	if (i40e_logtype_driver >= 0)
-		rte_log_set_level(i40e_logtype_driver, RTE_LOG_NOTICE);
-
+RTE_LOG_REGISTER(i40e_logtype_init, pmd.net.i40e.init, NOTICE);
+RTE_LOG_REGISTER(i40e_logtype_driver, pmd.net.i40e.driver, NOTICE);
 #ifdef RTE_LIBRTE_I40E_DEBUG_RX
-	i40e_logtype_rx = rte_log_register("pmd.net.i40e.rx");
-	if (i40e_logtype_rx >= 0)
-		rte_log_set_level(i40e_logtype_rx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(i40e_logtype_rx, pmd.net.i40e.rx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_I40E_DEBUG_TX
-	i40e_logtype_tx = rte_log_register("pmd.net.i40e.tx");
-	if (i40e_logtype_tx >= 0)
-		rte_log_set_level(i40e_logtype_tx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(i40e_logtype_tx, pmd.net.i40e.tx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
-	i40e_logtype_tx_free = rte_log_register("pmd.net.i40e.tx_free");
-	if (i40e_logtype_tx_free >= 0)
-		rte_log_set_level(i40e_logtype_tx_free, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(i40e_logtype_tx_free, pmd.net.i40e.tx_free, DEBUG);
 #endif
-}
 
 RTE_PMD_REGISTER_PARAM_STRING(net_i40e,
 			      ETH_I40E_FLOATING_VEB_ARG "=1"
diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 2b1066b0a..d69e5284e 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -74,20 +74,6 @@  static int iavf_dev_filter_ctrl(struct rte_eth_dev *dev,
 		     enum rte_filter_op filter_op,
 		     void *arg);
 
-
-int iavf_logtype_init;
-int iavf_logtype_driver;
-
-#ifdef RTE_LIBRTE_IAVF_DEBUG_RX
-int iavf_logtype_rx;
-#endif
-#ifdef RTE_LIBRTE_IAVF_DEBUG_TX
-int iavf_logtype_tx;
-#endif
-#ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
-int iavf_logtype_tx_free;
-#endif
-
 static const struct rte_pci_id pci_id_iavf_map[] = {
 	{ RTE_PCI_DEVICE(IAVF_INTEL_VENDOR_ID, IAVF_DEV_ID_ADAPTIVE_VF) },
 	{ .vendor_id = 0, /* sentinel */ },
@@ -1556,30 +1542,14 @@  RTE_PMD_REGISTER_PCI(net_iavf, rte_iavf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_iavf, pci_id_iavf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_iavf, "* igb_uio | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_iavf, "cap=dcf");
-RTE_INIT(iavf_init_log)
-{
-	iavf_logtype_init = rte_log_register("pmd.net.iavf.init");
-	if (iavf_logtype_init >= 0)
-		rte_log_set_level(iavf_logtype_init, RTE_LOG_NOTICE);
-	iavf_logtype_driver = rte_log_register("pmd.net.iavf.driver");
-	if (iavf_logtype_driver >= 0)
-		rte_log_set_level(iavf_logtype_driver, RTE_LOG_NOTICE);
-
+RTE_LOG_REGISTER(iavf_logtype_init, pmd.net.iavf.init, NOTICE);
+RTE_LOG_REGISTER(iavf_logtype_driver, pmd.net.iavf.driver, NOTICE);
 #ifdef RTE_LIBRTE_IAVF_DEBUG_RX
-	iavf_logtype_rx = rte_log_register("pmd.net.iavf.rx");
-	if (iavf_logtype_rx >= 0)
-		rte_log_set_level(iavf_logtype_rx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(iavf_logtype_rx, pmd.net.iavf.rx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_IAVF_DEBUG_TX
-	iavf_logtype_tx = rte_log_register("pmd.net.iavf.tx");
-	if (iavf_logtype_tx >= 0)
-		rte_log_set_level(iavf_logtype_tx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(iavf_logtype_tx, pmd.net.iavf.tx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
-	iavf_logtype_tx_free = rte_log_register("pmd.net.iavf.tx_free");
-	if (iavf_logtype_tx_free >= 0)
-		rte_log_set_level(iavf_logtype_tx_free, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(iavf_logtype_tx_free, pmd.net.iavf.tx_free, DEBUG);
 #endif
-}
diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c
index 5a89a1955..3386960df 100644
--- a/drivers/net/ice/ice_ethdev.c
+++ b/drivers/net/ice/ice_ethdev.c
@@ -71,18 +71,6 @@  static struct proto_xtr_ol_flag ice_proto_xtr_ol_flag_params[] = {
 #define ICE_COMMS_PKG_NAME			"ICE COMMS Package"
 #define ICE_MAX_RES_DESC_NUM        1024
 
-int ice_logtype_init;
-int ice_logtype_driver;
-#ifdef RTE_LIBRTE_ICE_DEBUG_RX
-int ice_logtype_rx;
-#endif
-#ifdef RTE_LIBRTE_ICE_DEBUG_TX
-int ice_logtype_tx;
-#endif
-#ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE
-int ice_logtype_tx_free;
-#endif
-
 static int ice_dev_configure(struct rte_eth_dev *dev);
 static int ice_dev_start(struct rte_eth_dev *dev);
 static void ice_dev_stop(struct rte_eth_dev *dev);
@@ -4576,30 +4564,14 @@  RTE_PMD_REGISTER_PARAM_STRING(net_ice,
 			      ICE_PIPELINE_MODE_SUPPORT_ARG "=<0|1>"
 			      ICE_FLOW_MARK_SUPPORT_ARG "=<0|1>");
 
-RTE_INIT(ice_init_log)
-{
-	ice_logtype_init = rte_log_register("pmd.net.ice.init");
-	if (ice_logtype_init >= 0)
-		rte_log_set_level(ice_logtype_init, RTE_LOG_NOTICE);
-	ice_logtype_driver = rte_log_register("pmd.net.ice.driver");
-	if (ice_logtype_driver >= 0)
-		rte_log_set_level(ice_logtype_driver, RTE_LOG_NOTICE);
-
+RTE_LOG_REGISTER(ice_logtype_init, pmd.net.ice.init, NOTICE);
+RTE_LOG_REGISTER(ice_logtype_driver, pmd.net.ice.driver, NOTICE);
 #ifdef RTE_LIBRTE_ICE_DEBUG_RX
-	ice_logtype_rx = rte_log_register("pmd.net.ice.rx");
-	if (ice_logtype_rx >= 0)
-		rte_log_set_level(ice_logtype_rx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(ice_logtype_rx, pmd.net.ice.rx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_ICE_DEBUG_TX
-	ice_logtype_tx = rte_log_register("pmd.net.ice.tx");
-	if (ice_logtype_tx >= 0)
-		rte_log_set_level(ice_logtype_tx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(ice_logtype_tx, pmd.net.ice.tx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE
-	ice_logtype_tx_free = rte_log_register("pmd.net.ice.tx_free");
-	if (ice_logtype_tx_free >= 0)
-		rte_log_set_level(ice_logtype_tx_free, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(ice_logtype_tx_free, pmd.net.ice.tx_free, DEBUG);
 #endif
-}
diff --git a/drivers/net/igc/igc_logs.c b/drivers/net/igc/igc_logs.c
index eff7640b1..2d458d7fb 100644
--- a/drivers/net/igc/igc_logs.c
+++ b/drivers/net/igc/igc_logs.c
@@ -6,17 +6,5 @@ 
 
 #include "igc_logs.h"
 
-/* declared as extern in igc_logs.h */
-int igc_logtype_init;
-int igc_logtype_driver;
-
-RTE_INIT(igc_init_log)
-{
-	igc_logtype_init = rte_log_register("pmd.net.igc.init");
-	if (igc_logtype_init >= 0)
-		rte_log_set_level(igc_logtype_init, RTE_LOG_INFO);
-
-	igc_logtype_driver = rte_log_register("pmd.net.igc.driver");
-	if (igc_logtype_driver >= 0)
-		rte_log_set_level(igc_logtype_driver, RTE_LOG_INFO);
-}
+RTE_LOG_REGISTER(igc_logtype_init, pmd.net.igc.init, INFO);
+RTE_LOG_REGISTER(igc_logtype_driver, pmd.net.igc.driver, INFO);
diff --git a/drivers/net/ionic/ionic_ethdev.c b/drivers/net/ionic/ionic_ethdev.c
index 363f0cf00..800f6e5d6 100644
--- a/drivers/net/ionic/ionic_ethdev.c
+++ b/drivers/net/ionic/ionic_ethdev.c
@@ -59,8 +59,6 @@  static int  ionic_dev_xstats_get_names_by_id(struct rte_eth_dev *dev,
 static int  ionic_dev_fw_version_get(struct rte_eth_dev *eth_dev,
 	char *fw_version, size_t fw_size);
 
-int ionic_logtype;
-
 static const struct rte_pci_id pci_id_ionic_map[] = {
 	{ RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_PF) },
 	{ RTE_PCI_DEVICE(IONIC_PENSANDO_VENDOR_ID, IONIC_DEV_ID_ETH_VF) },
@@ -1318,10 +1316,4 @@  static struct rte_pci_driver rte_ionic_pmd = {
 RTE_PMD_REGISTER_PCI(net_ionic, rte_ionic_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_ionic, pci_id_ionic_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_ionic, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(ionic_init_log)
-{
-	ionic_logtype = rte_log_register("pmd.net.ionic");
-	if (ionic_logtype >= 0)
-		rte_log_set_level(ionic_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(ionic_logtype, pmd.net.ionic, NOTICE);
diff --git a/drivers/net/ipn3ke/ipn3ke_ethdev.c b/drivers/net/ipn3ke/ipn3ke_ethdev.c
index 5b5510f08..027be29bd 100644
--- a/drivers/net/ipn3ke/ipn3ke_ethdev.c
+++ b/drivers/net/ipn3ke/ipn3ke_ethdev.c
@@ -26,8 +26,6 @@ 
 #include "ipn3ke_logs.h"
 #include "ipn3ke_ethdev.h"
 
-int ipn3ke_afu_logtype;
-
 static const struct rte_afu_uuid afu_uuid_ipn3ke_map[] = {
 	{ MAP_UUID_10G_LOW,  MAP_UUID_10G_HIGH },
 	{ IPN3KE_UUID_10G_LOW, IPN3KE_UUID_10G_HIGH },
@@ -587,10 +585,4 @@  static struct rte_afu_driver afu_ipn3ke_driver = {
 };
 
 RTE_PMD_REGISTER_AFU(net_ipn3ke_afu, afu_ipn3ke_driver);
-
-RTE_INIT(ipn3ke_afu_init_log)
-{
-	ipn3ke_afu_logtype = rte_log_register("pmd.afu.ipn3ke");
-	if (ipn3ke_afu_logtype >= 0)
-		rte_log_set_level(ipn3ke_afu_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(ipn3ke_afu_logtype, pmd.afu.ipn3ke, NOTICE);
diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index f8a84c565..248f21d14 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -419,19 +419,6 @@  static int ixgbe_wait_for_link_up(struct ixgbe_hw *hw);
 		(r) = (h)->bitmap[idx] >> bit & 1;\
 	} while (0)
 
-int ixgbe_logtype_init;
-int ixgbe_logtype_driver;
-
-#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX
-int ixgbe_logtype_rx;
-#endif
-#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX
-int ixgbe_logtype_tx;
-#endif
-#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE
-int ixgbe_logtype_tx_free;
-#endif
-
 /*
  * The set of PCI devices this driver supports
  */
@@ -9117,29 +9104,15 @@  RTE_PMD_REGISTER_KMOD_DEP(net_ixgbe_vf, "* igb_uio | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_ixgbe_vf,
 			      IXGBEVF_DEVARG_PFLINK_FULLCHK "=<0|1>");
 
-RTE_INIT(ixgbe_init_log)
-{
-	ixgbe_logtype_init = rte_log_register("pmd.net.ixgbe.init");
-	if (ixgbe_logtype_init >= 0)
-		rte_log_set_level(ixgbe_logtype_init, RTE_LOG_NOTICE);
-	ixgbe_logtype_driver = rte_log_register("pmd.net.ixgbe.driver");
-	if (ixgbe_logtype_driver >= 0)
-		rte_log_set_level(ixgbe_logtype_driver, RTE_LOG_NOTICE);
+RTE_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgbe.init, NOTICE);
+RTE_LOG_REGISTER(ixgbe_logtype_driver, pmd.net.ixgbe.driver, NOTICE);
+
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_RX
-	ixgbe_logtype_rx = rte_log_register("pmd.net.ixgbe.rx");
-	if (ixgbe_logtype_rx >= 0)
-		rte_log_set_level(ixgbe_logtype_rx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(ixgbe_logtype_rx, pmd.net.ixgbe.rx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX
-	ixgbe_logtype_tx = rte_log_register("pmd.net.ixgbe.tx");
-	if (ixgbe_logtype_tx >= 0)
-		rte_log_set_level(ixgbe_logtype_tx, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(ixgbe_logtype_tx, pmd.net.ixgbe.tx, DEBUG);
 #endif
-
 #ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE
-	ixgbe_logtype_tx_free = rte_log_register("pmd.net.ixgbe.tx_free");
-	if (ixgbe_logtype_tx_free >= 0)
-		rte_log_set_level(ixgbe_logtype_tx_free, RTE_LOG_DEBUG);
+RTE_LOG_REGISTER(ixgbe_logtype_tx_free, pmd.net.ixgbe.tx_free, DEBUG);
 #endif
-}
diff --git a/drivers/net/kni/rte_eth_kni.c b/drivers/net/kni/rte_eth_kni.c
index d88cb1778..cde98f0bb 100644
--- a/drivers/net/kni/rte_eth_kni.c
+++ b/drivers/net/kni/rte_eth_kni.c
@@ -67,7 +67,7 @@  static const struct rte_eth_link pmd_link = {
 };
 static int is_kni_initialized;
 
-static int eth_kni_logtype;
+RTE_LOG_REGISTER(eth_kni_logtype, pmd.net.kni, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, eth_kni_logtype, \
@@ -508,10 +508,3 @@  static struct rte_vdev_driver eth_kni_drv = {
 
 RTE_PMD_REGISTER_VDEV(net_kni, eth_kni_drv);
 RTE_PMD_REGISTER_PARAM_STRING(net_kni, ETH_KNI_NO_REQUEST_THREAD_ARG "=<int>");
-
-RTE_INIT(eth_kni_init_log)
-{
-	eth_kni_logtype = rte_log_register("pmd.net.kni");
-	if (eth_kni_logtype >= 0)
-		rte_log_set_level(eth_kni_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c
index ad4a51ecd..2258838c4 100644
--- a/drivers/net/liquidio/lio_ethdev.c
+++ b/drivers/net/liquidio/lio_ethdev.c
@@ -15,9 +15,6 @@ 
 #include "lio_ethdev.h"
 #include "lio_rxtx.h"
 
-int lio_logtype_init;
-int lio_logtype_driver;
-
 /* Default RSS key in use */
 static uint8_t lio_rss_key[40] = {
 	0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2,
@@ -2161,13 +2158,5 @@  static struct rte_pci_driver rte_liovf_pmd = {
 RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio-pci");
-
-RTE_INIT(lio_init_log)
-{
-	lio_logtype_init = rte_log_register("pmd.net.liquidio.init");
-	if (lio_logtype_init >= 0)
-		rte_log_set_level(lio_logtype_init, RTE_LOG_NOTICE);
-	lio_logtype_driver = rte_log_register("pmd.net.liquidio.driver");
-	if (lio_logtype_driver >= 0)
-		rte_log_set_level(lio_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(lio_logtype_init, pmd.net.liquidio.init, NOTICE);
+RTE_LOG_REGISTER(lio_logtype_driver, pmd.net.liquidio.driver, NOTICE);
diff --git a/drivers/net/memif/rte_eth_memif.c b/drivers/net/memif/rte_eth_memif.c
index b6da9a8b4..c1c7e9f8d 100644
--- a/drivers/net/memif/rte_eth_memif.c
+++ b/drivers/net/memif/rte_eth_memif.c
@@ -1806,11 +1806,4 @@  RTE_PMD_REGISTER_PARAM_STRING(net_memif,
 			      ETH_MEMIF_ZC_ARG "=yes|no"
 			      ETH_MEMIF_SECRET_ARG "=<string>");
 
-int memif_logtype;
-
-RTE_INIT(memif_init_log)
-{
-	memif_logtype = rte_log_register("pmd.net.memif");
-	if (memif_logtype >= 0)
-		rte_log_set_level(memif_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(memif_logtype, pmd.net.memif, NOTICE);
diff --git a/drivers/net/mlx4/mlx4.c b/drivers/net/mlx4/mlx4.c
index 5d7202720..927222c81 100644
--- a/drivers/net/mlx4/mlx4.c
+++ b/drivers/net/mlx4/mlx4.c
@@ -64,9 +64,6 @@  static rte_spinlock_t mlx4_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 /* Process local data for secondary processes. */
 static struct mlx4_local_data mlx4_local_data;
 
-/** Driver-specific log messages type. */
-int mlx4_logtype;
-
 /** Configuration structure for device arguments. */
 struct mlx4_conf {
 	struct {
@@ -1281,16 +1278,14 @@  mlx4_glue_init(void)
 
 #endif
 
+/* Initialize driver log type. */
+RTE_LOG_REGISTER(mlx4_logtype, pmd.net.mlx4, NOTICE)
+
 /**
  * Driver initialization routine.
  */
 RTE_INIT(rte_mlx4_pmd_init)
 {
-	/* Initialize driver log type. */
-	mlx4_logtype = rte_log_register("pmd.net.mlx4");
-	if (mlx4_logtype >= 0)
-		rte_log_set_level(mlx4_logtype, RTE_LOG_NOTICE);
-
 	/*
 	 * MLX4_DEVICE_FATAL_CLEANUP tells ibv_destroy functions we
 	 * want to get success errno value in case of calling them
diff --git a/drivers/net/mlx5/mlx5.c b/drivers/net/mlx5/mlx5.c
index 5c86f6fb9..16257a63a 100644
--- a/drivers/net/mlx5/mlx5.c
+++ b/drivers/net/mlx5/mlx5.c
@@ -173,8 +173,6 @@  static rte_spinlock_t mlx5_shared_data_lock = RTE_SPINLOCK_INITIALIZER;
 
 /* Process local data for secondary processes. */
 static struct mlx5_local_data mlx5_local_data;
-/** Driver-specific log messages type. */
-int mlx5_logtype;
 
 static LIST_HEAD(, mlx5_dev_ctx_shared) mlx5_dev_ctx_list =
 						LIST_HEAD_INITIALIZER();
@@ -1999,16 +1997,14 @@  struct rte_pci_driver mlx5_driver = {
 	.drv_flags = PCI_DRV_FLAGS,
 };
 
+/* Initialize driver log type. */
+RTE_LOG_REGISTER(mlx5_logtype, pmd.net.mlx5, NOTICE)
+
 /**
  * Driver initialization routine.
  */
 RTE_INIT(rte_mlx5_pmd_init)
 {
-	/* Initialize driver log type. */
-	mlx5_logtype = rte_log_register("pmd.net.mlx5");
-	if (mlx5_logtype >= 0)
-		rte_log_set_level(mlx5_logtype, RTE_LOG_NOTICE);
-
 	/* Build the static tables for Verbs conversion. */
 	mlx5_set_ptype_table();
 	mlx5_set_cksum_table();
diff --git a/drivers/net/mvneta/mvneta_ethdev.c b/drivers/net/mvneta/mvneta_ethdev.c
index 4aea87648..673a8e2b3 100644
--- a/drivers/net/mvneta/mvneta_ethdev.c
+++ b/drivers/net/mvneta/mvneta_ethdev.c
@@ -34,8 +34,6 @@ 
 /** Maximum length of a match string */
 #define MVNETA_MATCH_LEN 16
 
-int mvneta_logtype;
-
 static const char * const valid_args[] = {
 	MVNETA_IFACE_NAME_ARG,
 	NULL
@@ -982,10 +980,4 @@  static struct rte_vdev_driver pmd_mvneta_drv = {
 
 RTE_PMD_REGISTER_VDEV(net_mvneta, pmd_mvneta_drv);
 RTE_PMD_REGISTER_PARAM_STRING(net_mvneta, "iface=<ifc>");
-
-RTE_INIT(mvneta_init_log)
-{
-	mvneta_logtype = rte_log_register("pmd.net.mvneta");
-	if (mvneta_logtype >= 0)
-		rte_log_set_level(mvneta_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(mvneta_logtype, pmd.net.mvneta, NOTICE);
diff --git a/drivers/net/mvpp2/mrvl_ethdev.c b/drivers/net/mvpp2/mrvl_ethdev.c
index b98b1fd66..75589f18e 100644
--- a/drivers/net/mvpp2/mrvl_ethdev.c
+++ b/drivers/net/mvpp2/mrvl_ethdev.c
@@ -84,8 +84,6 @@  static struct pp2_bpool *mrvl_port_to_bpool_lookup[RTE_MAX_ETHPORTS];
 static int mrvl_port_bpool_size[PP2_NUM_PKT_PROC][PP2_BPOOL_NUM_POOLS][RTE_MAX_LCORE];
 static uint64_t cookie_addr_high = MRVL_COOKIE_ADDR_INVALID;
 
-int mrvl_logtype;
-
 struct mrvl_ifnames {
 	const char *names[PP2_NUM_ETH_PPIO * PP2_NUM_PKT_PROC];
 	int idx;
@@ -3040,10 +3038,4 @@  static struct rte_vdev_driver pmd_mrvl_drv = {
 
 RTE_PMD_REGISTER_VDEV(net_mvpp2, pmd_mrvl_drv);
 RTE_PMD_REGISTER_ALIAS(net_mvpp2, eth_mvpp2);
-
-RTE_INIT(mrvl_init_log)
-{
-	mrvl_logtype = rte_log_register("pmd.net.mvpp2");
-	if (mrvl_logtype >= 0)
-		rte_log_set_level(mrvl_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(mrvl_logtype, pmd.net.mvpp2, NOTICE);
diff --git a/drivers/net/netvsc/hn_ethdev.c b/drivers/net/netvsc/hn_ethdev.c
index ac182a548..fd91c0e49 100644
--- a/drivers/net/netvsc/hn_ethdev.c
+++ b/drivers/net/netvsc/hn_ethdev.c
@@ -45,9 +45,6 @@ 
 			    DEV_RX_OFFLOAD_VLAN_STRIP | \
 			    DEV_RX_OFFLOAD_RSS_HASH)
 
-int hn_logtype_init;
-int hn_logtype_driver;
-
 struct hn_xstats_name_off {
 	char name[RTE_ETH_XSTATS_NAME_SIZE];
 	unsigned int offset;
@@ -1121,13 +1118,5 @@  static struct rte_vmbus_driver rte_netvsc_pmd = {
 
 RTE_PMD_REGISTER_VMBUS(net_netvsc, rte_netvsc_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(net_netvsc, "* uio_hv_generic");
-
-RTE_INIT(hn_init_log)
-{
-	hn_logtype_init = rte_log_register("pmd.net.netvsc.init");
-	if (hn_logtype_init >= 0)
-		rte_log_set_level(hn_logtype_init, RTE_LOG_NOTICE);
-	hn_logtype_driver = rte_log_register("pmd.net.netvsc.driver");
-	if (hn_logtype_driver >= 0)
-		rte_log_set_level(hn_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(hn_logtype_init, pmd.net.netvsc.init, NOTICE);
+RTE_LOG_REGISTER(hn_logtype_driver, pmd.net.netvsc.driver, NOTICE);
diff --git a/drivers/net/nfp/nfp_net.c b/drivers/net/nfp/nfp_net.c
index 2460ee199..88e3f01d6 100644
--- a/drivers/net/nfp/nfp_net.c
+++ b/drivers/net/nfp/nfp_net.c
@@ -3683,9 +3683,6 @@  static int nfp_pf_pci_probe(struct rte_pci_driver *pci_drv __rte_unused,
 	return ret;
 }
 
-int nfp_logtype_init;
-int nfp_logtype_driver;
-
 static const struct rte_pci_id pci_id_nfp_pf_net_map[] = {
 	{
 		RTE_PCI_DEVICE(PCI_VENDOR_ID_NETRONOME,
@@ -3769,16 +3766,8 @@  RTE_PMD_REGISTER_PCI_TABLE(net_nfp_pf, pci_id_nfp_pf_net_map);
 RTE_PMD_REGISTER_PCI_TABLE(net_nfp_vf, pci_id_nfp_vf_net_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_nfp_pf, "* igb_uio | uio_pci_generic | vfio");
 RTE_PMD_REGISTER_KMOD_DEP(net_nfp_vf, "* igb_uio | uio_pci_generic | vfio");
-
-RTE_INIT(nfp_init_log)
-{
-	nfp_logtype_init = rte_log_register("pmd.net.nfp.init");
-	if (nfp_logtype_init >= 0)
-		rte_log_set_level(nfp_logtype_init, RTE_LOG_NOTICE);
-	nfp_logtype_driver = rte_log_register("pmd.net.nfp.driver");
-	if (nfp_logtype_driver >= 0)
-		rte_log_set_level(nfp_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(nfp_logtype_init, pmd.net.nfp.init, NOTICE);
+RTE_LOG_REGISTER(nfp_logtype_driver, pmd.net.nfp.driver, NOTICE);
 /*
  * Local variables:
  * c-file-style: "Linux"
diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c
index 11258ccea..8c779be7f 100644
--- a/drivers/net/null/rte_eth_null.c
+++ b/drivers/net/null/rte_eth_null.c
@@ -73,7 +73,7 @@  static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-static int eth_null_logtype;
+RTE_LOG_REGISTER(eth_null_logtype, pmd.net.null, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, eth_null_logtype, \
@@ -730,9 +730,3 @@  RTE_PMD_REGISTER_PARAM_STRING(net_null,
 	"copy=<int> "
 	ETH_NULL_PACKET_NO_RX_ARG "=0|1");
 
-RTE_INIT(eth_null_init_log)
-{
-	eth_null_logtype = rte_log_register("pmd.net.null");
-	if (eth_null_logtype >= 0)
-		rte_log_set_level(eth_null_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/octeontx/octeontx_ethdev.c b/drivers/net/octeontx/octeontx_ethdev.c
index d5371ae07..76c69294d 100644
--- a/drivers/net/octeontx/octeontx_ethdev.c
+++ b/drivers/net/octeontx/octeontx_ethdev.c
@@ -47,24 +47,9 @@  enum octeontx_link_speed {
 	OCTEONTX_LINK_SPEED_RESERVE2
 };
 
-int otx_net_logtype_mbox;
-int otx_net_logtype_init;
-int otx_net_logtype_driver;
-
-RTE_INIT(otx_net_init_log)
-{
-	otx_net_logtype_mbox = rte_log_register("pmd.net.octeontx.mbox");
-	if (otx_net_logtype_mbox >= 0)
-		rte_log_set_level(otx_net_logtype_mbox, RTE_LOG_NOTICE);
-
-	otx_net_logtype_init = rte_log_register("pmd.net.octeontx.init");
-	if (otx_net_logtype_init >= 0)
-		rte_log_set_level(otx_net_logtype_init, RTE_LOG_NOTICE);
-
-	otx_net_logtype_driver = rte_log_register("pmd.net.octeontx.driver");
-	if (otx_net_logtype_driver >= 0)
-		rte_log_set_level(otx_net_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(otx_net_logtype_mbox, pmd.net.octeontx.mbox, NOTICE);
+RTE_LOG_REGISTER(otx_net_logtype_init, pmd.net.octeontx.init, NOTICE);
+RTE_LOG_REGISTER(otx_net_logtype_driver, pmd.net.octeontx.driver, NOTICE);
 
 /* Parse integer from integer argument */
 static int
diff --git a/drivers/net/pcap/rte_eth_pcap.c b/drivers/net/pcap/rte_eth_pcap.c
index 13a3d0ac7..60e393c92 100644
--- a/drivers/net/pcap/rte_eth_pcap.c
+++ b/drivers/net/pcap/rte_eth_pcap.c
@@ -135,7 +135,7 @@  static struct rte_eth_link pmd_link = {
 		.link_autoneg = ETH_LINK_FIXED,
 };
 
-static int eth_pcap_logtype;
+RTE_LOG_REGISTER(eth_pcap_logtype, pmd.net.pcap, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, eth_pcap_logtype, \
@@ -1589,9 +1589,3 @@  RTE_PMD_REGISTER_PARAM_STRING(net_pcap,
 	ETH_PCAP_PHY_MAC_ARG "=<int>"
 	ETH_PCAP_INFINITE_RX_ARG "=<0|1>");
 
-RTE_INIT(eth_pcap_init_log)
-{
-	eth_pcap_logtype = rte_log_register("pmd.net.pcap");
-	if (eth_pcap_logtype >= 0)
-		rte_log_set_level(eth_pcap_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/pfe/pfe_ethdev.c b/drivers/net/pfe/pfe_ethdev.c
index b1de866d3..368acfa55 100644
--- a/drivers/net/pfe/pfe_ethdev.c
+++ b/drivers/net/pfe/pfe_ethdev.c
@@ -40,8 +40,6 @@  unsigned int pfe_svr = SVR_LS1012A_REV1;
 static void *cbus_emac_base[3];
 static void *cbus_gpi_base[3];
 
-int pfe_logtype_pmd;
-
 /* pfe_gemac_init
  */
 static int
@@ -1181,10 +1179,4 @@  struct rte_vdev_driver pmd_pfe_drv = {
 
 RTE_PMD_REGISTER_VDEV(PFE_NAME_PMD, pmd_pfe_drv);
 RTE_PMD_REGISTER_PARAM_STRING(PFE_NAME_PMD, PFE_VDEV_GEM_ID_ARG "=<int> ");
-
-RTE_INIT(pfe_pmd_init_log)
-{
-	pfe_logtype_pmd = rte_log_register("pmd.net.pfe");
-	if (pfe_logtype_pmd >= 0)
-		rte_log_set_level(pfe_logtype_pmd, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(pfe_logtype_pmd, pmd.net.pfe, NOTICE);
diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c
index c4f8f1258..6107d583e 100644
--- a/drivers/net/qede/qede_ethdev.c
+++ b/drivers/net/qede/qede_ethdev.c
@@ -10,10 +10,6 @@ 
 #include <rte_version.h>
 #include <rte_kvargs.h>
 
-/* Globals */
-int qede_logtype_init;
-int qede_logtype_driver;
-
 static const struct qed_eth_ops *qed_ops;
 static int qede_eth_dev_uninit(struct rte_eth_dev *eth_dev);
 static int qede_eth_dev_init(struct rte_eth_dev *eth_dev);
@@ -2870,13 +2866,5 @@  RTE_PMD_REGISTER_KMOD_DEP(net_qede, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PCI(net_qede_vf, rte_qedevf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_qede_vf, pci_id_qedevf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_qede_vf, "* igb_uio | vfio-pci");
-
-RTE_INIT(qede_init_log)
-{
-	qede_logtype_init = rte_log_register("pmd.net.qede.init");
-	if (qede_logtype_init >= 0)
-		rte_log_set_level(qede_logtype_init, RTE_LOG_NOTICE);
-	qede_logtype_driver = rte_log_register("pmd.net.qede.driver");
-	if (qede_logtype_driver >= 0)
-		rte_log_set_level(qede_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(qede_logtype_init, pmd.net.qede.init, NOTICE);
+RTE_LOG_REGISTER(qede_logtype_driver, pmd.net.qede.driver, NOTICE);
diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c
index f0fafa0c0..078df605a 100644
--- a/drivers/net/ring/rte_eth_ring.c
+++ b/drivers/net/ring/rte_eth_ring.c
@@ -61,7 +61,7 @@  static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-static int eth_ring_logtype;
+RTE_LOG_REGISTER(eth_ring_logtype, pmd.net.ring, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, eth_ring_logtype, \
@@ -703,9 +703,3 @@  RTE_PMD_REGISTER_ALIAS(net_ring, eth_ring);
 RTE_PMD_REGISTER_PARAM_STRING(net_ring,
 	ETH_RING_NUMA_NODE_ACTION_ARG "=name:node:action(ATTACH|CREATE)");
 
-RTE_INIT(eth_ring_init_log)
-{
-	eth_ring_logtype = rte_log_register("pmd.net.ring");
-	if (eth_ring_logtype >= 0)
-		rte_log_set_level(eth_ring_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c
index 11723778f..866d17a93 100644
--- a/drivers/net/softnic/rte_eth_softnic.c
+++ b/drivers/net/softnic/rte_eth_softnic.c
@@ -80,7 +80,7 @@  static const struct softnic_conn_params conn_params_default = {
 	.msg_handle_arg = NULL,
 };
 
-static int pmd_softnic_logtype;
+RTE_LOG_REGISTER(pmd_softnic_logtype, pmd.net.softnic, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \
@@ -690,14 +690,6 @@  RTE_PMD_REGISTER_PARAM_STRING(net_softnic,
 	PMD_PARAM_TM_QSIZE12 "=<uint32>"
 );
 
-
-RTE_INIT(pmd_softnic_init_log)
-{
-	pmd_softnic_logtype = rte_log_register("pmd.net.softnic");
-	if (pmd_softnic_logtype >= 0)
-		rte_log_set_level(pmd_softnic_logtype, RTE_LOG_NOTICE);
-}
-
 int
 rte_pmd_softnic_manage(uint16_t port_id)
 {
diff --git a/drivers/net/szedata2/rte_eth_szedata2.c b/drivers/net/szedata2/rte_eth_szedata2.c
index 821bb346c..30c888cd9 100644
--- a/drivers/net/szedata2/rte_eth_szedata2.c
+++ b/drivers/net/szedata2/rte_eth_szedata2.c
@@ -102,9 +102,6 @@  struct szedata2_tx_queue {
 	volatile uint64_t err_pkts;
 };
 
-int szedata2_logtype_init;
-int szedata2_logtype_driver;
-
 static struct rte_ether_addr eth_addr = {
 	.addr_bytes = { 0x00, 0x11, 0x17, 0x00, 0x00, 0x00 }
 };
@@ -1941,13 +1938,5 @@  RTE_PMD_REGISTER_PCI(RTE_SZEDATA2_DRIVER_NAME, szedata2_eth_driver);
 RTE_PMD_REGISTER_PCI_TABLE(RTE_SZEDATA2_DRIVER_NAME, rte_szedata2_pci_id_table);
 RTE_PMD_REGISTER_KMOD_DEP(RTE_SZEDATA2_DRIVER_NAME,
 	"* combo6core & combov3 & szedata2 & ( szedata2_cv3 | szedata2_cv3_fdt )");
-
-RTE_INIT(szedata2_init_log)
-{
-	szedata2_logtype_init = rte_log_register("pmd.net.szedata2.init");
-	if (szedata2_logtype_init >= 0)
-		rte_log_set_level(szedata2_logtype_init, RTE_LOG_NOTICE);
-	szedata2_logtype_driver = rte_log_register("pmd.net.szedata2.driver");
-	if (szedata2_logtype_driver >= 0)
-		rte_log_set_level(szedata2_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(szedata2_logtype_init, pmd.net.szedata2.init, NOTICE);
+RTE_LOG_REGISTER(szedata2_logtype_driver, pmd.net.szedata2.driver, NOTICE);
diff --git a/drivers/net/tap/rte_eth_tap.c b/drivers/net/tap/rte_eth_tap.c
index 7081ae23e..339f24bf8 100644
--- a/drivers/net/tap/rte_eth_tap.c
+++ b/drivers/net/tap/rte_eth_tap.c
@@ -2494,11 +2494,4 @@  RTE_PMD_REGISTER_PARAM_STRING(net_tap,
 			      ETH_TAP_IFACE_ARG "=<string> "
 			      ETH_TAP_MAC_ARG "=" ETH_TAP_MAC_ARG_FMT " "
 			      ETH_TAP_REMOTE_ARG "=<string>");
-int tap_logtype;
-
-RTE_INIT(tap_init_log)
-{
-	tap_logtype = rte_log_register("pmd.net.tap");
-	if (tap_logtype >= 0)
-		rte_log_set_level(tap_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(tap_logtype, pmd.net.tap, NOTICE);
diff --git a/drivers/net/thunderx/nicvf_ethdev.c b/drivers/net/thunderx/nicvf_ethdev.c
index bfda0ab0e..d955a7ee2 100644
--- a/drivers/net/thunderx/nicvf_ethdev.c
+++ b/drivers/net/thunderx/nicvf_ethdev.c
@@ -44,10 +44,6 @@ 
 #include "nicvf_svf.h"
 #include "nicvf_logs.h"
 
-int nicvf_logtype_mbox;
-int nicvf_logtype_init;
-int nicvf_logtype_driver;
-
 static void nicvf_dev_stop(struct rte_eth_dev *dev);
 static void nicvf_dev_stop_cleanup(struct rte_eth_dev *dev, bool cleanup);
 static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
@@ -55,20 +51,9 @@  static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
 static int nicvf_vlan_offload_config(struct rte_eth_dev *dev, int mask);
 static int nicvf_vlan_offload_set(struct rte_eth_dev *dev, int mask);
 
-RTE_INIT(nicvf_init_log)
-{
-	nicvf_logtype_mbox = rte_log_register("pmd.net.thunderx.mbox");
-	if (nicvf_logtype_mbox >= 0)
-		rte_log_set_level(nicvf_logtype_mbox, RTE_LOG_NOTICE);
-
-	nicvf_logtype_init = rte_log_register("pmd.net.thunderx.init");
-	if (nicvf_logtype_init >= 0)
-		rte_log_set_level(nicvf_logtype_init, RTE_LOG_NOTICE);
-
-	nicvf_logtype_driver = rte_log_register("pmd.net.thunderx.driver");
-	if (nicvf_logtype_driver >= 0)
-		rte_log_set_level(nicvf_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(nicvf_logtype_mbox, pmd.net.thunderx.mbox, NOTICE);
+RTE_LOG_REGISTER(nicvf_logtype_init, pmd.net.thunderx.init, NOTICE);
+RTE_LOG_REGISTER(nicvf_logtype_driver, pmd.net.thunderx.driver, NOTICE);
 
 static void
 nicvf_link_status_update(struct nicvf *nic,
diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c
index 9ed74a1d6..1ecb0b3e6 100644
--- a/drivers/net/vdev_netvsc/vdev_netvsc.c
+++ b/drivers/net/vdev_netvsc/vdev_netvsc.c
@@ -48,6 +48,8 @@ 
 #define NETVSC_CLASS_ID "{f8615163-df3e-46c5-913f-f2d2f965ed0e}"
 #define NETVSC_MAX_ROUTE_LINE_SIZE 300
 
+RTE_LOG_REGISTER(vdev_netvsc_logtype, pmd.net.vdev_netvsc, NOTICE);
+
 #define DRV_LOG(level, ...) \
 	rte_log(RTE_LOG_ ## level, \
 		vdev_netvsc_logtype, \
@@ -55,9 +57,6 @@ 
 			RTE_FMT_HEAD(__VA_ARGS__,) "\n", \
 		RTE_FMT_TAIL(__VA_ARGS__,)))
 
-/** Driver-specific log messages type. */
-static int vdev_netvsc_logtype;
-
 /** Context structure for a vdev_netvsc instance. */
 struct vdev_netvsc_ctx {
 	LIST_ENTRY(vdev_netvsc_ctx) entry; /**< Next entry in list. */
@@ -774,14 +773,6 @@  RTE_PMD_REGISTER_PARAM_STRING(net_vdev_netvsc,
 			      VDEV_NETVSC_ARG_FORCE "=<int> "
 			      VDEV_NETVSC_ARG_IGNORE "=<int>");
 
-/** Initialize driver log type. */
-RTE_INIT(vdev_netvsc_init_log)
-{
-	vdev_netvsc_logtype = rte_log_register("pmd.net.vdev_netvsc");
-	if (vdev_netvsc_logtype >= 0)
-		rte_log_set_level(vdev_netvsc_logtype, RTE_LOG_NOTICE);
-}
-
 /** Compare function for vdev find device operation. */
 static int
 vdev_netvsc_cmp_rte_device(const struct rte_device *dev1,
diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c
index 808e670f1..bfacdcb98 100644
--- a/drivers/net/vhost/rte_eth_vhost.c
+++ b/drivers/net/vhost/rte_eth_vhost.c
@@ -18,7 +18,7 @@ 
 
 #include "rte_eth_vhost.h"
 
-static int vhost_logtype;
+RTE_LOG_REGISTER(vhost_logtype, pmd.net.vhost, NOTICE);
 
 #define VHOST_LOG(level, ...) \
 	rte_log(RTE_LOG_ ## level, vhost_logtype, __VA_ARGS__)
@@ -1571,9 +1571,3 @@  RTE_PMD_REGISTER_PARAM_STRING(net_vhost,
 	"linear-buffer=<0|1> "
 	"ext-buffer=<0|1>");
 
-RTE_INIT(vhost_init_log)
-{
-	vhost_logtype = rte_log_register("pmd.net.vhost");
-	if (vhost_logtype >= 0)
-		rte_log_set_level(vhost_logtype, RTE_LOG_NOTICE);
-}
diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c
index 312871cb4..dc0093bdf 100644
--- a/drivers/net/virtio/virtio_ethdev.c
+++ b/drivers/net/virtio/virtio_ethdev.c
@@ -85,9 +85,6 @@  static int virtio_dev_queue_stats_mapping_set(
 	uint8_t stat_idx,
 	uint8_t is_rx);
 
-int virtio_logtype_init;
-int virtio_logtype_driver;
-
 static void virtio_notify_peers(struct rte_eth_dev *dev);
 static void virtio_ack_link_announce(struct rte_eth_dev *dev);
 
@@ -2659,13 +2656,5 @@  __rte_unused uint8_t is_rx)
 RTE_PMD_EXPORT_NAME(net_virtio, __COUNTER__);
 RTE_PMD_REGISTER_PCI_TABLE(net_virtio, pci_id_virtio_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_virtio, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(virtio_init_log)
-{
-	virtio_logtype_init = rte_log_register("pmd.net.virtio.init");
-	if (virtio_logtype_init >= 0)
-		rte_log_set_level(virtio_logtype_init, RTE_LOG_NOTICE);
-	virtio_logtype_driver = rte_log_register("pmd.net.virtio.driver");
-	if (virtio_logtype_driver >= 0)
-		rte_log_set_level(virtio_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(virtio_logtype_init, pmd.net.virtio.init, NOTICE);
+RTE_LOG_REGISTER(virtio_logtype_driver, pmd.net.virtio.driver, NOTICE);
diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c
index c6e11ad2d..815fba2f5 100644
--- a/drivers/net/vmxnet3/vmxnet3_ethdev.c
+++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c
@@ -95,9 +95,6 @@  static int vmxnet3_mac_addr_set(struct rte_eth_dev *dev,
 				 struct rte_ether_addr *mac_addr);
 static void vmxnet3_interrupt_handler(void *param);
 
-int vmxnet3_logtype_init;
-int vmxnet3_logtype_driver;
-
 /*
  * The set of PCI devices this driver supports
  */
@@ -1464,13 +1461,5 @@  vmxnet3_interrupt_handler(void *param)
 RTE_PMD_REGISTER_PCI(net_vmxnet3, rte_vmxnet3_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_vmxnet3, pci_id_vmxnet3_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_vmxnet3, "* igb_uio | uio_pci_generic | vfio-pci");
-
-RTE_INIT(vmxnet3_init_log)
-{
-	vmxnet3_logtype_init = rte_log_register("pmd.net.vmxnet3.init");
-	if (vmxnet3_logtype_init >= 0)
-		rte_log_set_level(vmxnet3_logtype_init, RTE_LOG_NOTICE);
-	vmxnet3_logtype_driver = rte_log_register("pmd.net.vmxnet3.driver");
-	if (vmxnet3_logtype_driver >= 0)
-		rte_log_set_level(vmxnet3_logtype_driver, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(vmxnet3_logtype_init, pmd.net.vmxnet3.init, NOTICE);
+RTE_LOG_REGISTER(vmxnet3_logtype_driver, pmd.net.vmxnet3.driver, NOTICE);