From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from out4-smtp.messagingengine.com (out4-smtp.messagingengine.com [66.111.4.28]) by dpdk.org (Postfix) with ESMTP id 89F4B1B284 for ; Mon, 6 Nov 2017 02:42:18 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 3EFA920C18; Sun, 5 Nov 2017 20:42:18 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 05 Nov 2017 20:42:18 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=monjalon.net; h= cc:date:from:in-reply-to:message-id:references:subject:to :x-me-sender:x-me-sender:x-sasl-enc; s=mesmtp; bh=igYH7DVo8Aj4nL rzF2N6vouasTJvYxG205ZMg4vFR6c=; b=eK7SXNwMMxeZ+W4/41PPUYgr4gK6CW iRqBDyxPXhiXSYmIQAXf4bEegsJinmV1bEmAikBeoMUOGOm48QUIsrV2izsSy31H 3QK0yyf6zlVGQztGi9PJ2Q7/JtPAlIMB0HheZfMxULDp/1U1uhUVgyQqSw4O4Yei fV2KNxm/PXIeU= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:date:from:in-reply-to:message-id :references:subject:to:x-me-sender:x-me-sender:x-sasl-enc; s= fm1; bh=igYH7DVo8Aj4nLrzF2N6vouasTJvYxG205ZMg4vFR6c=; b=rYoocW8J +G9wfeWxFA5wWKouBhwVA0Jw45qLFTJo+0+jYXZE70wmnsnlKrV39JO+TdYyBuvg 7Rm/PCcaSqboOU9bsOqDfRaxsjg7SUieIE9t2GOLfKqs4p07pK1IpYE6/j8LMwYG n4NiZno+RCkD6koa8xRkc2B+onRWNDiRhjKKAhFx2srUgCp6Mdbx2RbStAhoFrwV jSxbNiqiE+BBqpJqC33N9YQdjCcKtmayBK757xYm9jw4OnwA6URniH2vIeG6+IY0 S1WKIROxTNM8iFiwOwGq6miWaVoMPiWtoo8MG5nApAI1XF2x7HXB8JE2zuO5gOoG BCLmemU5m64dSA== X-ME-Sender: Received: from xps.monjalon.net (184.203.134.77.rev.sfr.net [77.134.203.184]) by mail.messagingengine.com (Postfix) with ESMTPA id 6D30B24DF9; Sun, 5 Nov 2017 20:42:17 -0500 (EST) From: Thomas Monjalon To: Santosh Shukla Cc: olivier.matz@6wind.com, sergio.gonzalez.monroy@intel.com, anatoly.burakov@intel.com, dev@dpdk.org Date: Mon, 6 Nov 2017 02:41:35 +0100 Message-Id: <20171106014141.13266-10-thomas@monjalon.net> X-Mailer: git-send-email 2.14.2 In-Reply-To: <20171106014141.13266-1-thomas@monjalon.net> References: <20170814151537.29454-1-santosh.shukla@caviumnetworks.com> <20171106014141.13266-1-thomas@monjalon.net> Subject: [dpdk-dev] [PATCH v4 09/15] mempool: rename address mapping function to IOVA X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: DPDK patches and discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 06 Nov 2017 01:42:18 -0000 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 --- app/test-crypto-perf/cperf_test_common.c | 4 ++-- drivers/crypto/qat/qat_crypto.c | 2 +- drivers/crypto/qat/qat_qp.c | 6 ++---- drivers/mempool/dpaa/dpaa_mempool.c | 4 ++-- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 4 ++-- lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +- lib/librte_mbuf/rte_mbuf.c | 2 +- lib/librte_mbuf/rte_mbuf.h | 2 +- lib/librte_mempool/rte_mempool.h | 19 ++++++++++++------- test/test/test_mempool.c | 2 +- 10 files changed, 25 insertions(+), 22 deletions(-) diff --git a/app/test-crypto-perf/cperf_test_common.c b/app/test-crypto-perf/cperf_test_common.c index 46e4a46ec..08b313f8b 100644 --- a/app/test-crypto-perf/cperf_test_common.c +++ b/app/test-crypto-perf/cperf_test_common.c @@ -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 { diff --git a/drivers/crypto/qat/qat_crypto.c b/drivers/crypto/qat/qat_crypto.c index 59bc81fb3..e49b71f28 100644 --- a/drivers/crypto/qat/qat_crypto.c +++ b/drivers/crypto/qat/qat_crypto.c @@ -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; diff --git a/drivers/crypto/qat/qat_qp.c b/drivers/crypto/qat/qat_qp.c index 94aeb9f63..ced3aa6a0 100644 --- a/drivers/crypto/qat/qat_qp.c +++ b/drivers/crypto/qat/qat_qp.c @@ -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); } diff --git a/drivers/mempool/dpaa/dpaa_mempool.c b/drivers/mempool/dpaa/dpaa_mempool.c index 8855fb655..f5ee80f2d 100644 --- a/drivers/mempool/dpaa/dpaa_mempool.c +++ b/drivers/mempool/dpaa/dpaa_mempool.c @@ -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; } diff --git a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c index d66492908..8bcbaa892 100644 --- a/drivers/mempool/dpaa2/dpaa2_hw_mempool.c +++ b/drivers/mempool/dpaa2/dpaa2_hw_mempool.c @@ -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; diff --git a/lib/librte_eal/bsdapp/eal/eal_memory.c b/lib/librte_eal/bsdapp/eal/eal_memory.c index 0e021fff1..6ba058578 100644 --- a/lib/librte_eal/bsdapp/eal/eal_memory.c +++ b/lib/librte_eal/bsdapp/eal/eal_memory.c @@ -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; } diff --git a/lib/librte_mbuf/rte_mbuf.c b/lib/librte_mbuf/rte_mbuf.c index d6675ecb5..c96943522 100644 --- a/lib/librte_mbuf/rte_mbuf.c +++ b/lib/librte_mbuf/rte_mbuf.c @@ -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 */ diff --git a/lib/librte_mbuf/rte_mbuf.h b/lib/librte_mbuf/rte_mbuf.h index 8aac0278d..0a555e2d5 100644 --- a/lib/librte_mbuf/rte_mbuf.h +++ b/lib/librte_mbuf/rte_mbuf.h @@ -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; diff --git a/lib/librte_mempool/rte_mempool.h b/lib/librte_mempool/rte_mempool.h index 41f8b2daf..4a31f03f2 100644 --- a/lib/librte_mempool/rte_mempool.h +++ b/lib/librte_mempool/rte_mempool.h @@ -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. * diff --git a/test/test/test_mempool.c b/test/test/test_mempool.c index fa8bad39f..37ead503b 100644 --- a/test/test/test_mempool.c +++ b/test/test/test_mempool.c @@ -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 -- 2.14.2