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 335DCA2E8C for ; Thu, 5 Sep 2019 16:54:27 +0200 (CEST) Received: from [92.243.14.124] (localhost [127.0.0.1]) by dpdk.org (Postfix) with ESMTP id A09C01F015; Thu, 5 Sep 2019 16:53:38 +0200 (CEST) Received: from mga17.intel.com (mga17.intel.com [192.55.52.151]) by dpdk.org (Postfix) with ESMTP id E10441EFBD; Thu, 5 Sep 2019 16:53:28 +0200 (CEST) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga008.fm.intel.com ([10.253.24.58]) by fmsmga107.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2019 07:53:28 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,470,1559545200"; d="scan'208";a="182846370" Received: from silpixa00399752.ir.intel.com (HELO silpixa00399752.ger.corp.intel.com) ([10.237.223.78]) by fmsmga008.fm.intel.com with ESMTP; 05 Sep 2019 07:53:27 -0700 From: Ferruh Yigit To: Jay Zhou Cc: dev@dpdk.org, stable@dpdk.org, Maxime Coquelin Date: Thu, 5 Sep 2019 15:53:11 +0100 Message-Id: <20190905145315.19395-7-ferruh.yigit@intel.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905145315.19395-1-ferruh.yigit@intel.com> References: <20190905145315.19395-1-ferruh.yigit@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [dpdk-dev] [PATCH 06/10] crypto/virtio: 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" 'virtio_hw_internal' global variable is defined in both 'crypto/virtio' and 'net/virtio' PMDs. This means they share same storage when application linked with static DPDK library, which is not the intention. Fixing by adding 'crypto_' prefix to the 'crypto/virtio' driver. Issue has been detected by '-fno-common' gcc flag. Fixes: 25500d4b8076 ("crypto/virtio: support device init") Cc: stable@dpdk.org Signed-off-by: Ferruh Yigit --- Cc: Maxime Coquelin --- drivers/crypto/virtio/virtio_pci.c | 4 ++-- drivers/crypto/virtio/virtio_pci.h | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/crypto/virtio/virtio_pci.c b/drivers/crypto/virtio/virtio_pci.c index 8137b3c5a..f490f6e28 100644 --- a/drivers/crypto/virtio/virtio_pci.c +++ b/drivers/crypto/virtio/virtio_pci.c @@ -31,7 +31,7 @@ #define VIRTIO_PCI_CONFIG(hw) \ (((hw)->use_msix == VIRTIO_MSIX_ENABLED) ? 24 : 20) -struct virtio_hw_internal virtio_hw_internal[RTE_MAX_VIRTIO_CRYPTO]; +struct virtio_hw_internal crypto_virtio_hw_internal[RTE_MAX_VIRTIO_CRYPTO]; static inline int check_vq_phys_addr_ok(struct virtqueue *vq) @@ -452,7 +452,7 @@ vtpci_cryptodev_init(struct rte_pci_device *dev, struct virtio_crypto_hw *hw) */ if (virtio_read_caps(dev, hw) == 0) { VIRTIO_CRYPTO_INIT_LOG_INFO("modern virtio pci detected."); - virtio_hw_internal[hw->dev_id].vtpci_ops = + crypto_virtio_hw_internal[hw->dev_id].vtpci_ops = &virtio_crypto_modern_ops; hw->modern = 1; return 0; diff --git a/drivers/crypto/virtio/virtio_pci.h b/drivers/crypto/virtio/virtio_pci.h index 604ec3662..d9a214dfd 100644 --- a/drivers/crypto/virtio/virtio_pci.h +++ b/drivers/crypto/virtio/virtio_pci.h @@ -201,10 +201,10 @@ struct virtio_hw_internal { struct rte_pci_ioport io; }; -#define VTPCI_OPS(hw) (virtio_hw_internal[(hw)->dev_id].vtpci_ops) -#define VTPCI_IO(hw) (&virtio_hw_internal[(hw)->dev_id].io) +#define VTPCI_OPS(hw) (crypto_virtio_hw_internal[(hw)->dev_id].vtpci_ops) +#define VTPCI_IO(hw) (&crypto_virtio_hw_internal[(hw)->dev_id].io) -extern struct virtio_hw_internal virtio_hw_internal[RTE_MAX_VIRTIO_CRYPTO]; +extern struct virtio_hw_internal crypto_virtio_hw_internal[RTE_MAX_VIRTIO_CRYPTO]; /* * How many bits to shift physical queue address written to QUEUE_PFN. -- 2.21.0