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 18394A0471 for ; Tue, 16 Jul 2019 20:55:36 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 5AAB9324D; Tue, 16 Jul 2019 20:55:35 +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 6B9532BF5 for ; Tue, 16 Jul 2019 20:55:33 +0200 (CEST) Received: by mail-pl1-f194.google.com with SMTP id ay6so10572514plb.9 for ; Tue, 16 Jul 2019 11:55:33 -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=B4/p4zJlkEYbE+vNSYhO8aFYXq26KRwWBR2jlkuoHwQ=; b=r7TfrkYpKbMURumLeOUYuhU9V6R61Hgh76zRFYrFzdThHhyKEUYnZmrC3GQiExWe6t P3Vu2tyo5HTXj9GxSIjhj3N2iiDX1GPBfGmB3S+IKO8RrgVZzmMpaADtYDW5sH/EevW7 HSWilBvMwmA1G2d4IKlgVYLt2TMqOh2JXUBe2E89QXkhLvj/8yxwEjrRo4tX8pYqcfwL gsOfkdBveGlYpPwXXIa8Vuxo5fALlxCBLvpGit/SrBrebx4GKrVsnu5d51m+4PKxfvBD NU8iMcAhMPfKHFQZwH5BiZp1pn7eM44tKoRM5sDZG4BI1t3g5hoaF/twH9tQ40umSdra DkMw== 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=B4/p4zJlkEYbE+vNSYhO8aFYXq26KRwWBR2jlkuoHwQ=; b=K2uo98i0+1qJnZEcq5nekQCABlgYzpYVWza6na6M5HafXY2E3vpMRN9Fpyp+gVlyc3 2ikXArLw7kuvG1GObh/tj/MHVti+fnKJBW5Is+tyHodHa+QvWjWSSYbf1wPTsINBVi8e b3oxolhi0PI5Hg/QCe4GFI3gieXd/dMIT74ee1LCNy6nRPUp7CksqwP5zejs1mGbipDk MvNG/fSIC1wKYJzugQvjeB8I7rzvuYc/JYPqK3swiQDa2OiWuHUKgyNNW0lexx5Qjbkf eovRc5O3lOPQeTM6rABNMRwM/1bVgvRIYn/bROtiPulXrhVBXtjTlFlhWudomYP4PUGA t47g== X-Gm-Message-State: APjAAAVAyFVcOMl+0T3xN2RRMZuXEHyldCS7itBldOQzl9tk2eQrKSlY 7qinEebA2fgmORmtX6TfzOPKDQLP X-Google-Smtp-Source: APXvYqyp5jNEm3/ALu8Ant0rg/O+ncA9Ls92mgUdgf1yf1ahDZCR9I5HmO9UWnOvX/y7DBKY9LIbaw== X-Received: by 2002:a17:902:110b:: with SMTP id d11mr39395356pla.213.1563303332661; Tue, 16 Jul 2019 11:55:32 -0700 (PDT) Received: from hermes.lan (204-195-22-127.wavecable.com. [204.195.22.127]) by smtp.gmail.com with ESMTPSA id v138sm22739945pfc.15.2019.07.16.11.55.31 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Tue, 16 Jul 2019 11:55:32 -0700 (PDT) From: Stephen Hemminger To: shepard.siegel@atomicrules.com, ed.czeck@atomicrules.com, john.miller@atomicrules.com Cc: dev@dpdk.org, Stephen Hemminger Date: Tue, 16 Jul 2019 11:55:30 -0700 Message-Id: <20190716185530.20508-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/ark: 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 will be deprecated in near future. Every driver must register its own logtype. Signed-off-by: Stephen Hemminger --- drivers/net/ark/ark_ethdev.c | 9 +++++++++ drivers/net/ark/ark_logs.h | 25 ++++++++++++++----------- 2 files changed, 23 insertions(+), 11 deletions(-) diff --git a/drivers/net/ark/ark_ethdev.c b/drivers/net/ark/ark_ethdev.c index 86e500ecb30c..630f78118355 100644 --- a/drivers/net/ark/ark_ethdev.c +++ b/drivers/net/ark/ark_ethdev.c @@ -78,6 +78,8 @@ static int eth_ark_set_mtu(struct rte_eth_dev *dev, uint16_t size); #define ARK_TX_MAX_QUEUE (4096 * 4) #define ARK_TX_MIN_QUEUE (256) +int ark_logtype; + static const char * const valid_arguments[] = { ARK_PKTGEN_ARG, ARK_PKTCHKR_ARG, @@ -1007,3 +1009,10 @@ RTE_PMD_REGISTER_PARAM_STRING(net_ark, ARK_PKTGEN_ARG "= " ARK_PKTCHKR_ARG "= " ARK_PKTDIR_ARG "="); + +RTE_INIT(ark_init_log) +{ + ark_logtype = rte_log_register("pmd.net.ark"); + if (ark_logtype >= 0) + rte_log_set_level(ark_logtype, RTE_LOG_NOTICE); +} diff --git a/drivers/net/ark/ark_logs.h b/drivers/net/ark/ark_logs.h index b90e9f0ac9ad..44aac6102ffa 100644 --- a/drivers/net/ark/ark_logs.h +++ b/drivers/net/ark/ark_logs.h @@ -26,29 +26,32 @@ #define ARK_SU64X "\n\t%-20s %#20" PRIx64 #define ARK_SPTR "\n\t%-20s %20p" - +extern int ark_logtype; #define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, PMD, fmt, ## args) + rte_log(RTE_LOG_ ##level, ark_logtype, fmt, ## args) /* Conditional trace definitions */ -#define ARK_TRACE_ON(level, fmt, ...) \ - RTE_LOG(level, PMD, fmt, ##__VA_ARGS__) +#define ARK_TRACE_ON(level, fmt, args...) \ + PMD_DRV_LOG(level, fmt, ## args) /* This pattern allows compiler check arguments even if disabled */ -#define ARK_TRACE_OFF(level, fmt, ...) \ - do {if (0) RTE_LOG(level, PMD, fmt, ##__VA_ARGS__); } \ - while (0) - +#define ARK_TRACE_OFF(level, fmt, args...) \ + do { \ + if (0) \ + PMD_DRV_LOG(level, fmt, ## args); \ + } while (0) /* tracing including the function name */ #define ARK_FUNC_ON(level, fmt, args...) \ - RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args) + PMD_DRV_LOG(level, "%s(): " fmt, __func__, ## args) /* tracing including the function name */ #define ARK_FUNC_OFF(level, fmt, args...) \ - do { if (0) RTE_LOG(level, PMD, "%s(): " fmt, __func__, ## args); } \ - while (0) + do { \ + if (0) \ + PMD_DRV_LOG(level, "%s(): " fmt, __func__, ## args); \ + } while (0) /* Debug macro for tracing full behavior, function tracing and messages*/ -- 2.20.1