DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com,
	beilei.xing@intel.com, qi.z.zhang@intel.com,
	xiao.w.wang@intel.com, jingjing.wu@intel.com
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH 2/6] net/fm10k: use dynamic log type for tx/rx debug
Date: Tue, 16 Jul 2019 08:40:09 -0700	[thread overview]
Message-ID: <20190716154013.6974-3-stephen@networkplumber.org> (raw)
In-Reply-To: <20190716154013.6974-1-stephen@networkplumber.org>

The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/fm10k/fm10k_ethdev.c | 28 ++++++++++++++++++++++++++++
 drivers/net/fm10k/fm10k_logs.h   | 18 ++++++++++++------
 2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/drivers/net/fm10k/fm10k_ethdev.c b/drivers/net/fm10k/fm10k_ethdev.c
index a1e3836cb449..1f0a6286a57b 100644
--- a/drivers/net/fm10k/fm10k_ethdev.c
+++ b/drivers/net/fm10k/fm10k_ethdev.c
@@ -43,6 +43,16 @@
 int fm10k_logtype_init;
 int fm10k_logtype_driver;
 
+#ifdef RTE_LIBRTE_FM10K_DEBUG_RX
+int fm10k_logtype_rx;
+#endif
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX
+int fm10k_logtype_tx;
+#endif
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
+int fm10k_logtype_tx_free;
+#endif
+
 static void fm10k_close_mbx_service(struct fm10k_hw *hw);
 static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
 static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
@@ -3286,4 +3296,22 @@ RTE_INIT(fm10k_init_log)
 	fm10k_logtype_driver = rte_log_register("pmd.net.fm10k.driver");
 	if (fm10k_logtype_driver >= 0)
 		rte_log_set_level(fm10k_logtype_driver, RTE_LOG_NOTICE);
+
+#ifdef RTE_LIBRTE_FM10K_DEBUG_RX
+	fm10k_logtype_rx = rte_log_register("pmd.net.fm10k.rx");
+	if (fm10k_logtype_rx >= 0)
+		rte_log_set_level(fm10k_logtype_rx, RTE_LOG_NOTICE);
+#endif
+
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX
+	fm10k_logtype_tx = rte_log_register("pmd.net.fm10k.tx");
+	if (fm10k_logtype_tx >= 0)
+		rte_log_set_level(fm10k_logtype_tx, RTE_LOG_NOTICE);
+#endif
+
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
+	fm10k_logtype_tx_free = rte_log_register("pmd.net.fm10k.tx_free");
+	if (fm10k_logtype_tx_free >= 0)
+		rte_log_set_level(fm10k_logtype_tx_free, RTE_LOG_NOTICE);
+#endif
 }
diff --git a/drivers/net/fm10k/fm10k_logs.h b/drivers/net/fm10k/fm10k_logs.h
index df56a51cac48..9ae743d80678 100644
--- a/drivers/net/fm10k/fm10k_logs.h
+++ b/drivers/net/fm10k/fm10k_logs.h
@@ -15,22 +15,28 @@ extern int fm10k_logtype_init;
 #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
 
 #ifdef RTE_LIBRTE_FM10K_DEBUG_RX
-#define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int fm10k_logtype_rx;
+#define PMD_RX_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, fm10k_logtype_rx,	\
+		"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_FM10K_DEBUG_TX
-#define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int fm10k_logtype_tx;
+#define PMD_TX_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, fm10k_logtype_tx,	\
+		"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
-#define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int fm10k_logtype_tx_free;
+#define PMD_TX_FREE_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, fm10k_logtype_tx_free,	\
+		"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0)
 #endif
-- 
2.20.1


  parent reply	other threads:[~2019-07-16 15:40 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 15:40 [dpdk-dev] [PATCH 0/6] replace usage of LOGTYPE_PMD in Intel drivers Stephen Hemminger
2019-07-16 15:40 ` [dpdk-dev] [PATCH 1/6] net/e1000: use dynamic log type for tx/rx debug Stephen Hemminger
2019-08-27  8:21   ` Ferruh Yigit
2019-09-30 15:28     ` Ye Xiaolong
2019-09-30 15:50       ` Stephen Hemminger
2019-09-30 15:56         ` Ferruh Yigit
2019-09-30 16:10     ` Ferruh Yigit
2019-07-16 15:40 ` Stephen Hemminger [this message]
2019-07-16 15:40 ` [dpdk-dev] [PATCH 3/6] net/ixgbe: " Stephen Hemminger
2019-08-27  8:24   ` Ferruh Yigit
2019-07-16 15:40 ` [dpdk-dev] [PATCH 4/6] net/ice: " Stephen Hemminger
2019-07-16 15:40 ` [dpdk-dev] [PATCH 5/6] net/i40e: " Stephen Hemminger
2019-07-16 15:40 ` [dpdk-dev] [PATCH 6/6] net/iavf: " Stephen Hemminger

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=20190716154013.6974-3-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=beilei.xing@intel.com \
    --cc=dev@dpdk.org \
    --cc=jingjing.wu@intel.com \
    --cc=konstantin.ananyev@intel.com \
    --cc=qi.z.zhang@intel.com \
    --cc=wenzhuo.lu@intel.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).