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: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/375224 Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
14f45fc832
commit
189c02996b
@ -423,25 +423,6 @@ spdk_mem_map_translate(const struct spdk_mem_map *map, uint64_t vaddr)
|
|||||||
return map_2mb->translation_2mb;
|
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
|
static uint64_t
|
||||||
vtophys_get_paddr(uint64_t vaddr)
|
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
|
||||||
* The memory is not registered with DPDK. Try to look it up
|
* in /proc/self/pagemap. DPDK provides a utility function
|
||||||
* in /proc/self/pagemap.
|
* to do this.
|
||||||
*/
|
*/
|
||||||
paddr = vtophys_get_dpdk_paddr((void *)vaddr);
|
paddr = rte_mem_virt2phy((void *)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((void *)vaddr);
|
||||||
|
}
|
||||||
if (paddr != RTE_BAD_PHYS_ADDR) {
|
if (paddr != RTE_BAD_PHYS_ADDR) {
|
||||||
return paddr;
|
return paddr;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user