From: Stephen Hemminger Date: Tue, 19 Dec 2017 06:38:34 +0000 (-0800) Subject: net/e1000: implement dynamic logging X-Git-Tag: spdx-start~503 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=ed5bbb767c3e;p=dpdk.git net/e1000: implement dynamic logging Signed-off-by: Stephen Hemminger --- diff --git a/config/common_base b/config/common_base index be49cc1e99..34f629adf0 100644 --- a/config/common_base +++ b/config/common_base @@ -177,11 +177,9 @@ CONFIG_RTE_LIBRTE_ENA_COM_DEBUG=n # CONFIG_RTE_LIBRTE_EM_PMD=y CONFIG_RTE_LIBRTE_IGB_PMD=y -CONFIG_RTE_LIBRTE_E1000_DEBUG_INIT=n CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n CONFIG_RTE_LIBRTE_E1000_DEBUG_TX_FREE=n -CONFIG_RTE_LIBRTE_E1000_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_E1000_PF_DISABLE_STRIP_CRC=n # diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h index 41087458e1..50348e9edb 100644 --- a/drivers/net/e1000/e1000_logs.h +++ b/drivers/net/e1000/e1000_logs.h @@ -5,14 +5,12 @@ #ifndef _E1000_LOGS_H_ #define _E1000_LOGS_H_ +extern int e1000_logtype_init; #define PMD_INIT_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ##args) + rte_log(RTE_LOG_ ## level, e1000_logtype_init, \ + "%s(): " fmt "\n", __func__, ##args) -#ifdef RTE_LIBRTE_E1000_DEBUG_INIT #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") -#else -#define PMD_INIT_FUNC_TRACE() do { } while (0) -#endif #ifdef RTE_LIBRTE_E1000_DEBUG_RX #define PMD_RX_LOG(level, fmt, args...) \ @@ -35,12 +33,10 @@ #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0) #endif -#ifdef RTE_LIBRTE_E1000_DEBUG_DRIVER +extern int e1000_logtype_driver; #define PMD_DRV_LOG_RAW(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) -#else -#define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0) -#endif + rte_log(RTE_LOG_ ## level, e1000_logtype_driver, "%s(): " fmt, \ + __func__, ## args) #define PMD_DRV_LOG(level, fmt, args...) \ PMD_DRV_LOG_RAW(level, fmt "\n", ## args) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index f457be55e7..4a77ec9813 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -105,6 +105,9 @@ static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, static enum e1000_fc_mode em_fc_setting = e1000_fc_full; +int e1000_logtype_init; +int e1000_logtype_driver; + /* * The set of PCI devices this driver supports */ @@ -1846,3 +1849,15 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map); RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci"); + +RTE_INIT(e1000_init_log); +static void +e1000_init_log(void) +{ + e1000_logtype_init = rte_log_register("pmd.e1000.init"); + if (e1000_logtype_init >= 0) + rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE); + e1000_logtype_driver = rte_log_register("pmd.e1000.driver"); + if (e1000_logtype_driver >= 0) + rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE); +}