From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id 48F5DA0471 for ; Tue, 16 Jul 2019 17:40:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id D5DC91B96E; Tue, 16 Jul 2019 17:40:30 +0200 (CEST) Received: from mail-pg1-f195.google.com (mail-pg1-f195.google.com [209.85.215.195]) by dpdk.org (Postfix) with ESMTP id 4D34D4C8D for ; Tue, 16 Jul 2019 17:40:28 +0200 (CEST) Received: by mail-pg1-f195.google.com with SMTP id n9so3410576pgc.1 for ; Tue, 16 Jul 2019 08:40:28 -0700 (PDT) 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 :mime-version:content-transfer-encoding; bh=ZXSV2Nlu4D0/iwC5xtg7RKMm+HIubjJ+bJkUF1sKjvs=; b=ORU/sKgi/m+jtwZx0JXdxFqXYahUAj/K009OOI5WvVD6eGo+GKqsNV+CQR8ZzJzGEh h2jJN6688s13Gj8dkcYkIHb1L59syg2VxCzJ6UAPdQpPN7b4eV0NgVZHaZ3SEVMPmDgk uzFY5iLX5J0tG6fNjV6KeZpoj+CsYlalyOy5BxF4GZ+paq0ynyqs8VC1+h2nLmwXa14E iK0J/MYZZOUcMhWFCCgUZS+jmb0lQglpRfdae4re5+DgJdjAA5IP23sqMvpfVoLRlCkS mH/0YEvz3UUQCwIZT87BHKGKHsT58s9gBXfWOKWXVMNgMFAQ7OgG8V9GTOYYYOUlZuQi 73Fg== 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:mime-version:content-transfer-encoding; bh=ZXSV2Nlu4D0/iwC5xtg7RKMm+HIubjJ+bJkUF1sKjvs=; b=N6s7DMofSC54NRQ/ctKrmEqYRLzi75sa1mpCIfLA1FS37Z09PkEHmkx2eBYT9jlX/7 rOvbfBpsLASGmOO4Uf3raP+L9ETMUIq+NL5ZH3eIczfRQ4nKwbI4RQq88XpCmL/7km4c svupS699y+PJ4e6ogskZSzyiNK8DFGFrGgc8GPBrJMEoFw6cw29s2mdj+D5iToO4ntA6 oiOs8ZRC7X3i5hUfJBBZOgCySFKnZ3/EimHwfIkYAAnkcwf868h+0zssdsj7TAduMouq c8bXj0yCiaJYpDFjkI1UTl9Ltdzkl16/ImU/fGEl38EeX5KrUemSw7xXHbLidkNseFBK s5GQ== X-Gm-Message-State: APjAAAWR7PY+Mq7pNjMLPtn3/aw/b1C5VC492wFVJj5hqNOklCwBWZ9J csporsuZ4E7mpu6XqcVeI4U= X-Google-Smtp-Source: APXvYqwx1Qxx3519pUzaTBHOsXBtVvREFIYoch20X6Pbl9y0zwe7lcP+4dg+byl/2NS/h9Nq8jVxzw== X-Received: by 2002:a63:4612:: with SMTP id t18mr25684015pga.85.1563291627091; Tue, 16 Jul 2019 08:40:27 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id b19sm20700833pgh.57.2019.07.16.08.40.25 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 08:40:26 -0700 (PDT) From: Stephen Hemminger To: wenzhuo.lu@intel.com, konstantin.ananyev@intel.com, beilei.xing@intel.com, qi.z.zhang@intel.com, xiao.w.wang@intel.com, jingjing.wu@intel.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 16 Jul 2019 08:40:08 -0700 Message-Id: <20190716154013.6974-2-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190716154013.6974-1-stephen@networkplumber.org> References: <20190716154013.6974-1-stephen@networkplumber.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 1/6] net/e1000: use dynamic log type for tx/rx debug 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: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The generic RTE_LOGTYPE_PMD is a historical relic and should not be used. Every driver should register the logtypes for itself. Signed-off-by: Stephen Hemminger --- drivers/net/e1000/e1000_logs.c | 48 +++++++++++++++++++++++++++------- drivers/net/e1000/e1000_logs.h | 25 +++++++++++------- 2 files changed, 55 insertions(+), 18 deletions(-) diff --git a/drivers/net/e1000/e1000_logs.c b/drivers/net/e1000/e1000_logs.c index 22173939f5e5..05f883dd201b 100644 --- a/drivers/net/e1000/e1000_logs.c +++ b/drivers/net/e1000/e1000_logs.c @@ -8,19 +8,49 @@ int e1000_logtype_init; int e1000_logtype_driver; +#ifdef RTE_LIBRTE_E1000_DEBUG_RX +int e1000_logtype_rx; +#endif +#ifdef RTE_LIBRTE_E1000_DEBUG_TX +int e1000_logtype_tx; +#endif +#ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE +int e1000_logtype_tx_free; +#endif + /* avoids double registering of logs if EM and IGB drivers are in use */ static int e1000_log_initialized; void e1000_igb_init_log(void) { - if (!e1000_log_initialized) { - e1000_logtype_init = rte_log_register("pmd.net.e1000.init"); - if (e1000_logtype_init >= 0) - rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE); - e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver"); - if (e1000_logtype_driver >= 0) - rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE); - e1000_log_initialized = 1; - } + if (e1000_log_initialized) + return; + + e1000_logtype_init = rte_log_register("pmd.net.e1000.init"); + if (e1000_logtype_init >= 0) + rte_log_set_level(e1000_logtype_init, RTE_LOG_NOTICE); + e1000_logtype_driver = rte_log_register("pmd.net.e1000.driver"); + if (e1000_logtype_driver >= 0) + rte_log_set_level(e1000_logtype_driver, RTE_LOG_NOTICE); + +#ifdef RTE_LIBRTE_E1000_DEBUG_RX + e1000_logtype_rx = rte_log_register("pmd.net.e1000.rx"); + if (e1000_logtype_rx >= 0) + rte_log_set_level(e1000_logtype_rx, RTE_LOG_NOTICE); +#endif + +#ifdef RTE_LIBRTE_E1000_DEBUG_TX + e1000_logtype_tx = rte_log_register("pmd.net.e1000.tx"); + if (e1000_logtype_tx >= 0) + rte_log_set_level(e1000_logtype_tx, RTE_LOG_NOTICE); +#endif + +#ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE + e1000_logtype_tx_free = rte_log_register("pmd.net.e1000.tx_free"); + if (e1000_logtype_tx_free >= 0) + rte_log_set_level(e1000_logtype_tx_free, RTE_LOG_NOTICE); +#endif + + e1000_log_initialized = 1; } diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h index 69d3d31186e0..2612134f38a0 100644 --- a/drivers/net/e1000/e1000_logs.h +++ b/drivers/net/e1000/e1000_logs.h @@ -8,6 +8,7 @@ #include extern int e1000_logtype_init; + #define PMD_INIT_LOG(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, e1000_logtype_init, \ "%s(): " fmt "\n", __func__, ##args) @@ -15,24 +16,30 @@ extern int e1000_logtype_init; #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_E1000_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int e1000_logtype_rx; +#define PMD_RX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, e1000_logtype_rx, \ + "%s(): " fmt "\n", __func__, ## args) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while(0) +#define PMD_RX_LOG(level, fmt, args...) do { } while (0) #endif #ifdef RTE_LIBRTE_E1000_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int e1000_logtype_tx; +#define PMD_TX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, e1000_logtype_tx, \ + "%s(): " fmt "\n", __func__, ## args) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while(0) +#define PMD_TX_LOG(level, fmt, args...) do { } while (0) #endif #ifdef RTE_LIBRTE_E1000_DEBUG_TX_FREE -#define PMD_TX_FREE_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int e1000_logtype_tx_free; +#define PMD_TX_FREE_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, e1000_logtype_tx_free, \ + "%s(): " fmt "\n", __func__, ## args) #else -#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0) +#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0) #endif extern int e1000_logtype_driver; -- 2.20.1