]> git.droids-corp.org - dpdk.git/commitdiff
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 b8ee8f91c1983ab09f90221fce2bee8496eb0009..bee31e752e63327a3c529217fa4a3da145a2b8ba 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 9b342bfa3ae81b04dcaa8d469b2cdd6a5187821f..deb6f355d3efa8fc79d3f27138798ade185e637d 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 252cab7da2cfb76a55ee9d953a8677a08d22c31b..e29394d5857f0ef3058d4ca8f8cf83cb0f77e741 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_ */