net/fm10k: implement dynamic logging

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Stephen Hemminger 2017-12-18 22:38:37 -08:00 committed by Ferruh Yigit
parent c73f9b2662
commit 1ad18ef8bf
3 changed files with 21 additions and 12 deletions

View File

@ -213,11 +213,9 @@ CONFIG_RTE_LIBRTE_I40E_ITR_INTERVAL=-1
# Compile burst-oriented FM10K PMD
#
CONFIG_RTE_LIBRTE_FM10K_PMD=y
CONFIG_RTE_LIBRTE_FM10K_DEBUG_INIT=n
CONFIG_RTE_LIBRTE_FM10K_DEBUG_RX=n
CONFIG_RTE_LIBRTE_FM10K_DEBUG_TX=n
CONFIG_RTE_LIBRTE_FM10K_DEBUG_TX_FREE=n
CONFIG_RTE_LIBRTE_FM10K_DEBUG_DRIVER=n
CONFIG_RTE_LIBRTE_FM10K_RX_OLFLAGS_ENABLE=y
CONFIG_RTE_LIBRTE_FM10K_INC_VECTOR=y

View File

@ -40,6 +40,9 @@
#define GLORT_FD_MASK GLORT_PF_MASK
#define GLORT_FD_INDEX GLORT_FD_Q_BASE
int fm10k_logtype_init;
int fm10k_logtype_driver;
static void fm10k_close_mbx_service(struct fm10k_hw *hw);
static void fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
static void fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
@ -3233,3 +3236,15 @@ static struct rte_pci_driver rte_pmd_fm10k = {
RTE_PMD_REGISTER_PCI(net_fm10k, rte_pmd_fm10k);
RTE_PMD_REGISTER_PCI_TABLE(net_fm10k, pci_id_fm10k_map);
RTE_PMD_REGISTER_KMOD_DEP(net_fm10k, "* igb_uio | uio_pci_generic | vfio-pci");
RTE_INIT(fm10k_init_log);
static void
fm10k_init_log(void)
{
fm10k_logtype_init = rte_log_register("pmd.fm10k.init");
if (fm10k_logtype_init >= 0)
rte_log_set_level(fm10k_logtype_init, RTE_LOG_NOTICE);
fm10k_logtype_driver = rte_log_register("pmd.fm10k.driver");
if (fm10k_logtype_driver >= 0)
rte_log_set_level(fm10k_logtype_driver, RTE_LOG_NOTICE);
}

View File

@ -7,14 +7,12 @@
#include <rte_log.h>
extern int fm10k_logtype_init;
#define PMD_INIT_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ##args)
rte_log(RTE_LOG_ ## level, fm10k_logtype_init, \
"%s(): " fmt "\n", __func__, ##args)
#ifdef RTE_LIBRTE_FM10K_DEBUG_INIT
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
#else
#define PMD_INIT_FUNC_TRACE() do { } while (0)
#endif
#ifdef RTE_LIBRTE_FM10K_DEBUG_RX
#define PMD_RX_LOG(level, fmt, args...) \
@ -37,12 +35,10 @@
#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_FM10K_DEBUG_DRIVER
extern int fm10k_logtype_driver;
#define PMD_DRV_LOG_RAW(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args)
#else
#define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0)
#endif
rte_log(RTE_LOG_ ## level, fm10k_logtype_driver, "%s(): " fmt, \
__func__, ## args)
#define PMD_DRV_LOG(level, fmt, args...) \
PMD_DRV_LOG_RAW(level, fmt "\n", ## args)