net/avp: implement dynamic logging
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 19 Dec 2017 06:38:30 +0000 (22:38 -0800)
committerFerruh Yigit <ferruh.yigit@intel.com>
Tue, 16 Jan 2018 17:47:49 +0000 (18:47 +0100)
All PMD should be using dynamic log levels.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
config/common_base
drivers/net/avp/avp_ethdev.c
drivers/net/avp/avp_logs.h

index b8ee8f9..bee31e7 100644 (file)
@@ -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
 
 #
index 9b342bf..deb6f35 100644 (file)
@@ -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);
+}
index 252cab7..e29394d 100644 (file)
 #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_ */