env/dpdk: use rte_virt2iova instead of rte_virt2phys for DPDK 17.11
DPDK 17.11-rc3 switched to IOVA-centric addressing. The old API is still available, but is deprecated. Change-Id: I7b54a1e626e39368acd2190dec725dbf30c7a5de Signed-off-by: Dariusz Stojaczyk <dariuszx.stojaczyk@intel.com> Reviewed-on: https://review.gerrithub.io/387654 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> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-on: https://review.gerrithub.io/387911
This commit is contained in:
parent
2779cead22
commit
7eafc71956
@ -42,12 +42,22 @@
|
|||||||
#include <rte_memzone.h>
|
#include <rte_memzone.h>
|
||||||
#include <rte_version.h>
|
#include <rte_version.h>
|
||||||
|
|
||||||
|
static uint64_t
|
||||||
|
virt_to_phys(void *vaddr)
|
||||||
|
{
|
||||||
|
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
|
||||||
|
return rte_malloc_virt2iova(vaddr);
|
||||||
|
#else
|
||||||
|
return rte_malloc_virt2phy(vaddr);
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void *
|
void *
|
||||||
spdk_dma_malloc_socket(size_t size, size_t align, uint64_t *phys_addr, int socket_id)
|
spdk_dma_malloc_socket(size_t size, size_t align, uint64_t *phys_addr, int socket_id)
|
||||||
{
|
{
|
||||||
void *buf = rte_malloc_socket(NULL, size, align, socket_id);
|
void *buf = rte_malloc_socket(NULL, size, align, socket_id);
|
||||||
if (buf && phys_addr) {
|
if (buf && phys_addr) {
|
||||||
*phys_addr = rte_malloc_virt2phy(buf);
|
*phys_addr = virt_to_phys(buf);
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
@ -79,7 +89,7 @@ spdk_dma_realloc(void *buf, size_t size, size_t align, uint64_t *phys_addr)
|
|||||||
{
|
{
|
||||||
void *new_buf = rte_realloc(buf, size, align);
|
void *new_buf = rte_realloc(buf, size, align);
|
||||||
if (new_buf && phys_addr) {
|
if (new_buf && phys_addr) {
|
||||||
*phys_addr = rte_malloc_virt2phy(new_buf);
|
*phys_addr = virt_to_phys(new_buf);
|
||||||
}
|
}
|
||||||
return new_buf;
|
return new_buf;
|
||||||
}
|
}
|
||||||
|
@ -316,7 +316,12 @@ spdk_mobj_ctor(struct rte_mempool *mp, __attribute__((unused)) void *arg,
|
|||||||
* right before the 512B aligned buffer area.
|
* right before the 512B aligned buffer area.
|
||||||
*/
|
*/
|
||||||
phys_addr = (uint64_t *)m->buf - 1;
|
phys_addr = (uint64_t *)m->buf - 1;
|
||||||
|
|
||||||
|
#if RTE_VERSION >= RTE_VERSION_NUM(17, 11, 0, 3)
|
||||||
|
*phys_addr = rte_mempool_virt2iova(m) + off;
|
||||||
|
#else
|
||||||
*phys_addr = rte_mempool_virt2phy(mp, m) + off;
|
*phys_addr = rte_mempool_virt2phy(mp, m) + off;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
#define PDU_POOL_SIZE(iscsi) (iscsi->MaxConnections * NUM_PDU_PER_CONNECTION)
|
#define PDU_POOL_SIZE(iscsi) (iscsi->MaxConnections * NUM_PDU_PER_CONNECTION)
|
||||||
|
Loading…
Reference in New Issue
Block a user