From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pg0-f67.google.com (mail-pg0-f67.google.com [74.125.83.67]) by dpdk.org (Postfix) with ESMTP id 60A9A1B168 for ; Tue, 19 Dec 2017 07:38:59 +0100 (CET) Received: by mail-pg0-f67.google.com with SMTP id y6so10192272pgp.4 for ; Mon, 18 Dec 2017 22:38:58 -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=kVUe5VovM1VCyFelR1IOFpF2ctLCo3JODeYgl2Pt3Ow=; b=OyOJoD2tOFFeh/lvX/EhWl2gjGiS/4Fr1nedEtbtkGES3/3VV6EhPBjffX8nRR1UlK PgqhOlTkJMUUW1EvtfzJRFgIEZ4CipKBtDXfvVR6ZJd40bMxwdf/Jl2wNBZIqb0peNut h8LKZfz826p2mqb44MsGw71rFWYxdkpPORwHkoxPJabWG5zCaFCWqQgV5GEY5bGpWI63 ano5Tmwrs6lhIoIZuuOB4Vz2jO/Voy+i9dUWJxYoDQ1R8BqXHUgdj7cmbpnWFksAsTa4 k8y/2R7FkjSf/qsb3CMfXfxgQ92ObkNYoN2omlxoFe+GYn7lrNzQiyjjVC+Oq0f2Iz4W sMrw== 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=kVUe5VovM1VCyFelR1IOFpF2ctLCo3JODeYgl2Pt3Ow=; b=FRCSGk4AnZoIDTrJDPQWm1ovFK8IyXx/l+4vY3S1uQMKPKFwHETn8je7gjU/LETNcS e7SMWuTmK/p4kTTBDAFgspzgAT/PxnHUocoR7R0G/Zyp/bEJiSgoikqZ32YC9jl1O65D 9HpGBL1Xw6xET88fOQMAwvMNknw2N9LjVyvLrIFenJg4ktHOTCViIxH5puwBqVHFAK3S L6UCdqyRoBgAe+mDHqPleUzYE/OZvf3VRicfRvH0yrcVtKVwW86/fQ+P+idHJ/TvIDPC GHP/i5Mm8HXAn0VMCOZ3P6LEgxnpCD3szpf37iC9BeChoOhtvlCmIRO+svyvcfDZ9YsI 5h8g== X-Gm-Message-State: AKGB3mKz4KUqwIuNORf1mMOPk8q9hV2OJx8ZFwEtZpSm1H59Cl6A2AIv AE8URlncGeEsHzJUMP4aEJfArDfb3VA= X-Google-Smtp-Source: ACJfBos/6K5uXp2yUCFdDRTBv92ffuOGsSvPMgZXPa0Y7tWI0uegUYVpJtKHQDNb+IloMKiF+Nh4gw== X-Received: by 10.99.185.4 with SMTP id z4mr2114516pge.212.1513665537616; Mon, 18 Dec 2017 22:38:57 -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.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 18 Dec 2017 22:38:56 -0800 (PST) From: Stephen Hemminger To: dev@dpdk.org Cc: Stephen Hemminger Date: Mon, 18 Dec 2017 22:38:39 -0800 Message-Id: <20171219063840.18981-11-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 10/11] qede: 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 is mostly like others with slightly different logging macros. The semantics were retained, with some minor reformatting. Signed-off-by: Stephen Hemminger --- config/common_base | 2 -- drivers/net/qede/qede_ethdev.c | 15 ++++++++++++ drivers/net/qede/qede_logs.h | 53 +++++++++++++++++++----------------------- 3 files changed, 39 insertions(+), 31 deletions(-) diff --git a/config/common_base b/config/common_base index 61ed718189ec..1718f6a14449 100644 --- a/config/common_base +++ b/config/common_base @@ -398,9 +398,7 @@ CONFIG_RTE_LIBRTE_BOND_DEBUG_ALB_L1=n # QLogic 10G/25G/40G/50G/100G PMD # CONFIG_RTE_LIBRTE_QEDE_PMD=y -CONFIG_RTE_LIBRTE_QEDE_DEBUG_INIT=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_INFO=n -CONFIG_RTE_LIBRTE_QEDE_DEBUG_DRIVER=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_TX=n CONFIG_RTE_LIBRTE_QEDE_DEBUG_RX=n CONFIG_RTE_LIBRTE_QEDE_VF_TX_SWITCH=y diff --git a/drivers/net/qede/qede_ethdev.c b/drivers/net/qede/qede_ethdev.c index 6f5ba2a9270c..cd8dd9c2a676 100644 --- a/drivers/net/qede/qede_ethdev.c +++ b/drivers/net/qede/qede_ethdev.c @@ -11,6 +11,9 @@ #include /* Globals */ +int qede_logtype_init; +int qede_logtype_driver; + static const struct qed_eth_ops *qed_ops; static int64_t timer_period = 1; @@ -2961,3 +2964,15 @@ RTE_PMD_REGISTER_KMOD_DEP(net_qede, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PCI(net_qede_vf, rte_qedevf_pmd); RTE_PMD_REGISTER_PCI_TABLE(net_qede_vf, pci_id_qedevf_map); RTE_PMD_REGISTER_KMOD_DEP(net_qede_vf, "* igb_uio | vfio-pci"); + +RTE_INIT(qede_init_log); +static void +qede_init_log(void) +{ + qede_logtype_init = rte_log_register("pmd.qede.init"); + if (qede_logtype_init >= 0) + rte_log_set_level(qede_logtype_init, RTE_LOG_NOTICE); + qede_logtype_driver = rte_log_register("pmd.qede.driver"); + if (qede_logtype_driver >= 0) + rte_log_set_level(qede_logtype_driver, RTE_LOG_NOTICE); +} diff --git a/drivers/net/qede/qede_logs.h b/drivers/net/qede/qede_logs.h index 15821151cf8a..b7ecf1c276b0 100644 --- a/drivers/net/qede/qede_logs.h +++ b/drivers/net/qede/qede_logs.h @@ -9,23 +9,25 @@ #ifndef _QEDE_LOGS_H_ #define _QEDE_LOGS_H_ -#define DP_ERR(p_dev, fmt, ...) \ - rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD, \ - "[%s:%d(%s)]" fmt, \ - __func__, __LINE__, \ - (p_dev)->name ? (p_dev)->name : "", \ +extern int qede_logtype_driver; + +#define DP_ERR(p_dev, fmt, ...) \ + rte_log(RTE_LOG_ERR, qede_logtype_driver, \ + "[%s:%d(%s)]" fmt, \ + __func__, __LINE__, \ + (p_dev)->name ? (p_dev)->name : "", \ ##__VA_ARGS__) #define DP_NOTICE(p_dev, is_assert, fmt, ...) \ do { \ if (is_assert) \ - rte_log(RTE_LOG_ERR, RTE_LOGTYPE_PMD,\ + rte_log(RTE_LOG_ERR, qede_logtype_driver,\ "[QEDE PMD: (%s)]%s:" fmt, \ (p_dev)->name ? (p_dev)->name : "", \ __func__, \ ##__VA_ARGS__); \ else \ - rte_log(RTE_LOG_NOTICE, RTE_LOGTYPE_PMD,\ + rte_log(RTE_LOG_NOTICE, qede_logtype_driver,\ "[QEDE PMD: (%s)]%s:" fmt, \ (p_dev)->name ? (p_dev)->name : "", \ __func__, \ @@ -34,7 +36,7 @@ do { \ #ifdef RTE_LIBRTE_QEDE_DEBUG_INFO #define DP_INFO(p_dev, fmt, ...) \ - rte_log(RTE_LOG_INFO, RTE_LOGTYPE_PMD, \ + rte_log(RTE_LOG_INFO, qede_logtype_driver, \ "[%s:%d(%s)]" fmt, \ __func__, __LINE__, \ (p_dev)->name ? (p_dev)->name : "", \ @@ -43,30 +45,23 @@ do { \ #define DP_INFO(p_dev, fmt, ...) do { } while (0) #endif -#ifdef RTE_LIBRTE_QEDE_DEBUG_DRIVER -#define DP_VERBOSE(p_dev, module, fmt, ...) \ -do { \ - if ((p_dev)->dp_module & module) \ - rte_log(RTE_LOG_DEBUG, RTE_LOGTYPE_PMD, \ - "[%s:%d(%s)]" fmt, \ - __func__, __LINE__, \ - (p_dev)->name ? (p_dev)->name : "", \ - ##__VA_ARGS__); \ -} while (0) -#else -#define DP_VERBOSE(p_dev, fmt, ...) do { } while (0) -#endif +#define DP_VERBOSE(p_dev, module, fmt, ...) \ + do { \ + if ((p_dev)->dp_module & module) \ + rte_log(RTE_LOG_DEBUG, qede_logtype_driver, \ + "[%s:%d(%s)]" fmt, \ + __func__, __LINE__, \ + (p_dev)->name ? (p_dev)->name : "", \ + ##__VA_ARGS__); \ + } while (0) -#define PMD_INIT_LOG(level, edev, fmt, args...) \ - rte_log(RTE_LOG_ ## level, RTE_LOGTYPE_PMD, \ - "[qede_pmd: %s] %s() " fmt "\n", \ - (edev)->name, __func__, ##args) +extern int qede_logtype_init; +#define PMD_INIT_LOG(level, edev, fmt, args...) \ + rte_log(RTE_LOG_ ## level, qede_logtype_init, \ + "[qede_pmd: %s] %s() " fmt "\n", \ + (edev)->name, __func__, ##args) -#ifdef RTE_LIBRTE_QEDE_DEBUG_INIT #define PMD_INIT_FUNC_TRACE(edev) PMD_INIT_LOG(DEBUG, edev, " >>") -#else -#define PMD_INIT_FUNC_TRACE(edev) do { } while (0) -#endif #ifdef RTE_LIBRTE_QEDE_DEBUG_TX #define PMD_TX_LOG(level, q, fmt, args...) \ -- 2.11.0