net/octeontx: 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:07 +05:30 committed by Ferruh Yigit
parent c563443c64
commit 4d35a276c1
3 changed files with 34 additions and 34 deletions

View File

@ -322,11 +322,6 @@ CONFIG_RTE_LIBRTE_DPAA_PMD=n
# Compile burst-oriented Cavium OCTEONTX network PMD driver
#
CONFIG_RTE_LIBRTE_OCTEONTX_PMD=y
CONFIG_RTE_LIBRTE_OCTEONTX_DEBUG_INIT=n
CONFIG_RTE_LIBRTE_OCTEONTX_DEBUG_RX=n
CONFIG_RTE_LIBRTE_OCTEONTX_DEBUG_TX=n
CONFIG_RTE_LIBRTE_OCTEONTX_DEBUG_DRIVER=n
CONFIG_RTE_LIBRTE_OCTEONTX_DEBUG_MBOX=n
#
# Compile NXP DPAA2 FSL-MC Bus

View File

@ -38,6 +38,27 @@ enum octeontx_link_speed {
OCTEONTX_LINK_SPEED_RESERVE2
};
int otx_net_logtype_mbox;
int otx_net_logtype_init;
int otx_net_logtype_driver;
RTE_INIT(otx_net_init_log);
static void
otx_net_init_log(void)
{
otx_net_logtype_mbox = rte_log_register("pmd.otx.ethdev.mbox");
if (otx_net_logtype_mbox >= 0)
rte_log_set_level(otx_net_logtype_mbox, RTE_LOG_NOTICE);
otx_net_logtype_init = rte_log_register("pmd.otx.ethdev.init");
if (otx_net_logtype_init >= 0)
rte_log_set_level(otx_net_logtype_init, RTE_LOG_NOTICE);
otx_net_logtype_driver = rte_log_register("pmd.otx.ethdev.driver");
if (otx_net_logtype_driver >= 0)
rte_log_set_level(otx_net_logtype_driver, RTE_LOG_NOTICE);
}
/* Parse integer from integer argument */
static int
parse_integer_arg(const char *key __rte_unused,

View File

@ -6,44 +6,28 @@
#define __OCTEONTX_LOGS_H__
#define PMD_INIT_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
rte_log(RTE_LOG_ ## level, otx_net_logtype_init, \
"%s(): " fmt "\n", __func__, ## args)
#ifdef RTE_LIBRTE_OCTEONTX_DEBUG_INIT
#define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, ">>")
#else
#define PMD_INIT_FUNC_TRACE() do { } while (0)
#endif
#ifdef RTE_LIBRTE_OCTEONTX_DEBUG_RX
#define PMD_RX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_RX_LOG(level, fmt, args...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_OCTEONTX_DEBUG_TX
#define PMD_TX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_TX_LOG(level, fmt, args...) do { } while (0)
#endif
#ifdef RTE_LIBRTE_OCTEONTX_DEBUG_DRIVER
#define PMD_DRV_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_DRV_LOG(level, fmt, args...) do { } while (0)
#endif
rte_log(RTE_LOG_ ## level, otx_net_logtype_driver, \
"%s(): " fmt "\n", __func__, ## args)
#ifdef RTE_LIBRTE_OCTEONTX_DEBUG_MBOX
#define PMD_MBOX_LOG(level, fmt, args...) \
RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
#else
#define PMD_MBOX_LOG(level, fmt, args...) do { } while (0)
#endif
rte_log(RTE_LOG_ ## level, otx_net_logtype_mbox, \
"%s(): " fmt "\n", __func__, ## args)
#define octeontx_log_err(s, ...) PMD_INIT_LOG(ERR, s, ##__VA_ARGS__)
#define octeontx_log_dbg(s, ...) PMD_DRV_LOG(DEBUG, s, ##__VA_ARGS__)
#define octeontx_mbox_log(s, ...) PMD_MBOX_LOG(DEBUG, s, ##__VA_ARGS__)
#define PMD_RX_LOG PMD_DRV_LOG
#define PMD_TX_LOG PMD_DRV_LOG
extern int otx_net_logtype_init;
extern int otx_net_logtype_driver;
extern int otx_net_logtype_mbox;
#endif /* __OCTEONTX_LOGS_H__*/