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 05/15] malloc: rename address mapping function to IOVA
Date: Mon,  6 Nov 2017 02:41:31 +0100	[thread overview]
Message-ID: <20171106014141.13266-6-thomas@monjalon.net> (raw)
In-Reply-To: <20171106014141.13266-1-thomas@monjalon.net>

The function rte_malloc_virt2phy() is renamed to rte_malloc_virt2iova().
The deprecated name is kept as an alias to avoid breaking the API.

Signed-off-by: Thomas Monjalon <thomas@monjalon.net>
---
 app/test-crypto-perf/cperf_test_vector_parsing.c |  4 ++--
 app/test-crypto-perf/cperf_test_vectors.c        |  6 +++---
 drivers/mempool/octeontx/octeontx_fpavf.c        |  2 +-
 drivers/net/ark/ark_ethdev_rx.c                  |  4 ++--
 drivers/net/ark/ark_ethdev_tx.c                  |  4 ++--
 drivers/net/octeontx/base/octeontx_pkovf.c       |  2 +-
 drivers/net/sfc/sfc_tso.c                        |  2 +-
 examples/l2fwd-crypto/main.c                     |  2 +-
 lib/librte_eal/common/eal_common_memzone.c       |  2 +-
 lib/librte_eal/common/include/rte_malloc.h       | 17 ++++++++++++-----
 lib/librte_eal/common/rte_malloc.c               | 16 ++++++++--------
 lib/librte_eal/rte_eal_version.map               |  2 +-
 12 files changed, 35 insertions(+), 28 deletions(-)

