Skip to contentSkip to conversation

cleanup drivers log registration

PATCH Superseded Thomas Monjalon 9 participants 37 messages Mar 10, 2021 – Apr 8, 2021

Subsystems (4)
lore
Share & tools
lore
#0 lore raw

cover cleanup drivers log registration

After working on the option "--log-level help", it became clear that few adjustments were required for the log registration of some drivers.

Thomas Monjalon (3):
log: choose EAL log type on registration failure
drivers: fix log level after loading
drivers: align log names

 doc/guides/cryptodevs/qat.rst          | 10 +++---
 drivers/common/mlx5/mlx5_common.c      |  9 +----
 drivers/common/qat/qat_logs.c          |  4 +--
 drivers/crypto/bcmfs/bcmfs_logs.c      | 17 ++-------
 drivers/net/e1000/e1000_logs.c         | 49 +++-----------------------
 drivers/net/e1000/em_ethdev.c          |  6 ----
 drivers/net/e1000/igb_ethdev.c         |  6 ----
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 drivers/raw/ioat/ioat_rawdev.c         |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c          |  2 +-
 lib/librte_eal/include/rte_log.h       |  1 +
 12 files changed, 20 insertions(+), 90 deletions(-)
Signature · 1 line
2.30.1
#1 lore raw

PATCH 1/3 log: choose EAL log type on registration failure

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

---
 lib/librte_eal/include/rte_log.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/include/rte_log.h +1 -0
