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 0D4691B1E7 for ; Tue, 9 Jan 2018 13:11:49 +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:49 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,335,1511856000"; d="scan'208";a="191856126" 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:47 -0800 From: Ferruh Yigit To: Thomas Monjalon , Allain Legacy , Matt Peters , Shijith Thotton , Srisivasubramanian Srinivasan Cc: dev@dpdk.org, Ferruh Yigit , Stephen Hemminger Date: Tue, 9 Jan 2018 12:10:57 +0000 Message-Id: <20180109121057.59750-12-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 12/12] net/liquidio: 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:50 -0000 From: Stephen Hemminger This driver mostly uses the common pattern. Convert this to the dynamic logging. Signed-off-by: Stephen Hemminger --- config/common_base | 2 -- drivers/net/liquidio/lio_ethdev.c | 15 +++++++++++++++ drivers/net/liquidio/lio_logs.h | 20 ++++++++------------ 3 files changed, 23 insertions(+), 14 deletions(-) diff --git a/config/common_base b/config/common_base index 2eee92a01..071bd0ec1 100644 --- a/config/common_base +++ b/config/common_base @@ -311,8 +311,6 @@ CONFIG_RTE_LIBRTE_THUNDERX_NICVF_DEBUG_MBOX=n # Compile burst-oriented Cavium LiquidIO PMD driver # CONFIG_RTE_LIBRTE_LIO_PMD=y -CONFIG_RTE_LIBRTE_LIO_DEBUG_DRIVER=n -CONFIG_RTE_LIBRTE_LIO_DEBUG_INIT=n CONFIG_RTE_LIBRTE_LIO_DEBUG_RX=n CONFIG_RTE_LIBRTE_LIO_DEBUG_TX=n CONFIG_RTE_LIBRTE_LIO_DEBUG_MBOX=n diff --git a/drivers/net/liquidio/lio_ethdev.c b/drivers/net/liquidio/lio_ethdev.c index 6b5d52ef7..b90d0545b 100644 --- a/drivers/net/liquidio/lio_ethdev.c +++ b/drivers/net/liquidio/lio_ethdev.c @@ -43,6 +43,9 @@ #include "lio_ethdev.h" #include "lio_rxtx.h" +int lio_logtype_init; +int lio_logtype_driver; + /* Default RSS key in use */ static uint8_t lio_rss_key[40] = { 0x6D, 0x5A, 0x56, 0xDA, 0x25, 0x5B, 0x0E, 0xC2, @@ -2210,3 +2213,15 @@ static struct rte_pci_driver rte_liovf_pmd = { RTE_PMD_REGISTER_PCI(net_liovf, rte_liovf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_liovf, pci_id_liovf_map); RTE_PMD_REGISTER_KMOD_DEP(net_liovf, "* igb_uio | vfio-pci"); + +RTE_INIT(lio_init_log); +static void +lio_init_log(void) +{ + lio_logtype_init = rte_log_register("pmd.lio.init"); + if (lio_logtype_init >= 0) + rte_log_set_level(lio_logtype_init, RTE_LOG_NOTICE); + lio_logtype_driver = rte_log_register("pmd.lio.driver"); + if (lio_logtype_driver >= 0) + rte_log_set_level(lio_logtype_driver, RTE_LOG_NOTICE); +} diff --git a/drivers/net/liquidio/lio_logs.h b/drivers/net/liquidio/lio_logs.h index a4c9ca4db..c6f9bd15b 100644 --- a/drivers/net/liquidio/lio_logs.h +++ b/drivers/net/liquidio/lio_logs.h @@ -34,8 +34,10 @@ #ifndef _LIO_LOGS_H_ #define _LIO_LOGS_H_ -#define lio_dev_printf(lio_dev, level, fmt, args...) \ - RTE_LOG(level, PMD, "%s" fmt, (lio_dev)->dev_string, ##args) +extern int lio_logtype_driver; +#define lio_dev_printf(lio_dev, level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, lio_logtype_driver, \ + "%s" fmt, (lio_dev)->dev_string, ##args) #define lio_dev_info(lio_dev, fmt, args...) \ lio_dev_printf(lio_dev, INFO, "INFO: " fmt, ##args) @@ -43,22 +45,16 @@ #define lio_dev_err(lio_dev, fmt, args...) \ lio_dev_printf(lio_dev, ERR, "ERROR: %s() " fmt, __func__, ##args) -#define PMD_INIT_LOG(level, fmt, args...) RTE_LOG(level, PMD, fmt, ## args) +extern int lio_logtype_init; +#define PMD_INIT_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, lio_logtype_init, \ + fmt, ## args) /* Enable these through config options */ - -#ifdef RTE_LIBRTE_LIO_DEBUG_INIT #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, "%s() >>\n", __func__) -#else /* !RTE_LIBRTE_LIO_DEBUG_INIT */ -#define PMD_INIT_FUNC_TRACE() do { } while (0) -#endif /* RTE_LIBRTE_LIO_DEBUG_INIT */ -#ifdef RTE_LIBRTE_LIO_DEBUG_DRIVER #define lio_dev_dbg(lio_dev, fmt, args...) \ lio_dev_printf(lio_dev, DEBUG, "DEBUG: %s() " fmt, __func__, ##args) -#else /* !RTE_LIBRTE_LIO_DEBUG_DRIVER */ -#define lio_dev_dbg(lio_dev, fmt, args...) do { } while (0) -#endif /* RTE_LIBRTE_LIO_DEBUG_DRIVER */ #ifdef RTE_LIBRTE_LIO_DEBUG_RX #define PMD_RX_LOG(lio_dev, level, fmt, args...) \ -- 2.14.3