From patchwork Tue Mar 3 15:23:46 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Thomas Monjalon X-Patchwork-Id: 3826 Return-Path: X-Original-To: patchwork@dpdk.org Delivered-To: patchwork@dpdk.org Received: from [92.243.14.124] (localhost [IPv6:::1]) by dpdk.org (Postfix) with ESMTP id F301C6942; Tue, 3 Mar 2015 16:24:35 +0100 (CET) Received: from mail-wi0-f179.google.com (mail-wi0-f179.google.com [209.85.212.179]) by dpdk.org (Postfix) with ESMTP id E7D006849 for ; Tue, 3 Mar 2015 16:24:33 +0100 (CET) Received: by wiwl15 with SMTP id l15so23583711wiw.3 for ; Tue, 03 Mar 2015 07:24:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-type:content-transfer-encoding; bh=FbJb/XIx093/tjypwcO4G06OXgpdUwILSFhYYBm40GM=; b=JM9ATwrNjMztVhrh0mkzLQH2WlkDQUlX2TgsQ3hjc0fudXdW8Pm3s0WrcSsYGrDyIx u9asSwYnxhVxlOT63kTLXGG+7etbb/bkNQ6JbS8m5Da+zWPUXDikkX5cR388gP7E1o6a Ilr0oB6JbUjmMHKzC5gyG9N4ATew5pngpo3ukJuwofez8cilSm7Xr2olC81MkMIkU3t6 I1i2DjgLF/csrL7wqEAC0yMDi0qYLunJfVENzZ/Hmv8HWvIjs/xJBTIPW/AigZJjPbSB WIpyyK/9nO7jx5svYtSuVtPaiqKsaTn5f6YEdx2EErl3Nt00UdyyIdDLcLxD2Tr0g0fn LDNw== X-Gm-Message-State: ALoCoQn9gj9EwgzsyKhX+PwtyEdCGbntbIAqQ+awoPlQYwPVkTTRDIUILEF6+2flDv7BXWIbkkhe X-Received: by 10.194.61.100 with SMTP id o4mr71176459wjr.28.1425396273833; Tue, 03 Mar 2015 07:24:33 -0800 (PST) Received: from localhost.localdomain (136-92-190-109.dsl.ovh.fr. [109.190.92.136]) by mx.google.com with ESMTPSA id gf11sm2889236wic.18.2015.03.03.07.24.31 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 03 Mar 2015 07:24:33 -0800 (PST) From: Thomas Monjalon To: dev@dpdk.org Date: Tue, 3 Mar 2015 16:23:46 +0100 Message-Id: <1425396230-13379-4-git-send-email-thomas.monjalon@6wind.com> X-Mailer: git-send-email 2.2.2 In-Reply-To: <1425396230-13379-1-git-send-email-thomas.monjalon@6wind.com> References: <1425396230-13379-1-git-send-email-thomas.monjalon@6wind.com> MIME-Version: 1.0 Subject: [dpdk-dev] [PATCH 3/7] virtio: fix build with mempool debug enabled X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dev-bounces@dpdk.org Sender: "dev" The mempool header forces error on -Wcast-qual: error: cast discards ‘const’ qualifier from pointer target type Let's fix it by removing const qualifier of pci driver from commit 5e9f6d1340ff ("pci: reference driver structure for each device") It's needed because the driver flags are changed depending on using uio or not. Actually these driver flags should be directly attached to each device. Fixes: da978dfdc43b ("virtio: use port IO to get PCI resource") Signed-off-by: Thomas Monjalon Acked-by: Changchun Ouyang --- lib/librte_eal/common/include/rte_pci.h | 2 +- lib/librte_pmd_virtio/Makefile | 2 -- lib/librte_pmd_virtio/virtio_ethdev.c | 8 ++------ 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index b9cdf8b..995f814 100644 --- a/lib/librte_eal/common/include/rte_pci.h +++ b/lib/librte_eal/common/include/rte_pci.h @@ -158,7 +158,7 @@ struct rte_pci_device { struct rte_pci_id id; /**< PCI ID. */ struct rte_pci_resource mem_resource[PCI_MAX_RESOURCE]; /**< PCI Memory Resource */ struct rte_intr_handle intr_handle; /**< Interrupt handle */ - const struct rte_pci_driver *driver; /**< Associated driver */ + struct rte_pci_driver *driver; /**< Associated driver */ uint16_t max_vfs; /**< sriov enable if not zero */ int numa_node; /**< NUMA node connection */ struct rte_devargs *devargs; /**< Device user arguments */ diff --git a/lib/librte_pmd_virtio/Makefile b/lib/librte_pmd_virtio/Makefile index 0baaf46..793067f 100644 --- a/lib/librte_pmd_virtio/Makefile +++ b/lib/librte_pmd_virtio/Makefile @@ -57,6 +57,4 @@ DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_eal lib/librte_ether DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_mempool lib/librte_mbuf DEPDIRS-$(CONFIG_RTE_LIBRTE_VIRTIO_PMD) += lib/librte_net lib/librte_malloc -CFLAGS_virtio_ethdev.o += -Wno-cast-qual - include $(RTE_SDK)/mk/rte.lib.mk diff --git a/lib/librte_pmd_virtio/virtio_ethdev.c b/lib/librte_pmd_virtio/virtio_ethdev.c index 88ecd57..4bad1e4 100644 --- a/lib/librte_pmd_virtio/virtio_ethdev.c +++ b/lib/librte_pmd_virtio/virtio_ethdev.c @@ -938,8 +938,6 @@ static int virtio_resource_init_by_uio(struct rte_pci_device *pci_dev) char filename[PATH_MAX]; unsigned long start, size; unsigned int uio_num; - struct rte_pci_driver *pci_drv = - (struct rte_pci_driver *)pci_dev->driver; if (get_uio_dev(&pci_dev->addr, dirname, sizeof(dirname), &uio_num) < 0) return -1; @@ -978,7 +976,7 @@ static int virtio_resource_init_by_uio(struct rte_pci_device *pci_dev) } pci_dev->intr_handle.type = RTE_INTR_HANDLE_UIO; - pci_drv->drv_flags |= RTE_PCI_DRV_INTR_LSC; + pci_dev->driver->drv_flags |= RTE_PCI_DRV_INTR_LSC; return 0; } @@ -993,8 +991,6 @@ static int virtio_resource_init_by_ioports(struct rte_pci_device *pci_dev) char pci_id[16]; int found = 0; size_t linesz; - struct rte_pci_driver *pci_drv = - (struct rte_pci_driver *)pci_dev->driver; snprintf(pci_id, sizeof(pci_id), PCI_PRI_FMT, pci_dev->addr.domain, @@ -1046,7 +1042,7 @@ static int virtio_resource_init_by_ioports(struct rte_pci_device *pci_dev) start, size); /* can't support lsc interrupt without uio */ - pci_drv->drv_flags &= ~RTE_PCI_DRV_INTR_LSC; + pci_dev->driver->drv_flags &= ~RTE_PCI_DRV_INTR_LSC; return 0; }