index e6192892c3..178a265c3f 100644
@@ -392,6 +392,7 @@ RTE_INIT(__##type)							\
 {									\
 	type = rte_log_register_type_and_pick_level(RTE_STR(name),	\
 						    RTE_LOG_##level);	\
+	type = RTE_MAX(0, type);                                        \
 }
 
 #ifdef __cplusplus
Signature · 1 line
2.30.1
#2 lore raw

Re: [dpdk-dev] [PATCH 1/3] log: choose EAL log type on registration failure

Quoted 15 lines · Thomas Monjalon

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

---
 lib/librte_eal/include/rte_log.h | 1 +
 1 file changed, 1 insertion(+)
lib/librte_eal/include/rte_log.h +0 -0
index e6192892c3..178a265c3f 100644

lib/librte_eal/include/rte_log.h RTE_INIT(__##type) \ · line 396

Quoted 5 lines
lib/librte_eal/include/rte_log.h +1 -0
@@ -392,6 +392,7 @@ RTE_INIT(__##type)                                                  \
 {                                                                      \
        type = rte_log_register_type_and_pick_level(RTE_STR(name),      \
                                                    RTE_LOG_##level);   \
+       type = RTE_MAX(0, type);                                        \
 }

Hard to read and to grep, can we use explicit logtype?

if (type < 0)

    type = RTE_LOGTYPE_EAL;
Signature · 1 line
David Marchand
#3 lore raw

Re: [dpdk-dev] [PATCH 1/3] log: choose EAL log type on registration failure

23/03/2021 19:22, David Marchand:

Quoted 7 lines · Thomas Monjalon
Quoted 6 lines

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

[...]

Quoted 10 lines
Quoted 5 lines
 {                                                                      \
        type = rte_log_register_type_and_pick_level(RTE_STR(name),      \
                                                    RTE_LOG_##level);   \
+       type = RTE_MAX(0, type);                                        \

}

Hard to read and to grep, can we use explicit logtype?

if (type < 0)

    type = RTE_LOGTYPE_EAL;

Yes I agree it is better because we can grep the explicit name.

#4 lore raw

PATCH 2/3 drivers: fix log level after loading

In reply to Thomas Monjalon

When compiled as a shared object, and loaded at runtime as a plugin, the drivers should get the log level set earlier at EAL init by the user through --log-level option.

The function for applying the log level setting is rte_log_register_type_and_pick_level().
It is called by most drivers via RTE_LOG_REGISTER().

The drivers common/mlx5, bcmfs and e1000 were missing, so the user-specified log level was not applied when those drivers were loaded as plugins.
The macro RTE_LOG_REGISTER() is used for those drivers.

The unnecessary protection for double registration is removed from e1000.

Fixes 9c99878aa1b1 ("log: introduce logtype register macro")
Fixes c8e79da7c676 ("crypto/bcmfs: introduce BCMFS driver")
---
 drivers/common/mlx5/mlx5_common.c |  9 +-----
 drivers/crypto/bcmfs/bcmfs_logs.c | 17 ++---------
 drivers/net/e1000/e1000_logs.c    | 49 ++++---------------------------
 drivers/net/e1000/em_ethdev.c     |  6 ----
 drivers/net/e1000/igb_ethdev.c    |  6 ----
 5 files changed, 8 insertions(+), 79 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -8
index c26a2cfa30..f92f05bda5 100644
@@ -14,8 +14,6 @@
 #include "mlx5_common_utils.h"
 #include "mlx5_common_pci.h"
 
-int mlx5_common_logtype;
-
 uint8_t haswell_broadwell_cpu;
 
 /* In case this is an x86_64 intel processor to check if
@@ -41,12 +39,7 @@ static inline void mlx5_cpu_id(unsigned int level,
 }
 #endif
 
-RTE_INIT_PRIO(mlx5_log_init, LOG)
-{
-	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
-	if (mlx5_common_logtype >= 0)
-		rte_log_set_level(mlx5_common_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(mlx5_common_logtype, pmd.common.mlx5, NOTICE)
 
 static bool mlx5_common_initialized;
 
drivers/crypto/bcmfs/bcmfs_logs.c +2 -15
index 86f4ff3b53..701da9ecf3 100644
@@ -8,9 +8,6 @@
 
 #include "bcmfs_logs.h"
 
-int bcmfs_conf_logtype;
-int bcmfs_dp_logtype;
-
 int
 bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 		const void *buf, unsigned int len)
@@ -24,15 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_INIT(bcmfs_device_init_log)
-{
-	/* Configuration and general logs */
-	bcmfs_conf_logtype = rte_log_register("pmd.bcmfs_config");
-	if (bcmfs_conf_logtype >= 0)
-		rte_log_set_level(bcmfs_conf_logtype, RTE_LOG_NOTICE);
-
-	/* data-path logs */
-	bcmfs_dp_logtype = rte_log_register("pmd.bcmfs_fp");
-	if (bcmfs_dp_logtype >= 0)
-		rte_log_set_level(bcmfs_dp_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
drivers/net/e1000/e1000_logs.c +5 -44

58 lines not on this page · raw message

drivers/net/e1000/em_ethdev.c +0 -6
index 9b8c4a7de5..79a6d8f461 100644
@@ -1846,9 +1846,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
 RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(igb_init_log)
-{
-	e1000_igb_init_log();
-}
drivers/net/e1000/igb_ethdev.c +0 -6
index 5323504e98..395dc3f5aa 100644
@@ -5434,9 +5434,3 @@ RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio-pci
 RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(e1000_init_log)
-{
-	e1000_igb_init_log();
-}
Signature · 1 line
2.30.1
Reviewed-by on v1 2/3
#5 lore raw

Re: [dpdk-dev] [dpdk-stable] [PATCH 2/3] drivers: fix log level after loading

Quoted 14 lines · Thomas Monjalon

When compiled as a shared object, and loaded at runtime as a plugin, the drivers should get the log level set earlier at EAL init by the user through --log-level option.

The function for applying the log level setting is rte_log_register_type_and_pick_level().
It is called by most drivers via RTE_LOG_REGISTER().

The drivers common/mlx5, bcmfs and e1000 were missing, so the user-specified log level was not applied when those drivers were loaded as plugins.
The macro RTE_LOG_REGISTER() is used for those drivers.

Quoted 8 lines

The unnecessary protection for double registration is removed from e1000.

Fixes 9c99878aa1b1 ("log: introduce logtype register macro")
Fixes c8e79da7c676 ("crypto/bcmfs: introduce BCMFS driver")
Signature · 1 line
David Marchand
Acked-by on v1 2/3
#6 lore raw

Re: [dpdk-dev] [PATCH 2/3] drivers: fix log level after loading

In reply to Thomas Monjalon
Quoted 17 lines · Thomas Monjalon

When compiled as a shared object, and loaded at runtime as a plugin, the drivers should get the log level set earlier at EAL init by the user through --log-level option.

The function for applying the log level setting is rte_log_register_type_and_pick_level().
It is called by most drivers via RTE_LOG_REGISTER().

The drivers common/mlx5, bcmfs and e1000 were missing, so the user-specified log level was not applied when those drivers were loaded as plugins.
The macro RTE_LOG_REGISTER() is used for those drivers.

The unnecessary protection for double registration is removed from e1000.

Quoted 8 lines
Fixes 9c99878aa1b1 ("log: introduce logtype register macro")
Fixes c8e79da7c676 ("crypto/bcmfs: introduce BCMFS driver")
---
 drivers/common/mlx5/mlx5_common.c |  9 +-----
 drivers/crypto/bcmfs/bcmfs_logs.c | 17 ++---------

For bcmfs,

Quoted 158 lines
 drivers/net/e1000/e1000_logs.c    | 49 ++++---------------------------
 drivers/net/e1000/em_ethdev.c     |  6 ----
 drivers/net/e1000/igb_ethdev.c    |  6 ----
 5 files changed, 8 insertions(+), 79 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -8
index c26a2cfa30..f92f05bda5 100644
@@ -14,8 +14,6 @@
 #include "mlx5_common_utils.h"
 #include "mlx5_common_pci.h"
 
-int mlx5_common_logtype;
-
 uint8_t haswell_broadwell_cpu;
 
 /* In case this is an x86_64 intel processor to check if
@@ -41,12 +39,7 @@ static inline void mlx5_cpu_id(unsigned int level,
 }
 #endif
 
-RTE_INIT_PRIO(mlx5_log_init, LOG)
-{
-       mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
-       if (mlx5_common_logtype >= 0)
-               rte_log_set_level(mlx5_common_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(mlx5_common_logtype, pmd.common.mlx5, NOTICE)
 
 static bool mlx5_common_initialized;
 
drivers/crypto/bcmfs/bcmfs_logs.c +2 -15
index 86f4ff3b53..701da9ecf3 100644
@@ -8,9 +8,6 @@
 
 #include "bcmfs_logs.h"
 
-int bcmfs_conf_logtype;
-int bcmfs_dp_logtype;
-
 int
 bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
                const void *buf, unsigned int len)
@@ -24,15 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
        return 0;
 }
 
-RTE_INIT(bcmfs_device_init_log)
-{
-       /* Configuration and general logs */
-       bcmfs_conf_logtype = rte_log_register("pmd.bcmfs_config");
-       if (bcmfs_conf_logtype >= 0)
-               rte_log_set_level(bcmfs_conf_logtype, RTE_LOG_NOTICE);
-
-       /* data-path logs */
-       bcmfs_dp_logtype = rte_log_register("pmd.bcmfs_fp");
-       if (bcmfs_dp_logtype >= 0)
-               rte_log_set_level(bcmfs_dp_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
drivers/net/e1000/e1000_logs.c +5 -44
index 231f5c03ef..d9b8a4672f 100644
@@ -4,53 +4,14 @@
 
 #include "e1000_logs.h"
 
-/* declared as extern in e1000_logs.h */
-int e1000_logtype_init;
-int e1000_logtype_driver;
-
+RTE_LOG_REGISTER(e1000_logtype_init, pmd.net.e1000.init, NOTICE)
+RTE_LOG_REGISTER(e1000_logtype_driver, pmd.net.e1000.driver, NOTICE)
 #ifdef RTE_LIBRTE_E1000_DEBUG_RX
-int e1000_logtype_rx;
+RTE_LOG_REGISTER(e1000_logtype_rx, pmd.net.e1000.rx, DEBUG)
 #endif
 #ifdef RTE_LIBRTE_E1000_DEBUG_TX
-int e1000_logtype_tx;
+RTE_LOG_REGISTER(e1000_logtype_tx, pmd.net.e1000.tx, DEBUG)
 #endif
 #ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
-int e1000_logtype_tx_free;
+RTE_LOG_REGISTER(e1000_logtype_tx_free, pmd.net.e1000.tx_free, DEBUG)
 #endif
-
-/* avoids double registering of logs if EM and IGB drivers are in use */
-static int e1000_log_initialized;
-
-void
-e1000_igb_init_log(void)
-{
-       if (e1000_log_initialized)
-               return;
-
-       e1000_logtype_init = rte_log_register("pmd.net.e1000.init");
-       if (e1000_logtype_init >= 0)
-               rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE);
-       e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver");
-       if (e1000_logtype_driver >= 0)
-               rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE);
-
-#ifdef RTE_LIBRTE_E1000_DEBUG_RX
-       e1000_logtype_rx = rte_log_register("pmd.net.e1000.rx");
-       if (e1000_logtype_rx >= 0)
-               rte_log_set_level(e1000_logtype_rx, RTE_LOG_DEBUG);
-#endif
-
-#ifdef RTE_LIBRTE_E1000_DEBUG_TX
-       e1000_logtype_tx = rte_log_register("pmd.net.e1000.tx");
-       if (e1000_logtype_tx >= 0)
-               rte_log_set_level(e1000_logtype_tx, RTE_LOG_DEBUG);
-#endif
-
-#ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE
-       e1000_logtype_tx_free = rte_log_register("pmd.net.e1000.tx_free");
-       if (e1000_logtype_tx_free >= 0)
-               rte_log_set_level(e1000_logtype_tx_free, RTE_LOG_DEBUG);
-#endif
-
-       e1000_log_initialized = 1;
-}
drivers/net/e1000/em_ethdev.c +0 -6
index 9b8c4a7de5..79a6d8f461 100644
@@ -1846,9 +1846,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
 RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(igb_init_log)
-{
-       e1000_igb_init_log();
-}
drivers/net/e1000/igb_ethdev.c +0 -7
index 5323504e98..395dc3f5aa 100644
@@ -5434,9 +5434,3 @@ RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio-pci
 RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(e1000_init_log)
-{
-       e1000_igb_init_log();
-}
--

2.30.1

#7 lore raw

PATCH 3/3 drivers: align log names

In reply to Thomas Monjalon

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

---
 doc/guides/cryptodevs/qat.rst          | 10 +++++-----
 drivers/common/qat/qat_logs.c          |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c      |  4 ++--
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 drivers/raw/ioat/ioat_rawdev.c         |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c          |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/qat.rst +5 -5
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log level) on
 the process cmdline, e.g. using any of the following::
 
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
drivers/common/qat/qat_logs.c +2 -2
index fa48be53c3..adbe163cd9 100644
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
-RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +2 -2
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
-RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 27129b133e..56b1866f77 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd = {
 RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
 #define COMPLETION_SZ sizeof(__m128i)
drivers/raw/skeleton/skeleton_rawdev.c +1 -1
index aa3beaad18..8896f0c9c5 100644
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -1
index 6a1b44bc77..bf7afe4610 100644
@@ -25,7 +25,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
Signature · 1 line
2.30.1
Acked-by on v1 3/3
#9 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

In reply to Thomas Monjalon

Hi,

Quoted 144 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, March 10, 2021 22:01
To: [email protected]
Cc: Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Ajit Khaparde <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>; Richardson, Bruce <[email protected]>; Nipun Gupta <[email protected]>; Hemant Agrawal <[email protected]>; Wang, Xiao W <[email protected]>
Subject: [PATCH 3/3] drivers: align log names

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

---
 doc/guides/cryptodevs/qat.rst          | 10 +++++-----
 drivers/common/qat/qat_logs.c          |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c      |  4 ++--
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 drivers/raw/ioat/ioat_rawdev.c         |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c          |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/qat.rst +2 -2
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log level)

on the process cmdline, e.g. using any of the following::

doc/guides/cryptodevs/qat.rst +3 -3
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
(quoted diff) +0 -0

b/drivers/common/qat/qat_logs.c index fa48be53c3..adbe163cd9 100644

drivers/common/qat/qat_logs.c +0 -1
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype,
 const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE); -

RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);

drivers/common/qat/qat_logs.c +2 -0
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +0 -1
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype,
 const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE) -

RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)

drivers/crypto/bcmfs/bcmfs_logs.c +2 -0
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/raw/ifpga/ifpga_rawdev.c +0 -0
index 27129b133e..56b1866f77 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd
 = {  RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver,
 rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver,
 rte_ifpga_rawdev_pmd);

RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci"); -RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);

drivers/raw/ifpga/ifpga_rawdev.c +1 -0
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)  #define

