From: Stephen Hemminger Date: Tue, 16 Jul 2019 15:40:11 +0000 (-0700) Subject: net/ice: use dynamic log type for Tx/Rx debug X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=c67c8c5c1449128339ff6378d1737b7c2e91afc4;p=dpdk.git net/ice: 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 --- diff --git a/drivers/net/ice/ice_ethdev.c b/drivers/net/ice/ice_ethdev.c index dfccef65de..022b58c017 100644 --- a/drivers/net/ice/ice_ethdev.c +++ b/drivers/net/ice/ice_ethdev.c @@ -41,6 +41,15 @@ static const char * const ice_valid_args[] = { int ice_logtype_init; int ice_logtype_driver; +#ifdef RTE_LIBRTE_ICE_DEBUG_RX +int ice_logtype_rx; +#endif +#ifdef RTE_LIBRTE_ICE_DEBUG_TX +int ice_logtype_tx; +#endif +#ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE +int ice_logtype_tx_free; +#endif static int ice_dev_configure(struct rte_eth_dev *dev); static int ice_dev_start(struct rte_eth_dev *dev); @@ -4279,4 +4288,22 @@ RTE_INIT(ice_init_log) ice_logtype_driver = rte_log_register("pmd.net.ice.driver"); if (ice_logtype_driver >= 0) rte_log_set_level(ice_logtype_driver, RTE_LOG_NOTICE); + +#ifdef RTE_LIBRTE_ICE_DEBUG_RX + ice_logtype_rx = rte_log_register("pmd.net.ice.rx"); + if (ice_logtype_rx >= 0) + rte_log_set_level(ice_logtype_rx, RTE_LOG_DEBUG); +#endif + +#ifdef RTE_LIBRTE_ICE_DEBUG_TX + ice_logtype_tx = rte_log_register("pmd.net.ice.tx"); + if (ice_logtype_tx >= 0) + rte_log_set_level(ice_logtype_tx, RTE_LOG_DEBUG); +#endif + +#ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE + ice_logtype_tx_free = rte_log_register("pmd.net.ice.tx_free"); + if (ice_logtype_tx_free >= 0) + rte_log_set_level(ice_logtype_tx_free, RTE_LOG_DEBUG); +#endif } diff --git a/drivers/net/ice/ice_logs.h b/drivers/net/ice/ice_logs.h index de2d573d44..aab7da5f7b 100644 --- a/drivers/net/ice/ice_logs.h +++ b/drivers/net/ice/ice_logs.h @@ -15,22 +15,28 @@ extern int ice_logtype_driver; #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_ICE_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ice_logtype_rx; +#define PMD_RX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ice_logtype_rx, \ + "%s(): " fmt "\n", __func__, ## args) #else #define PMD_RX_LOG(level, fmt, args...) do { } while (0) #endif #ifdef RTE_LIBRTE_ICE_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ice_logtype_tx; +#define PMD_TX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ice_logtype_tx, \ + "%s(): " fmt "\n", __func__, ## args) #else #define PMD_TX_LOG(level, fmt, args...) do { } while (0) #endif #ifdef RTE_LIBRTE_ICE_DEBUG_TX_FREE -#define PMD_TX_FREE_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ice_logtype_tx_free; +#define PMD_TX_FREE_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ice_logtype_tx_free, \ + "%s(): " fmt "\n", __func__, ## args) #else #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0) #endif