From ef62ed0ceb305057530b77dd2c193dbe2d87b3aa Mon Sep 17 00:00:00 2001 From: David Marchand Date: Fri, 17 Nov 2023 14:18:24 +0100 Subject: [PATCH] lib: use per line logging in helpers Use RTE_LOG_LINE in existing macros that append a \n. Signed-off-by: David Marchand Reviewed-by: Chengwen Feng Reviewed-by: Andrew Rybchenko --- 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/ethdev/rte_ethdev.h | 3 +-- lib/eventdev/eventdev_pmd.h | 12 ++++++------ lib/eventdev/rte_event_timer_adapter.c | 17 ++++++++++------- lib/gpudev/gpudev.c | 6 ++++-- lib/graph/graph_private.h | 7 ++++--- 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 | 8 +++++--- 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, 83 insertions(+), 79 deletions(-) diff --git a/lib/bbdev/rte_bbdev.c b/lib/bbdev/rte_bbdev.c index e09bb97abbf..13bde3c25b9 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 6a82ae4ef2a..1a3d97d0c7f 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 2f9cc0722ab..6a5e4fd942d 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 b3b193e3eef..01b77642823 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 30ad2d9a950..359b6c2b299 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 009a21849a9..5953a77bd6f 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 e89e474c391..21e3a21903e 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 2ec5aec0a83..1790587808a 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 3f22e85173a..e6d34920561 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 6845d18b4d5..de8291151f2 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 d0ef13b205d..f9274ce96c7 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/member/member.h b/lib/member/member.h index a7b5b4a57c4..cf600c48387 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 1d133e1f8cb..b8c9d75a7de 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 63b2670bb04..5cf6f0566f1 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 900d6de7f47..b401ea3dd88 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 26135aaa5b6..845fdaa12e1 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 70963e7ee7f..f6160f9911c 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 ea2febbd862..4e325481698 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 7b9ef1d09fd..7173282c66c 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 0dca8310c0a..23c9f898057 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 a215d8768e3..a50b841b1ed 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 c7eab4027d9..2dce42a9da8 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 747eba2656c..31e23918676 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 5a74d0e6281..25c0f86e552 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 6e5443e5f88..3704fbbb3d5 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...)