diff --git a/app/test-crypto-perf/cperf_test_vector_parsing.c b/app/test-crypto-perf/cperf_test_vector_parsing.c
index 3952632c1..d4736f9ef 100644
--- a/app/test-crypto-perf/cperf_test_vector_parsing.c
+++ b/app/test-crypto-perf/cperf_test_vector_parsing.c
@@ -445,7 +445,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 	} else if (strstr(key_token, "aad")) {
 		rte_free(vector->aad.data);
 		vector->aad.data = data;
-		vector->aad.phys_addr = rte_malloc_virt2phy(vector->aad.data);
+		vector->aad.phys_addr = rte_malloc_virt2iova(vector->aad.data);
 		if (tc_found)
 			vector->aad.length = data_length;
 		else {
@@ -460,7 +460,7 @@ parse_entry(char *entry, struct cperf_test_vector *vector,
 	} else if (strstr(key_token, "digest")) {
 		rte_free(vector->digest.data);
 		vector->digest.data = data;
-		vector->digest.phys_addr = rte_malloc_virt2phy(
+		vector->digest.phys_addr = rte_malloc_virt2iova(
 			vector->digest.data);
 		if (tc_found)
 			vector->digest.length = data_length;
diff --git a/app/test-crypto-perf/cperf_test_vectors.c b/app/test-crypto-perf/cperf_test_vectors.c
index e51dcc3f1..fa911ff69 100644
--- a/app/test-crypto-perf/cperf_test_vectors.c
+++ b/app/test-crypto-perf/cperf_test_vectors.c
@@ -498,7 +498,7 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
 				return NULL;
 			}
 			t_vec->digest.phys_addr =
-				rte_malloc_virt2phy(t_vec->digest.data);
+				rte_malloc_virt2iova(t_vec->digest.data);
 			t_vec->digest.length = options->digest_sz;
 			memcpy(t_vec->digest.data, digest,
 					options->digest_sz);
@@ -531,7 +531,7 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
 				return NULL;
 			}
 			memcpy(t_vec->aad.data, aad, options->aead_aad_sz);
-			t_vec->aad.phys_addr = rte_malloc_virt2phy(t_vec->aad.data);
+			t_vec->aad.phys_addr = rte_malloc_virt2iova(t_vec->aad.data);
 			t_vec->aad.length = options->aead_aad_sz;
 		} else {
 			t_vec->aad.data = NULL;
@@ -546,7 +546,7 @@ cperf_test_vector_get_dummy(struct cperf_options *options)
 			return NULL;
 		}
 		t_vec->digest.phys_addr =
-				rte_malloc_virt2phy(t_vec->digest.data);
+				rte_malloc_virt2iova(t_vec->digest.data);
 		t_vec->digest.length = options->digest_sz;
 		memcpy(t_vec->digest.data, digest, options->digest_sz);
 		t_vec->data.aead_offset = 0;
diff --git a/drivers/mempool/octeontx/octeontx_fpavf.c b/drivers/mempool/octeontx/octeontx_fpavf.c
index 07b6ffbe2..bab841ccd 100644
--- a/drivers/mempool/octeontx/octeontx_fpavf.c
+++ b/drivers/mempool/octeontx/octeontx_fpavf.c
@@ -244,7 +244,7 @@ octeontx_fpapf_pool_setup(unsigned int gpool, unsigned int buf_size,
 
 	/* Configure stack */
 	fpa->pool_stack_base = memptr;
-	phys_addr = rte_malloc_virt2phy(memptr);
+	phys_addr = rte_malloc_virt2iova(memptr);
 
 	buf_size /= FPA_LN_SIZE;
 
diff --git a/drivers/net/ark/ark_ethdev_rx.c b/drivers/net/ark/ark_ethdev_rx.c
index f5d812a55..4e39d9557 100644
--- a/drivers/net/ark/ark_ethdev_rx.c
+++ b/drivers/net/ark/ark_ethdev_rx.c
@@ -99,11 +99,11 @@ eth_ark_rx_hw_setup(struct rte_eth_dev *dev,
 	phys_addr_t phys_addr_q_base;
 	phys_addr_t phys_addr_prod_index;
 
-	queue_base = rte_malloc_virt2phy(queue);
+	queue_base = rte_malloc_virt2iova(queue);
 	phys_addr_prod_index = queue_base +
 		offsetof(struct ark_rx_queue, prod_index);
 
-	phys_addr_q_base = rte_malloc_virt2phy(queue->paddress_q);
+	phys_addr_q_base = rte_malloc_virt2iova(queue->paddress_q);
 
 	/* Verify HW */
 	if (ark_mpu_verify(queue->mpu, sizeof(phys_addr_t))) {
diff --git a/drivers/net/ark/ark_ethdev_tx.c b/drivers/net/ark/ark_ethdev_tx.c
index 0e2d60deb..57841dfd1 100644
--- a/drivers/net/ark/ark_ethdev_tx.c
+++ b/drivers/net/ark/ark_ethdev_tx.c
@@ -317,8 +317,8 @@ eth_ark_tx_hw_queue_config(struct ark_tx_queue *queue)
 	if (ark_mpu_verify(queue->mpu, sizeof(struct ark_tx_meta)))
 		return -1;
 
-	queue_base = rte_malloc_virt2phy(queue);
-	ring_base = rte_malloc_virt2phy(queue->meta_q);
+	queue_base = rte_malloc_virt2iova(queue);
+	ring_base = rte_malloc_virt2iova(queue->meta_q);
 	cons_index_addr =
 		queue_base + offsetof(struct ark_tx_queue, cons_index);
 
diff --git a/drivers/net/octeontx/base/octeontx_pkovf.c b/drivers/net/octeontx/base/octeontx_pkovf.c
index 2bf607b15..64e5d69b1 100644
--- a/drivers/net/octeontx/base/octeontx_pkovf.c
+++ b/drivers/net/octeontx/base/octeontx_pkovf.c
@@ -485,7 +485,7 @@ octeontx_pko_init_fc(const size_t pko_vf_count)
 		return -ENOMEM;
 	}
 
-	pko_vf_ctl.fc_iomem.iova = rte_malloc_virt2phy((void *)
+	pko_vf_ctl.fc_iomem.iova = rte_malloc_virt2iova((void *)
 							pko_vf_ctl.fc_iomem.va);
 	pko_vf_ctl.fc_iomem.size = fc_mem_size;
 
diff --git a/drivers/net/sfc/sfc_tso.c b/drivers/net/sfc/sfc_tso.c
index fb79d7491..ad100676e 100644
--- a/drivers/net/sfc/sfc_tso.c
+++ b/drivers/net/sfc/sfc_tso.c
@@ -155,7 +155,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,
 					   header_len);
 		tsoh = txq->sw_ring[idx & txq->ptr_mask].tsoh;
 
-		header_paddr = rte_malloc_virt2phy((void *)tsoh);
+		header_paddr = rte_malloc_virt2iova((void *)tsoh);
 	} else {
 		if (m->data_len == header_len) {
 			*in_off = 0;
diff --git a/examples/l2fwd-crypto/main.c b/examples/l2fwd-crypto/main.c
index 841666028..06f90ab4a 100644
--- a/examples/l2fwd-crypto/main.c
+++ b/examples/l2fwd-crypto/main.c
@@ -2484,7 +2484,7 @@ reserve_key_memory(struct l2fwd_crypto_options *options)
 	options->aad.data = rte_malloc("aad", MAX_KEY_SIZE, 0);
 	if (options->aad.data == NULL)
 		rte_exit(EXIT_FAILURE, "Failed to allocate memory for AAD");
-	options->aad.phys_addr = rte_malloc_virt2phy(options->aad.data);
+	options->aad.phys_addr = rte_malloc_virt2iova(options->aad.data);
 }
 
 int
diff --git a/lib/librte_eal/common/eal_common_memzone.c b/lib/librte_eal/common/eal_common_memzone.c
index 3026e36b8..ab681101b 100644
--- a/lib/librte_eal/common/eal_common_memzone.c
+++ b/lib/librte_eal/common/eal_common_memzone.c
@@ -251,7 +251,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
 	mcfg->memzone_cnt++;
 	snprintf(mz->name, sizeof(mz->name), "%s", name);
-	mz->phys_addr = rte_malloc_virt2phy(mz_addr);
+	mz->phys_addr = rte_malloc_virt2iova(mz_addr);
 	mz->addr = mz_addr;
 	mz->len = (requested_len == 0 ? elem->size : requested_len);
 	mz->hugepage_sz = elem->ms->hugepage_sz;
diff --git a/lib/librte_eal/common/include/rte_malloc.h b/lib/librte_eal/common/include/rte_malloc.h
index 3d37f79b8..5d4c11a7c 100644
--- a/lib/librte_eal/common/include/rte_malloc.h
+++ b/lib/librte_eal/common/include/rte_malloc.h
@@ -323,17 +323,24 @@ int
 rte_malloc_set_limit(const char *type, size_t max);
 
 /**
- * Return the physical address of a virtual address obtained through
+ * Return the IO address of a virtual address obtained through
  * rte_malloc
  *
  * @param addr
  *   Address obtained from a previous rte_malloc call
  * @return
- *   RTE_BAD_PHYS_ADDR on error
- *   otherwise return physical address of the buffer
+ *   RTE_BAD_IOVA on error
+ *   otherwise return an address suitable for IO
  */
-phys_addr_t
-rte_malloc_virt2phy(const void *addr);
+rte_iova_t
+rte_malloc_virt2iova(const void *addr);
+
+__rte_deprecated
+static inline phys_addr_t
+rte_malloc_virt2phy(const void *addr)
+{
+	return rte_malloc_virt2iova(addr);
+}
 
 #ifdef __cplusplus
 }
diff --git a/lib/librte_eal/common/rte_malloc.c b/lib/librte_eal/common/rte_malloc.c
index 0028128a5..53057fcba 100644
--- a/lib/librte_eal/common/rte_malloc.c
+++ b/lib/librte_eal/common/rte_malloc.c
@@ -246,22 +246,22 @@ rte_malloc_set_limit(__rte_unused const char *type,
 }
 
 /*
- * Return the physical address of a virtual address obtained through rte_malloc
+ * Return the IO address of a virtual address obtained through rte_malloc
  */
-phys_addr_t
-rte_malloc_virt2phy(const void *addr)
+rte_iova_t
+rte_malloc_virt2iova(const void *addr)
 {
-	phys_addr_t paddr;
+	rte_iova_t iova;
 	const struct malloc_elem *elem = malloc_elem_from_data(addr);
 	if (elem == NULL)
-		return RTE_BAD_PHYS_ADDR;
+		return RTE_BAD_IOVA;
 	if (elem->ms->iova == RTE_BAD_IOVA)
 		return RTE_BAD_IOVA;
 
 	if (rte_eal_iova_mode() == RTE_IOVA_VA)
-		paddr = (uintptr_t)addr;
+		iova = (uintptr_t)addr;
 	else
-		paddr = elem->ms->iova +
+		iova = elem->ms->iova +
 			((uintptr_t)addr - (uintptr_t)elem->ms->addr);
-	return paddr;
+	return iova;
 }
diff --git a/lib/librte_eal/rte_eal_version.map b/lib/librte_eal/rte_eal_version.map
index a600881f0..b4d7cd93c 100644
--- a/lib/librte_eal/rte_eal_version.map
+++ b/lib/librte_eal/rte_eal_version.map
@@ -60,7 +60,6 @@ DPDK_2.0 {
 	rte_malloc_set_limit;
 	rte_malloc_socket;
 	rte_malloc_validate;
-	rte_malloc_virt2phy;
 	rte_mem_lock_page;
 	rte_mem_virt2phy;
 	rte_memdump;
@@ -233,6 +232,7 @@ DPDK_17.11 {
 	rte_eal_using_phys_addrs;
 	rte_eal_vfio_intr_mode;
 	rte_lcore_has_role;
+	rte_malloc_virt2iova;
 	rte_memcpy_ptr;
 	rte_mem_virt2iova;
 	vfio_enable;
-- 
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   ` Thomas Monjalon [this message]
2017-11-06  5:47     ` [dpdk-dev] [PATCH v4 05/15] malloc: " 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   ` [dpdk-dev] [PATCH v4 09/15] mempool: rename address mapping function " Thomas Monjalon
2017-11-06  5:54     ` 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-6-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).