net/virtio: fix incorrect cast of void *
[dpdk.git] / lib / librte_eal / linuxapp / eal / eal_memory.c
index 284758a..16a181c 100644 (file)
@@ -128,9 +128,6 @@ rte_mem_virt2phy(const void *virtaddr)
        int page_size;
        off_t offset;
 
-       if (rte_eal_iova_mode() == RTE_IOVA_VA)
-               return (uintptr_t)virtaddr;
-
        /* Cannot parse /proc/self/pagemap, no need to log errors everywhere */
        if (!phys_addrs_available)
                return RTE_BAD_IOVA;
@@ -180,6 +177,14 @@ rte_mem_virt2phy(const void *virtaddr)
        return physaddr;
 }
 
+rte_iova_t
+rte_mem_virt2iova(const void *virtaddr)
+{
+       if (rte_eal_iova_mode() == RTE_IOVA_VA)
+               return (uintptr_t)virtaddr;
+       return rte_mem_virt2phy(virtaddr);
+}
+
 /*
  * For each hugepage in hugepg_tbl, fill the physaddr value. We find
  * it by browsing the /proc/self/pagemap special file.
@@ -339,7 +344,7 @@ void numa_error(char *where)
  * hugetlbfs, then mmap() hugepage_sz data in it. If orig is set, the
  * virtual address is stored in hugepg_tbl[i].orig_va, else it is stored
  * in hugepg_tbl[i].final_va. The second mapping (when orig is 0) tries to
- * map continguous physical blocks in contiguous virtual blocks.
+ * map contiguous physical blocks in contiguous virtual blocks.
  */
 static unsigned
 map_all_hugepages(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi,