DPDK patches and discussions
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: rahul.lakkireddy@chelsio.com
Cc: dev@dpdk.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [dpdk-dev] [PATCH] net/cxgbe: implement dynamic log type
Date: Tue, 16 Jul 2019 11:53:31 -0700	[thread overview]
Message-ID: <20190716185331.20374-1-stephen@networkplumber.org> (raw)

The generic RTE_LOGTYPE_PMD is a historical relic and should
be deprecated. Every driver must register its own logtype.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 drivers/net/cxgbe/cxgbe_compat.h | 7 +++++--
 drivers/net/cxgbe/cxgbe_ethdev.c | 9 +++++++++
 2 files changed, 14 insertions(+), 2 deletions(-)

diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h
index cce51c2f975b..93df0a7754a5 100644
--- a/drivers/net/cxgbe/cxgbe_compat.h
+++ b/drivers/net/cxgbe/cxgbe_compat.h
@@ -20,8 +20,11 @@
 #include <rte_io.h>
 #include <rte_net.h>
 
+extern int cxgbe_logtype;
+
 #define dev_printf(level, fmt, ...) \
-	RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__)
+	rte_log(RTE_LOG_ ## level, cxgbe_logtype, \
+		"rte_cxgbe_pmd: " fmt, ##__VA_ARGS__)
 
 #define dev_err(x, fmt, ...) dev_printf(ERR, fmt, ##__VA_ARGS__)
 #define dev_info(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__)
@@ -63,7 +66,7 @@
 
 #ifdef RTE_LIBRTE_CXGBE_DEBUG
 #define CXGBE_FUNC_TRACE() \
-	RTE_LOG(DEBUG, PMD, "CXGBE trace: %s\n", __func__)
+	dev_printf(DEBUG, "CXGBE trace: %s\n", __func__)
 #else
 #define CXGBE_FUNC_TRACE() do { } while (0)
 #endif
diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c
index 3a373ec1daa0..efb458d4707c 100644
--- a/drivers/net/cxgbe/cxgbe_ethdev.c
+++ b/drivers/net/cxgbe/cxgbe_ethdev.c
@@ -38,6 +38,8 @@
 #include "cxgbe_pfvf.h"
 #include "cxgbe_flow.h"
 
+int cxgbe_logtype;
+
 /*
  * Macros needed to support the PCI Device ID Table ...
  */
@@ -1218,3 +1220,10 @@ RTE_PMD_REGISTER_KMOD_DEP(net_cxgbe, "* igb_uio | uio_pci_generic | vfio-pci");
 RTE_PMD_REGISTER_PARAM_STRING(net_cxgbe,
 			      CXGBE_DEVARG_KEEP_OVLAN "=<0|1> "
 			      CXGBE_DEVARG_FORCE_LINK_UP "=<0|1> ");
+
+RTE_INIT(cxgbe_init_log)
+{
+	cxgbe_logtype = rte_log_register("pmd.net.cxgbe");
+	if (cxgbe_logtype >= 0)
+		rte_log_set_level(cxgbe_logtype, RTE_LOG_NOTICE);
+}
-- 
2.20.1


             reply	other threads:[~2019-07-16 18:54 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-16 18:53 Stephen Hemminger [this message]
2019-08-27  8:28 ` Ferruh Yigit

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=20190716185331.20374-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=dev@dpdk.org \
    --cc=rahul.lakkireddy@chelsio.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).