ethdev: remove legacy HASH filter type support
[dpdk.git] / drivers / bus / pci / linux / pci_uio.c
index e031361..f3305a2 100644 (file)
@@ -25,6 +25,7 @@
 
 #include "eal_filesystem.h"
 #include "pci_init.h"
+#include "private.h"
 
 void *pci_map_addr = NULL;
 
@@ -248,7 +249,7 @@ pci_uio_alloc_resource(struct rte_pci_device *dev,
                goto error;
        }
 
-       if (dev->kdrv == RTE_KDRV_IGB_UIO)
+       if (dev->kdrv == RTE_PCI_KDRV_IGB_UIO)
                dev->intr_handle.type = RTE_INTR_HANDLE_UIO;
        else {
                dev->intr_handle.type = RTE_INTR_HANDLE_UIO_INTX;
@@ -345,12 +346,14 @@ pci_uio_map_resource_by_index(struct rte_pci_device *dev, int res_idx,
        mapaddr = pci_map_resource(pci_map_addr, fd, 0,
                        (size_t)dev->mem_resource[res_idx].len, 0);
        close(fd);
-       if (mapaddr == MAP_FAILED)
+       if (mapaddr == NULL)
                goto error;
 
        pci_map_addr = RTE_PTR_ADD(mapaddr,
                        (size_t)dev->mem_resource[res_idx].len);
 
+       pci_map_addr = RTE_PTR_ALIGN(pci_map_addr, sysconf(_SC_PAGE_SIZE));
+
        maps[map_idx].phaddr = dev->mem_resource[res_idx].phys_addr;
        maps[map_idx].size = dev->mem_resource[res_idx].len;
        maps[map_idx].addr = mapaddr;
@@ -375,6 +378,12 @@ pci_uio_ioport_map(struct rte_pci_device *dev, int bar,
        int uio_num;
        unsigned long start;
 
+       if (rte_eal_iopl_init() != 0) {
+               RTE_LOG(ERR, EAL, "%s(): insufficient ioport permissions for PCI device %s\n",
+                       __func__, dev->name);
+               return -1;
+       }
+
        uio_num = pci_get_uio_dev(dev, dirname, sizeof(dirname), 0);
        if (uio_num < 0)
                return -1;