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 <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
This commit is contained in:
Stephen Hemminger 2019-07-16 08:40:13 -07:00 committed by Ferruh Yigit
parent 1f14a1731a
commit 23198c17af
2 changed files with 41 additions and 6 deletions

View File

@ -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 */

View File

@ -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