From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from dpdk.org (dpdk.org [92.243.14.124]) by inbox.dpdk.org (Postfix) with ESMTP id E61FDA0350; Wed, 1 Jul 2020 05:59:45 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 54B101BF70; Wed, 1 Jul 2020 05:59:30 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id C72991BF7F for ; Wed, 1 Jul 2020 05:59:28 +0200 (CEST) Received: from pps.filterd (m0045851.ppops.net [127.0.0.1]) by mx0b-0016f401.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 0613uemI018511; Tue, 30 Jun 2020 20:59:28 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=CEy8dfwhyxJeMxPHmlzMy1ClBAnLAFkRkqtcm+aqWnQ=; b=yBDs3ZOoTPzsx6siKwG4SGOmkSoZPnc1snNuiJsMIPUSjXYfKXpw2KDXLoREQArvtT9J KJbgTXAkp4HBzhtupTkMWsfcek+TqseJ/aod/M4rUz3jOcYQ5cJhAaF95M2K0dFtNZZf v4qcyhks51xMzEc5KsWCu9xi85cSVpk53KOInLDDOnmjs1fV1Fqpwii+wf+1NB2Mdrvi aIao0zp7UNUhQnJ8C/8W63ED1GqoGYQ5f5fv5CwGB+PqWCuZ2gKrq8ZS/0sNr2Z/RUh6 KwoTT9HfXbdkpCg+POOXSO5p7vsqOBn7YIF+Sgx5BDh+XApqcE5pa1+D6AU3gq3LEr2s bA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 31x5mnps1p-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Tue, 30 Jun 2020 20:59:27 -0700 Received: from DC5-EXCH02.marvell.com (10.69.176.39) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Tue, 30 Jun 2020 20:59:26 -0700 Received: from maili.marvell.com (10.69.176.80) by DC5-EXCH02.marvell.com (10.69.176.39) with Microsoft SMTP Server id 15.0.1497.2 via Frontend Transport; Tue, 30 Jun 2020 20:59:26 -0700 Received: from jerin-lab.marvell.com (jerin-lab.marvell.com [10.28.34.14]) by maili.marvell.com (Postfix) with ESMTP id 429613F703F; Tue, 30 Jun 2020 20:59:22 -0700 (PDT) From: To: , Nipun Gupta , Rosen Xu , Tianfei zhang , "Bruce Richardson" , Xiaoyun Li , Jingjing Wu , Hemant Agrawal CC: , , , , , Jerin Jacob Date: Wed, 1 Jul 2020 09:28:31 +0530 Message-ID: <20200701035840.4028056-5-jerinj@marvell.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200701035840.4028056-1-jerinj@marvell.com> References: <20200617063047.1555518-1-jerinj@marvell.com> <20200701035840.4028056-1-jerinj@marvell.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235, 18.0.687 definitions=2020-07-01_01:2020-07-01, 2020-06-30 signatures=0 Subject: [dpdk-dev] [PATCH v2 04/13] drivers/raw: use log register macro X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" From: Jerin Jacob Use log register macro to avoid the code duplication in the log registration process. Signed-off-by: Jerin Jacob Acked-by: Adam Dybkowski --- drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c | 11 +---------- drivers/raw/dpaa2_qdma/dpaa2_qdma.c | 11 +---------- drivers/raw/ifpga/ifpga_rawdev.c | 10 +--------- drivers/raw/ioat/ioat_rawdev.c | 12 ++---------- drivers/raw/ioat/rte_ioat_rawdev.h | 2 -- drivers/raw/ntb/ntb.c | 10 +--------- drivers/raw/skeleton/skeleton_rawdev.c | 11 +---------- 7 files changed, 7 insertions(+), 60 deletions(-) diff --git a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c index 7c21c6a52..c7bddbc6c 100644 --- a/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c +++ b/drivers/raw/dpaa2_cmdif/dpaa2_cmdif.c @@ -20,9 +20,6 @@ #include "dpaa2_cmdif_logs.h" #include "rte_pmd_dpaa2_cmdif.h" -/* Dynamic log type identifier */ -int dpaa2_cmdif_logtype; - /* CMDIF driver name */ #define DPAA2_CMDIF_PMD_NAME dpaa2_dpci @@ -291,10 +288,4 @@ static struct rte_vdev_driver dpaa2_cmdif_drv = { }; RTE_PMD_REGISTER_VDEV(DPAA2_CMDIF_PMD_NAME, dpaa2_cmdif_drv); - -RTE_INIT(dpaa2_cmdif_init_log) -{ - dpaa2_cmdif_logtype = rte_log_register("pmd.raw.dpaa2.cmdif"); - if (dpaa2_cmdif_logtype >= 0) - rte_log_set_level(dpaa2_cmdif_logtype, RTE_LOG_INFO); -} +RTE_LOG_REGISTER(dpaa2_cmdif_logtype, pmd.raw.dpaa2.cmdif, INFO); diff --git a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c index 1be1b6ddf..0b9c4e3d7 100644 --- a/drivers/raw/dpaa2_qdma/dpaa2_qdma.c +++ b/drivers/raw/dpaa2_qdma/dpaa2_qdma.c @@ -26,9 +26,6 @@ #define DPAA2_QDMA_NO_PREFETCH "no_prefetch" -/* Dynamic log type identifier */ -int dpaa2_qdma_logtype; - uint32_t dpaa2_coherent_no_alloc_cache; uint32_t dpaa2_coherent_alloc_cache; @@ -1495,10 +1492,4 @@ static struct rte_dpaa2_driver rte_dpaa2_qdma_pmd = { RTE_PMD_REGISTER_DPAA2(dpaa2_qdma, rte_dpaa2_qdma_pmd); RTE_PMD_REGISTER_PARAM_STRING(dpaa2_qdma, "no_prefetch= "); - -RTE_INIT(dpaa2_qdma_init_log) -{ - dpaa2_qdma_logtype = rte_log_register("pmd.raw.dpaa2.qdma"); - if (dpaa2_qdma_logtype >= 0) - rte_log_set_level(dpaa2_qdma_logtype, RTE_LOG_INFO); -} +RTE_LOG_REGISTER(dpaa2_qdma_logtype, pmd.raw.dpaa2.qdma, INFO); diff --git a/drivers/raw/ifpga/ifpga_rawdev.c b/drivers/raw/ifpga/ifpga_rawdev.c index b8701e155..cc25c662b 100644 --- a/drivers/raw/ifpga/ifpga_rawdev.c +++ b/drivers/raw/ifpga/ifpga_rawdev.c @@ -47,8 +47,6 @@ #define RTE_PCI_EXT_CAP_ID(header) (int)(header & 0x0000ffff) #define RTE_PCI_EXT_CAP_NEXT(header) ((header >> 20) & 0xffc) -int ifpga_rawdev_logtype; - #define PCI_VENDOR_ID_INTEL 0x8086 /* PCI Device ID */ #define PCIE_DEVICE_ID_PF_INT_5_X 0xBCBD @@ -1597,13 +1595,7 @@ static struct rte_pci_driver rte_ifpga_rawdev_pmd = { RTE_PMD_REGISTER_PCI(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd); RTE_PMD_REGISTER_PCI_TABLE(ifpga_rawdev_pci_driver, rte_ifpga_rawdev_pmd); RTE_PMD_REGISTER_KMOD_DEP(ifpga_rawdev_pci_driver, "* igb_uio | uio_pci_generic | vfio-pci"); - -RTE_INIT(ifpga_rawdev_init_log) -{ - ifpga_rawdev_logtype = rte_log_register("driver.raw.init"); - if (ifpga_rawdev_logtype >= 0) - rte_log_set_level(ifpga_rawdev_logtype, RTE_LOG_NOTICE); -} +RTE_LOG_REGISTER(ifpga_rawdev_logtype, driver.raw.init, NOTICE); static const char * const valid_args[] = { #define IFPGA_ARG_NAME "ifpga" diff --git a/drivers/raw/ioat/ioat_rawdev.c b/drivers/raw/ioat/ioat_rawdev.c index a8a48f90a..30d9f597e 100644 --- a/drivers/raw/ioat/ioat_rawdev.c +++ b/drivers/raw/ioat/ioat_rawdev.c @@ -9,9 +9,6 @@ #include "rte_ioat_rawdev.h" -/* Dynamic log type identifier */ -int ioat_pmd_logtype; - static struct rte_pci_driver ioat_pmd_drv; #define IOAT_VENDOR_ID 0x8086 @@ -28,6 +25,8 @@ static struct rte_pci_driver ioat_pmd_drv; #define IOAT_DEVICE_ID_BDXF 0x6f2F #define IOAT_DEVICE_ID_ICX 0x0b00 +RTE_LOG_REGISTER(ioat_pmd_logtype, rawdev.ioat, INFO); + #define IOAT_PMD_LOG(level, fmt, args...) rte_log(RTE_LOG_ ## level, \ ioat_pmd_logtype, "%s(): " fmt "\n", __func__, ##args) @@ -386,10 +385,3 @@ static struct rte_pci_driver ioat_pmd_drv = { RTE_PMD_REGISTER_PCI(IOAT_PMD_RAWDEV_NAME, ioat_pmd_drv); RTE_PMD_REGISTER_PCI_TABLE(IOAT_PMD_RAWDEV_NAME, pci_id_ioat_map); RTE_PMD_REGISTER_KMOD_DEP(IOAT_PMD_RAWDEV_NAME, "* igb_uio | uio_pci_generic"); - -RTE_INIT(ioat_pmd_init_log) -{ - ioat_pmd_logtype = rte_log_register(IOAT_PMD_LOG_NAME); - if (ioat_pmd_logtype >= 0) - rte_log_set_level(ioat_pmd_logtype, RTE_LOG_INFO); -} diff --git a/drivers/raw/ioat/rte_ioat_rawdev.h b/drivers/raw/ioat/rte_ioat_rawdev.h index 4b271f174..f765a6557 100644 --- a/drivers/raw/ioat/rte_ioat_rawdev.h +++ b/drivers/raw/ioat/rte_ioat_rawdev.h @@ -25,8 +25,6 @@ #define IOAT_PMD_RAWDEV_NAME rawdev_ioat /** String reported as the device driver name by rte_rawdev_info_get() */ #define IOAT_PMD_RAWDEV_NAME_STR "rawdev_ioat" -/** Name used to adjust the log level for this driver */ -#define IOAT_PMD_LOG_NAME "rawdev.ioat" /** * Configuration structure for an ioat rawdev instance diff --git a/drivers/raw/ntb/ntb.c b/drivers/raw/ntb/ntb.c index dd0b72f8c..e40412bb7 100644 --- a/drivers/raw/ntb/ntb.c +++ b/drivers/raw/ntb/ntb.c @@ -23,8 +23,6 @@ #include "rte_pmd_ntb.h" #include "ntb.h" -int ntb_logtype; - static const struct rte_pci_id pci_id_ntb_map[] = { { RTE_PCI_DEVICE(NTB_INTEL_VENDOR_ID, NTB_INTEL_DEV_ID_B2B_SKX) }, { .vendor_id = 0, /* sentinel */ }, @@ -1504,10 +1502,4 @@ static struct rte_pci_driver rte_ntb_pmd = { RTE_PMD_REGISTER_PCI(raw_ntb, rte_ntb_pmd); RTE_PMD_REGISTER_PCI_TABLE(raw_ntb, pci_id_ntb_map); RTE_PMD_REGISTER_KMOD_DEP(raw_ntb, "* igb_uio | uio_pci_generic | vfio-pci"); - -RTE_INIT(ntb_init_log) -{ - ntb_logtype = rte_log_register("pmd.raw.ntb"); - if (ntb_logtype >= 0) - rte_log_set_level(ntb_logtype, RTE_LOG_INFO); -} +RTE_LOG_REGISTER(ntb_logtype, pmd.raw.ntb, INFO); diff --git a/drivers/raw/skeleton/skeleton_rawdev.c b/drivers/raw/skeleton/skeleton_rawdev.c index 586183a5b..72ece887a 100644 --- a/drivers/raw/skeleton/skeleton_rawdev.c +++ b/drivers/raw/skeleton/skeleton_rawdev.c @@ -28,9 +28,6 @@ #include "skeleton_rawdev.h" -/* Dynamic log type identifier */ -int skeleton_pmd_logtype; - /* Count of instances */ static uint16_t skeldev_init_once; @@ -759,10 +756,4 @@ static struct rte_vdev_driver skeleton_pmd_drv = { }; RTE_PMD_REGISTER_VDEV(SKELETON_PMD_RAWDEV_NAME, skeleton_pmd_drv); - -RTE_INIT(skeleton_pmd_init_log) -{ - skeleton_pmd_logtype = rte_log_register("rawdev.skeleton"); - if (skeleton_pmd_logtype >= 0) - rte_log_set_level(skeleton_pmd_logtype, RTE_LOG_INFO); -} +RTE_LOG_REGISTER(skeleton_pmd_logtype, rawdev.skeleton, INFO); -- 2.27.0