From patchwork Tue Jul 16 15:40:10 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stephen Hemminger X-Patchwork-Id: 56517 X-Patchwork-Delegate: ferruh.yigit@amd.com Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 0E8551B9C9; Tue, 16 Jul 2019 17:40:36 +0200 (CEST) Received: from mail-pl1-f194.google.com (mail-pl1-f194.google.com [209.85.214.194]) by dpdk.org (Postfix) with ESMTP id 25DA61B993 for ; Tue, 16 Jul 2019 17:40:31 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id az7so10305727plb.5 for ; Tue, 16 Jul 2019 08:40:31 -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=86DlfqbCTtipSA4feDoZUp7m1s8v+Lm2is1qKP3dRPs=; b=hO72xGSTvhAjfz/xXRt3g9A87KGwE1bKHkBzEY3CnwI0/PUsAPv1gC/NTCkJYB9PMk UYWP+QkpT7TnlqnsQnh9z1DZ4sRuwvdpOlywWjA0iN9wu3tSliKxu9zFNlY67pufKSzi uapW/2Zd8nwCFh4hbvCVfCJNBywwZa1p+tubQkie3cbEPR8G9GeXIYFnEtYO0OLAgL8O wvQAJ7hnIF7quD+V2jVfw5PH1rMks2NhsMGd5qcBQo5XzgFyWDw2Fd97w5xledp7Ljpl 12cH8Ges4jWHBIc9d+WW1/q6On48eiAYF+BpEzrR1LI7v6sJmgv3dA0uWpZsuytmcwx2 8e1Q== 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=86DlfqbCTtipSA4feDoZUp7m1s8v+Lm2is1qKP3dRPs=; b=MoK46PzoY2KjlnFpDukDmgaWBWoHFXXMwWB2eBW0p8BbRLXEAywLpDNU0Cx1pZez/T ygaiJIqqyAXVYxgrgl/s555885H7LyE9OCo2H0933BwMTdqEyEAs8gUpTeE92wbaE2TZ VwoMv+rL/0qMoUBG28Y5jDOv7wus6f2oGB+bx3cN2QCQZ205tJfQFyQQFixkPKRfmf1X H885n5PKsXgDxDLSkSsH+HHwXEY1NYv4VXuRdQOYNR18bhC5l27d+Zavv3bAkE+N5RmF 22VurcwRq7hf9T/A10ET8fJBefwAUZa/XKYudj/gmcj1vn9eX+8dkfDDNOMiIpMmhXYf JbQQ== X-Gm-Message-State: APjAAAU57kmnRk98lDf/e9CDuoM/URPJNKR0dS2SQv2atlpMljOpFa9i b51SXvdXbhRfzJ4FAOZjDFI= X-Google-Smtp-Source: APXvYqzQ5rfeUEmraafIXOzfDnCPr/v/GY3Pw8bw0pQ3eSFASOyfK/iahlioNwSc0vcyCJZqe2rFPg== X-Received: by 2002:a17:902:6ac6:: with SMTP id i6mr36724345plt.233.1563291630235; Tue, 16 Jul 2019 08:40:30 -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.28 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 08:40:28 -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:10 -0700 Message-Id: <20190716154013.6974-4-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 Subject: [dpdk-dev] [PATCH 3/6] net/ixgbe: 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 must dynamic log types. Signed-off-by: Stephen Hemminger --- drivers/net/ixgbe/ixgbe_ethdev.c | 27 +++++++++++++++++++++++++++ drivers/net/ixgbe/ixgbe_logs.h | 24 +++++++++++++++--------- drivers/net/ixgbe/ixgbe_pf.c | 19 ++++++++----------- 3 files changed, 50 insertions(+), 20 deletions(-) diff --git a/drivers/net/ixgbe/ixgbe_ethdev.c b/drivers/net/ixgbe/ixgbe_ethdev.c index 22c5b2c5cabd..5c84fd046752 100644 --- a/drivers/net/ixgbe/ixgbe_ethdev.c +++ b/drivers/net/ixgbe/ixgbe_ethdev.c @@ -419,6 +419,16 @@ static void ixgbe_l2_tunnel_conf(struct rte_eth_dev *dev); int ixgbe_logtype_init; int ixgbe_logtype_driver; +#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX +int ixgbe_logtype_rx; +#endif +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX +int ixgbe_logtype_tx; +#endif +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE +int ixgbe_logtype_tx_free; +#endif + /* * The set of PCI devices this driver supports */ @@ -8732,4 +8742,21 @@ RTE_INIT(ixgbe_init_log) ixgbe_logtype_driver = rte_log_register("pmd.net.ixgbe.driver"); if (ixgbe_logtype_driver >= 0) rte_log_set_level(ixgbe_logtype_driver, RTE_LOG_NOTICE); +#ifdef RTE_LIBRTE_IXGBE_DEBUG_RX + ixgbe_logtype_rx = rte_log_register("pmd.net.ixgbe.rx"); + if (ixgbe_logtype_rx >= 0) + rte_log_set_level(ixgbe_logtype_rx, RTE_LOG_NOTICE); +#endif + +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX + ixgbe_logtype_tx = rte_log_register("pmd.net.ixgbe.tx"); + if (ixgbe_logtype_tx >= 0) + rte_log_set_level(ixgbe_logtype_tx, RTE_LOG_NOTICE); +#endif + +#ifdef RTE_LIBRTE_IXGBE_DEBUG_TX_FREE + ixgbe_logtype_tx_free = rte_log_register("pmd.net.ixgbe.tx_free"); + if (ixgbe_logtype_tx_free >= 0) + rte_log_set_level(ixgbe_logtype_tx_free, RTE_LOG_NOTICE); +#endif } diff --git a/drivers/net/ixgbe/ixgbe_logs.h b/drivers/net/ixgbe/ixgbe_logs.h index dc73e9bded35..2a279d109813 100644 --- a/drivers/net/ixgbe/ixgbe_logs.h +++ b/drivers/net/ixgbe/ixgbe_logs.h @@ -13,24 +13,30 @@ extern int ixgbe_logtype_init; #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_IXGBE_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ixgbe_logtype_rx; +#define PMD_RX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ixgbe_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_IXGBE_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ixgbe_logtype_tx; +#define PMD_TX_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ixgbe_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_IXGBE_DEBUG_TX_FREE -#define PMD_TX_FREE_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt "\n", __func__, ## args) +extern int ixgbe_logtype_tx_free; +#define PMD_TX_FREE_LOG(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, ixgbe_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 ixgbe_logtype_driver; diff --git a/drivers/net/ixgbe/ixgbe_pf.c b/drivers/net/ixgbe/ixgbe_pf.c index c88d56e24564..a9e77f21c0de 100644 --- a/drivers/net/ixgbe/ixgbe_pf.c +++ b/drivers/net/ixgbe/ixgbe_pf.c @@ -161,16 +161,14 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev) struct ixgbe_ethertype_filter ethertype_filter; if (!hw->mac.ops.set_ethertype_anti_spoofing) { - RTE_LOG(INFO, PMD, "ether type anti-spoofing is not" - " supported.\n"); + PMD_DRV_LOG(INFO, "ether type anti-spoofing is not supported.\n"); return; } i = ixgbe_ethertype_filter_lookup(filter_info, IXGBE_ETHERTYPE_FLOW_CTRL); if (i >= 0) { - RTE_LOG(ERR, PMD, "A ether type filter" - " entity for flow control already exists!\n"); + PMD_DRV_LOG(ERR, "A ether type filter entity for flow control already exists!\n"); return; } @@ -183,8 +181,7 @@ ixgbe_add_tx_flow_control_drop_filter(struct rte_eth_dev *eth_dev) i = ixgbe_ethertype_filter_insert(filter_info, ðertype_filter); if (i < 0) { - RTE_LOG(ERR, PMD, "Cannot find an unused ether type filter" - " entity for flow control.\n"); + PMD_DRV_LOG(ERR, "Cannot find an unused ether type filter entity for flow control.\n"); return; } @@ -415,7 +412,7 @@ ixgbe_disable_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf) vmolr = IXGBE_READ_REG(hw, IXGBE_VMOLR(vf)); - RTE_LOG(INFO, PMD, "VF %u: disabling multicast promiscuous\n", vf); + PMD_DRV_LOG(INFO, "VF %u: disabling multicast promiscuous\n", vf); vmolr &= ~IXGBE_VMOLR_MPE; @@ -588,7 +585,7 @@ ixgbe_negotiate_vf_api(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) break; } - RTE_LOG(ERR, PMD, "Negotiate invalid api version %u from VF %d\n", + PMD_DRV_LOG(ERR, "Negotiate invalid api version %u from VF %d\n", api_version, vf); return -1; @@ -635,7 +632,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) switch (eth_conf->txmode.mq_mode) { case ETH_MQ_TX_NONE: case ETH_MQ_TX_DCB: - RTE_LOG(ERR, PMD, "PF must work with virtualization for VF %u" + PMD_DRV_LOG(ERR, "PF must work with virtualization for VF %u" ", but its tx mode = %d\n", vf, eth_conf->txmode.mq_mode); return -1; @@ -670,7 +667,7 @@ ixgbe_get_vf_queues(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) break; default: - RTE_LOG(ERR, PMD, "PF work with invalid mode = %d\n", + PMD_DRV_LOG(ERR, "PF work with invalid mode = %d\n", eth_conf->txmode.mq_mode); return -1; } @@ -725,7 +722,7 @@ ixgbe_set_vf_mc_promisc(struct rte_eth_dev *dev, uint32_t vf, uint32_t *msgbuf) fctrl = IXGBE_READ_REG(hw, IXGBE_FCTRL); if (!(fctrl & IXGBE_FCTRL_UPE)) { /* VF promisc requires PF in promisc */ - RTE_LOG(ERR, PMD, + PMD_DRV_LOG(ERR, "Enabling VF promisc requires PF in promisc\n"); return -1; }