From: Olivier Matz <olivier.matz@6wind.com>
To: dev@dpdk.org, david.marchand@6wind.com
Subject: [dpdk-dev] [RFC 8/8] net/i40e: use dynamic log type for control logs
Date: Mon, 6 Feb 2017 14:29:16 +0100 [thread overview]
Message-ID: <1486387756-16865-9-git-send-email-olivier.matz@6wind.com> (raw)
In-Reply-To: <1486387756-16865-1-git-send-email-olivier.matz@6wind.com>
This is an example of how a dynamic log type can be used in a
PMD.
Signed-off-by: Olivier Matz <olivier.matz@6wind.com>
---
drivers/net/i40e/i40e_ethdev.c | 18 ++++++++++++++++--
drivers/net/i40e/i40e_fdir.c | 4 ----
drivers/net/i40e/i40e_logs.h | 17 ++++++-----------
3 files changed, 22 insertions(+), 17 deletions(-)
diff --git a/drivers/net/i40e/i40e_ethdev.c b/drivers/net/i40e/i40e_ethdev.c
index 4492bcc..0beb37f 100644
--- a/drivers/net/i40e/i40e_ethdev.c
+++ b/drivers/net/i40e/i40e_ethdev.c
@@ -40,6 +40,7 @@
#include <inttypes.h>
#include <assert.h>
+#include <rte_eal.h>
#include <rte_string_fns.h>
#include <rte_pci.h>
#include <rte_ether.h>
@@ -419,6 +420,9 @@ static void i40e_ethertype_filter_restore(struct i40e_pf *pf);
static void i40e_tunnel_filter_restore(struct i40e_pf *pf);
static void i40e_filter_restore(struct i40e_pf *pf);
+int i40e_logtype_init;
+int i40e_logtype_driver;
+
static const struct rte_pci_id pci_id_i40e_map[] = {
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_SFP_XL710) },
{ RTE_PCI_DEVICE(I40E_INTEL_VENDOR_ID, I40E_DEV_ID_QEMU) },
@@ -5788,7 +5792,6 @@ i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
PMD_DRV_LOG(INFO, "No interrupt event");
goto done;
}
-#ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER
if (icr0 & I40E_PFINT_ICR0_ECC_ERR_MASK)
PMD_DRV_LOG(ERR, "ICR0: unrecoverable ECC error");
if (icr0 & I40E_PFINT_ICR0_MAL_DETECT_MASK)
@@ -5803,7 +5806,6 @@ i40e_dev_interrupt_handler(struct rte_intr_handle *intr_handle,
PMD_DRV_LOG(ERR, "ICR0: HMC error");
if (icr0 & I40E_PFINT_ICR0_PE_CRITERR_MASK)
PMD_DRV_LOG(ERR, "ICR0: protocol engine critical error");
-#endif /* RTE_LIBRTE_I40E_DEBUG_DRIVER */
if (icr0 & I40E_PFINT_ICR0_VFLR_MASK) {
PMD_DRV_LOG(INFO, "ICR0: VF reset detected");
@@ -11187,3 +11189,15 @@ rte_pmd_i40e_reset_vf_stats(uint8_t port,
return 0;
}
+
+RTE_INIT(i40e_init_log);
+static void
+i40e_init_log(void)
+{
+ i40e_logtype_init = rte_log_register("pmd.i40e.init");
+ if (i40e_logtype_init >= 0)
+ rte_log_set_level(i40e_logtype_init, RTE_LOG_NOTICE);
+ i40e_logtype_driver = rte_log_register("pmd.i40e.driver");
+ if (i40e_logtype_driver >= 0)
+ rte_log_set_level(i40e_logtype_driver, RTE_LOG_NOTICE);
+}
diff --git a/drivers/net/i40e/i40e_fdir.c b/drivers/net/i40e/i40e_fdir.c
index 0700253..32d3b19 100644
--- a/drivers/net/i40e/i40e_fdir.c
+++ b/drivers/net/i40e/i40e_fdir.c
@@ -1592,17 +1592,14 @@ i40e_fdir_filter_restore(struct i40e_pf *pf)
struct rte_eth_dev *dev = I40E_VSI_TO_ETH_DEV(pf->main_vsi);
struct i40e_fdir_filter_list *fdir_list = &pf->fdir.fdir_list;
struct i40e_fdir_filter *f;
-#ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER
struct i40e_hw *hw = I40E_PF_TO_HW(pf);
uint32_t fdstat;
uint32_t guarant_cnt; /**< Number of filters in guaranteed spaces. */
uint32_t best_cnt; /**< Number of filters in best effort spaces. */
-#endif /* RTE_LIBRTE_I40E_DEBUG_DRIVER */
TAILQ_FOREACH(f, fdir_list, rules)
i40e_add_del_fdir_filter(dev, &f->fdir, TRUE);
-#ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER
fdstat = I40E_READ_REG(hw, I40E_PFQF_FDSTAT);
guarant_cnt =
(uint32_t)((fdstat & I40E_PFQF_FDSTAT_GUARANT_CNT_MASK) >>
@@ -1610,7 +1607,6 @@ i40e_fdir_filter_restore(struct i40e_pf *pf)
best_cnt =
(uint32_t)((fdstat & I40E_PFQF_FDSTAT_BEST_CNT_MASK) >>
I40E_PFQF_FDSTAT_BEST_CNT_SHIFT);
-#endif /* RTE_LIBRTE_I40E_DEBUG_DRIVER */
PMD_DRV_LOG(INFO, "FDIR: Guarant count: %d, Best count: %d",
guarant_cnt, best_cnt);
diff --git a/drivers/net/i40e/i40e_logs.h b/drivers/net/i40e/i40e_logs.h
index e042e24..8e99cd5 100644
--- a/drivers/net/i40e/i40e_logs.h
+++ b/drivers/net/i40e/i40e_logs.h
@@ -34,14 +34,11 @@
#ifndef _I40E_LOGS_H_
#define _I40E_LOGS_H_
+extern int i40e_logtype_init;
#define PMD_INIT_LOG(level, fmt, args...) \
- RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ##args)
-
-#ifdef RTE_LIBRTE_I40E_DEBUG_INIT
+ rte_log(RTE_LOG_ ## level, i40e_logtype_init, "%s(): " fmt "\n", \
+ __func__, ##args)
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
-#else
-#define PMD_INIT_FUNC_TRACE() do { } while(0)
-#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_RX
#define PMD_RX_LOG(level, fmt, args...) \
@@ -64,12 +61,10 @@
#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
#endif
-#ifdef RTE_LIBRTE_I40E_DEBUG_DRIVER
+extern int i40e_logtype_driver;
#define PMD_DRV_LOG_RAW(level, fmt, args...) \
- RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
-#else
-#define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0)
-#endif
+ rte_log(RTE_LOG_ ## level, i40e_logtype_driver, "%s(): " fmt, \
+ __func__, ## args)
#define PMD_DRV_LOG(level, fmt, args...) \
PMD_DRV_LOG_RAW(level, fmt "\n", ## args)
--
2.8.1
next prev parent reply other threads:[~2017-02-06 13:29 UTC|newest]
Thread overview: 66+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-06 13:29 [dpdk-dev] [RFC 0/8] eal: dynamic logs Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 1/8] eal: support dynamic log types Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 2/8] eal: dump registered " Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 3/8] eal: change several log levels matching a regexp Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 4/8] eal: change specific log levels at startup Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 5/8] eal: deprecate log functions Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 6/8] app/test: new command to dump log types Olivier Matz
2017-02-06 13:29 ` [dpdk-dev] [RFC 7/8] app/testpmd: " Olivier Matz
2017-02-06 13:29 ` Olivier Matz [this message]
2017-02-06 13:49 ` [dpdk-dev] [RFC 0/8] eal: dynamic logs Bruce Richardson
2017-02-06 14:10 ` Olivier Matz
2017-02-06 15:01 ` Wiles, Keith
2017-02-06 15:27 ` Olivier Matz
2017-02-06 15:55 ` Wiles, Keith
2017-02-06 16:18 ` Olivier Matz
2017-02-06 17:57 ` Wiles, Keith
2017-03-15 16:35 ` Thomas Monjalon
2017-03-17 15:32 ` Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH " Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 1/8] eal: support dynamic log types Olivier Matz
2017-03-17 16:13 ` Stephen Hemminger
2017-03-17 16:14 ` Stephen Hemminger
2017-03-17 16:15 ` Stephen Hemminger
2017-03-17 16:40 ` Olivier Matz
2017-03-17 16:17 ` Stephen Hemminger
2017-03-17 15:51 ` [dpdk-dev] [PATCH 2/8] eal: dump registered " Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 3/8] eal: change several log levels matching a regexp Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 4/8] eal: change specific log levels at startup Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 5/8] eal: deprecate log functions Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 6/8] app/test: new command to dump log types Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 7/8] app/testpmd: " Olivier Matz
2017-03-17 15:51 ` [dpdk-dev] [PATCH 8/8] net/i40e: use dynamic log type for control logs Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 0/8] eal: dynamic logs Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 1/8] eal: support dynamic log types Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 2/8] eal: dump registered " Olivier Matz
2017-04-04 9:01 ` Thomas Monjalon
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 3/8] eal: change several log levels matching a regexp Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 4/8] eal: change specific log levels at startup Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 5/8] eal: deprecate log functions Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 6/8] app/test: new command to dump log types Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 7/8] app/testpmd: " Olivier Matz
2017-03-29 15:53 ` [dpdk-dev] [PATCH v2 8/8] net/i40e: use dynamic log type for control logs Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 0/8] eal: dynamic logs Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 1/8] eal: support dynamic log types Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 2/8] eal: dump registered " Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 3/8] eal: change several log levels matching a regexp Olivier Matz
2017-04-14 5:40 ` Tan, Jianfeng
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 4/8] eal: change specific log levels at startup Olivier Matz
2017-04-14 5:33 ` Tan, Jianfeng
2017-04-18 8:50 ` Olivier MATZ
2017-04-18 11:15 ` Tan, Jianfeng
2017-04-18 11:56 ` Olivier MATZ
2017-04-14 15:32 ` Ferruh Yigit
2017-04-18 8:02 ` Olivier MATZ
2017-04-14 15:40 ` Ferruh Yigit
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 5/8] eal: deprecate log functions Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 6/8] app/test: new command to dump log types Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 7/8] app/testpmd: " Olivier Matz
2017-04-04 16:40 ` [dpdk-dev] [PATCH v3 8/8] net/i40e: use dynamic log type for control logs Olivier Matz
2017-04-05 11:50 ` [dpdk-dev] [PATCH v3 0/8] eal: dynamic logs Thomas Monjalon
2017-04-12 9:26 ` De Lara Guarch, Pablo
2017-04-12 10:37 ` Thomas Monjalon
2017-04-12 13:11 ` De Lara Guarch, Pablo
2017-04-12 13:29 ` Thomas Monjalon
2017-04-12 13:47 ` De Lara Guarch, Pablo
2017-04-12 14:06 ` Thomas Monjalon
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=1486387756-16865-9-git-send-email-olivier.matz@6wind.com \
--to=olivier.matz@6wind.com \
--cc=david.marchand@6wind.com \
--cc=dev@dpdk.org \
/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).