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 2EF424596C; Thu, 12 Sep 2024 10:29:08 +0200 (CEST) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id 16C3340ED3; Thu, 12 Sep 2024 10:29:08 +0200 (CEST) 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 82FFF40E41 for ; Thu, 12 Sep 2024 10:29:06 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1726129746; 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=KhpFLtw0R+QdOOpAXdCr+nl6sr5yC52vFUe89Eh2OPw=; b=UHWvCZHNcYdz60gt1xzOZVpec+Ke2WzpNBV3r5v5BGoMtaEVOQ85wBLFQ7bmy9HCqbvWWT ROgJW2p0E86hYWsBe6K+R6T1fVtEbXxd+qNFIlCZFxYJiK15AHOM7mID27Gxqs7BYJInfk E0SC/INB/AXIZcnNTKxM+fUrwpLNfEU= Received: from mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-599-wl_o0KSOO6y9S38k0e4t4w-1; Thu, 12 Sep 2024 04:29:01 -0400 X-MC-Unique: wl_o0KSOO6y9S38k0e4t4w-1 Received: from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4]) (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 mx-prod-mc-02.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id 1149B1953945; Thu, 12 Sep 2024 08:28:56 +0000 (UTC) Received: from dmarchan.redhat.com (unknown [10.45.224.230]) by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 164583000235; Thu, 12 Sep 2024 08:28:25 +0000 (UTC) From: David Marchand To: dev@dpdk.org Cc: Chengwen Feng , Andrew Rybchenko , Thomas Monjalon , Nicolas Chautru , Gagandeep Singh , Hemant Agrawal , Parav Pandit , Xueming Li , Nipun Gupta , Nikhil Agarwal , Sachin Saxena , Rosen Xu , Tomasz Duszynski , Long Li , Wei Hu , Nithin Dabilpuram , Kiran Kumar K , Sunil Kumar Kori , Satha Rao , Harman Kalra , Anoob Joseph , Jingjing Wu , Chaoyong He , Nagadheeraj Rottela , Srikanth Jampala , Kai Ji , Lee Daly , Pablo de Lara , Fan Zhang , Ashish Gupta , Zhangfei Gao , Sunila Sahu , Jack Bond-Preston , Ajit Khaparde , Raveendra Padasalagi , Vikas Gupta , Sunil Uttarwar , Michael Shamis , Liron Himi , Jay Zhou , Bruce Richardson , Kevin Laatz , Conor Walsh , Gowrishankar Muthukrishnan , Vidya Sagar Velumuri , Abdullah Sevincer , =?UTF-8?q?Mattias=20R=C3=B6nnblom?= , Jerin Jacob , Pavan Nikhilesh , Liang Ma , Peter Mccarthy , Harry van Haaren , Elena Agostini , "John W. Linville" , Ciara Loftus , Maryam Tahhan , Igor Russkikh , Steven Webster , Matt Peters , Selwin Sebastian , Julien Aube , Somnath Kotur , Wathsala Vithanage , Konstantin Ananyev , Chas Williams , "Min Hu (Connor)" , Shai Brandes , Evgeny Schemeilin , Ron Beider , Amit Bernstein , Wajeeh Atrash , Apeksha Gupta , John Daley , Hyong Youb Kim , Gaetan Rivet , Jeroen de Borst , Rushil Gupta , Joshua Washington , Ziyang Xuan , Xiaoyun Wang , Jie Hai , Yisen Zhuang , Jakub Grajciar , Matan Azrad , Viacheslav Ovsiienko , Zyta Szpak , Martin Spinler , Jiawen Wu , Tetsuya Mukawa , Vamsi Attunuru , Cristian Dumitrescu , Stephen Hemminger , Maciej Czekaj , Jian Wang , Maxime Coquelin , Chenbo Xia , Jochen Behrens , Jakub Palider Subject: [PATCH v2 14/14] drivers: use per line logging in helpers Date: Thu, 12 Sep 2024 10:26:40 +0200 Message-ID: <20240912082643.1532679-15-david.marchand@redhat.com> In-Reply-To: <20240912082643.1532679-1-david.marchand@redhat.com> References: <20240907145433.1479091-1-david.marchand@redhat.com> <20240912082643.1532679-1-david.marchand@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.4.1 on 10.30.177.4 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(_DP)?_LINE(_PREFIX)? in existing macros that append a \n. Signed-off-by: David Marchand Acked-by: Chengwen Feng Acked-by: Andrew Rybchenko --- Changes since v1: - when possible, used RTE_LOG_LINE_PREFIX, - used __VA_ARGS__ to avoid adding more gcc specific variadic arguments, - added changes to event/dlb2 and net/bonding, --- devtools/checkpatches.sh | 11 +++- drivers/baseband/acc/acc100_pmd.h | 12 ++-- drivers/baseband/acc/acc_common.h | 6 +- drivers/baseband/acc/rte_acc100_pmd.c | 1 + drivers/baseband/acc/rte_vrb_pmd.c | 1 + drivers/baseband/acc/vrb_pmd.h | 12 ++-- .../baseband/fpga_5gnr_fec/fpga_5gnr_fec.h | 15 ++--- drivers/baseband/fpga_lte_fec/fpga_lte_fec.c | 13 ++-- .../baseband/la12xx/bbdev_la12xx_pmd_logs.h | 16 +++-- drivers/baseband/null/bbdev_null.c | 5 +- .../baseband/turbo_sw/bbdev_turbo_software.c | 6 +- drivers/bus/auxiliary/private.h | 5 +- drivers/bus/cdx/cdx_logs.h | 11 ++-- drivers/bus/dpaa/include/fman.h | 3 +- drivers/bus/dpaa/rte_dpaa_logs.h | 10 ++-- drivers/bus/fslmc/fslmc_logs.h | 11 ++-- drivers/bus/ifpga/ifpga_logs.h | 6 +- drivers/bus/platform/private.h | 3 +- drivers/bus/uacce/uacce.c | 6 +- drivers/bus/vdev/vdev_logs.h | 6 +- drivers/bus/vmbus/private.h | 6 +- drivers/common/cnxk/roc_platform.h | 46 +++++++++----- drivers/common/cpt/cpt_pmd_logs.h | 41 +++++++------ drivers/common/dpaax/dpaax_logs.h | 10 ++-- drivers/common/idpf/idpf_common_logs.h | 29 ++------- drivers/common/nfp/nfp_common_log.h | 6 +- drivers/common/nitrox/nitrox_logs.h | 4 +- drivers/common/octeontx/octeontx_mbox.h | 7 ++- drivers/common/qat/qat_logs.h | 12 ++-- drivers/common/sfc_efx/sfc_efx_log.h | 5 +- .../compress/isal/isal_compress_pmd_private.h | 6 +- drivers/compress/octeontx/otx_zip.h | 7 +-- .../compress/uadk/uadk_compress_pmd_private.h | 8 +-- drivers/compress/zlib/zlib_pmd_private.h | 6 +- drivers/crypto/armv8/armv8_pmd_private.h | 29 ++++----- drivers/crypto/bcmfs/bcmfs_logs.h | 12 ++-- drivers/crypto/caam_jr/caam_jr_log.h | 14 ++--- drivers/crypto/ccp/ccp_pmd_private.h | 19 +++--- drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h | 14 ++--- drivers/crypto/dpaa_sec/dpaa_sec_log.h | 14 ++--- drivers/crypto/ipsec_mb/ipsec_mb_private.h | 7 ++- drivers/crypto/mvsam/mrvl_pmd_private.h | 8 +-- drivers/crypto/null/null_crypto_pmd_private.h | 8 +-- drivers/crypto/openssl/openssl_pmd_private.h | 8 +-- .../crypto/scheduler/scheduler_pmd_private.h | 7 ++- drivers/crypto/uadk/uadk_crypto_pmd_private.h | 8 +-- drivers/crypto/virtio/virtio_logs.h | 36 +++++------ drivers/dma/dpaa/dpaa_qdma_logs.h | 14 ++--- drivers/dma/dpaa2/dpaa2_qdma_logs.h | 14 ++--- drivers/dma/hisilicon/hisi_dmadev.c | 29 +++++---- drivers/dma/idxd/idxd_internal.h | 5 +- drivers/dma/ioat/ioat_internal.h | 5 +- drivers/dma/odm/odm.h | 9 ++- drivers/dma/skeleton/skeleton_dmadev.c | 6 +- drivers/event/dlb2/dlb2_log.h | 8 +-- drivers/event/dpaa/dpaa_eventdev.c | 1 + drivers/event/dpaa/dpaa_eventdev.h | 5 +- drivers/event/dpaa2/dpaa2_eventdev_logs.h | 11 ++-- drivers/event/dsw/dsw_evdev.h | 2 +- drivers/event/octeontx/ssovf_evdev.h | 8 +-- drivers/event/octeontx/timvf_evdev.h | 8 +-- drivers/event/opdl/opdl_log.h | 11 +--- drivers/event/skeleton/skeleton_eventdev.h | 13 ++-- drivers/event/sw/sw_evdev_log.h | 6 +- drivers/gpu/cuda/common.h | 3 +- drivers/mempool/dpaa/dpaa_mempool.h | 5 +- drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h | 10 ++-- drivers/mempool/octeontx/octeontx_pool_logs.h | 7 ++- drivers/net/af_packet/rte_eth_af_packet.c | 12 ++-- drivers/net/af_xdp/rte_eth_af_xdp.c | 4 +- drivers/net/atlantic/atl_logs.h | 22 +++---- drivers/net/avp/avp_logs.h | 12 ++-- drivers/net/axgbe/axgbe_logs.h | 10 ++-- drivers/net/bnx2x/bnx2x_logs.h | 42 ++++++------- drivers/net/bnxt/bnxt.h | 4 +- drivers/net/bnxt/bnxt_rxtx_vec_neon.c | 4 +- drivers/net/bnxt/bnxt_rxtx_vec_sse.c | 4 +- drivers/net/bnxt/bnxt_txr.c | 4 +- drivers/net/bonding/eth_bond_private.h | 6 +- drivers/net/bonding/rte_eth_bond_8023ad.c | 9 ++- drivers/net/bonding/rte_eth_bond_pmd.c | 4 +- drivers/net/cpfl/cpfl_logs.h | 16 ++--- drivers/net/dpaa/dpaa_ethdev.h | 9 ++- drivers/net/dpaa2/dpaa2_pmd_logs.h | 16 +++-- drivers/net/dpaa2/dpaa2_rxtx.c | 30 +++++----- drivers/net/e1000/e1000_logs.h | 26 ++++---- drivers/net/ena/ena_logs.h | 16 ++--- drivers/net/ena/ena_platform.h | 2 +- drivers/net/enetc/enetc_logs.h | 16 +++-- drivers/net/enetfec/enet_pmd_logs.h | 11 ++-- drivers/net/enic/enic_compat.h | 6 +- drivers/net/failsafe/failsafe_private.h | 7 +-- drivers/net/fm10k/fm10k_logs.h | 26 ++++---- drivers/net/gve/gve_logs.h | 6 +- drivers/net/hinic/base/hinic_compat.h | 9 +-- drivers/net/hns3/hns3_logs.h | 41 +++++++------ drivers/net/i40e/i40e_logs.h | 26 ++++---- drivers/net/iavf/iavf_log.h | 31 +++++----- drivers/net/ice/ice_logs.h | 26 ++++---- drivers/net/idpf/idpf_logs.h | 21 ++----- drivers/net/igc/igc_logs.h | 20 +++---- drivers/net/ipn3ke/ipn3ke_logs.h | 6 +- drivers/net/ixgbe/ixgbe_logs.h | 26 ++++---- drivers/net/mana/mana.h | 15 +++-- drivers/net/memif/rte_eth_memif.h | 6 +- drivers/net/mlx4/mlx4_utils.h | 15 ++--- drivers/net/mvneta/mvneta_ethdev.h | 6 +- drivers/net/mvpp2/mrvl_ethdev.h | 6 +- drivers/net/netvsc/hn_logs.h | 26 ++++---- drivers/net/netvsc/hn_rndis.c | 60 +++++++++---------- drivers/net/nfb/nfb.h | 6 +- drivers/net/nfp/nfp_logs.h | 34 +++++------ drivers/net/ngbe/ngbe_logs.h | 28 ++++----- drivers/net/null/rte_eth_null.c | 6 +- drivers/net/octeon_ep/otx_ep_common.h | 25 ++++---- drivers/net/octeon_ep/otx_ep_rxtx.c | 4 +- drivers/net/octeontx/octeontx_logs.h | 21 ++++--- drivers/net/pcap/pcap_osdep.h | 6 +- drivers/net/pfe/pfe_logs.h | 11 ++-- drivers/net/ring/rte_eth_ring.c | 6 +- drivers/net/softnic/rte_eth_softnic.c | 6 +- drivers/net/tap/tap_log.h | 6 +- drivers/net/thunderx/nicvf_logs.h | 18 +++--- drivers/net/txgbe/txgbe_logs.h | 37 ++++++------ drivers/net/vdev_netvsc/vdev_netvsc.c | 7 +-- drivers/net/vhost/rte_eth_vhost.c | 3 +- drivers/net/virtio/virtio_logs.h | 23 ++++--- drivers/net/vmxnet3/vmxnet3_logs.h | 29 +++++---- drivers/raw/cnxk_bphy/rte_pmd_bphy.h | 6 +- drivers/raw/cnxk_gpio/cnxk_gpio.h | 5 +- drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h | 14 ++--- drivers/raw/ifpga/ifpga_rawdev.h | 6 +- drivers/raw/ntb/ntb.h | 6 +- drivers/raw/skeleton/skeleton_rawdev.h | 6 +- drivers/raw/skeleton/skeleton_rawdev_test.c | 5 +- drivers/vdpa/ifc/base/ifcvf.c | 10 ++-- drivers/vdpa/ifc/ifcvf_vdpa.c | 6 +- drivers/vdpa/nfp/nfp_vdpa_log.h | 12 ++-- 138 files changed, 824 insertions(+), 908 deletions(-) diff --git a/devtools/checkpatches.sh b/devtools/checkpatches.sh index 8f245ebdab..0ab841bd5a 100755 --- a/devtools/checkpatches.sh +++ b/devtools/checkpatches.sh @@ -53,7 +53,7 @@ print_usage () { check_forbidden_additions() { # res=0 - # refrain from new calls to RTE_LOG + # refrain from new calls to RTE_LOG in libraries awk -v FOLDERS="lib" \ -v EXPRESSIONS="RTE_LOG\\\(" \ -v RET_ON_FAIL=1 \ @@ -61,6 +61,15 @@ check_forbidden_additions() { # -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ "$1" || res=1 + # refrain from new calls to RTE_LOG in drivers (but leave some leeway for base drivers) + awk -v FOLDERS="drivers" \ + -v SKIP_FILES='osdep.h$' \ + -v EXPRESSIONS="RTE_LOG\\\( RTE_LOG_DP\\\( rte_log\\\(" \ + -v RET_ON_FAIL=1 \ + -v MESSAGE='Prefer RTE_LOG_LINE/RTE_LOG_DP_LINE' \ + -f $(dirname $(readlink -f $0))/check-forbidden-tokens.awk \ + "$1" || res=1 + # no output on stdout or stderr awk -v FOLDERS="lib drivers" \ -v EXPRESSIONS="\\\ \\\>") /* DP Logs, toggled out at compile time if level lower than current level */ -#define rte_bbdev_dp_log(level, fmt, args...) \ - RTE_LOG_DP(level, BBDEV_LA12XX, fmt, ## args) +#define rte_bbdev_dp_log(level, ...) \ + RTE_LOG_DP_LINE(level, BBDEV_LA12XX, __VA_ARGS__) #endif /* _BBDEV_LA12XX_PMD_LOGS_H_ */ diff --git a/drivers/baseband/null/bbdev_null.c b/drivers/baseband/null/bbdev_null.c index 75f78993fa..dab416aa41 100644 --- a/drivers/baseband/null/bbdev_null.c +++ b/drivers/baseband/null/bbdev_null.c @@ -17,10 +17,11 @@ #define DRIVER_NAME baseband_null RTE_LOG_REGISTER_DEFAULT(bbdev_null_logtype, NOTICE); +#define RTE_LOGTYPE_BBDEV_NULL bbdev_null_logtype /* Helper macro for logging */ -#define rte_bbdev_log(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, bbdev_null_logtype, fmt "\n", ##__VA_ARGS__) +#define rte_bbdev_log(level, ...) \ + RTE_LOG_LINE(level, BBDEV_NULL, __VA_ARGS__) #define rte_bbdev_log_debug(fmt, ...) \ rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \ diff --git a/drivers/baseband/turbo_sw/bbdev_turbo_software.c b/drivers/baseband/turbo_sw/bbdev_turbo_software.c index 1f661dd801..e527008524 100644 --- a/drivers/baseband/turbo_sw/bbdev_turbo_software.c +++ b/drivers/baseband/turbo_sw/bbdev_turbo_software.c @@ -37,11 +37,11 @@ #define DRIVER_NAME baseband_turbo_sw RTE_LOG_REGISTER_DEFAULT(bbdev_turbo_sw_logtype, NOTICE); +#define RTE_LOGTYPE_BBDEV_TURBO_SW bbdev_turbo_sw_logtype /* Helper macro for logging */ -#define rte_bbdev_log(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, bbdev_turbo_sw_logtype, fmt "\n", \ - ##__VA_ARGS__) +#define rte_bbdev_log(level, ...) \ + RTE_LOG_LINE(level, BBDEV_TURBO_SW, __VA_ARGS__) #define rte_bbdev_log_debug(fmt, ...) \ rte_bbdev_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \ diff --git a/drivers/bus/auxiliary/private.h b/drivers/bus/auxiliary/private.h index 3dee13e1d1..4604f6f4a7 100644 --- a/drivers/bus/auxiliary/private.h +++ b/drivers/bus/auxiliary/private.h @@ -14,11 +14,10 @@ #include "bus_auxiliary_driver.h" extern int auxiliary_bus_logtype; +#define RTE_LOGTYPE_AUXILIARY_BUS auxiliary_bus_logtype #define AUXILIARY_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, auxiliary_bus_logtype, \ - RTE_FMT("auxiliary bus: " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, AUXILIARY_BUS, __VA_ARGS__) /* * Structure describing the auxiliary bus diff --git a/drivers/bus/cdx/cdx_logs.h b/drivers/bus/cdx/cdx_logs.h index 0ec39e9dd4..18b4010746 100644 --- a/drivers/bus/cdx/cdx_logs.h +++ b/drivers/bus/cdx/cdx_logs.h @@ -6,15 +6,14 @@ #define CDX_LOGS_H extern int cdx_logtype_bus; +#define RTE_LOGTYPE_CDX_BUS cdx_logtype_bus -#define CDX_BUS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, cdx_logtype_bus, "cdx: " fmt "\n", \ - ##args) +#define CDX_BUS_LOG(level, ...) \ + RTE_LOG_LINE(level, CDX_BUS, __VA_ARGS__) /* Debug logs with Function names */ -#define CDX_BUS_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, cdx_logtype_bus, "cdx: %s(): " fmt "\n", \ - __func__, ##args) +#define CDX_BUS_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, CDX_BUS, "%s(): ", __func__, __VA_ARGS__) #define CDX_BUS_INFO(fmt, args...) \ CDX_BUS_LOG(INFO, fmt, ## args) diff --git a/drivers/bus/dpaa/include/fman.h b/drivers/bus/dpaa/include/fman.h index 19f6132bba..f918836ec2 100644 --- a/drivers/bus/dpaa/include/fman.h +++ b/drivers/bus/dpaa/include/fman.h @@ -403,8 +403,7 @@ extern int fman_ccsr_map_fd; #define FMAN_ERR(rc, fmt, args...) \ do { \ _errno = (rc); \ - rte_log(RTE_LOG_ERR, dpaa_logtype_bus, "dpaa: " fmt "(%d)\n", \ - ##args, errno); \ + RTE_LOG_LINE(ERR, DPAA_BUS, fmt "(%d)", ##args, errno); \ } while (0) #define FMAN_IP_REV_1 0xC30C4 diff --git a/drivers/bus/dpaa/rte_dpaa_logs.h b/drivers/bus/dpaa/rte_dpaa_logs.h index 149b127434..1e61b4e76b 100644 --- a/drivers/bus/dpaa/rte_dpaa_logs.h +++ b/drivers/bus/dpaa/rte_dpaa_logs.h @@ -10,9 +10,10 @@ #include extern int dpaa_logtype_bus; +#define RTE_LOGTYPE_DPAA_BUS dpaa_logtype_bus -#define DPAA_BUS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa_logtype_bus, "dpaa: " fmt "\n", ##args) +#define DPAA_BUS_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA_BUS, __VA_ARGS__) #ifdef RTE_LIBRTE_DPAA_DEBUG_BUS #define DPAA_BUS_HWWARN(cond, fmt, args...) \ @@ -24,9 +25,8 @@ extern int dpaa_logtype_bus; #define DPAA_BUS_HWWARN(cond, fmt, args...) do { } while (0) #endif -#define DPAA_BUS_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa_logtype_bus, "dpaa: %s(): " fmt "\n", \ - __func__, ##args) +#define DPAA_BUS_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA_BUS, "%s(): ", __func__, __VA_ARGS__) #define BUS_INIT_FUNC_TRACE() DPAA_BUS_DEBUG(" >>") diff --git a/drivers/bus/fslmc/fslmc_logs.h b/drivers/bus/fslmc/fslmc_logs.h index e15c603426..ac0cd3dc29 100644 --- a/drivers/bus/fslmc/fslmc_logs.h +++ b/drivers/bus/fslmc/fslmc_logs.h @@ -8,15 +8,14 @@ #define _FSLMC_LOGS_H_ extern int dpaa2_logtype_bus; +#define RTE_LOGTYPE_DPAA2_BUS dpaa2_logtype_bus -#define DPAA2_BUS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_logtype_bus, "fslmc: " fmt "\n", \ - ##args) +#define DPAA2_BUS_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_BUS, __VA_ARGS__) /* Debug logs are with Function names */ -#define DPAA2_BUS_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_logtype_bus, "fslmc: %s(): " fmt "\n", \ - __func__, ##args) +#define DPAA2_BUS_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_BUS, "%s(): ", __func__, __VA_ARGS__) #define DPAA2_BUS_INFO(fmt, args...) \ DPAA2_BUS_LOG(INFO, fmt, ## args) diff --git a/drivers/bus/ifpga/ifpga_logs.h b/drivers/bus/ifpga/ifpga_logs.h index 248bccba5d..154405a590 100644 --- a/drivers/bus/ifpga/ifpga_logs.h +++ b/drivers/bus/ifpga/ifpga_logs.h @@ -8,10 +8,10 @@ #include extern int ifpga_bus_logtype; +#define RTE_LOGTYPE_IFPGA_BUS ifpga_bus_logtype -#define IFPGA_BUS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ifpga_bus_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define IFPGA_BUS_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IFPGA_BUS, "%s(): ", __func__, __VA_ARGS__) #define IFPGA_BUS_FUNC_TRACE() IFPGA_BUS_LOG(DEBUG, ">>") diff --git a/drivers/bus/platform/private.h b/drivers/bus/platform/private.h index 72185aa457..d89ba0e4a5 100644 --- a/drivers/bus/platform/private.h +++ b/drivers/bus/platform/private.h @@ -35,8 +35,7 @@ struct rte_platform_bus { extern int platform_bus_logtype; #define RTE_LOGTYPE_PLATFORM_BUS platform_bus_logtype #define PLATFORM_LOG_LINE(level, ...) \ - RTE_LOG(level, PLATFORM_BUS, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, PLATFORM_BUS, __VA_ARGS__) /* * Iterate registered platform devices and find one that matches provided string. diff --git a/drivers/bus/uacce/uacce.c b/drivers/bus/uacce/uacce.c index 8b666c4e30..c1529c38c0 100644 --- a/drivers/bus/uacce/uacce.c +++ b/drivers/bus/uacce/uacce.c @@ -59,9 +59,9 @@ static const char *const uacce_params_keys[] = { RTE_TAILQ_FOREACH(p, &uacce_bus.driver_list, next) extern int uacce_bus_logtype; -#define UACCE_BUS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, uacce_bus_logtype, "uacce: " fmt "\n", \ - ##args) +#define RTE_LOGTYPE_UACCE_BUS uacce_bus_logtype +#define UACCE_BUS_LOG(level, ...) \ + RTE_LOG_LINE(level, UACCE_BUS, __VA_ARGS__) #define UACCE_BUS_ERR(fmt, args...) UACCE_BUS_LOG(ERR, fmt, ##args) #define UACCE_BUS_WARN(fmt, args...) UACCE_BUS_LOG(WARNING, fmt, ##args) #define UACCE_BUS_INFO(fmt, args...) UACCE_BUS_LOG(INFO, fmt, ##args) diff --git a/drivers/bus/vdev/vdev_logs.h b/drivers/bus/vdev/vdev_logs.h index 8759374193..38859ae4b7 100644 --- a/drivers/bus/vdev/vdev_logs.h +++ b/drivers/bus/vdev/vdev_logs.h @@ -8,9 +8,9 @@ #include extern int vdev_logtype_bus; +#define RTE_LOGTYPE_VDEV_BUS vdev_logtype_bus -#define VDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, vdev_logtype_bus, "%s(): " fmt "\n", \ - __func__, ##args) +#define VDEV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VDEV_BUS, "%s(): ", __func__, __VA_ARGS__) #endif /* _VDEV_LOGS_H_ */ diff --git a/drivers/bus/vmbus/private.h b/drivers/bus/vmbus/private.h index e33424675c..abee1b29f0 100644 --- a/drivers/bus/vmbus/private.h +++ b/drivers/bus/vmbus/private.h @@ -34,9 +34,9 @@ extern struct rte_vmbus_bus rte_vmbus_bus; RTE_TAILQ_FOREACH(p, &(rte_vmbus_bus.driver_list), next) extern int vmbus_logtype_bus; -#define VMBUS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, vmbus_logtype_bus, "%s(): " fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_VMBUS_BUS vmbus_logtype_bus +#define VMBUS_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VMBUS_BUS, "%s(): ", __func__, __VA_ARGS__) struct vmbus_br { struct vmbus_bufring *vbr; diff --git a/drivers/common/cnxk/roc_platform.h b/drivers/common/cnxk/roc_platform.h index 658bafb935..6944e72669 100644 --- a/drivers/common/cnxk/roc_platform.h +++ b/drivers/common/cnxk/roc_platform.h @@ -260,37 +260,50 @@ plt_thread_is_valid(plt_thread_t thr) /* Log */ extern int cnxk_logtype_base; +#define RTE_LOGTYPE_base cnxk_logtype_base extern int cnxk_logtype_mbox; +#define RTE_LOGTYPE_mbox cnxk_logtype_mbox extern int cnxk_logtype_cpt; +#define RTE_LOGTYPE_cpt cnxk_logtype_cpt extern int cnxk_logtype_ml; +#define RTE_LOGTYPE_ml cnxk_logtype_ml extern int cnxk_logtype_npa; +#define RTE_LOGTYPE_npa cnxk_logtype_npa extern int cnxk_logtype_nix; +#define RTE_LOGTYPE_nix cnxk_logtype_nix extern int cnxk_logtype_npc; +#define RTE_LOGTYPE_npc cnxk_logtype_npc extern int cnxk_logtype_sso; +#define RTE_LOGTYPE_sso cnxk_logtype_sso extern int cnxk_logtype_tim; +#define RTE_LOGTYPE_tim cnxk_logtype_tim extern int cnxk_logtype_tm; +#define RTE_LOGTYPE_tm cnxk_logtype_tm extern int cnxk_logtype_ree; +#define RTE_LOGTYPE_ree cnxk_logtype_ree extern int cnxk_logtype_dpi; +#define RTE_LOGTYPE_dpi cnxk_logtype_dpi extern int cnxk_logtype_rep; +#define RTE_LOGTYPE_rep cnxk_logtype_rep extern int cnxk_logtype_esw; +#define RTE_LOGTYPE_esw cnxk_logtype_esw #define RTE_LOGTYPE_CNXK cnxk_logtype_base -#define plt_err(fmt, args...) \ - RTE_LOG(ERR, CNXK, "%s():%u " fmt "\n", __func__, __LINE__, ##args) -#define plt_info(fmt, args...) RTE_LOG(INFO, CNXK, fmt "\n", ##args) -#define plt_warn(fmt, args...) RTE_LOG(WARNING, CNXK, fmt "\n", ##args) -#define plt_print(fmt, args...) RTE_LOG(INFO, CNXK, fmt "\n", ##args) +#define plt_err(...) \ + RTE_LOG_LINE_PREFIX(ERR, CNXK, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) +#define plt_info(...) RTE_LOG_LINE(INFO, CNXK, __VA_ARGS__) +#define plt_warn(...) RTE_LOG_LINE(WARNING, CNXK, __VA_ARGS__) +#define plt_print(...) RTE_LOG_LINE(INFO, CNXK, __VA_ARGS__) #define plt_dump(fmt, ...) fprintf(stderr, fmt "\n", ##__VA_ARGS__) #define plt_dump_no_nl(fmt, ...) fprintf(stderr, fmt, ##__VA_ARGS__) /** * Log debug message if given subsystem logging is enabled. */ -#define plt_dbg(subsystem, fmt, args...) \ - rte_log(RTE_LOG_DEBUG, cnxk_logtype_##subsystem, \ - "[%s] %s():%u " fmt "\n", #subsystem, __func__, __LINE__, \ -##args) +#define plt_dbg(subsystem, ...) \ + RTE_LOG_LINE_PREFIX(DEBUG, subsystem, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, \ + __VA_ARGS__) #define plt_base_dbg(fmt, ...) plt_dbg(base, fmt, ##__VA_ARGS__) #define plt_cpt_dbg(fmt, ...) plt_dbg(cpt, fmt, ##__VA_ARGS__) @@ -308,12 +321,15 @@ extern int cnxk_logtype_esw; #define plt_esw_dbg(fmt, ...) plt_dbg(esw, fmt, ##__VA_ARGS__) /* Datapath logs */ -#define plt_dp_err(fmt, args...) \ - RTE_LOG_DP(ERR, CNXK, "%s():%u " fmt "\n", __func__, __LINE__, ##args) -#define plt_dp_info(fmt, args...) \ - RTE_LOG_DP(INFO, CNXK, "%s():%u " fmt "\n", __func__, __LINE__, ##args) -#define plt_dp_dbg(fmt, args...) \ - RTE_LOG_DP(DEBUG, CNXK, "%s():%u " fmt "\n", __func__, __LINE__, ##args) +#define plt_dp_err(...) \ + RTE_LOG_DP_LINE_PREFIX(ERR, CNXK, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, \ + __VA_ARGS__) +#define plt_dp_info(...) \ + RTE_LOG_DP_LINE_PREFIX(INFO, CNXK, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, \ + __VA_ARGS__) +#define plt_dp_dbg(...) \ + RTE_LOG_DP_LINE_PREFIX(DEBUG, CNXK, "%s():%u ", __func__ RTE_LOG_COMMA __LINE__, \ + __VA_ARGS__) #ifdef __cplusplus #define CNXK_PCI_ID(subsystem_dev, dev) \ diff --git a/drivers/common/cpt/cpt_pmd_logs.h b/drivers/common/cpt/cpt_pmd_logs.h index 3c109c1983..20eb8d63ed 100644 --- a/drivers/common/cpt/cpt_pmd_logs.h +++ b/drivers/common/cpt/cpt_pmd_logs.h @@ -17,32 +17,31 @@ */ #define RTE_LOGTYPE_CPT CPT_LOGTYPE -#define CPT_PMD_DRV_LOG_RAW(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, CPT_LOGTYPE, \ - "cpt: %s(): " fmt "\n", __func__, ##args) +#define CPT_PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, CPT, "%s(): ", __func__, __VA_ARGS__) -#define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG_RAW(DEBUG, " >>") +#define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG(DEBUG, " >>") -#define CPT_LOG_INFO(fmt, args...) \ - CPT_PMD_DRV_LOG_RAW(INFO, fmt, ## args) -#define CPT_LOG_WARN(fmt, args...) \ - CPT_PMD_DRV_LOG_RAW(WARNING, fmt, ## args) -#define CPT_LOG_ERR(fmt, args...) \ - CPT_PMD_DRV_LOG_RAW(ERR, fmt, ## args) +#define CPT_LOG_INFO(...) \ + CPT_PMD_DRV_LOG(INFO, __VA_ARGS__) +#define CPT_LOG_WARN(...) \ + CPT_PMD_DRV_LOG(WARNING, __VA_ARGS__) +#define CPT_LOG_ERR(...) \ + CPT_PMD_DRV_LOG(ERR, __VA_ARGS__) /* * DP logs, toggled out at compile time if level lower than current level. */ -#define CPT_LOG_DP(level, fmt, args...) \ - RTE_LOG_DP(level, CPT, fmt "\n", ## args) - -#define CPT_LOG_DP_DEBUG(fmt, args...) \ - CPT_LOG_DP(DEBUG, fmt, ## args) -#define CPT_LOG_DP_INFO(fmt, args...) \ - CPT_LOG_DP(INFO, fmt, ## args) -#define CPT_LOG_DP_WARN(fmt, args...) \ - CPT_LOG_DP(WARNING, fmt, ## args) -#define CPT_LOG_DP_ERR(fmt, args...) \ - CPT_LOG_DP(ERR, fmt, ## args) +#define CPT_LOG_DP(level, ...) \ + RTE_LOG_DP_LINE(level, CPT, __VA_ARGS__) + +#define CPT_LOG_DP_DEBUG(...) \ + CPT_LOG_DP(DEBUG, __VA_ARGS__) +#define CPT_LOG_DP_INFO(...) \ + CPT_LOG_DP(INFO, __VA_ARGS__) +#define CPT_LOG_DP_WARN(...) \ + CPT_LOG_DP(WARNING, __VA_ARGS__) +#define CPT_LOG_DP_ERR(...) \ + CPT_LOG_DP(ERR, __VA_ARGS__) #endif /* _CPT_PMD_LOGS_H_ */ diff --git a/drivers/common/dpaax/dpaax_logs.h b/drivers/common/dpaax/dpaax_logs.h index fe43bbc8f1..6ed29fb2ea 100644 --- a/drivers/common/dpaax/dpaax_logs.h +++ b/drivers/common/dpaax/dpaax_logs.h @@ -20,14 +20,12 @@ extern int dpaax_logger; #define DPAAX_HWWARN(cond, fmt, args...) do { } while (0) #endif -#define DPAAX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaax_logger, "dpaax: " fmt "\n", \ - ##args) +#define DPAAX_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAAX_LOGGER, __VA_ARGS__) /* Debug logs are with Function names */ -#define DPAAX_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaax_logger, "dpaax: %s(): " fmt "\n", \ - __func__, ##args) +#define DPAAX_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAAX_LOGGER, "%s(): ", __func__, __VA_ARGS__) #define DPAAX_INFO(fmt, args...) \ DPAAX_LOG(INFO, fmt, ## args) diff --git a/drivers/common/idpf/idpf_common_logs.h b/drivers/common/idpf/idpf_common_logs.h index 561836760c..a60f4f0e60 100644 --- a/drivers/common/idpf/idpf_common_logs.h +++ b/drivers/common/idpf/idpf_common_logs.h @@ -10,36 +10,19 @@ extern int idpf_common_logtype; #define RTE_LOGTYPE_IDPF_COMMON idpf_common_logtype -#define DRV_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, \ - idpf_common_logtype, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) +#define DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IDPF_COMMON, "%s(): ", __func__, __VA_ARGS__) #ifdef RTE_LIBRTE_IDPF_DEBUG_RX -#define RX_LOG(level, ...) \ - RTE_LOG(level, \ - IDPF_COMMON, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) +#define RX_LOG(...) DRV_LOG(__VA_ARGS__) #else -#define RX_LOG(level, fmt, args...) do { } while (0) +#define RX_LOG(...) do {} while (0) #endif #ifdef RTE_LIBRTE_IDPF_DEBUG_TX -#define TX_LOG(level, ...) \ - RTE_LOG(level, \ - IDPF_COMMON, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) +#define TX_LOG(...) DRV_LOG(__VA_ARGS__) #else -#define TX_LOG(level, fmt, args...) do { } while (0) +#define TX_LOG(...) do {} while (0) #endif #endif /* _IDPF_COMMON_LOGS_H_ */ diff --git a/drivers/common/nfp/nfp_common_log.h b/drivers/common/nfp/nfp_common_log.h index 066e38e688..040bca7e51 100644 --- a/drivers/common/nfp/nfp_common_log.h +++ b/drivers/common/nfp/nfp_common_log.h @@ -9,8 +9,8 @@ #include extern int nfp_logtype_common; -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_common, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_COMMON nfp_logtype_common +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_COMMON, "%s(): ", __func__, __VA_ARGS__) #endif/* __NFP_COMMON_LOG_H__ */ diff --git a/drivers/common/nitrox/nitrox_logs.h b/drivers/common/nitrox/nitrox_logs.h index 67964447eb..6f5f58dda6 100644 --- a/drivers/common/nitrox/nitrox_logs.h +++ b/drivers/common/nitrox/nitrox_logs.h @@ -7,7 +7,7 @@ extern int nitrox_logtype; #define RTE_LOGTYPE_NITROX nitrox_logtype -#define NITROX_LOG_LINE(level, fmt, args...) \ - RTE_LOG(level, NITROX, "%s:%d " fmt "\n", __func__, __LINE__, ## args) +#define NITROX_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NITROX, "%s:%d ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #endif /* _NITROX_LOGS_H_ */ diff --git a/drivers/common/octeontx/octeontx_mbox.h b/drivers/common/octeontx/octeontx_mbox.h index ab4c010558..c551f179d7 100644 --- a/drivers/common/octeontx/octeontx_mbox.h +++ b/drivers/common/octeontx/octeontx_mbox.h @@ -17,9 +17,9 @@ #define RM_INTERFACE_VERSION 0x2 -#define MBOX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, octeontx_logtype_mbox,\ - "%s() line %u: " fmt "\n", __func__, __LINE__, ## args) +#define MBOX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OCTEONTX_MBOX, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #define mbox_log_info(fmt, ...) MBOX_LOG(INFO, fmt, ##__VA_ARGS__) #define mbox_log_dbg(fmt, ...) MBOX_LOG(DEBUG, fmt, ##__VA_ARGS__) @@ -27,6 +27,7 @@ #define mbox_func_trace mbox_log_dbg extern int octeontx_logtype_mbox; +#define RTE_LOGTYPE_OCTEONTX_MBOX octeontx_logtype_mbox struct octeontx_mbox_hdr { uint16_t vfid; /* VF index or pf resource index local to the domain */ diff --git a/drivers/common/qat/qat_logs.h b/drivers/common/qat/qat_logs.h index 2e4d3945cb..9ccef818cc 100644 --- a/drivers/common/qat/qat_logs.h +++ b/drivers/common/qat/qat_logs.h @@ -6,15 +6,15 @@ #define _QAT_LOGS_H_ extern int qat_gen_logtype; +#define RTE_LOGTYPE_QAT_GEN qat_gen_logtype extern int qat_dp_logtype; +#define RTE_LOGTYPE_QAT_DP qat_dp_logtype -#define QAT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, qat_gen_logtype, \ - "%s(): " fmt "\n", __func__, ## args) +#define QAT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, QAT_GEN, "%s(): ", __func__, __VA_ARGS__) -#define QAT_DP_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, qat_dp_logtype, \ - "%s(): " fmt "\n", __func__, ## args) +#define QAT_DP_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, QAT_DP, "%s(): ", __func__, __VA_ARGS__) #define QAT_DP_HEXDUMP_LOG(level, title, buf, len) \ qat_hexdump_log(RTE_LOG_ ## level, qat_dp_logtype, title, buf, len) diff --git a/drivers/common/sfc_efx/sfc_efx_log.h b/drivers/common/sfc_efx/sfc_efx_log.h index 1519ebdc17..b41ef3490b 100644 --- a/drivers/common/sfc_efx/sfc_efx_log.h +++ b/drivers/common/sfc_efx/sfc_efx_log.h @@ -12,11 +12,10 @@ /** Generic driver log type */ extern int sfc_efx_logtype; +#define RTE_LOGTYPE_SFC_EFX sfc_efx_logtype /** Log message, add a prefix and a line break */ #define SFC_EFX_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, sfc_efx_logtype, \ - RTE_FMT("sfc_efx: " RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__ ,))) + RTE_LOG_LINE(level, SFC_EFX, ## __VA_ARGS__) #endif /* _SFC_EFX_LOG_H_ */ diff --git a/drivers/compress/isal/isal_compress_pmd_private.h b/drivers/compress/isal/isal_compress_pmd_private.h index c713a5bb6c..e6e3cfb50c 100644 --- a/drivers/compress/isal/isal_compress_pmd_private.h +++ b/drivers/compress/isal/isal_compress_pmd_private.h @@ -9,9 +9,9 @@ /**< ISA-L comp PMD device name */ extern int isal_logtype_driver; -#define ISAL_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, isal_logtype_driver, "%s(): "fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_ISAL_DRIVER isal_logtype_driver +#define ISAL_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ISAL_DRIVER, "%s(): ", __func__, __VA_ARGS__) /* private data structure for each ISA-L compression device */ struct isal_comp_private { diff --git a/drivers/compress/octeontx/otx_zip.h b/drivers/compress/octeontx/otx_zip.h index 7353fd4957..bf09e2f58c 100644 --- a/drivers/compress/octeontx/otx_zip.h +++ b/drivers/compress/octeontx/otx_zip.h @@ -18,6 +18,7 @@ #include extern int octtx_zip_logtype_driver; +#define RTE_LOGTYPE_OCTTX_ZIP_DRIVER octtx_zip_logtype_driver /* ZIP VF Control/Status registers (CSRs): */ /* VF_BAR0: */ @@ -76,10 +77,8 @@ extern int octtx_zip_logtype_driver; /**< ZIP PMD device name */ #define COMPRESSDEV_NAME_ZIP_PMD compress_octeontx -#define ZIP_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, \ - octtx_zip_logtype_driver, "%s(): "fmt "\n", \ - __func__, ##args) +#define ZIP_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OCTTX_ZIP_DRIVER, "%s(): ", __func__, __VA_ARGS__) #define ZIP_PMD_INFO(fmt, args...) \ ZIP_PMD_LOG(INFO, fmt, ## args) diff --git a/drivers/compress/uadk/uadk_compress_pmd_private.h b/drivers/compress/uadk/uadk_compress_pmd_private.h index b09569fb94..6db53744fd 100644 --- a/drivers/compress/uadk/uadk_compress_pmd_private.h +++ b/drivers/compress/uadk/uadk_compress_pmd_private.h @@ -27,10 +27,10 @@ struct uadk_compress_xform { }; extern int uadk_compress_logtype; +#define RTE_LOGTYPE_UADK_COMPRESS uadk_compress_logtype -#define UADK_LOG(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, uadk_compress_logtype, \ - "%s() line %u: " fmt "\n", __func__, __LINE__, \ - ## __VA_ARGS__) +#define UADK_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, UADK_COMPRESS, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #endif /* _UADK_COMPRESS_PMD_PRIVATE_H_ */ diff --git a/drivers/compress/zlib/zlib_pmd_private.h b/drivers/compress/zlib/zlib_pmd_private.h index 46a33d4d1b..7f6a57c6c5 100644 --- a/drivers/compress/zlib/zlib_pmd_private.h +++ b/drivers/compress/zlib/zlib_pmd_private.h @@ -15,9 +15,9 @@ #define DEF_MEM_LEVEL 8 extern int zlib_logtype_driver; -#define ZLIB_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, zlib_logtype_driver, "%s(): "fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_ZLIB_DRIVER zlib_logtype_driver +#define ZLIB_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ZLIB_DRIVER, "%s(): ", __func__, __VA_ARGS__) #define ZLIB_PMD_INFO(fmt, args...) \ ZLIB_PMD_LOG(INFO, fmt, ## args) diff --git a/drivers/crypto/armv8/armv8_pmd_private.h b/drivers/crypto/armv8/armv8_pmd_private.h index c9bbcc2b74..ebae97911a 100644 --- a/drivers/crypto/armv8/armv8_pmd_private.h +++ b/drivers/crypto/armv8/armv8_pmd_private.h @@ -11,24 +11,19 @@ /**< ARMv8 Crypto PMD device name */ extern int crypto_armv8_log_type; +#define RTE_LOGTYPE_CRYPTO_ARMV8 crypto_armv8_log_type -#define ARMV8_CRYPTO_LOG_ERR(fmt, args...) \ - rte_log(RTE_LOG_ERR, crypto_armv8_log_type, \ - "[%s] %s() line %u: " fmt "\n", \ - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), \ - __func__, __LINE__, ## args) - -#define ARMV8_CRYPTO_LOG_INFO(fmt, args...) \ - rte_log(RTE_LOG_INFO, crypto_armv8_log_type, \ - "[%s] %s() line %u: " fmt "\n", \ - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), \ - __func__, __LINE__, ## args) - -#define ARMV8_CRYPTO_LOG_DBG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, crypto_armv8_log_type, \ - "[%s] %s() line %u: " fmt "\n", \ - RTE_STR(CRYPTODEV_NAME_ARMV8_PMD), \ - __func__, __LINE__, ## args) +#define ARMV8_CRYPTO_LOG_ERR(...) \ + RTE_LOG_LINE_PREFIX(ERR, CRYPTO_ARMV8, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) + +#define ARMV8_CRYPTO_LOG_INFO(...) \ + RTE_LOG_LINE_PREFIX(INFO, CRYPTO_ARMV8, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) + +#define ARMV8_CRYPTO_LOG_DBG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, CRYPTO_ARMV8, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #define NBBY 8 /* Number of bits in a byte */ #define BYTE_LENGTH(x) ((x) / NBBY) /* Number of bytes in x (round down) */ diff --git a/drivers/crypto/bcmfs/bcmfs_logs.h b/drivers/crypto/bcmfs/bcmfs_logs.h index c03a49b75c..c12ca33f27 100644 --- a/drivers/crypto/bcmfs/bcmfs_logs.h +++ b/drivers/crypto/bcmfs/bcmfs_logs.h @@ -9,15 +9,15 @@ #include extern int bcmfs_conf_logtype; +#define RTE_LOGTYPE_BCMFS_CONF bcmfs_conf_logtype extern int bcmfs_dp_logtype; +#define RTE_LOGTYPE_BCMFS_DP bcmfs_dp_logtype -#define BCMFS_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bcmfs_conf_logtype, \ - "%s(): " fmt "\n", __func__, ## args) +#define BCMFS_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, BCMFS_CONF, "%s(): ", __func__, __VA_ARGS__) -#define BCMFS_DP_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bcmfs_dp_logtype, \ - "%s(): " fmt "\n", __func__, ## args) +#define BCMFS_DP_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, BCMFS_DP, "%s(): ", __func__, __VA_ARGS__) #define BCMFS_DP_HEXDUMP_LOG(level, title, buf, len) \ bcmfs_hexdump_log(RTE_LOG_ ## level, bcmfs_dp_logtype, title, buf, len) diff --git a/drivers/crypto/caam_jr/caam_jr_log.h b/drivers/crypto/caam_jr/caam_jr_log.h index 8f6aa50e2a..7c50119106 100644 --- a/drivers/crypto/caam_jr/caam_jr_log.h +++ b/drivers/crypto/caam_jr/caam_jr_log.h @@ -10,13 +10,11 @@ extern int caam_jr_logtype; #define RTE_LOGTYPE_CAAM_JR caam_jr_logtype -#define CAAM_JR_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, caam_jr_logtype, "caam_jr: " \ - fmt "\n", ##args) +#define CAAM_JR_LOG(level, ...) \ + RTE_LOG_LINE(level, CAAM_JR, __VA_ARGS__) -#define CAAM_JR_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, caam_jr_logtype, "caam_jr: %s(): " \ - fmt "\n", __func__, ##args) +#define CAAM_JR_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, CAAM_JR, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() CAAM_JR_DEBUG(" >>") @@ -28,8 +26,8 @@ extern int caam_jr_logtype; CAAM_JR_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define CAAM_JR_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, CAAM_JR, fmt "\n", ## args) +#define CAAM_JR_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, CAAM_JR, __VA_ARGS__) #define CAAM_JR_DP_DEBUG(fmt, args...) \ CAAM_JR_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/crypto/ccp/ccp_pmd_private.h b/drivers/crypto/ccp/ccp_pmd_private.h index 94c8fec46d..361a20fa3e 100644 --- a/drivers/crypto/ccp/ccp_pmd_private.h +++ b/drivers/crypto/ccp/ccp_pmd_private.h @@ -11,18 +11,21 @@ extern int crypto_ccp_logtype; #define RTE_LOGTYPE_CRYPTO_CCP crypto_ccp_logtype -#define CCP_LOG_ERR(fmt, args...) \ - RTE_LOG_LINE(ERR, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args) +#define CCP_LOG_ERR(...) \ + RTE_LOG_LINE_PREFIX(ERR, CRYPTO_CCP, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #ifdef RTE_LIBRTE_CCP_DEBUG -#define CCP_LOG_INFO(fmt, args...) \ - RTE_LOG_LINE(INFO, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args) +#define CCP_LOG_INFO(...) \ + RTE_LOG_LINE_PREFIX(INFO, CRYPTO_CCP, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) -#define CCP_LOG_DBG(fmt, args...) \ - RTE_LOG_LINE(DEBUG, CRYPTO_CCP, "%s() line %u: " fmt, __func__, __LINE__, ## args) +#define CCP_LOG_DBG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, CRYPTO_CCP, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #else -#define CCP_LOG_INFO(fmt, args...) -#define CCP_LOG_DBG(fmt, args...) +#define CCP_LOG_INFO(...) +#define CCP_LOG_DBG(...) #endif /**< Maximum queue pairs supported by CCP PMD */ diff --git a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h index ee69209504..53a5ebc760 100644 --- a/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h +++ b/drivers/crypto/dpaa2_sec/dpaa2_sec_logs.h @@ -11,13 +11,11 @@ extern int dpaa2_logtype_sec; #define RTE_LOGTYPE_DPAA2_SEC dpaa2_logtype_sec -#define DPAA2_SEC_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_logtype_sec, "dpaa2_sec: " \ - fmt "\n", ##args) +#define DPAA2_SEC_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_SEC, __VA_ARGS__) -#define DPAA2_SEC_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_logtype_sec, "dpaa2_sec: %s(): " \ - fmt "\n", __func__, ##args) +#define DPAA2_SEC_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_SEC, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() DPAA2_SEC_DEBUG(">>") @@ -29,8 +27,8 @@ extern int dpaa2_logtype_sec; DPAA2_SEC_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA2_SEC_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA2_SEC, fmt, ## args) +#define DPAA2_SEC_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA2_SEC, __VA_ARGS__) #define DPAA2_SEC_DP_DEBUG(fmt, args...) \ DPAA2_SEC_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/crypto/dpaa_sec/dpaa_sec_log.h b/drivers/crypto/dpaa_sec/dpaa_sec_log.h index 60dbaee4ec..6ac02d07e1 100644 --- a/drivers/crypto/dpaa_sec/dpaa_sec_log.h +++ b/drivers/crypto/dpaa_sec/dpaa_sec_log.h @@ -11,13 +11,11 @@ extern int dpaa_logtype_sec; #define RTE_LOGTYPE_DPAA_SEC dpaa_logtype_sec -#define DPAA_SEC_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa_logtype_sec, "dpaa_sec: " \ - fmt "\n", ##args) +#define DPAA_SEC_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA_SEC, __VA_ARGS__) -#define DPAA_SEC_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa_logtype_sec, "dpaa_sec: %s(): " \ - fmt "\n", __func__, ##args) +#define DPAA_SEC_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA_SEC, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() DPAA_SEC_DEBUG(" >>") @@ -29,8 +27,8 @@ extern int dpaa_logtype_sec; DPAA_SEC_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA_SEC_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP_LINE(level, DPAA_SEC, fmt, ## args) +#define DPAA_SEC_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA_SEC, __VA_ARGS__) #define DPAA_SEC_DP_DEBUG(fmt, args...) \ DPAA_SEC_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/crypto/ipsec_mb/ipsec_mb_private.h b/drivers/crypto/ipsec_mb/ipsec_mb_private.h index d42acd913c..025767cfce 100644 --- a/drivers/crypto/ipsec_mb/ipsec_mb_private.h +++ b/drivers/crypto/ipsec_mb/ipsec_mb_private.h @@ -59,9 +59,10 @@ extern RTE_DEFINE_PER_LCORE(IMB_MGR *, mb_mgr); /** PMD LOGTYPE DRIVER, common to all PMDs */ extern int ipsec_mb_logtype_driver; -#define IPSEC_MB_LOG(level, fmt, ...) \ - rte_log(RTE_LOG_##level, ipsec_mb_logtype_driver, \ - "%s() line %u: " fmt "\n", __func__, __LINE__, ##__VA_ARGS__) +#define RTE_LOGTYPE_IPSEC_MB ipsec_mb_logtype_driver +#define IPSEC_MB_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IPSEC_MB, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) /** All supported device types */ enum ipsec_mb_pmd_types { diff --git a/drivers/crypto/mvsam/mrvl_pmd_private.h b/drivers/crypto/mvsam/mrvl_pmd_private.h index 80ff229c1b..01efc25306 100644 --- a/drivers/crypto/mvsam/mrvl_pmd_private.h +++ b/drivers/crypto/mvsam/mrvl_pmd_private.h @@ -14,11 +14,11 @@ /** MRVL PMD LOGTYPE DRIVER */ extern int mrvl_logtype_driver; +#define RTE_LOGTYPE_MRVL_DRIVER mrvl_logtype_driver -#define MRVL_LOG(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, mrvl_logtype_driver, \ - "%s() line %u: " fmt "\n", __func__, __LINE__, \ - ## __VA_ARGS__) +#define MRVL_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, MRVL_DRIVER, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) /** * Handy bits->bytes conversion macro. diff --git a/drivers/crypto/null/null_crypto_pmd_private.h b/drivers/crypto/null/null_crypto_pmd_private.h index 645a68d1da..45629addcf 100644 --- a/drivers/crypto/null/null_crypto_pmd_private.h +++ b/drivers/crypto/null/null_crypto_pmd_private.h @@ -9,11 +9,11 @@ /**< Null crypto PMD device name */ extern int null_logtype_driver; +#define RTE_LOGTYPE_NULL_DRIVER null_logtype_driver -#define NULL_LOG(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, null_logtype_driver, \ - "%s() line %u: "fmt "\n", __func__, __LINE__, \ - ## __VA_ARGS__) +#define NULL_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NULL_DRIVER, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) /** private data structure for each NULL crypto device */ diff --git a/drivers/crypto/openssl/openssl_pmd_private.h b/drivers/crypto/openssl/openssl_pmd_private.h index a50e4d4918..0282b3d829 100644 --- a/drivers/crypto/openssl/openssl_pmd_private.h +++ b/drivers/crypto/openssl/openssl_pmd_private.h @@ -23,10 +23,10 @@ /** OPENSSL PMD LOGTYPE DRIVER */ extern int openssl_logtype_driver; -#define OPENSSL_LOG(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, openssl_logtype_driver, \ - "%s() line %u: " fmt "\n", __func__, __LINE__, \ - ## __VA_ARGS__) +#define RTE_LOGTYPE_OPENSSL_DRIVER openssl_logtype_driver +#define OPENSSL_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OPENSSL_DRIVER, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) /* Maximum length for digest (SHA-512 needs 64 bytes) */ #define DIGEST_LENGTH_MAX 64 diff --git a/drivers/crypto/scheduler/scheduler_pmd_private.h b/drivers/crypto/scheduler/scheduler_pmd_private.h index 0f0a6b4a85..fc75cd29cd 100644 --- a/drivers/crypto/scheduler/scheduler_pmd_private.h +++ b/drivers/crypto/scheduler/scheduler_pmd_private.h @@ -15,10 +15,11 @@ #define PER_WORKER_BUFF_SIZE (256) extern int scheduler_logtype_driver; +#define RTE_LOGTYPE_SCHEDULER_DRIVER scheduler_logtype_driver -#define CR_SCHED_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, scheduler_logtype_driver, \ - "%s() line %u: "fmt "\n", __func__, __LINE__, ##args) +#define CR_SCHED_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, SCHEDULER_DRIVER, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) struct scheduler_worker { uint8_t dev_id; diff --git a/drivers/crypto/uadk/uadk_crypto_pmd_private.h b/drivers/crypto/uadk/uadk_crypto_pmd_private.h index 7a35c94a4f..1f55d09a54 100644 --- a/drivers/crypto/uadk/uadk_crypto_pmd_private.h +++ b/drivers/crypto/uadk/uadk_crypto_pmd_private.h @@ -71,10 +71,10 @@ struct __rte_cache_aligned uadk_crypto_priv { }; extern int uadk_crypto_logtype; +#define RTE_LOGTYPE_UADK_CRYPTO uadk_crypto_logtype -#define UADK_LOG(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, uadk_crypto_logtype, \ - "%s() line %u: " fmt "\n", __func__, __LINE__, \ - ## __VA_ARGS__) +#define UADK_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, UADK_CRYPTO, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #endif /* _UADK_CRYPTO_PMD_PRIVATE_H_ */ diff --git a/drivers/crypto/virtio/virtio_logs.h b/drivers/crypto/virtio/virtio_logs.h index 1ee3819309..a1afb90a98 100644 --- a/drivers/crypto/virtio/virtio_logs.h +++ b/drivers/crypto/virtio/virtio_logs.h @@ -8,18 +8,18 @@ #include extern int virtio_crypto_logtype_init; +#define RTE_LOGTYPE_VIRTIO_CRYPTO_INIT virtio_crypto_logtype_init -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_init, \ - "PMD: %s(): " fmt "\n", __func__, ##args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") extern int virtio_crypto_logtype_init; +#define RTE_LOGTYPE_VIRTIO_CRYPTO_INIT virtio_crypto_logtype_init -#define VIRTIO_CRYPTO_INIT_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_init, \ - "INIT: %s(): " fmt "\n", __func__, ##args) +#define VIRTIO_CRYPTO_INIT_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_INIT, "%s(): ", __func__, __VA_ARGS__) #define VIRTIO_CRYPTO_INIT_LOG_INFO(fmt, args...) \ VIRTIO_CRYPTO_INIT_LOG_IMPL(INFO, fmt, ## args) @@ -31,10 +31,10 @@ extern int virtio_crypto_logtype_init; VIRTIO_CRYPTO_INIT_LOG_IMPL(ERR, fmt, ## args) extern int virtio_crypto_logtype_session; +#define RTE_LOGTYPE_VIRTIO_CRYPTO_SESSION virtio_crypto_logtype_session -#define VIRTIO_CRYPTO_SESSION_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_session, \ - "SESSION: %s(): " fmt "\n", __func__, ##args) +#define VIRTIO_CRYPTO_SESSION_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_SESSION, "%s(): ", __func__, __VA_ARGS__) #define VIRTIO_CRYPTO_SESSION_LOG_INFO(fmt, args...) \ VIRTIO_CRYPTO_SESSION_LOG_IMPL(INFO, fmt, ## args) @@ -46,10 +46,10 @@ extern int virtio_crypto_logtype_session; VIRTIO_CRYPTO_SESSION_LOG_IMPL(ERR, fmt, ## args) extern int virtio_crypto_logtype_rx; +#define RTE_LOGTYPE_VIRTIO_CRYPTO_RX virtio_crypto_logtype_rx -#define VIRTIO_CRYPTO_RX_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_rx, \ - "RX: %s(): " fmt "\n", __func__, ##args) +#define VIRTIO_CRYPTO_RX_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_RX, "%s(): ", __func__, __VA_ARGS__) #define VIRTIO_CRYPTO_RX_LOG_INFO(fmt, args...) \ VIRTIO_CRYPTO_RX_LOG_IMPL(INFO, fmt, ## args) @@ -61,10 +61,10 @@ extern int virtio_crypto_logtype_rx; VIRTIO_CRYPTO_RX_LOG_IMPL(ERR, fmt, ## args) extern int virtio_crypto_logtype_tx; +#define RTE_LOGTYPE_VIRTIO_CRYPTO_TX virtio_crypto_logtype_tx -#define VIRTIO_CRYPTO_TX_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_tx, \ - "TX: %s(): " fmt "\n", __func__, ##args) +#define VIRTIO_CRYPTO_TX_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_TX, "%s(): ", __func__, __VA_ARGS__) #define VIRTIO_CRYPTO_TX_LOG_INFO(fmt, args...) \ VIRTIO_CRYPTO_TX_LOG_IMPL(INFO, fmt, ## args) @@ -76,10 +76,10 @@ extern int virtio_crypto_logtype_tx; VIRTIO_CRYPTO_TX_LOG_IMPL(ERR, fmt, ## args) extern int virtio_crypto_logtype_driver; +#define RTE_LOGTYPE_VIRTIO_CRYPTO_DRIVER virtio_crypto_logtype_driver -#define VIRTIO_CRYPTO_DRV_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_crypto_logtype_driver, \ - "DRIVER: %s(): " fmt "\n", __func__, ##args) +#define VIRTIO_CRYPTO_DRV_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_DRIVER, "%s(): ", __func__, __VA_ARGS__) #define VIRTIO_CRYPTO_DRV_LOG_INFO(fmt, args...) \ VIRTIO_CRYPTO_DRV_LOG_IMPL(INFO, fmt, ## args) diff --git a/drivers/dma/dpaa/dpaa_qdma_logs.h b/drivers/dma/dpaa/dpaa_qdma_logs.h index 95753dcd89..2d77255fd8 100644 --- a/drivers/dma/dpaa/dpaa_qdma_logs.h +++ b/drivers/dma/dpaa/dpaa_qdma_logs.h @@ -8,13 +8,11 @@ extern int dpaa_qdma_logtype; #define RTE_LOGTYPE_DPAA_QDMA dpaa_qdma_logtype -#define DPAA_QDMA_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa_qdma_logtype, "dpaa_qdma: " \ - fmt "\n", ## args) +#define DPAA_QDMA_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA_QDMA, __VA_ARGS__) -#define DPAA_QDMA_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa_qdma_logtype, "dpaa_qdma: %s(): " \ - fmt "\n", __func__, ## args) +#define DPAA_QDMA_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA_QDMA, "%s(): ", __func__, __VA_ARGS__) #define DPAA_QDMA_FUNC_TRACE() DPAA_QDMA_DEBUG(">>") @@ -26,8 +24,8 @@ extern int dpaa_qdma_logtype; DPAA_QDMA_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA_QDMA_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA_QDMA, "dpaa_qdma: " fmt "\n", ## args) +#define DPAA_QDMA_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA_QDMA, __VA_ARGS__) #define DPAA_QDMA_DP_DEBUG(fmt, args...) \ DPAA_QDMA_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/dma/dpaa2/dpaa2_qdma_logs.h b/drivers/dma/dpaa2/dpaa2_qdma_logs.h index 37a5a5c6e9..62ef60bcf2 100644 --- a/drivers/dma/dpaa2/dpaa2_qdma_logs.h +++ b/drivers/dma/dpaa2/dpaa2_qdma_logs.h @@ -12,13 +12,11 @@ extern "C" { extern int dpaa2_qdma_logtype; #define RTE_LOGTYPE_DPAA2_QDMA dpaa2_qdma_logtype -#define DPAA2_QDMA_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_qdma_logtype, "dpaa2_qdma: " \ - fmt "\n", ## args) +#define DPAA2_QDMA_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_QDMA, __VA_ARGS__) -#define DPAA2_QDMA_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_qdma_logtype, "dpaa2_qdma: %s(): " \ - fmt "\n", __func__, ## args) +#define DPAA2_QDMA_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_QDMA, "%s(): ", __func__, __VA_ARGS__) #define DPAA2_QDMA_FUNC_TRACE() DPAA2_QDMA_DEBUG(">>") @@ -30,8 +28,8 @@ extern int dpaa2_qdma_logtype; DPAA2_QDMA_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA2_QDMA_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA2_QDMA, "dpaa2_qdma: " fmt "\n", ## args) +#define DPAA2_QDMA_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA2_QDMA, __VA_ARGS__) #define DPAA2_QDMA_DP_DEBUG(fmt, args...) \ DPAA2_QDMA_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/dma/hisilicon/hisi_dmadev.c b/drivers/dma/hisilicon/hisi_dmadev.c index bce4b4b277..fdd2fa225f 100644 --- a/drivers/dma/hisilicon/hisi_dmadev.c +++ b/drivers/dma/hisilicon/hisi_dmadev.c @@ -18,21 +18,20 @@ #include "hisi_dmadev.h" RTE_LOG_REGISTER_DEFAULT(hisi_dma_logtype, INFO); -#define HISI_DMA_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hisi_dma_logtype, \ - "%s(): " fmt "\n", __func__, ##args) -#define HISI_DMA_LOG_RAW(hw, level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hisi_dma_logtype, \ - "%s %s(): " fmt "\n", (hw)->data->dev_name, \ - __func__, ##args) -#define HISI_DMA_DEBUG(hw, fmt, args...) \ - HISI_DMA_LOG_RAW(hw, DEBUG, fmt, ## args) -#define HISI_DMA_INFO(hw, fmt, args...) \ - HISI_DMA_LOG_RAW(hw, INFO, fmt, ## args) -#define HISI_DMA_WARN(hw, fmt, args...) \ - HISI_DMA_LOG_RAW(hw, WARNING, fmt, ## args) -#define HISI_DMA_ERR(hw, fmt, args...) \ - HISI_DMA_LOG_RAW(hw, ERR, fmt, ## args) +#define RTE_LOGTYPE_HISI_DMA hisi_dma_logtype +#define HISI_DMA_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, HISI_DMA, "%s(): ", __func__, __VA_ARGS__) +#define HISI_DMA_DEV_LOG(hw, level, ...) \ + RTE_LOG_LINE_PREFIX(level, HISI_DMA, "%s %s(): ", \ + (hw)->data->dev_name RTE_LOG_COMMA __func__, __VA_ARGS__) +#define HISI_DMA_DEBUG(hw, ...) \ + HISI_DMA_DEV_LOG(hw, DEBUG, __VA_ARGS__) +#define HISI_DMA_INFO(hw, ...) \ + HISI_DMA_DEV_LOG(hw, INFO, __VA_ARGS__) +#define HISI_DMA_WARN(hw, ...) \ + HISI_DMA_DEV_LOG(hw, WARNING, __VA_ARGS__) +#define HISI_DMA_ERR(hw, ...) \ + HISI_DMA_DEV_LOG(hw, ERR, __VA_ARGS__) static uint32_t hisi_dma_queue_base(struct hisi_dma_dev *hw) diff --git a/drivers/dma/idxd/idxd_internal.h b/drivers/dma/idxd/idxd_internal.h index 537cf9b1cf..99dc2b367e 100644 --- a/drivers/dma/idxd/idxd_internal.h +++ b/drivers/dma/idxd/idxd_internal.h @@ -20,9 +20,10 @@ */ extern int idxd_pmd_logtype; +#define RTE_LOGTYPE_IDXD_PMD idxd_pmd_logtype -#define IDXD_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ - idxd_pmd_logtype, "IDXD: %s(): " fmt "\n", __func__, ##args) +#define IDXD_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IDXD_PMD, "%s(): ", __func__, __VA_ARGS__) #define IDXD_PMD_DEBUG(fmt, args...) IDXD_PMD_LOG(DEBUG, fmt, ## args) #define IDXD_PMD_INFO(fmt, args...) IDXD_PMD_LOG(INFO, fmt, ## args) diff --git a/drivers/dma/ioat/ioat_internal.h b/drivers/dma/ioat/ioat_internal.h index f4285c50f0..2da26b616f 100644 --- a/drivers/dma/ioat/ioat_internal.h +++ b/drivers/dma/ioat/ioat_internal.h @@ -35,9 +35,10 @@ struct ioat_dmadev { }; extern int ioat_pmd_logtype; +#define RTE_LOGTYPE_IOAT_PMD ioat_pmd_logtype -#define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ - ioat_pmd_logtype, "IOAT: %s(): " fmt "\n", __func__, ##args) +#define IOAT_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IOAT_PMD, "%s(): ", __func__, __VA_ARGS__) #define IOAT_PMD_DEBUG(fmt, args...) IOAT_PMD_LOG(DEBUG, fmt, ## args) #define IOAT_PMD_INFO(fmt, args...) IOAT_PMD_LOG(INFO, fmt, ## args) diff --git a/drivers/dma/odm/odm.h b/drivers/dma/odm/odm.h index 274c21ef8d..6b96439094 100644 --- a/drivers/dma/odm/odm.h +++ b/drivers/dma/odm/odm.h @@ -13,8 +13,6 @@ #include #include -extern int odm_logtype; - /* ODM VF register offsets from VF_BAR0 */ #define ODM_VDMA_EN(x) (0x00 | (x << 3)) #define ODM_VDMA_REQQ_CTL(x) (0x80 | (x << 3)) @@ -66,10 +64,11 @@ extern int odm_logtype; #define odm_read64(addr) rte_read64_relaxed((volatile void *)(addr)) #define odm_write64(val, addr) rte_write64_relaxed((val), (volatile void *)(addr)) +extern int odm_logtype; +#define RTE_LOGTYPE_ODM odm_logtype + #define ODM_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, odm_logtype, \ - RTE_FMT("%s(): %u" RTE_FMT_HEAD(__VA_ARGS__,) "\n", __func__, __LINE__, \ - RTE_FMT_TAIL(__VA_ARGS__, ))) + RTE_LOG_LINE_PREFIX(level, ODM, "%s(): %u", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) /* * Structure odm_instr_hdr_s for ODM diff --git a/drivers/dma/skeleton/skeleton_dmadev.c b/drivers/dma/skeleton/skeleton_dmadev.c index 4b18fb3767..e287802eb9 100644 --- a/drivers/dma/skeleton/skeleton_dmadev.c +++ b/drivers/dma/skeleton/skeleton_dmadev.c @@ -21,9 +21,9 @@ #include "skeleton_dmadev.h" RTE_LOG_REGISTER_DEFAULT(skeldma_logtype, INFO); -#define SKELDMA_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, skeldma_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_SKELDMA skeldma_logtype +#define SKELDMA_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, SKELDMA, "%s(): ", __func__, __VA_ARGS__) static int skeldma_info_get(const struct rte_dma_dev *dev, struct rte_dma_info *dev_info, diff --git a/drivers/event/dlb2/dlb2_log.h b/drivers/event/dlb2/dlb2_log.h index 201c88a98b..c9ce87681c 100644 --- a/drivers/event/dlb2/dlb2_log.h +++ b/drivers/event/dlb2/dlb2_log.h @@ -9,8 +9,8 @@ extern int eventdev_dlb2_log_level; #define RTE_LOGTYPE_EVENTDEV_DLB2 eventdev_dlb2_log_level /* Dynamic logging */ -#define DLB2_LOG_IMPL(level, fmt, args...) \ - RTE_LOG(level, EVENTDEV_DLB2, "%s" fmt "\n", __func__, ##args) +#define DLB2_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, EVENTDEV_DLB2, "%s", __func__, __VA_ARGS__) #define DLB2_LOG_INFO(fmt, args...) \ DLB2_LOG_IMPL(INFO, fmt, ## args) @@ -19,7 +19,7 @@ extern int eventdev_dlb2_log_level; DLB2_LOG_IMPL(ERR, fmt, ## args) /* remove debug logs at compile time unless actually debugging */ -#define DLB2_LOG_LINE_DBG(fmt, args...) \ - RTE_LOG_DP(DEBUG, EVENTDEV_DLB2, fmt "\n", ## args) +#define DLB2_LOG_LINE_DBG(...) \ + RTE_LOG_DP_LINE(DEBUG, EVENTDEV_DLB2, __VA_ARGS__) #endif /* _DLB2_EVDEV_LOG_H_ */ diff --git a/drivers/event/dpaa/dpaa_eventdev.c b/drivers/event/dpaa/dpaa_eventdev.c index f8cf48bd2e..85ccb586ef 100644 --- a/drivers/event/dpaa/dpaa_eventdev.c +++ b/drivers/event/dpaa/dpaa_eventdev.c @@ -48,6 +48,7 @@ * 1 Eventdev can have N Eventqueue */ RTE_LOG_REGISTER_DEFAULT(dpaa_logtype_eventdev, NOTICE); +#define RTE_LOGTYPE_DPAA_EVENTDEV dpaa_logtype_eventdev #define DISABLE_INTR_MODE "disable_intr" diff --git a/drivers/event/dpaa/dpaa_eventdev.h b/drivers/event/dpaa/dpaa_eventdev.h index b4535c7b86..5831ccb4e8 100644 --- a/drivers/event/dpaa/dpaa_eventdev.h +++ b/drivers/event/dpaa/dpaa_eventdev.h @@ -77,9 +77,8 @@ struct dpaa_eventdev { uint32_t event_dev_cfg; }; -#define DPAA_EVENTDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa_logtype_eventdev, "%s(): " fmt "\n", \ - __func__, ##args) +#define DPAA_EVENTDEV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, DPAA_EVENTDEV, "%s(): ", __func__, __VA_ARGS__) #define EVENTDEV_INIT_FUNC_TRACE() DPAA_EVENTDEV_LOG(DEBUG, " >>") diff --git a/drivers/event/dpaa2/dpaa2_eventdev_logs.h b/drivers/event/dpaa2/dpaa2_eventdev_logs.h index b894fb3299..12317ae39f 100644 --- a/drivers/event/dpaa2/dpaa2_eventdev_logs.h +++ b/drivers/event/dpaa2/dpaa2_eventdev_logs.h @@ -6,14 +6,13 @@ #define _DPAA2_EVENTDEV_LOGS_H_ extern int dpaa2_logtype_event; +#define RTE_LOGTYPE_DPAA2_EVENT dpaa2_logtype_event -#define DPAA2_EVENTDEV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_logtype_event, "dpaa2_event: " \ - fmt "\n", ##args) +#define DPAA2_EVENTDEV_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_EVENT, __VA_ARGS__) -#define DPAA2_EVENTDEV_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_logtype_event, "dpaa2_event: %s(): " \ - fmt "\n", __func__, ##args) +#define DPAA2_EVENTDEV_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_EVENT, "%s():", __func__, __VA_ARGS__) #define EVENTDEV_INIT_FUNC_TRACE() DPAA2_EVENTDEV_DEBUG(" >>") diff --git a/drivers/event/dsw/dsw_evdev.h b/drivers/event/dsw/dsw_evdev.h index 01b7a99ba1..3f29e53929 100644 --- a/drivers/event/dsw/dsw_evdev.h +++ b/drivers/event/dsw/dsw_evdev.h @@ -305,7 +305,7 @@ dsw_pmd_priv(const struct rte_eventdev *eventdev) extern int event_dsw_logtype; #define RTE_LOGTYPE_EVENT_DSW event_dsw_logtype #define DSW_LOG_DP_LINE(level, fmt, args...) \ - RTE_LOG_DP(level, EVENT_DSW, "%s() line %u: " fmt "\n", \ + RTE_LOG_DP_LINE(level, EVENT_DSW, "%s() line %u: " fmt, \ __func__, __LINE__, ## args) #define DSW_LOG_DP_PORT_LINE(level, port_id, fmt, args...) \ diff --git a/drivers/event/octeontx/ssovf_evdev.h b/drivers/event/octeontx/ssovf_evdev.h index 293eb85a40..1997626438 100644 --- a/drivers/event/octeontx/ssovf_evdev.h +++ b/drivers/event/octeontx/ssovf_evdev.h @@ -19,10 +19,9 @@ #define EVENTDEV_NAME_OCTEONTX_PMD event_octeontx -#define SSOVF_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, otx_logtype_ssovf, \ - "[%s] %s() " fmt "\n", \ - RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD), __func__, ## args) +#define SSOVF_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OTX_SSOVF, "[%s] %s() ", \ + RTE_STR(EVENTDEV_NAME_OCTEONTX_PMD) RTE_LOG_COMMA __func__, __VA_ARGS__) #define ssovf_log_info(fmt, ...) SSOVF_LOG(INFO, fmt, ##__VA_ARGS__) #define ssovf_log_dbg(fmt, ...) SSOVF_LOG(DEBUG, fmt, ##__VA_ARGS__) @@ -171,6 +170,7 @@ ssovf_pmd_priv(const struct rte_eventdev *eventdev) } extern int otx_logtype_ssovf; +#define RTE_LOGTYPE_OTX_SSOVF otx_logtype_ssovf uint16_t ssows_enq(void *port, const struct rte_event *ev); uint16_t ssows_enq_burst(void *port, diff --git a/drivers/event/octeontx/timvf_evdev.h b/drivers/event/octeontx/timvf_evdev.h index 3a2dc475e3..44a4ee41c4 100644 --- a/drivers/event/octeontx/timvf_evdev.h +++ b/drivers/event/octeontx/timvf_evdev.h @@ -26,10 +26,9 @@ #include #include -#define timvf_log(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, otx_logtype_timvf, \ - "[%s] %s() " fmt "\n", \ - RTE_STR(event_timer_octeontx), __func__, ## args) +#define timvf_log(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OTX_TIMVF, "[%s] %s() ", \ + RTE_STR(event_timer_octeontx) RTE_LOG_COMMA __func__, __VA_ARGS__) #define timvf_log_info(fmt, ...) timvf_log(INFO, fmt, ##__VA_ARGS__) #define timvf_log_dbg(fmt, ...) timvf_log(DEBUG, fmt, ##__VA_ARGS__) @@ -113,6 +112,7 @@ #define TIMVF_ENABLE_STATS_ARG ("timvf_stats") extern int otx_logtype_timvf; +#define RTE_LOGTYPE_OTX_TIMVF otx_logtype_timvf static const uint16_t nb_chunk_slots = (TIM_CHUNK_SIZE / 16) - 1; enum timvf_clk_src { diff --git a/drivers/event/opdl/opdl_log.h b/drivers/event/opdl/opdl_log.h index ae5221c1e4..9a8ee71bb6 100644 --- a/drivers/event/opdl/opdl_log.h +++ b/drivers/event/opdl/opdl_log.h @@ -8,14 +8,9 @@ #include extern int opdl_logtype_driver; +#define RTE_LOGTYPE_OPDL opdl_logtype_driver -#define PMD_DRV_LOG_RAW(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, opdl_logtype_driver, "%s(): " fmt, \ - __func__, ## args) - -#define PMD_DRV_LOG(level, fmt, args...) \ - PMD_DRV_LOG_RAW(level, fmt "\n", ## args) - - +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OPDL, "%s(): ", __func__, __VA_ARGS__) #endif /* _OPDL_LOGS_H_ */ diff --git a/drivers/event/skeleton/skeleton_eventdev.h b/drivers/event/skeleton/skeleton_eventdev.h index 283342ac19..6fca68c5d0 100644 --- a/drivers/event/skeleton/skeleton_eventdev.h +++ b/drivers/event/skeleton/skeleton_eventdev.h @@ -9,20 +9,19 @@ #include extern int skeleton_eventdev_logtype; +#define RTE_LOGTYPE_SKELETON_EVENTDEV skeleton_eventdev_logtype #ifdef RTE_LIBRTE_PMD_SKELETON_EVENTDEV_DEBUG -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, skeleton_eventdev_logtype, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, SKELETON_EVENTDEV, "%s(): ", __func__, __VA_ARGS__) #define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>") #else -#define PMD_DRV_LOG(level, fmt, args...) do { } while (0) +#define PMD_DRV_LOG(...) do { } while (0) #define PMD_DRV_FUNC_TRACE() do { } while (0) #endif -#define PMD_DRV_ERR(fmt, args...) \ - rte_log(RTE_LOG_ERR, skeleton_eventdev_logtype, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_ERR(...) \ + RTE_LOG_LINE_PREFIX(ERR, SKELETON_EVENTDEV, "%s(): ", __func__, __VA_ARGS__) struct __rte_cache_aligned skeleton_eventdev { uintptr_t reg_base; diff --git a/drivers/event/sw/sw_evdev_log.h b/drivers/event/sw/sw_evdev_log.h index f76825abc5..50a707939c 100644 --- a/drivers/event/sw/sw_evdev_log.h +++ b/drivers/event/sw/sw_evdev_log.h @@ -6,10 +6,10 @@ #define _SW_EVDEV_LOG_H_ extern int eventdev_sw_log_level; +#define RTE_LOGTYPE_EVENT_SW eventdev_sw_log_level -#define SW_LOG_IMPL(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, eventdev_sw_log_level, "%s" fmt "\n", \ - __func__, ##args) +#define SW_LOG_IMPL(level, ...) \ + RTE_LOG_LINE_PREFIX(level, EVENT_SW, "%s", __func__, __VA_ARGS__) #define SW_LOG_INFO(fmt, args...) \ SW_LOG_IMPL(INFO, fmt, ## args) diff --git a/drivers/gpu/cuda/common.h b/drivers/gpu/cuda/common.h index e809988503..e098418401 100644 --- a/drivers/gpu/cuda/common.h +++ b/drivers/gpu/cuda/common.h @@ -13,10 +13,11 @@ #include extern int cuda_logtype; +#define RTE_LOGTYPE_CUDA cuda_logtype /* Helper macro for logging */ #define rte_cuda_log(level, fmt, ...) \ - rte_log(RTE_LOG_ ## level, cuda_logtype, fmt "\n", ##__VA_ARGS__) + RTE_LOG_LINE(level, CUDA, fmt, ##__VA_ARGS__) #define rte_cuda_debug(fmt, ...) \ rte_cuda_log(DEBUG, RTE_STR(__LINE__) ":%s() " fmt, __func__, \ diff --git a/drivers/mempool/dpaa/dpaa_mempool.h b/drivers/mempool/dpaa/dpaa_mempool.h index 153fefd507..135520922f 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.h +++ b/drivers/mempool/dpaa/dpaa_mempool.h @@ -60,9 +60,8 @@ extern struct dpaa_bp_info *rte_dpaa_bpid_info; /* Mempool related logs */ -#define DPAA_MEMPOOL_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa_logtype_mempool, "%s(): " fmt "\n", \ - __func__, ##args) +#define DPAA_MEMPOOL_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, DPAA_MEMPOOL, "%s(): ", __func__, __VA_ARGS__) #define MEMPOOL_INIT_FUNC_TRACE() DPAA_MEMPOOL_LOG(DEBUG, " >>") diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h index fbc8cb30a2..d69ef17a04 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool_logs.h @@ -8,14 +8,12 @@ extern int dpaa2_logtype_mempool; #define RTE_LOGTYPE_DPAA2_MEMPOOL dpaa2_logtype_mempool -#define DPAA2_MEMPOOL_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_logtype_mempool, \ - "mempool/dpaa2: " fmt "\n", ##args) +#define DPAA2_MEMPOOL_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_MEMPOOL, __VA_ARGS__) /* Debug logs are with Function names */ -#define DPAA2_MEMPOOL_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_logtype_mempool, \ - "mempool/dpaa2: %s(): " fmt "\n", __func__, ##args) +#define DPAA2_MEMPOOL_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_MEMPOOL, "%s(): ", __func__, __VA_ARGS__) #define DPAA2_MEMPOOL_INFO(fmt, args...) \ DPAA2_MEMPOOL_LOG(INFO, fmt, ## args) diff --git a/drivers/mempool/octeontx/octeontx_pool_logs.h b/drivers/mempool/octeontx/octeontx_pool_logs.h index 7b4e1b3877..48395e307f 100644 --- a/drivers/mempool/octeontx/octeontx_pool_logs.h +++ b/drivers/mempool/octeontx/octeontx_pool_logs.h @@ -7,9 +7,9 @@ #include -#define FPAVF_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, octeontx_logtype_fpavf,\ - "%s() line %u: " fmt "\n", __func__, __LINE__, ## args) +#define FPAVF_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OCTEONTX_FPAVF, "%s() line %u: ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #define fpavf_log_info(fmt, ...) FPAVF_LOG(INFO, fmt, ##__VA_ARGS__) #define fpavf_log_dbg(fmt, ...) FPAVF_LOG(DEBUG, fmt, ##__VA_ARGS__) @@ -18,5 +18,6 @@ extern int octeontx_logtype_fpavf; +#define RTE_LOGTYPE_OCTEONTX_FPAVF octeontx_logtype_fpavf #endif /* __OCTEONTX_POOL_LOGS_H__*/ diff --git a/drivers/net/af_packet/rte_eth_af_packet.c b/drivers/net/af_packet/rte_eth_af_packet.c index 6b7b16f348..68870dd3e2 100644 --- a/drivers/net/af_packet/rte_eth_af_packet.c +++ b/drivers/net/af_packet/rte_eth_af_packet.c @@ -102,14 +102,14 @@ static struct rte_eth_link pmd_link = { }; RTE_LOG_REGISTER_DEFAULT(af_packet_logtype, NOTICE); +#define RTE_LOGTYPE_AFPACKET af_packet_logtype -#define PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, af_packet_logtype, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, AFPACKET, "%s(): ", __func__, __VA_ARGS__) -#define PMD_LOG_ERRNO(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, af_packet_logtype, \ - "%s(): " fmt ":%s\n", __func__, ##args, strerror(errno)) +#define PMD_LOG_ERRNO(level, fmt, ...) \ + RTE_LOG_LINE(level, AFPACKET, "%s(): " fmt ":%s", __func__, \ + ## __VA_ARGS__, strerror(errno)) static uint16_t eth_af_packet_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) diff --git a/drivers/net/af_xdp/rte_eth_af_xdp.c b/drivers/net/af_xdp/rte_eth_af_xdp.c index 676006ce0d..814398ba4b 100644 --- a/drivers/net/af_xdp/rte_eth_af_xdp.c +++ b/drivers/net/af_xdp/rte_eth_af_xdp.c @@ -65,8 +65,8 @@ RTE_LOG_REGISTER_DEFAULT(af_xdp_logtype, NOTICE); #define RTE_LOGTYPE_NET_AF_XDP af_xdp_logtype -#define AF_XDP_LOG_LINE(level, fmt, args...) \ - RTE_LOG(level, NET_AF_XDP, "%s(): " fmt "\n", __func__, ##args) +#define AF_XDP_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NET_AF_XDP, "%s(): ", __func__, __VA_ARGS__) #define ETH_AF_XDP_FRAME_SIZE 2048 #define ETH_AF_XDP_NUM_BUFFERS 4096 diff --git a/drivers/net/atlantic/atl_logs.h b/drivers/net/atlantic/atl_logs.h index 14a7a1de1d..a233baf461 100644 --- a/drivers/net/atlantic/atl_logs.h +++ b/drivers/net/atlantic/atl_logs.h @@ -7,26 +7,22 @@ #include extern int atl_logtype_init; +#define RTE_LOGTYPE_ATL_INIT atl_logtype_init -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, atl_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ATL_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, ATL_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_DP_LINE_PREFIX(level, ATL_DRIVER, "%s(): ", __func__, __VA_ARGS__) -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, ATL_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_DP_LINE_PREFIX(level, ATL_DRIVER, "%s(): ", __func__, __VA_ARGS__) extern int atl_logtype_driver; #define RTE_LOGTYPE_ATL_DRIVER atl_logtype_driver -#define PMD_DRV_LOG_RAW(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, atl_logtype_driver, "%s(): " fmt, \ - __func__, ## args) - -#define PMD_DRV_LOG(level, fmt, args...) \ - PMD_DRV_LOG_RAW(level, fmt "\n", ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ATL_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif diff --git a/drivers/net/avp/avp_logs.h b/drivers/net/avp/avp_logs.h index 3f2721df1a..b84b67c3f1 100644 --- a/drivers/net/avp/avp_logs.h +++ b/drivers/net/avp/avp_logs.h @@ -8,15 +8,15 @@ #include #ifdef RTE_LIBRTE_AVP_DEBUG_RX -#define PMD_RX_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, AVP_DRIVER, "%s() rx: " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_RX_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, AVP_DRIVER, "%s() rx: ", __func__, __VA_ARGS__) #else #define PMD_RX_LOG_LINE(...) do { } while (0) #endif #ifdef RTE_LIBRTE_AVP_DEBUG_TX -#define PMD_TX_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, AVP_DRIVER, "%s() tx: " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_TX_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, AVP_DRIVER, "%s() tx: ", __func__, __VA_ARGS__) #else #define PMD_TX_LOG_LINE(...) do { } while (0) #endif @@ -24,7 +24,7 @@ extern int avp_logtype_driver; #define RTE_LOGTYPE_AVP_DRIVER avp_logtype_driver -#define PMD_DRV_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, AVP_DRIVER, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_DRV_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, AVP_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _AVP_LOGS_H_ */ diff --git a/drivers/net/axgbe/axgbe_logs.h b/drivers/net/axgbe/axgbe_logs.h index 3962895c5a..7990c79ef7 100644 --- a/drivers/net/axgbe/axgbe_logs.h +++ b/drivers/net/axgbe/axgbe_logs.h @@ -8,9 +8,9 @@ #include extern int axgbe_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, axgbe_logtype_init, "%s(): " fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_AXGBE_INIT axgbe_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, AXGBE_INIT, "%s(): ", __func__, __VA_ARGS__) #ifdef RTE_LIBRTE_AXGBE_PMD_DEBUG #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") @@ -20,7 +20,7 @@ extern int axgbe_logtype_init; extern int axgbe_logtype_driver; #define RTE_LOGTYPE_AXGBE_DRIVER axgbe_logtype_driver -#define PMD_DRV_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, AXGBE_DRIVER, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_DRV_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, AXGBE_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _AXGBE_LOGS_H_ */ diff --git a/drivers/net/bnx2x/bnx2x_logs.h b/drivers/net/bnx2x/bnx2x_logs.h index f0cf69c163..ba3b058fbb 100644 --- a/drivers/net/bnx2x/bnx2x_logs.h +++ b/drivers/net/bnx2x/bnx2x_logs.h @@ -9,44 +9,40 @@ #define _PMD_LOGS_H_ extern int bnx2x_logtype_init; -#define PMD_INIT_LOG(level, sc, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bnx2x_logtype_init, \ - "[bnx2x_pmd: %s] %s() " fmt "\n", (sc)->devinfo.name, __func__, ##args) +#define RTE_LOGTYPE_BNX2X_INIT bnx2x_logtype_init +#define PMD_INIT_LOG(level, sc, ...) \ + RTE_LOG_LINE_PREFIX(level, BNX2X_INIT, "[%s] %s() ", \ + (sc)->devinfo.name RTE_LOG_COMMA __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE(sc) PMD_INIT_LOG(DEBUG, sc, " >>") extern int bnx2x_logtype_driver; -#define PMD_DRV_LOG_RAW(level, sc, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \ - "[%s:%d(%s)] " fmt, __func__, __LINE__, \ - (sc)->devinfo.name ? (sc)->devinfo.name : "", ## args) - -#define PMD_DRV_LOG(level, sc, fmt, args...) \ - PMD_DRV_LOG_RAW(level, sc, fmt "\n", ## args) +#define RTE_LOGTYPE_BNX2X_DRIVER bnx2x_logtype_driver +#define PMD_DRV_LOG(level, sc, ...) \ + RTE_LOG_LINE_PREFIX(level, BNX2X_DRIVER, "[%s:%d(%s)] ", \ + __func__ RTE_LOG_COMMA __LINE__ RTE_LOG_COMMA \ + (sc)->devinfo.name ? (sc)->devinfo.name : "", __VA_ARGS__) #ifdef RTE_LIBRTE_BNX2X_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, BNX2X_DRIVER, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while(0) +#define PMD_RX_LOG(...) do { } while(0) #endif #ifdef RTE_LIBRTE_BNX2X_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, BNX2X_DRIVER, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while(0) +#define PMD_TX_LOG(...) do { } while(0) #endif #ifdef RTE_LIBRTE_BNX2X_DEBUG_PERIODIC -#define PMD_DEBUG_PERIODIC_LOG(level, sc, fmt, args...) \ - rte_log(RTE_LOG_ ## level, bnx2x_logtype_driver, \ - "%s(%s): " fmt "\n", __func__, \ - (sc)->devinfo.name ? (sc)->devinfo.name : "", ## args) +#define PMD_DEBUG_PERIODIC_LOG(level, sc, ...) \ + RTE_LOG_LINE_PREFIX(level, BNX2X_DRIVER, "%s(%s): ", \ + __func__ RTE_LOG_COMMA (sc)->devinfo.name ? (sc)->devinfo.name : "", __VA_ARGS__) #else -#define PMD_DEBUG_PERIODIC_LOG(level, sc, fmt, args...) do { } while (0) +#define PMD_DEBUG_PERIODIC_LOG(...) do { } while (0) #endif #endif /* _PMD_LOGS_H_ */ diff --git a/drivers/net/bnxt/bnxt.h b/drivers/net/bnxt/bnxt.h index 8ac20961d9..02d21bae53 100644 --- a/drivers/net/bnxt/bnxt.h +++ b/drivers/net/bnxt/bnxt.h @@ -1207,8 +1207,8 @@ extern const struct rte_flow_ops bnxt_flow_meter_ops; extern int bnxt_logtype_driver; #define RTE_LOGTYPE_BNXT bnxt_logtype_driver -#define PMD_DRV_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, BNXT, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_DRV_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, BNXT, "%s(): ", __func__, __VA_ARGS__) #define BNXT_LINK_SPEEDS_V2_OPTIONS(f) \ ((f) & HWRM_PORT_PHY_QCFG_OUTPUT_OPTION_FLAGS_SPEEDS2_SUPPORTED) diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c index 0ff1641c19..355d41bbd3 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_neon.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_neon.c @@ -357,8 +357,8 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) if (likely(CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)) nb_tx_pkts += txcmp->opaque; else - RTE_LOG_DP(ERR, BNXT, - "Unhandled CMP type %02x\n", + RTE_LOG_DP_LINE(ERR, BNXT, + "Unhandled CMP type %02x", CMP_TYPE(txcmp)); raw_cons = NEXT_RAW_CMP(raw_cons); } while (nb_tx_pkts < ring_mask); diff --git a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c index 9f1a02f0ab..c1c3e1ecaf 100644 --- a/drivers/net/bnxt/bnxt_rxtx_vec_sse.c +++ b/drivers/net/bnxt/bnxt_rxtx_vec_sse.c @@ -578,8 +578,8 @@ bnxt_handle_tx_cp_vec(struct bnxt_tx_queue *txq) if (likely(CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2)) nb_tx_pkts += txcmp->opaque; else - RTE_LOG_DP(ERR, BNXT, - "Unhandled CMP type %02x\n", + RTE_LOG_DP_LINE(ERR, BNXT, + "Unhandled CMP type %02x", CMP_TYPE(txcmp)); raw_cons = NEXT_RAW_CMP(raw_cons); } while (nb_tx_pkts < ring_mask); diff --git a/drivers/net/bnxt/bnxt_txr.c b/drivers/net/bnxt/bnxt_txr.c index 6a38c7c6e4..9087fd4e6c 100644 --- a/drivers/net/bnxt/bnxt_txr.c +++ b/drivers/net/bnxt/bnxt_txr.c @@ -548,8 +548,8 @@ static int bnxt_handle_tx_cp(struct bnxt_tx_queue *txq) if (CMP_TYPE(txcmp) == TX_CMPL_TYPE_TX_L2) nb_tx_pkts += opaque; else - RTE_LOG_DP(ERR, BNXT, - "Unhandled CMP type %02x\n", + RTE_LOG_DP_LINE(ERR, BNXT, + "Unhandled CMP type %02x", CMP_TYPE(txcmp)); raw_cons = NEXT_RAW_CMP(raw_cons); } while (nb_tx_pkts < ring_mask); diff --git a/drivers/net/bonding/eth_bond_private.h b/drivers/net/bonding/eth_bond_private.h index e688894210..378bbba4e6 100644 --- a/drivers/net/bonding/eth_bond_private.h +++ b/drivers/net/bonding/eth_bond_private.h @@ -34,10 +34,10 @@ #define PMD_BOND_XMIT_POLICY_LAYER34_KVARG ("l34") extern int bond_logtype; +#define RTE_LOGTYPE_BOND bond_logtype -#define RTE_BOND_LOG(lvl, msg, ...) \ - rte_log(RTE_LOG_ ## lvl, bond_logtype, \ - "%s(%d) - " msg "\n", __func__, __LINE__, ##__VA_ARGS__) +#define RTE_BOND_LOG(lvl, ...) \ + RTE_LOG_LINE_PREFIX(lvl, BOND, "%s(%d) - ", __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) #define BONDING_MODE_INVALID 0xFF diff --git a/drivers/net/bonding/rte_eth_bond_8023ad.c b/drivers/net/bonding/rte_eth_bond_8023ad.c index 1abc939376..7f885ab521 100644 --- a/drivers/net/bonding/rte_eth_bond_8023ad.c +++ b/drivers/net/bonding/rte_eth_bond_8023ad.c @@ -16,11 +16,10 @@ static void bond_mode_8023ad_ext_periodic_cb(void *arg); #ifdef RTE_LIBRTE_BOND_DEBUG_8023AD -#define MODE4_DEBUG_LOG(fmt, ...) \ - rte_log(RTE_LOG_DEBUG, bond_logtype, \ - "%6u [Port %u: %s] " fmt "\n", \ - bond_dbg_get_time_diff_ms(), member_id, \ - __func__, ##__VA_ARGS__) +#define MODE4_DEBUG_LOG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, BOND, "%6u [Port %u: %s] ", \ + bond_dbg_get_time_diff_ms() RTE_LOG_COMMA member_id RTE_LOG_COMMA __func__, \ + __VA_ARGS__) static uint64_t start_time; diff --git a/drivers/net/bonding/rte_eth_bond_pmd.c b/drivers/net/bonding/rte_eth_bond_pmd.c index 4144c86be4..34131f0e35 100644 --- a/drivers/net/bonding/rte_eth_bond_pmd.c +++ b/drivers/net/bonding/rte_eth_bond_pmd.c @@ -491,9 +491,9 @@ update_client_stats(uint32_t addr, uint16_t port, uint32_t *TXorRXindicator) #ifdef RTE_LIBRTE_BOND_DEBUG_ALB #define MODE6_DEBUG(info, src_ip, dst_ip, eth_h, arp_op, port, burstnumber) \ - rte_log(RTE_LOG_DEBUG, bond_logtype, \ + RTE_LOG_LINE(DEBUG, BOND, \ "%s port:%d SrcMAC:" RTE_ETHER_ADDR_PRT_FMT " SrcIP:%s " \ - "DstMAC:" RTE_ETHER_ADDR_PRT_FMT " DstIP:%s %s %d\n", \ + "DstMAC:" RTE_ETHER_ADDR_PRT_FMT " DstIP:%s %s %d", \ info, \ port, \ RTE_ETHER_ADDR_BYTES(ð_h->src_addr), \ diff --git a/drivers/net/cpfl/cpfl_logs.h b/drivers/net/cpfl/cpfl_logs.h index bdfa5c41a5..dc77e4d4c3 100644 --- a/drivers/net/cpfl/cpfl_logs.h +++ b/drivers/net/cpfl/cpfl_logs.h @@ -8,22 +8,14 @@ #include extern int cpfl_logtype_init; +#define RTE_LOGTYPE_CPFL_INIT cpfl_logtype_init extern int cpfl_logtype_driver; +#define RTE_LOGTYPE_CPFL_DRIVER cpfl_logtype_driver #define PMD_INIT_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, \ - cpfl_logtype_init, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE_PREFIX(level, CPFL_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_DRV_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, \ - cpfl_logtype_driver, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE_PREFIX(level, CPFL_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _CPFL_LOGS_H_ */ diff --git a/drivers/net/dpaa/dpaa_ethdev.h b/drivers/net/dpaa/dpaa_ethdev.h index b6c61b8b6b..0006bd33d4 100644 --- a/drivers/net/dpaa/dpaa_ethdev.h +++ b/drivers/net/dpaa/dpaa_ethdev.h @@ -216,9 +216,8 @@ dpaa_rx_cb_atomic(void *event, extern int dpaa_logtype_pmd; #define RTE_LOGTYPE_DPAA_PMD dpaa_logtype_pmd -#define DPAA_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa_logtype_pmd, "%s(): " fmt "\n", \ - __func__, ##args) +#define DPAA_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, DPAA_PMD, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() DPAA_PMD_LOG(DEBUG, " >>") @@ -232,7 +231,7 @@ extern int dpaa_logtype_pmd; DPAA_PMD_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA_PMD, fmt, ## args) +#define DPAA_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA_PMD, __VA_ARGS__) #endif diff --git a/drivers/net/dpaa2/dpaa2_pmd_logs.h b/drivers/net/dpaa2/dpaa2_pmd_logs.h index af895a6b6e..a9317b27eb 100644 --- a/drivers/net/dpaa2/dpaa2_pmd_logs.h +++ b/drivers/net/dpaa2/dpaa2_pmd_logs.h @@ -6,15 +6,13 @@ #define _DPAA2_PMD_LOGS_H_ extern int dpaa2_logtype_pmd; -#define RTE_LOGTYPE_DPAA2_PMD dpaa2_logtype_pmd +#define RTE_LOGTYPE_DPAA2_NET dpaa2_logtype_pmd -#define DPAA2_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_logtype_pmd, "dpaa2_net: " \ - fmt "\n", ##args) +#define DPAA2_PMD_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_NET, __VA_ARGS__) -#define DPAA2_PMD_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_logtype_pmd, "dpaa2_net: %s(): "\ - fmt "\n", __func__, ##args) +#define DPAA2_PMD_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_NET, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() DPAA2_PMD_DEBUG(">>") @@ -28,8 +26,8 @@ extern int dpaa2_logtype_pmd; DPAA2_PMD_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA2_PMD_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA2_PMD, fmt, ## args) +#define DPAA2_PMD_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA2_NET, __VA_ARGS__) #define DPAA2_PMD_DP_DEBUG(fmt, args...) \ DPAA2_PMD_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/net/dpaa2/dpaa2_rxtx.c b/drivers/net/dpaa2/dpaa2_rxtx.c index b64232b88f..92e9dd40dc 100644 --- a/drivers/net/dpaa2/dpaa2_rxtx.c +++ b/drivers/net/dpaa2/dpaa2_rxtx.c @@ -399,7 +399,7 @@ eth_fd_to_mbuf(const struct qbman_fd *fd, mbuf->packet_type = dpaa2_dev_rx_parse(mbuf, hw_annot_addr); DPAA2_PMD_DP_DEBUG("to mbuf - mbuf =%p, mbuf->buf_addr =%p, off = %d," - "fd_off=%d fd =%" PRIx64 ", meta = %d bpid =%d, len=%d\n", + "fd_off=%d fd =%" PRIx64 ", meta = %d bpid =%d, len=%d", mbuf, mbuf->buf_addr, mbuf->data_off, DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_ADDR(fd), rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size, @@ -446,7 +446,7 @@ eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, } else { temp = rte_pktmbuf_alloc(dpaa2_tx_sg_pool); if (temp == NULL) { - DPAA2_PMD_DP_DEBUG("No memory to allocate S/G table\n"); + DPAA2_PMD_DP_DEBUG("No memory to allocate S/G table"); return -ENOMEM; } DPAA2_SET_ONLY_FD_BPID(fd, mempool_to_bpid(dpaa2_tx_sg_pool)); @@ -543,7 +543,7 @@ eth_mbuf_to_fd(struct rte_mbuf *mbuf, DPAA2_MBUF_TO_CONTIG_FD(mbuf, fd, bpid); DPAA2_PMD_DP_DEBUG("mbuf =%p, mbuf->buf_addr =%p, off = %d," - "fd_off=%d fd =%" PRIx64 ", meta = %d bpid =%d, len=%d\n", + "fd_off=%d fd =%" PRIx64 ", meta = %d bpid =%d, len=%d", mbuf, mbuf->buf_addr, mbuf->data_off, DPAA2_GET_FD_OFFSET(fd), DPAA2_GET_FD_ADDR(fd), rte_dpaa2_bpid_info[DPAA2_GET_FD_BPID(fd)].meta_data_size, @@ -587,7 +587,7 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, if (rte_dpaa2_mbuf_alloc_bulk( rte_dpaa2_bpid_info[bpid].bp_list->mp, &mb, 1)) { - DPAA2_PMD_DP_DEBUG("Unable to allocated DPAA2 buffer\n"); + DPAA2_PMD_DP_DEBUG("Unable to allocated DPAA2 buffer"); return -1; } m = (struct rte_mbuf *)mb; @@ -609,7 +609,7 @@ eth_copy_mbuf_to_fd(struct rte_mbuf *mbuf, #endif DPAA2_PMD_DP_DEBUG( "mbuf: %p, BMAN buf addr: %p, fdaddr: %" PRIx64 ", bpid: %d," - " meta: %d, off: %d, len: %d\n", + " meta: %d, off: %d, len: %d", (void *)mbuf, mbuf->buf_addr, DPAA2_GET_FD_ADDR(fd), @@ -656,7 +656,7 @@ dump_err_pkts(struct dpaa2_queue *dpaa2_q) while (1) { if (qbman_swp_pull(swp, &pulldesc)) { - DPAA2_PMD_DP_DEBUG("VDQ command is not issued.QBMAN is busy\n"); + DPAA2_PMD_DP_DEBUG("VDQ command is not issued.QBMAN is busy"); /* Portal was busy, try again */ continue; } @@ -765,7 +765,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) while (1) { if (qbman_swp_pull(swp, &pulldesc)) { DPAA2_PMD_DP_DEBUG("VDQ command is not issued." - " QBMAN is busy (1)\n"); + " QBMAN is busy (1)"); /* Portal was busy, try again */ continue; } @@ -861,7 +861,7 @@ dpaa2_dev_prefetch_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) while (1) { if (qbman_swp_pull(swp, &pulldesc)) { DPAA2_PMD_DP_DEBUG("VDQ command is not issued." - "QBMAN is busy (2)\n"); + "QBMAN is busy (2)"); continue; } break; @@ -1002,7 +1002,7 @@ dpaa2_dev_rx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) while (1) { if (qbman_swp_pull(swp, &pulldesc)) { DPAA2_PMD_DP_DEBUG( - "VDQ command is not issued.QBMAN is busy\n"); + "VDQ command is not issued.QBMAN is busy"); /* Portal was busy, try again */ continue; } @@ -1126,7 +1126,7 @@ uint16_t dpaa2_dev_tx_conf(void *queue) while (1) { if (qbman_swp_pull(swp, &pulldesc)) { DPAA2_PMD_DP_DEBUG("VDQ command is not issued." - "QBMAN is busy\n"); + "QBMAN is busy"); /* Portal was busy, try again */ continue; } @@ -1263,7 +1263,7 @@ dpaa2_dev_tx(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } swp = DPAA2_PER_LCORE_PORTAL; - DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n", + DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d", eth_data, dpaa2_q->fqid); #ifdef RTE_LIBRTE_IEEE1588 @@ -1598,7 +1598,7 @@ dpaa2_dev_tx_multi_txq_ordered(void **queue, } } - DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n", + DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d", eth_data, dpaa2_q[loop]->fqid); /* Check if the queue is congested */ @@ -1754,7 +1754,7 @@ dpaa2_dev_tx_ordered(void *queue, struct rte_mbuf **bufs, uint16_t nb_pkts) } swp = DPAA2_PER_LCORE_PORTAL; - DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d\n", + DPAA2_PMD_DP_DEBUG("===> eth_data =%p, fqid =%d", eth_data, dpaa2_q->fqid); /* This would also handle normal and atomic queues as any type @@ -1989,7 +1989,7 @@ dpaa2_dev_loopback_rx(void *queue, while (1) { if (qbman_swp_pull(swp, &pulldesc)) { DPAA2_PMD_DP_DEBUG( - "VDQ command not issued.QBMAN busy\n"); + "VDQ command not issued.QBMAN busy"); /* Portal was busy, try again */ continue; } @@ -2071,7 +2071,7 @@ dpaa2_dev_loopback_rx(void *queue, while (1) { if (qbman_swp_pull(swp, &pulldesc)) { DPAA2_PMD_DP_DEBUG("VDQ command is not issued." - "QBMAN is busy (2)\n"); + "QBMAN is busy (2)"); continue; } break; diff --git a/drivers/net/e1000/e1000_logs.h b/drivers/net/e1000/e1000_logs.h index 30b5531069..2060cbdbe3 100644 --- a/drivers/net/e1000/e1000_logs.h +++ b/drivers/net/e1000/e1000_logs.h @@ -8,35 +8,35 @@ #include extern int e1000_logtype_init; +#define RTE_LOGTYPE_E1000_INIT e1000_logtype_init -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, e1000_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, E1000_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX extern int e1000_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, e1000_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_E1000_RX e1000_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, E1000_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int e1000_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, e1000_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_E1000_TX e1000_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, E1000_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif extern int e1000_logtype_driver; #define RTE_LOGTYPE_E1000_DRIVER e1000_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, E1000_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, E1000_DRIVER, "%s(): ", __func__, __VA_ARGS__) /* log init function shared by e1000 and igb drivers */ void e1000_igb_init_log(void); diff --git a/drivers/net/ena/ena_logs.h b/drivers/net/ena/ena_logs.h index 5c9ec1772b..a5840131db 100644 --- a/drivers/net/ena/ena_logs.h +++ b/drivers/net/ena/ena_logs.h @@ -8,14 +8,14 @@ extern int ena_logtype_init; #define RTE_LOGTYPE_ENA_INIT ena_logtype_init -#define PMD_INIT_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, ENA_INIT, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_INIT_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ENA_INIT, "%s(): ", __func__, __VA_ARGS__) #ifdef RTE_ETHDEV_DEBUG_RX extern int ena_logtype_rx; #define RTE_LOGTYPE_ENA_RX ena_logtype_rx -#define PMD_RX_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, ENA_RX, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_RX_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ENA_RX, "%s(): ", __func__, __VA_ARGS__) #else #define PMD_RX_LOG_LINE(...) do { } while (0) #endif @@ -23,15 +23,15 @@ extern int ena_logtype_rx; #ifdef RTE_ETHDEV_DEBUG_TX extern int ena_logtype_tx; #define RTE_LOGTYPE_ENA_TX ena_logtype_tx -#define PMD_TX_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, ENA_TX, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_TX_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ENA_TX, "%s(): ", __func__, __VA_ARGS__) #else #define PMD_TX_LOG_LINE(...) do { } while (0) #endif extern int ena_logtype_driver; #define RTE_LOGTYPE_ENA_DRIVER ena_logtype_driver -#define PMD_DRV_LOG_LINE(level, fmt, ...) \ - RTE_LOG(level, ENA_DRIVER, "%s(): " fmt "\n", __func__, ## __VA_ARGS__) +#define PMD_DRV_LOG_LINE(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ENA_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _ENA_LOGS_H_ */ diff --git a/drivers/net/ena/ena_platform.h b/drivers/net/ena/ena_platform.h index 748928b2d9..71190b2932 100644 --- a/drivers/net/ena/ena_platform.h +++ b/drivers/net/ena/ena_platform.h @@ -9,7 +9,7 @@ #define ena_assert_msg(cond, msg) \ do { \ if (unlikely(!(cond))) { \ - rte_log(RTE_LOG_ERR, ena_logtype_driver, \ + RTE_LOG_LINE(ERR, ENA_DRIVER, \ "Assert failed on %s:%s:%d: ", \ __FILE__, __func__, __LINE__); \ rte_panic(msg); \ diff --git a/drivers/net/enetc/enetc_logs.h b/drivers/net/enetc/enetc_logs.h index 63f6ca4cf4..57bddcf683 100644 --- a/drivers/net/enetc/enetc_logs.h +++ b/drivers/net/enetc/enetc_logs.h @@ -6,15 +6,13 @@ #define _ENETC_LOGS_H_ extern int enetc_logtype_pmd; -#define RTE_LOGTYPE_ENETC_PMD enetc_logtype_pmd +#define RTE_LOGTYPE_ENETC_NET enetc_logtype_pmd -#define ENETC_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, enetc_logtype_pmd, "enetc_net: " \ - fmt "\n", ##args) +#define ENETC_PMD_LOG(level, ...) \ + RTE_LOG_LINE(level, ENETC_NET, __VA_ARGS__) -#define ENETC_PMD_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, enetc_logtype_pmd, "enetc_net: %s(): "\ - fmt "\n", __func__, ##args) +#define ENETC_PMD_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, ENETC_NET, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() ENETC_PMD_DEBUG(">>") @@ -30,8 +28,8 @@ extern int enetc_logtype_pmd; ENETC_PMD_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define ENETC_PMD_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, ENETC_PMD, fmt, ## args) +#define ENETC_PMD_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, ENETC_NET, __VA_ARGS__) #define ENETC_PMD_DP_DEBUG(fmt, args...) \ ENETC_PMD_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/net/enetfec/enet_pmd_logs.h b/drivers/net/enetfec/enet_pmd_logs.h index 270981373f..7580b5c8cc 100644 --- a/drivers/net/enetfec/enet_pmd_logs.h +++ b/drivers/net/enetfec/enet_pmd_logs.h @@ -8,12 +8,11 @@ #include extern int enetfec_logtype_pmd; -#define RTE_LOGTYPE_ENETFEC_PMD enetfec_logtype_pmd +#define RTE_LOGTYPE_ENETFEC_NET enetfec_logtype_pmd /* PMD related logs */ -#define ENETFEC_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, enetfec_logtype_pmd, "\nfec_net: %s()" \ - fmt "\n", __func__, ##args) +#define ENETFEC_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ENETFEC_NET, "%s()", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() ENET_PMD_LOG(DEBUG, " >>") @@ -28,7 +27,7 @@ extern int enetfec_logtype_pmd; ENETFEC_PMD_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define ENETFEC_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, ENETFEC_PMD, fmt, ## args) +#define ENETFEC_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, ENETFEC_NET, __VA_ARGS__) #endif /* _ENETFEC_LOGS_H_ */ diff --git a/drivers/net/enic/enic_compat.h b/drivers/net/enic/enic_compat.h index 7741273037..6d766bcd14 100644 --- a/drivers/net/enic/enic_compat.h +++ b/drivers/net/enic/enic_compat.h @@ -26,6 +26,7 @@ #define __ALIGN_MASK(x, mask) (((x)+(mask))&~(mask)) extern int enic_pmd_logtype; +#define RTE_LOGTYPE_ENIC_PMD enic_pmd_logtype #define dev_printk(level, fmt, args...) \ rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \ @@ -36,9 +37,8 @@ extern int enic_pmd_logtype; #define dev_warning(x, args...) dev_printk(WARNING, args) #define dev_debug(x, args...) dev_printk(DEBUG, args) -#define ENICPMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, enic_pmd_logtype, \ - "%s " fmt "\n", __func__, ##args) +#define ENICPMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ENIC_PMD, "%s ", __func__, __VA_ARGS__) #define ENICPMD_FUNC_TRACE() ENICPMD_LOG(DEBUG, ">>") typedef unsigned long long dma_addr_t; diff --git a/drivers/net/failsafe/failsafe_private.h b/drivers/net/failsafe/failsafe_private.h index 53a451c1b1..babea6016e 100644 --- a/drivers/net/failsafe/failsafe_private.h +++ b/drivers/net/failsafe/failsafe_private.h @@ -357,12 +357,9 @@ extern int failsafe_mac_from_arg; #endif extern int failsafe_logtype; +#define RTE_LOGTYPE_NET_FAILSAFE failsafe_logtype -#define LOG__(l, m, ...) \ - rte_log(RTE_LOG_ ## l, failsafe_logtype, \ - "net_failsafe: " m "%c", __VA_ARGS__) - -#define LOG_(level, ...) LOG__(level, __VA_ARGS__, '\n') +#define LOG_(l, ...) RTE_LOG_LINE(l, NET_FAILSAFE, __VA_ARGS__) #define DEBUG(...) LOG_(DEBUG, __VA_ARGS__) #define INFO(...) LOG_(INFO, __VA_ARGS__) #define WARN(...) LOG_(WARNING, __VA_ARGS__) diff --git a/drivers/net/fm10k/fm10k_logs.h b/drivers/net/fm10k/fm10k_logs.h index c4c7c977d9..ea1128a4e4 100644 --- a/drivers/net/fm10k/fm10k_logs.h +++ b/drivers/net/fm10k/fm10k_logs.h @@ -8,33 +8,33 @@ #include extern int fm10k_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, fm10k_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_FM10K_INIT fm10k_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, FM10K_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX extern int fm10k_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, fm10k_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_FM10K_RX fm10k_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, FM10K_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int fm10k_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, fm10k_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_FM10K_TX fm10k_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, FM10K_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif extern int fm10k_logtype_driver; #define RTE_LOGTYPE_FM10K_DRIVER fm10k_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, FM10K_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, FM10K_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _FM10K_LOGS_H_ */ diff --git a/drivers/net/gve/gve_logs.h b/drivers/net/gve/gve_logs.h index 0d02da46e1..a3d50fa45c 100644 --- a/drivers/net/gve/gve_logs.h +++ b/drivers/net/gve/gve_logs.h @@ -6,9 +6,9 @@ #define _GVE_LOGS_H_ extern int gve_logtype_driver; +#define RTE_LOGTYPE_GVE_DRIVER gve_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, gve_logtype_driver, "%s(): " fmt "\n", \ - __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, GVE_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif diff --git a/drivers/net/hinic/base/hinic_compat.h b/drivers/net/hinic/base/hinic_compat.h index aea332046e..ab9d1b9a02 100644 --- a/drivers/net/hinic/base/hinic_compat.h +++ b/drivers/net/hinic/base/hinic_compat.h @@ -80,14 +80,11 @@ typedef uint64_t dma_addr_t; #define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a))) -/* Reported driver name. */ -#define HINIC_DRIVER_NAME "net_hinic" - extern int hinic_logtype; +#define RTE_LOGTYPE_NET_HINIC hinic_logtype -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hinic_logtype, \ - HINIC_DRIVER_NAME": " fmt "\n", ##args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE(level, NET_HINIC, __VA_ARGS__) /* common definition */ #ifndef ETH_ALEN diff --git a/drivers/net/hns3/hns3_logs.h b/drivers/net/hns3/hns3_logs.h index 47d3a13220..d468c353fa 100644 --- a/drivers/net/hns3/hns3_logs.h +++ b/drivers/net/hns3/hns3_logs.h @@ -6,47 +6,50 @@ #define HNS3_LOGS_H extern int hns3_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hns3_logtype_init, "%s(): " fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_HNS3_INIT hns3_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, HNS3_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") extern int hns3_logtype_driver; -#define PMD_DRV_LOG_RAW(hw, level, fmt, args...) \ - rte_log(level, hns3_logtype_driver, "%s %s(): " fmt, \ - (hw)->data->name, __func__, ## args) +#define RTE_LOGTYPE_HNS3_DRIVER hns3_logtype_driver +#define PMD_DRV_LOG(hw, level, ...) \ + RTE_LOG_LINE_PREFIX(level, HNS3_DRIVER, "%s %s(): ", \ + (hw)->data->name RTE_LOG_COMMA __func__, __VA_ARGS__) #define hns3_err(hw, fmt, args...) \ - PMD_DRV_LOG_RAW(hw, RTE_LOG_ERR, fmt "\n", ## args) + PMD_DRV_LOG(hw, ERR, fmt, ## args) #define hns3_warn(hw, fmt, args...) \ - PMD_DRV_LOG_RAW(hw, RTE_LOG_WARNING, fmt "\n", ## args) + PMD_DRV_LOG(hw, WARNING, fmt, ## args) #define hns3_notice(hw, fmt, args...) \ - PMD_DRV_LOG_RAW(hw, RTE_LOG_NOTICE, fmt "\n", ## args) + PMD_DRV_LOG(hw, NOTICE, fmt, ## args) #define hns3_info(hw, fmt, args...) \ - PMD_DRV_LOG_RAW(hw, RTE_LOG_INFO, fmt "\n", ## args) + PMD_DRV_LOG(hw, INFO, fmt, ## args) #define hns3_dbg(hw, fmt, args...) \ - PMD_DRV_LOG_RAW(hw, RTE_LOG_DEBUG, fmt "\n", ## args) + PMD_DRV_LOG(hw, DEBUG, fmt, ## args) #ifdef RTE_ETHDEV_DEBUG_RX extern int hns3_logtype_rx; -#define PMD_RX_LOG(hw, level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hns3_logtype_rx, "%s %s(): " fmt "\n", \ - (hw)->data->name, __func__, ## args) +#define RTE_LOGTYPE_HNS3_RX hns3_logtype_rx +#define PMD_RX_LOG(hw, level, ...) \ + RTE_LOG_LINE_PREFIX(level, HNS3_RX, "%s %s(): ", \ + (hw)->data->name RTE_LOG_COMMA __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(hw, level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int hns3_logtype_tx; -#define PMD_TX_LOG(hw, level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hns3_logtype_tx, "%s %s(): " fmt "\n", \ - (hw)->data->name, __func__, ## args) +#define RTE_LOGTYPE_HNS3_TX hns3_logtype_tx +#define PMD_TX_LOG(hw, level, ...) \ + RTE_LOG_LINE_PREFIX(level, HNS3_TX, "%s %s(): ", \ + (hw)->data->name RTE_LOG_COMMA __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(hw, level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif #endif /* HNS3_LOGS_H */ diff --git a/drivers/net/i40e/i40e_logs.h b/drivers/net/i40e/i40e_logs.h index fb1f3a4096..d4d33681a6 100644 --- a/drivers/net/i40e/i40e_logs.h +++ b/drivers/net/i40e/i40e_logs.h @@ -6,32 +6,32 @@ #define _I40E_LOGS_H_ extern int i40e_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, i40e_logtype_init, "%s(): " fmt "\n", \ - __func__, ##args) +#define RTE_LOGTYPE_I40E_INIT i40e_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, I40E_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX extern int i40e_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, i40e_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_I40E_RX i40e_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, I40E_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int i40e_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, i40e_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_I40E_TX i40e_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, I40E_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif extern int i40e_logtype_driver; #define RTE_LOGTYPE_I40E_DRIVER i40e_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, I40E_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, I40E_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _I40E_LOGS_H_ */ diff --git a/drivers/net/iavf/iavf_log.h b/drivers/net/iavf/iavf_log.h index ff66ab0ccf..4168080812 100644 --- a/drivers/net/iavf/iavf_log.h +++ b/drivers/net/iavf/iavf_log.h @@ -6,37 +6,34 @@ #define _IAVF_LOG_H_ extern int iavf_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, iavf_logtype_init, "%s(): " fmt "\n", \ - __func__, ## args) +#define RTE_LOGTYPE_IAVF_INIT iavf_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IAVF_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") extern int iavf_logtype_driver; -#define PMD_DRV_LOG_RAW(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, iavf_logtype_driver, "%s(): " fmt, \ - __func__, ## args) - -#define PMD_DRV_LOG(level, fmt, args...) \ - PMD_DRV_LOG_RAW(level, fmt "\n", ## args) +#define RTE_LOGTYPE_IAVF_DRIVER iavf_logtype_driver +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IAVF_DRIVER, "%s(): ", __func__, __VA_ARGS__) #define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX extern int iavf_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, iavf_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_IAVF_RX iavf_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IAVF_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int iavf_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, iavf_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_IAVF_TX iavf_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IAVF_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif #endif /* _IAVF_LOG_H_ */ diff --git a/drivers/net/ice/ice_logs.h b/drivers/net/ice/ice_logs.h index a54e9d8b59..0f5ccba8ff 100644 --- a/drivers/net/ice/ice_logs.h +++ b/drivers/net/ice/ice_logs.h @@ -6,34 +6,34 @@ #define _ICE_LOGS_H_ extern int ice_logtype_init; +#define RTE_LOGTYPE_ICE_INIT ice_logtype_init extern int ice_logtype_driver; #define RTE_LOGTYPE_ICE_DRIVER ice_logtype_driver -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ice_logtype_init, "%s(): " fmt "\n", \ - __func__, ##args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ICE_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX extern int ice_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ice_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_ICE_RX ice_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ICE_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int ice_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ice_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_ICE_TX ice_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ICE_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif -#define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, ICE_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ICE_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _ICE_LOGS_H_ */ diff --git a/drivers/net/idpf/idpf_logs.h b/drivers/net/idpf/idpf_logs.h index bf0774b8e4..dd0f0b2375 100644 --- a/drivers/net/idpf/idpf_logs.h +++ b/drivers/net/idpf/idpf_logs.h @@ -8,25 +8,14 @@ #include extern int idpf_logtype_init; +#define RTE_LOGTYPE_IDPF_INIT idpf_logtype_init extern int idpf_logtype_driver; +#define RTE_LOGTYPE_IDPF_DRIVER idpf_logtype_driver #define PMD_INIT_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, \ - idpf_logtype_init, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE_PREFIX(level, IDPF_INIT, "%s(): ", __func__, __VA_ARGS__) -#define PMD_DRV_LOG_RAW(level, ...) \ - rte_log(RTE_LOG_ ## level, \ - idpf_logtype_driver, \ - RTE_FMT("%s(): " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) - -#define PMD_DRV_LOG(level, fmt, args...) \ - PMD_DRV_LOG_RAW(level, fmt "\n", ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IDPF_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _IDPF_LOGS_H_ */ diff --git a/drivers/net/igc/igc_logs.h b/drivers/net/igc/igc_logs.h index 4a574f10cb..3e6afd9f10 100644 --- a/drivers/net/igc/igc_logs.h +++ b/drivers/net/igc/igc_logs.h @@ -12,31 +12,29 @@ extern "C" { #endif extern int igc_logtype_init; +#define RTE_LOGTYPE_IGC_INIT igc_logtype_init extern int igc_logtype_driver; #define RTE_LOGTYPE_IGC_DRIVER igc_logtype_driver -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, igc_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IGC_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, IGC_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_RX_LOG(...) PMD_DRV_LOG(__VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, IGC_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_TX_LOG(...) PMD_DRV_LOG(__VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif -#define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, IGC_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IGC_DRIVER, "%s(): ", __func__, __VA_ARGS__) #ifdef __cplusplus } diff --git a/drivers/net/ipn3ke/ipn3ke_logs.h b/drivers/net/ipn3ke/ipn3ke_logs.h index 147fd8039e..42dceeeab1 100644 --- a/drivers/net/ipn3ke/ipn3ke_logs.h +++ b/drivers/net/ipn3ke/ipn3ke_logs.h @@ -8,10 +8,10 @@ #include extern int ipn3ke_afu_logtype; +#define RTE_LOGTYPE_IPN3KE_AFU ipn3ke_afu_logtype -#define IPN3KE_AFU_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ipn3ke_afu_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define IPN3KE_AFU_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IPN3KE_AFU, "%s(): ", __func__, __VA_ARGS__) #define IPN3KE_AFU_PMD_FUNC_TRACE() IPN3KE_AFU_PMD_LOG(DEBUG, ">>") diff --git a/drivers/net/ixgbe/ixgbe_logs.h b/drivers/net/ixgbe/ixgbe_logs.h index 5a2c5ccde0..150a2ea9f1 100644 --- a/drivers/net/ixgbe/ixgbe_logs.h +++ b/drivers/net/ixgbe/ixgbe_logs.h @@ -6,33 +6,33 @@ #define _IXGBE_LOGS_H_ extern int ixgbe_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ixgbe_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_IXGBE_INIT ixgbe_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IXGBE_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_ETHDEV_DEBUG_RX extern int ixgbe_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ixgbe_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_IXGBE_RX ixgbe_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IXGBE_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int ixgbe_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ixgbe_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_IXGBE_TX ixgbe_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IXGBE_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif extern int ixgbe_logtype_driver; #define RTE_LOGTYPE_IXGBE_DRIVER ixgbe_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - RTE_LOG(level, IXGBE_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IXGBE_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _IXGBE_LOGS_H_ */ diff --git a/drivers/net/mana/mana.h b/drivers/net/mana/mana.h index 37f654f0e6..41a0ca6dfe 100644 --- a/drivers/net/mana/mana.h +++ b/drivers/net/mana/mana.h @@ -466,17 +466,16 @@ struct mana_rxq { extern int mana_logtype_driver; #define RTE_LOGTYPE_MANA_DRIVER mana_logtype_driver extern int mana_logtype_init; +#define RTE_LOGTYPE_MANA_INIT mana_logtype_init -#define DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, mana_logtype_driver, "%s(): " fmt "\n", \ - __func__, ## args) +#define DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, MANA_DRIVER, "%s(): ", __func__, __VA_ARGS__) -#define DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, MANA_DRIVER, fmt "\n", ## args) +#define DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, MANA_DRIVER, __VA_ARGS__) -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, mana_logtype_init, "%s(): " fmt "\n",\ - __func__, ## args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, MANA_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") diff --git a/drivers/net/memif/rte_eth_memif.h b/drivers/net/memif/rte_eth_memif.h index f21806c811..8e45a3ab78 100644 --- a/drivers/net/memif/rte_eth_memif.h +++ b/drivers/net/memif/rte_eth_memif.h @@ -28,10 +28,10 @@ #define MAX_PKT_BURST 32 extern int memif_logtype; +#define RTE_LOGTYPE_MEMIF memif_logtype -#define MIF_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, memif_logtype, \ - "%s(): " fmt "\n", __func__, ##args) +#define MIF_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, MEMIF, "%s(): ", __func__, __VA_ARGS__) enum memif_role_t { MEMIF_ROLE_SERVER, diff --git a/drivers/net/mlx4/mlx4_utils.h b/drivers/net/mlx4/mlx4_utils.h index fca21fd79c..4b3323be8c 100644 --- a/drivers/net/mlx4/mlx4_utils.h +++ b/drivers/net/mlx4/mlx4_utils.h @@ -25,6 +25,7 @@ #endif extern int mlx4_logtype; +#define RTE_LOGTYPE_MLX4 mlx4_logtype #ifdef RTE_LIBRTE_MLX4_DEBUG @@ -46,12 +47,9 @@ pmd_drv_log_basename(const char *s) } #define PMD_DRV_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, mlx4_logtype, \ - RTE_FMT("%s:%u: %s(): " RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - pmd_drv_log_basename(__FILE__), \ - __LINE__, \ - __func__, \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE_PREFIX(level, MLX4, "%s:%u: %s(): ", \ + pmd_drv_log_basename(__FILE__) RTE_LOG_COMMA __LINE__ RTE_LOG_COMMA __func__, \ + __VA_ARGS__) #define MLX4_ASSERT(exp) RTE_VERIFY(exp) #define claim_zero(...) MLX4_ASSERT((__VA_ARGS__) == 0) @@ -63,10 +61,7 @@ pmd_drv_log_basename(const char *s) */ #define PMD_DRV_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, mlx4_logtype, \ - RTE_FMT(MLX4_DRIVER_NAME ": " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, MLX4, MLX4_DRIVER_NAME ": " __VA_ARGS__) #define MLX4_ASSERT(exp) RTE_ASSERT(exp) #define claim_zero(...) (__VA_ARGS__) diff --git a/drivers/net/mvneta/mvneta_ethdev.h b/drivers/net/mvneta/mvneta_ethdev.h index 9e711d8e5a..55859ed5e7 100644 --- a/drivers/net/mvneta/mvneta_ethdev.h +++ b/drivers/net/mvneta/mvneta_ethdev.h @@ -83,9 +83,9 @@ struct mvneta_priv { /** Current log type. */ extern int mvneta_logtype; +#define RTE_LOGTYPE_MVNETA mvneta_logtype -#define MVNETA_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, mvneta_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define MVNETA_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, MVNETA, "%s(): ", __func__, __VA_ARGS__) #endif /* _MVNETA_ETHDEV_H_ */ diff --git a/drivers/net/mvpp2/mrvl_ethdev.h b/drivers/net/mvpp2/mrvl_ethdev.h index 178b5103ba..8eb6278654 100644 --- a/drivers/net/mvpp2/mrvl_ethdev.h +++ b/drivers/net/mvpp2/mrvl_ethdev.h @@ -200,10 +200,10 @@ extern const struct rte_tm_ops mrvl_tm_ops; /** Current log type. */ extern int mrvl_logtype; +#define RTE_LOGTYPE_MRVL mrvl_logtype -#define MRVL_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, mrvl_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define MRVL_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, MRVL, "%s(): ", __func__, __VA_ARGS__) extern struct pp2_bpool *dummy_pool[PP2_NUM_PKT_PROC]; diff --git a/drivers/net/netvsc/hn_logs.h b/drivers/net/netvsc/hn_logs.h index cddadef09c..791c154e01 100644 --- a/drivers/net/netvsc/hn_logs.h +++ b/drivers/net/netvsc/hn_logs.h @@ -6,31 +6,29 @@ #include extern int hn_logtype_init; +#define RTE_LOGTYPE_HN_INIT hn_logtype_init extern int hn_logtype_driver; +#define RTE_LOGTYPE_HN_DRIVER hn_logtype_driver -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hn_logtype_init, "%s(): " fmt "\n",\ - __func__, ## args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, HN_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_NETVSC_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hn_logtype_driver, \ - "%s() rx: " fmt "\n", __func__, ## args) +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, HN_DRIVER, "%s() rx: ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_LIBRTE_NETVSC_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hn_logtype_driver, \ - "%s() tx: " fmt "\n", __func__, ## args) +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, HN_DRIVER, "%s() tx: ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, hn_logtype_driver, "%s(): " fmt "\n", \ - __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, HN_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _HN_LOGS_H_ */ diff --git a/drivers/net/netvsc/hn_rndis.c b/drivers/net/netvsc/hn_rndis.c index 1ba75ee804..b2dae6474a 100644 --- a/drivers/net/netvsc/hn_rndis.c +++ b/drivers/net/netvsc/hn_rndis.c @@ -95,8 +95,8 @@ void hn_rndis_dump(const void *buf) const struct rndis_pktinfo *ppi; unsigned int ppi_len; - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_MSG_PACKET (len %u, data %u:%u, # oob %u %u:%u, pkt %u:%u)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_MSG_PACKET (len %u, data %u:%u, # oob %u %u:%u, pkt %u:%u)", rndis_msg->pkt.len, rndis_msg->pkt.dataoffset, rndis_msg->pkt.datalen, @@ -116,8 +116,8 @@ void hn_rndis_dump(const void *buf) ppi_data = ppi->data; - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - " PPI (size %u, type %u, offs %u data %#x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + " PPI (size %u, type %u, offs %u data %#x)", ppi->size, ppi->type, ppi->offset, *(const uint32_t *)ppi_data); if (ppi->size == 0) @@ -129,8 +129,8 @@ void hn_rndis_dump(const void *buf) break; } case RNDIS_INITIALIZE_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_MSG_INIT (len %u id %#x, ver %u.%u max xfer %u)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_MSG_INIT (len %u id %#x, ver %u.%u max xfer %u)", rndis_msg->init_request.len, rndis_msg->init_request.rid, rndis_msg->init_request.ver_major, @@ -139,9 +139,9 @@ void hn_rndis_dump(const void *buf) break; case RNDIS_INITIALIZE_CMPLT: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, + RTE_LOG_LINE(DEBUG, HN_DRIVER, "RNDIS_MSG_INIT_C (len %u, id %#x, status 0x%x, vers %u.%u, " - "flags %d, max xfer %u, max pkts %u, aligned %u)\n", + "flags %d, max xfer %u, max pkts %u, aligned %u)", rndis_msg->init_complete.len, rndis_msg->init_complete.rid, rndis_msg->init_complete.status, @@ -154,14 +154,14 @@ void hn_rndis_dump(const void *buf) break; case RNDIS_HALT_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_HALT (len %u id %#x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_HALT (len %u id %#x)", rndis_msg->halt.len, rndis_msg->halt.rid); break; case RNDIS_QUERY_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_QUERY (len %u, id %#x, oid %#x, info %u:%u)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_QUERY (len %u, id %#x, oid %#x, info %u:%u)", rndis_msg->query_request.len, rndis_msg->query_request.rid, rndis_msg->query_request.oid, @@ -170,8 +170,8 @@ void hn_rndis_dump(const void *buf) break; case RNDIS_QUERY_CMPLT: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_MSG_QUERY_C (len %u, id %#x, status 0x%x, buf %u:%u)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_MSG_QUERY_C (len %u, id %#x, status 0x%x, buf %u:%u)", rndis_msg->query_complete.len, rndis_msg->query_complete.rid, rndis_msg->query_complete.status, @@ -180,8 +180,8 @@ void hn_rndis_dump(const void *buf) break; case RNDIS_SET_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_SET (len %u, id %#x, oid %#x, info %u:%u)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_SET (len %u, id %#x, oid %#x, info %u:%u)", rndis_msg->set_request.len, rndis_msg->set_request.rid, rndis_msg->set_request.oid, @@ -190,16 +190,16 @@ void hn_rndis_dump(const void *buf) break; case RNDIS_SET_CMPLT: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_MSG_SET_C (len %u, id 0x%x, status 0x%x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_MSG_SET_C (len %u, id 0x%x, status 0x%x)", rndis_msg->set_complete.len, rndis_msg->set_complete.rid, rndis_msg->set_complete.status); break; case RNDIS_INDICATE_STATUS_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_MSG_INDICATE (len %u, status %#x, buf len %u, buf offset %u)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_MSG_INDICATE (len %u, status %#x, buf len %u, buf offset %u)", rndis_msg->indicate_status.len, rndis_msg->indicate_status.status, rndis_msg->indicate_status.stbuflen, @@ -207,38 +207,38 @@ void hn_rndis_dump(const void *buf) break; case RNDIS_RESET_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_RESET (len %u, id %#x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_RESET (len %u, id %#x)", rndis_msg->reset_request.len, rndis_msg->reset_request.rid); break; case RNDIS_RESET_CMPLT: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_RESET_C (len %u, status %#x address %#x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_RESET_C (len %u, status %#x address %#x)", rndis_msg->reset_complete.len, rndis_msg->reset_complete.status, rndis_msg->reset_complete.adrreset); break; case RNDIS_KEEPALIVE_MSG: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_KEEPALIVE (len %u, id %#x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_KEEPALIVE (len %u, id %#x)", rndis_msg->keepalive_request.len, rndis_msg->keepalive_request.rid); break; case RNDIS_KEEPALIVE_CMPLT: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS_KEEPALIVE_C (len %u, id %#x address %#x)\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS_KEEPALIVE_C (len %u, id %#x address %#x)", rndis_msg->keepalive_complete.len, rndis_msg->keepalive_complete.rid, rndis_msg->keepalive_complete.status); break; default: - rte_log(RTE_LOG_DEBUG, hn_logtype_driver, - "RNDIS type %#x len %u\n", + RTE_LOG_LINE(DEBUG, HN_DRIVER, + "RNDIS type %#x len %u", rndis_msg->hdr.type, rndis_msg->hdr.len); break; diff --git a/drivers/net/nfb/nfb.h b/drivers/net/nfb/nfb.h index ca0b647571..a8b24ff822 100644 --- a/drivers/net/nfb/nfb.h +++ b/drivers/net/nfb/nfb.h @@ -13,9 +13,9 @@ #include extern int nfb_logtype; -#define NFB_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfb_logtype, "%s(): " fmt "\n", \ - __func__, ## args) +#define RTE_LOGTYPE_NFB nfb_logtype +#define NFB_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFB, "%s(): ", __func__, __VA_ARGS__) #include "nfb_rx.h" #include "nfb_tx.h" diff --git a/drivers/net/nfp/nfp_logs.h b/drivers/net/nfp/nfp_logs.h index 690adabffd..2b31798d73 100644 --- a/drivers/net/nfp/nfp_logs.h +++ b/drivers/net/nfp/nfp_logs.h @@ -9,36 +9,36 @@ #include extern int nfp_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_init, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_INIT nfp_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_INIT, "%s(): ", __func__, __VA_ARGS__) #ifdef RTE_ETHDEV_DEBUG_RX extern int nfp_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_rx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_RX nfp_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int nfp_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_tx, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_TX nfp_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif extern int nfp_logtype_cpp; -#define PMD_CPP_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_cpp, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_CPP nfp_logtype_cpp +#define PMD_CPP_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_CPP, "%s(): ", __func__, __VA_ARGS__) extern int nfp_logtype_driver; -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_DRIVER nfp_logtype_driver +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* __NFP_LOGS_H__ */ diff --git a/drivers/net/ngbe/ngbe_logs.h b/drivers/net/ngbe/ngbe_logs.h index e5165ffd60..f6c1ee66d9 100644 --- a/drivers/net/ngbe/ngbe_logs.h +++ b/drivers/net/ngbe/ngbe_logs.h @@ -10,31 +10,31 @@ * PMD_USER_LOG: for user */ extern int ngbe_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ngbe_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_NGBE_INIT ngbe_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NGBE_INIT, "%s(): ", __func__, __VA_ARGS__) extern int ngbe_logtype_driver; -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ngbe_logtype_driver, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_NGBE_DRIVER ngbe_logtype_driver +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NGBE_DRIVER, "%s(): ", __func__, __VA_ARGS__) #ifdef RTE_ETHDEV_DEBUG_RX extern int ngbe_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ngbe_logtype_rx, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_NGBE_RX ngbe_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NGBE_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_ETHDEV_DEBUG_TX extern int ngbe_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ngbe_logtype_tx, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_NGBE_TX ngbe_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NGBE_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif #define DEBUGOUT(fmt, args...) PMD_DRV_LOG(DEBUG, fmt, ##args) diff --git a/drivers/net/null/rte_eth_null.c b/drivers/net/null/rte_eth_null.c index f4ed3b8a7f..6764cf2ec1 100644 --- a/drivers/net/null/rte_eth_null.c +++ b/drivers/net/null/rte_eth_null.c @@ -76,10 +76,10 @@ static struct rte_eth_link pmd_link = { }; RTE_LOG_REGISTER_DEFAULT(eth_null_logtype, NOTICE); +#define RTE_LOGTYPE_ETH_NULL eth_null_logtype -#define PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, eth_null_logtype, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ETH_NULL, "%s(): ", __func__, __VA_ARGS__) static uint16_t eth_null_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) diff --git a/drivers/net/octeon_ep/otx_ep_common.h b/drivers/net/octeon_ep/otx_ep_common.h index 7d5dd91a77..122926cd40 100644 --- a/drivers/net/octeon_ep/otx_ep_common.h +++ b/drivers/net/octeon_ep/otx_ep_common.h @@ -67,20 +67,17 @@ #define OTX_EP_MAX_IOQS_PER_VF 8 #define OTX_CUST_DATA_LEN 0 -#define otx_ep_info(fmt, args...) \ - rte_log(RTE_LOG_INFO, otx_net_ep_logtype, \ - "%s():%u " fmt "\n", \ - __func__, __LINE__, ##args) - -#define otx_ep_err(fmt, args...) \ - rte_log(RTE_LOG_ERR, otx_net_ep_logtype, \ - "%s():%u " fmt "\n", \ - __func__, __LINE__, ##args) - -#define otx_ep_dbg(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, otx_net_ep_logtype, \ - "%s():%u " fmt "\n", \ - __func__, __LINE__, ##args) +#define otx_ep_info(...) \ + RTE_LOG_LINE_PREFIX(INFO, OTX_NET_EP, "%s():%u ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) + +#define otx_ep_err(...) \ + RTE_LOG_LINE_PREFIX(ERR, OTX_NET_EP, "%s():%u ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) + +#define otx_ep_dbg(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, OTX_NET_EP, "%s():%u ", \ + __func__ RTE_LOG_COMMA __LINE__, __VA_ARGS__) /* IO Access */ #define oct_ep_read64(addr) rte_read64_relaxed((void *)(addr)) diff --git a/drivers/net/octeon_ep/otx_ep_rxtx.c b/drivers/net/octeon_ep/otx_ep_rxtx.c index 9680a59797..09ed3c8da0 100644 --- a/drivers/net/octeon_ep/otx_ep_rxtx.c +++ b/drivers/net/octeon_ep/otx_ep_rxtx.c @@ -916,9 +916,9 @@ otx_ep_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) next_fetch = (pkts == new_pkts - 1) ? 0 : 1; oq_pkt = otx_ep_droq_read_packet(otx_ep, droq, next_fetch); if (!oq_pkt) { - RTE_LOG_DP(ERR, OTX_NET_EP, + RTE_LOG_DP_LINE(ERR, OTX_NET_EP, "DROQ read pkt failed pending %" PRIu64 - "last_pkt_count %" PRIu64 "new_pkts %d.\n", + "last_pkt_count %" PRIu64 "new_pkts %d.", droq->pkts_pending, droq->last_pkt_count, new_pkts); droq->stats.rx_err++; diff --git a/drivers/net/octeontx/octeontx_logs.h b/drivers/net/octeontx/octeontx_logs.h index b58f296478..2ebec8d3f8 100644 --- a/drivers/net/octeontx/octeontx_logs.h +++ b/drivers/net/octeontx/octeontx_logs.h @@ -5,22 +5,19 @@ #ifndef __OCTEONTX_LOGS_H__ #define __OCTEONTX_LOGS_H__ -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, otx_net_logtype_init, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OTX_NET_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, ">>") -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, otx_net_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OTX_NET_DRIVER, "%s(): ", __func__, __VA_ARGS__) -#define PMD_MBOX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, otx_net_logtype_mbox, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_MBOX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, OTX_NET_MBOX, "%s(): ", __func__, __VA_ARGS__) -#define octeontx_log_info(fmt, args...) \ - RTE_LOG(INFO, OTX_NET_DRIVER, fmt "\n", ## args) +#define octeontx_log_info(...) \ + RTE_LOG_LINE(INFO, OTX_NET_DRIVER, __VA_ARGS__) #define octeontx_log_err(s, ...) PMD_INIT_LOG(ERR, s, ##__VA_ARGS__) #define octeontx_log_dbg(s, ...) PMD_DRV_LOG(DEBUG, s, ##__VA_ARGS__) @@ -30,8 +27,10 @@ #define PMD_TX_LOG PMD_DRV_LOG extern int otx_net_logtype_init; +#define RTE_LOGTYPE_OTX_NET_INIT otx_net_logtype_init extern int otx_net_logtype_driver; #define RTE_LOGTYPE_OTX_NET_DRIVER otx_net_logtype_driver extern int otx_net_logtype_mbox; +#define RTE_LOGTYPE_OTX_NET_MBOX otx_net_logtype_mbox #endif /* __OCTEONTX_LOGS_H__*/ diff --git a/drivers/net/pcap/pcap_osdep.h b/drivers/net/pcap/pcap_osdep.h index bf41cba982..2aa13f3629 100644 --- a/drivers/net/pcap/pcap_osdep.h +++ b/drivers/net/pcap/pcap_osdep.h @@ -7,10 +7,10 @@ #include -#define PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, eth_pcap_logtype, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ETH_PCAP, "%s(): ", __func__, __VA_ARGS__) extern int eth_pcap_logtype; +#define RTE_LOGTYPE_ETH_PCAP eth_pcap_logtype int osdep_iface_index_get(const char *name); int osdep_iface_mac_get(const char *name, struct rte_ether_addr *mac); diff --git a/drivers/net/pfe/pfe_logs.h b/drivers/net/pfe/pfe_logs.h index 369a50bec5..d0b6943a26 100644 --- a/drivers/net/pfe/pfe_logs.h +++ b/drivers/net/pfe/pfe_logs.h @@ -6,12 +6,11 @@ #define _PFE_LOGS_H_ extern int pfe_logtype_pmd; -#define RTE_LOGTYPE_PFE_PMD pfe_logtype_pmd +#define RTE_LOGTYPE_PFE_NET pfe_logtype_pmd /* PMD related logs */ -#define PFE_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, pfe_logtype_pmd, "pfe_net: %s()" \ - fmt "\n", __func__, ##args) +#define PFE_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, PFE_NET, "%s()", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PFE_PMD_LOG(DEBUG, " >>") @@ -26,7 +25,7 @@ extern int pfe_logtype_pmd; PFE_PMD_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define PFE_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, PFE_PMD, fmt, ## args) +#define PFE_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, PFE_NET, __VA_ARGS__) #endif /* _PFE_LOGS_H_ */ diff --git a/drivers/net/ring/rte_eth_ring.c b/drivers/net/ring/rte_eth_ring.c index 1346a0dba3..146bdc8e02 100644 --- a/drivers/net/ring/rte_eth_ring.c +++ b/drivers/net/ring/rte_eth_ring.c @@ -68,10 +68,10 @@ static struct rte_eth_link pmd_link = { }; RTE_LOG_REGISTER_DEFAULT(eth_ring_logtype, NOTICE); +#define RTE_LOGTYPE_ETH_RING eth_ring_logtype -#define PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, eth_ring_logtype, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, ETH_RING, "%s(): ", __func__, __VA_ARGS__) static uint16_t eth_ring_rx(void *q, struct rte_mbuf **bufs, uint16_t nb_bufs) diff --git a/drivers/net/softnic/rte_eth_softnic.c b/drivers/net/softnic/rte_eth_softnic.c index 1b90cf7a21..2147ea35f6 100644 --- a/drivers/net/softnic/rte_eth_softnic.c +++ b/drivers/net/softnic/rte_eth_softnic.c @@ -51,10 +51,10 @@ static const struct softnic_conn_params conn_params_default = { }; RTE_LOG_REGISTER_DEFAULT(pmd_softnic_logtype, NOTICE); +#define RTE_LOGTYPE_PMD_SOFTNIC pmd_softnic_logtype -#define PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, pmd_softnic_logtype, \ - "%s(): " fmt "\n", __func__, ##args) +#define PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, PMD_SOFTNIC, "%s(): ", __func__, __VA_ARGS__) static int pmd_dev_infos_get(struct rte_eth_dev *dev __rte_unused, diff --git a/drivers/net/tap/tap_log.h b/drivers/net/tap/tap_log.h index fa06843a4c..847d89050c 100644 --- a/drivers/net/tap/tap_log.h +++ b/drivers/net/tap/tap_log.h @@ -4,7 +4,7 @@ */ extern int tap_logtype; +#define RTE_LOGTYPE_TAP tap_logtype -#define TAP_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, tap_logtype, "%s(): " fmt "\n", \ - __func__, ## args) +#define TAP_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, TAP, "%s(): ", __func__, __VA_ARGS__) diff --git a/drivers/net/thunderx/nicvf_logs.h b/drivers/net/thunderx/nicvf_logs.h index 3c455b4288..7f162b34a4 100644 --- a/drivers/net/thunderx/nicvf_logs.h +++ b/drivers/net/thunderx/nicvf_logs.h @@ -19,26 +19,26 @@ #define NICVF_TX_ASSERT(x) do { } while (0) #endif -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nicvf_logtype_init, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NICVF_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, ">>") -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nicvf_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NICVF_DRIVER, "%s(): ", __func__, __VA_ARGS__) #define PMD_DRV_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>") -#define PMD_MBOX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nicvf_logtype_mbox, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_MBOX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NICVF_MBOX, "%s(): ", __func__, __VA_ARGS__) #define PMD_MBOX_FUNC_TRACE() PMD_DRV_LOG(DEBUG, ">>") #define PMD_RX_LOG PMD_DRV_LOG #define PMD_TX_LOG PMD_DRV_LOG extern int nicvf_logtype_init; +#define RTE_LOGTYPE_NICVF_INIT nicvf_logtype_init extern int nicvf_logtype_driver; +#define RTE_LOGTYPE_NICVF_DRIVER nicvf_logtype_driver extern int nicvf_logtype_mbox; +#define RTE_LOGTYPE_NICVF_MBOX nicvf_logtype_mbox #endif /* __THUNDERX_NICVF_LOGS__ */ diff --git a/drivers/net/txgbe/txgbe_logs.h b/drivers/net/txgbe/txgbe_logs.h index b5a5a9233f..e6e570734c 100644 --- a/drivers/net/txgbe/txgbe_logs.h +++ b/drivers/net/txgbe/txgbe_logs.h @@ -12,40 +12,41 @@ * PMD_USER_LOG: for user */ extern int txgbe_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, txgbe_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_TXGBE_INIT txgbe_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, TXGBE_INIT, "%s(): ", __func__, __VA_ARGS__) extern int txgbe_logtype_driver; -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, txgbe_logtype_driver, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_TXGBE_DRIVER txgbe_logtype_driver +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, TXGBE_DRIVER, "%s(): ", __func__, __VA_ARGS__) #ifdef RTE_LIBRTE_TXGBE_DEBUG_RX extern int txgbe_logtype_rx; -#define PMD_RX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, txgbe_logtype_rx, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_TXGBE_RX txgbe_logtype_rx +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, TXGBE_RX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while (0) +#define PMD_RX_LOG(...) do { } while (0) #endif #ifdef RTE_LIBRTE_TXGBE_DEBUG_TX extern int txgbe_logtype_tx; -#define PMD_TX_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, txgbe_logtype_tx, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_TXGBE_TX txgbe_logtype_tx +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, TXGBE_TX, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_LOG(...) do { } while (0) #endif #ifdef RTE_LIBRTE_TXGBE_DEBUG_TX_FREE extern int txgbe_logtype_tx_free; -#define PMD_TX_FREE_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, txgbe_logtype_tx_free, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_TXGBE_TX_FREE txgbe_logtype_tx_free +#define RTE_LOGTYPE_TXGBE_TX txgbe_logtype_tx +#define PMD_TX_FREE_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, TXGBE_TX_FREE, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while (0) +#define PMD_TX_FREE_LOG(...) do { } while (0) #endif #define DEBUGOUT(fmt, args...) PMD_DRV_LOG(DEBUG, fmt, ##args) diff --git a/drivers/net/vdev_netvsc/vdev_netvsc.c b/drivers/net/vdev_netvsc/vdev_netvsc.c index c3e045d892..f4a84783ce 100644 --- a/drivers/net/vdev_netvsc/vdev_netvsc.c +++ b/drivers/net/vdev_netvsc/vdev_netvsc.c @@ -49,13 +49,10 @@ #define NETVSC_MAX_ROUTE_LINE_SIZE 300 RTE_LOG_REGISTER_DEFAULT(vdev_netvsc_logtype, NOTICE); +#define RTE_LOGTYPE_VDEV_NETVSC vdev_netvsc_logtype #define DRV_LOG(level, ...) \ - rte_log(RTE_LOG_ ## level, \ - vdev_netvsc_logtype, \ - RTE_FMT(VDEV_NETVSC_DRIVER_NAME ": " \ - RTE_FMT_HEAD(__VA_ARGS__,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__,))) + RTE_LOG_LINE(level, VDEV_NETVSC, __VA_ARGS__) /** Context structure for a vdev_netvsc instance. */ struct vdev_netvsc_ctx { diff --git a/drivers/net/vhost/rte_eth_vhost.c b/drivers/net/vhost/rte_eth_vhost.c index 6ccb228872..87c05caccd 100644 --- a/drivers/net/vhost/rte_eth_vhost.c +++ b/drivers/net/vhost/rte_eth_vhost.c @@ -25,8 +25,7 @@ RTE_LOG_REGISTER_DEFAULT(vhost_logtype, NOTICE); #define RTE_LOGTYPE_VHOST vhost_logtype #define VHOST_LOG_LINE(level, ...) \ - RTE_LOG(level, VHOST, RTE_FMT(RTE_FMT_HEAD(__VA_ARGS__ ,) "\n", \ - RTE_FMT_TAIL(__VA_ARGS__ ,))) + RTE_LOG_LINE(level, VHOST, __VA_ARGS__) enum {VIRTIO_RXQ, VIRTIO_TXQ, VIRTIO_QNUM}; diff --git a/drivers/net/virtio/virtio_logs.h b/drivers/net/virtio/virtio_logs.h index 01911514bd..dea1a7ac11 100644 --- a/drivers/net/virtio/virtio_logs.h +++ b/drivers/net/virtio/virtio_logs.h @@ -8,30 +8,29 @@ #include extern int virtio_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_logtype_init, \ - "%s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_VIRTIO_INIT virtio_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_VIRTIO_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, VIRTIO_DRIVER, "%s() rx: " fmt "\n", __func__, ## args) +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_DRIVER, "%s() rx: ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while(0) +#define PMD_RX_LOG(...) do { } while(0) #endif #ifdef RTE_LIBRTE_VIRTIO_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, VIRTIO_DRIVER, "%s() tx: " fmt "\n", __func__, ## args) +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_DRIVER, "%s() tx: ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while(0) +#define PMD_TX_LOG(...) do { } while(0) #endif extern int virtio_logtype_driver; #define RTE_LOGTYPE_VIRTIO_DRIVER virtio_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, virtio_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VIRTIO_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _VIRTIO_LOGS_H_ */ diff --git a/drivers/net/vmxnet3/vmxnet3_logs.h b/drivers/net/vmxnet3/vmxnet3_logs.h index 5962325d62..43a982cdf5 100644 --- a/drivers/net/vmxnet3/vmxnet3_logs.h +++ b/drivers/net/vmxnet3/vmxnet3_logs.h @@ -6,36 +6,35 @@ #define _VMXNET3_LOGS_H_ extern int vmxnet3_logtype_init; -#define PMD_INIT_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, vmxnet3_logtype_init, \ - "%s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_VMXNET3_INIT vmxnet3_logtype_init +#define PMD_INIT_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VMXNET3_INIT, "%s(): ", __func__, __VA_ARGS__) #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") #ifdef RTE_LIBRTE_VMXNET3_DEBUG_RX -#define PMD_RX_LOG(level, fmt, args...) \ - RTE_LOG(level, VMXNET3_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_RX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VMXNET3_DRIVER, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_RX_LOG(level, fmt, args...) do { } while(0) +#define PMD_RX_LOG(...) do { } while(0) #endif #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX -#define PMD_TX_LOG(level, fmt, args...) \ - RTE_LOG(level, VMXNET3_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_TX_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VMXNET3_DRIVER, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_LOG(level, fmt, args...) do { } while(0) +#define PMD_TX_LOG(...) do { } while(0) #endif #ifdef RTE_LIBRTE_VMXNET3_DEBUG_TX_FREE -#define PMD_TX_FREE_LOG(level, fmt, args...) \ - RTE_LOG(level, VMXNET3_DRIVER, "%s(): " fmt "\n", __func__, ## args) +#define PMD_TX_FREE_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VMXNET3_DRIVER, "%s(): ", __func__, __VA_ARGS__) #else -#define PMD_TX_FREE_LOG(level, fmt, args...) do { } while(0) +#define PMD_TX_FREE_LOG(...) do { } while(0) #endif extern int vmxnet3_logtype_driver; #define RTE_LOGTYPE_VMXNET3_DRIVER vmxnet3_logtype_driver -#define PMD_DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, vmxnet3_logtype_driver, \ - "%s(): " fmt "\n", __func__, ## args) +#define PMD_DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, VMXNET3_DRIVER, "%s(): ", __func__, __VA_ARGS__) #endif /* _VMXNET3_LOGS_H_ */ diff --git a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h index 790b4d2a5a..f668e6ea82 100644 --- a/drivers/raw/cnxk_bphy/rte_pmd_bphy.h +++ b/drivers/raw/cnxk_bphy/rte_pmd_bphy.h @@ -27,10 +27,10 @@ extern "C" { #endif extern int cnxk_logtype_bphy; +#define RTE_LOGTYPE_CNXK_BPHY cnxk_logtype_bphy -#define CNXK_BPHY_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, cnxk_logtype_bphy, \ - "%s(): " fmt "\n", __func__, ## args) +#define CNXK_BPHY_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, CNXK_BPHY, "%s(): ", __func__, __VA_ARGS__) /** Available message types */ enum cnxk_bphy_cgx_msg_type { diff --git a/drivers/raw/cnxk_gpio/cnxk_gpio.h b/drivers/raw/cnxk_gpio/cnxk_gpio.h index 336d7ac373..94c8e36977 100644 --- a/drivers/raw/cnxk_gpio/cnxk_gpio.h +++ b/drivers/raw/cnxk_gpio/cnxk_gpio.h @@ -6,9 +6,10 @@ #define _CNXK_GPIO_H_ extern int cnxk_logtype_gpio; +#define RTE_LOGTYPE_CNXK_GPIO cnxk_logtype_gpio -#define CNXK_GPIO_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, cnxk_logtype_gpio, fmt "\n", ## args) +#define CNXK_GPIO_LOG(level, ...) \ + RTE_LOG_LINE(level, CNXK_GPIO, __VA_ARGS__) struct cnxk_gpiochip; diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h index f5f2455413..66108e0667 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif_logs.h @@ -12,13 +12,11 @@ extern "C" { extern int dpaa2_cmdif_logtype; #define RTE_LOGTYPE_DPAA2_CMDIF dpaa2_cmdif_logtype -#define DPAA2_CMDIF_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, dpaa2_cmdif_logtype, "dpaa2_cmdif: " \ - fmt "\n", ## args) +#define DPAA2_CMDIF_LOG(level, ...) \ + RTE_LOG_LINE(level, DPAA2_CMDIF, __VA_ARGS__) -#define DPAA2_CMDIF_DEBUG(fmt, args...) \ - rte_log(RTE_LOG_DEBUG, dpaa2_cmdif_logtype, "dpaa2_cmdif: %s(): " \ - fmt "\n", __func__, ## args) +#define DPAA2_CMDIF_DEBUG(...) \ + RTE_LOG_LINE_PREFIX(DEBUG, DPAA2_CMDIF, "%s(): ", __func__, __VA_ARGS__) #define DPAA2_CMDIF_FUNC_TRACE() DPAA2_CMDIF_DEBUG(">>") @@ -30,8 +28,8 @@ extern int dpaa2_cmdif_logtype; DPAA2_CMDIF_LOG(WARNING, fmt, ## args) /* DP Logs, toggled out at compile time if level lower than current level */ -#define DPAA2_CMDIF_DP_LOG(level, fmt, args...) \ - RTE_LOG_DP(level, DPAA2_CMDIF, "dpaa2_cmdif: " fmt "\n", ## args) +#define DPAA2_CMDIF_DP_LOG(level, ...) \ + RTE_LOG_DP_LINE(level, DPAA2_CMDIF, __VA_ARGS__) #define DPAA2_CMDIF_DP_DEBUG(fmt, args...) \ DPAA2_CMDIF_DP_LOG(DEBUG, fmt, ## args) diff --git a/drivers/raw/ifpga/ifpga_rawdev.h b/drivers/raw/ifpga/ifpga_rawdev.h index 0fb66cbaae..c733ffcb41 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.h +++ b/drivers/raw/ifpga/ifpga_rawdev.h @@ -6,12 +6,12 @@ #define _IFPGA_RAWDEV_H_ extern int ifpga_rawdev_logtype; +#define RTE_LOGTYPE_IFPGA_RAWDEV ifpga_rawdev_logtype #define IFPGA_RAWDEV_NAME_FMT "IFPGA:%02x:%02x.%x" -#define IFPGA_RAWDEV_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ifpga_rawdev_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define IFPGA_RAWDEV_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IFPGA_RAWDEV, "%s(): ", __func__, __VA_ARGS__) #define IFPGA_RAWDEV_PMD_FUNC_TRACE() IFPGA_RAWDEV_PMD_LOG(DEBUG, ">>") diff --git a/drivers/raw/ntb/ntb.h b/drivers/raw/ntb/ntb.h index 563ceddf18..8c7a2230f9 100644 --- a/drivers/raw/ntb/ntb.h +++ b/drivers/raw/ntb/ntb.h @@ -8,10 +8,10 @@ #include extern int ntb_logtype; +#define RTE_LOGTYPE_NTB ntb_logtype -#define NTB_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ntb_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define NTB_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NTB, "%s(): ", __func__, __VA_ARGS__) /* Vendor ID */ #define NTB_INTEL_VENDOR_ID 0x8086 diff --git a/drivers/raw/skeleton/skeleton_rawdev.h b/drivers/raw/skeleton/skeleton_rawdev.h index c3f92e72ab..53f21212a2 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.h +++ b/drivers/raw/skeleton/skeleton_rawdev.h @@ -8,10 +8,10 @@ #include extern int skeleton_pmd_logtype; +#define RTE_LOGTYPE_SKELETON_PMD skeleton_pmd_logtype -#define SKELETON_PMD_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, skeleton_pmd_logtype, "%s(): " fmt "\n", \ - __func__, ##args) +#define SKELETON_PMD_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, SKELETON_PMD, "%s(): ", __func__, __VA_ARGS__) #define SKELETON_PMD_FUNC_TRACE() SKELETON_PMD_LOG(DEBUG, ">>") diff --git a/drivers/raw/skeleton/skeleton_rawdev_test.c b/drivers/raw/skeleton/skeleton_rawdev_test.c index b7a7f623aa..ebbaabff4d 100644 --- a/drivers/raw/skeleton/skeleton_rawdev_test.c +++ b/drivers/raw/skeleton/skeleton_rawdev_test.c @@ -18,9 +18,8 @@ #define TEST_DEV_NAME "rawdev_skeleton" -#define SKELDEV_LOGS(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, skeleton_pmd_logtype, fmt "\n", \ - ##args) +#define SKELDEV_LOGS(level, ...) \ + RTE_LOG_LINE(level, SKELETON_PMD, __VA_ARGS__) #define SKELDEV_TEST_INFO(fmt, args...) \ SKELDEV_LOGS(INFO, fmt, ## args) diff --git a/drivers/vdpa/ifc/base/ifcvf.c b/drivers/vdpa/ifc/base/ifcvf.c index 8479172bfa..54067f94aa 100644 --- a/drivers/vdpa/ifc/base/ifcvf.c +++ b/drivers/vdpa/ifc/base/ifcvf.c @@ -224,10 +224,10 @@ ifcvf_enable_mq(struct ifcvf_hw *hw) if (mq_cfg) { if (hw->device_type == IFCVF_BLK) { *(u32 *)mq_cfg = nr_queue; - RTE_LOG(INFO, IFCVF_VDPA, "%d queues are enabled\n", nr_queue); + RTE_LOG_LINE(INFO, IFCVF_VDPA, "%d queues are enabled", nr_queue); } else { *(u32 *)mq_cfg = nr_queue / 2; - RTE_LOG(INFO, IFCVF_VDPA, "%d queue pairs are enabled\n", + RTE_LOG_LINE(INFO, IFCVF_VDPA, "%d queue pairs are enabled", nr_queue / 2); } } @@ -246,7 +246,7 @@ ifcvf_enable_vring_hw(struct ifcvf_hw *hw, int i) cfg = hw->common_cfg; if (!cfg) { - RTE_LOG(ERR, IFCVF_VDPA, "common_cfg in HW is NULL.\n"); + RTE_LOG_LINE(ERR, IFCVF_VDPA, "common_cfg in HW is NULL."); return -1; } @@ -258,7 +258,7 @@ ifcvf_enable_vring_hw(struct ifcvf_hw *hw, int i) IFCVF_WRITE_REG16(i + 1, &cfg->queue_msix_vector); msix_vector = IFCVF_READ_REG16(&cfg->queue_msix_vector); if (msix_vector == IFCVF_MSI_NO_VECTOR) { - RTE_LOG(ERR, IFCVF_VDPA, "queue %d, msix vec alloc failed\n", + RTE_LOG_LINE(ERR, IFCVF_VDPA, "queue %d, msix vec alloc failed", i); return -1; } @@ -307,7 +307,7 @@ ifcvf_disable_vring_hw(struct ifcvf_hw *hw, int i) cfg = hw->common_cfg; if (!cfg) { - RTE_LOG(ERR, IFCVF_VDPA, "common_cfg in HW is NULL.\n"); + RTE_LOG_LINE(ERR, IFCVF_VDPA, "common_cfg in HW is NULL."); return; } diff --git a/drivers/vdpa/ifc/ifcvf_vdpa.c b/drivers/vdpa/ifc/ifcvf_vdpa.c index 2958368813..65de383b95 100644 --- a/drivers/vdpa/ifc/ifcvf_vdpa.c +++ b/drivers/vdpa/ifc/ifcvf_vdpa.c @@ -33,9 +33,9 @@ #define MIN(v1, v2) ((v1) < (v2) ? (v1) : (v2)) RTE_LOG_REGISTER(ifcvf_vdpa_logtype, pmd.vdpa.ifcvf, NOTICE); -#define DRV_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, ifcvf_vdpa_logtype, \ - "IFCVF %s(): " fmt "\n", __func__, ##args) +#define RTE_LOGTYPE_IFCVF_VDPA ifcvf_vdpa_logtype +#define DRV_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, IFCVF_VDPA, "%s(): ", __func__, __VA_ARGS__) #define IFCVF_USED_RING_LEN(size) \ ((size) * sizeof(struct vring_used_elem) + sizeof(uint16_t) * 3) diff --git a/drivers/vdpa/nfp/nfp_vdpa_log.h b/drivers/vdpa/nfp/nfp_vdpa_log.h index cf342329b1..8fa4e3b2a0 100644 --- a/drivers/vdpa/nfp/nfp_vdpa_log.h +++ b/drivers/vdpa/nfp/nfp_vdpa_log.h @@ -9,13 +9,13 @@ #include extern int nfp_logtype_vdpa; -#define DRV_VDPA_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_vdpa, \ - "NFP_VDPA: %s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_VDPA nfp_logtype_vdpa +#define DRV_VDPA_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_VDPA, "%s(): ", __func__, __VA_ARGS__) extern int nfp_logtype_core; -#define DRV_CORE_LOG(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, nfp_logtype_core, \ - "NFP_CORE: %s(): " fmt "\n", __func__, ## args) +#define RTE_LOGTYPE_NFP_CORE nfp_logtype_core +#define DRV_CORE_LOG(level, ...) \ + RTE_LOG_LINE_PREFIX(level, NFP_CORE, "%s(): ", __func__, __VA_ARGS__) #endif /* __NFP_VDPA_LOG_H__ */ -- 2.46.0