diff mbox series

[3/3] drivers: align log names

Message ID 20210310140107.2730088-4-thomas@monjalon.net (mailing list archive)
State Superseded, archived
Delegated to: David Marchand
Headers show
Series cleanup drivers log registration | expand

Checks

Context Check Description
ci/intel-Testing success Testing PASS
ci/iol-testing success Testing PASS
ci/iol-mellanox-Functional success Functional Testing PASS
ci/iol-mellanox-Performance success Performance Testing PASS
ci/iol-abi-testing success Testing PASS
ci/iol-intel-Performance success Performance Testing PASS
ci/iol-intel-Functional success Functional Testing PASS
ci/github-robot success github build: passed
ci/travis-robot success travis build: passed
ci/Intel-compilation success Compilation OK
ci/checkpatch success coding style OK

Commit Message

Thomas Monjalon March 10, 2021, 2:01 p.m. UTC
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

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 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(-)

Comments

Bruce Richardson March 10, 2021, 2:36 p.m. UTC | #1
On Wed, Mar 10, 2021 at 03:01:07PM +0100, Thomas Monjalon wrote:
> 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
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
Acked-by: Bruce Richardson <bruce.richardson@intel.com>
Xu, Rosen March 11, 2021, 2:54 a.m. UTC | #2
Hi,

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, March 10, 2021 22:01
> To: dev@dpdk.org
> Cc: Griffin, John <john.griffin@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>; Jain, Deepak K <deepak.k.jain@intel.com>; Ajit
> Khaparde <ajit.khaparde@broadcom.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta
> <vikas.gupta@broadcom.com>; Xu, Rosen <rosen.xu@intel.com>; Zhang,
> Tianfei <tianfei.zhang@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>;
> Hemant Agrawal <hemant.agrawal@nxp.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>
> 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
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  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(-)
> 
> diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
> index cf16f03503..224b22b3f7 100644
> --- a/doc/guides/cryptodevs/qat.rst
> +++ b/doc/guides/cryptodevs/qat.rst
> @@ -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"
> diff --git a/drivers/common/qat/qat_logs.c
> b/drivers/common/qat/qat_logs.c index fa48be53c3..adbe163cd9 100644
> --- a/drivers/common/qat/qat_logs.c
> +++ b/drivers/common/qat/qat_logs.c
> @@ -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);
> diff --git a/drivers/crypto/bcmfs/bcmfs_logs.c
> b/drivers/crypto/bcmfs/bcmfs_logs.c
> index 701da9ecf3..9faf12f238 100644
> --- a/drivers/crypto/bcmfs/bcmfs_logs.c
> +++ b/drivers/crypto/bcmfs/bcmfs_logs.c
> @@ -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)
> diff --git a/drivers/raw/ifpga/ifpga_rawdev.c
> b/drivers/raw/ifpga/ifpga_rawdev.c
> index 27129b133e..56b1866f77 100644
> --- a/drivers/raw/ifpga/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga/ifpga_rawdev.c
> @@ -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"
> diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
> index a95854d5ac..15af07017c 100644
> --- a/drivers/raw/ioat/ioat_rawdev.c
> +++ b/drivers/raw/ioat/ioat_rawdev.c
> @@ -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
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -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);
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 6a1b44bc77..bf7afe4610 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -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

Acked-by: Rosen Xu <rosen.xu@intel.com>
Wang, Xiao W March 11, 2021, 3:02 a.m. UTC | #3
Hi,

BRs,
Xiao

> -----Original Message-----
> From: Thomas Monjalon <thomas@monjalon.net>
> Sent: Wednesday, March 10, 2021 10:01 PM
> To: dev@dpdk.org
> Cc: Griffin, John <john.griffin@intel.com>; Trahe, Fiona
> <fiona.trahe@intel.com>; Jain, Deepak K <deepak.k.jain@intel.com>; Ajit
> Khaparde <ajit.khaparde@broadcom.com>; Raveendra Padasalagi
> <raveendra.padasalagi@broadcom.com>; Vikas Gupta
> <vikas.gupta@broadcom.com>; Xu, Rosen <rosen.xu@intel.com>; Zhang,
> Tianfei <tianfei.zhang@intel.com>; Richardson, Bruce
> <bruce.richardson@intel.com>; Nipun Gupta <nipun.gupta@nxp.com>;
> Hemant Agrawal <hemant.agrawal@nxp.com>; Wang, Xiao W
> <xiao.w.wang@intel.com>
> 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
> 
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  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(-)
> 
> diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
> index cf16f03503..224b22b3f7 100644
> --- a/doc/guides/cryptodevs/qat.rst
> +++ b/doc/guides/cryptodevs/qat.rst
> @@ -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.
> 

[...]

> b/drivers/raw/skeleton/skeleton_rawdev.c
> index aa3beaad18..8896f0c9c5 100644
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -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);
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 6a1b44bc77..bf7afe4610 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -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

For vdpa/ifc part:
Acked-by: Xiao Wang <xiao.w.wang@intel.com>
Hemant Agrawal March 12, 2021, 7:39 a.m. UTC | #4
Acked-by: Hemant Agrawal <hemant.agrawal@nxp.com>
David Marchand March 19, 2021, 4:29 p.m. UTC | #5
On Wed, Mar 10, 2021 at 3:02 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 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:

diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh
index 78a408ef98..dc52569792 100755
--- a/devtools/checkpatches.sh
+++ b/devtools/checkpatches.sh
@@ -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:

diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c
index 761a0f26bb..ef6e3b2d0c 100644
--- a/drivers/net/ixgbe/ixgbe_ethdev.c
+++ b/drivers/net/ixgbe/ixgbe_ethdev.c
@@ -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
diff --git a/lib/librte_compressdev/rte_compressdev.c
b/lib/librte_compressdev/rte_compressdev.c
index 49a342f400..d444685053 100644
--- a/lib/librte_compressdev/rte_compressdev.c
+++ b/lib/librte_compressdev/rte_compressdev.c
@@ -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?
Ajit Khaparde March 19, 2021, 4:53 p.m. UTC | #6
On Wed, Mar 10, 2021 at 6:01 AM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 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
>
> Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
> ---
>  doc/guides/cryptodevs/qat.rst          | 10 +++++-----
>  drivers/common/qat/qat_logs.c          |  4 ++--
>  drivers/crypto/bcmfs/bcmfs_logs.c      |  4 ++--
For bcmfs,
Acked-by: Ajit Khaparde <ajit.khaparde@broadcom.com>

>  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(-)
>
> diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
> index cf16f03503..224b22b3f7 100644
> --- a/doc/guides/cryptodevs/qat.rst
> +++ b/doc/guides/cryptodevs/qat.rst
> @@ -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"
> diff --git a/drivers/common/qat/qat_logs.c b/drivers/common/qat/qat_logs.c
> index fa48be53c3..adbe163cd9 100644
> --- a/drivers/common/qat/qat_logs.c
> +++ b/drivers/common/qat/qat_logs.c
> @@ -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);
> diff --git a/drivers/crypto/bcmfs/bcmfs_logs.c b/drivers/crypto/bcmfs/bcmfs_logs.c
> index 701da9ecf3..9faf12f238 100644
> --- a/drivers/crypto/bcmfs/bcmfs_logs.c
> +++ b/drivers/crypto/bcmfs/bcmfs_logs.c
> @@ -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)
> diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
> index 27129b133e..56b1866f77 100644
> --- a/drivers/raw/ifpga/ifpga_rawdev.c
> +++ b/drivers/raw/ifpga/ifpga_rawdev.c
> @@ -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"
> diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
> index a95854d5ac..15af07017c 100644
> --- a/drivers/raw/ioat/ioat_rawdev.c
> +++ b/drivers/raw/ioat/ioat_rawdev.c
> @@ -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
> --- a/drivers/raw/skeleton/skeleton_rawdev.c
> +++ b/drivers/raw/skeleton/skeleton_rawdev.c
> @@ -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);
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 6a1b44bc77..bf7afe4610 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -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
>
Thomas Monjalon March 19, 2021, 5:14 p.m. UTC | #7
19/03/2021 17:29, David Marchand:
> On Wed, Mar 10, 2021 at 3:02 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> >
> > 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:
[...]
> +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?
David Marchand March 19, 2021, 8:38 p.m. UTC | #8
On Fri, Mar 19, 2021 at 6:15 PM Thomas Monjalon <thomas@monjalon.net> wrote:
>
> 19/03/2021 17:29, David Marchand:
> > On Wed, Mar 10, 2021 at 3:02 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> > >
> > > 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:
> [...]
> > +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?

http://inbox.dpdk.org/dev/20210319203737.13526-1-david.marchand@redhat.com/T/#u
David Marchand March 22, 2021, 10:33 a.m. UTC | #9
On Wed, Mar 10, 2021 at 3:02 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> index 6a1b44bc77..bf7afe4610 100644
> --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> @@ -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);
Thomas Monjalon April 5, 2021, 9:52 a.m. UTC | #10
22/03/2021 11:33, David Marchand:
> On Wed, Mar 10, 2021 at 3:02 PM Thomas Monjalon <thomas@monjalon.net> wrote:
> > diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > index 6a1b44bc77..bf7afe4610 100644
> > --- a/drivers/vdpa/ifc/ifcvf_vdpa.c
> > +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
> > @@ -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

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.

> 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.

> 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.
diff mbox series

Patch

diff --git a/doc/guides/cryptodevs/qat.rst b/doc/guides/cryptodevs/qat.rst
index cf16f03503..224b22b3f7 100644
--- a/doc/guides/cryptodevs/qat.rst
+++ b/doc/guides/cryptodevs/qat.rst
@@ -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"
diff --git a/drivers/common/qat/qat_logs.c b/drivers/common/qat/qat_logs.c
index fa48be53c3..adbe163cd9 100644
--- a/drivers/common/qat/qat_logs.c
+++ b/drivers/common/qat/qat_logs.c
@@ -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);
diff --git a/drivers/crypto/bcmfs/bcmfs_logs.c b/drivers/crypto/bcmfs/bcmfs_logs.c
index 701da9ecf3..9faf12f238 100644
--- a/drivers/crypto/bcmfs/bcmfs_logs.c
+++ b/drivers/crypto/bcmfs/bcmfs_logs.c
@@ -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)
diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c
index 27129b133e..56b1866f77 100644
--- a/drivers/raw/ifpga/ifpga_rawdev.c
+++ b/drivers/raw/ifpga/ifpga_rawdev.c
@@ -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"
diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c
index a95854d5ac..15af07017c 100644
--- a/drivers/raw/ioat/ioat_rawdev.c
+++ b/drivers/raw/ioat/ioat_rawdev.c
@@ -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
--- a/drivers/raw/skeleton/skeleton_rawdev.c
+++ b/drivers/raw/skeleton/skeleton_rawdev.c
@@ -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);
diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c
index 6a1b44bc77..bf7afe4610 100644
--- a/drivers/vdpa/ifc/ifcvf_vdpa.c
+++ b/drivers/vdpa/ifc/ifcvf_vdpa.c
@@ -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)