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 6A7BF45F2A; Tue, 24 Dec 2024 08:39:26 +0100 (CET) Received: from mails.dpdk.org (localhost [127.0.0.1]) by mails.dpdk.org (Postfix) with ESMTP id C7F2B4068A; Tue, 24 Dec 2024 08:38:46 +0100 (CET) Received: from mx0b-0016f401.pphosted.com (mx0a-0016f401.pphosted.com [67.231.148.174]) by mails.dpdk.org (Postfix) with ESMTP id 35B3B40613 for ; Tue, 24 Dec 2024 08:38:43 +0100 (CET) Received: from pps.filterd (m0045849.ppops.net [127.0.0.1]) by mx0a-0016f401.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 4BO7Aqlm003104; Mon, 23 Dec 2024 23:38:42 -0800 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=pfpt0220; bh=i bm7YGbsHRZ2QhFYtAdxszSus3CCw0JMxdMkISX0+mc=; b=Zmb9MZ+cKN/ujHDSh vmbY26MKWrt2sQJ2CrjGR7RCndOzVZx8jpc4419TWrYfqDjG38p+ESpWUcIrdM3l 7Xzd29A/3WQwVteaR8JwweJQP+gtuUPGs249ozpz+fXehyz1tzS96jnoLLF0p7jD CvpyWc466EtW9BTlxPSaxD0DlV45fEe4pIm+P/+ritlV5cjRo8oBlbFBcPDgpTx0 B/PlZ6nNJbE6FBHa0PMf/vAyd72AKKQGCyx/QGGwHAlDZ83oESIS+7KHUTE6KLvX rIq7Vufb2fWYk7jmLqN2/EFOrw4fvbfNQ71/caMj6gNxmbjnGshtz+n2LsZzyEiS BvEaQ== Received: from dc6wp-exch02.marvell.com ([4.21.29.225]) by mx0a-0016f401.pphosted.com (PPS) with ESMTPS id 43qrb8028k-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 23 Dec 2024 23:38:42 -0800 (PST) Received: from DC6WP-EXCH02.marvell.com (10.76.176.209) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.4; Mon, 23 Dec 2024 23:38:41 -0800 Received: from maili.marvell.com (10.69.176.80) by DC6WP-EXCH02.marvell.com (10.76.176.209) with Microsoft SMTP Server id 15.2.1544.4 via Frontend Transport; Mon, 23 Dec 2024 23:38:40 -0800 Received: from IN-lckQE5Rwctls.marvell.com (IN-lckQE5Rwctls.marvell.com [10.28.163.68]) by maili.marvell.com (Postfix) with ESMTP id 59EBA3F705D; Mon, 23 Dec 2024 23:38:37 -0800 (PST) From: Gowrishankar Muthukrishnan To: , Akhil Goyal , Maxime Coquelin , Chenbo Xia , Fan Zhang , Jay Zhou , "Bruce Richardson" , Konstantin Ananyev CC: , , Rajesh Mudimadugula , Gowrishankar Muthukrishnan Subject: [v1 12/16] common/virtio: common virtio log Date: Tue, 24 Dec 2024 13:07:10 +0530 Message-ID: X-Mailer: git-send-email 2.37.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: SVE802-hvHUsW4eFPMYDzKWPazZX3Hhp X-Proofpoint-GUID: SVE802-hvHUsW4eFPMYDzKWPazZX3Hhp X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.680,FMLib:17.12.60.29 definitions=2024-09-06_09,2024-09-06_01,2024-09-02_01 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 Common virtio log include file. Signed-off-by: Gowrishankar Muthukrishnan --- drivers/{net => common}/virtio/virtio_logs.h | 16 ++-------- drivers/crypto/virtio/meson.build | 1 + .../{virtio_logs.h => virtio_crypto_logs.h} | 30 ++++++++----------- drivers/crypto/virtio/virtio_cryptodev.c | 4 +-- drivers/crypto/virtio/virtqueue.h | 2 +- drivers/net/virtio/meson.build | 3 +- drivers/net/virtio/virtio.c | 3 +- drivers/net/virtio/virtio_ethdev.c | 3 +- drivers/net/virtio/virtio_net_logs.h | 30 +++++++++++++++++++ drivers/net/virtio/virtio_pci.c | 3 +- drivers/net/virtio/virtio_pci_ethdev.c | 3 +- drivers/net/virtio/virtio_rxtx.c | 3 +- drivers/net/virtio/virtio_rxtx_packed.c | 3 +- drivers/net/virtio/virtio_rxtx_packed.h | 3 +- drivers/net/virtio/virtio_rxtx_packed_avx.h | 3 +- drivers/net/virtio/virtio_rxtx_simple.h | 3 +- .../net/virtio/virtio_user/vhost_kernel_tap.c | 3 +- drivers/net/virtio/virtio_user/vhost_vdpa.c | 3 +- drivers/net/virtio/virtio_user_ethdev.c | 3 +- drivers/net/virtio/virtqueue.c | 3 +- drivers/net/virtio/virtqueue.h | 3 +- 21 files changed, 77 insertions(+), 51 deletions(-) rename drivers/{net => common}/virtio/virtio_logs.h (61%) rename drivers/crypto/virtio/{virtio_logs.h => virtio_crypto_logs.h} (74%) create mode 100644 drivers/net/virtio/virtio_net_logs.h diff --git a/drivers/net/virtio/virtio_logs.h b/drivers/common/virtio/virtio_logs.h similarity index 61% rename from drivers/net/virtio/virtio_logs.h rename to drivers/common/virtio/virtio_logs.h index dea1a7ac11..bc115e7a36 100644 --- a/drivers/net/virtio/virtio_logs.h +++ b/drivers/common/virtio/virtio_logs.h @@ -5,6 +5,8 @@ #ifndef _VIRTIO_LOGS_H_ #define _VIRTIO_LOGS_H_ +#include + #include extern int virtio_logtype_init; @@ -14,20 +16,6 @@ extern int virtio_logtype_init; #define PMD_INIT_FUNC_TRACE() PMD_INIT_LOG(DEBUG, " >>") -#ifdef RTE_LIBRTE_VIRTIO_DEBUG_RX -#define PMD_RX_LOG(level, ...) \ - RTE_LOG_LINE_PREFIX(level, VIRTIO_DRIVER, "%s() rx: ", __func__, __VA_ARGS__) -#else -#define PMD_RX_LOG(...) do { } while(0) -#endif - -#ifdef RTE_LIBRTE_VIRTIO_DEBUG_TX -#define PMD_TX_LOG(level, ...) \ - RTE_LOG_LINE_PREFIX(level, VIRTIO_DRIVER, "%s() tx: ", __func__, __VA_ARGS__) -#else -#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, ...) \ diff --git a/drivers/crypto/virtio/meson.build b/drivers/crypto/virtio/meson.build index d2c3b3ad07..6c082a3112 100644 --- a/drivers/crypto/virtio/meson.build +++ b/drivers/crypto/virtio/meson.build @@ -8,6 +8,7 @@ if is_windows endif includes += include_directories('../../../lib/vhost') +includes += include_directories('../../common/virtio') deps += 'bus_pci' sources = files( 'virtio_cryptodev.c', diff --git a/drivers/crypto/virtio/virtio_logs.h b/drivers/crypto/virtio/virtio_crypto_logs.h similarity index 74% rename from drivers/crypto/virtio/virtio_logs.h rename to drivers/crypto/virtio/virtio_crypto_logs.h index 988514919f..56caa162d4 100644 --- a/drivers/crypto/virtio/virtio_logs.h +++ b/drivers/crypto/virtio/virtio_crypto_logs.h @@ -2,24 +2,18 @@ * Copyright(c) 2018 HUAWEI TECHNOLOGIES CO., LTD. */ -#ifndef _VIRTIO_LOGS_H_ -#define _VIRTIO_LOGS_H_ +#ifndef _VIRTIO_CRYPTO_LOGS_H_ +#define _VIRTIO_CRYPTO_LOGS_H_ #include -extern int virtio_crypto_logtype_init; -#define RTE_LOGTYPE_VIRTIO_CRYPTO_INIT virtio_crypto_logtype_init +#include "virtio_logs.h" -#define PMD_INIT_LOG(level, ...) \ - RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_INIT, "%s(): ", __func__, __VA_ARGS__) +extern int virtio_logtype_init; -#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, ...) \ - RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_INIT, "%s(): ", __func__, __VA_ARGS__) +#define VIRTIO_CRYPTO_INIT_LOG_IMPL(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, virtio_logtype_init, \ + "INIT: %s(): " fmt "\n", __func__, ##args) #define VIRTIO_CRYPTO_INIT_LOG_INFO(fmt, ...) \ VIRTIO_CRYPTO_INIT_LOG_IMPL(INFO, fmt, ## __VA_ARGS__) @@ -75,11 +69,11 @@ extern int virtio_crypto_logtype_tx; #define VIRTIO_CRYPTO_TX_LOG_ERR(fmt, ...) \ VIRTIO_CRYPTO_TX_LOG_IMPL(ERR, fmt, ## __VA_ARGS__) -extern int virtio_crypto_logtype_driver; -#define RTE_LOGTYPE_VIRTIO_CRYPTO_DRIVER virtio_crypto_logtype_driver +extern int virtio_logtype_driver; -#define VIRTIO_CRYPTO_DRV_LOG_IMPL(level, ...) \ - RTE_LOG_LINE_PREFIX(level, VIRTIO_CRYPTO_DRIVER, "%s(): ", __func__, __VA_ARGS__) +#define VIRTIO_CRYPTO_DRV_LOG_IMPL(level, fmt, args...) \ + rte_log(RTE_LOG_ ## level, virtio_logtype_driver, \ + "DRIVER: %s(): " fmt "\n", __func__, ##args) #define VIRTIO_CRYPTO_DRV_LOG_INFO(fmt, ...) \ VIRTIO_CRYPTO_DRV_LOG_IMPL(INFO, fmt, ## __VA_ARGS__) @@ -90,4 +84,4 @@ extern int virtio_crypto_logtype_driver; #define VIRTIO_CRYPTO_DRV_LOG_ERR(fmt, ...) \ VIRTIO_CRYPTO_DRV_LOG_IMPL(ERR, fmt, ## __VA_ARGS__) -#endif /* _VIRTIO_LOGS_H_ */ +#endif /* _VIRTIO_CRYPTO_LOGS_H_ */ diff --git a/drivers/crypto/virtio/virtio_cryptodev.c b/drivers/crypto/virtio/virtio_cryptodev.c index d3db4f898e..b31e7ea0cf 100644 --- a/drivers/crypto/virtio/virtio_cryptodev.c +++ b/drivers/crypto/virtio/virtio_cryptodev.c @@ -1749,8 +1749,8 @@ RTE_PMD_REGISTER_PCI(CRYPTODEV_NAME_VIRTIO_PMD, rte_virtio_crypto_driver); RTE_PMD_REGISTER_CRYPTO_DRIVER(virtio_crypto_drv, rte_virtio_crypto_driver.driver, cryptodev_virtio_driver_id); -RTE_LOG_REGISTER_SUFFIX(virtio_crypto_logtype_init, init, NOTICE); +RTE_LOG_REGISTER_SUFFIX(virtio_logtype_init, init, NOTICE); RTE_LOG_REGISTER_SUFFIX(virtio_crypto_logtype_session, session, NOTICE); RTE_LOG_REGISTER_SUFFIX(virtio_crypto_logtype_rx, rx, NOTICE); RTE_LOG_REGISTER_SUFFIX(virtio_crypto_logtype_tx, tx, NOTICE); -RTE_LOG_REGISTER_SUFFIX(virtio_crypto_logtype_driver, driver, NOTICE); +RTE_LOG_REGISTER_SUFFIX(virtio_logtype_driver, driver, NOTICE); diff --git a/drivers/crypto/virtio/virtqueue.h b/drivers/crypto/virtio/virtqueue.h index b31342940e..ccf45800c0 100644 --- a/drivers/crypto/virtio/virtqueue.h +++ b/drivers/crypto/virtio/virtqueue.h @@ -15,7 +15,7 @@ #include "virtio_cvq.h" #include "virtio_pci.h" #include "virtio_ring.h" -#include "virtio_logs.h" +#include "virtio_crypto_logs.h" #include "virtio_crypto.h" #include "virtio_rxtx.h" diff --git a/drivers/net/virtio/meson.build b/drivers/net/virtio/meson.build index 02742da5c2..6331366712 100644 --- a/drivers/net/virtio/meson.build +++ b/drivers/net/virtio/meson.build @@ -22,6 +22,7 @@ sources += files( 'virtqueue.c', ) deps += ['kvargs', 'bus_pci'] +includes += include_directories('../../common/virtio') if arch_subdir == 'x86' if cc_has_avx512 @@ -56,5 +57,5 @@ if is_linux 'virtio_user/vhost_user.c', 'virtio_user/vhost_vdpa.c', 'virtio_user/virtio_user_dev.c') - deps += ['bus_vdev'] + deps += ['bus_vdev', 'common_virtio'] endif diff --git a/drivers/net/virtio/virtio.c b/drivers/net/virtio/virtio.c index d9e642f412..21b0490fe7 100644 --- a/drivers/net/virtio/virtio.c +++ b/drivers/net/virtio/virtio.c @@ -5,8 +5,9 @@ #include +#include "virtio_net_logs.h" + #include "virtio.h" -#include "virtio_logs.h" uint64_t virtio_negotiate_features(struct virtio_hw *hw, uint64_t host_features) diff --git a/drivers/net/virtio/virtio_ethdev.c b/drivers/net/virtio/virtio_ethdev.c index 70d4839def..491b75ec19 100644 --- a/drivers/net/virtio/virtio_ethdev.c +++ b/drivers/net/virtio/virtio_ethdev.c @@ -29,9 +29,10 @@ #include #include +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" #include "virtio.h" -#include "virtio_logs.h" #include "virtqueue.h" #include "virtio_cvq.h" #include "virtio_rxtx.h" diff --git a/drivers/net/virtio/virtio_net_logs.h b/drivers/net/virtio/virtio_net_logs.h new file mode 100644 index 0000000000..bd5867b1fe --- /dev/null +++ b/drivers/net/virtio/virtio_net_logs.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: BSD-3-Clause + * Copyright(c) 2010-2014 Intel Corporation + */ + +#ifndef _VIRTIO_NET_LOGS_H_ +#define _VIRTIO_NET_LOGS_H_ + +#include + +#include + +#include "virtio_logs.h" + +#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) +#else +#define PMD_RX_LOG(level, fmt, args...) 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) +#else +#define PMD_TX_LOG(level, fmt, args...) do { } while (0) +#endif + +#endif /* _VIRTIO_NET_LOGS_H_ */ diff --git a/drivers/net/virtio/virtio_pci.c b/drivers/net/virtio/virtio_pci.c index 90bbb53502..ca0ccdebd8 100644 --- a/drivers/net/virtio/virtio_pci.c +++ b/drivers/net/virtio/virtio_pci.c @@ -11,8 +11,9 @@ #include #include +#include "virtio_net_logs.h" + #include "virtio_pci.h" -#include "virtio_logs.h" #include "virtqueue.h" /* diff --git a/drivers/net/virtio/virtio_pci_ethdev.c b/drivers/net/virtio/virtio_pci_ethdev.c index 9b4b846f8a..8aa9d48807 100644 --- a/drivers/net/virtio/virtio_pci_ethdev.c +++ b/drivers/net/virtio/virtio_pci_ethdev.c @@ -19,10 +19,11 @@ #include #include +#include "virtio_net_logs.h" + #include "virtio.h" #include "virtio_ethdev.h" #include "virtio_pci.h" -#include "virtio_logs.h" /* * The set of PCI devices this driver supports diff --git a/drivers/net/virtio/virtio_rxtx.c b/drivers/net/virtio/virtio_rxtx.c index b67f063b31..f645d70202 100644 --- a/drivers/net/virtio/virtio_rxtx.c +++ b/drivers/net/virtio/virtio_rxtx.c @@ -26,7 +26,8 @@ #include #include -#include "virtio_logs.h" +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" #include "virtio.h" #include "virtqueue.h" diff --git a/drivers/net/virtio/virtio_rxtx_packed.c b/drivers/net/virtio/virtio_rxtx_packed.c index 5f7d4903bc..6eed0d7872 100644 --- a/drivers/net/virtio/virtio_rxtx_packed.c +++ b/drivers/net/virtio/virtio_rxtx_packed.c @@ -10,7 +10,8 @@ #include -#include "virtio_logs.h" +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" #include "virtio_pci.h" #include "virtio_rxtx_packed.h" diff --git a/drivers/net/virtio/virtio_rxtx_packed.h b/drivers/net/virtio/virtio_rxtx_packed.h index 536112983c..d6f530ec10 100644 --- a/drivers/net/virtio/virtio_rxtx_packed.h +++ b/drivers/net/virtio/virtio_rxtx_packed.h @@ -13,7 +13,8 @@ #include -#include "virtio_logs.h" +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" #include "virtio.h" #include "virtqueue.h" diff --git a/drivers/net/virtio/virtio_rxtx_packed_avx.h b/drivers/net/virtio/virtio_rxtx_packed_avx.h index 584ac72f95..de8f2b2ba8 100644 --- a/drivers/net/virtio/virtio_rxtx_packed_avx.h +++ b/drivers/net/virtio/virtio_rxtx_packed_avx.h @@ -10,7 +10,8 @@ #include -#include "virtio_logs.h" +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" #include "virtio.h" #include "virtio_rxtx_packed.h" diff --git a/drivers/net/virtio/virtio_rxtx_simple.h b/drivers/net/virtio/virtio_rxtx_simple.h index 79196ed86e..d32af60337 100644 --- a/drivers/net/virtio/virtio_rxtx_simple.h +++ b/drivers/net/virtio/virtio_rxtx_simple.h @@ -7,7 +7,8 @@ #include -#include "virtio_logs.h" +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" #include "virtqueue.h" #include "virtio_rxtx.h" diff --git a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c index 611e2e25ec..c2d925bbe2 100644 --- a/drivers/net/virtio/virtio_user/vhost_kernel_tap.c +++ b/drivers/net/virtio/virtio_user/vhost_kernel_tap.c @@ -14,8 +14,9 @@ #include +#include "virtio_net_logs.h" + #include "vhost_kernel_tap.h" -#include "../virtio_logs.h" #include "../virtio.h" diff --git a/drivers/net/virtio/virtio_user/vhost_vdpa.c b/drivers/net/virtio/virtio_user/vhost_vdpa.c index bc3e2a9af5..77e2fd62d8 100644 --- a/drivers/net/virtio/virtio_user/vhost_vdpa.c +++ b/drivers/net/virtio/virtio_user/vhost_vdpa.c @@ -12,8 +12,7 @@ #include -#include "vhost.h" -#include "virtio_user_dev.h" +#include "../virtio_net_logs.h" struct vhost_vdpa_data { int vhostfd; diff --git a/drivers/net/virtio/virtio_user_ethdev.c b/drivers/net/virtio/virtio_user_ethdev.c index 747dddeb2e..fda6634c94 100644 --- a/drivers/net/virtio/virtio_user_ethdev.c +++ b/drivers/net/virtio/virtio_user_ethdev.c @@ -20,8 +20,9 @@ #include #include +#include "virtio_net_logs.h" + #include "virtio_ethdev.h" -#include "virtio_logs.h" #include "virtio.h" #include "virtqueue.h" #include "virtio_rxtx.h" diff --git a/drivers/net/virtio/virtqueue.c b/drivers/net/virtio/virtqueue.c index cf46abfd06..95cf2fdafc 100644 --- a/drivers/net/virtio/virtqueue.c +++ b/drivers/net/virtio/virtqueue.c @@ -9,8 +9,9 @@ #include #include +#include "virtio_net_logs.h" + #include "virtqueue.h" -#include "virtio_logs.h" #include "virtio.h" #include "virtio_rxtx_simple.h" diff --git a/drivers/net/virtio/virtqueue.h b/drivers/net/virtio/virtqueue.h index 60211a40c9..13503edc21 100644 --- a/drivers/net/virtio/virtqueue.h +++ b/drivers/net/virtio/virtqueue.h @@ -12,9 +12,10 @@ #include #include +#include "virtio_net_logs.h" + #include "virtio.h" #include "virtio_ring.h" -#include "virtio_logs.h" #include "virtio_rxtx.h" #include "virtio_cvq.h" -- 2.25.1