]> git.droids-corp.org - dpdk.git/commitdiff
virtio: fix build with mempool debug enabled
authorThomas Monjalon <thomas.monjalon@6wind.com>
Tue, 3 Mar 2015 14:58:37 +0000 (15:58 +0100)
committerThomas Monjalon <thomas.monjalon@6wind.com>
Wed, 4 Mar 2015 10:18:36 +0000 (11:18 +0100)
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 <thomas.monjalon@6wind.com>
Acked-by: Changchun Ouyang <changchun.ouyang@intel.com>
lib/librte_eal/common/include/rte_pci.h
lib/librte_pmd_virtio/Makefile
lib/librte_pmd_virtio/virtio_ethdev.c

index b9cdf8b77995572208384cfaa443fe5a39f0beb1..995f814a553fe910f103a542ed932998be7edc90 100644 (file)
@@ -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 */
index 0baaf468c03d72411029d9d6651da6e5ab1d599e..793067f7a2c75d6ce573e46073aa458ca2f8d794 100644 (file)
@@ -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
index 88ecd571d0421a8757815d2f367f32cb6bd4a9b8..4bad1e4474ec241b2a7e549513be5ccbcb8e2d16 100644 (file)
@@ -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;
 }