From a8ad07ec64fd280d65f58f3a585a72b2293d8496 Mon Sep 17 00:00:00 2001 From: Stephen Hemminger Date: Tue, 16 Jul 2019 08:40:10 -0700 Subject: [PATCH] net/ixgbe: 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/ixgbe/ixgbe_ethdev.c | 27 +++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_logs.h | 24 +++++++++++++++--------- drivers/net/ixgbe/ixgbe_pf.c | 19 ++++++++----------- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 77c6d387f6..dbce7a80e9 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -419,6 +419,16 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev); int ixgbe_logtype_init; int ixgbe_logtype_driver; +#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX +int ixgbe_logtype_rx; +#endif +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX +int ixgbe_logtype_tx; +#endif +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE +int ixgbe_logtype_tx_free; +#endif + /* * The set of PCI devices this driver supports */ @@ -8823,4 +8833,21 @@ RTE_INIT(ixgbe_init_log) ixgbe_logtype_driver = rte_log_register("pmd.net.ixgbe.driver"); if (ixgbe_logtype_driver >= 0) rte_log_set_level(ixgbe_logtype_driver, RTE_LOG_NOTICE); +#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX + ixgbe_logtype_rx = rte_log_register("pmd.net.ixgbe.rx"); + if (ixgbe_logtype_rx >= 0) + rte_log_set_level(ixgbe_logtype_rx, RTE_LOG_DEBUG); +#endif + +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX + ixgbe_logtype_tx = rte_log_register("pmd.net.ixgbe.tx"); + if (ixgbe_logtype_tx >= 0) + rte_log_set_level(ixgbe_logtype_tx, RTE_LOG_DEBUG); +#endif + +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE + ixgbe_logtype_tx_free = rte_log_register("pmd.net.ixgbe.tx_free"); + if (ixgbe_logtype_tx_free >= 0) + rte_log_set_level(ixgbe_logtype_tx_free, RTE_LOG_DEBUG); +#endif } diff --git a/drivers/net/ixgbe/ixgbe_logs.h b/drivers/net/ixgbe/ixgbe_logs.h index dc73e9bded..2a279d1098 100644 --- a/drivers/net/ixgbe/ixgbe_logs.h +++ b/drivers/net/ixgbe/ixgbe_logs.h @@ -13,24 +13,30 @@ extern int ixgbe_logtype_init; #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_IXGBE_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ixgbe_logtype_rx; +#define PMD_RX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ixgbe_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_IXGBE_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ixgbe_logtype_tx; +#define PMD_TX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ixgbe_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_IXGBE_DEBUG_TX_FREE -#define PMD_TX_FREE_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ixgbe_logtype_tx_free; +#define PMD_TX_FREE_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ixgbe_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 ixgbe_logtype_driver; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index be729ba2d0..d0d85e1386 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -161,16 +161,14 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev) struct ixgbe_ethertype_filter ethertype_filter; if (!hw->mac.ops.set_ethertype_anti_spoofing) { - RTE_LOG(INFO, PMD, "ether type anti-spoofing is not" - " supported.\n"); + PMD_DRV_LOG(INFO, "ether type anti-spoofing is not supported.\n"); return; } i = ixgbe_ethertype_filter_lookup(filter_info, IXGBE_ETHERTYPE_FLOW_CTRL); if (i >= 0) { - RTE_LOG(ERR, PMD, "A ether type filter" - " entity for flow control already exists!\n"); + PMD_DRV_LOG(ERR, "A ether type filter entity for flow control already exists!\n"); return; } @@ -183,8 +181,7 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev) i = ixgbe_ethertype_filter_insert(filter_info, ðertype_filter); if (i < 0) { - RTE_LOG(ERR, PMD, "Cannot find an unused ether type filter" - " entity for flow control.\n"); + PMD_DRV_LOG(ERR, "Cannot find an unused ether type filter entity for flow control.\n"); return; } @@ -415,7 +412,7 @@ ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf) vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); - RTE_LOG(INFO, PMD, "VF %u: disabling multicast promiscuous\n", vf); + PMD_DRV_LOG(INFO, "VF %u: disabling multicast promiscuous\n", vf); vmolr &= ~IXGBE_VMOLR_MPE; @@ -588,7 +585,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) break; } - RTE_LOG(ERR, PMD, "Negotiate invalid api version %u from VF %d\n", + PMD_DRV_LOG(ERR, "Negotiate invalid api version %u from VF %d\n", api_version, vf); return -1; @@ -636,7 +633,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) switch (eth_conf->txmode.mq_mode) { case ETH_MQ_TX_NONE: case ETH_MQ_TX_DCB: - RTE_LOG(ERR, PMD, "PF must work with virtualization for VF %u" + PMD_DRV_LOG(ERR, "PF must work with virtualization for VF %u" ", but its tx mode = %d\n", vf, eth_conf->txmode.mq_mode); return -1; @@ -671,7 +668,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) break; default: - RTE_LOG(ERR, PMD, "PF work with invalid mode = %d\n", + PMD_DRV_LOG(ERR, "PF work with invalid mode = %d\n", eth_conf->txmode.mq_mode); return -1; } @@ -726,7 +723,7 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); if (!(fctrl & IXGBE_FCTRL_UPE)) { /* VF promisc requires PF in promisc */ - RTE_LOG(ERR, PMD, + PMD_DRV_LOG(ERR, "Enabling VF promisc requires PF in promisc\n"); return -1; } -- 2.20.1