From: Stephen Hemminger Date: Tue, 19 Dec 2017 06:38:30 +0000 (-0800) Subject: net/avp: implement dynamic logging X-Git-Tag: spdx-start~507 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=e6b790c0659f71bbed1649f211b1cab614a268c7;p=dpdk.git net/avp: implement dynamic logging All PMD should be using dynamic log levels. Signed-off-by: Stephen Hemminger --- diff --git a/config/common_base b/config/common_base index b8ee8f91c1..bee31e752e 100644 --- a/config/common_base +++ b/config/common_base @@ -440,7 +440,6 @@ CONFIG_RTE_LIBRTE_ARK_DEBUG_TRACE=n CONFIG_RTE_LIBRTE_AVP_PMD=n CONFIG_RTE_LIBRTE_AVP_DEBUG_RX=n CONFIG_RTE_LIBRTE_AVP_DEBUG_TX=n -CONFIG_RTE_LIBRTE_AVP_DEBUG_DRIVER=y CONFIG_RTE_LIBRTE_AVP_DEBUG_BUFFERS=n # diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 9b342bfa3a..deb6f355d3 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -60,6 +60,7 @@ #include "avp_logs.h" +int avp_logtype_driver; static int avp_dev_create(struct rte_pci_device *pci_dev, struct rte_eth_dev *eth_dev); @@ -2312,3 +2313,12 @@ avp_dev_stats_reset(struct rte_eth_dev *eth_dev) RTE_PMD_REGISTER_PCI(net_avp, rte_avp_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_avp, pci_id_avp_map); + +RTE_INIT(avp_init_log); +static void +avp_init_log(void) +{ + avp_logtype_driver = rte_log_register("pmd.avp.driver"); + if (avp_logtype_driver >= 0) + rte_log_set_level(avp_logtype_driver, RTE_LOG_NOTICE); +} diff --git a/drivers/net/avp/avp_logs.h b/drivers/net/avp/avp_logs.h index 252cab7da2..e29394d585 100644 --- a/drivers/net/avp/avp_logs.h +++ b/drivers/net/avp/avp_logs.h @@ -49,11 +49,10 @@ #define PMD_TX_LOG(level, fmt, args...) do { } while (0) #endif -#ifdef RTE_LIBRTE_AVP_DEBUG_DRIVER +extern int avp_logtype_driver; + #define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) -#else -#define PMD_DRV_LOG(level, fmt, args...) do { } while (0) -#endif + rte_log(RTE_LOG_ ## level, avp_logtype_driver, \ + "%s(): " fmt, __func__, ## args) #endif /* _AVP_LOGS_H_ */