COMPLETION_SZ sizeof(__m128i) diff --git
a/drivers/raw/skeleton/skeleton_rawdev.c
b/drivers/raw/skeleton/skeleton_rawdev.c
index aa3beaad18..8896f0c9c5 100644

drivers/raw/skeleton/skeleton_rawdev.c +1 -0
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {  };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME,
 skeleton_pmd_drv); -RTE_LOG_REGISTER(skeleton_pmd_logtype,
 rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -2
index 6a1b44bc77..bf7afe4610 100644
@@ -25,7 +25,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
--
Quoted 1 line

2.30.1

Acked-by on v1 3/3
#10 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

In reply to Thomas Monjalon

Hi,

BRs,
Xiao

Quoted 45 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Wednesday, March 10, 2021 10:01 PM
To: [email protected]
Cc: Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Ajit Khaparde <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; Xu, Rosen <[email protected]>; Zhang, Tianfei <[email protected]>; Richardson, Bruce <[email protected]>; Nipun Gupta <[email protected]>; Hemant Agrawal <[email protected]>; Wang, Xiao W <[email protected]>
Subject: [PATCH 3/3] drivers: align log names

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

---
 doc/guides/cryptodevs/qat.rst          | 10 +++++-----
 drivers/common/qat/qat_logs.c          |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c      |  4 ++--
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 drivers/raw/ioat/ioat_rawdev.c         |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c          |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/qat.rst +2 -2
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 

[...]

Quoted 25 lines

b/drivers/raw/skeleton/skeleton_rawdev.c
index aa3beaad18..8896f0c9c5 100644

drivers/raw/skeleton/skeleton_rawdev.c +1 -1
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME,
 skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -2
index 6a1b44bc77..bf7afe4610 100644
@@ -25,7 +25,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
--
Quoted 1 line

2.30.1

For vdpa/ifc part:

#12 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

In reply to Thomas Monjalon
Quoted 6 lines · Thomas Monjalon

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Without a check, this is likely to happen again.
I cooked this:

devtools/checkpatches.sh +12 -0
index 78a408ef98..dc52569792 100755
@@ -199,6 +199,41 @@ check_internal_tags() { # <patch>
        return $res
 }
 
+check_log_levels() { # <patch>
+       res=0
+
+       cat "$1" |awk '
+       BEGIN {
+               pattern = "";
+               ret = 0;
+       }
+       /^+++ b\// {
+               count = split($2, path, "/")
+               if (count >= 4 && path[2] == "lib") {
+                       pattern = "lib\\." gensub(/librte_(.*)/,

"\\1", "", path[3])
+ } else if (count >= 5 && path[2] == "drivers") {
+ pattern = "pmd\\." path[3] "\\." path[4]
+ } else {
+ pattern = "";
+ }
+ }
+ /^+.*RTE_LOG_REGISTER\([^,]+,[^,]+,/ {
+ if (pattern == "") {
+ next;
+ }
+ if (! ($0 ~ "RTE_LOG_REGISTER\\([^,]+, " pattern
"(|\\.[^,]+),")) {
+ print $0
+ print "Added logtype does not comply with
pattern: " gensub(/\\/, "", "g", pattern)
+ ret = 1;
+ }
+ }
+ END {
+ exit ret;
+ }' || res=1
+
+ return $res
+}
+
number=0
range='origin/main..'
quiet=false
@@ -290,6 +325,14 @@ check () { # <patch> <commit> <title>

                ret=1
        fi
+       ! $verbose || printf '\nChecking RTE_LOG_REGISTER:\n'
+       report=$(check_log_levels "$tmpinput")
+       if [ $? -ne 0 ] ; then
+               $headline_printed || print_headline "$3"
+               printf '%s\n' "$report"
+               ret=1

+ fi
+
if [ "$tmpinput" != "$1" ]; then
rm -f "$tmpinput"
trap - INT

Which for following patch:

drivers/net/ixgbe/ixgbe_ethdev.c +0 -0
index 761a0f26bb..ef6e3b2d0c 100644
@@ -8452,7 +8452,8 @@ 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_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgbe.init, NOTICE); +RTE_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgb.init, NOTICE); +RTE_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgbe.plop, NOTICE);
RTE_LOG_REGISTER(ixgbe_logtype_driver, pmd.net.ixgbe.driver, NOTICE);

#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX

(quoted diff) +0 -0

b/lib/librte_compressdev/rte_compressdev.c
index 49a342f400..d444685053 100644

lib/librte_compressdev/rte_compressdev.c +2 -0
@@ -764,3 +764,5 @@ rte_compressdev_name_get(uint8_t dev_id)
 }
 
 RTE_LOG_REGISTER(compressdev_logtype, lib.compressdev, NOTICE);
+RTE_LOG_REGISTER(compressdev_logtype, lib.compressdev, NOTICE);
+RTE_LOG_REGISTER(compressdev_logtype, lib.compressde, NOTICE);

Triggers:

$ ./devtools/checkpatches.sh -n1
...

+RTE_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgb.init, NOTICE); Added logtype does not comply with pattern: pmd.net.ixgbe +RTE_LOG_REGISTER(compressdev_logtype, lib.compressde, NOTICE); Added logtype does not comply with pattern: lib.compressdev

WDYT?

Signature · 1 line
David Marchand
#13 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

19/03/2021 17:29, David Marchand:

Quoted 10 lines · Thomas Monjalon
Quoted 6 lines

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Without a check, this is likely to happen again.
I cooked this:

[...]

Quoted 6 lines

+RTE_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgb.init, NOTICE); Added logtype does not comply with pattern: pmd.net.ixgbe +RTE_LOG_REGISTER(compressdev_logtype, lib.compressde, NOTICE); Added logtype does not comply with pattern: lib.compressdev

WDYT?

I cannot parse awk but it looks nice.
And in general, have more tools is a good thing.
Would you submit this tool as a patch?

#14 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

Quoted 18 lines · Thomas Monjalon

19/03/2021 17:29, David Marchand:

Quoted 10 lines · Thomas Monjalon
Quoted 6 lines

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Without a check, this is likely to happen again.
I cooked this:

[...]

Quoted 5 lines

+RTE_LOG_REGISTER(ixgbe_logtype_init, pmd.net.ixgb.init, NOTICE); Added logtype does not comply with pattern: pmd.net.ixgbe +RTE_LOG_REGISTER(compressdev_logtype, lib.compressde, NOTICE); Added logtype does not comply with pattern: lib.compressdev

