Commit 189c0299 authored by Ben Walker's avatar Ben Walker Committed by Jim Harris
Browse files

env: Remove vtophys_get_dpdk_paddr



This function was only called from one place, so
inline it there. It's easier to follow the code
without so much jumping around.

Change-Id: I3bb11dda321af5f266d23aa32f1a79c8b361595b
Signed-off-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-on: https://review.gerrithub.io/375224


Reviewed-by: default avatarDaniel Verkamp <daniel.verkamp@intel.com>
Tested-by: default avatarSPDK Automated Test System <sys_sgsw@intel.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
parent 14f45fc8
Loading
Loading
Loading
Loading
+13 −23
Original line number Diff line number Diff line
@@ -423,25 +423,6 @@ spdk_mem_map_translate(const struct spdk_mem_map *map, uint64_t vaddr)
	return map_2mb->translation_2mb;
}

static uint64_t
vtophys_get_dpdk_paddr(void *vaddr)
{
	uintptr_t paddr;

	paddr = rte_mem_virt2phy(vaddr);
	if (paddr == 0) {
		/*
		 * The vaddr was valid but returned 0.  Touch the page
		 *  to ensure a backing page gets assigned, then call
		 *  rte_mem_virt2phy() again.
		 */
		rte_atomic64_read((rte_atomic64_t *)vaddr);
		paddr = rte_mem_virt2phy(vaddr);
	}

	return paddr;
}

static uint64_t
vtophys_get_paddr(uint64_t vaddr)
{
@@ -466,11 +447,20 @@ vtophys_get_paddr(uint64_t vaddr)
		}
	}

	/* The memory is not registered with DPDK. Try to look it up
	 * in /proc/self/pagemap. DPDK provides a utility function
	 * to do this.
	 */
	paddr = rte_mem_virt2phy((void *)vaddr);
	if (paddr == 0) {
		/*
	 * The memory is not registered with DPDK. Try to look it up
	 * in /proc/self/pagemap.
		 * The vaddr was valid but returned 0.  Touch the page
		 * to ensure a backing page gets assigned, then call
		 * rte_mem_virt2phy() again.
		 */
	paddr = vtophys_get_dpdk_paddr((void *)vaddr);
		rte_atomic64_read((rte_atomic64_t *)vaddr);
		paddr = rte_mem_virt2phy((void *)vaddr);
	}
	if (paddr != RTE_BAD_PHYS_ADDR) {
		return paddr;
	}