net/i40e: 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:12 -07:00 committed by Ferruh Yigit
parent c67c8c5c14
commit 1f14a1731a
2 changed files with 42 additions and 9 deletions

View File

@ -400,6 +400,15 @@ static void i40e_notify_all_vfs_link_status(struct rte_eth_dev *dev);
int i40e_logtype_init;
int i40e_logtype_driver;
#ifdef RTE_LIBRTE_I40E_DEBUG_RX
int i40e_logtype_rx;
#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_TX
int i40e_logtype_tx;
#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
int i40e_logtype_tx_free;
#endif
static const char *const valid_keys[] = {
ETH_I40E_FLOATING_VEB_ARG,
@ -12862,6 +12871,24 @@ RTE_INIT(i40e_init_log)
i40e_logtype_driver = rte_log_register("pmd.net.i40e.driver");
if (i40e_logtype_driver >= 0)
rte_log_set_level(i40e_logtype_driver, RTE_LOG_NOTICE);
#ifdef RTE_LIBRTE_I40E_DEBUG_RX
i40e_logtype_rx = rte_log_register("pmd.net.i40e.rx");
if (i40e_logtype_rx >= 0)
rte_log_set_level(i40e_logtype_rx, RTE_LOG_DEBUG);
#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_TX
i40e_logtype_tx = rte_log_register("pmd.net.i40e.tx");
if (i40e_logtype_tx >= 0)
rte_log_set_level(i40e_logtype_tx, RTE_LOG_DEBUG);
#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
i40e_logtype_tx_free = rte_log_register("pmd.net.i40e.tx_free");
if (i40e_logtype_tx_free >= 0)
rte_log_set_level(i40e_logtype_tx_free, RTE_LOG_DEBUG);
#endif
}
RTE_PMD_REGISTER_PARAM_STRING(net_i40e,

View File

@ -12,24 +12,30 @@ extern int i40e_logtype_init;
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
#ifdef RTE_LIBRTE_I40E_DEBUG_RX
#define PMD_RX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
extern int i40e_logtype_rx;
#define PMD_RX_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, i40e_logtype_rx, \
"%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_RX_LOG(level, fmt, args...) do { } while(0)
#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_TX
#define PMD_TX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
extern int i40e_logtype_tx;
#define PMD_TX_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, i40e_logtype_tx, \
"%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_TX_LOG(level, fmt, args...) do { } while(0)
#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_I40E_DEBUG_TX_FREE
#define PMD_TX_FREE_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
extern int i40e_logtype_tx_free;
#define PMD_TX_FREE_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, i40e_logtype_tx_free, \
"%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0)
#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0)
#endif
extern int i40e_logtype_driver;