Quoted 5 lines
Quoted 1 line

WDYT?

I cannot parse awk but it looks nice.
And in general, have more tools is a good thing.
Would you submit this tool as a patch?

http://inbox.dpdk.org/dev/[email protected]/T/#u

Signature · 1 line
David Marchand
Acked-by on v1 3/3
#15 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

In reply to Thomas Monjalon
Quoted 7 lines · Thomas Monjalon

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Quoted 5 lines
---
 doc/guides/cryptodevs/qat.rst          | 10 +++++-----
 drivers/common/qat/qat_logs.c          |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c      |  4 ++--

For bcmfs,

Quoted 112 lines
 drivers/raw/ifpga/ifpga_rawdev.c       |  2 +-
 drivers/raw/ioat/ioat_rawdev.c         |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c          |  2 +-
 7 files changed, 13 insertions(+), 13 deletions(-)
doc/guides/cryptodevs/qat.rst +5 -5
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log level) on
 the process cmdline, e.g. using any of the following::
 
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-       --log-level="7" --log-level="pmd.qat_general,8"
+       --log-level="7" --log-level="pmd.qat.general,8"
drivers/common/qat/qat_logs.c +2 -2
index fa48be53c3..adbe163cd9 100644
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
        return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
-RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +2 -2
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
        return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
-RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 27129b133e..56b1866f77 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd = {
 RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF    0x6f2F
 #define IOAT_DEVICE_ID_ICX     0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
 #define COMPLETION_SZ sizeof(__m128i)
drivers/raw/skeleton/skeleton_rawdev.c +1 -1
index aa3beaad18..8896f0c9c5 100644
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -2
index 6a1b44bc77..bf7afe4610 100644
@@ -25,7 +25,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
        rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
                "IFCVF %s(): " fmt "\n", __func__, ##args)
--

2.30.1

#16 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

In reply to Thomas Monjalon

drivers/vdpa/ifc/ifcvf_vdpa.c line 28

Quoted 10 lines · Thomas Monjalon
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -1
index 6a1b44bc77..bf7afe4610 100644
@@ -25,7 +25,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);

The driver is in drivers/vdpa/ifc, I would expect pmd.vdpa.ifc

We have some little variations for the af_packet and bonding drivers, worth aligning from my pov. drivers/net/af_packet/rte_eth_af_packet.c:RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE); drivers/net/bonding/rte_eth_bond_pmd.c:RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);

And ipn3ke is odd too:
drivers/net/ipn3ke/ipn3ke_ethdev.c:RTE_LOG_REGISTER(ipn3ke_afu_logtype, pmd.afu.ipn3ke, NOTICE);

Signature · 1 line
David Marchand
#17 lore raw

Re: [dpdk-dev] [PATCH 3/3] drivers: align log names

22/03/2021 11:33, David Marchand:

Quoted 7 lines · Thomas Monjalon
Quoted 6 lines
drivers/vdpa/ifc/ifcvf_vdpa.c +0 -0
index 6a1b44bc77..bf7afe4610 100644
@@ -25,7 +25,7 @@
 
Quoted 6 lines

drivers/vdpa/ifc/ifcvf_vdpa.c line 28

Quoted 4 lines
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -1
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);

The driver is in drivers/vdpa/ifc, I would expect pmd.vdpa.ifc

I'm not sure for this one.
My understanding is that the name of the driver can be a little different of the directory name, especially if having multiple drivers in a directory.
Here there is only VF in IFC.

Quoted 6 lines

We have some little variations for the af_packet and bonding drivers, worth aligning from my pov. drivers/net/af_packet/rte_eth_af_packet.c:RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE); drivers/net/bonding/rte_eth_bond_pmd.c:RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);

Yes good catch, will align these two.

Quoted 3 lines

And ipn3ke is odd too:
drivers/net/ipn3ke/ipn3ke_ethdev.c:RTE_LOG_REGISTER(ipn3ke_afu_logtype, pmd.afu.ipn3ke, NOTICE);

I agree it's strange, but I don't understand ifpga and ipn3ke enough to have a good judgement.
I feel more naming have to be carified in this driver.

I will highlight ifc and ipn3ke in v2 to have a conclusion.

Rosen, Xiao, please comment.

#18 lore raw

v2 cover drivers: align log names

In reply to Thomas Monjalon

After working on the option "--log-level help", it became clear that few adjustments were required for the log registration of some drivers.

v2:
- align bonding and af_packet
- make explicit the RTE_LOGTYPE_EAL default

Thomas Monjalon (3):
log: choose EAL log type on registration failure
drivers: fix log level after loading
drivers: align log names

 doc/guides/cryptodevs/qat.rst             | 10 ++---
 drivers/common/mlx5/mlx5_common.c         |  9 +----
 drivers/common/qat/qat_logs.c             |  4 +-
 drivers/crypto/bcmfs/bcmfs_logs.c         | 17 +-------
 drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
 drivers/net/e1000/e1000_logs.c            | 49 +++--------------------
 drivers/net/e1000/em_ethdev.c             |  6 ---
 drivers/net/e1000/igb_ethdev.c            |  6 ---
 drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
 drivers/raw/ioat/ioat_rawdev.c            |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
 lib/librte_eal/include/rte_log.h          |  2 +
 14 files changed, 23 insertions(+), 92 deletions(-)
Signature · 1 line
2.31.1
#19 lore raw

PATCH v2 1/3 log: choose EAL log type on registration failure

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

---
 lib/librte_eal/include/rte_log.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_eal/include/rte_log.h +2 -0
