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 6E6A17D19 for ; Tue, 19 Dec 2017 07:38:52 +0100 (CET) Received: by mail-pl0-f68.google.com with SMTP id 62so4978778pld.7 for ; Mon, 18 Dec 2017 22:38:52 -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=fwFJ0gb44kkl97yYetzPxwcpiEgwtD0OpbNLOE2aNd4=; b=Rx5SxzWQt8z2S66U/uG3v/ZhDJSGlhBk2bzNZ31wpL2IppSk6NM/U4qOyX/hmDPFQJ 3VnzUDLyxwzQwjsSOS9wg/2yR7o3mGVZR4jOQX1HeQgAUQE0gFlUf2hTmKSUJ0uIgEra gwVx+Slh+EMLDYQYZmkm5P+qP77WQ84UkI0vaQ7Q+SBKDBtj+GuIrP3/9YtQaPKsViTC DiBLki6VU7wLgLJZCdLRQrs6DglZiQxZ0UCmGny1HSCENSz0b3Un0fYpyRnR4wzpvu1C 35Kt3zlvHNaXEfUTPfz6JEiw+moIOsAx5Rkf2OlqckqJXrRDaEdw/FiyGVA83m4sS9GJ 8hsw== 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=fwFJ0gb44kkl97yYetzPxwcpiEgwtD0OpbNLOE2aNd4=; b=BL7fUoXZA0gR7G4NazAle1vYPE4n8gZl4Tylag7+J7uzHkTYjTnKP98DAP6UyWWrMb DTqA2F6QQ2DFJ73VD0/Ld+m9RSrzXTxRoktbUMgPEHcyz2X3UAs9XUpEfzcNBw8r37qC hLUeFvr0xHaekNoZbP24puFa/+CW2jyTKOmpMZkWzJs/wfXXco/8MPyDscR4Z5clztOB RzD+BwjC9UURGNUTr+PnIQCiIsSSu3o04pOfm0V6t3CopbvH57jAjwmYrddmpDwZj9P1 RFPo7cgku7WEqss4hN3RYnrzKruTNPBC9WoaQhv0rKV+S+st1MVpzn7GQ8YDq2PbiqB5 Watw== X-Gm-Message-State: AKGB3mKzLDaUSF91uxo446w1JtSJm3w5c4V01eSUXrg83dFq+G7O42lW JEjQYYytJmtUI0Wb51nJgX+WsmztM8w= X-Google-Smtp-Source: ACJfBouyPNypeKrfkyKfrHF3ac2Xeti4avp8w8LgxHn+KEpxaUU2Yxhpjgma1eBCQ2GKIdgP5cqaJw== X-Received: by 10.84.194.228 with SMTP id h91mr2205183pld.177.1513665531375; Mon, 18 Dec 2017 22:38:51 -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.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 22:38:50 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 18 Dec 2017 22:38:34 -0800 Message-Id: <20171219063840.18981-6-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 05/11] e1000: 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:52 -0000 Signed-off-by: Stephen Hemminger --- config/common_base | 2 -- drivers/net/e1000/e1000_logs.h | 16 ++++++---------- drivers/net/e1000/em_ethdev.c | 15 +++++++++++++++ 3 files changed, 21 insertions(+), 12 deletions(-) diff --git a/config/common_base b/config/common_base index 333689f052f5..d2564075706d 100644 --- a/config/common_base +++ b/config/common_base @@ -177,11 +177,9 @@ CONFIG_RTE_LIBRTE_ENA_COM_DEBUG=n # CONFIG_RTE_LIBRTE_EM_PMD=y CONFIG_RTE_LIBRTE_IGB_PMD=y -CONFIG_RTE_LIBRTE_E1000_DEBUG_INIT=n CONFIG_RTE_LIBRTE_E1000_DEBUG_RX=n CONFIG_RTE_LIBRTE_E1000_DEBUG_TX=n CONFIG_RTE_LIBRTE_E1000_DEBUG_TX_FREE=n -CONFIG_RTE_LIBRTE_E1000_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_E1000_PF_DISABLE_STRIP_CRC=n # diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h index 81e7bf52ce54..c6be294a51da 100644 --- a/drivers/net/e1000/e1000_logs.h +++ b/drivers/net/e1000/e1000_logs.h @@ -34,14 +34,12 @@ #ifndef _E1000_LOGS_H_ #define _E1000_LOGS_H_ +extern int e1000_logtype_init; #define PMD_INIT_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ##args) + rte_log(RTE_LOG_ ## level, e1000_logtype_init, \ + "%s(): " fmt "\n", __func__, ##args) -#ifdef RTE_LIBRTE_E1000_DEBUG_INIT #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") -#else -#define PMD_INIT_FUNC_TRACE() do { } while (0) -#endif #ifdef RTE_LIBRTE_E1000_DEBUG_RX #define PMD_RX_LOG(level, fmt, args...) \ @@ -64,12 +62,10 @@ #define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0) #endif -#ifdef RTE_LIBRTE_E1000_DEBUG_DRIVER +extern int e1000_logtype_driver; #define PMD_DRV_LOG_RAW(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) -#else -#define PMD_DRV_LOG_RAW(level, fmt, args...) do { } while (0) -#endif + rte_log(RTE_LOG_ ## level, e1000_logtype_driver, "%s(): " fmt, \ + __func__, ## args) #define PMD_DRV_LOG(level, fmt, args...) \ PMD_DRV_LOG_RAW(level, fmt "\n", ## args) diff --git a/drivers/net/e1000/em_ethdev.c b/drivers/net/e1000/em_ethdev.c index a0c3b4dc50a7..19e827fb5ac8 100644 --- a/drivers/net/e1000/em_ethdev.c +++ b/drivers/net/e1000/em_ethdev.c @@ -134,6 +134,9 @@ static int eth_em_set_mc_addr_list(struct rte_eth_dev *dev, static enum e1000_fc_mode em_fc_setting = e1000_fc_full; +int e1000_logtype_init; +int e1000_logtype_driver; + /* * The set of PCI devices this driver supports */ @@ -1875,3 +1878,15 @@ eth_em_set_mc_addr_list(struct rte_eth_dev *dev, RTE_PMD_REGISTER_PCI(net_e1000_em, rte_em_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_e1000_em, pci_id_em_map); RTE_PMD_REGISTER_KMOD_DEP(net_e1000_em, "* igb_uio | uio_pci_generic | vfio-pci"); + +RTE_INIT(e1000_init_log); +static void +e1000_init_log(void) +{ + e1000_logtype_init = rte_log_register("pmd.e1000.init"); + if (e1000_logtype_init >= 0) + rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE); + e1000_logtype_driver = rte_log_register("pmd.e1000.driver"); + if (e1000_logtype_driver >= 0) + rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE); +} -- 2.11.0