From: Thomas Monjalon Date: Tue, 3 Mar 2015 14:58:37 +0000 (+0100) Subject: virtio: fix build with mempool debug enabled X-Git-Tag: spdx-start~9506 X-Git-Url: http://git.droids-corp.org/?a=commitdiff_plain;h=459132bc2c4096cdcc23b0dd7a778a51a0268570;p=dpdk.git virtio: fix build with mempool debug enabled 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 --- diff --git a/lib/librte_eal/common/include/rte_pci.h b/lib/librte_eal/common/include/rte_pci.h index b9cdf8b779..995f814a55 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 0baaf468c0..793067f7a2 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 88ecd571d0..4bad1e4474 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; }