index 173004fd71..21a7d16340 100644
@@ -380,6 +380,8 @@ RTE_INIT(__##type)							\
 {									\
 	type = rte_log_register_type_and_pick_level(RTE_STR(name),	\
 						    RTE_LOG_##level);	\
+	if (type < 0)                                                   \
+		type = RTE_LOGTYPE_EAL;                                 \
 }
 
 #ifdef __cplusplus
Signature · 1 line
2.31.1
Reviewed-by on v2 1/3
#20 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] log: choose EAL log type on registration failure

Quoted 4 lines · Thomas Monjalon

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

How about simply:
the fallback is to use the EAL log type.

Quoted 2 lines
Signature · 1 line
David Marchand
#21 lore raw

Re: [dpdk-dev] [PATCH v2 1/3] log: choose EAL log type on registration failure

06/04/2021 11:17, David Marchand:

Quoted 8 lines · Thomas Monjalon
Quoted 4 lines

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the log type 0, assigned to EAL.

How about simply:
the fallback is to use the EAL log type.

OK, no need to mention 0.

Quoted 6 lines
Quoted 2 lines
#22 lore raw

PATCH v2 2/3 drivers: fix log level after loading

In reply to Thomas Monjalon

When compiled as a shared object, and loaded at runtime as a plugin, the drivers should get the log level set earlier at EAL init by the user through --log-level option.

The function for applying the log level setting is rte_log_register_type_and_pick_level().
It is called by most drivers via RTE_LOG_REGISTER().

The drivers common/mlx5, bcmfs and e1000 were missing, so the user-specified log level was not applied when those drivers were loaded as plugins.
The macro RTE_LOG_REGISTER() is used for those drivers.

The unnecessary protection for double registration is removed from e1000.

Fixes 9c99878aa1b1 ("log: introduce logtype register macro")
Fixes c8e79da7c676 ("crypto/bcmfs: introduce BCMFS driver")
---
 drivers/common/mlx5/mlx5_common.c |  9 +-----
 drivers/crypto/bcmfs/bcmfs_logs.c | 17 ++---------
 drivers/net/e1000/e1000_logs.c    | 49 ++++---------------------------
 drivers/net/e1000/em_ethdev.c     |  6 ----
 drivers/net/e1000/igb_ethdev.c    |  6 ----
 5 files changed, 8 insertions(+), 79 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -8
index c26a2cfa30..f92f05bda5 100644
@@ -14,8 +14,6 @@
 #include "mlx5_common_utils.h"
 #include "mlx5_common_pci.h"
 
-int mlx5_common_logtype;
-
 uint8_t haswell_broadwell_cpu;
 
 /* In case this is an x86_64 intel processor to check if
@@ -41,12 +39,7 @@ static inline void mlx5_cpu_id(unsigned int level,
 }
 #endif
 
-RTE_INIT_PRIO(mlx5_log_init, LOG)
-{
-	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
-	if (mlx5_common_logtype >= 0)
-		rte_log_set_level(mlx5_common_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(mlx5_common_logtype, pmd.common.mlx5, NOTICE)
 
 static bool mlx5_common_initialized;
 
drivers/crypto/bcmfs/bcmfs_logs.c +2 -15
index 86f4ff3b53..701da9ecf3 100644
@@ -8,9 +8,6 @@
 
 #include "bcmfs_logs.h"
 
-int bcmfs_conf_logtype;
-int bcmfs_dp_logtype;
-
 int
 bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 		const void *buf, unsigned int len)
@@ -24,15 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_INIT(bcmfs_device_init_log)
-{
-	/* Configuration and general logs */
-	bcmfs_conf_logtype = rte_log_register("pmd.bcmfs_config");
-	if (bcmfs_conf_logtype >= 0)
-		rte_log_set_level(bcmfs_conf_logtype, RTE_LOG_NOTICE);
-
-	/* data-path logs */
-	bcmfs_dp_logtype = rte_log_register("pmd.bcmfs_fp");
-	if (bcmfs_dp_logtype >= 0)
-		rte_log_set_level(bcmfs_dp_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
drivers/net/e1000/e1000_logs.c +5 -44

58 lines not on this page · raw message

drivers/net/e1000/em_ethdev.c +0 -6
index 3c6f643c19..3e7ccdbf09 100644
@@ -1850,9 +1850,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
 RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(igb_init_log)
-{
-	e1000_igb_init_log();
-}
drivers/net/e1000/igb_ethdev.c +0 -6
index 17ee6e91a0..a1a72339ba 100644
@@ -5421,9 +5421,3 @@ RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio-pci
 RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(e1000_init_log)
-{
-	e1000_igb_init_log();
-}
Signature · 1 line
2.31.1
#23 lore raw

PATCH v2 3/3 drivers: align log names

In reply to Thomas Monjalon

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc pmd.afu.ipn3ke instead of pmd.net.ipn3ke

---
 doc/guides/cryptodevs/qat.rst             | 10 +++++-----
 drivers/common/qat/qat_logs.c             |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c         |  4 ++--
 drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
 drivers/raw/ioat/ioat_rawdev.c            |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)
doc/guides/cryptodevs/qat.rst +5 -5
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log level) on
 the process cmdline, e.g. using any of the following::
 
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
drivers/common/qat/qat_logs.c +2 -2
index fa48be53c3..adbe163cd9 100644
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
-RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +2 -2
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
-RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index bfe5a0a451..a04f7c773a 100644
@@ -97,7 +97,7 @@ static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE);
+RTE_LOG_REGISTER(af_packet_logtype, pmd.net.af_packet, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
drivers/net/bonding/rte_eth_bond_pmd.c +1 -1
index 24e3cf3c2e..2e9cea5b8e 100644
@@ -3775,4 +3775,4 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
 	"up_delay=<int> "
 	"down_delay=<int>");
 
-RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);
+RTE_LOG_REGISTER(bond_logtype, pmd.net.bonding, NOTICE);
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 05d79bfcc2..d9a46ef915 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd = {
 RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
 #define COMPLETION_SZ sizeof(__m128i)
drivers/raw/skeleton/skeleton_rawdev.c +1 -1
index aa3beaad18..8896f0c9c5 100644
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -1
index 39237aecf7..7a06f97429 100644
@@ -26,7 +26,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
Signature · 1 line
2.31.1
Acked-by on v2 3/3
#24 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] drivers: align log names

Hi Thomas,

Quoted 189 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, April 5, 2021 6:03 PM
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Xu, Rosen <[email protected]>; Wang, Xiao W <[email protected]>; Hemant Agrawal <[email protected]>; Ajit Khaparde <[email protected]>; Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; John W. Linville <[email protected]>; Chas Williams <[email protected]>; Min Hu (Connor) <[email protected]>; Zhang, Tianfei <[email protected]>; Nipun Gupta <[email protected]>
Subject: [PATCH v2 3/3] drivers: align log names

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc pmd.afu.ipn3ke instead of pmd.net.ipn3ke

---
 doc/guides/cryptodevs/qat.rst             | 10 +++++-----
 drivers/common/qat/qat_logs.c             |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c         |  4 ++--
 drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
 drivers/raw/ioat/ioat_rawdev.c            |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)
doc/guides/cryptodevs/qat.rst +2 -2
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log

level) on
the process cmdline, e.g. using any of the following::

doc/guides/cryptodevs/qat.rst +3 -3
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
drivers/common/qat/qat_logs.c +2 -2
index fa48be53c3..adbe163cd9 100644
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype,
 const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
-RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +1 -2
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype,
 const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
-RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config,

NOTICE)

drivers/crypto/bcmfs/bcmfs_logs.c +1 -0
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index bfe5a0a451..a04f7c773a 100644
@@ -97,7 +97,7 @@ static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE);
+RTE_LOG_REGISTER(af_packet_logtype, pmd.net.af_packet, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
drivers/net/bonding/rte_eth_bond_pmd.c +1 -1
index 24e3cf3c2e..2e9cea5b8e 100644
@@ -3775,4 +3775,4 @@
 RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
 	"up_delay=<int> "
 	"down_delay=<int>");
 
-RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);
+RTE_LOG_REGISTER(bond_logtype, pmd.net.bonding, NOTICE);
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 05d79bfcc2..d9a46ef915 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver
 rte_ifpga_rawdev_pmd = {
 RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver,
 rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver,
 rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio |
 uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
 #define COMPLETION_SZ sizeof(__m128i)
drivers/raw/skeleton/skeleton_rawdev.c +1 -1
index aa3beaad18..8896f0c9c5 100644
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME,
 skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -2
index 39237aecf7..7a06f97429 100644
@@ -26,7 +26,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
--
Quoted 1 line

2.31.1

For this vdpa/ifc part:

BRs,
Xiao

Acked-by on v2 3/3
#25 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] drivers: align log names

In reply to Thomas Monjalon

Hi,

Quoted 183 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Monday, April 05, 2021 18:03
To: [email protected]
Cc: Richardson, Bruce <[email protected]>; Xu, Rosen <[email protected]>; Wang, Xiao W <[email protected]>; Hemant Agrawal <[email protected]>; Ajit Khaparde <[email protected]>; Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; John W. Linville <[email protected]>; Chas Williams <[email protected]>; Min Hu (Connor) <[email protected]>; Zhang, Tianfei <[email protected]>; Nipun Gupta <[email protected]>
Subject: [PATCH v2 3/3] drivers: align log names

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc
pmd.afu.ipn3ke instead of pmd.net.ipn3ke

---
 doc/guides/cryptodevs/qat.rst             | 10 +++++-----
 drivers/common/qat/qat_logs.c             |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c         |  4 ++--
 drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
 drivers/raw/ioat/ioat_rawdev.c            |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
 9 files changed, 15 insertions(+), 15 deletions(-)
doc/guides/cryptodevs/qat.rst +2 -2
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log level)

on the process cmdline, e.g. using any of the following::

