event/cnxk: support vectorized Rx adapter
[dpdk.git] / drivers / bus / vmbus / linux / vmbus_uio.c
index fb60ee1..b52ca5b 100644 (file)
@@ -14,7 +14,6 @@
 #include <rte_log.h>
 #include <rte_bus.h>
 #include <rte_memory.h>
-#include <rte_eal_memconfig.h>
 #include <rte_common.h>
 #include <rte_malloc.h>
 #include <rte_bus_vmbus.h>
@@ -155,7 +154,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
                vmbus_map_addr = vmbus_find_max_end_va();
 
        /* offset is special in uio it indicates which resource */
-       offset = idx * PAGE_SIZE;
+       offset = idx * rte_mem_page_size();
 
        mapaddr = vmbus_map_resource(vmbus_map_addr, fd, offset, size, flags);
        close(fd);
@@ -166,7 +165,7 @@ vmbus_uio_map_resource_by_index(struct rte_vmbus_device *dev, int idx,
        dev->resource[idx].addr = mapaddr;
        vmbus_map_addr = RTE_PTR_ADD(mapaddr, size);
 
-       /* Record result of sucessful mapping for use by secondary */
+       /* Record result of successful mapping for use by secondary */
        maps[idx].addr = mapaddr;
        maps[idx].size = size;
 
@@ -225,7 +224,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
        }
        file_size = sb.st_size;
 
-       if (file_size == 0 || (file_size & (PAGE_SIZE - 1))) {
+       if (file_size == 0 || (file_size & (rte_mem_page_size() - 1))) {
                VMBUS_LOG(ERR, "incorrect size %s: %zu",
                          ring_path, file_size);
 
@@ -243,7 +242,7 @@ static int vmbus_uio_map_subchan(const struct rte_vmbus_device *dev,
        *ring_size = file_size / 2;
        *ring_buf = mapaddr;
 
-       vmbus_map_addr = RTE_PTR_ADD(ring_buf, file_size);
+       vmbus_map_addr = RTE_PTR_ADD(mapaddr, file_size);
        return 0;
 }
 
@@ -283,10 +282,12 @@ vmbus_uio_map_secondary_subchan(const struct rte_vmbus_device *dev,
        if (mapaddr == MAP_FAILED)
                VMBUS_LOG(ERR,
                          "mmap subchan %u in secondary failed", chan->relid);
-       else
+       else {
                VMBUS_LOG(ERR,
                          "mmap subchan %u in secondary address mismatch",
                          chan->relid);
+               vmbus_unmap_resource(mapaddr, 2 * ring_size);
+       }
        return -1;
 }