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 E1B0D1B266 for ; Mon, 6 Nov 2017 02:42:14 +0100 (CET) Received: from compute1.internal (compute1.nyi.internal [10.202.2.41]) by mailout.nyi.internal (Postfix) with ESMTP id 9422220C1D; Sun, 5 Nov 2017 20:42:14 -0500 (EST) Received: from frontend2 ([10.202.2.161]) by compute1.internal (MEProxy); Sun, 05 Nov 2017 20:42:14 -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=5C3d3ENYYRyBAk P80TXfT8VZiWSg5ZxMChPMmk9KXN4=; b=JEogC7/3YjThbf5geT3kyTHXt1Pr5H 3AY/j12ulBblnGpkAG7ntdloALuNYR1+zIxo1MOIxQN0s8ans98S7ca2/2dlqmu/ edrrk116uOzctut28f0qhhMk5fuKeejogEDcgRZlLXK+YRk9docJ/lJkS+oMqip9 b5gugotVZ9lIk= 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=5C3d3ENYYRyBAkP80TXfT8VZiWSg5ZxMChPMmk9KXN4=; b=q6NG/xaR Cpsn28H38PVVTFRPvN4rfgJZRmvbCHTNsc/31TaLqgePpe0x4UMO034sv/uNDjbJ u/XM73xyiRO0KGD69RkEHTa8adurF9CrVUCOtyN4tZVMpSKrCKzpHCmIq4yV4SQW pBvExhuNDtn9S5OVzTs4VmKAjroz2KHRcxZ+drFJ0CsEk9Jusip7qMbeZZdAFXZn BKQZhjta80rMgW+MCApIfFOcw+NRbfokUW2rTfujMCftgjFh8PqWRjpNNx9YsGZL kzovLxLu8t4gfw6YYkg/TP82DRyUoRvDH5EXUKVzEqc0YZfHWfdW0wCgoUztbSkz q5yjU1pBh1HNrQ== 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 CCF182494B; Sun, 5 Nov 2017 20:42:13 -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:31 +0100 Message-Id: <20171106014141.13266-6-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 05/15] malloc: 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:15 -0000 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 --- 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