doc/guides/cryptodevs/qat.rst +3 -3
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
(quoted diff) +0 -0

b/drivers/common/qat/qat_logs.c index fa48be53c3..adbe163cd9 100644

drivers/common/qat/qat_logs.c +0 -1
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype,
 const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE); -

RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);

drivers/common/qat/qat_logs.c +2 -0
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +0 -1
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype,
 const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE) -

RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)

drivers/crypto/bcmfs/bcmfs_logs.c +2 -0
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index bfe5a0a451..a04f7c773a 100644
@@ -97,7 +97,7 @@ static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE);
+RTE_LOG_REGISTER(af_packet_logtype, pmd.net.af_packet, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \ diff --git

a/drivers/net/bonding/rte_eth_bond_pmd.c
b/drivers/net/bonding/rte_eth_bond_pmd.c
index 24e3cf3c2e..2e9cea5b8e 100644

drivers/net/bonding/rte_eth_bond_pmd.c +1 -1
@@ -3775,4 +3775,4 @@
 RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
 	"up_delay=<int> "
 	"down_delay=<int>");
 
-RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);
+RTE_LOG_REGISTER(bond_logtype, pmd.net.bonding, NOTICE);
drivers/raw/ifpga/ifpga_rawdev.c +0 -0
index 05d79bfcc2..d9a46ef915 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd
 = {  RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver,
 rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver,
 rte_ifpga_rawdev_pmd);

RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci"); -RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);

drivers/raw/ifpga/ifpga_rawdev.c +1 -0
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)  #define

COMPLETION_SZ sizeof(__m128i) diff --git
a/drivers/raw/skeleton/skeleton_rawdev.c
b/drivers/raw/skeleton/skeleton_rawdev.c
index aa3beaad18..8896f0c9c5 100644

drivers/raw/skeleton/skeleton_rawdev.c +1 -0
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {  };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME,
 skeleton_pmd_drv); -RTE_LOG_REGISTER(skeleton_pmd_logtype,
 rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -2
index 39237aecf7..7a06f97429 100644
@@ -26,7 +26,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
--
Quoted 1 line

2.31.1

#26 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] drivers: align log names

Hi Rosen,

You already gave your ack in previous version, no need to re-ack. Instead, please give your opinion and explanation as requested below. We want to replace pmd.afu.ipn3ke with pmd.net.ipn3ke.
The use of AFU in the driver is not clear.

Xiao, we need your opinion as well about ifcvf vs ifc name.

Quoted 16 lines
Quoted 16 lines

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc pmd.afu.ipn3ke instead of pmd.net.ipn3ke

[...]

Quoted 1 line
#27 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] drivers: align log names

HI Thomas,

I'm ok, if you replace pmd.afu.ipn3ke with pmd.net.ipn3ke. Thanks your reminder.

Quoted 47 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, April 06, 2021 17:31
To: Xu, Rosen <[email protected]>; Wang, Xiao W <[email protected]>
Cc: [email protected]; Richardson, Bruce <[email protected]>; Hemant Agrawal <[email protected]>; Ajit Khaparde <[email protected]>; Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; John W. Linville <[email protected]>; Chas Williams <[email protected]>; Min Hu (Connor) <[email protected]>; Zhang, Tianfei <[email protected]>; Nipun Gupta <[email protected]>; [email protected]
Subject: Re: [PATCH v2 3/3] drivers: align log names

Hi Rosen,

You already gave your ack in previous version, no need to re-ack. Instead, please give your opinion and explanation as requested below. We want to replace pmd.afu.ipn3ke with pmd.net.ipn3ke.
The use of AFU in the driver is not clear.

Xiao, we need your opinion as well about ifcvf vs ifc name.

Quoted 16 lines
Quoted 16 lines

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc pmd.afu.ipn3ke instead of pmd.net.ipn3ke

[...]

Quoted 1 line
#28 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] drivers: align log names

Hi Thomas,

I agree with the "ifcvf" name, as there might be more than one driver in a single driver dir.

Thanks,
Xiao

Quoted 70 lines

-----Original Message-----
From: Xu, Rosen <[email protected]>
Sent: Tuesday, April 6, 2021 5:48 PM
To: Thomas Monjalon <[email protected]>; Wang, Xiao W <[email protected]>
Cc: [email protected]; Richardson, Bruce <[email protected]>; Hemant Agrawal <[email protected]>; Ajit Khaparde <[email protected]>; Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; John W. Linville <[email protected]>; Chas Williams <[email protected]>; Min Hu (Connor) <[email protected]>; Zhang, Tianfei <[email protected]>; Nipun Gupta <[email protected]>; [email protected]
Subject: RE: [PATCH v2 3/3] drivers: align log names

HI Thomas,

I'm ok, if you replace pmd.afu.ipn3ke with pmd.net.ipn3ke. Thanks your reminder.

Quoted 5 lines

-----Original Message-----
From: Thomas Monjalon <[email protected]>
Sent: Tuesday, April 06, 2021 17:31
To: Xu, Rosen <[email protected]>; Wang, Xiao W
<[email protected]>

Quoted 8 lines

Cc: [email protected]; Richardson, Bruce <[email protected]>; Hemant Agrawal <[email protected]>; Ajit Khaparde <[email protected]>; Griffin, John <[email protected]>; Trahe, Fiona <[email protected]>; Jain, Deepak K <[email protected]>; Raveendra Padasalagi <[email protected]>; Vikas Gupta <[email protected]>; John W. Linville <[email protected]>; Chas Williams <[email protected]>; Min Hu (Connor)

<[email protected]>;

Quoted 34 lines

Zhang, Tianfei <[email protected]>; Nipun Gupta <[email protected]>; [email protected]
Subject: Re: [PATCH v2 3/3] drivers: align log names

Hi Rosen,

You already gave your ack in previous version, no need to re-ack. Instead, please give your opinion and explanation as requested below. We want to replace pmd.afu.ipn3ke with pmd.net.ipn3ke.
The use of AFU in the driver is not clear.

Xiao, we need your opinion as well about ifcvf vs ifc name.

Quoted 16 lines
Quoted 16 lines

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc pmd.afu.ipn3ke instead of pmd.net.ipn3ke

[...]

Quoted 1 line
Acked-by on v2 3/3
#29 lore raw

Re: [dpdk-dev] [PATCH v2 3/3] drivers: align log names

In reply to Thomas Monjalon
Quoted 155 lines · Thomas Monjalon

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

Two drivers have exceptions to be clarified:
pmd.vdpa.ifcvf instead of pmd.vdpa.ifc pmd.afu.ipn3ke instead of pmd.net.ipn3ke

---
  doc/guides/cryptodevs/qat.rst             | 10 +++++-----
  drivers/common/qat/qat_logs.c             |  4 ++--
  drivers/crypto/bcmfs/bcmfs_logs.c         |  4 ++--
  drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
  drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
  drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
  drivers/raw/ioat/ioat_rawdev.c            |  2 +-
  drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
  drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
  9 files changed, 15 insertions(+), 15 deletions(-)
doc/guides/cryptodevs/qat.rst +5 -5
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
  There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
  pmd.qat exposes both sets of traces.
  They can be enabled using the log-level option (where 8=maximum log level) on
  the process cmdline, e.g. using any of the following::
 
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
      --log-level="pmd.qat,8"
 
  .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
      Also the dynamic global log level overrides both sets of trace, so e.g. no
      QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
drivers/common/qat/qat_logs.c +2 -2
index fa48be53c3..adbe163cd9 100644
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
  	return 0;
  }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
-RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +2 -2
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
  	return 0;
  }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
-RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index bfe5a0a451..a04f7c773a 100644
@@ -97,7 +97,7 @@ static struct rte_eth_link pmd_link = {
  	.link_autoneg = ETH_LINK_FIXED,
  };
 
-RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE);
+RTE_LOG_REGISTER(af_packet_logtype, pmd.net.af_packet, NOTICE);
 
  #define PMD_LOG(level, fmt, args...) \
  	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
drivers/net/bonding/rte_eth_bond_pmd.c +1 -1
index 24e3cf3c2e..2e9cea5b8e 100644
@@ -3775,4 +3775,4 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
  	"up_delay=<int> "
  	"down_delay=<int>");
 
-RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);
+RTE_LOG_REGISTER(bond_logtype, pmd.net.bonding, NOTICE);
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 05d79bfcc2..d9a46ef915 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd = {
  RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
  RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
  RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
  static const char * const valid_args[] = {
  #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
  #define IOAT_DEVICE_ID_BDXF	0x6f2F
  #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
  #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
  #define COMPLETION_SZ sizeof(__m128i)
drivers/raw/skeleton/skeleton_rawdev.c +1 -1
index aa3beaad18..8896f0c9c5 100644
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
  };
 
  RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -1
index 39237aecf7..7a06f97429 100644
@@ -26,7 +26,7 @@
 
  #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
  #define DRV_LOG(level, fmt, args...) \
  	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
  		"IFCVF %s(): " fmt "\n", __func__, ##args)
#30 lore raw

Re: [dpdk-dev] [PATCH v2 0/3] drivers: align log names

In reply to Thomas Monjalon

Sorry the name of the series should be "cleanup drivers log registration"

05/04/2021 12:02, Thomas Monjalon:

Quoted 12 lines

After working on the option "--log-level help", it became clear that few adjustments were required for the log registration of some drivers.

v2:
- align bonding and af_packet
- make explicit the RTE_LOGTYPE_EAL default

Thomas Monjalon (3):
log: choose EAL log type on registration failure
drivers: fix log level after loading
drivers: align log names

#31 lore raw

v3 cover cleanup drivers log registration

In reply to Thomas Monjalon

After working on the option "--log-level help", it became clear that few adjustments were required for the log registration of some drivers.

v3:
- rename pmd.afu.ipn3ke log type to pmd.net.ipn3ke
v2:
- align bonding and af_packet
- make explicit the RTE_LOGTYPE_EAL default

Thomas Monjalon (3):
log: choose EAL log type on registration failure
drivers: fix log level after loading
drivers: align log names

 doc/guides/cryptodevs/qat.rst             | 10 ++---
 drivers/common/mlx5/mlx5_common.c         |  9 +----
 drivers/common/qat/qat_logs.c             |  4 +-
 drivers/crypto/bcmfs/bcmfs_logs.c         | 17 +-------
 drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
 drivers/net/e1000/e1000_logs.c            | 49 +++--------------------
 drivers/net/e1000/em_ethdev.c             |  6 ---
 drivers/net/e1000/igb_ethdev.c            |  6 ---
 drivers/net/ipn3ke/ipn3ke_ethdev.c        |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
 drivers/raw/ioat/ioat_rawdev.c            |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
 lib/librte_eal/include/rte_log.h          |  2 +
 15 files changed, 24 insertions(+), 93 deletions(-)
Signature · 1 line
2.31.1
#32 lore raw

PATCH v3 1/3 log: choose EAL log type on registration failure

In the unlikely case where something goes wrong while registering a log type,
the fallback is to use the EAL log type.

---
 lib/librte_eal/include/rte_log.h | 2 ++
 1 file changed, 2 insertions(+)
lib/librte_eal/include/rte_log.h +2 -0
index 173004fd71..21a7d16340 100644
@@ -380,6 +380,8 @@ RTE_INIT(__##type)							\
 {									\
 	type = rte_log_register_type_and_pick_level(RTE_STR(name),	\
 						    RTE_LOG_##level);	\
+	if (type < 0)                                                   \
+		type = RTE_LOGTYPE_EAL;                                 \
 }
 
 #ifdef __cplusplus
Signature · 1 line
2.31.1
#34 lore raw

PATCH v3 2/3 drivers: fix log level after loading

In reply to Thomas Monjalon

When compiled as a shared object, and loaded at runtime as a plugin, the drivers should get the log level set earlier at EAL init by the user through --log-level option.

The function for applying the log level setting is rte_log_register_type_and_pick_level().
It is called by most drivers via RTE_LOG_REGISTER().

The drivers common/mlx5, bcmfs and e1000 were missing, so the user-specified log level was not applied when those drivers were loaded as plugins.
The macro RTE_LOG_REGISTER() is used for those drivers.

The unnecessary protection for double registration is removed from e1000.

Fixes 9c99878aa1b1 ("log: introduce logtype register macro")
Fixes c8e79da7c676 ("crypto/bcmfs: introduce BCMFS driver")
---
 drivers/common/mlx5/mlx5_common.c |  9 +-----
 drivers/crypto/bcmfs/bcmfs_logs.c | 17 ++---------
 drivers/net/e1000/e1000_logs.c    | 49 ++++---------------------------
 drivers/net/e1000/em_ethdev.c     |  6 ----
 drivers/net/e1000/igb_ethdev.c    |  6 ----
 5 files changed, 8 insertions(+), 79 deletions(-)
drivers/common/mlx5/mlx5_common.c +1 -8
index c26a2cfa30..f92f05bda5 100644
@@ -14,8 +14,6 @@
 #include "mlx5_common_utils.h"
 #include "mlx5_common_pci.h"
 
-int mlx5_common_logtype;
-
 uint8_t haswell_broadwell_cpu;
 
 /* In case this is an x86_64 intel processor to check if
@@ -41,12 +39,7 @@ static inline void mlx5_cpu_id(unsigned int level,
 }
 #endif
 
-RTE_INIT_PRIO(mlx5_log_init, LOG)
-{
-	mlx5_common_logtype = rte_log_register("pmd.common.mlx5");
-	if (mlx5_common_logtype >= 0)
-		rte_log_set_level(mlx5_common_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(mlx5_common_logtype, pmd.common.mlx5, NOTICE)
 
 static bool mlx5_common_initialized;
 
drivers/crypto/bcmfs/bcmfs_logs.c +2 -15
index 86f4ff3b53..701da9ecf3 100644
@@ -8,9 +8,6 @@
 
 #include "bcmfs_logs.h"
 
-int bcmfs_conf_logtype;
-int bcmfs_dp_logtype;
-
 int
 bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 		const void *buf, unsigned int len)
@@ -24,15 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_INIT(bcmfs_device_init_log)
-{
-	/* Configuration and general logs */
-	bcmfs_conf_logtype = rte_log_register("pmd.bcmfs_config");
-	if (bcmfs_conf_logtype >= 0)
-		rte_log_set_level(bcmfs_conf_logtype, RTE_LOG_NOTICE);
-
-	/* data-path logs */
-	bcmfs_dp_logtype = rte_log_register("pmd.bcmfs_fp");
-	if (bcmfs_dp_logtype >= 0)
-		rte_log_set_level(bcmfs_dp_logtype, RTE_LOG_NOTICE);
-}
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
drivers/net/e1000/e1000_logs.c +5 -44

58 lines not on this page · raw message

drivers/net/e1000/em_ethdev.c +0 -6
index 3c6f643c19..3e7ccdbf09 100644
@@ -1850,9 +1850,3 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev,
 RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(igb_init_log)
-{
-	e1000_igb_init_log();
-}
drivers/net/e1000/igb_ethdev.c +0 -6
index 17ee6e91a0..a1a72339ba 100644
@@ -5421,9 +5421,3 @@ RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb, "* igb_uio | uio_pci_generic | vfio-pci
 RTE_PMD_REGISTER_PCI(net_e1000_igb_vf, rte_igbvf_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(net_e1000_igb_vf, pci_id_igbvf_map);
 RTE_PMD_REGISTER_KMOD_DEP(net_e1000_igb_vf, "* igb_uio | vfio-pci");
-
-/* see e1000_logs.c */
-RTE_INIT(e1000_init_log)
-{
-	e1000_igb_init_log();
-}
Signature · 1 line
2.31.1
#35 lore raw

PATCH v3 3/3 drivers: align log names

In reply to Thomas Monjalon

The log levels are configured by using the name of the logs. Some drivers are aligned to follow a common log name standard:
pmd.class.driver[.sub]
Some "common" drivers skip the "class" part:
pmd.driver.sub

---
 doc/guides/cryptodevs/qat.rst             | 10 +++++-----
 drivers/common/qat/qat_logs.c             |  4 ++--
 drivers/crypto/bcmfs/bcmfs_logs.c         |  4 ++--
 drivers/net/af_packet/rte_eth_af_packet.c |  2 +-
 drivers/net/bonding/rte_eth_bond_pmd.c    |  2 +-
 drivers/net/ipn3ke/ipn3ke_ethdev.c        |  2 +-
 drivers/raw/ifpga/ifpga_rawdev.c          |  2 +-
 drivers/raw/ioat/ioat_rawdev.c            |  2 +-
 drivers/raw/skeleton/skeleton_rawdev.c    |  2 +-
 drivers/vdpa/ifc/ifcvf_vdpa.c             |  2 +-
 10 files changed, 16 insertions(+), 16 deletions(-)
doc/guides/cryptodevs/qat.rst +5 -5
index cf16f03503..224b22b3f7 100644
@@ -659,15 +659,15 @@ Debugging
 
 There are 2 sets of trace available via the dynamic logging feature:
 
-* pmd.qat_dp exposes trace on the data-path.
-* pmd.qat_general exposes all other trace.
+* pmd.qat.dp exposes trace on the data-path.
+* pmd.qat.general exposes all other trace.
 
 pmd.qat exposes both sets of traces.
 They can be enabled using the log-level option (where 8=maximum log level) on
 the process cmdline, e.g. using any of the following::
 
-    --log-level="pmd.qat_general,8"
-    --log-level="pmd.qat_dp,8"
+    --log-level="pmd.qat.general,8"
+    --log-level="pmd.qat.dp,8"
     --log-level="pmd.qat,8"
 
 .. Note::
@@ -678,4 +678,4 @@ the process cmdline, e.g. using any of the following::
     Also the dynamic global log level overrides both sets of trace, so e.g. no
     QAT trace would display in this case::
 
-	--log-level="7" --log-level="pmd.qat_general,8"
+	--log-level="7" --log-level="pmd.qat.general,8"
drivers/common/qat/qat_logs.c +2 -2
index fa48be53c3..adbe163cd9 100644
@@ -17,5 +17,5 @@ qat_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat_general, NOTICE);
-RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat_dp, NOTICE);
+RTE_LOG_REGISTER(qat_gen_logtype, pmd.qat.general, NOTICE);
+RTE_LOG_REGISTER(qat_dp_logtype, pmd.qat.dp, NOTICE);
drivers/crypto/bcmfs/bcmfs_logs.c +2 -2
index 701da9ecf3..9faf12f238 100644
@@ -21,5 +21,5 @@ bcmfs_hexdump_log(uint32_t level, uint32_t logtype, const char *title,
 	return 0;
 }
 
-RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.bcmfs_config, NOTICE)
-RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.bcmfs_fp, NOTICE)
+RTE_LOG_REGISTER(bcmfs_conf_logtype, pmd.crypto.bcmfs.config, NOTICE)
+RTE_LOG_REGISTER(bcmfs_dp_logtype, pmd.crypto.bcmfs.fp, NOTICE)
drivers/net/af_packet/rte_eth_af_packet.c +1 -1
index bfe5a0a451..a04f7c773a 100644
@@ -97,7 +97,7 @@ static struct rte_eth_link pmd_link = {
 	.link_autoneg = ETH_LINK_FIXED,
 };
 
