env/dpdk: support memsegs without phys addr assigned
If those are encountered, SPDK will get physical addreses by itself (either IOVAs from vfio or real physical addreses from /proc/self/pagemap). Change-Id: I321892f7dfb26054087a86cd24502efff05883ea Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/404138 Tested-by: SPDK Automated Test System <sys_sgsw@intel.com> Reviewed-by: Daniel Verkamp <daniel.verkamp@intel.com> Reviewed-by: Jim Harris <james.r.harris@intel.com>
This commit is contained in:
parent
aa8e7002ba
commit
c45669cf89
@ -45,11 +45,21 @@
|
||||
static uint64_t
|
||||
virt_to_phys(void *vaddr)
|
||||
{
|
||||
uint64_t ret;
|
||||
|
||||
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
|
||||
return rte_malloc_virt2iova(vaddr);
|
||||
ret = rte_malloc_virt2iova(vaddr);
|
||||
if (ret != RTE_BAD_IOVA) {
|
||||
return ret;
|
||||
}
|
||||
#else
|
||||
return rte_malloc_virt2phy(vaddr);
|
||||
ret = rte_malloc_virt2phy(vaddr);
|
||||
if (ret != RTE_BAD_PHYS_ADDR) {
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
|
||||
return spdk_vtophys(vaddr);
|
||||
}
|
||||
|
||||
void *
|
||||
|
@ -208,6 +208,13 @@ vtophys_get_paddr_memseg(uint64_t vaddr)
|
||||
if (vaddr >= (uintptr_t)seg->addr &&
|
||||
vaddr < ((uintptr_t)seg->addr + seg->len)) {
|
||||
paddr = seg->phys_addr;
|
||||
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
|
||||
if (paddr == RTE_BAD_IOVA) {
|
||||
#else
|
||||
if (paddr == RTE_BAD_PHYS_ADDR) {
|
||||
#endif
|
||||
return SPDK_VTOPHYS_ERROR;
|
||||
}
|
||||
paddr += (vaddr - (uintptr_t)seg->addr);
|
||||
return paddr;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user