eal: use sizeof to avoid a double use of a define
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal_vfio.c
index 3f56967..58f0123 100644 (file)
@@ -39,6 +39,7 @@
 #include <rte_log.h>
 #include <rte_memory.h>
 #include <rte_eal_memconfig.h>
+#include <rte_vfio.h>
 
 #include "eal_filesystem.h"
 #include "eal_vfio.h"
@@ -283,7 +284,7 @@ clear_group(int vfio_group_fd)
 }
 
 int
-vfio_setup_device(const char *sysfs_base, const char *dev_addr,
+rte_vfio_setup_device(const char *sysfs_base, const char *dev_addr,
                int *vfio_dev_fd, struct vfio_device_info *device_info)
 {
        struct vfio_group_status group_status = {
@@ -415,7 +416,7 @@ vfio_setup_device(const char *sysfs_base, const char *dev_addr,
 }
 
 int
-vfio_release_device(const char *sysfs_base, const char *dev_addr,
+rte_vfio_release_device(const char *sysfs_base, const char *dev_addr,
                    int vfio_dev_fd)
 {
        struct vfio_group_status group_status = {
@@ -477,7 +478,7 @@ vfio_release_device(const char *sysfs_base, const char *dev_addr,
 }
 
 int
-vfio_enable(const char *modname)
+rte_vfio_enable(const char *modname)
 {
        /* initialize group list */
        int i;
@@ -522,7 +523,7 @@ vfio_enable(const char *modname)
 }
 
 int
-vfio_is_enabled(const char *modname)
+rte_vfio_is_enabled(const char *modname)
 {
        const int mod_available = rte_eal_check_module(modname);
        return vfio_cfg.vfio_enabled && mod_available;
@@ -712,7 +713,7 @@ vfio_type1_dma_map(int vfio_container_fd)
                if (rte_eal_iova_mode() == RTE_IOVA_VA)
                        dma_map.iova = dma_map.vaddr;
                else
-                       dma_map.iova = ms[i].phys_addr;
+                       dma_map.iova = ms[i].iova;
                dma_map.flags = VFIO_DMA_MAP_FLAG_READ | VFIO_DMA_MAP_FLAG_WRITE;
 
                ret = ioctl(vfio_container_fd, VFIO_IOMMU_MAP_DMA, &dma_map);
@@ -771,7 +772,7 @@ vfio_spapr_dma_map(int vfio_container_fd)
                        break;
 
                create.window_size = RTE_MAX(create.window_size,
-                               ms[i].phys_addr + ms[i].len);
+                               ms[i].iova + ms[i].len);
        }
 
        /* sPAPR requires window size to be a power of 2 */
@@ -815,7 +816,7 @@ vfio_spapr_dma_map(int vfio_container_fd)
                if (rte_eal_iova_mode() == RTE_IOVA_VA)
                        dma_map.iova = dma_map.vaddr;
                else
-                       dma_map.iova = ms[i].phys_addr;
+                       dma_map.iova = ms[i].iova;
                dma_map.flags = VFIO_DMA_MAP_FLAG_READ |
                                 VFIO_DMA_MAP_FLAG_WRITE;
 
@@ -840,7 +841,7 @@ vfio_noiommu_dma_map(int __rte_unused vfio_container_fd)
 }
 
 int
-vfio_noiommu_is_enabled(void)
+rte_vfio_noiommu_is_enabled(void)
 {
        int fd, ret, cnt __rte_unused;
        char c;