From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pl0-f68.google.com (mail-pl0-f68.google.com [209.85.160.68]) by dpdk.org (Postfix) with ESMTP id 13EF51B012 for ; Tue, 19 Dec 2017 07:38:49 +0100 (CET) Received: by mail-pl0-f68.google.com with SMTP id bi12so6419756plb.6 for ; Mon, 18 Dec 2017 22:38:49 -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=+ZXWRLz47VlDDzr9iAopGfnsSG/l0BqhYKct6OR8Qd8=; b=ELHFPOuqKAC4DwofO26R+VkA8OiLxc1PdI5zdk7BGxcOV/4WuC+VDiz5tHcM+NYsL8 QvM9ztFxDUiHumx3RYLQTpgOmD4YqrcxW7GUj3HcXBi2n+sI1rnnph2GWEeUx9Nr32gq vb+/bLlzcoFuSRDIt1w6ef+fnmRy8SDbCYgRrDIEHq4eL6kusqXW3cO83X3ZqE8z0iIP vHUq54vVVrQbb6Aeq3V7367DW479zNCDuSFjmgiQSsHQFr++RdMvCa0D6IspBs4jjbIV xEymAY210boTyZPNK2VAl5jKT9b4har4/WIpLOUIGwDAoEHjNeriNIq+Wfzewf9aBRCZ R5UQ== 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=+ZXWRLz47VlDDzr9iAopGfnsSG/l0BqhYKct6OR8Qd8=; b=QKjUHsnvqjH1BCGrrHAm1TrzccsPcOefirD3hT2ieO/qBz/Ul6jhXAnhOshvFzZB+K Bonj8L8O5G/f2H4tV64wCcFPUPG5bW2LuSoR/phbW84H+6fjwxHsqKn3xLBHkhRhbLi2 mGcUf4WI+tja2kXHstDHT2suKX10t/ucM0HBw9d40OX9uLZKa9NaSuLr1LjH/wusQzC6 FLpxIPgIt8ro/tZ3s1h6vrvZuN6ERCzOlYDMJ3Bcuc2+imzEqEc9CmmdlIT4AuO/kd8A wAmhRsXmQzcpKJ/2FoDdzX6rYGttSfzDv3Ch2kKosXx6USPHdiGJC4ZavdfmpPOCKsXz iVZQ== X-Gm-Message-State: AKGB3mIHZqKwVKGRftXumdF6d+DDUwtjOvQIB8CD3GIOd5k/woW6ayKZ tsAV1oXMDL3PXNkDx6uUjvBmKRD8ESA= X-Google-Smtp-Source: ACJfBotD+p+Sv+kdOzcb4Z6aLCmi/00GnMAkWh0y2b6EJ4NGJmQw6DjkwWcOekrbeG6HHXNTfyRFJA== X-Received: by 10.84.211.143 with SMTP id c15mr2311075pli.100.1513665528738; Mon, 18 Dec 2017 22:38:48 -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.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 22:38:46 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 18 Dec 2017 22:38:32 -0800 Message-Id: <20171219063840.18981-4-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 03/11] vmxnet3: 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:38:50 -0000 Replace compile time configuration with runtime. Signed-off-by: Stephen Hemminger --- config/common_base | 2 -- drivers/net/vmxnet3/vmxnet3_ethdev.c | 15 +++++++++++++++ drivers/net/vmxnet3/vmxnet3_logs.h | 17 ++++++----------- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/config/common_base b/config/common_base index 82d1f9ac47ef..8b63f205d9b9 100644 --- a/config/common_base +++ b/config/common_base @@ -380,11 +380,9 @@ CONFIG_RTE_VIRTIO_USER=n # Compile burst-oriented VMXNET3 PMD driver # CONFIG_RTE_LIBRTE_VMXNET3_PMD=y -CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_INIT=n CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_RX=n CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX=n CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE=n -CONFIG_RTE_LIBRTE_VMXNET3_DEBUG_DRIVER=n # # Compile example software rings based PMD diff --git a/drivers/net/vmxnet3/vmxnet3_ethdev.c b/drivers/net/vmxnet3/vmxnet3_ethdev.c index 82d59ca8caa2..217399df9e1d 100644 --- a/drivers/net/vmxnet3/vmxnet3_ethdev.c +++ b/drivers/net/vmxnet3/vmxnet3_ethdev.c @@ -106,6 +106,9 @@ static void vmxnet3_mac_addr_set(struct rte_eth_dev *dev, struct ether_addr *mac_addr); static void vmxnet3_interrupt_handler(void *param); +int vmxnet3_logtype_init; +int vmxnet3_logtype_driver; + /* * The set of PCI devices this driver supports */ @@ -1374,3 +1377,15 @@ vmxnet3_interrupt_handler(void *param) RTE_PMD_REGISTER_PCI(net_vmxnet3, rte_vmxnet3_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_vmxnet3, pci_id_vmxnet3_map); RTE_PMD_REGISTER_KMOD_DEP(net_vmxnet3, "* igb_uio | uio_pci_generic | vfio-pci"); + +RTE_INIT(vmxnet3_init_log); +static void +vmxnet3_init_log(void) +{ + vmxnet3_logtype_init = rte_log_register("pmd.vmxnet3.init"); + if (vmxnet3_logtype_init >= 0) + rte_log_set_level(vmxnet3_logtype_init, RTE_LOG_NOTICE); + vmxnet3_logtype_driver = rte_log_register("pmd.vmxnet3.driver"); + if (vmxnet3_logtype_driver >= 0) + rte_log_set_level(vmxnet3_logtype_driver, RTE_LOG_NOTICE); +} diff --git a/drivers/net/vmxnet3/vmxnet3_logs.h b/drivers/net/vmxnet3/vmxnet3_logs.h index 82639a083356..c6233eea34e4 100644 --- a/drivers/net/vmxnet3/vmxnet3_logs.h +++ b/drivers/net/vmxnet3/vmxnet3_logs.h @@ -34,14 +34,11 @@ #ifndef _VMXNET3_LOGS_H_ #define _VMXNET3_LOGS_H_ -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_INIT +extern int vmxnet3_logtype_init; #define PMD_INIT_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) + rte_log(RTE_LOG_ ## level, vmxnet3_logtype_driver, \ + "%s(): " fmt "\n", __func__, ## args) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") -#else -#define PMD_INIT_LOG(level, fmt, args...) do { } while(0) -#define PMD_INIT_FUNC_TRACE() do { } while(0) -#endif #ifdef RTE_LIBRTE_VMXNET3_DEBUG_RX #define PMD_RX_LOG(level, fmt, args...) \ @@ -64,11 +61,9 @@ #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0) #endif -#ifdef RTE_LIBRTE_VMXNET3_DEBUG_DRIVER +extern int vmxnet3_logtype_driver; #define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) -#else -#define PMD_DRV_LOG(level, fmt, args...) do { } while(0) -#endif + rte_log(RTE_LOG_ ## level, vmxnet3_logtype_driver, \ + "%s(): " fmt "\n", __func__, ## args) #endif /* _VMXNET3_LOGS_H_ */ -- 2.11.0