From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga05.intel.com (mga05.intel.com [192.55.52.43]) by dpdk.org (Postfix) with ESMTP id 73F2C1B1EE for ; Tue, 9 Jan 2018 13:11:46 +0100 (CET) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga005.jf.intel.com ([10.7.209.41]) by fmsmga105.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 09 Jan 2018 04:11:46 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,335,1511856000"; d="scan'208";a="191856081" Received: from silpixa00372839.ir.intel.com (HELO silpixa00372839.ger.corp.intel.com) ([10.237.222.154]) by orsmga005.jf.intel.com with ESMTP; 09 Jan 2018 04:11:43 -0800 From: Ferruh Yigit To: Thomas Monjalon , Allain Legacy , Matt Peters , Rasesh Mody , Harish Patil , Shahed Shaikh Cc: dev@dpdk.org, Ferruh Yigit , Stephen Hemminger Date: Tue, 9 Jan 2018 12:10:56 +0000 Message-Id: <20180109121057.59750-11-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180109121057.59750-1-ferruh.yigit@intel.com> References: <20171219063840.18981-1-stephen@networkplumber.org> <20180109121057.59750-1-ferruh.yigit@intel.com> Subject: [dpdk-dev] [PATCH v2 11/12] net/qede: implement dynamic logging X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Jan 2018 12:11:47 -0000 From: Stephen Hemminger This driver is mostly like others with slightly different logging macros. The semantics were retained, with some minor reformatting. Signed-off-by: Stephen Hemminger --- config/common_base | 2 -- drivers/net/qede/qede_ethdev.c | 15 ++++++++++++ drivers/net/qede/qede_logs.h | 53 +++++++++++++++++++----------------------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/config/common_base b/config/common_base index 5e7b9be0f..2eee92a01 100644 --- a/config/common_base +++ b/config/common_base @@ -397,9 +397,7 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n # QLogic 10G/25G/40G/50G/100G PMD # CONFIG_RTE_LIBRTE_QEDE_PMD=y -CONFIG_RTE_LIBRTE_QEDE_DEBUG_INIT=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_INFO=n -CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_TX=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_RX=n CONFIG_RTE_LIBRTE_QEDE_VF_TX_SWITCH=y diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 68e99c594..071c44110 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -11,6 +11,9 @@ #include /* Globals */ +int qede_logtype_init; +int qede_logtype_driver; + static const struct qed_eth_ops *qed_ops; static int64_t timer_period = 1; @@ -3125,3 +3128,15 @@ RTE_PMD_REGISTER_KMOD_DEP(net_qede, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PCI(net_qede_vf, rte_qedevf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_qede_vf, pci_id_qedevf_map); RTE_PMD_REGISTER_KMOD_DEP(net_qede_vf, "* igb_uio | vfio-pci"); + +RTE_INIT(qede_init_log); +static void +qede_init_log(void) +{ + qede_logtype_init = rte_log_register("pmd.qede.init"); + if (qede_logtype_init >= 0) + rte_log_set_level(qede_logtype_init, RTE_LOG_NOTICE); + qede_logtype_driver = rte_log_register("pmd.qede.driver"); + if (qede_logtype_driver >= 0) + rte_log_set_level(qede_logtype_driver, RTE_LOG_NOTICE); +} diff --git a/drivers/net/qede/qede_logs.h b/drivers/net/qede/qede_logs.h index 15821151c..b7ecf1c27 100644 --- a/drivers/net/qede/qede_logs.h +++ b/drivers/net/qede/qede_logs.h @@ -9,23 +9,25 @@ #ifndef _QEDE_LOGS_H_ #define _QEDE_LOGS_H_ -#define DP_ERR(p_dev, fmt, ...) \ - rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, \ - "[%s:%d(%s)]" fmt, \ - __func__, __LINE__, \ - (p_dev)->name ? (p_dev)->name : "", \ +extern int qede_logtype_driver; + +#define DP_ERR(p_dev, fmt, ...) \ + rte_log(RTE_LOG_ERR, qede_logtype_driver, \ + "[%s:%d(%s)]" fmt, \ + __func__, __LINE__, \ + (p_dev)->name ? (p_dev)->name : "", \ ##__VA_ARGS__) #define DP_NOTICE(p_dev, is_assert, fmt, ...) \ do { \ if (is_assert) \ - rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD,\ + rte_log(RTE_LOG_ERR, qede_logtype_driver,\ "[QEDE PMD: (%s)]%s:" fmt, \ (p_dev)->name ? (p_dev)->name : "", \ __func__, \ ##__VA_ARGS__); \ else \ - rte_log(RTE_LOG_NOTICE, RTE_LOGTYPE_PMD,\ + rte_log(RTE_LOG_NOTICE, qede_logtype_driver,\ "[QEDE PMD: (%s)]%s:" fmt, \ (p_dev)->name ? (p_dev)->name : "", \ __func__, \ @@ -34,7 +36,7 @@ do { \ #ifdef RTE_LIBRTE_QEDE_DEBUG_INFO #define DP_INFO(p_dev, fmt, ...) \ - rte_log(RTE_LOG_INFO, RTE_LOGTYPE_PMD, \ + rte_log(RTE_LOG_INFO, qede_logtype_driver, \ "[%s:%d(%s)]" fmt, \ __func__, __LINE__, \ (p_dev)->name ? (p_dev)->name : "", \ @@ -43,30 +45,23 @@ do { \ #define DP_INFO(p_dev, fmt, ...) do { } while (0) #endif -#ifdef RTE_LIBRTE_QEDE_DEBUG_DRIVER -#define DP_VERBOSE(p_dev, module, fmt, ...) \ -do { \ - if ((p_dev)->dp_module & module) \ - rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_PMD, \ - "[%s:%d(%s)]" fmt, \ - __func__, __LINE__, \ - (p_dev)->name ? (p_dev)->name : "", \ - ##__VA_ARGS__); \ -} while (0) -#else -#define DP_VERBOSE(p_dev, fmt, ...) do { } while (0) -#endif +#define DP_VERBOSE(p_dev, module, fmt, ...) \ + do { \ + if ((p_dev)->dp_module & module) \ + rte_log(RTE_LOG_DEBUG, qede_logtype_driver, \ + "[%s:%d(%s)]" fmt, \ + __func__, __LINE__, \ + (p_dev)->name ? (p_dev)->name : "", \ + ##__VA_ARGS__); \ + } while (0) -#define PMD_INIT_LOG(level, edev, fmt, args...) \ - rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \ - "[qede_pmd: %s] %s() " fmt "\n", \ - (edev)->name, __func__, ##args) +extern int qede_logtype_init; +#define PMD_INIT_LOG(level, edev, fmt, args...) \ + rte_log(RTE_LOG_ ## level, qede_logtype_init, \ + "[qede_pmd: %s] %s() " fmt "\n", \ + (edev)->name, __func__, ##args) -#ifdef RTE_LIBRTE_QEDE_DEBUG_INIT #define PMD_INIT_FUNC_TRACE(edev) PMD_INIT_LOG(DEBUG, edev, " >>") -#else -#define PMD_INIT_FUNC_TRACE(edev) do { } while (0) -#endif #ifdef RTE_LIBRTE_QEDE_DEBUG_TX #define PMD_TX_LOG(level, q, fmt, args...) \ -- 2.14.3