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 351ADA0471 for ; Tue, 16 Jul 2019 20:54:38 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id E5D231BDFB; Tue, 16 Jul 2019 20:53:45 +0200 (CEST) Received: from mail-pl1-f196.google.com (mail-pl1-f196.google.com [209.85.214.196]) by dpdk.org (Postfix) with ESMTP id E6FA81BDF1 for ; Tue, 16 Jul 2019 20:53:38 +0200 (CEST) Received: by mail-pl1-f196.google.com with SMTP id m9so10526306pls.8 for ; Tue, 16 Jul 2019 11:53:38 -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:mime-version :content-transfer-encoding; bh=vrswNjxRhiwQ4fWnowrC8iyBnr3cJxQr3FGbb424mAg=; b=O8r82ALGkC410PzW6vBZaTxsF00w+ODsx/2N+iZd4dyJwJKxGhaS5J7AI90mkU8nnN hpJ/4LHERxSLdoN+UjyiCRzom0BU6zZGe0OnbSDwNW7otydhdfDD9hVmc5JaCaGM/pho SaJNMZCctGM3QtoKQuCNCOAOnpE1DxGxnoWKt5DkwFpGsNwrzAx04Xs7wKNtFVns6Wtc wyQvT8meNp+Hwx7E+/y0vTufeEPqtHvUIZCfwQEkGLKZlue0DaTGe3G5v26nJgnt6Hkk kF8B0Zd8/4sq9paJ50aY/wo1DhU2F0ZBeMmChqZPOqctu/2Hpu2UoNxsU0YBaTR6dhDW d7RA== 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:mime-version :content-transfer-encoding; bh=vrswNjxRhiwQ4fWnowrC8iyBnr3cJxQr3FGbb424mAg=; b=JjphwFiWDB1iJ4lL+MJFNbC2F/7eF8tSQ18VwJ+Of3qb1RllhGe89Pre0+6FA2Bla1 xAgycraSdI5hJN361o8Ixp/ccLnuZ+eDjVHtjjpMcabtrIX2gmN/yqs+U/iQ0Lf1XSvc Nnt9i4FW0WZGRwVq2zKXQe5u213WJc7OzMo5a7pCPADa7qCP8k6+GTMYZuh9GreXES9P PO9HDP9rJuUYNWn+7VYHiVlRNw7hPAhralVLr7eRDB6OC34QXSIorAj3bfbFQ4vnVWkx Jz17TGrgjIY3L7W9qZSsLn9dHdI4T4Ykw9JnV/Zt7PcFkoocJyEXRYKeFasQK9JsRrN+ jOHg== X-Gm-Message-State: APjAAAUkWKQ3Bk3Nz5KkCg6Q8hXG8a0K4Nf20S86CW92RDgyF2bgkL95 HPA4hwNVyxjIOjZMsfaXmVw= X-Google-Smtp-Source: APXvYqwczWCJ7eTy6H/C+B21nqzc9UFjBmG2tyB33bAnufrVw3yib50oPlvfI9WzBCfWuAkydHko5g== X-Received: by 2002:a17:902:9f93:: with SMTP id g19mr37321187plq.223.1563303218083; Tue, 16 Jul 2019 11:53:38 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id i7sm17457089pjk.24.2019.07.16.11.53.37 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 11:53:37 -0700 (PDT) From: Stephen Hemminger To: rahul.lakkireddy@chelsio.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 16 Jul 2019 11:53:31 -0700 Message-Id: <20190716185331.20374-1-stephen@networkplumber.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH] net/cxgbe: implement dynamic log type 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 be deprecated. Every driver must register its own logtype. Signed-off-by: Stephen Hemminger --- drivers/net/cxgbe/cxgbe_compat.h | 7 +++++-- drivers/net/cxgbe/cxgbe_ethdev.c | 9 +++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/drivers/net/cxgbe/cxgbe_compat.h b/drivers/net/cxgbe/cxgbe_compat.h index cce51c2f975b..93df0a7754a5 100644 --- a/drivers/net/cxgbe/cxgbe_compat.h +++ b/drivers/net/cxgbe/cxgbe_compat.h @@ -20,8 +20,11 @@ #include #include +extern int cxgbe_logtype; + #define dev_printf(level, fmt, ...) \ - RTE_LOG(level, PMD, "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__) + rte_log(RTE_LOG_ ## level, cxgbe_logtype, \ + "rte_cxgbe_pmd: " fmt, ##__VA_ARGS__) #define dev_err(x, fmt, ...) dev_printf(ERR, fmt, ##__VA_ARGS__) #define dev_info(x, fmt, ...) dev_printf(INFO, fmt, ##__VA_ARGS__) @@ -63,7 +66,7 @@ #ifdef RTE_LIBRTE_CXGBE_DEBUG #define CXGBE_FUNC_TRACE() \ - RTE_LOG(DEBUG, PMD, "CXGBE trace: %s\n", __func__) + dev_printf(DEBUG, "CXGBE trace: %s\n", __func__) #else #define CXGBE_FUNC_TRACE() do { } while (0) #endif diff --git a/drivers/net/cxgbe/cxgbe_ethdev.c b/drivers/net/cxgbe/cxgbe_ethdev.c index 3a373ec1daa0..efb458d4707c 100644 --- a/drivers/net/cxgbe/cxgbe_ethdev.c +++ b/drivers/net/cxgbe/cxgbe_ethdev.c @@ -38,6 +38,8 @@ #include "cxgbe_pfvf.h" #include "cxgbe_flow.h" +int cxgbe_logtype; + /* * Macros needed to support the PCI Device ID Table ... */ @@ -1218,3 +1220,10 @@ RTE_PMD_REGISTER_KMOD_DEP(net_cxgbe, "* igb_uio | uio_pci_generic | vfio-pci"); RTE_PMD_REGISTER_PARAM_STRING(net_cxgbe, CXGBE_DEVARG_KEEP_OVLAN "=<0|1> " CXGBE_DEVARG_FORCE_LINK_UP "=<0|1> "); + +RTE_INIT(cxgbe_init_log) +{ + cxgbe_logtype = rte_log_register("pmd.net.cxgbe"); + if (cxgbe_logtype >= 0) + rte_log_set_level(cxgbe_logtype, RTE_LOG_NOTICE); +} -- 2.20.1