DPDK patches and discussions
 help / color / mirror / Atom feed
From: Thomas Monjalon <thomas@monjalon.net>
To: Santosh Shukla <santosh.shukla@caviumnetworks.com>
Cc: olivier.matz@6wind.com, sergio.gonzalez.monroy@intel.com,
	anatoly.burakov@intel.com, dev@dpdk.org
Subject: [dpdk-dev] [PATCH v4 09/15] mempool: rename address mapping function to IOVA
Date: Mon,  6 Nov 2017 02:41:35 +0100	[thread overview]
Message-ID: <20171106014141.13266-10-thomas@monjalon.net> (raw)
In-Reply-To: <20171106014141.13266-1-thomas@monjalon.net>

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>
---
 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

  parent reply	other threads:[~2017-11-06  1:42 UTC|newest]

Thread overview: 91+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-14 15:15 [dpdk-dev] [PATCH v1 0/4] make dpdk iova aware Santosh Shukla
2017-08-14 15:15 ` [dpdk-dev] [PATCH v1 1/4] eal: rename phys_addr_t to iova_addr_t Santosh Shukla
2017-09-18 14:06   ` Burakov, Anatoly
2017-09-18 14:31     ` santosh
2017-09-18 14:32     ` Burakov, Anatoly
2017-08-14 15:15 ` [dpdk-dev] [PATCH v1 2/4] eal/memory: rename buf_physaddr to buf_iovaaddr Santosh Shukla
2017-08-14 15:15 ` [dpdk-dev] [PATCH v1 3/4] eal/memory: rename memory translational api to _iova types Santosh Shukla
2017-08-14 15:15 ` [dpdk-dev] [PATCH v1 4/4] doc: remove dpdk iova aware notice Santosh Shukla
2017-09-18 18:44   ` Mcnamara, John
2017-09-05 10:31 ` [dpdk-dev] [PATCH v2 0/5] make dpdk iova aware Santosh Shukla
2017-09-05 10:31   ` [dpdk-dev] [PATCH v2 1/5] eal: rename phys_addr_t to iova_addr_t Santosh Shukla
2017-09-18 15:19     ` Burakov, Anatoly
2017-09-05 10:31   ` [dpdk-dev] [PATCH v2 2/5] eal/memory: rename buf_physaddr to buf_iovaaddr Santosh Shukla
2017-09-18 15:20     ` Burakov, Anatoly
2017-09-05 10:31   ` [dpdk-dev] [PATCH v2 3/5] eal/memory: rename memseg member phys to iova addr Santosh Shukla
2017-09-18 15:04     ` Burakov, Anatoly
2017-09-18 15:08       ` santosh
2017-09-18 15:11         ` Burakov, Anatoly
2017-09-18 15:21     ` Burakov, Anatoly
2017-09-05 10:31   ` [dpdk-dev] [PATCH v2 4/5] eal/memory: rename memory api to iova types Santosh Shukla
2017-09-05 10:31   ` [dpdk-dev] [PATCH v2 5/5] doc: remove dpdk iova aware notice Santosh Shukla
2017-09-19 13:38     ` Mcnamara, John
2017-10-17 13:31   ` [dpdk-dev] [PATCH v2 0/5] make dpdk iova aware Thomas Monjalon
2017-10-17 14:12     ` santosh
2017-10-20 12:31   ` [dpdk-dev] [PATCH v3 0/6] " Santosh Shukla
2017-10-20 12:31     ` [dpdk-dev] [PATCH v3 1/6] eal: rename phys addr to iova addr Santosh Shukla
2017-10-23 20:32       ` Thomas Monjalon
2017-10-24  5:16         ` santosh
2017-10-20 12:31     ` [dpdk-dev] [PATCH v3 2/6] eal/memory: rename buf physaddr to buf iovaaddr Santosh Shukla
2017-10-23 20:15       ` Thomas Monjalon
2017-10-25  9:55         ` Olivier MATZ
2017-10-23 20:34       ` Thomas Monjalon
2017-10-24  5:17         ` santosh
2017-10-25  9:44       ` Olivier MATZ
2017-10-20 12:31     ` [dpdk-dev] [PATCH v3 3/6] eal/memory: rename memseg member phys to iova addr Santosh Shukla
2017-10-20 12:31     ` [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iova types Santosh Shukla
2017-11-03 11:11       ` Thomas Monjalon
2017-11-03 11:35         ` santosh
2017-11-03 13:58           ` Thomas Monjalon
2017-11-03 15:22             ` [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iovatypes Jonas Pfefferle1
2017-10-20 12:31     ` [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware notice Santosh Shukla
2017-10-23 20:29       ` Thomas Monjalon
2017-10-24  5:06         ` santosh
2017-10-25  9:45           ` Thomas Monjalon
2017-10-25  9:50             ` Richardson, Bruce
2017-10-25 10:01               ` Thomas Monjalon
2017-10-25 10:05                 ` Bruce Richardson
2017-10-25 10:12                   ` Thomas Monjalon
2017-10-25 10:32                     ` Bruce Richardson
2017-10-20 12:31     ` [dpdk-dev] [PATCH v3 6/6] eal/common/rte_malloc: use pointer diff in virt2iova Santosh Shukla
2017-10-23 14:58     ` [dpdk-dev] [PATCH v3 0/6] make dpdk iova aware Thomas Monjalon
2017-10-24  5:12       ` santosh
2017-10-24  7:38         ` Thomas Monjalon
2017-11-06  1:41 ` [dpdk-dev] [PATCH v4 00/15] make DPDK IOVA aware Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 01/15] mem: hide physical address error in VA mode Thomas Monjalon
2017-11-06  5:39     ` santosh
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 02/15] mem: introduce IOVA type Thomas Monjalon
2017-11-06  5:38     ` santosh
2017-11-06  8:37       ` Thomas Monjalon
2017-11-06  8:51         ` santosh
2017-11-06  9:08           ` Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 03/15] mem: rename segment address from physical to IOVA Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 04/15] mem: rename address mapping function " Thomas Monjalon
2017-11-06  5:41     ` santosh
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 05/15] malloc: " Thomas Monjalon
2017-11-06  5:47     ` santosh
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 06/15] malloc: use pointer diff macro in IOVA mapping Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 07/15] memzone: rename address from physical to IOVA Thomas Monjalon
2017-11-06  5:50     ` santosh
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 08/15] mempool: rename addresses " Thomas Monjalon
2017-11-06  5:52     ` santosh
2017-11-06 15:44     ` Olivier MATZ
2017-11-06  1:41   ` Thomas Monjalon [this message]
2017-11-06  5:54     ` [dpdk-dev] [PATCH v4 09/15] mempool: rename address mapping function " santosh
2017-11-06 15:44     ` Olivier MATZ
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 10/15] mempool: rename populate functions " Thomas Monjalon
2017-11-06 15:49     ` Olivier MATZ
2017-11-06 15:58       ` Thomas Monjalon
2017-11-06 16:39         ` Olivier MATZ
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 11/15] mbuf: rename physical address " Thomas Monjalon
2017-11-06 15:52     ` Olivier MATZ
2017-11-06 16:00       ` Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 12/15] mbuf: rename data address helpers " Thomas Monjalon
2017-11-06 15:56     ` Olivier MATZ
2017-11-06 16:03       ` Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 13/15] cryptodev: rename physical address type " Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 14/15] drivers/net: " Thomas Monjalon
2017-11-06  1:41   ` [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes Thomas Monjalon
2017-11-06  5:56     ` santosh
2017-11-06  8:50     ` Mcnamara, John
2017-11-06 22:48   ` [dpdk-dev] [PATCH v4 00/15] make DPDK IOVA aware Thomas Monjalon

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20171106014141.13266-10-thomas@monjalon.net \
    --to=thomas@monjalon.net \
    --cc=anatoly.burakov@intel.com \
    --cc=dev@dpdk.org \
    --cc=olivier.matz@6wind.com \
    --cc=santosh.shukla@caviumnetworks.com \
    --cc=sergio.gonzalez.monroy@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).