From: David Marchand <david.marchand@redhat.com>
To: Thomas Monjalon <thomas@monjalon.net>
Cc: dev <dev@dpdk.org>, John Griffin <john.griffin@intel.com>,
Fiona Trahe <fiona.trahe@intel.com>,
Deepak Kumar Jain <deepak.k.jain@intel.com>,
Ajit Khaparde <ajit.khaparde@broadcom.com>,
Raveendra Padasalagi <raveendra.padasalagi@broadcom.com>,
Vikas Gupta <vikas.gupta@broadcom.com>,
Rosen Xu <rosen.xu@intel.com>,
Tianfei zhang <tianfei.zhang@intel.com>,
Bruce Richardson <bruce.richardson@intel.com>,
Nipun Gupta <nipun.gupta@nxp.com>,
Hemant Agrawal <hemant.agrawal@nxp.com>,
Xiao Wang <xiao.w.wang@intel.com>
Subject: Re: [dpdk-dev] [PATCH 3/3] drivers: align log names
Date: Fri, 19 Mar 2021 17:29:25 +0100 [thread overview]
Message-ID: <CAJFAV8xYS56DMLy3XGNXob-Pv1OxAj90xj_8_Y31yo00b023mg@mail.gmail.com> (raw)
In-Reply-To: <20210310140107.2730088-4-thomas@monjalon.net>
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?
--
David Marchand
next prev parent reply other threads:[~2021-03-19 16:29 UTC|newest]
Thread overview: 37+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-03-10 14:01 [dpdk-dev] [PATCH 0/3] cleanup drivers log registration Thomas Monjalon
2021-03-10 14:01 ` [dpdk-dev] [PATCH 1/3] log: choose EAL log type on registration failure Thomas Monjalon
2021-03-23 18:22 ` David Marchand
2021-03-23 18:43 ` Thomas Monjalon
2021-03-10 14:01 ` [dpdk-dev] [PATCH 2/3] drivers: fix log level after loading Thomas Monjalon
2021-03-23 18:25 ` [dpdk-dev] [dpdk-stable] " David Marchand
2021-03-23 18:50 ` [dpdk-dev] " Ajit Khaparde
2021-03-10 14:01 ` [dpdk-dev] [PATCH 3/3] drivers: align log names Thomas Monjalon
2021-03-10 14:36 ` Bruce Richardson
2021-03-11 2:54 ` Xu, Rosen
2021-03-11 3:02 ` Wang, Xiao W
2021-03-12 7:39 ` Hemant Agrawal
2021-03-19 16:29 ` David Marchand [this message]
2021-03-19 17:14 ` Thomas Monjalon
2021-03-19 20:38 ` David Marchand
2021-03-19 16:53 ` Ajit Khaparde
2021-03-22 10:33 ` David Marchand
2021-04-05 9:52 ` Thomas Monjalon
2021-04-05 10:02 ` [dpdk-dev] [PATCH v2 0/3] " Thomas Monjalon
2021-04-05 10:02 ` [dpdk-dev] [PATCH v2 1/3] log: choose EAL log type on registration failure Thomas Monjalon
2021-04-06 9:17 ` David Marchand
2021-04-06 9:49 ` Thomas Monjalon
2021-04-05 10:03 ` [dpdk-dev] [PATCH v2 2/3] drivers: fix log level after loading Thomas Monjalon
2021-04-05 10:03 ` [dpdk-dev] [PATCH v2 3/3] drivers: align log names Thomas Monjalon
2021-04-06 1:19 ` Wang, Xiao W
2021-04-06 5:27 ` Xu, Rosen
2021-04-06 9:31 ` Thomas Monjalon
2021-04-06 9:48 ` Xu, Rosen
2021-04-07 0:49 ` Wang, Xiao W
2021-04-06 6:02 ` Min Hu (Connor)
2021-04-05 10:05 ` [dpdk-dev] [PATCH v2 0/3] " Thomas Monjalon
2021-04-06 13:22 ` [dpdk-dev] [PATCH v3 0/3] cleanup drivers log registration Thomas Monjalon
2021-04-06 13:22 ` [dpdk-dev] [PATCH v3 1/3] log: choose EAL log type on registration failure Thomas Monjalon
2021-04-07 8:17 ` Andrew Rybchenko
2021-04-06 13:22 ` [dpdk-dev] [PATCH v3 2/3] drivers: fix log level after loading Thomas Monjalon
2021-04-06 13:22 ` [dpdk-dev] [PATCH v3 3/3] drivers: align log names Thomas Monjalon
2021-04-08 16:43 ` [dpdk-dev] [PATCH v3 0/3] cleanup drivers log registration David Marchand
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAJFAV8xYS56DMLy3XGNXob-Pv1OxAj90xj_8_Y31yo00b023mg@mail.gmail.com \
--to=david.marchand@redhat.com \
--cc=ajit.khaparde@broadcom.com \
--cc=bruce.richardson@intel.com \
--cc=deepak.k.jain@intel.com \
--cc=dev@dpdk.org \
--cc=fiona.trahe@intel.com \
--cc=hemant.agrawal@nxp.com \
--cc=john.griffin@intel.com \
--cc=nipun.gupta@nxp.com \
--cc=raveendra.padasalagi@broadcom.com \
--cc=rosen.xu@intel.com \
--cc=thomas@monjalon.net \
--cc=tianfei.zhang@intel.com \
--cc=vikas.gupta@broadcom.com \
--cc=xiao.w.wang@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).