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 6/6] net/iavf: use dynamic log type for tx/rx debug
Date: Tue, 16 Jul 2019 08:40:13 -0700	[thread overview]
Message-ID: <20190716154013.6974-7-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/iavf/iavf_ethdev.c | 28 ++++++++++++++++++++++++++++
 drivers/net/iavf/iavf_log.h    | 19 +++++++++++++------
 2 files changed, 41 insertions(+), 6 deletions(-)

diff --git a/drivers/net/iavf/iavf_ethdev.c b/drivers/net/iavf/iavf_ethdev.c
index 53dc05c78d1c..d019e6ad57cb 100644
--- a/drivers/net/iavf/iavf_ethdev.c
+++ b/drivers/net/iavf/iavf_ethdev.c
@@ -76,6 +76,16 @@ static int iavf_dev_rx_queue_intr_disable(struct rte_eth_dev *dev,
 int iavf_logtype_init;
 int iavf_logtype_driver;
 
+#ifdef RTE_LIBRTE_IAVF_DEBUG_RX
+int iavf_logtype_rx;
+#endif
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX
+int iavf_logtype_tx;
+#endif
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
+int iavf_logtype_tx_free;
+#endif
+
 static const struct rte_pci_id pci_id_iavf_map[] = {
 	{ RTE_PCI_DEVICE(IAVF_INTEL_VENDOR_ID, IAVF_DEV_ID_ADAPTIVE_VF) },
 	{ .vendor_id = 0, /* sentinel */ },
@@ -1419,6 +1429,24 @@ RTE_INIT(iavf_init_log)
 	iavf_logtype_driver = rte_log_register("pmd.net.iavf.driver");
 	if (iavf_logtype_driver >= 0)
 		rte_log_set_level(iavf_logtype_driver, RTE_LOG_NOTICE);
+
+#ifdef RTE_LIBRTE_IAVF_DEBUG_RX
+	iavf_logtype_rx = rte_log_register("pmd.net.iavf.rx");
+	if (iavf_logtype_rx >= 0)
+		rte_log_set_level(iavf_logtype_rx, RTE_LOG_NOTICE);
+#endif
+
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX
+	iavf_logtype_tx = rte_log_register("pmd.net.iavf.tx");
+	if (iavf_logtype_tx >= 0)
+		rte_log_set_level(iavf_logtype_tx, RTE_LOG_NOTICE);
+#endif
+
+#ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
+	iavf_logtype_tx_free = rte_log_register("pmd.net.iavf.tx_free");
+	if (iavf_logtype_tx_free >= 0)
+		rte_log_set_level(iavf_logtype_tx_free, RTE_LOG_NOTICE);
+#endif
 }
 
 /* memory func for base code */
diff --git a/drivers/net/iavf/iavf_log.h b/drivers/net/iavf/iavf_log.h
index f66c37041439..1088ec75f55b 100644
--- a/drivers/net/iavf/iavf_log.h
+++ b/drivers/net/iavf/iavf_log.h
@@ -20,23 +20,30 @@ extern int iavf_logtype_driver;
 	PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
 #define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, " >>")
 
+
 #ifdef RTE_LIBRTE_IAVF_DEBUG_RX
-#define PMD_RX_LOG(level, fmt, args...) \
-	RTE_LOG_DP(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int iavf_logtype_rx;
+#define PMD_RX_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, iavf_logtype_rx,	\
+		"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_IAVF_DEBUG_TX
-#define PMD_TX_LOG(level, fmt, args...) \
-	RTE_LOG_DP(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int iavf_logtype_tx;
+#define PMD_TX_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, iavf_logtype_tx,	\
+		"%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_IAVF_DEBUG_TX_FREE
-#define PMD_TX_FREE_LOG(level, fmt, args...) \
-	RTE_LOG_DP(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int iavf_logtype_tx_free;
+#define PMD_TX_FREE_LOG(level, fmt, args...)			\
+	rte_log(RTE_LOG_ ## level, iavf_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:41 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 ` [dpdk-dev] [PATCH 2/6] net/fm10k: " Stephen Hemminger
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 ` Stephen Hemminger [this message]

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