mempool: rename address mapping function to IOVA

The function rte_mempool_virt2phy() is renamed to rte_mempool_virt2iova().
The new function has one less parameter because it is unused.
The deprecated function is kept as an alias to avoid breaking the API.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Acked-by: Olivier Matz <olivier.matz@6wind.com>
This commit is contained in:
Thomas Monjalon 2017-11-05 19:02:29 +01:00
parent efd785f994
commit b0eca11631
10 changed files with 25 additions and 22 deletions

View File

@ -50,7 +50,7 @@ fill_single_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
/* start of buffer is after mbuf structure and priv data */
m->priv_size = 0;
m->buf_addr = (char *)m + mbuf_hdr_size;
m->buf_physaddr = rte_mempool_virt2phy(mp, obj) +
m->buf_physaddr = rte_mempool_virt2iova(obj) +
mbuf_offset + mbuf_hdr_size;
m->buf_len = segment_sz;
m->data_len = segment_sz;
@ -74,7 +74,7 @@ fill_multi_seg_mbuf(struct rte_mbuf *m, struct rte_mempool *mp,
uint16_t mbuf_hdr_size = sizeof(struct rte_mbuf);
uint16_t remaining_segments = segments_nb;
struct rte_mbuf *next_mbuf;
phys_addr_t next_seg_phys_addr = rte_mempool_virt2phy(mp, obj) +
phys_addr_t next_seg_phys_addr = rte_mempool_virt2iova(obj) +
mbuf_offset + mbuf_hdr_size;
do {

View File

@ -527,7 +527,7 @@ qat_crypto_set_session_parameters(struct rte_cryptodev *dev,
PMD_INIT_FUNC_TRACE();
/* Set context descriptor physical address */
session->cd_paddr = rte_mempool_virt2phy(NULL, session) +
session->cd_paddr = rte_mempool_virt2iova(session) +
offsetof(struct qat_session, cd);
session->min_qat_dev_gen = QAT_GEN1;

View File

@ -228,14 +228,12 @@ int qat_crypto_sym_qp_setup(struct rte_cryptodev *dev, uint16_t queue_pair_id,
qp->op_cookies[i];
sql_cookie->qat_sgl_src_phys_addr =
rte_mempool_virt2phy(qp->op_cookie_pool,
sql_cookie) +
rte_mempool_virt2iova(sql_cookie) +
offsetof(struct qat_crypto_op_cookie,
qat_sgl_list_src);
sql_cookie->qat_sgl_dst_phys_addr =
rte_mempool_virt2phy(qp->op_cookie_pool,
sql_cookie) +
rte_mempool_virt2iova(sql_cookie) +
offsetof(struct qat_crypto_op_cookie,
qat_sgl_list_dst);
}

View File

@ -172,8 +172,8 @@ dpaa_mbuf_free_bulk(struct rte_mempool *pool,
while (i < n) {
dpaa_buf_free(bp_info,
(uint64_t)rte_mempool_virt2phy(pool,
obj_table[i]) + bp_info->meta_data_size);
(uint64_t)rte_mempool_virt2iova(obj_table[i]) +
bp_info->meta_data_size);
i = i + 1;
}

View File

@ -225,7 +225,7 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
/* convert mbuf to buffers for the remainder */
for (i = 0; i < n ; i++) {
#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
bufs[i] = (uint64_t)rte_mempool_virt2phy(pool, obj_table[i])
bufs[i] = (uint64_t)rte_mempool_virt2iova(obj_table[i])
+ meta_data_size;
#else
bufs[i] = (uint64_t)obj_table[i] + meta_data_size;
@ -244,7 +244,7 @@ rte_dpaa2_mbuf_release(struct rte_mempool *pool __rte_unused,
for (i = 0; i < DPAA2_MBUF_MAX_ACQ_REL; i++) {
#ifdef RTE_LIBRTE_DPAA2_USE_PHYS_IOVA
bufs[i] = (uint64_t)
rte_mempool_virt2phy(pool, obj_table[n + i])
rte_mempool_virt2iova(obj_table[n + i])
+ meta_data_size;
#else
bufs[i] = (uint64_t)obj_table[n + i] + meta_data_size;

View File

@ -54,7 +54,7 @@ phys_addr_t
rte_mem_virt2phy(const void *virtaddr)
{
/* XXX not implemented. This function is only used by
* rte_mempool_virt2phy() when hugepages are disabled. */
* rte_mempool_virt2iova() when hugepages are disabled. */
(void)virtaddr;
return RTE_BAD_IOVA;
}

View File

@ -134,7 +134,7 @@ rte_pktmbuf_init(struct rte_mempool *mp,
/* start of buffer is after mbuf structure and priv data */
m->priv_size = priv_size;
m->buf_addr = (char *)m + mbuf_size;
m->buf_physaddr = rte_mempool_virt2phy(mp, m) + mbuf_size;
m->buf_physaddr = rte_mempool_virt2iova(m) + mbuf_size;
m->buf_len = (uint16_t)buf_len;
/* keep some headroom between start of buffer and data */

View File

@ -1298,7 +1298,7 @@ static inline void rte_pktmbuf_detach(struct rte_mbuf *m)
m->priv_size = priv_size;
m->buf_addr = (char *)m + mbuf_size;
m->buf_physaddr = rte_mempool_virt2phy(mp, m) + mbuf_size;
m->buf_physaddr = rte_mempool_virt2iova(m) + mbuf_size;
m->buf_len = (uint16_t)buf_len;
rte_pktmbuf_reset_headroom(m);
m->data_len = 0;

View File

@ -1452,19 +1452,17 @@ rte_mempool_empty(const struct rte_mempool *mp)
}
/**
* Return the physical address of elt, which is an element of the pool mp.
* Return the IO address of elt, which is an element of the pool mp.
*
* @param mp
* A pointer to the mempool structure.
* @param elt
* A pointer (virtual address) to the element of the pool.
* @return
* The physical address of the elt element.
* The IO address of the elt element.
* If the mempool was created with MEMPOOL_F_NO_PHYS_CONTIG, the
* returned value is RTE_BAD_PHYS_ADDR.
* returned value is RTE_BAD_IOVA.
*/
static inline phys_addr_t
rte_mempool_virt2phy(__rte_unused const struct rte_mempool *mp, const void *elt)
static inline rte_iova_t
rte_mempool_virt2iova(const void *elt)
{
const struct rte_mempool_objhdr *hdr;
hdr = (const struct rte_mempool_objhdr *)RTE_PTR_SUB(elt,
@ -1472,6 +1470,13 @@ rte_mempool_virt2phy(__rte_unused const struct rte_mempool *mp, const void *elt)
return hdr->iova;
}
__rte_deprecated
static inline phys_addr_t
rte_mempool_virt2phy(__rte_unused const struct rte_mempool *mp, const void *elt)
{
return rte_mempool_virt2iova(elt);
}
/**
* Check the consistency of mempool objects.
*

View File

@ -146,7 +146,7 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache)
#ifndef RTE_EXEC_ENV_BSDAPP /* rte_mem_virt2iova() not supported on bsd */
printf("get physical address of an object\n");
if (rte_mempool_virt2phy(mp, obj) != rte_mem_virt2iova(obj))
if (rte_mempool_virt2iova(obj) != rte_mem_virt2iova(obj))
GOTO_ERR(ret, out);
#endif