malloc: rename address mapping function to IOVA
authorThomas Monjalon <thomas@monjalon.net>
Sat, 4 Nov 2017 01:22:21 +0000 (02:22 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 6 Nov 2017 21:24:25 +0000 (22:24 +0100)
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>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
12 files changed:
app/test-crypto-perf/cperf_test_vector_parsing.c
app/test-crypto-perf/cperf_test_vectors.c
drivers/mempool/octeontx/octeontx_fpavf.c
drivers/net/ark/ark_ethdev_rx.c
drivers/net/ark/ark_ethdev_tx.c
drivers/net/octeontx/base/octeontx_pkovf.c
drivers/net/sfc/sfc_tso.c
examples/l2fwd-crypto/main.c
lib/librte_eal/common/eal_common_memzone.c
lib/librte_eal/common/include/rte_malloc.h
lib/librte_eal/common/rte_malloc.c
lib/librte_eal/rte_eal_version.map

index 3952632..d4736f9 100644 (file)
@@ -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;
index e51dcc3..fa911ff 100644 (file)
@@ -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;
index 07b6ffb..bab841c 100644 (file)
@@ -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;
 
index f5d812a..4e39d95 100644 (file)
@@ -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))) {
index 0e2d60d..57841df 100644 (file)
@@ -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);
 
index 2bf607b..64e5d69 100644 (file)
@@ -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;
 
index fb79d74..ad10067 100644 (file)
@@ -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;
index 8416660..06f90ab 100644 (file)
@@ -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
index 3026e36..ab68110 100644 (file)
@@ -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;
index 3d37f79..5d4c11a 100644 (file)
@@ -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
 }
index 0028128..53057fc 100644 (file)
@@ -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;
 }
index 5635adb..a974a54 100644 (file)
@@ -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_mem_virt2iova;
        rte_memcpy_ptr;
        rte_vfio_enable;