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 574631B171 for ; Tue, 9 Jan 2018 13:11:10 +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:09 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,335,1511856000"; d="scan'208";a="191855813" 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:07 -0800 From: Ferruh Yigit To: Thomas Monjalon , Allain Legacy , Matt Peters Cc: dev@dpdk.org, Ferruh Yigit , Stephen Hemminger Date: Tue, 9 Jan 2018 12:10:46 +0000 Message-Id: <20180109121057.59750-1-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20171219063840.18981-1-stephen@networkplumber.org> References: <20171219063840.18981-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH v2 01/12] net/avp: 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:10 -0000 From: Stephen Hemminger All PMD should be using dynamic log levels. Signed-off-by: Stephen Hemminger --- config/common_base | 1 - drivers/net/avp/avp_ethdev.c | 10 ++++++++++ drivers/net/avp/avp_logs.h | 9 ++++----- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/config/common_base b/config/common_base index b8ee8f91c..bee31e752 100644 --- a/config/common_base +++ b/config/common_base @@ -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 # diff --git a/drivers/net/avp/avp_ethdev.c b/drivers/net/avp/avp_ethdev.c index 9b342bfa3..deb6f355d 100644 --- a/drivers/net/avp/avp_ethdev.c +++ b/drivers/net/avp/avp_ethdev.c @@ -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); +} diff --git a/drivers/net/avp/avp_logs.h b/drivers/net/avp/avp_logs.h index 252cab7da..e29394d58 100644 --- a/drivers/net/avp/avp_logs.h +++ b/drivers/net/avp/avp_logs.h @@ -49,11 +49,10 @@ #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_ */ -- 2.14.3