-RTE_LOG_REGISTER(af_packet_logtype, pmd.net.packet, NOTICE);
+RTE_LOG_REGISTER(af_packet_logtype, pmd.net.af_packet, NOTICE);
 
 #define PMD_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, af_packet_logtype, \
drivers/net/bonding/rte_eth_bond_pmd.c +1 -1
index 24e3cf3c2e..2e9cea5b8e 100644
@@ -3775,4 +3775,4 @@ RTE_PMD_REGISTER_PARAM_STRING(net_bonding,
 	"up_delay=<int> "
 	"down_delay=<int>");
 
-RTE_LOG_REGISTER(bond_logtype, pmd.net.bond, NOTICE);
+RTE_LOG_REGISTER(bond_logtype, pmd.net.bonding, NOTICE);
drivers/net/ipn3ke/ipn3ke_ethdev.c +1 -1
index f8e751cb09..e83bd92bac 100644
@@ -583,4 +583,4 @@ static struct rte_afu_driver afu_ipn3ke_driver = {
 };
 
 RTE_PMD_REGISTER_AFU(net_ipn3ke_afu, afu_ipn3ke_driver);
-RTE_LOG_REGISTER(ipn3ke_afu_logtype, pmd.afu.ipn3ke, NOTICE);
+RTE_LOG_REGISTER(ipn3ke_afu_logtype, pmd.net.ipn3ke, NOTICE);
drivers/raw/ifpga/ifpga_rawdev.c +1 -1
index 05d79bfcc2..d9a46ef915 100644
@@ -1611,7 +1611,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd = {
 RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd);
 RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci");
-RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE);
+RTE_LOG_REGISTER(ifpga_rawdev_logtype, pmd.raw.ifpga, NOTICE);
 
 static const char * const valid_args[] = {
 #define IFPGA_ARG_NAME         "ifpga"
drivers/raw/ioat/ioat_rawdev.c +1 -1
index a95854d5ac..15af07017c 100644
@@ -28,7 +28,7 @@ static struct rte_pci_driver ioat_pmd_drv;
 #define IOAT_DEVICE_ID_BDXF	0x6f2F
 #define IOAT_DEVICE_ID_ICX	0x0b00
 
-RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO);
+RTE_LOG_REGISTER(ioat_pmd_logtype, pmd.raw.ioat, INFO);
 
 #define DESC_SZ sizeof(struct rte_ioat_generic_hw_desc)
 #define COMPLETION_SZ sizeof(__m128i)
drivers/raw/skeleton/skeleton_rawdev.c +1 -1
index aa3beaad18..8896f0c9c5 100644
@@ -768,4 +768,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = {
 };
 
 RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv);
-RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO);
+RTE_LOG_REGISTER(skeleton_pmd_logtype, pmd.raw.skeleton, INFO);
drivers/vdpa/ifc/ifcvf_vdpa.c +1 -1
index 39237aecf7..7a06f97429 100644
@@ -26,7 +26,7 @@
 
 #include "base/ifcvf.h"
 
-RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.net.ifcvf_vdpa, NOTICE);
+RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE);
 #define DRV_LOG(level, fmt, args...) \
 	rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \
 		"IFCVF %s(): " fmt "\n", __func__, ##args)
Signature · 1 line
2.31.1
#36 lore raw
In reply to Thomas Monjalon
Quoted 10 lines · Thomas Monjalon

After working on the option "--log-level help", it became clear that few adjustments were required for the log registration of some drivers.

v3:
- rename pmd.afu.ipn3ke log type to pmd.net.ipn3ke
v2:
- align bonding and af_packet
- make explicit the RTE_LOGTYPE_EAL default

Series applied, thanks.

Signature · 1 line
David Marchand