From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mails.dpdk.org (mails.dpdk.org [217.70.189.124]) by inbox.dpdk.org (Postfix) with ESMTP id 0D6C3436AB; Fri, 8 Dec 2023 16:02:42 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 8735443274; Fri, 8 Dec 2023 16:01:11 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by mails.dpdk.org (Postfix) with ESMTP id 757964327A for ; Fri, 8 Dec 2023 16:01:09 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1702047669; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=67Iolrvhjf0BWODGEWwHGaXwh5MoyOYl1HfOhFsvUEA=; b=eF+rrobrDrQTn/qUsGvVAgrwI25jTRvO4xZB6xbICz4smDwV/m+aK4IqJ/3ulZYjaxfVoe zkkOPEF5B5XlBl+RnJ3HQ8mtBLP0IYzBtLW5KV4mI0E9oBrjTePQiD6d4j8L56usADaTQP TMQMC0RtKocG1uR3OFmvj7I+q0FDKxI= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-54-5Ncl7l3QOyapRQ8bKLCVvQ-1; Fri, 08 Dec 2023 10:01:05 -0500 X-MC-Unique: 5Ncl7l3QOyapRQ8bKLCVvQ-1 Received: from smtp.corp.redhat.com (int-mx08.intmail.prod.int.rdu2.redhat.com [10.11.54.8]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id CAE7185A596; Fri, 8 Dec 2023 15:01:02 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.122]) by smtp.corp.redhat.com (Postfix) with ESMTP id 89402C01650; Fri, 8 Dec 2023 15:00:56 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: thomas@monjalon.net, ferruh.yigit@amd.com, bruce.richardson@intel.com, stephen@networkplumber.org, mb@smartsharesystems.com, Nicolas Chautru , Konstantin Ananyev , Cristian Dumitrescu , Fan Zhang , Ashish Gupta , Akhil Goyal , Chengwen Feng , Kevin Laatz , Andrew Rybchenko , Jerin Jacob , Erik Gabriel Carrillo , Elena Agostini , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan , Yipeng Wang , Sameh Gobriel , Srikanth Yalavarthi , Jasvinder Singh , Pavan Nikhilesh , Reshma Pattan , Anatoly Burakov , David Hunt , Sivaprasad Tummala , Sachin Saxena , Hemant Agrawal , Honnappa Nagarahalli , Ori Kam , Ciara Power , Maxime Coquelin , Chenbo Xia Subject: [RFC v2 14/14] lib: use per line logging in helpers Date: Fri, 8 Dec 2023 15:59:48 +0100 Message-ID: <20231208145950.2184940-15-david.marchand@redhat.com> In-Reply-To: <20231208145950.2184940-1-david.marchand@redhat.com> References: <20231117131824.1977792-1-david.marchand@redhat.com> <20231208145950.2184940-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.8 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Use RTE_LOG_LINE in existing macros that append a \n. Signed-off-by: David Marchand --- Changes since RFC v1: - converted all logging helpers in lib/, --- lib/bbdev/rte_bbdev.c | 5 +++-- lib/bpf/bpf_impl.h | 2 +- lib/cfgfile/rte_cfgfile.c | 4 ++-- lib/compressdev/rte_compressdev_internal.h | 5 +++-- lib/cryptodev/rte_cryptodev.h | 16 +++++++--------- lib/dmadev/rte_dmadev.c | 6 ++++-- lib/ethdev/rte_ethdev.h | 3 +-- lib/eventdev/eventdev_pmd.h | 8 ++++---- lib/eventdev/rte_event_timer_adapter.c | 17 ++++++++++------- lib/gpudev/gpudev.c | 6 ++++-- lib/graph/graph_private.h | 5 +++-- lib/member/member.h | 4 ++-- lib/metrics/rte_metrics_telemetry.c | 4 ++-- lib/mldev/rte_mldev.h | 5 +++-- lib/net/rte_net_crc.c | 8 ++++---- lib/node/node_private.h | 6 ++++-- lib/pdump/rte_pdump.c | 5 ++--- lib/power/power_common.h | 2 +- lib/rawdev/rte_rawdev_pmd.h | 4 ++-- lib/rcu/rte_rcu_qsbr.h | 8 +++----- lib/regexdev/rte_regexdev.h | 3 +-- lib/stack/stack_pvt.h | 4 ++-- lib/telemetry/telemetry.c | 4 +--- lib/vhost/vhost.h | 8 ++++---- lib/vhost/vhost_crypto.c | 6 +++--- 25 files changed, 76 insertions(+), 72 deletions(-) diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index e09bb97abb..13bde3c25b 100644 --- a/lib/bbdev/rte_bbdev.c +++ b/lib/bbdev/rte_bbdev.c @@ -28,10 +28,11 @@ /* BBDev library logging ID */ RTE_LOG_REGISTER_DEFAULT(bbdev_logtype, NOTICE); +#define RTE_LOGTYPE_BBDEV bbdev_logtype /* Helper macro for logging */ -#define rte_bbdev_log(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, bbdev_logtype, fmt "\n", ##__VA_ARGS__) +#define rte_bbdev_log(level, ...) \ + RTE_LOG_LINE(level, BBDEV, "" __VA_ARGS__) #define rte_bbdev_log_debug(fmt, ...) \ rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \ diff --git a/lib/bpf/bpf_impl.h b/lib/bpf/bpf_impl.h index 30d83d2b40..17f38faec1 100644 --- a/lib/bpf/bpf_impl.h +++ b/lib/bpf/bpf_impl.h @@ -30,7 +30,7 @@ extern int rte_bpf_logtype; #define RTE_LOGTYPE_BPF rte_bpf_logtype #define BPF_LOG(lvl, fmt, args...) \ - RTE_LOG(lvl, BPF, fmt "\n", ##args) + RTE_LOG_LINE(lvl, BPF, fmt, ##args) static inline size_t bpf_size(uint32_t bpf_op_sz) diff --git a/lib/cfgfile/rte_cfgfile.c b/lib/cfgfile/rte_cfgfile.c index 2f9cc0722a..6a5e4fd942 100644 --- a/lib/cfgfile/rte_cfgfile.c +++ b/lib/cfgfile/rte_cfgfile.c @@ -29,10 +29,10 @@ struct rte_cfgfile { /* Setting up dynamic logging 8< */ RTE_LOG_REGISTER_DEFAULT(cfgfile_logtype, INFO); +#define RTE_LOGTYPE_CFGFILE cfgfile_logtype #define CFG_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, cfgfile_logtype, "%s(): " fmt "\n", \ - __func__, ## args) + RTE_LOG_LINE(level, CFGFILE, "%s(): " fmt, __func__, ## args) /* >8 End of setting up dynamic logging */ /** when we resize a file structure, how many extra entries diff --git a/lib/compressdev/rte_compressdev_internal.h b/lib/compressdev/rte_compressdev_internal.h index b3b193e3ee..01b7764282 100644 --- a/lib/compressdev/rte_compressdev_internal.h +++ b/lib/compressdev/rte_compressdev_internal.h @@ -21,9 +21,10 @@ extern "C" { /* Logging Macros */ extern int compressdev_logtype; +#define RTE_LOGTYPE_COMPRESSDEV compressdev_logtype + #define COMPRESSDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, compressdev_logtype, "%s(): " fmt "\n", \ - __func__, ##args) + RTE_LOG_LINE(level, COMPRESSDEV, "%s(): " fmt, __func__, ## args) /** * Dequeue processed packets from queue pair of a device. diff --git a/lib/cryptodev/rte_cryptodev.h b/lib/cryptodev/rte_cryptodev.h index aaeaf294e6..563f011299 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -31,23 +31,21 @@ extern const char **rte_cyptodev_names; /* Logging Macros */ #define CDEV_LOG_ERR(...) \ - RTE_LOG(ERR, CRYPTODEV, \ - RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_LOG_LINE(ERR, CRYPTODEV, \ + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) #define CDEV_LOG_INFO(...) \ - RTE_LOG(INFO, CRYPTODEV, \ - RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(INFO, CRYPTODEV, "" __VA_ARGS__) #define CDEV_LOG_DEBUG(...) \ - RTE_LOG(DEBUG, CRYPTODEV, \ - RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_LOG_LINE(DEBUG, CRYPTODEV, \ + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) #define CDEV_PMD_TRACE(...) \ - RTE_LOG(DEBUG, CRYPTODEV, \ - RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_LOG_LINE(DEBUG, CRYPTODEV, \ + RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__,), \ dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,))) /** diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 009a21849a..c1a166858c 100644 --- a/lib/dmadev/rte_dmadev.c +++ b/lib/dmadev/rte_dmadev.c @@ -32,9 +32,11 @@ static struct { } *dma_devices_shared_data; RTE_LOG_REGISTER_DEFAULT(rte_dma_logtype, INFO); +#define RTE_LOGTYPE_DMA rte_dma_logtype + #define RTE_DMA_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, rte_dma_logtype, RTE_FMT("dma: " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, DMA, RTE_FMT("dma: " RTE_FMT_HEAD(__VA_ARGS__,), \ + RTE_FMT_TAIL(__VA_ARGS__,))) int rte_dma_dev_max(size_t dev_max) diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index 18debce99c..21e3a21903 100644 --- a/lib/ethdev/rte_ethdev.h +++ b/lib/ethdev/rte_ethdev.h @@ -179,8 +179,7 @@ extern int rte_eth_dev_logtype; #define RTE_LOGTYPE_ETHDEV rte_eth_dev_logtype #define RTE_ETHDEV_LOG_LINE(level, ...) \ - RTE_LOG(level, ETHDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, ETHDEV, "" __VA_ARGS__) struct rte_mbuf; diff --git a/lib/eventdev/eventdev_pmd.h b/lib/eventdev/eventdev_pmd.h index 2ec5aec0a8..50cf7d9057 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -33,14 +33,14 @@ extern "C" { /* Logging Macros */ #define RTE_EDEV_LOG_ERR(...) \ - RTE_LOG(ERR, EVENTDEV, \ - RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_LOG_LINE(ERR, EVENTDEV, \ + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) #ifdef RTE_LIBRTE_EVENTDEV_DEBUG #define RTE_EDEV_LOG_DEBUG(...) \ - RTE_LOG(DEBUG, EVENTDEV, \ - RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_LOG_LINE(DEBUG, EVENTDEV, \ + RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) #else #define RTE_EDEV_LOG_DEBUG(...) (void)0 diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index 3f22e85173..6ebb7b257e 100644 --- a/lib/eventdev/rte_event_timer_adapter.c +++ b/lib/eventdev/rte_event_timer_adapter.c @@ -30,27 +30,30 @@ #define DATA_MZ_NAME_FORMAT "rte_event_timer_adapter_data_%d" RTE_LOG_REGISTER_SUFFIX(evtim_logtype, adapter.timer, NOTICE); +#define RTE_LOGTYPE_EVTIM evtim_logtype RTE_LOG_REGISTER_SUFFIX(evtim_buffer_logtype, adapter.timer, NOTICE); +#define RTE_LOGTYPE_EVTIM_BUF evtim_buffer_logtype RTE_LOG_REGISTER_SUFFIX(evtim_svc_logtype, adapter.timer.svc, NOTICE); +#define RTE_LOGTYPE_EVTIM_SVC evtim_svc_logtype static struct rte_event_timer_adapter *adapters; static const struct event_timer_adapter_ops swtim_ops; #define EVTIM_LOG(level, logtype, ...) \ - rte_log(RTE_LOG_ ## level, logtype, \ - RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) \ - "\n", __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, logtype, \ + RTE_FMT("EVTIMER: %s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,), \ + __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) -#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, evtim_logtype, __VA_ARGS__) +#define EVTIM_LOG_ERR(...) EVTIM_LOG(ERR, EVTIM, __VA_ARGS__) #ifdef RTE_LIBRTE_EVENTDEV_DEBUG #define EVTIM_LOG_DBG(...) \ - EVTIM_LOG(DEBUG, evtim_logtype, __VA_ARGS__) + EVTIM_LOG(DEBUG, EVTIM, __VA_ARGS__) #define EVTIM_BUF_LOG_DBG(...) \ - EVTIM_LOG(DEBUG, evtim_buffer_logtype, __VA_ARGS__) + EVTIM_LOG(DEBUG, EVTIM_BUF, __VA_ARGS__) #define EVTIM_SVC_LOG_DBG(...) \ - EVTIM_LOG(DEBUG, evtim_svc_logtype, __VA_ARGS__) + EVTIM_LOG(DEBUG, EVTIM_SVC, __VA_ARGS__) #else #define EVTIM_LOG_DBG(...) (void)0 #define EVTIM_BUF_LOG_DBG(...) (void)0 diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c index 6845d18b4d..79118c3e94 100644 --- a/lib/gpudev/gpudev.c +++ b/lib/gpudev/gpudev.c @@ -17,9 +17,11 @@ /* Logging */ RTE_LOG_REGISTER_DEFAULT(gpu_logtype, NOTICE); +#define RTE_LOGTYPE_GPUDEV gpu_logtype + #define GPU_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, gpu_logtype, RTE_FMT("gpu: " \ - RTE_FMT_HEAD(__VA_ARGS__, ) "\n", RTE_FMT_TAIL(__VA_ARGS__, ))) + RTE_LOG_LINE(level, GPUDEV, RTE_FMT("gpu: " RTE_FMT_HEAD(__VA_ARGS__, ), \ + RTE_FMT_TAIL(__VA_ARGS__, ))) /* Set any driver error as EPERM */ #define GPU_DRV_RET(function) \ diff --git a/lib/graph/graph_private.h b/lib/graph/graph_private.h index d0ef13b205..672a034287 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -18,10 +18,11 @@ #include "rte_graph_worker.h" extern int rte_graph_logtype; +#define RTE_LOGTYPE_GRAPH rte_graph_logtype #define GRAPH_LOG(level, ...) \ - rte_log(RTE_LOG_##level, rte_graph_logtype, \ - RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n", \ + RTE_LOG_LINE(level, GRAPH, \ + RTE_FMT("GRAPH: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ), \ __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__, ))) #define graph_err(...) GRAPH_LOG(ERR, __VA_ARGS__) diff --git a/lib/member/member.h b/lib/member/member.h index ce150f7689..56dd2782a6 100644 --- a/lib/member/member.h +++ b/lib/member/member.h @@ -8,7 +8,7 @@ extern int librte_member_logtype; #define RTE_LOGTYPE_MEMBER librte_member_logtype #define MEMBER_LOG(level, ...) \ - RTE_LOG(level, MEMBER, \ - RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ + RTE_LOG_LINE(level, MEMBER, \ + RTE_FMT("%s(): " RTE_FMT_HEAD(__VA_ARGS__,), \ __func__, RTE_FMT_TAIL(__VA_ARGS__,))) diff --git a/lib/metrics/rte_metrics_telemetry.c b/lib/metrics/rte_metrics_telemetry.c index 1d133e1f8c..b8c9d75a7d 100644 --- a/lib/metrics/rte_metrics_telemetry.c +++ b/lib/metrics/rte_metrics_telemetry.c @@ -16,11 +16,11 @@ struct telemetry_metrics_data tel_met_data; int metrics_log_level; +#define RTE_LOGTYPE_METRICS metrics_log_level /* Logging Macros */ #define METRICS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ##level, metrics_log_level, "%s(): "fmt "\n", \ - __func__, ##args) + RTE_LOG_LINE(level, METRICS, "%s(): "fmt, __func__, ## args) #define METRICS_LOG_ERR(fmt, args...) \ METRICS_LOG(ERR, fmt, ## args) diff --git a/lib/mldev/rte_mldev.h b/lib/mldev/rte_mldev.h index 63b2670bb0..5cf6f0566f 100644 --- a/lib/mldev/rte_mldev.h +++ b/lib/mldev/rte_mldev.h @@ -144,9 +144,10 @@ extern "C" { /* Logging Macro */ extern int rte_ml_dev_logtype; +#define RTE_LOGTYPE_MLDEV rte_ml_dev_logtype -#define RTE_MLDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_##level, rte_ml_dev_logtype, "%s(): " fmt "\n", __func__, ##args) +#define RTE_MLDEV_LOG(level, fmt, args...) \ + RTE_LOG_LINE(level, MLDEV, "%s(): " fmt, __func__, ##args) #define RTE_ML_STR_MAX 128 /**< Maximum length of name string */ diff --git a/lib/net/rte_net_crc.c b/lib/net/rte_net_crc.c index 900d6de7f4..b401ea3dd8 100644 --- a/lib/net/rte_net_crc.c +++ b/lib/net/rte_net_crc.c @@ -70,11 +70,11 @@ static const rte_net_crc_handler handlers_neon[] = { static uint16_t max_simd_bitwidth; -#define NET_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, libnet_logtype, "%s(): " fmt "\n", \ - __func__, ## args) - RTE_LOG_REGISTER_DEFAULT(libnet_logtype, INFO); +#define RTE_LOGTYPE_NET libnet_logtype + +#define NET_LOG(level, fmt, args...) \ + RTE_LOG_LINE(level, NET, "%s(): " fmt, __func__, ## args) /* Scalar handling */ diff --git a/lib/node/node_private.h b/lib/node/node_private.h index 26135aaa5b..5702146db4 100644 --- a/lib/node/node_private.h +++ b/lib/node/node_private.h @@ -11,9 +11,11 @@ #include extern int rte_node_logtype; +#define RTE_LOGTYPE_NODE rte_node_logtype + #define NODE_LOG(level, node_name, ...) \ - rte_log(RTE_LOG_##level, rte_node_logtype, \ - RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ) "\n", \ + RTE_LOG_LINE(level, NODE, \ + RTE_FMT("NODE %s: %s():%u " RTE_FMT_HEAD(__VA_ARGS__, ), \ node_name, __func__, __LINE__, \ RTE_FMT_TAIL(__VA_ARGS__, ))) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 70963e7ee7..3954c06a87 100644 --- a/lib/pdump/rte_pdump.c +++ b/lib/pdump/rte_pdump.c @@ -18,9 +18,8 @@ RTE_LOG_REGISTER_DEFAULT(pdump_logtype, NOTICE); #define RTE_LOGTYPE_PDUMP pdump_logtype -#define PDUMP_LOG_LINE(level, fmt, args...) \ - RTE_LOG(level, PDUMP, "%s(): " fmt "\n", \ - __func__, ## args) +#define PDUMP_LOG_LINE(level, fmt, args...) \ + RTE_LOG_LINE(level, PDUMP, "%s(): " fmt, __func__, ## args) /* Used for the multi-process communication */ #define PDUMP_MP "mp_pdump" diff --git a/lib/power/power_common.h b/lib/power/power_common.h index ea2febbd86..4e32548169 100644 --- a/lib/power/power_common.h +++ b/lib/power/power_common.h @@ -15,7 +15,7 @@ extern int power_logtype; #ifdef RTE_LIBRTE_POWER_DEBUG #define POWER_DEBUG_LOG(fmt, args...) \ - RTE_LOG(ERR, POWER, "%s: " fmt "\n", __func__, ## args) + RTE_LOG_LINE(ERR, POWER, "%s: " fmt, __func__, ## args) #else #define POWER_DEBUG_LOG(fmt, args...) #endif diff --git a/lib/rawdev/rte_rawdev_pmd.h b/lib/rawdev/rte_rawdev_pmd.h index 7b9ef1d09f..7173282c66 100644 --- a/lib/rawdev/rte_rawdev_pmd.h +++ b/lib/rawdev/rte_rawdev_pmd.h @@ -27,11 +27,11 @@ extern "C" { #include "rte_rawdev.h" extern int librawdev_logtype; +#define RTE_LOGTYPE_RAWDEV librawdev_logtype /* Logging Macros */ #define RTE_RDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, librawdev_logtype, "%s(): " fmt "\n", \ - __func__, ##args) + RTE_LOG_LINE(level, RAWDEV, "%s(): " fmt, __func__, ##args) #define RTE_RDEV_ERR(fmt, args...) \ RTE_RDEV_LOG(ERR, fmt, ## args) diff --git a/lib/rcu/rte_rcu_qsbr.h b/lib/rcu/rte_rcu_qsbr.h index 0dca8310c0..23c9f89805 100644 --- a/lib/rcu/rte_rcu_qsbr.h +++ b/lib/rcu/rte_rcu_qsbr.h @@ -40,17 +40,15 @@ extern int rte_rcu_log_type; #if RTE_LOG_DP_LEVEL >= RTE_LOG_DEBUG #define __RTE_RCU_DP_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \ - "%s(): " fmt "\n", __func__, ## args) + RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args) #else #define __RTE_RCU_DP_LOG(level, fmt, args...) #endif #if defined(RTE_LIBRTE_RCU_DEBUG) -#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do {\ +#define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) do { \ if (v->qsbr_cnt[thread_id].lock_cnt) \ - rte_log(RTE_LOG_ ## level, rte_rcu_log_type, \ - "%s(): " fmt "\n", __func__, ## args); \ + RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args); \ } while (0) #else #define __RTE_RCU_IS_LOCK_CNT_ZERO(v, thread_id, level, fmt, args...) diff --git a/lib/regexdev/rte_regexdev.h b/lib/regexdev/rte_regexdev.h index dc111317a5..a50b841b1e 100644 --- a/lib/regexdev/rte_regexdev.h +++ b/lib/regexdev/rte_regexdev.h @@ -209,8 +209,7 @@ extern int rte_regexdev_logtype; #define RTE_LOGTYPE_REGEXDEV rte_regexdev_logtype #define RTE_REGEXDEV_LOG_LINE(level, ...) \ - RTE_LOG(level, REGEXDEV, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, REGEXDEV, "" __VA_ARGS__) /* Macros to check for valid port */ #define RTE_REGEXDEV_VALID_DEV_ID_OR_ERR_RET(dev_id, retval) do { \ diff --git a/lib/stack/stack_pvt.h b/lib/stack/stack_pvt.h index c7eab4027d..2dce42a9da 100644 --- a/lib/stack/stack_pvt.h +++ b/lib/stack/stack_pvt.h @@ -8,10 +8,10 @@ #include extern int stack_logtype; +#define RTE_LOGTYPE_STACK stack_logtype #define STACK_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ##level, stack_logtype, "%s(): "fmt "\n", \ - __func__, ##args) + RTE_LOG_LINE(level, STACK, "%s(): "fmt, __func__, ##args) #define STACK_LOG_ERR(fmt, args...) \ STACK_LOG(ERR, fmt, ## args) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 5c655e2b25..31e2391867 100644 --- a/lib/telemetry/telemetry.c +++ b/lib/telemetry/telemetry.c @@ -57,9 +57,7 @@ static rte_cpuset_t *thread_cpuset; RTE_LOG_REGISTER_DEFAULT(logtype, WARNING); #define RTE_LOGTYPE_TMTY logtype -#define TMTY_LOG_LINE(l, ...) \ - RTE_LOG(l, TMTY, RTE_FMT("TELEMETRY: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) +#define TMTY_LOG_LINE(l, ...) RTE_LOG_LINE(l, TMTY, "TELEMETRY: " __VA_ARGS__) /* list of command callbacks, with one command registered by default */ static struct cmd_callback *callbacks; diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h index 5a74d0e628..25c0f86e55 100644 --- a/lib/vhost/vhost.h +++ b/lib/vhost/vhost.h @@ -678,12 +678,12 @@ extern int vhost_data_log_level; #define RTE_LOGTYPE_VHOST_DATA vhost_data_log_level #define VHOST_CONFIG_LOG(prefix, level, fmt, args...) \ - RTE_LOG(level, VHOST_CONFIG, \ - "VHOST_CONFIG: (%s) " fmt "\n", prefix, ##args) + RTE_LOG_LINE(level, VHOST_CONFIG, \ + "VHOST_CONFIG: (%s) " fmt, prefix, ##args) #define VHOST_DATA_LOG(prefix, level, fmt, args...) \ - RTE_LOG_DP(level, VHOST_DATA, \ - "VHOST_DATA: (%s) " fmt "\n", prefix, ##args) + RTE_LOG_DP_LINE(level, VHOST_DATA, \ + "VHOST_DATA: (%s) " fmt, prefix, ##args) #ifdef RTE_LIBRTE_VHOST_DEBUG #define VHOST_MAX_PRINT_BUFF 6072 diff --git a/lib/vhost/vhost_crypto.c b/lib/vhost/vhost_crypto.c index 6e5443e5f8..3704fbbb3d 100644 --- a/lib/vhost/vhost_crypto.c +++ b/lib/vhost/vhost_crypto.c @@ -21,15 +21,15 @@ RTE_LOG_REGISTER_SUFFIX(vhost_crypto_logtype, crypto, INFO); #define RTE_LOGTYPE_VHOST_CRYPTO vhost_crypto_logtype #define VC_LOG_ERR(fmt, args...) \ - RTE_LOG(ERR, VHOST_CRYPTO, "%s() line %u: " fmt "\n", \ + RTE_LOG_LINE(ERR, VHOST_CRYPTO, "%s() line %u: " fmt, \ __func__, __LINE__, ## args) #define VC_LOG_INFO(fmt, args...) \ - RTE_LOG(INFO, VHOST_CRYPTO, "%s() line %u: " fmt "\n", \ + RTE_LOG_LINE(INFO, VHOST_CRYPTO, "%s() line %u: " fmt, \ __func__, __LINE__, ## args) #ifdef RTE_LIBRTE_VHOST_DEBUG #define VC_LOG_DBG(fmt, args...) \ - RTE_LOG(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt "\n", \ + RTE_LOG_LINE(DEBUG, VHOST_CRYPTO, "%s() line %u: " fmt, \ __func__, __LINE__, ## args) #else #define VC_LOG_DBG(fmt, args...) -- 2.43.0