From 23198c17afd76a6c30d0ca551bb1f3b35e405a3d Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Jul 2019 08:40:13 -0700 Subject: [PATCH] net/iavf: use dynamic log type for Tx/Rx debug 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 Reviewed-by: Ferruh Yigit --- 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 4129e5de21..64037e11d2 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 */ }, @@ -1440,6 +1450,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_DEBUG); +#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_DEBUG); +#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_DEBUG); +#endif } /* memory func for base code */ diff --git a/drivers/net/iavf/iavf_log.h b/drivers/net/iavf/iavf_log.h index f66c370414..1088ec75f5 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