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 C9BF943728; Wed, 20 Dec 2023 16:40:04 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id E2BA842EAB; Wed, 20 Dec 2023 16:39:01 +0100 (CET) Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by mails.dpdk.org (Postfix) with ESMTP id 8F63B42DDB for ; Wed, 20 Dec 2023 16:39:00 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1703086740; 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=Yo2sp9EvXaKZpVEViz3Zump+dRhNuNafk36W/U+fAkE=; b=IIynMUmQ6PNsYmHJvEYwGFdbY/fNqKpUe9zZ05UgJTcesurBSx/up1fw8tUL4DDzU+KTob H70azj20HpRNWstWSGrRhrr+TlEXcRt6AyEmj0RZywNPZwaKPncz3EW+pQhrHN86aIiwZY vmfpM3lMskDYpA0+9QELvMBZ32Lh4eY= Received: from mimecast-mx02.redhat.com (mx-ext.redhat.com [66.187.233.73]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-639-xSmeCyVYMZSpezpFByswpA-1; Wed, 20 Dec 2023 10:38:56 -0500 X-MC-Unique: xSmeCyVYMZSpezpFByswpA-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (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 A14DE3810786; Wed, 20 Dec 2023 15:38:48 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.218]) by smtp.corp.redhat.com (Postfix) with ESMTP id BF6CD2166B31; Wed, 20 Dec 2023 15:38:41 +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, Chengwen Feng , Andrew Rybchenko , Konstantin Ananyev , Nicolas Chautru , Cristian Dumitrescu , Fan Zhang , Ashish Gupta , Akhil Goyal , Kevin Laatz , Dmitry Kozlyuk , Narcisa Ana Maria Vasile , Dmitry Malloy , Pallavi Kadam , Byron Marohn , Yipeng Wang , Jerin Jacob , Erik Gabriel Carrillo , Vladimir Medvedkin , Elena Agostini , Kiran Kumar K , Nithin Dabilpuram , Zhirun Yan , Sameh Gobriel , Reshma Pattan , Srikanth Yalavarthi , Jasvinder Singh , Pavan Nikhilesh , Anatoly Burakov , David Hunt , Sivaprasad Tummala , Sachin Saxena , Hemant Agrawal , Honnappa Nagarahalli , Ori Kam , Volodymyr Fialko , Ciara Power , Maxime Coquelin , Chenbo Xia Subject: [PATCH v5 13/13] lib: use per line logging in helpers Date: Wed, 20 Dec 2023 16:36:06 +0100 Message-ID: <20231220153607.718606-14-david.marchand@redhat.com> In-Reply-To: <20231220153607.718606-1-david.marchand@redhat.com> References: <20231117131824.1977792-1-david.marchand@redhat.com> <20231220153607.718606-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.11.54.6 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. This will help catching unwanted newline character or multilines in log messages. Signed-off-by: David Marchand Reviewed-by: Chengwen Feng Reviewed-by: Andrew Rybchenko --- Changes since v4: - converted more helpers, Changes since v3: - fixed some checkpatch complaints, Changes since RFC v1: - converted all logging helpers in lib/, --- lib/acl/acl_log.h | 4 ++-- 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 | 22 ++++++++++------------ lib/dmadev/rte_dmadev.c | 6 ++++-- lib/eal/common/eal_private.h | 4 ++-- lib/eal/windows/include/rte_windows.h | 6 +++--- lib/efd/rte_efd.c | 4 ++-- lib/ethdev/rte_ethdev.h | 3 +-- lib/eventdev/eventdev_pmd.h | 12 ++++++------ lib/eventdev/rte_event_timer_adapter.c | 17 ++++++++++------- lib/fib/fib_log.h | 4 ++-- lib/gpudev/gpudev.c | 6 ++++-- lib/graph/graph_private.h | 7 ++++--- lib/hash/rte_cuckoo_hash.c | 4 ++-- lib/hash/rte_fbk_hash.c | 4 ++-- lib/hash/rte_hash_crc.c | 4 ++-- lib/hash/rte_thash.c | 4 ++-- lib/hash/rte_thash_gfni.c | 4 ++-- lib/ip_frag/ip_frag_common.h | 4 ++-- lib/latencystats/rte_latencystats.c | 4 ++-- lib/lpm/lpm_log.h | 4 ++-- lib/mbuf/mbuf_log.h | 4 ++-- lib/member/member.h | 4 ++-- lib/mempool/rte_mempool.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 | 8 +++++--- lib/pdump/rte_pdump.c | 5 ++--- lib/pipeline/rte_pipeline.c | 4 ++-- lib/port/port_log.h | 4 ++-- lib/power/guest_channel.c | 4 ++-- lib/power/power_common.h | 6 +++--- lib/rawdev/rte_rawdev_pmd.h | 4 ++-- lib/rcu/rte_rcu_qsbr.c | 2 +- lib/rcu/rte_rcu_qsbr.h | 8 +++----- lib/regexdev/rte_regexdev.h | 3 +-- lib/reorder/rte_reorder.c | 4 ++-- lib/rib/rib_log.h | 4 ++-- lib/ring/rte_ring.c | 4 ++-- lib/sched/rte_sched_log.h | 4 ++-- lib/stack/stack_pvt.h | 4 ++-- lib/table/table_log.h | 4 ++-- lib/telemetry/telemetry.c | 4 +--- lib/vhost/fd_man.c | 4 ++-- lib/vhost/vhost.h | 4 ++-- lib/vhost/vhost_crypto.c | 6 +++--- 50 files changed, 133 insertions(+), 129 deletions(-) diff --git a/lib/acl/acl_log.h b/lib/acl/acl_log.h index 2d7c376058..d2310401a8 100644 --- a/lib/acl/acl_log.h +++ b/lib/acl/acl_log.h @@ -4,5 +4,5 @@ extern int acl_logtype; #define RTE_LOGTYPE_ACL acl_logtype -#define ACL_LOG(level, fmt, ...) \ - RTE_LOG(level, ACL, fmt "\n", ## __VA_ARGS__) +#define ACL_LOG(level, ...) \ + RTE_LOG_LINE(level, ACL, "" __VA_ARGS__) 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 6a82ae4ef2..1a3d97d0c7 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 RTE_BPF_LOG_LINE(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 30ad2d9a95..359b6c2b29 100644 --- a/lib/cryptodev/rte_cryptodev.h +++ b/lib/cryptodev/rte_cryptodev.h @@ -36,24 +36,22 @@ extern int rte_cryptodev_logtype; /* Logging Macros */ #define CDEV_LOG_ERR(...) \ - RTE_LOG(ERR, CRYPTODEV, \ - RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) + 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", \ - __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) + 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", \ - dev, __func__, RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(DEBUG, CRYPTODEV, \ + RTE_FMT("[%s] %s: " RTE_FMT_HEAD(__VA_ARGS__ ,), \ + dev, __func__, RTE_FMT_TAIL(__VA_ARGS__ ,))) /** * A macro that points to an offset from the start diff --git a/lib/dmadev/rte_dmadev.c b/lib/dmadev/rte_dmadev.c index 009a21849a..5953a77bd6 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/eal/common/eal_private.h b/lib/eal/common/eal_private.h index afd87000e7..71523cfdb8 100644 --- a/lib/eal/common/eal_private.h +++ b/lib/eal/common/eal_private.h @@ -748,7 +748,7 @@ int eal_asprintf(char **buffer, const char *format, ...); eal_asprintf(buffer, format, ##__VA_ARGS__) #endif -#define EAL_LOG(level, fmt, ...) \ - RTE_LOG(level, EAL, fmt "\n", ## __VA_ARGS__) +#define EAL_LOG(level, ...) \ + RTE_LOG_LINE(level, EAL, "" __VA_ARGS__) #endif /* _EAL_PRIVATE_H_ */ diff --git a/lib/eal/windows/include/rte_windows.h b/lib/eal/windows/include/rte_windows.h index 83730c3d2e..0b0d117865 100644 --- a/lib/eal/windows/include/rte_windows.h +++ b/lib/eal/windows/include/rte_windows.h @@ -48,9 +48,9 @@ extern "C" { * Log GetLastError() with context, usually a Win32 API function and arguments. */ #define RTE_LOG_WIN32_ERR(...) \ - RTE_LOG(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", GetLastError(), \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(DEBUG, EAL, RTE_FMT("GetLastError()=%lu: " \ + RTE_FMT_HEAD(__VA_ARGS__ ,), GetLastError(), \ + RTE_FMT_TAIL(__VA_ARGS__ ,))) #ifdef __cplusplus } diff --git a/lib/efd/rte_efd.c b/lib/efd/rte_efd.c index cd0d90f328..d3b732f2e8 100644 --- a/lib/efd/rte_efd.c +++ b/lib/efd/rte_efd.c @@ -31,8 +31,8 @@ RTE_LOG_REGISTER_DEFAULT(efd_logtype, INFO); #define RTE_LOGTYPE_EFD efd_logtype -#define EFD_LOG(level, fmt, ...) \ - RTE_LOG(level, EFD, fmt "\n", ## __VA_ARGS__) +#define EFD_LOG(level, ...) \ + RTE_LOG_LINE(level, EFD, "" __VA_ARGS__) #define EFD_KEY(key_idx, table) (table->keys + ((key_idx) * table->key_len)) /** Hash function used to determine chunk_id and bin_id for a group */ diff --git a/lib/ethdev/rte_ethdev.h b/lib/ethdev/rte_ethdev.h index e89e474c39..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..1790587808 100644 --- a/lib/eventdev/eventdev_pmd.h +++ b/lib/eventdev/eventdev_pmd.h @@ -33,15 +33,15 @@ extern "C" { /* Logging Macros */ #define RTE_EDEV_LOG_ERR(...) \ - RTE_LOG(ERR, EVENTDEV, \ - RTE_FMT("%s() line %u: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) + 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", \ - __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__,))) + 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 #endif diff --git a/lib/eventdev/rte_event_timer_adapter.c b/lib/eventdev/rte_event_timer_adapter.c index 3f22e85173..e6d3492056 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/fib/fib_log.h b/lib/fib/fib_log.h index aa901cb344..29ee356c4e 100644 --- a/lib/fib/fib_log.h +++ b/lib/fib/fib_log.h @@ -2,5 +2,5 @@ extern int fib_logtype; #define RTE_LOGTYPE_FIB fib_logtype -#define FIB_LOG(level, fmt, ...) \ - RTE_LOG(level, FIB, fmt "\n", ## __VA_ARGS__) +#define FIB_LOG(level, ...) \ + RTE_LOG_LINE(level, FIB, "" __VA_ARGS__) diff --git a/lib/gpudev/gpudev.c b/lib/gpudev/gpudev.c index 6845d18b4d..de8291151f 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..f9274ce96c 100644 --- a/lib/graph/graph_private.h +++ b/lib/graph/graph_private.h @@ -18,11 +18,12 @@ #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", \ - __func__, __LINE__, RTE_FMT_TAIL(__VA_ARGS__, ))) + 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__) #define graph_warn(...) GRAPH_LOG(WARNING, __VA_ARGS__) diff --git a/lib/hash/rte_cuckoo_hash.c b/lib/hash/rte_cuckoo_hash.c index a1b5137bfb..70456754c4 100644 --- a/lib/hash/rte_cuckoo_hash.c +++ b/lib/hash/rte_cuckoo_hash.c @@ -28,8 +28,8 @@ /* needs to be before rte_cuckoo_hash.h */ RTE_LOG_REGISTER_DEFAULT(hash_logtype, INFO); #define RTE_LOGTYPE_HASH hash_logtype -#define HASH_LOG(level, fmt, ...) \ - RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__) +#define HASH_LOG(level, ...) \ + RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) #include "rte_cuckoo_hash.h" diff --git a/lib/hash/rte_fbk_hash.c b/lib/hash/rte_fbk_hash.c index 681286b946..dacb7e8b09 100644 --- a/lib/hash/rte_fbk_hash.c +++ b/lib/hash/rte_fbk_hash.c @@ -21,8 +21,8 @@ RTE_LOG_REGISTER_SUFFIX(fbk_hash_logtype, fbk, INFO); #define RTE_LOGTYPE_HASH fbk_hash_logtype -#define HASH_LOG(level, fmt, ...) \ - RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__) +#define HASH_LOG(level, ...) \ + RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) TAILQ_HEAD(rte_fbk_hash_list, rte_tailq_entry); diff --git a/lib/hash/rte_hash_crc.c b/lib/hash/rte_hash_crc.c index 997ac3c5fa..c037cdb0f0 100644 --- a/lib/hash/rte_hash_crc.c +++ b/lib/hash/rte_hash_crc.c @@ -9,8 +9,8 @@ RTE_LOG_REGISTER_SUFFIX(hash_crc_logtype, crc, INFO); #define RTE_LOGTYPE_HASH_CRC hash_crc_logtype -#define HASH_CRC_LOG(level, fmt, ...) \ - RTE_LOG(level, HASH_CRC, fmt "\n", ## __VA_ARGS__) +#define HASH_CRC_LOG(level, ...) \ + RTE_LOG_LINE(level, HASH_CRC, "" __VA_ARGS__) uint8_t rte_hash_crc32_alg = CRC32_SW; diff --git a/lib/hash/rte_thash.c b/lib/hash/rte_thash.c index 3dcae495e9..e8de071ede 100644 --- a/lib/hash/rte_thash.c +++ b/lib/hash/rte_thash.c @@ -15,8 +15,8 @@ RTE_LOG_REGISTER_SUFFIX(thash_logtype, thash, INFO); #define RTE_LOGTYPE_HASH thash_logtype -#define HASH_LOG(level, fmt, ...) \ - RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__) +#define HASH_LOG(level, ...) \ + RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) #define THASH_NAME_LEN 64 #define TOEPLITZ_HASH_LEN 32 diff --git a/lib/hash/rte_thash_gfni.c b/lib/hash/rte_thash_gfni.c index cd22a649f7..f1525f9838 100644 --- a/lib/hash/rte_thash_gfni.c +++ b/lib/hash/rte_thash_gfni.c @@ -11,8 +11,8 @@ RTE_LOG_REGISTER_SUFFIX(hash_gfni_logtype, gfni, INFO); #define RTE_LOGTYPE_HASH hash_gfni_logtype -#define HASH_LOG(level, fmt, ...) \ - RTE_LOG(level, HASH, fmt "\n", ## __VA_ARGS__) +#define HASH_LOG(level, ...) \ + RTE_LOG_LINE(level, HASH, "" __VA_ARGS__) uint32_t rte_thash_gfni(const uint64_t *mtrx __rte_unused, diff --git a/lib/ip_frag/ip_frag_common.h b/lib/ip_frag/ip_frag_common.h index 4e9637d12f..c766154dbe 100644 --- a/lib/ip_frag/ip_frag_common.h +++ b/lib/ip_frag/ip_frag_common.h @@ -22,8 +22,8 @@ extern int ipfrag_logtype; #define RTE_LOGTYPE_IPFRAG ipfrag_logtype /* logging macros. */ -#define IP_FRAG_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, IPFRAG, fmt "\n", ## __VA_ARGS__) +#define IP_FRAG_LOG_LINE(level, ...) \ + RTE_LOG_LINE(level, IPFRAG, "" __VA_ARGS__) #ifdef RTE_LIBRTE_IP_FRAG_DEBUG #define IP_FRAG_LOG(lvl, fmt, args...) RTE_LOG(lvl, IPFRAG, fmt, ##args) diff --git a/lib/latencystats/rte_latencystats.c b/lib/latencystats/rte_latencystats.c index 6d7c4a3316..4ea9b0d75b 100644 --- a/lib/latencystats/rte_latencystats.c +++ b/lib/latencystats/rte_latencystats.c @@ -27,8 +27,8 @@ latencystat_cycles_per_ns(void) RTE_LOG_REGISTER_DEFAULT(latencystat_logtype, INFO); #define RTE_LOGTYPE_LATENCY_STATS latencystat_logtype -#define LATENCY_STATS_LOG(level, fmt, ...) \ - RTE_LOG(level, LATENCY_STATS, fmt "\n", ## __VA_ARGS__) +#define LATENCY_STATS_LOG(level, ...) \ + RTE_LOG_LINE(level, LATENCY_STATS, "" __VA_ARGS__) static uint64_t timestamp_dynflag; static int timestamp_dynfield_offset = -1; diff --git a/lib/lpm/lpm_log.h b/lib/lpm/lpm_log.h index 1385b9b02a..1a22b573e2 100644 --- a/lib/lpm/lpm_log.h +++ b/lib/lpm/lpm_log.h @@ -2,5 +2,5 @@ extern int lpm_logtype; #define RTE_LOGTYPE_LPM lpm_logtype -#define LPM_LOG(level, fmt, ...) \ - RTE_LOG(level, LPM, fmt "\n", ## __VA_ARGS__) +#define LPM_LOG(level, ...) \ + RTE_LOG_LINE(level, LPM, "" __VA_ARGS__) diff --git a/lib/mbuf/mbuf_log.h b/lib/mbuf/mbuf_log.h index a8a674f6be..8feaf20747 100644 --- a/lib/mbuf/mbuf_log.h +++ b/lib/mbuf/mbuf_log.h @@ -2,5 +2,5 @@ extern int mbuf_logtype; #define RTE_LOGTYPE_MBUF mbuf_logtype -#define MBUF_LOG(level, fmt, ...) \ - RTE_LOG(level, MBUF, fmt "\n", ## __VA_ARGS__) +#define MBUF_LOG(level, ...) \ + RTE_LOG_LINE(level, MBUF, "" __VA_ARGS__) diff --git a/lib/member/member.h b/lib/member/member.h index a7b5b4a57c..cf600c4838 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/mempool/rte_mempool.h b/lib/mempool/rte_mempool.h index e44039dffb..6fa4d482c5 100644 --- a/lib/mempool/rte_mempool.h +++ b/lib/mempool/rte_mempool.h @@ -182,8 +182,8 @@ struct rte_mempool_objtlr { */ extern int rte_mempool_logtype; #define RTE_LOGTYPE_MEMPOOL rte_mempool_logtype -#define RTE_MEMPOOL_LOG(level, fmt, ...) \ - RTE_LOG(level, MEMPOOL, fmt "\n", ## __VA_ARGS__) +#define RTE_MEMPOOL_LOG(level, ...) \ + RTE_LOG_LINE(level, MEMPOOL, "" __VA_ARGS__) /** * A list of memory where objects are stored 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..845fdaa12e 100644 --- a/lib/node/node_private.h +++ b/lib/node/node_private.h @@ -11,11 +11,13 @@ #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__, ))) + RTE_FMT_TAIL(__VA_ARGS__ ,))) #define node_err(node_name, ...) NODE_LOG(ERR, node_name, __VA_ARGS__) #define node_info(node_name, ...) NODE_LOG(INFO, node_name, __VA_ARGS__) diff --git a/lib/pdump/rte_pdump.c b/lib/pdump/rte_pdump.c index 70963e7ee7..f6160f9911 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/pipeline/rte_pipeline.c b/lib/pipeline/rte_pipeline.c index d52b63506e..b0aea4596d 100644 --- a/lib/pipeline/rte_pipeline.c +++ b/lib/pipeline/rte_pipeline.c @@ -12,8 +12,8 @@ #include "rte_pipeline.h" -#define PIPELINE_LOG(level, fmt, ...) \ - RTE_LOG(level, PIPELINE, fmt "\n", ## __VA_ARGS__) +#define PIPELINE_LOG(level, ...) \ + RTE_LOG_LINE(level, PIPELINE, "" __VA_ARGS__) #define RTE_TABLE_INVALID UINT32_MAX diff --git a/lib/port/port_log.h b/lib/port/port_log.h index bc1744bd97..99332a3803 100644 --- a/lib/port/port_log.h +++ b/lib/port/port_log.h @@ -4,6 +4,6 @@ #include -#define PORT_LOG(level, fmt, ...) \ - RTE_LOG(level, PORT, fmt "\n", ## __VA_ARGS__) +#define PORT_LOG(level, ...) \ + RTE_LOG_LINE(level, PORT, "" __VA_ARGS__) diff --git a/lib/power/guest_channel.c b/lib/power/guest_channel.c index 6949f26d33..bc3f55b6bf 100644 --- a/lib/power/guest_channel.c +++ b/lib/power/guest_channel.c @@ -19,8 +19,8 @@ RTE_LOG_REGISTER_SUFFIX(guest_channel_logtype, guest_channel, INFO); #define RTE_LOGTYPE_GUEST_CHANNEL guest_channel_logtype -#define GUEST_CHANNEL_LOG(level, fmt, ...) \ - RTE_LOG(level, GUEST_CHANNEL, fmt "\n", ## __VA_ARGS__) +#define GUEST_CHANNEL_LOG(level, ...) \ + RTE_LOG_LINE(level, GUEST_CHANNEL, "" __VA_ARGS__) /* Timeout for incoming message in milliseconds. */ #define TIMEOUT 10 diff --git a/lib/power/power_common.h b/lib/power/power_common.h index 877ff2ca4c..30966400ba 100644 --- a/lib/power/power_common.h +++ b/lib/power/power_common.h @@ -12,12 +12,12 @@ extern int power_logtype; #define RTE_LOGTYPE_POWER power_logtype -#define POWER_LOG(level, fmt, ...) \ - RTE_LOG(level, POWER, fmt "\n", ## __VA_ARGS__) +#define POWER_LOG(level, ...) \ + RTE_LOG_LINE(level, POWER, "" __VA_ARGS__) #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.c b/lib/rcu/rte_rcu_qsbr.c index 5b6530788a..bd0b83be0c 100644 --- a/lib/rcu/rte_rcu_qsbr.c +++ b/lib/rcu/rte_rcu_qsbr.c @@ -20,7 +20,7 @@ #include "rcu_qsbr_pvt.h" #define RCU_LOG(level, fmt, args...) \ - RTE_LOG(level, RCU, "%s(): " fmt "\n", __func__, ## args) + RTE_LOG_LINE(level, RCU, "%s(): " fmt, __func__, ## args) /* Get the memory size of QSBR variable */ size_t 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 a215d8768e..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/reorder/rte_reorder.c b/lib/reorder/rte_reorder.c index fd550b03af..ff815445a8 100644 --- a/lib/reorder/rte_reorder.c +++ b/lib/reorder/rte_reorder.c @@ -18,8 +18,8 @@ RTE_LOG_REGISTER_DEFAULT(reorder_logtype, INFO); #define RTE_LOGTYPE_REORDER reorder_logtype -#define REORDER_LOG(level, fmt, ...) \ - RTE_LOG(level, REORDER, fmt "\n", ## __VA_ARGS__) +#define REORDER_LOG(level, ...) \ + RTE_LOG_LINE(level, REORDER, "" __VA_ARGS__) TAILQ_HEAD(rte_reorder_list, rte_tailq_entry); diff --git a/lib/rib/rib_log.h b/lib/rib/rib_log.h index ce74a4ce3e..db549d28a7 100644 --- a/lib/rib/rib_log.h +++ b/lib/rib/rib_log.h @@ -4,5 +4,5 @@ extern int rib_logtype; #define RTE_LOGTYPE_RIB rib_logtype -#define RIB_LOG(level, fmt, ...) \ - RTE_LOG(level, RIB, fmt "\n", ## __VA_ARGS__) +#define RIB_LOG(level, ...) \ + RTE_LOG_LINE(level, RIB, "" __VA_ARGS__) diff --git a/lib/ring/rte_ring.c b/lib/ring/rte_ring.c index 118ffab4b9..c59f626263 100644 --- a/lib/ring/rte_ring.c +++ b/lib/ring/rte_ring.c @@ -28,8 +28,8 @@ RTE_LOG_REGISTER_DEFAULT(ring_logtype, INFO); #define RTE_LOGTYPE_RING ring_logtype -#define RING_LOG(level, fmt, ...) \ - RTE_LOG(level, RING, fmt "\n", ## __VA_ARGS__) +#define RING_LOG(level, ...) \ + RTE_LOG_LINE(level, RING, "" __VA_ARGS__) TAILQ_HEAD(rte_ring_list, rte_tailq_entry); diff --git a/lib/sched/rte_sched_log.h b/lib/sched/rte_sched_log.h index d050b8fda1..19ddb655f8 100644 --- a/lib/sched/rte_sched_log.h +++ b/lib/sched/rte_sched_log.h @@ -2,5 +2,5 @@ extern int sched_logtype; #define RTE_LOGTYPE_SCHED sched_logtype -#define SCHED_LOG(level, fmt, ...) \ - RTE_LOG(level, SCHED, fmt "\n", ## __VA_ARGS__) +#define SCHED_LOG(level, ...) \ + RTE_LOG_LINE(level, SCHED, "" __VA_ARGS__) 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/table/table_log.h b/lib/table/table_log.h index b50b20e595..0330f89d41 100644 --- a/lib/table/table_log.h +++ b/lib/table/table_log.h @@ -4,6 +4,6 @@ #include -#define TABLE_LOG(level, fmt, ...) \ - RTE_LOG(level, TABLE, fmt "\n", ## __VA_ARGS__) +#define TABLE_LOG(level, ...) \ + RTE_LOG_LINE(level, TABLE, "" __VA_ARGS__) diff --git a/lib/telemetry/telemetry.c b/lib/telemetry/telemetry.c index 747eba2656..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/fd_man.c b/lib/vhost/fd_man.c index 01cb77257e..79a8d2c006 100644 --- a/lib/vhost/fd_man.c +++ b/lib/vhost/fd_man.c @@ -12,8 +12,8 @@ RTE_LOG_REGISTER_SUFFIX(vhost_fdset_logtype, fdset, INFO); #define RTE_LOGTYPE_VHOST_FDMAN vhost_fdset_logtype -#define VHOST_FDMAN_LOG(level, fmt, ...) \ - RTE_LOG(level, VHOST_FDMAN, fmt "\n", ## __VA_ARGS__) +#define VHOST_FDMAN_LOG(level, ...) \ + RTE_LOG_LINE(level, VHOST_FDMAN, "" __VA_ARGS__) #define FDPOLLERR (POLLERR | POLLHUP | POLLNVAL) diff --git a/lib/vhost/vhost.h b/lib/vhost/vhost.h index e0f6dd4081..470dadbba6 100644 --- a/lib/vhost/vhost.h +++ b/lib/vhost/vhost.h @@ -678,10 +678,10 @@ 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