From: Rahul Lakkireddy Date: Fri, 27 Sep 2019 20:30:07 +0000 (+0530) Subject: net/cxgbe: use dynamic logging for debug prints X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=70977725286e7c8ba23fa42c7208b4bf19353de9;p=dpdk.git net/cxgbe: use dynamic logging for debug prints Remove compile time flags and use dynamic logging for debug prints. Also remove rarely used debug logs in register access and datapath. Signed-off-by: Rahul Lakkireddy --- diff --git a/config/common_base b/config/common_base index 46ca2b2e13..756351ebac 100644 --- a/config/common_base +++ b/config/common_base @@ -217,11 +217,6 @@ CONFIG_RTE_LIBRTE_BNXT_PMD=y # Compile burst-oriented Chelsio Terminator (CXGBE) PMD # CONFIG_RTE_LIBRTE_CXGBE_PMD=y -CONFIG_RTE_LIBRTE_CXGBE_DEBUG=n -CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG=n -CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX=n -CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX=n -CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX=n CONFIG_RTE_LIBRTE_CXGBE_TPUT=y # NXP DPAA Bus diff --git a/doc/guides/nics/cxgbe.rst b/doc/guides/nics/cxgbe.rst index 7a893cc1d4..fc74b571c5 100644 --- a/doc/guides/nics/cxgbe.rst +++ b/doc/guides/nics/cxgbe.rst @@ -104,26 +104,6 @@ enabling debugging options may affect system performance. This controls compilation of both CXGBE and CXGBEVF PMD. -- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG`` (default **n**) - - Toggle display of generic debugging messages. - -- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_REG`` (default **n**) - - Toggle display of registers related run-time check messages. - -- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_MBOX`` (default **n**) - - Toggle display of firmware mailbox related run-time check messages. - -- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_TX`` (default **n**) - - Toggle display of transmission data path run-time check messages. - -- ``CONFIG_RTE_LIBRTE_CXGBE_DEBUG_RX`` (default **n**) - - Toggle display of receiving data path run-time check messages. - - ``CONFIG_RTE_LIBRTE_CXGBE_TPUT`` (default **y**) Toggle behavior to prefer Throughput or Latency. diff --git a/drivers/net/cxgbe/base/adapter.h b/drivers/net/cxgbe/base/adapter.h index e548f9f63a..2dfdb2df8a 100644 --- a/drivers/net/cxgbe/base/adapter.h +++ b/drivers/net/cxgbe/base/adapter.h @@ -450,11 +450,7 @@ static inline uint64_t cxgbe_write_addr64(volatile void *addr, uint64_t val) */ static inline u32 t4_read_reg(struct adapter *adapter, u32 reg_addr) { - u32 val = CXGBE_READ_REG(adapter, reg_addr); - - CXGBE_DEBUG_REG(adapter, "read register 0x%x value 0x%x\n", reg_addr, - val); - return val; + return CXGBE_READ_REG(adapter, reg_addr); } /** @@ -467,8 +463,6 @@ static inline u32 t4_read_reg(struct adapter *adapter, u32 reg_addr) */ static inline void t4_write_reg(struct adapter *adapter, u32 reg_addr, u32 val) { - CXGBE_DEBUG_REG(adapter, "setting register 0x%x to 0x%x\n", reg_addr, - val); CXGBE_WRITE_REG(adapter, reg_addr, val); } @@ -483,8 +477,6 @@ static inline void t4_write_reg(struct adapter *adapter, u32 reg_addr, u32 val) static inline void t4_write_reg_relaxed(struct adapter *adapter, u32 reg_addr, u32 val) { - CXGBE_DEBUG_REG(adapter, "setting register 0x%x to 0x%x\n", reg_addr, - val); CXGBE_WRITE_REG_RELAXED(adapter, reg_addr, val); } @@ -497,11 +489,7 @@ static inline void t4_write_reg_relaxed(struct adapter *adapter, u32 reg_addr, */ static inline u64 t4_read_reg64(struct adapter *adapter, u32 reg_addr) { - u64 val = CXGBE_READ_REG64(adapter, reg_addr); - - CXGBE_DEBUG_REG(adapter, "64-bit read register %#x value %#llx\n", - reg_addr, (unsigned long long)val); - return val; + return CXGBE_READ_REG64(adapter, reg_addr); } /** @@ -515,9 +503,6 @@ static inline u64 t4_read_reg64(struct adapter *adapter, u32 reg_addr) static inline void t4_write_reg64(struct adapter *adapter, u32 reg_addr, u64 val) { - CXGBE_DEBUG_REG(adapter, "setting register %#x to %#llx\n", reg_addr, - (unsigned long long)val); - CXGBE_WRITE_REG64(adapter, reg_addr, val); } diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index 93df0a7754..20e4f8af20 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -21,55 +21,26 @@ #include extern int cxgbe_logtype; +extern int cxgbe_mbox_logtype; -#define dev_printf(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, cxgbe_logtype, \ +#define dev_printf(level, logtype, fmt, ...) \ + rte_log(RTE_LOG_ ## level, logtype, \ "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__) -#define dev_err(x, fmt, ...) dev_printf(ERR, fmt, ##__VA_ARGS__) -#define dev_info(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__) -#define dev_warn(x, fmt, ...) dev_printf(WARNING, fmt, ##__VA_ARGS__) +#define dev_err(x, fmt, ...) \ + dev_printf(ERR, cxgbe_logtype, fmt, ##__VA_ARGS__) +#define dev_info(x, fmt, ...) \ + dev_printf(INFO, cxgbe_logtype, fmt, ##__VA_ARGS__) +#define dev_warn(x, fmt, ...) \ + dev_printf(WARNING, cxgbe_logtype, fmt, ##__VA_ARGS__) +#define dev_debug(x, fmt, ...) \ + dev_printf(DEBUG, cxgbe_logtype, fmt, ##__VA_ARGS__) -#ifdef RTE_LIBRTE_CXGBE_DEBUG -#define dev_debug(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__) -#else -#define dev_debug(x, fmt, ...) do { } while (0) -#endif - -#ifdef RTE_LIBRTE_CXGBE_DEBUG_REG -#define CXGBE_DEBUG_REG(x, fmt, ...) \ - dev_printf(INFO, "REG:" fmt, ##__VA_ARGS__) -#else -#define CXGBE_DEBUG_REG(x, fmt, ...) do { } while (0) -#endif - -#ifdef RTE_LIBRTE_CXGBE_DEBUG_MBOX #define CXGBE_DEBUG_MBOX(x, fmt, ...) \ - dev_printf(INFO, "MBOX:" fmt, ##__VA_ARGS__) -#else -#define CXGBE_DEBUG_MBOX(x, fmt, ...) do { } while (0) -#endif + dev_printf(DEBUG, cxgbe_mbox_logtype, "MBOX:" fmt, ##__VA_ARGS__) -#ifdef RTE_LIBRTE_CXGBE_DEBUG_TX -#define CXGBE_DEBUG_TX(x, fmt, ...) \ - dev_printf(INFO, "TX:" fmt, ##__VA_ARGS__) -#else -#define CXGBE_DEBUG_TX(x, fmt, ...) do { } while (0) -#endif - -#ifdef RTE_LIBRTE_CXGBE_DEBUG_RX -#define CXGBE_DEBUG_RX(x, fmt, ...) \ - dev_printf(INFO, "RX:" fmt, ##__VA_ARGS__) -#else -#define CXGBE_DEBUG_RX(x, fmt, ...) do { } while (0) -#endif - -#ifdef RTE_LIBRTE_CXGBE_DEBUG #define CXGBE_FUNC_TRACE() \ - dev_printf(DEBUG, "CXGBE trace: %s\n", __func__) -#else -#define CXGBE_FUNC_TRACE() do { } while (0) -#endif + dev_printf(DEBUG, cxgbe_logtype, "CXGBE trace: %s\n", __func__) #define pr_err(fmt, ...) dev_err(0, fmt, ##__VA_ARGS__) #define pr_warn(fmt, ...) dev_warn(0, fmt, ##__VA_ARGS__) diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 5df8d746c9..13df45b2d9 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -39,6 +39,7 @@ #include "cxgbe_flow.h" int cxgbe_logtype; +int cxgbe_mbox_logtype; /* * Macros needed to support the PCI Device ID Table ... @@ -70,9 +71,6 @@ uint16_t cxgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t idx = 0; int ret = 0; - CXGBE_DEBUG_TX(adapter, "%s: txq = %p; tx_pkts = %p; nb_pkts = %d\n", - __func__, txq, tx_pkts, nb_pkts); - t4_os_lock(&txq->txq_lock); /* free up desc from already completed tx */ reclaim_completed_tx(&txq->q); @@ -106,13 +104,9 @@ uint16_t cxgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, struct sge_eth_rxq *rxq = (struct sge_eth_rxq *)rx_queue; unsigned int work_done; - CXGBE_DEBUG_RX(adapter, "%s: rxq->rspq.cntxt_id = %u; nb_pkts = %d\n", - __func__, rxq->rspq.cntxt_id, nb_pkts); - if (cxgbe_poll(&rxq->rspq, rx_pkts, (unsigned int)nb_pkts, &work_done)) dev_err(adapter, "error in cxgbe poll\n"); - CXGBE_DEBUG_RX(adapter, "%s: work_done = %u\n", __func__, work_done); return work_done; } @@ -1251,4 +1245,7 @@ RTE_INIT(cxgbe_init_log) cxgbe_logtype = rte_log_register("pmd.net.cxgbe"); if (cxgbe_logtype >= 0) rte_log_set_level(cxgbe_logtype, RTE_LOG_NOTICE); + cxgbe_mbox_logtype = rte_log_register("pmd.net.cxgbe.mbox"); + if (cxgbe_mbox_logtype >= 0) + rte_log_set_level(cxgbe_mbox_logtype, RTE_LOG_NOTICE); }