From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf0-f196.google.com (mail-pf0-f196.google.com [209.85.192.196]) by dpdk.org (Postfix) with ESMTP id D16221B01C for ; Tue, 19 Dec 2017 07:38:59 +0100 (CET) Received: by mail-pf0-f196.google.com with SMTP id j28so10758581pfk.8 for ; Mon, 18 Dec 2017 22:38:59 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=networkplumber-org.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=QkmPkzTJJ0rQq0h5SsmTxNo5jeFc8a/FBMwrb4WybpY=; b=G/5JKmofRVc8Ktbei6A5JdvKxo6LkYYpuh/nDD0CJxiX1M5nrzQzxAzb8IewYA0dXp FbOkr3t69SnoknLHpFCQvz/mfB4AKh5WncQv13+KPM6tbKbJ3ZXx5kOfwhAwj/9xELgw 1SRRmBf27roM4FXyYXAdo4YIqfH82kk6O4XTpuiwevEOweEDJe+eBlItFB0P+ucWv2lQ 1DMe7atRm/PzRdDLt1SFe3w5vP3Ge/y8iibcYTDwJ2r+L3A7GQ5PPs4/S4LNZHBmK9Jg UG3CfkeTDv9ku14X0KaZ9L3fjFCixF0FQJOu01z7yHdVr4+FxN4j8FcXira6PvKGWQa5 KdvQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=QkmPkzTJJ0rQq0h5SsmTxNo5jeFc8a/FBMwrb4WybpY=; b=PSJHCkkW2opISm0vTe8m5D/zWdn8o7nG59aT40tw8X/juFm0pCr4ZOl19XJOzKuY0n EKoYv5rqYG8d6vDDzXAgsMvJtH1Btp5ZJTWdkr59DU5ZRP+WWtv1Hd9EAix+xvxnfN9h ykPCUn5KMiW6J295X2vzX/BEx1FSlAhgQ7UbAI8y+SPO/L4dm7phbbCFbnI+VdaGOSDG iYolojE8jE1h5P95p8Zw8BO2X2qItWubSLFijVOACVGjkVL9fvbREaz2EC/JRdhyor1o YvBusNuu1vq1ocCQP3tgEJPg/xD1RVR0b5P7Xr1g2ig0qYYo0DrF3a3UCP0pWudjR18g 3Raw== X-Gm-Message-State: AKGB3mJHf/r7qKtJW01g5ljh45U0vU2L0mcXWUKsE0SP9ZtwfyUS1Ow+ RzAlxkAR2INfunlnfJCNKBQv9Df22YM= X-Google-Smtp-Source: ACJfBotYsWE+Um81B2c+GNJrIzM43JRZ66obY36a+3yJgskwK/zNNVE7CCb3m98hqNPAy5yGcEA6wA== X-Received: by 10.101.81.11 with SMTP id f11mr2009463pgq.432.1513665538523; Mon, 18 Dec 2017 22:38:58 -0800 (PST) Received: from xeon-e3.lan (204-195-18-133.wavecable.com. [204.195.18.133]) by smtp.gmail.com with ESMTPSA id d9sm31288842pfk.117.2017.12.18.22.38.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 22:38:57 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 18 Dec 2017 22:38:40 -0800 Message-Id: <20171219063840.18981-12-stephen@networkplumber.org> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20171219063840.18981-1-stephen@networkplumber.org> References: <20171219063840.18981-1-stephen@networkplumber.org> Subject: [dpdk-dev] [PATCH 11/11] lio: 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, 19 Dec 2017 06:39:00 -0000 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 1718f6a14449..ee716adc4e0f 100644 --- a/config/common_base +++ b/config/common_base @@ -312,8 +312,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 84b8a3288d12..5ad7c9902af4 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, @@ -2180,3 +2183,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 a4c9ca4db291..c6f9bd15bd79 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.11.0