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 E7661A2F67 for ; Fri, 4 Oct 2019 11:44:52 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id 23FD61C1EC; Fri, 4 Oct 2019 11:44:52 +0200 (CEST) Received: from mx0b-0016f401.pphosted.com (mx0b-0016f401.pphosted.com [67.231.156.173]) by dpdk.org (Postfix) with ESMTP id EBBE21C1D4; Fri, 4 Oct 2019 11:44:49 +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 x949f5eh006593; Fri, 4 Oct 2019 02:44:49 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=marvell.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding : content-type; s=pfpt0818; bh=Vla/TZV+eK3vXmuiSQYQ3m9rlm2/S6KetXOClT9s7dk=; b=IRHMVrtG+Zqn5PjZhm2wsj3V6abtbAQA5DLrOgrJYKTsVoNSQ5uXGQUVpKw0aE/vZr09 CUiV0ZqlbkAj0srEQyrNpz+oAsowyN335KrAj5Rh33gSYPLgScq8+fMcrh+fk6TyGlGY oCq6T6qG/M787052/1vCAT0upMJkPtFF29XKh4m+W63iwaDZo5pBFdSiHkPSDIj7bA+6 p3mb8VTUarQoore5nRNzOeET407ohdVb9OXuVe22Np10enggH0+fKD/AjKXkBrh2Bqie FZOjcaXbFWLFQETBEcvYUw/LYFS7a25M9kdsvqQjU9CsP4p+denbneuyOSFvLExJRKN8 QA== Received: from sc-exch01.marvell.com ([199.233.58.181]) by mx0b-0016f401.pphosted.com with ESMTP id 2vd0ya7ffn-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-SHA384 bits=256 verify=NOT); Fri, 04 Oct 2019 02:44:49 -0700 Received: from SC-EXCH03.marvell.com (10.93.176.83) by SC-EXCH01.marvell.com (10.93.176.81) with Microsoft SMTP Server (TLS) id 15.0.1367.3; Fri, 4 Oct 2019 02:44:47 -0700 Received: from maili.marvell.com (10.93.176.43) by SC-EXCH03.marvell.com (10.93.176.83) with Microsoft SMTP Server id 15.0.1367.3 via Frontend Transport; Fri, 4 Oct 2019 02:44:47 -0700 Received: from ajoseph83.caveonetworks.com.com (unknown [10.29.45.60]) by maili.marvell.com (Postfix) with ESMTP id 4B3D03F7040; Fri, 4 Oct 2019 02:44:44 -0700 (PDT) From: Anoob Joseph To: Akhil Goyal , Pablo de Lara CC: Anoob Joseph , Jerin Jacob , Narayana Prasad , Ankur Dwivedi , , Date: Fri, 4 Oct 2019 15:14:35 +0530 Message-ID: <1570182275-361-1-git-send-email-anoobj@marvell.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.95,1.0.8 definitions=2019-10-04_05:2019-10-03,2019-10-04 signatures=0 Subject: [dpdk-dev] [PATCH] crypto/octeontx: fix global variable multiple definitions 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" 'cpt_logtype' & 'otx_cryptodev_driver_id' global variables are defined in a header file which was causing multiple definitions of the variables. Fixed it by moving the required vars to the .c file and introducing a new macro so the CPT_LOG macros in common/cpt would use the associated PMD log var. Issue has been detected by '-fno-common' gcc flag. Fixes: bfe2ae495ee2 ("crypto/octeontx: add PMD skeleton") Cc: stable@dpdk.org Signed-off-by: Anoob Joseph Reported-by: Ferruh Yigit --- drivers/common/cpt/cpt_pmd_logs.h | 12 +++++------- drivers/crypto/octeontx/otx_cryptodev.c | 23 +++++++---------------- drivers/crypto/octeontx/otx_cryptodev.h | 6 +++++- drivers/crypto/octeontx/otx_cryptodev_hw_access.h | 2 ++ drivers/crypto/octeontx/otx_cryptodev_ops.c | 6 +++--- 5 files changed, 22 insertions(+), 27 deletions(-) diff --git a/drivers/common/cpt/cpt_pmd_logs.h b/drivers/common/cpt/cpt_pmd_logs.h index 4cbec4e..174326c 100644 --- a/drivers/common/cpt/cpt_pmd_logs.h +++ b/drivers/common/cpt/cpt_pmd_logs.h @@ -11,8 +11,12 @@ * This file defines log macros */ +/* + * otx*_cryptodev.h file would define the CPT_LOGTYPE macro for the + * platform. + */ #define CPT_PMD_DRV_LOG_RAW(level, fmt, args...) \ - rte_log(RTE_LOG_ ## level, cpt_logtype, \ + rte_log(RTE_LOG_ ## level, CPT_LOGTYPE, \ "cpt: %s(): " fmt "\n", __func__, ##args) #define CPT_PMD_INIT_FUNC_TRACE() CPT_PMD_DRV_LOG_RAW(DEBUG, " >>") @@ -41,10 +45,4 @@ #define CPT_LOG_DP_ERR(fmt, args...) \ CPT_LOG_DP(ERR, fmt, ## args) -/* - * cpt_logtype will be used for common logging. This field would be initialized - * by otx_* driver routines during PCI probe. - */ -int cpt_logtype; - #endif /* _CPT_PMD_LOGS_H_ */ diff --git a/drivers/crypto/octeontx/otx_cryptodev.c b/drivers/crypto/octeontx/otx_cryptodev.c index 8df4b71..ddece13 100644 --- a/drivers/crypto/octeontx/otx_cryptodev.c +++ b/drivers/crypto/octeontx/otx_cryptodev.c @@ -9,13 +9,13 @@ #include #include -/* CPT common headers */ -#include "cpt_pmd_logs.h" - #include "otx_cryptodev.h" #include "otx_cryptodev_ops.h" -static int otx_cryptodev_logtype; +#include "cpt_pmd_logs.h" + +uint8_t otx_cryptodev_driver_id; +int otx_cpt_logtype; static struct rte_pci_id pci_id_cpt_table[] = { { @@ -27,12 +27,6 @@ static struct rte_pci_id pci_id_cpt_table[] = { }, }; -static void -otx_cpt_logtype_init(void) -{ - cpt_logtype = otx_cryptodev_logtype; -} - static int otx_cpt_pci_probe(struct rte_pci_driver *pci_drv, struct rte_pci_device *pci_dev) @@ -57,9 +51,6 @@ otx_cpt_pci_probe(struct rte_pci_driver *pci_drv, /* init user callbacks */ TAILQ_INIT(&(cryptodev->link_intr_cbs)); - /* init logtype used in common */ - otx_cpt_logtype_init(); - /* Invoke PMD device initialization function */ retval = otx_cpt_dev_create(cryptodev); if (retval == 0) @@ -125,7 +116,7 @@ RTE_PMD_REGISTER_CRYPTO_DRIVER(otx_cryptodev_drv, otx_cryptodev_pmd.driver, RTE_INIT(otx_cpt_init_log) { /* Bus level logs */ - otx_cryptodev_logtype = rte_log_register("pmd.crypto.octeontx"); - if (otx_cryptodev_logtype >= 0) - rte_log_set_level(otx_cryptodev_logtype, RTE_LOG_NOTICE); + otx_cpt_logtype = rte_log_register("pmd.crypto.octeontx"); + if (otx_cpt_logtype >= 0) + rte_log_set_level(otx_cpt_logtype, RTE_LOG_NOTICE); } diff --git a/drivers/crypto/octeontx/otx_cryptodev.h b/drivers/crypto/octeontx/otx_cryptodev.h index 6c2871d..b66ef4a 100644 --- a/drivers/crypto/octeontx/otx_cryptodev.h +++ b/drivers/crypto/octeontx/otx_cryptodev.h @@ -12,9 +12,13 @@ #define PCI_VENDOR_ID_CAVIUM 0x177d #define CPT_81XX_PCI_VF_DEVICE_ID 0xa041 +#define CPT_LOGTYPE otx_cpt_logtype + +extern int otx_cpt_logtype; + /* * Crypto device driver ID */ -uint8_t otx_cryptodev_driver_id; +extern uint8_t otx_cryptodev_driver_id; #endif /* _OTX_CRYPTODEV_H_ */ diff --git a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h index 63c199e..063c636 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_hw_access.h +++ b/drivers/crypto/octeontx/otx_cryptodev_hw_access.h @@ -13,6 +13,8 @@ #include #include +#include "otx_cryptodev.h" + #include "cpt_common.h" #include "cpt_hw_types.h" #include "cpt_mcode_defines.h" diff --git a/drivers/crypto/octeontx/otx_cryptodev_ops.c b/drivers/crypto/octeontx/otx_cryptodev_ops.c index 9628ffa..118168a 100644 --- a/drivers/crypto/octeontx/otx_cryptodev_ops.c +++ b/drivers/crypto/octeontx/otx_cryptodev_ops.c @@ -10,14 +10,14 @@ #include #include -#include "cpt_pmd_logs.h" -#include "cpt_ucode.h" - #include "otx_cryptodev.h" #include "otx_cryptodev_capabilities.h" #include "otx_cryptodev_hw_access.h" #include "otx_cryptodev_ops.h" +#include "cpt_pmd_logs.h" +#include "cpt_ucode.h" + /* Forward declarations */ static int -- 2.7.4