net/thunderx: implement dynamic logging

Signed-off-by: Pavan Nikhilesh <pbhagavatula@caviumnetworks.com>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Stephen Hemminger <stephen@networkplumber.org>
This commit is contained in:
Pavan Nikhilesh 2017-12-19 17:55:06 +05:30 committed by Ferruh Yigit
parent 70e28c612d
commit c563443c64
3 changed files with 39 additions and 32 deletions

View File

@ -301,11 +301,8 @@ CONFIG_RTE_LIBRTE_PMD_SZEDATA2_AS=0
# Compile burst-oriented Cavium Thunderx NICVF PMD driver
#
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_PMD=y
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT=n
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX=n
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX=n
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_DRIVER=n
CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n
#
# Compile burst-oriented Cavium LiquidIO PMD driver

View File

@ -43,11 +43,32 @@
#include "nicvf_svf.h"
#include "nicvf_logs.h"
int nicvf_logtype_mbox;
int nicvf_logtype_init;
int nicvf_logtype_driver;
static void nicvf_dev_stop(struct rte_eth_dev *dev);
static void nicvf_dev_stop_cleanup(struct rte_eth_dev *dev, bool cleanup);
static void nicvf_vf_stop(struct rte_eth_dev *dev, struct nicvf *nic,
bool cleanup);
RTE_INIT(nicvf_init_log);
static void
nicvf_init_log(void)
{
nicvf_logtype_mbox = rte_log_register("pmd.nicvf.mbox");
if (nicvf_logtype_mbox >= 0)
rte_log_set_level(nicvf_logtype_mbox, RTE_LOG_NOTICE);
nicvf_logtype_init = rte_log_register("pmd.nicvf.init");
if (nicvf_logtype_init >= 0)
rte_log_set_level(nicvf_logtype_init, RTE_LOG_NOTICE);
nicvf_logtype_driver = rte_log_register("pmd.nicvf.driver");
if (nicvf_logtype_driver >= 0)
rte_log_set_level(nicvf_logtype_driver, RTE_LOG_NOTICE);
}
static inline int
nicvf_atomic_write_link_status(struct rte_eth_dev *dev,
struct rte_eth_link *link)

View File

@ -7,49 +7,38 @@
#include <assert.h>
#define PMD_INIT_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#ifdef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_INIT
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, ">>")
#else
#define PMD_INIT_FUNC_TRACE() do { } while (0)
#endif
#ifdef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_RX
#define PMD_RX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#define NICVF_RX_ASSERT(x) assert(x)
#else
#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
#define NICVF_RX_ASSERT(x) do { } while (0)
#endif
#ifdef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_TX
#define PMD_TX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#define NICVF_TX_ASSERT(x) assert(x)
#else
#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
#define NICVF_TX_ASSERT(x) do { } while (0)
#endif
#ifdef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_DRIVER
#define PMD_DRV_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#else
#define PMD_DRV_LOG(level, fmt, args...) do { } while (0)
#define PMD_DRV_FUNC_TRACE() do { } while (0)
#endif
#define PMD_INIT_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, nicvf_logtype_init, \
"%s(): " fmt "\n", __func__, ## args)
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, ">>")
#define PMD_DRV_LOG(level, fmt, args...) \
rte_log(RTE_LOG_ ## level, nicvf_logtype_driver, \
"%s(): " fmt "\n", __func__, ## args)
#define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#ifdef RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX
#define PMD_MBOX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
rte_log(RTE_LOG_ ## level, nicvf_logtype_mbox, \
"%s(): " fmt "\n", __func__, ## args)
#define PMD_MBOX_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>")
#else
#define PMD_MBOX_LOG(level, fmt, args...) do { } while (0)
#define PMD_MBOX_FUNC_TRACE() do { } while (0)
#endif
#define PMD_RX_LOG PMD_DRV_LOG
#define PMD_TX_LOG PMD_DRV_LOG
extern int nicvf_logtype_init;
extern int nicvf_logtype_driver;
extern int nicvf_logtype_mbox;
#endif /* __THUNDERX_NICVF_LOGS__ */