net/fm10k: use dynamic log type for Tx/Rx debug
authorStephen Hemminger <stephen@networkplumber.org>
Tue, 16 Jul 2019 15:40:09 +0000 (08:40 -0700)
committerFerruh Yigit <ferruh.yigit@intel.com>
Mon, 7 Oct 2019 13:00:57 +0000 (15:00 +0200)
The generic RTE_LOGTYPE_PMD is a historical relic and should
not be used. Every driver must dynamic log types.

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
Reviewed-by: Ferruh Yigit <ferruh.yigit@intel.com>
drivers/net/fm10k/fm10k_ethdev.c
drivers/net/fm10k/fm10k_logs.h

index dc8bc75..99c4366 100644 (file)
 int fm10k_logtype_init;
 int fm10k_logtype_driver;
 
+#ifdef RTE_LIBRTE_FM10K_DEBUG_RX
+int fm10k_logtype_rx;
+#endif
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX
+int fm10k_logtype_tx;
+#endif
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
+int fm10k_logtype_tx_free;
+#endif
+
 static void fm10k_close_mbx_service(struct fm10k_hw *hw);
 static int fm10k_dev_promiscuous_enable(struct rte_eth_dev *dev);
 static int fm10k_dev_promiscuous_disable(struct rte_eth_dev *dev);
@@ -3313,4 +3323,22 @@ RTE_INIT(fm10k_init_log)
        fm10k_logtype_driver = rte_log_register("pmd.net.fm10k.driver");
        if (fm10k_logtype_driver >= 0)
                rte_log_set_level(fm10k_logtype_driver, RTE_LOG_NOTICE);
+
+#ifdef RTE_LIBRTE_FM10K_DEBUG_RX
+       fm10k_logtype_rx = rte_log_register("pmd.net.fm10k.rx");
+       if (fm10k_logtype_rx >= 0)
+               rte_log_set_level(fm10k_logtype_rx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX
+       fm10k_logtype_tx = rte_log_register("pmd.net.fm10k.tx");
+       if (fm10k_logtype_tx >= 0)
+               rte_log_set_level(fm10k_logtype_tx, RTE_LOG_DEBUG);
+#endif
+
+#ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
+       fm10k_logtype_tx_free = rte_log_register("pmd.net.fm10k.tx_free");
+       if (fm10k_logtype_tx_free >= 0)
+               rte_log_set_level(fm10k_logtype_tx_free, RTE_LOG_DEBUG);
+#endif
 }
index df56a51..9ae743d 100644 (file)
@@ -15,22 +15,28 @@ extern int fm10k_logtype_init;
 #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>")
 
 #ifdef RTE_LIBRTE_FM10K_DEBUG_RX
-#define PMD_RX_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int fm10k_logtype_rx;
+#define PMD_RX_LOG(level, fmt, args...)                        \
+       rte_log(RTE_LOG_ ## level, fm10k_logtype_rx,    \
+               "%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_RX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_FM10K_DEBUG_TX
-#define PMD_TX_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int fm10k_logtype_tx;
+#define PMD_TX_LOG(level, fmt, args...)                        \
+       rte_log(RTE_LOG_ ## level, fm10k_logtype_tx,    \
+               "%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_TX_LOG(level, fmt, args...) do { } while (0)
 #endif
 
 #ifdef RTE_LIBRTE_FM10K_DEBUG_TX_FREE
-#define PMD_TX_FREE_LOG(level, fmt, args...) \
-       RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args)
+extern int fm10k_logtype_tx_free;
+#define PMD_TX_FREE_LOG(level, fmt, args...)                   \
+       rte_log(RTE_LOG_ ## level, fm10k_logtype_tx_free,       \
+               "%s(): " fmt "\n", __func__, ## args)
 #else
 #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0)
 #endif