make dpdk iova aware
Subsystems (3)
PATCH v3 4/6 eal/memory: rename memory API to iova types
In reply to Santosh ShuklaRenamed memory translational api to _iova types.
The following api renamed from:
rte_mempool_populate_phys()rte_mempool_populate_phys_tab()rte_eal_using_phys_addrs()rte_mem_virt2phy()rte_dump_physmem_layout()rte_eal_get_physmem_layout()rte_eal_get_physmem_size()rte_malloc_virt2phy()rte_mem_phy2mch()
To the following iova types api:
rte_mempool_populate_iova()rte_mempool_populate_iova_tab()rte_eal_using_iova_addrs()rte_mem_virt2iova()rte_dump_iovamem_layout()rte_eal_get_iovamem_layout()rte_eal_get_iovamem_size()rte_malloc_virt2iova()rte_mem_phy2iova()
--- app/proc_info/main.c | 2 +- app/test-crypto-perf/cperf_test_vector_parsing.c | 4 ++-- app/test-crypto-perf/cperf_test_vectors.c | 6 +++--- app/test-pmd/cmdline.c | 2 +- doc/guides/rel_notes/release_17_11.rst | 2 +- drivers/bus/dpaa/base/qbman/qman.c | 2 +- drivers/bus/dpaa/base/qbman/qman.h | 2 +- drivers/bus/dpaa/rte_dpaa_bus.h | 2 +- drivers/bus/fslmc/fslmc_vfio.c | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 4 ++-- drivers/crypto/dpaa_sec/dpaa_sec.c | 4 ++-- drivers/crypto/qat/qat_qp.c | 2 +- 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/bnxt/bnxt_ethdev.c | 8 ++++---- drivers/net/bnxt/bnxt_hwrm.c | 20 ++++++++++---------- drivers/net/bnxt/bnxt_ring.c | 4 ++-- drivers/net/bnxt/bnxt_vnic.c | 4 ++-- drivers/net/liquidio/lio_rxtx.c | 2 +- drivers/net/mlx4/mlx4_mr.c | 2 +- drivers/net/mlx5/mlx5_mr.c | 2 +- drivers/net/octeontx/base/octeontx_pkovf.c | 2 +- drivers/net/sfc/sfc_tso.c | 2 +- examples/l2fwd-crypto/main.c | 2 +- lib/librte_cryptodev/rte_cryptodev.c | 2 +- lib/librte_eal/bsdapp/eal/eal.c | 2 +- lib/librte_eal/bsdapp/eal/eal_memory.c | 2 +- lib/librte_eal/bsdapp/eal/rte_eal_version.map | 12 ++++++------ lib/librte_eal/common/eal_common_memory.c | 6 +++--- lib/librte_eal/common/eal_common_memzone.c | 4 ++-- lib/librte_eal/common/eal_private.h | 2 +- lib/librte_eal/common/include/rte_malloc.h | 2 +- lib/librte_eal/common/include/rte_memory.h | 8 ++++---- lib/librte_eal/common/rte_malloc.c | 2 +- lib/librte_eal/linuxapp/eal/eal.c | 2 +- lib/librte_eal/linuxapp/eal/eal_memory.c | 8 ++++---- lib/librte_eal/linuxapp/eal/eal_pci.c | 4 ++-- lib/librte_eal/linuxapp/eal/eal_vfio.c | 4 ++-- lib/librte_eal/linuxapp/eal/rte_eal_version.map | 12 ++++++------ lib/librte_mempool/rte_mempool.c | 20 ++++++++++---------- lib/librte_mempool/rte_mempool.h | 6 +++--- lib/librte_mempool/rte_mempool_version.map | 4 ++-- lib/librte_vhost/vhost_user.c | 4 ++-- test/test/commands.c | 2 +- test/test/test_malloc.c | 4 ++-- test/test/test_memory.c | 6 +++--- test/test/test_mempool.c | 4 ++-- test/test/test_memzone.c | 10 +++++----- 49 files changed, 112 insertions(+), 112 deletions(-)
app/proc_info/main.c +1 -1
@@ -297,7 +297,7 @@ static voidmeminfo_display (void) {printf ("----------- MEMORY_SEGMENTS -----------\n" ); -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);printf ("--------- END_MEMORY_SEGMENTS ---------\n" );printf ("------------ MEMORY_ZONES -------------\n" );
app/test-crypto-perf/cperf_test_vector_parsing.c +2 -2
@@ -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;
app/test-crypto-perf/cperf_test_vectors.c +3 -3
@@ -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 ;
app/test-pmd/cmdline.c +1 -1
@@ -8315,7 +8315,7 @@ static void cmd_dump_parsed(void *parsed_result,struct cmd_dump_result *res = parsed_result;if (!strcmp (res->dump,"dump_physmem" )) -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);else if (!strcmp (res->dump,"dump_memzone" ))rte_memzone_dump (stdout);else if (!strcmp (res->dump,"dump_struct_sizes" ))
doc/guides/rel_notes/release_17_11.rst +1 -1
@@ -269,7 +269,7 @@ API Changes * Xen dom0 in EAL was removed, as well as xenvirt PMD and vhost_xen. -* ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address; +* ``rte_mem_phy2iova`` was used in Xen dom0 to obtain the physical address; remove this API as Xen dom0 support was removed. * **Add return value to stats_get dev op API**
drivers/bus/dpaa/base/qbman/qman.c +1 -1
@@ -1351,7 +1351,7 @@ int qman_init_fq(struct qman_fq *fq, u32 flags, struct qm_mcc_initfq *opts)memset (&mcc->initfq.fqd.context_a,0 ,sizeof (mcc->initfq.fqd.context_a)); }else { - phys_fq =rte_mem_virt2phy (fq); + phys_fq =rte_mem_virt2iova (fq);qm_fqd_stashing_set64 (&mcc->initfq.fqd, phys_fq); } }
drivers/bus/dpaa/base/qbman/qman.h +1 -1
@@ -240,7 +240,7 @@ struct qm_portal {#define EQCR_CARRYCLEAR (p) \ (void *)((unsigned long)(p) & (~(unsigned long)(QM_EQCR_SIZE << 6))) -extern dma_addr_t rte_mem_virt2phy (const void *addr); +extern dma_addr_t rte_mem_virt2iova (const void *addr);/* Bit-wise logic to convert a ring pointer to a ring index */ static inline u8 EQCR_PTR2IDX (struct qm_eqcr_entry *e)
drivers/bus/dpaa/rte_dpaa_bus.h +1 -1
@@ -109,7 +109,7 @@ struct dpaa_portal {/* TODO - this is costly, need to write a fast coversion routine */ static inline void *rte_dpaa_mem_ptov (iova_addr_t paddr) { -const struct rte_memseg *memseg =rte_eal_get_physmem_layout (); +const struct rte_memseg *memseg =rte_eal_get_iovamem_layout ();int i;for (i =0 ; i <RTE_MAX_MEMSEG && memseg[i].addr !=NULL ; i++) {
drivers/bus/fslmc/fslmc_vfio.c +1 -1
@@ -234,7 +234,7 @@ int rte_fslmc_vfio_dmamap(void)if (is_dma_done)return 0 ; - memseg =rte_eal_get_physmem_layout (); + memseg =rte_eal_get_iovamem_layout ();if (memseg ==NULL ) {FSLMC_VFIO_LOG (ERR ,"Cannot get physical layout." );return -ENODEV ;
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +2 -2
@@ -276,7 +276,7 @@ static void *dpaa2_mem_ptov(iova_addr_t paddr) __attribute__((unused));/* todo - this is costly, need to write a fast coversion routine */ static void *dpaa2_mem_ptov (iova_addr_t paddr) { -const struct rte_memseg *memseg =rte_eal_get_physmem_layout (); +const struct rte_memseg *memseg =rte_eal_get_iovamem_layout ();int i;for (i =0 ; i <RTE_MAX_MEMSEG && memseg[i].addr_64 !=0 ; i++) {
@@ -291,7 +291,7 @@ static void *dpaa2_mem_ptov(iova_addr_t paddr)static iova_addr_t dpaa2_mem_vtop (uint64_t vaddr) __attribute__((unused));static iova_addr_t dpaa2_mem_vtop (uint64_t vaddr) { -const struct rte_memseg *memseg =rte_eal_get_physmem_layout (); +const struct rte_memseg *memseg =rte_eal_get_iovamem_layout ();int i;for (i =0 ; i <RTE_MAX_MEMSEG && memseg[i].addr_64 !=0 ; i++) {
drivers/crypto/dpaa_sec/dpaa_sec.c +2 -2
@@ -113,7 +113,7 @@ dpaa_sec_alloc_ctx(dpaa_sec_session *ses)static inline iova_addr_t dpaa_mem_vtop (void *vaddr) { -const struct rte_memseg *memseg =rte_eal_get_physmem_layout (); +const struct rte_memseg *memseg =rte_eal_get_iovamem_layout ();uint64_t vaddr_64, paddr;int i;
@@ -133,7 +133,7 @@ dpaa_mem_vtop(void *vaddr)static inline void *dpaa_mem_ptov (iova_addr_t paddr) { -const struct rte_memseg *memseg =rte_eal_get_physmem_layout (); +const struct rte_memseg *memseg =rte_eal_get_iovamem_layout ();int i;for (i =0 ; i <RTE_MAX_MEMSEG && memseg[i].addr_64 !=0 ; i++) {
drivers/crypto/qat/qat_qp.c +1 -1
@@ -106,7 +106,7 @@ queue_dma_zone_reserve(const char *queue_name, uint32_t queue_size,PMD_DRV_LOG (DEBUG ,"Allocate memzone for %s, size %u on socket %u" , queue_name, queue_size, socket_id); - ms =rte_eal_get_physmem_layout (); + ms =rte_eal_get_iovamem_layout ();switch (ms[0 ].hugepage_sz) {case (RTE_PGSIZE_2M ): memzone_flags =RTE_MEMZONE_2MB ;
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
@@ -247,7 +247,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 ;
drivers/net/ark/ark_ethdev_rx.c +2 -2
@@ -99,11 +99,11 @@ eth_ark_rx_hw_setup(struct rte_eth_dev *dev,iova_addr_t phys_addr_q_base;iova_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 (iova_addr_t))) {
drivers/net/ark/ark_ethdev_tx.c +2 -2
@@ -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);
drivers/net/bnxt/bnxt_ethdev.c +4 -4
@@ -2829,8 +2829,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); - mz_phys_addr =rte_mem_virt2phy (mz->addr); +"Using rte_mem_virt2iova()\n" ); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map address to physical memory\n" );
@@ -2864,8 +2864,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); - mz_phys_addr =rte_mem_virt2phy (mz->addr); +"Using rte_mem_virt2iova()\n" ); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map address to physical memory\n" );
drivers/net/bnxt/bnxt_hwrm.c +10 -10
@@ -277,7 +277,7 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,if (!(mask &HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN )) mask |=HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY ; req.vlan_tag_tbl_addr =rte_cpu_to_le_64 ( -rte_mem_virt2phy (vlan_table)); +rte_mem_virt2iova (vlan_table)); req.num_vlan_tags =rte_cpu_to_le_32 ((uint32_t )vlan_count); } req.mask =rte_cpu_to_le_32 (mask);
@@ -318,7 +318,7 @@ int bnxt_hwrm_cfa_vlan_antispoof_cfg(struct bnxt *bp, uint16_t fid, req.fid =rte_cpu_to_le_16 (fid); req.vlan_tag_mask_tbl_addr = -rte_cpu_to_le_64 (rte_mem_virt2phy (vlan_table)); +rte_cpu_to_le_64 (rte_mem_virt2iova (vlan_table)); req.num_vlan_entries =rte_cpu_to_le_32 ((uint32_t )vlan_count); rc =bnxt_hwrm_send_message (bp, &req,sizeof (req));
@@ -643,7 +643,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) }rte_mem_lock_page (bp->hwrm_cmd_resp_addr); bp->hwrm_cmd_resp_dma_addr = -rte_mem_virt2phy (bp->hwrm_cmd_resp_addr); +rte_mem_virt2iova (bp->hwrm_cmd_resp_addr);if (bp->hwrm_cmd_resp_dma_addr ==0 ) {RTE_LOG (ERR ,PMD ,"Unable to map response buffer to physical memory.\n" );
@@ -669,7 +669,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) }rte_mem_lock_page (bp->hwrm_short_cmd_req_addr); bp->hwrm_short_cmd_req_dma_addr = -rte_mem_virt2phy (bp->hwrm_short_cmd_req_addr); +rte_mem_virt2iova (bp->hwrm_short_cmd_req_addr);if (bp->hwrm_short_cmd_req_dma_addr ==0 ) {rte_free (bp->hwrm_short_cmd_req_addr); RTE_LOG(ERR, PMD,
@@ -1752,7 +1752,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)if (bp->hwrm_cmd_resp_addr ==NULL )return -ENOMEM ; bp->hwrm_cmd_resp_dma_addr = -rte_mem_virt2phy (bp->hwrm_cmd_resp_addr); +rte_mem_virt2iova (bp->hwrm_cmd_resp_addr);if (bp->hwrm_cmd_resp_dma_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -2621,7 +2621,7 @@ int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp) page_getenum(bp->pf.active_vfs * HWRM_MAX_REQ_LEN)); req.req_buf_len =rte_cpu_to_le_16 (HWRM_MAX_REQ_LEN ); req.req_buf_page_addr[0 ] = -rte_cpu_to_le_64 (rte_mem_virt2phy (bp->pf.vf_req_buf)); +rte_cpu_to_le_64 (rte_mem_virt2iova (bp->pf.vf_req_buf));if (req.req_buf_page_addr[0 ] ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map buffer address to physical memory\n" );
@@ -3043,7 +3043,7 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)rte_mem_lock_page (buf);if (buf ==NULL )return -ENOMEM ; - dma_handle =rte_mem_virt2phy (buf); + dma_handle =rte_mem_virt2iova (buf);if (dma_handle ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -3079,7 +3079,7 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index,if (!buf)return -ENOMEM ; - dma_handle =rte_mem_virt2phy (buf); + dma_handle =rte_mem_virt2iova (buf);if (dma_handle ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -3140,7 +3140,7 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,if (!buf)return -ENOMEM ; - dma_handle =rte_mem_virt2phy (buf); + dma_handle =rte_mem_virt2iova (buf);if (dma_handle ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -3195,7 +3195,7 @@ static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf, req.vf_id =rte_cpu_to_le_16 (bp->pf.first_vf_id + vf); req.max_vnic_id_cnt =rte_cpu_to_le_32 (bp->pf.total_vnics); - req.vnic_id_tbl_addr =rte_cpu_to_le_64 (rte_mem_virt2phy (vnic_ids)); + req.vnic_id_tbl_addr =rte_cpu_to_le_64 (rte_mem_virt2iova (vnic_ids));if (req.vnic_id_tbl_addr ==0 ) {HWRM_UNLOCK ();
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -177,10 +177,10 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); +"Using rte_mem_virt2iova()\n" );for (sz =0 ; sz < total_alloc_len; sz +=getpagesize ())rte_mem_lock_page (((char *)mz->addr) + sz); - mz_phys_addr =rte_mem_virt2phy (mz->addr); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map ring address to physical memory\n" );
drivers/net/bnxt/bnxt_vnic.c +2 -2
@@ -197,8 +197,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); - mz_phys_addr =rte_mem_virt2phy (mz->addr); +"Using rte_mem_virt2iova()\n" ); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map vnic address to physical memory\n" );
drivers/net/liquidio/lio_rxtx.c +1 -1
@@ -1790,7 +1790,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) m = m->next; } - phyaddr =rte_mem_virt2phy (g->sg); + phyaddr =rte_mem_virt2iova (g->sg);if (phyaddr ==RTE_BAD_PHYS_ADDR ) {PMD_TX_LOG (lio_dev,ERR ,"bad phys addr\n" ); goto xmit_failed;
drivers/net/mlx4/mlx4_mr.c +1 -1
@@ -144,7 +144,7 @@ mlx4_check_mempool(struct rte_mempool *mp, uintptr_t *start, uintptr_t *end)struct ibv_mr *mlx4_mp2mr (struct ibv_pd *pd,struct rte_mempool *mp) { -const struct rte_memseg *ms =rte_eal_get_physmem_layout (); +const struct rte_memseg *ms =rte_eal_get_iovamem_layout ();uintptr_t start;uintptr_t end;unsigned int i;
drivers/net/mlx5/mlx5_mr.c +1 -1
@@ -272,7 +272,7 @@ mlx5_mp2mr_iter(struct rte_mempool *mp, void *arg)struct mlx5_mr *priv_mr_new (struct priv *priv,struct rte_mempool *mp) { -const struct rte_memseg *ms =rte_eal_get_physmem_layout (); +const struct rte_memseg *ms =rte_eal_get_iovamem_layout ();uintptr_t start;uintptr_t end;unsigned int i;
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
@@ -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;
drivers/net/sfc/sfc_tso.c +1 -1
@@ -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 ;
examples/l2fwd-crypto/main.c +1 -1
@@ -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
lib/librte_cryptodev/rte_cryptodev.c +1 -1
@@ -1271,7 +1271,7 @@ rte_crypto_op_init(struct rte_mempool *mempool,__rte_crypto_op_reset (op, type); - op->phys_addr =rte_mem_virt2phy (_op_data); + op->phys_addr =rte_mem_virt2iova (_op_data); op->mempool = mempool; }
lib/librte_eal/bsdapp/eal/eal.c +1 -1
@@ -457,7 +457,7 @@ eal_check_mem_on_local_socket(void) socket_id =rte_lcore_to_socket_id (rte_config.master_lcore); - ms =rte_eal_get_physmem_layout (); + ms =rte_eal_get_iovamem_layout ();for (i =0 ; i <RTE_MAX_MEMSEG ; i++) if (ms[i].socket_id == socket_id &&
lib/librte_eal/bsdapp/eal/eal_memory.c +1 -1
@@ -51,7 +51,7 @@* Get physical address of any mapped virtual address in the current process. */ iova_addr_t -rte_mem_virt2phy (const void *virtaddr) +rte_mem_virt2iova (const void *virtaddr) {/* XXX not implemented. This function is only used by * rte_mempool_virt2phy() when hugepages are disabled. */
lib/librte_eal/bsdapp/eal/rte_eal_version.map +6 -6
@@ -14,7 +14,7 @@ DPDK_2.0 { rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; rte_delay_us; - rte_dump_physmem_layout; + rte_dump_iovamem_layout; rte_dump_registers; rte_dump_stack; rte_dump_tailq;
@@ -25,8 +25,8 @@ DPDK_2.0 { rte_eal_devargs_type_count; rte_eal_get_configuration; rte_eal_get_lcore_state; - rte_eal_get_physmem_layout; - rte_eal_get_physmem_size; + rte_eal_get_iovamem_layout; + rte_eal_get_iovamem_size; rte_eal_has_hugepages; rte_eal_hpet_init; rte_eal_init;
@@ -62,10 +62,10 @@ DPDK_2.0 { rte_malloc_set_limit; rte_malloc_socket; rte_malloc_validate; - rte_malloc_virt2phy; + rte_malloc_virt2iova; rte_mem_lock_page; - rte_mem_phy2mch; - rte_mem_virt2phy; + rte_mem_phy2iova; + rte_mem_virt2iova; rte_memdump; rte_memory_get_nchannel; rte_memory_get_nrank;
lib/librte_eal/common/eal_common_memory.c +3 -3
@@ -55,7 +55,7 @@* memory. The last element of the table contains a NULL address. */ const struct rte_memseg * -rte_eal_get_physmem_layout (void ) +rte_eal_get_iovamem_layout (void ) {return rte_eal_get_configuration ()->mem_config->memseg; }
@@ -63,7 +63,7 @@ rte_eal_get_physmem_layout(void)/* get the total size of memory */ uint64_t -rte_eal_get_physmem_size (void ) +rte_eal_get_iovamem_size (void ) {const struct rte_mem_config *mcfg;unsigned i =0 ;
@@ -84,7 +84,7 @@ rte_eal_get_physmem_size(void)/* Dump the physical memory layout on console */ void -rte_dump_physmem_layout (FILE *f) +rte_dump_iovamem_layout (FILE *f) {const struct rte_mem_config *mcfg;unsigned i =0 ;
lib/librte_eal/common/eal_common_memzone.c +2 -2
@@ -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;
@@ -419,7 +419,7 @@ rte_eal_memzone_init(void)if (rte_eal_process_type () ==RTE_PROC_SECONDARY )return 0 ; - memseg =rte_eal_get_physmem_layout (); + memseg =rte_eal_get_iovamem_layout ();if (memseg ==NULL ) {RTE_LOG (ERR ,EAL ,"%s(): Cannot get physical layout\n" , __func__);return -1 ;
lib/librte_eal/common/eal_private.h +1 -1
@@ -352,7 +352,7 @@ int rte_eal_hugepage_attach(void);* addresses are obtainable. It is only possible to get * physical addresses when running as a privileged user. */ -bool rte_eal_using_phys_addrs (void ); +bool rte_eal_using_iova_addrs (void );/** * Find a bus capable of identifying a device.
lib/librte_eal/common/include/rte_malloc.h +1 -1
@@ -333,7 +333,7 @@ rte_malloc_set_limit(const char *type, size_t max);* otherwise return physical address of the buffer */ iova_addr_t -rte_malloc_virt2phy (const void *addr); +rte_malloc_virt2iova (const void *addr); #ifdef __cplusplus }
lib/librte_eal/common/include/rte_memory.h +4 -4
@@ -134,7 +134,7 @@ int rte_mem_lock_page(const void *virt);* @return * The physical address or RTE_BAD_PHYS_ADDR on error. */ -iova_addr_t rte_mem_virt2phy (const void *virt); +iova_addr_t rte_mem_virt2iova (const void *virt);/** * Get the layout of the available physical memory.
@@ -151,7 +151,7 @@ iova_addr_t rte_mem_virt2phy(const void *virt);* - On error, return NULL. This should not happen since it is a fatal * error that will probably cause the entire system to panic. */ -const struct rte_memseg *rte_eal_get_physmem_layout (void ); +const struct rte_memseg *rte_eal_get_iovamem_layout (void );/** * Dump the physical memory layout to a file.
@@ -159,7 +159,7 @@ const struct rte_memseg *rte_eal_get_physmem_layout(void);* @param f * A pointer to a file for output */ -void rte_dump_physmem_layout (FILE *f); +void rte_dump_iovamem_layout (FILE *f);/** * Get the total amount of available physical memory.
@@ -167,7 +167,7 @@ void rte_dump_physmem_layout(FILE *f);* @return * The total amount of available physical memory in bytes. */ -uint64_t rte_eal_get_physmem_size (void ); +uint64_t rte_eal_get_iovamem_size (void );/** * Get the number of memory channels.
lib/librte_eal/common/rte_malloc.c +1 -1
@@ -249,7 +249,7 @@ rte_malloc_set_limit(__rte_unused const char *type,* Return the physical address of a virtual address obtained through rte_malloc */ iova_addr_t -rte_malloc_virt2phy (const void *addr) +rte_malloc_virt2iova (const void *addr) {iova_addr_t paddr;const struct malloc_elem *elem =malloc_elem_from_data (addr);
lib/librte_eal/linuxapp/eal/eal.c +1 -1
@@ -665,7 +665,7 @@ eal_check_mem_on_local_socket(void) socket_id =rte_lcore_to_socket_id (rte_config.master_lcore); - ms =rte_eal_get_physmem_layout (); + ms =rte_eal_get_iovamem_layout ();for (i =0 ; i <RTE_MAX_MEMSEG ; i++) if (ms[i].socket_id == socket_id &&
lib/librte_eal/linuxapp/eal/eal_memory.c +4 -4
@@ -106,7 +106,7 @@ test_phys_addrs_available(void)return ; } - physaddr =rte_mem_virt2phy (&tmp); + physaddr =rte_mem_virt2iova (&tmp);if (physaddr ==RTE_BAD_PHYS_ADDR ) {RTE_LOG (ERR ,EAL , "Cannot obtain physical addresses: %s. "
@@ -120,7 +120,7 @@ test_phys_addrs_available(void)* Get physical address of any mapped virtual address in the current process. */ iova_addr_t -rte_mem_virt2phy (const void *virtaddr) +rte_mem_virt2iova (const void *virtaddr) {int fd, retval;uint64_t page, physaddr;
@@ -191,7 +191,7 @@ find_physaddrs(struct hugepage_file *hugepg_tbl, struct hugepage_info *hpi)iova_addr_t addr;for (i =0 ; i < hpi->num_pages[0 ]; i++) { - addr =rte_mem_virt2phy (hugepg_tbl[i].orig_va); + addr =rte_mem_virt2iova (hugepg_tbl[i].orig_va);if (addr ==RTE_BAD_PHYS_ADDR )return -1 ; hugepg_tbl[i].physaddr = addr;
@@ -1495,7 +1495,7 @@ rte_eal_hugepage_attach(void) }bool -rte_eal_using_phys_addrs (void ) +rte_eal_using_iova_addrs (void ) {return phys_addrs_available; }
lib/librte_eal/linuxapp/eal/eal_pci.c +2 -2
@@ -103,7 +103,7 @@ rte_pci_map_device(struct rte_pci_device *dev)break ;case RTE_KDRV_IGB_UIO :case RTE_KDRV_UIO_GENERIC : -if (rte_eal_using_phys_addrs ()) { +if (rte_eal_using_iova_addrs ()) {/* map resources for devices that use uio */ ret =pci_uio_map_resource (dev); }
@@ -145,7 +145,7 @@ rte_pci_unmap_device(struct rte_pci_device *dev)void *pci_find_max_end_va (void ) { -const struct rte_memseg *seg =rte_eal_get_physmem_layout (); +const struct rte_memseg *seg =rte_eal_get_iovamem_layout ();const struct rte_memseg *last = seg;unsigned i =0 ;
lib/librte_eal/linuxapp/eal/eal_vfio.c +2 -2
@@ -692,7 +692,7 @@ vfio_get_group_no(const char *sysfs_base,static int vfio_type1_dma_map (int vfio_container_fd) { -const struct rte_memseg *ms =rte_eal_get_physmem_layout (); +const struct rte_memseg *ms =rte_eal_get_iovamem_layout ();int i, ret;/* map all DPDK segments for DMA. use 1:1 PA to IOVA mapping */
@@ -728,7 +728,7 @@ vfio_type1_dma_map(int vfio_container_fd)static int vfio_spapr_dma_map (int vfio_container_fd) { -const struct rte_memseg *ms =rte_eal_get_physmem_layout (); +const struct rte_memseg *ms =rte_eal_get_iovamem_layout ();int i, ret;struct vfio_iommu_spapr_register_memory reg = {
lib/librte_eal/linuxapp/eal/rte_eal_version.map +6 -6
@@ -14,7 +14,7 @@ DPDK_2.0 { rte_cpu_get_flag_enabled; rte_cycles_vmware_tsc_map; rte_delay_us; - rte_dump_physmem_layout; + rte_dump_iovamem_layout; rte_dump_registers; rte_dump_stack; rte_dump_tailq;
@@ -25,8 +25,8 @@ DPDK_2.0 { rte_eal_devargs_type_count; rte_eal_get_configuration; rte_eal_get_lcore_state; - rte_eal_get_physmem_layout; - rte_eal_get_physmem_size; + rte_eal_get_iovamem_layout; + rte_eal_get_iovamem_size; rte_eal_has_hugepages; rte_eal_hpet_init; rte_eal_init;
@@ -62,10 +62,10 @@ DPDK_2.0 { rte_malloc_set_limit; rte_malloc_socket; rte_malloc_validate; - rte_malloc_virt2phy; + rte_malloc_virt2iova; rte_mem_lock_page; - rte_mem_phy2mch; - rte_mem_virt2phy; + rte_mem_phy2iova; + rte_mem_virt2iova; rte_memdump; rte_memory_get_nchannel; rte_memory_get_nrank;
lib/librte_mempool/rte_mempool.c +10 -10
@@ -357,7 +357,7 @@ rte_mempool_free_memchunks(struct rte_mempool *mp)* on error. */ int -rte_mempool_populate_phys (struct rte_mempool *mp,char *vaddr, +rte_mempool_populate_iova (struct rte_mempool *mp,char *vaddr,iova_addr_t paddr,size_t len,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque) {
@@ -439,7 +439,7 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,* number of objects added, or a negative value on error. */ int -rte_mempool_populate_phys_tab (struct rte_mempool *mp,char *vaddr, +rte_mempool_populate_iova_tab (struct rte_mempool *mp,char *vaddr,const iova_addr_t paddr[],uint32_t pg_num,uint32_t pg_shift,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque) {
@@ -452,7 +452,7 @@ rte_mempool_populate_phys_tab(struct rte_mempool *mp, char *vaddr,return -EEXIST ;if (mp->flags &MEMPOOL_F_NO_PHYS_CONTIG ) -return rte_mempool_populate_phys (mp, vaddr,RTE_BAD_PHYS_ADDR , +return rte_mempool_populate_iova (mp, vaddr,RTE_BAD_PHYS_ADDR , pg_num * pg_sz, free_cb, opaque);for (i =0 ; i < pg_num && mp->populated_size < mp->size; i += n) {
@@ -462,7 +462,7 @@ rte_mempool_populate_phys_tab(struct rte_mempool *mp, char *vaddr, paddr[i + n - 1] + pg_sz == paddr[i + n]; n++) ; - ret =rte_mempool_populate_phys (mp, vaddr + i * pg_sz, + ret =rte_mempool_populate_iova (mp, vaddr + i * pg_sz, paddr[i], n * pg_sz, free_cb, opaque);if (ret <0 ) {rte_mempool_free_memchunks (mp);
@@ -497,13 +497,13 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,return -EINVAL ;if (mp->flags &MEMPOOL_F_NO_PHYS_CONTIG ) -return rte_mempool_populate_phys (mp, addr,RTE_BAD_PHYS_ADDR , +return rte_mempool_populate_iova (mp, addr,RTE_BAD_PHYS_ADDR , len, free_cb, opaque);for (off =0 ; off + pg_sz <= len && mp->populated_size < mp->size; off += phys_len) { - paddr =rte_mem_virt2phy (addr + off); + paddr =rte_mem_virt2iova (addr + off);if (paddr ==RTE_BAD_PHYS_ADDR &&rte_eal_has_hugepages ()) { ret = -EINVAL ;
@@ -514,13 +514,13 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,for (phys_len = pg_sz; off + phys_len < len; phys_len += pg_sz) {iova_addr_t paddr_tmp; - paddr_tmp =rte_mem_virt2phy (addr + off + phys_len); + paddr_tmp =rte_mem_virt2iova (addr + off + phys_len);if (paddr_tmp != paddr + phys_len)break ; } - ret =rte_mempool_populate_phys (mp, addr + off, paddr, + ret =rte_mempool_populate_iova (mp, addr + off, paddr, phys_len, free_cb, opaque);if (ret <0 ) goto fail;
@@ -604,7 +604,7 @@ rte_mempool_populate_default(struct rte_mempool *mp) paddr = mz->phys_addr;if (rte_eal_has_hugepages ()) - ret =rte_mempool_populate_phys (mp, mz->addr, + ret =rte_mempool_populate_iova (mp, mz->addr, paddr, mz->len, rte_mempool_memchunk_mz_free, (void *)(uintptr_t )mz);
@@ -990,7 +990,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,if (mp_init)mp_init (mp, mp_init_arg); - ret =rte_mempool_populate_phys_tab (mp, vaddr, paddr, pg_num, pg_shift, + ret =rte_mempool_populate_iova_tab (mp, vaddr, paddr, pg_num, pg_shift,NULL ,NULL );if (ret <0 || ret != (int )mp->size) goto fail;
lib/librte_mempool/rte_mempool.h +3 -3
@@ -577,7 +577,7 @@ rte_mempool_ops_get_capabilities(const struct rte_mempool *mp,* @return * - 0: Success; * - -ENOTSUP - doesn't support register_memory_area ops (valid error case). -* - Otherwise, rte_mempool_populate_phys fails thus pool create fails. +* - Otherwise, rte_mempool_populate_iova fails thus pool create fails. */ int rte_mempool_ops_register_memory_area(const struct rte_mempool *mp,
@@ -894,7 +894,7 @@ rte_mempool_free(struct rte_mempool *mp);* On error, the chunk is not added in the memory list of the * mempool and a negative errno is returned. */ -int rte_mempool_populate_phys (struct rte_mempool *mp,char *vaddr, +int rte_mempool_populate_iova (struct rte_mempool *mp,char *vaddr,iova_addr_t paddr,size_t len,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque);
@@ -925,7 +925,7 @@ int rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,* On error, the chunks are not added in the memory list of the * mempool and a negative errno is returned. */ -int rte_mempool_populate_phys_tab (struct rte_mempool *mp,char *vaddr, +int rte_mempool_populate_iova_tab (struct rte_mempool *mp,char *vaddr,const iova_addr_t paddr[],uint32_t pg_num,uint32_t pg_shift,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque);
lib/librte_mempool/rte_mempool_version.map +2 -2
@@ -34,8 +34,8 @@ DPDK_16.07 { rte_mempool_ops_table; rte_mempool_populate_anon; rte_mempool_populate_default; - rte_mempool_populate_phys; - rte_mempool_populate_phys_tab; + rte_mempool_populate_iova; + rte_mempool_populate_iova_tab; rte_mempool_populate_virt; rte_mempool_register_ops; rte_mempool_set_ops_byname;
lib/librte_vhost/vhost_user.c +2 -2
@@ -516,7 +516,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg,uint64_t host_phys_addr;uint64_t size; - host_phys_addr =rte_mem_virt2phy ((void *)(uintptr_t )host_user_addr); + host_phys_addr =rte_mem_virt2iova ((void *)(uintptr_t )host_user_addr); size = page_size - (guest_phys_addr & (page_size -1 )); size =RTE_MIN (size, reg_size);
@@ -527,7 +527,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg,while (reg_size >0 ) { size =RTE_MIN (reg_size, page_size); - host_phys_addr =rte_mem_virt2phy ((void *)(uintptr_t ) + host_phys_addr =rte_mem_virt2iova ((void *)(uintptr_t ) host_user_addr);add_one_guest_page (dev, guest_phys_addr, host_phys_addr, size);
test/test/commands.c +1 -1
@@ -147,7 +147,7 @@ static void cmd_dump_parsed(void *parsed_result,struct cmd_dump_result *res = parsed_result;if (!strcmp (res->dump,"dump_physmem" )) -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);else if (!strcmp (res->dump,"dump_memzone" ))rte_memzone_dump (stdout);else if (!strcmp (res->dump,"dump_struct_sizes" ))
test/test/test_malloc.c +2 -2
@@ -739,7 +739,7 @@ test_malloc_bad_params(void)static int is_mem_on_socket (int32_t socket) { -const struct rte_memseg *ms =rte_eal_get_physmem_layout (); +const struct rte_memseg *ms =rte_eal_get_iovamem_layout ();unsigned i;for (i =0 ; i <RTE_MAX_MEMSEG ; i++) {
@@ -756,7 +756,7 @@ is_mem_on_socket(int32_t socket)static int32_t addr_to_socket (void * addr) { -const struct rte_memseg *ms =rte_eal_get_physmem_layout (); +const struct rte_memseg *ms =rte_eal_get_iovamem_layout ();unsigned i;for (i =0 ; i <RTE_MAX_MEMSEG ; i++) {
test/test/test_memory.c +3 -3
@@ -64,17 +64,17 @@ test_memory(void)* that at least one line is dumped */ printf ("Dump memory layout\n" ); -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);/* check that memory size is != 0 */ - s =rte_eal_get_physmem_size (); + s =rte_eal_get_iovamem_size ();if (s ==0 ) {printf ("No memory detected\n" );return -1 ; }/* try to read memory (should not segfault) */ - mem =rte_eal_get_physmem_layout (); + mem =rte_eal_get_iovamem_layout ();for (i =0 ; i <RTE_MAX_MEMSEG && mem[i].addr !=NULL ; i++) {/* check memory */
test/test/test_mempool.c +2 -2
@@ -145,9 +145,9 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) MEMPOOL_HEADER_SIZE(mp, mp->cache_size))GOTO_ERR (ret, out); -#ifndef RTE_EXEC_ENV_BSDAPP /* rte_mem_virt2phy() not supported on bsd */ +#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_virt2phy (obj)) +if (rte_mempool_virt2phy (mp, obj) !=rte_mem_virt2iova (obj))GOTO_ERR (ret, out);#endif
test/test/test_memzone.c +5 -5
@@ -139,7 +139,7 @@ test_memzone_reserve_flags(void)int hugepage_16GB_avail =0 ;const size_t size =100 ;int i =0 ; - ms =rte_eal_get_physmem_layout (); + ms =rte_eal_get_iovamem_layout ();for (i =0 ; i <RTE_MAX_MEMSEG ; i++) {if (ms[i].hugepage_sz ==RTE_PGSIZE_2M ) hugepage_2MB_avail =1 ;
@@ -422,7 +422,7 @@ test_memzone_reserve_max(void)if (mz ==NULL ){printf ("Failed to reserve a big chunk of memory - %s\n" ,rte_strerror (rte_errno)); -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);rte_memzone_dump (stdout);return -1 ; }
@@ -430,7 +430,7 @@ test_memzone_reserve_max(void)if (mz->len != maxlen) {printf ("Memzone reserve with 0 size did not return bigest block\n" );printf ("Expected size = %zu, actual size = %zu\n" , maxlen, mz->len); -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);rte_memzone_dump (stdout);return -1 ; }
@@ -459,7 +459,7 @@ test_memzone_reserve_max_aligned(void)if (mz ==NULL ){printf ("Failed to reserve a big chunk of memory - %s\n" ,rte_strerror (rte_errno)); -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);rte_memzone_dump (stdout);return -1 ; }
@@ -469,7 +469,7 @@ test_memzone_reserve_max_aligned(void) " bigest block\n", align);printf ("Expected size = %zu, actual size = %zu\n" , maxlen, mz->len); -rte_dump_physmem_layout (stdout); +rte_dump_iovamem_layout (stdout);rte_memzone_dump (stdout);return -1 ; }
Signature · 1 line
2.14.1
Re: [PATCH v3 4/6] eal/memory: rename memory API to iova types
20/10/2017 14:31, Santosh Shukla:
Quoted 5 lines
Renamed memory translational api to
_iovatypes.
The following api renamed from:
rte_mempool_populate_phys()rte_mempool_populate_phys_tab()
These functions still have "physical addresses" in their description. It is not consistent.
Please provide ABI compatibility for mempool functions.
Quoted 1 line
rte_eal_using_phys_addrs()
Why renaming rte_eal_using_phys_addrs?
I think we need to review how it is used.
Maybe it requires a rework.
Quoted 4 lines
rte_mem_virt2phy()rte_dump_physmem_layout()rte_eal_get_physmem_layout()rte_eal_get_physmem_size()
Those 3 functions deal with physical memory layout. I don't see a need to rename them.
But the dump function needs a change to avoid printing "phys" even in VA case.
Quoted 2 lines
rte_malloc_virt2phy()rte_mem_phy2mch()
This last function was removed with Xen.
It is wrong to rename it in the release notes.
It should just be removed from the map file (I will send a patch).
Quoted 6 lines
To the following iova types api:
rte_mempool_populate_iova()rte_mempool_populate_iova_tab()rte_eal_using_iova_addrs()rte_mem_virt2iova()
[...]
Quoted 1 line
rte_malloc_virt2iova()
I am not convinced by the names virt2iova.
I sounds like "virt to virt".
What about "virt2io" or "virt2io_addr"?
As the ABI is broken in EAL 17.11, we do not care about compatibility. But we must keep an alias to the old function name in order to allow a smooth API transition for applications.
I suggest to add static inline functions with the old names and set the deprecated attribute.
Re: [PATCH v3 4/6] eal/memory: rename memory API to iova types
Quoted 16 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 5 lines
Renamed memory translational api to
_iovatypes.
The following api renamed from:
rte_mempool_populate_phys()rte_mempool_populate_phys_tab()These functions still have "physical addresses" in their description. It is not consistent.
Please provide ABI compatibility for mempool functions.
Quoted 1 line
rte_eal_using_phys_addrs()Why renaming
rte_eal_using_phys_addrs?
I think we need to review how it is used.
Maybe it requires a rework.
Quoted 6 lines
Quoted 4 lines
rte_mem_virt2phy()rte_dump_physmem_layout()rte_eal_get_physmem_layout()rte_eal_get_physmem_size()Those 3 functions deal with physical memory layout. I don't see a need to rename them.
In iova=va mode, those api will have va address.
Quoted 15 lines
But the dump function needs a change to avoid printing "phys" even in VA case.
Quoted 2 lines
rte_malloc_virt2phy()rte_mem_phy2mch()This last function was removed with Xen.
It is wrong to rename it in the release notes.
It should just be removed from the map file (I will send a patch).Quoted 6 lines
To the following iova types api:
rte_mempool_populate_iova()rte_mempool_populate_iova_tab()rte_eal_using_iova_addrs()rte_mem_virt2iova()
Quoted 5 lines
[...]
Quoted 1 line
rte_malloc_virt2iova()I am not convinced by the names virt2iova.
I sounds like "virt to virt".
What about "virt2io" or "virt2io_addr"?
no, iova can be _pa or _va, its an io_addr indeed but
I prefer virt2iova, same mentioned in deprecation notice (no strong opinion),
More suggestion on naming pl.?
Quoted 5 lines
As the ABI is broken in EAL 17.11, we do not care about compatibility. But we must keep an alias to the old function name in order to allow a smooth API transition for applications.
I suggest to add static inline functions with the old names and set the deprecated attribute.
ok, Will address in 18.02.
Thanks.
Re: [PATCH v3 4/6] eal/memory: rename memory API to iova types
03/11/2017 12:35, santosh:
Quoted 17 lines · Thomas Monjalon
Quoted 16 lines
20/10/2017 14:31, Santosh Shukla:
Quoted 5 lines
Renamed memory translational api to
_iovatypes.
The following api renamed from:
rte_mempool_populate_phys()rte_mempool_populate_phys_tab()These functions still have "physical addresses" in their description. It is not consistent.
Please provide ABI compatibility for mempool functions.
Quoted 1 line
rte_eal_using_phys_addrs()Why renaming
rte_eal_using_phys_addrs?
I think we need to review how it is used.
Maybe it requires a rework.
Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
rte_mem_virt2phy()rte_dump_physmem_layout()rte_eal_get_physmem_layout()rte_eal_get_physmem_size()Those 3 functions deal with physical memory layout. I don't see a need to rename them.
In iova=va mode, those api will have va address.
Yes addresses can be virtual.
But it is still physically segmented.
Quoted 17 lines
Quoted 17 lines
But the dump function needs a change to avoid printing "phys" even in VA case.
Quoted 2 lines
rte_malloc_virt2phy()rte_mem_phy2mch()This last function was removed with Xen.
It is wrong to rename it in the release notes.
It should just be removed from the map file (I will send a patch).Quoted 6 lines
To the following iova types api:
rte_mempool_populate_iova()rte_mempool_populate_iova_tab()rte_eal_using_iova_addrs()rte_mem_virt2iova()[...]
Quoted 1 line
rte_malloc_virt2iova()
Quoted 8 lines
Quoted 3 lines
I am not convinced by the names virt2iova.
I sounds like "virt to virt".
What about "virt2io" or "virt2io_addr"?no, iova can be
_paor_va, its anio_addrindeed but
I prefer virt2iova, same mentioned in deprecation notice (no strong opinion),More suggestion on naming pl.?
I like virt2io_addr but virt2iova is not so bad. I agree with Santosh that we need more opinions.
Quoted 7 lines
Quoted 5 lines
As the ABI is broken in EAL 17.11, we do not care about compatibility. But we must keep an alias to the old function name in order to allow a smooth API transition for applications.
I suggest to add static inline functions with the old names and set the deprecated attribute.ok, Will address in 18.02.
I would prefer these changes made in 17.11 as announced. As you are not willing to work on it, I am trying to send some updated patches.
Re: [PATCH v3 4/6] eal/memory: rename memory API to iovatypes
"dev" <[email protected]> wrote on 11/03/2017 02:58:43 PM:
Quoted 61 lines
From: Thomas Monjalon <[email protected]>
To: santosh <[email protected]>
Cc: [email protected], [email protected], [email protected], [email protected], [email protected]
Date: 11/03/2017 02:59 PM
Subject: Re: [dpdk-dev] [PATCH v3 4/6] eal/memory: rename memory API to iova types
Sent by: "dev" <[email protected]>03/11/2017 12:35, santosh:
Quoted 17 lines · Thomas Monjalon
Quoted 16 lines
20/10/2017 14:31, Santosh Shukla:
Quoted 5 lines
Renamed memory translational api to
_iovatypes.
The following api renamed from:
rte_mempool_populate_phys()rte_mempool_populate_phys_tab()These functions still have "physical addresses" in their description. It is not consistent.
Please provide ABI compatibility for mempool functions.
Quoted 1 line
rte_eal_using_phys_addrs()Why renaming
rte_eal_using_phys_addrs?
I think we need to review how it is used.
Maybe it requires a rework.Quoted 8 lines
Quoted 6 lines
Quoted 4 lines
rte_mem_virt2phy()rte_dump_physmem_layout()rte_eal_get_physmem_layout()rte_eal_get_physmem_size()Those 3 functions deal with physical memory layout. I don't see a need to rename them.
In iova=va mode, those api will have va address.
Yes addresses can be virtual.
But it is still physically segmented.Quoted 21 lines
Quoted 20 lines
But the dump function needs a change to avoid printing "phys" even in VA case.
Quoted 2 lines
rte_malloc_virt2phy()rte_mem_phy2mch()This last function was removed with Xen.
It is wrong to rename it in the release notes.
It should just be removed from the map file (I will send a patch).Quoted 6 lines
To the following iova types api:
rte_mempool_populate_iova()rte_mempool_populate_iova_tab()rte_eal_using_iova_addrs()rte_mem_virt2iova()[...]
Quoted 1 line
rte_malloc_virt2iova()I am not convinced by the names virt2iova.
I sounds like "virt to virt".
What about "virt2io" or "virt2io_addr"?
Quoted 8 lines
Quoted 2 lines
no, iova can be
_paor_va, its anio_addrindeed but I prefer virt2iova, same mentioned in deprecation notice (nostrong opinion),
Quoted 2 lines
More suggestion on naming pl.?
I like
virt2io_addrbut virt2iova is not so bad.
I agree with Santosh that we need more opinions.
virt2iova +1
Another suggestion va2iova to be consistent with the names
Quoted 2 lines
Quoted 2 lines
Quoted 2 lines
As the ABI is broken in EAL 17.11, we do not care about
compatibility.
Quoted 11 lines
Quoted 6 lines
Quoted 4 lines
But we must keep an alias to the old function name in order to allow a smooth API transition for applications.
I suggest to add static inline functions with the old names and set the deprecated attribute.ok, Will address in 18.02.
I would prefer these changes made in 17.11 as announced. As you are not willing to work on it, I am trying to send some updated patches.
PATCH v3 5/6 doc: remove dpdk iova aware notice
In reply to Santosh ShuklaRemoved dpdk iova aware ABI deprecation notice, and updated ABI change details in release_17.11.rst.
--- doc/guides/rel_notes/deprecation.rst | 7 ------- doc/guides/rel_notes/release_17_11.rst | 28 ++++++++++++++++++++++++++++ 2 files changed, 28 insertions(+), 7 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
@@ -29,13 +29,6 @@ Deprecation Notices - ``rte_eal_devargs_type_count`` - ``rte_eal_parse_devargs_str``, replaced by ``rte_eal_devargs_parse`` -* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address - translation scheme. - Reference to phys address in EAL data-structure or functions may change to - IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same. - * The mbuf flags PKT_RX_VLAN_PKT and PKT_RX_QINQ_PKT are deprecated and are respectively replaced by PKT_RX_VLAN_STRIPPED and PKT_RX_QINQ_STRIPPED, that are better described. The old flags and
doc/guides/rel_notes/release_17_11.rst +28 -0
@@ -302,6 +302,34 @@ ABI Changes The size of the field ``port_id`` in the ``rte_eth_dev_data`` structure changed, as described in the `New Features` section. +* **Following datatypes, structure member and function renamed to iova type.** + + * Renamed ``phys_addr_t`` to ``iova_addr_t``. + * Renamed ``buf_physaddr`` to ``buf_iovaaddr`` for struct rte_mbuf. + * Renamed ``phys_addr`` to ``iova_addr`` for struct rte_memseg. + * The Following memory translation api renamed from: + + * ``rte_mempool_populate_phys()`` + * ``rte_mempool_populate_phys_tab()`` + * ``rte_eal_using_phys_addrs()`` + * ``rte_mem_virt2phy()`` + * ``rte_dump_physmem_layout()`` + * ``rte_eal_get_physmem_layout()`` + * ``rte_eal_get_physmem_size()`` + * ``rte_malloc_virt2phy()`` + * ``rte_mem_phy2mch()`` + + * To the following iova types api: + + * ``rte_mempool_populate_iova()`` + * ``rte_mempool_populate_iova_tab()`` + * ``rte_eal_using_iova_addrs()`` + * ``rte_mem_virt2iova()`` + * ``rte_dump_iovamem_layout()`` + * ``rte_eal_get_iovamem_layout()`` + * ``rte_eal_get_iovamem_size()`` + * ``rte_malloc_virt2iova()`` + * ``rte_mem_phy2iova()`` Removed Items -------------
Signature · 1 line
2.14.1
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
20/10/2017 14:31, Santosh Shukla:
Quoted 8 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 37
Quoted 6 lines
doc/guides/rel_notes/deprecation.rst +0
-6-* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address - translation scheme. - Reference to phys address in EAL data-structure or functions may change to - IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.
Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
One more comment:
For such a large change, we should provide a script in devtools to help porting the applications. I suggest a sed script.
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
Hi Thomas,
Quoted 4 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 3 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.
Quoted 16 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 37
Quoted 11 lines
Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-6-* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address - translation scheme. - Reference to phys address in EAL data-structure or functions may change to - IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02
Theme of series is to make dpdk iova aware so I would prefer option 1) or 2). However I have no strong opinion on this topic.
Lets get more opinion from others about option 1/2/3.
Quoted 5 lines
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
One more comment:
For such a large change, we should provide a script in devtools to help porting the applications. I suggest a sed script.
+1.
Thanks.
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
Hi Santosh,
24/10/2017 07:06, santosh:
Quoted 25 lines
Hi Thomas,
Quoted 4 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 3 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Quoted 16 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 37
Quoted 11 lines
Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-6-* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address - translation scheme. - Reference to phys address in EAL data-structure or functions may change to - IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02
Quoted 5 lines
Theme of series is to make dpdk iova aware so I would prefer option 1) or 2). However I have no strong opinion on this topic.
Lets get more opinion from others about option 1/2/3.Quoted 1 line
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
After discussing with Olivier it appeared there is a fourth solution. We should not break any API (EAL, mbuf, mempool).
I would like to merge these changes in RC2, but keeping compatibility with old names:
- When you rename a function or a type, you can define a macro for the old name, alias the new name.
- When you rename a struct field, you can make an anonymous union to allow both names.
Then we can deprecate the old names and remove them later.
Are you able to do these small changes today please?
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
Quoted 47 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Wednesday, October 25, 2017 10:46 AM
To: santosh <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware noticeHi Santosh,
24/10/2017 07:06, santosh:
Quoted 27 lines
Hi Thomas,
Quoted 14 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 13 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-1-* eal: An ABI change is planned for 17.11 to make DPDK aware ofIOVA address
doc/guides/rel_notes/deprecation.rst +0
-2- translation scheme. - Reference to phys address in EAL data-structure or functions maychange to
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 37
Quoted 3 lines
doc/guides/rel_notes/deprecation.rst +0
-3- IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02Quoted 1 line
Theme of series is to make dpdk iova aware so I would prefer option 1)
or 2).
Quoted 4 lines
However I have no strong opinion on this topic. Lets get more opinion from others about option 1/2/3.
Quoted 1 line
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
Quoted 7 lines
After discussing with Olivier it appeared there is a fourth solution. We should not break any API (EAL, mbuf, mempool).
I would like to merge these changes in RC2, but keeping compatibility with old names:
- When you rename a function or a type, you can define a macro for the old name, alias the new name.
Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
25/10/2017 11:50, Richardson, Bruce:
Quoted 49 lines
Quoted 49 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Wednesday, October 25, 2017 10:46 AM
To: santosh <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware noticeHi Santosh,
24/10/2017 07:06, santosh:
Quoted 27 lines
Hi Thomas,
Quoted 14 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 13 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-1-* eal: An ABI change is planned for 17.11 to make DPDK aware ofIOVA address
doc/guides/rel_notes/deprecation.rst +0
-2- translation scheme. - Reference to phys address in EAL data-structure or functions maychange to
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 37
Quoted 3 lines
doc/guides/rel_notes/deprecation.rst +0
-3- IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02Quoted 1 line
Theme of series is to make dpdk iova aware so I would prefer option 1)
or 2).
Quoted 4 lines
However I have no strong opinion on this topic. Lets get more opinion from others about option 1/2/3.
Quoted 1 line
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
After discussing with Olivier it appeared there is a fourth solution. We should not break any API (EAL, mbuf, mempool).
Quoted 6 lines
Quoted 4 lines
I would like to merge these changes in RC2, but keeping compatibility with old names:
- When you rename a function or a type, you can define a macro for the old name, alias the new name.Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
True
We can use an inline function to avoid ABI breakage.
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
Quoted 55 lines · Thomas Monjalon
25/10/2017 11:50, Richardson, Bruce:
Quoted 54 lines
Quoted 53 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Wednesday, October 25, 2017 10:46 AM
To: santosh <[email protected]>
Cc: [email protected]; [email protected]; [email protected]; [email protected]; Burakov, Anatoly <[email protected]>
Subject: Re: [dpdk-dev] [PATCH v3 5/6] doc: remove dpdk iova aware noticeHi Santosh,
24/10/2017 07:06, santosh:
Quoted 27 lines
Hi Thomas,
Quoted 14 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 13 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-1-* eal: An ABI change is planned for 17.11 to make DPDK aware ofIOVA address
doc/guides/rel_notes/deprecation.rst +0
-2- translation scheme. - Reference to phys address in EAL data-structure or functions maychange to
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst Deprecation Notices · line 37
Quoted 3 lines
doc/guides/rel_notes/deprecation.rst +0
-3- IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02Quoted 1 line
Theme of series is to make dpdk iova aware so I would prefer option 1)
or 2).
Quoted 4 lines
However I have no strong opinion on this topic. Lets get more opinion from others about option 1/2/3.
Quoted 1 line
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
After discussing with Olivier it appeared there is a fourth solution. We should not break any API (EAL, mbuf, mempool).
I would like to merge these changes in RC2, but keeping compatibility with old names:
- When you rename a function or a type, you can define a macro for the old name, alias the new name.
Quoted 4 lines
Quoted 1 line
Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
True
We can use an inline function to avoid ABI breakage.
Nope, inline function won't work either, since that ends up the same as the macro and compiled into the end app, not the library ABI. You need a public non-inline wrapper function to keep ABI, or else function renaming via symbol versioning/mapping.
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
25/10/2017 12:05, Bruce Richardson:
Quoted 44 lines · Thomas Monjalon
Quoted 43 lines
25/10/2017 11:50, Richardson, Bruce:
Quoted 41 lines
From: Thomas Monjalon
Quoted 31 lines
Quoted 24 lines · Thomas Monjalon
Quoted 14 lines
20/10/2017 14:31, Santosh Shukla:
Quoted 13 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-1-* eal: An ABI change is planned for 17.11 to make DPDK aware ofIOVA address
doc/guides/rel_notes/deprecation.rst +0
-2- translation scheme. - Reference to phys address in EAL data-structure or functions maychange to
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst
Quoted 3 lines
doc/guides/rel_notes/deprecation.rst +0
-3- IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02Quoted 1 line
Theme of series is to make dpdk iova aware so I would prefer option 1)
or 2).
Quoted 4 lines
However I have no strong opinion on this topic. Lets get more opinion from others about option 1/2/3.
Quoted 1 line
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
Quoted 7 lines
After discussing with Olivier it appeared there is a fourth solution. We should not break any API (EAL, mbuf, mempool).
I would like to merge these changes in RC2, but keeping compatibility with old names:
- When you rename a function or a type, you can define a macro for the old name, alias the new name.Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
Quoted 7 lines
Quoted 2 lines
True
We can use an inline function to avoid ABI breakage.Nope, inline function won't work either, since that ends up the same as the macro and compiled into the end app, not the library ABI. You need a public non-inline wrapper function to keep ABI, or else function renaming via symbol versioning/mapping.
Ah ah ah, I'm writing before thinking :)
Yes, the function must not be inlined.
And generally speaking it is not an issue,
even for performance critical functions.
Adding one more function call in the path is not a bad thing for deprecated functions.
I've seen another project (don't remember which one) adding a sleep() in deprecated functions and increasing the sleep time at each new release :)
Re: [PATCH v3 5/6] doc: remove dpdk iova aware notice
Quoted 56 lines · Thomas Monjalon
25/10/2017 12:05, Bruce Richardson:
Quoted 44 lines · Thomas Monjalon
Quoted 43 lines
25/10/2017 11:50, Richardson, Bruce:
Quoted 41 lines
From: Thomas Monjalon
Quoted 31 lines
Quoted 24 lines · Thomas Monjalon
Quoted 14 lines
20/10/2017 14:31, Santosh Shukla:
Quoted 13 lines
Removed dpdk iova aware ABI deprecation notice, and updated ABI change details in
release_17.11.rst.Signed-off-by Santosh Shukla <[email protected]>Acked-by John McNamara <[email protected]>---
doc/guides/rel_notes/deprecation.rst +0
-1-* eal: An ABI change is planned for 17.11 to make DPDK aware ofIOVA address
doc/guides/rel_notes/deprecation.rst +0
-2- translation scheme. - Reference to phys address in EAL data-structure or functions maychange to
Quoted 8 lines
doc/guides/rel_notes/deprecation.rst
Quoted 3 lines
doc/guides/rel_notes/deprecation.rst +0
-3- IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same.Sorry, this series cannot be applied as is because it is breaking more than EAL API. The API of mbuf and mempool are also changed. We need to choose one of these three options:
1/ accept to break all API in 17.11
2/ postpone the whole series to 18.02Quoted 1 line
Theme of series is to make dpdk iova aware so I would prefer option 1)
or 2).
Quoted 4 lines
However I have no strong opinion on this topic. Lets get more opinion from others about option 1/2/3.
Quoted 1 line
3/ rename only EAL API in 17.11 and postpone mbuf/mempool
Quoted 7 lines
After discussing with Olivier it appeared there is a fourth solution. We should not break any API (EAL, mbuf, mempool).
I would like to merge these changes in RC2, but keeping compatibility with old names:
- When you rename a function or a type, you can define a macro for the old name, alias the new name.Note: using a macro doesn't prevent the ABI being broken if you rename a public function. You'll need to use function versioning too.
Quoted 7 lines
Quoted 2 lines
True
We can use an inline function to avoid ABI breakage.Nope, inline function won't work either, since that ends up the same as the macro and compiled into the end app, not the library ABI. You need a public non-inline wrapper function to keep ABI, or else function renaming via symbol versioning/mapping.
Ah ah ah, I'm writing before thinking :)
Yes, the function must not be inlined.
Quoted 7 lines
And generally speaking it is not an issue,
even for performance critical functions.
Adding one more function call in the path is not a bad thing for deprecated functions.
I've seen another project (don't remember which one) adding asleep()in deprecated functions and increasing the sleep time at each new release :)
Genius!!
PATCH v3 6/6 eal/common/rte_malloc: use pointer diff in virt2iova
In reply to Santosh ShuklaUse RTE_PTR_DIFF macro in rte_mem_virt2iova api.
--- lib/librte_eal/common/rte_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/rte_malloc.c +1 -1
@@ -262,6 +262,6 @@ rte_malloc_virt2iova(const void *addr) paddr = (uintptr_t )addr; else paddr = elem->ms->iova_addr + - ((uintptr_t )addr - (uintptr_t )elem->ms->addr); +RTE_PTR_DIFF (addr, elem->ms->addr);return paddr; }
Signature · 1 line
2.14.1
20/10/2017 14:31, Santosh Shukla:
Quoted 7 lines
v3:
Include v2 review comment and rebased on
top of upstream tip commit:6b9ed026a8704v2:
Include build fixes reported in patchworks.
Please fix checkpatch issues, thanks
Hi Thomas,
Quoted 10 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 7 lines
v3:
Include v2 review comment and rebased on
top of upstream tip commit:6b9ed026a8704v2:
Include build fixes reported in patchworks.Please fix checkpatch issues, thanks
Checkpatch warning coming from legacy code, not from iova change,
Same mentioned down in cover letter.
Will address them in v4.. After we conclude on your proposition on [5/6] patch of this series.
Thanks.
24/10/2017 07:12, santosh:
Quoted 10 lines
Hi Thomas,
Quoted 6 lines · Thomas Monjalon
20/10/2017 14:31, Santosh Shukla:
Quoted 5 lines
v3:
Include v2 review comment and rebased on
top of upstream tip commit:6b9ed026a8704
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
v2:
Include build fixes reported in patchworks.Please fix checkpatch issues, thanks
Checkpatch warning coming from legacy code, not from iova change,
Same mentioned down in cover letter.
Will address them in v4.. After we conclude on your proposition on [5/6] patch of this series.
Sorry, I had overlooked checkpatch issues.
No need to fix the checkpatch issues if it makes code lines formatted differently of their context.
v4 cover make DPDK IOVA aware
In reply to Santosh ShuklaThis v4 is a big rework to complete the patches sent by Santosh. The core components for memory handling (memseg, malloc, memzone, mempool, mbuf) are almost fully updated for IOVA awareness. It will ease maintenance and upcoming reworks; that's why we should push it in 17.11 LTS.
The most important changes in this revision v4 are:
- No API break: everything is aliased to keep old names during next releases. It will ease apps migration, waiting for major ABI break.
- Rename type from iova_addr_t to rte_iova_t.
- Convert memzone field.
- Convert mempool fields.
- Convert mbuf address helpers.
- Reword doxygen comments and variable names in functions.
In PMDs, only the address type is renamed.
All PMDs will require some attention to transition to IOVA scheme. KNI and NXP bus drivers are not reworded.
Santosh Shukla (5):
mem: rename segment address from physical to IOVA
malloc: use pointer diff macro in IOVA mapping
mbuf: rename physical address to IOVA
cryptodev: rename physical address type to IOVA drivers/net: rename physical address type to IOVA
Thomas Monjalon (10):
mem: hide physical address error in VA mode
mem: introduce IOVA type
mem: rename address mapping function to IOVA
malloc: rename address mapping function to IOVA
memzone: rename address from physical to IOVA
mempool: rename addresses from physical to IOVA
mempool: rename address mapping function to IOVA
mempool: rename populate functions to IOVA
mbuf: rename data address helpers to IOVA
doc: add IOVA aware API changes in release notes
app/test-crypto-perf/cperf_ops.c | 6 +- app/test-crypto-perf/cperf_test_common.c | 6 +- app/test-crypto-perf/cperf_test_vector_parsing.c | 4 +- app/test-crypto-perf/cperf_test_vectors.c | 6 +- app/test-crypto-perf/cperf_test_vectors.h | 4 +- doc/guides/prog_guide/cryptodev_lib.rst | 6 +- doc/guides/prog_guide/img/mbuf1.svg | 2 +- doc/guides/rel_notes/deprecation.rst | 7 -- doc/guides/rel_notes/release_17_11.rst | 17 ++++ drivers/bus/dpaa/base/qbman/qman.c | 2 +- drivers/bus/dpaa/base/qbman/qman.h | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 28 +++--- drivers/crypto/mrvl/rte_mrvl_pmd.c | 4 +- drivers/crypto/qat/qat_adf/qat_algs.h | 6 +- drivers/crypto/qat/qat_crypto.c | 22 ++--- drivers/crypto/qat/qat_crypto.h | 2 +- drivers/crypto/qat/qat_qp.c | 8 +- drivers/mempool/dpaa/dpaa_mempool.c | 4 +- drivers/mempool/dpaa2/dpaa2_hw_mempool.c | 4 +- drivers/mempool/dpaa2/dpaa2_hw_mempool.h | 2 +- drivers/mempool/octeontx/octeontx_fpavf.c | 4 +- drivers/mempool/octeontx/rte_mempool_octeontx.c | 2 +- drivers/net/ark/ark_ddm.c | 2 +- drivers/net/ark/ark_ddm.h | 4 +- drivers/net/ark/ark_ethdev_rx.c | 24 ++--- drivers/net/ark/ark_ethdev_tx.c | 8 +- drivers/net/ark/ark_mpu.c | 2 +- drivers/net/ark/ark_mpu.h | 4 +- drivers/net/ark/ark_udm.c | 2 +- drivers/net/ark/ark_udm.h | 4 +- drivers/net/avp/avp_ethdev.c | 2 +- drivers/net/avp/rte_avp_common.h | 20 ++-- drivers/net/bnx2x/bnx2x.c | 44 ++++----- drivers/net/bnx2x/bnx2x.h | 22 ++--- drivers/net/bnx2x/bnx2x_rxtx.c | 14 +-- drivers/net/bnx2x/bnx2x_stats.c | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 10 +- drivers/net/bnxt/bnxt_cpr.h | 4 +- drivers/net/bnxt/bnxt_ethdev.c | 14 +-- drivers/net/bnxt/bnxt_hwrm.c | 26 +++--- drivers/net/bnxt/bnxt_ring.c | 10 +- drivers/net/bnxt/bnxt_ring.h | 4 +- drivers/net/bnxt/bnxt_rxr.h | 4 +- drivers/net/bnxt/bnxt_txr.h | 2 +- drivers/net/bnxt/bnxt_vnic.c | 8 +- drivers/net/bnxt/bnxt_vnic.h | 6 +- drivers/net/cxgbe/sge.c | 6 +- drivers/net/dpaa/dpaa_rxtx.c | 6 +- drivers/net/e1000/em_rxtx.c | 12 +-- drivers/net/e1000/igb_rxtx.c | 12 +-- drivers/net/ena/base/ena_plat_dpdk.h | 4 +- drivers/net/ena/ena_ethdev.c | 6 +- drivers/net/enic/enic_main.c | 8 +- drivers/net/enic/enic_rxtx.c | 6 +- drivers/net/fm10k/fm10k.h | 4 +- drivers/net/fm10k/fm10k_ethdev.c | 4 +- drivers/net/fm10k/fm10k_rxtx_vec.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_fdir.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 22 ++--- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 4 +- drivers/net/i40e/i40e_rxtx_vec_neon.c | 6 +- drivers/net/i40e/i40e_rxtx_vec_sse.c | 6 +- drivers/net/ixgbe/ixgbe_rxtx.c | 18 ++-- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 6 +- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 6 +- drivers/net/liquidio/lio_rxtx.c | 20 ++-- drivers/net/liquidio/lio_rxtx.h | 6 +- drivers/net/mrvl/mrvl_ethdev.c | 8 +- drivers/net/nfp/nfp_net.c | 8 +- drivers/net/octeontx/base/octeontx_pkovf.c | 4 +- drivers/net/octeontx/octeontx_rxtx.c | 2 +- drivers/net/qede/base/bcm_osal.c | 10 +- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/qede/qede_fdir.c | 2 +- drivers/net/qede/qede_rxtx.c | 16 ++-- drivers/net/sfc/efsys.h | 2 +- drivers/net/sfc/sfc.c | 4 +- drivers/net/sfc/sfc_ef10_rx.c | 4 +- drivers/net/sfc/sfc_ef10_tx.c | 6 +- drivers/net/sfc/sfc_rx.c | 2 +- drivers/net/sfc/sfc_tso.c | 4 +- drivers/net/sfc/sfc_tx.c | 2 +- drivers/net/thunderx/base/nicvf_hw.c | 2 +- drivers/net/thunderx/base/nicvf_hw.h | 2 +- drivers/net/thunderx/base/nicvf_hw_defs.h | 6 +- drivers/net/thunderx/nicvf_ethdev.c | 10 +- drivers/net/thunderx/nicvf_ethdev.h | 6 +- drivers/net/thunderx/nicvf_rxtx.h | 4 +- drivers/net/thunderx/nicvf_struct.h | 6 +- drivers/net/virtio/virtio_ethdev.c | 10 +- drivers/net/virtio/virtio_rxtx.h | 4 +- drivers/net/virtio/virtqueue.h | 6 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 10 +- drivers/net/vmxnet3/vmxnet3_rxtx.c | 8 +- examples/ipsec-secgw/esp.c | 12 +-- examples/l2fwd-crypto/main.c | 8 +- lib/librte_cryptodev/rte_crypto.h | 2 +- lib/librte_cryptodev/rte_crypto_sym.h | 6 +- lib/librte_cryptodev/rte_cryptodev.c | 2 +- lib/librte_cryptodev/rte_cryptodev.h | 2 +- lib/librte_eal/bsdapp/eal/eal_memory.c | 15 ++- lib/librte_eal/common/eal_common_memory.c | 4 +- lib/librte_eal/common/eal_common_memzone.c | 6 +- lib/librte_eal/common/include/rte_malloc.h | 17 +++- lib/librte_eal/common/include/rte_memory.h | 28 +++++- lib/librte_eal/common/include/rte_memzone.h | 6 +- lib/librte_eal/common/rte_malloc.c | 22 ++--- lib/librte_eal/linuxapp/eal/eal_memory.c | 40 ++++---- lib/librte_eal/linuxapp/eal/eal_vfio.c | 6 +- lib/librte_eal/rte_eal_version.map | 3 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_mbuf/rte_mbuf.c | 6 +- lib/librte_mbuf/rte_mbuf.h | 53 ++++++++--- lib/librte_mempool/rte_mempool.c | 111 +++++++++++++---------- lib/librte_mempool/rte_mempool.h | 86 +++++++++++------- lib/librte_mempool/rte_mempool_ops.c | 4 +- lib/librte_mempool/rte_mempool_version.map | 2 + lib/librte_vhost/vhost.h | 2 +- lib/librte_vhost/vhost_user.c | 4 +- lib/librte_vhost/virtio_net.c | 2 +- test/test/test_cryptodev.c | 42 ++++----- test/test/test_cryptodev.h | 4 +- test/test/test_mbuf.c | 2 +- test/test/test_mempool.c | 4 +- test/test/test_memzone.c | 80 ++++++++-------- 129 files changed, 708 insertions(+), 591 deletions(-)
Signature · 1 line
2.14.2
PATCH v4 1/15 mem: hide physical address error in VA mode
If the IOVA mode is not using physical addresses, no need to log an error about physical address issue.
--- lib/librte_eal/linuxapp/eal/eal_memory.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-)
lib/librte_eal/linuxapp/eal/eal_memory.c +5 -4
@@ -107,10 +107,11 @@ test_phys_addrs_available(void) physaddr =rte_mem_virt2phy (&tmp);if (physaddr ==RTE_BAD_PHYS_ADDR ) { -RTE_LOG (ERR ,EAL , -"Cannot obtain physical addresses: %s. " -"Only vfio will function.\n" , -strerror (errno)); +if (rte_eal_iova_mode () ==RTE_IOVA_PA ) +RTE_LOG (ERR ,EAL , +"Cannot obtain physical addresses: %s. " +"Only vfio will function.\n" , +strerror (errno)); phys_addrs_available = false; } }
Signature · 1 line
2.14.2
Re: [PATCH v4 01/15] mem: hide physical address error in VA mode
Quoted 5 lines · Thomas Monjalon
If the IOVA mode is not using physical addresses, no need to log an error about physical address issue.
Signed-off-by Thomas Monjalon <[email protected]>---
PATCH v4 2/15 mem: introduce IOVA type
In reply to Thomas MonjalonThe IO virtual addresses may be used instead of physical addresses. As IOVA is more generic, it should be used in most places instead of physical address wording.
--- lib/librte_eal/common/include/rte_memory.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
lib/librte_eal/common/include/rte_memory.h +9 -1
@@ -92,8 +92,16 @@ enum rte_page_sizes {*/ #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE) -typedef uint64_t phys_addr_t ;/**< Physical address definition. */ +typedef uint64_t phys_addr_t ;/**< Physical address. */ #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1) +/** +* IO virtual address type. +* When the physical addressing mode is in use, +* the translation from a virtual address to a physical address +* is a direct mapping, i.e. the same value. +*/ +typedef uint64_t rte_iova_t ; +#define RTE_BAD_IOVA ((rte_iova_t)-1)/** * Physical memory segment descriptor.
Signature · 1 line
2.14.2
Re: [PATCH v4 02/15] mem: introduce IOVA type
Quoted 16 lines · Thomas Monjalon
The IO virtual addresses may be used instead of physical addresses. As IOVA is more generic, it should be used in most places instead of physical address wording.
Signed-off-by Thomas Monjalon <[email protected]>--- lib/librte_eal/common/include/rte_memory.h | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)lib/librte_eal/common/include/rte_memory.h +0
-0@@ -92,8 +92,16 @@ enum rte_page_sizes {*/ #define __rte_cache_min_aligned __rte_aligned(RTE_CACHE_LINE_MIN_SIZE)
lib/librte_eal/common/include/rte_memory.h enum rte_page_sizes { · line 102
Quoted 10 lines
lib/librte_eal/common/include/rte_memory.h +7
-1-typedef uint64_t phys_addr_t ;/**< Physical address definition. */ +typedef uint64_t phys_addr_t ;/**< Physical address. */ #define RTE_BAD_PHYS_ADDR ((phys_addr_t)-1) +/** +* IO virtual address type. +* When the physical addressing mode is in use, +* the translation from a virtual address to a physical address +* is a direct mapping, i.e. the same value. +*/
I guess - that description applicable for iova=va mode
and for iova=pa mode - Need to do explicit virt2phy translation. I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.
With that:
Thanks.
Quoted 5 lines
lib/librte_eal/common/include/rte_memory.h +2
-0+typedef uint64_t rte_iova_t ; +#define RTE_BAD_IOVA ((rte_iova_t)-1)/** * Physical memory segment descriptor.
Re: [PATCH v4 02/15] mem: introduce IOVA type
06/11/2017 06:38, santosh:
Quoted 15 lines · Thomas Monjalon
Quoted 4 lines
The IO virtual addresses may be used instead of physical addresses. As IOVA is more generic, it should be used in most places instead of physical address wording.
Quoted 8 lines
Signed-off-by Thomas Monjalon <[email protected]>---
+/**
+ * IO virtual address type.
+ * When the physical addressing mode is in use,
+ * the translation from a virtual address to a physical address
+ * is a direct mapping, i.e. the same value.
+ */
Quoted 3 lines
I guess - that description applicable for iova=va mode
and for iova=pa mode - Need to do explicit virt2phy translation. I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.
Not sure to understand your comment.
Let me reword the description to be less ambiguous:
* When the physical addressing mode (IOVA as PA) is in use,
* the translation from an IO virtual address (IOVA) to a physical address
* is a direct mapping, i.e. the same value.
* Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.
Is this description correct?
Re: [PATCH v4 02/15] mem: introduce IOVA type
Quoted 20 lines · Thomas Monjalon
06/11/2017 06:38, santosh:
Quoted 13 lines · Thomas Monjalon
Quoted 4 lines
The IO virtual addresses may be used instead of physical addresses. As IOVA is more generic, it should be used in most places instead of physical address wording.
Quoted 8 lines
Signed-off-by Thomas Monjalon <[email protected]>---
+/**
+ * IO virtual address type.
+ * When the physical addressing mode is in use,
+ * the translation from a virtual address to a physical address
+ * is a direct mapping, i.e. the same value.
+ */Quoted 3 lines
I guess - that description applicable for iova=va mode
and for iova=pa mode - Need to do explicit virt2phy translation. I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.Not sure to understand your comment.
Let me reword the description to be less ambiguous:
Quoted 7 lines
* When the physical addressing mode (IOVA as PA) is in use,
* the translation from an IO virtual address (IOVA) to a physical address
* is a direct mapping, i.e. the same value.
* Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.Is this description correct?
Yes.
Re: [PATCH v4 02/15] mem: introduce IOVA type
06/11/2017 09:51, santosh:
Quoted 22 lines · Thomas Monjalon
Quoted 20 lines
06/11/2017 06:38, santosh:
Quoted 13 lines · Thomas Monjalon
Quoted 4 lines
The IO virtual addresses may be used instead of physical addresses. As IOVA is more generic, it should be used in most places instead of physical address wording.
Quoted 8 lines
Signed-off-by Thomas Monjalon <[email protected]>---
+/**
+ * IO virtual address type.
+ * When the physical addressing mode is in use,
+ * the translation from a virtual address to a physical address
+ * is a direct mapping, i.e. the same value.
+ */Quoted 3 lines
I guess - that description applicable for iova=va mode
and for iova=pa mode - Need to do explicit virt2phy translation. I believe you mis-wrote - s/physical addressing mode/virtual addressing mode.Not sure to understand your comment.
Let me reword the description to be less ambiguous:
Quoted 8 lines
Quoted 7 lines
* When the physical addressing mode (IOVA as PA) is in use,
* the translation from an IO virtual address (IOVA) to a physical address
* is a direct mapping, i.e. the same value.
* Otherwise, in virtual mode (IOVA as VA), an IOMMU may do the translation.Is this description correct?
Yes.
Good, so I can change the description with this one and add your ack, right?
PATCH v4 3/15 mem: rename segment address from physical to IOVA
In reply to Thomas MonjalonFrom: Santosh Shukla <[email protected]>
Renaming rte_memseg {.phys_addr} to {.iova}
Keep the deprecated name in an anonymous union to avoid breaking the API.
Use rte_iova_t and RTE_BAD_IOVA where appropriate in memory segment handling.
--- lib/librte_eal/bsdapp/eal/eal_memory.c | 8 ++++---- lib/librte_eal/common/eal_common_memory.c | 4 ++-- lib/librte_eal/common/include/rte_memory.h | 8 ++++++-- lib/librte_eal/common/rte_malloc.c | 6 +++--- lib/librte_eal/linuxapp/eal/eal_memory.c | 20 ++++++++++---------- lib/librte_eal/linuxapp/eal/eal_vfio.c | 6 +++--- 6 files changed, 28 insertions(+), 24 deletions(-)
lib/librte_eal/bsdapp/eal/eal_memory.c +4 -4
@@ -56,7 +56,7 @@ rte_mem_virt2phy(const void *virtaddr)/* XXX not implemented. This function is only used by * rte_mempool_virt2phy() when hugepages are disabled. */ (void )virtaddr; -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ; }int
@@ -73,7 +73,7 @@ rte_eal_hugepage_init(void)/* for debug purposes, hugetlbfs can be disabled */ if (internal_config.no_hugetlbfs) { addr =malloc (internal_config.memory); - mcfg->memseg[0 ].phys_addr = (phys_addr_t )(uintptr_t )addr; + mcfg->memseg[0 ].iova = (rte_iova_t )(uintptr_t )addr; mcfg->memseg[0 ].addr = addr; mcfg->memseg[0 ].hugepage_sz =RTE_PGSIZE_4K ; mcfg->memseg[0 ].len = internal_config.memory;
@@ -88,7 +88,7 @@ rte_eal_hugepage_init(void) hpi = &internal_config.hugepage_info[i];for (j =0 ; j < hpi->num_pages[0 ]; j++) {struct rte_memseg *seg; -uint64_t physaddr; +rte_iova_t physaddr;int error;size_t sysctl_size =sizeof (physaddr);char physaddr_str[64 ];
@@ -114,7 +114,7 @@ rte_eal_hugepage_init(void) seg = &mcfg->memseg[seg_idx++]; seg->addr = addr; - seg->phys_addr = physaddr; + seg->iova = physaddr; seg->hugepage_sz = hpi->hugepage_sz; seg->len = hpi->hugepage_sz; seg->nchannel = mcfg->nchannel;
lib/librte_eal/common/eal_common_memory.c +2 -2
@@ -95,11 +95,11 @@ rte_dump_physmem_layout(FILE *f)if (mcfg->memseg[i].addr ==NULL )break ; - fprintf(f, "Segment %u: phys:0x%"PRIx64", len:%zu, " + fprintf(f, "Segment %u: IOVA:0x%"PRIx64", len:%zu, " "virt:%p, socket_id:%"PRId32", " "hugepage_sz:%"PRIu64", nchannel:%"PRIx32", " "nrank:%"PRIx32"\n", i, - mcfg->memseg[i].phys_addr, + mcfg->memseg[i].iova, mcfg->memseg[i].len, mcfg->memseg[i].addr, mcfg->memseg[i].socket_id,
lib/librte_eal/common/include/rte_memory.h +6 -2
@@ -107,7 +107,11 @@ typedef uint64_t rte_iova_t;* Physical memory segment descriptor. */ struct rte_memseg { - phys_addr_t phys_addr; /**< Start physical address. */ + RTE_STD_C11 + union { +phys_addr_t phys_addr;/**< deprecated - Start physical address. */ +rte_iova_t iova;/**< Start IO address. */ + };RTE_STD_C11 union {void *addr;/**< Start virtual address. */
@@ -138,7 +142,7 @@ int rte_mem_lock_page(const void *virt);* @param virt * The virtual address. * @return -* The physical address or RTE_BAD_PHYS_ADDR on error. +* The physical address or RTE_BAD_IOVA on error. */ phys_addr_t rte_mem_virt2phy (const void *virt);
lib/librte_eal/common/rte_malloc.c +3 -3
@@ -255,13 +255,13 @@ rte_malloc_virt2phy(const void *addr)const struct malloc_elem *elem =malloc_elem_from_data (addr);if (elem ==NULL )return RTE_BAD_PHYS_ADDR ; -if (elem->ms->phys_addr ==RTE_BAD_PHYS_ADDR ) -return RTE_BAD_PHYS_ADDR ; +if (elem->ms->iova ==RTE_BAD_IOVA ) +return RTE_BAD_IOVA ;if (rte_eal_iova_mode () ==RTE_IOVA_VA ) paddr = (uintptr_t )addr;else - paddr = elem->ms->phys_addr + + paddr = elem->ms->iova + ((uintptr_t )addr - (uintptr_t )elem->ms->addr);return paddr; }
lib/librte_eal/linuxapp/eal/eal_memory.c +10 -10
@@ -133,7 +133,7 @@ rte_mem_virt2phy(const void *virtaddr)/* Cannot parse /proc/self/pagemap, no need to log errors everywhere */ if (!phys_addrs_available) -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ;/* standard page size */ page_size =getpagesize ();
@@ -142,7 +142,7 @@ rte_mem_virt2phy(const void *virtaddr)if (fd <0 ) {RTE_LOG (ERR ,EAL ,"%s(): cannot open /proc/self/pagemap: %s\n" , __func__,strerror (errno)); -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ; } virt_pfn = (unsigned long )virtaddr / page_size;
@@ -151,7 +151,7 @@ rte_mem_virt2phy(const void *virtaddr)RTE_LOG (ERR ,EAL ,"%s(): seek error in /proc/self/pagemap: %s\n" , __func__,strerror (errno));close (fd); -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ; } retval =read (fd, &page,PFN_MASK_SIZE );
@@ -159,12 +159,12 @@ rte_mem_virt2phy(const void *virtaddr)if (retval <0 ) {RTE_LOG (ERR ,EAL ,"%s(): cannot read /proc/self/pagemap: %s\n" , __func__,strerror (errno)); -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ; }else if (retval !=PFN_MASK_SIZE ) {RTE_LOG (ERR ,EAL ,"%s(): read %d bytes from /proc/self/pagemap " "but expected %d:\n" , __func__, retval,PFN_MASK_SIZE ); -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ; }/*
@@ -172,7 +172,7 @@ rte_mem_virt2phy(const void *virtaddr)* pagemap.txt in linux Documentation) */ if ((page &0x7fffffffffffffULL ) ==0 ) -return RTE_BAD_PHYS_ADDR ; +return RTE_BAD_IOVA ; physaddr = ((page &0x7fffffffffffffULL ) * page_size) + ((unsigned long )virtaddr % page_size);
@@ -1031,9 +1031,9 @@ rte_eal_hugepage_init(void)return -1 ; }if (rte_eal_iova_mode () ==RTE_IOVA_VA ) - mcfg->memseg[0 ].phys_addr = (uintptr_t )addr; + mcfg->memseg[0 ].iova = (uintptr_t )addr;else - mcfg->memseg[0 ].phys_addr =RTE_BAD_PHYS_ADDR ; + mcfg->memseg[0 ].iova =RTE_BAD_IOVA ; mcfg->memseg[0 ].addr = addr; mcfg->memseg[0 ].hugepage_sz =RTE_PGSIZE_4K ; mcfg->memseg[0 ].len = internal_config.memory;
@@ -1282,7 +1282,7 @@ rte_eal_hugepage_init(void)if (j ==RTE_MAX_MEMSEG )break ; - mcfg->memseg[j].phys_addr = hugepage[i].physaddr; + mcfg->memseg[j].iova = hugepage[i].physaddr; mcfg->memseg[j].addr = hugepage[i].final_va; mcfg->memseg[j].len = hugepage[i].size; mcfg->memseg[j].socket_id = hugepage[i].socket_id;
@@ -1293,7 +1293,7 @@ rte_eal_hugepage_init(void)#ifdef RTE_ARCH_PPC_64 /* Use the phy and virt address of the last page as segment * address for IBM Power architecture */ - mcfg->memseg[j].phys_addr = hugepage[i].physaddr; + mcfg->memseg[j].iova = hugepage[i].physaddr; mcfg->memseg[j].addr = hugepage[i].final_va;#endif mcfg->memseg[j].len += mcfg->memseg[j].hugepage_sz;
lib/librte_eal/linuxapp/eal/eal_vfio.c +3 -3
@@ -713,7 +713,7 @@ vfio_type1_dma_map(int vfio_container_fd)if (rte_eal_iova_mode () ==RTE_IOVA_VA ) dma_map.iova = dma_map.vaddr;else - dma_map.iova = ms[i].phys_addr; + dma_map.iova = ms[i].iova; dma_map.flags =VFIO_DMA_MAP_FLAG_READ |VFIO_DMA_MAP_FLAG_WRITE ; ret =ioctl (vfio_container_fd,VFIO_IOMMU_MAP_DMA , &dma_map);
@@ -772,7 +772,7 @@ vfio_spapr_dma_map(int vfio_container_fd)break ; create.window_size =RTE_MAX (create.window_size, - ms[i].phys_addr + ms[i].len); + ms[i].iova + ms[i].len); }/* sPAPR requires window size to be a power of 2 */
@@ -816,7 +816,7 @@ vfio_spapr_dma_map(int vfio_container_fd)if (rte_eal_iova_mode () ==RTE_IOVA_VA ) dma_map.iova = dma_map.vaddr;else - dma_map.iova = ms[i].phys_addr; + dma_map.iova = ms[i].iova; dma_map.flags =VFIO_DMA_MAP_FLAG_READ |VFIO_DMA_MAP_FLAG_WRITE ;
Signature · 1 line
2.14.2
PATCH v4 4/15 mem: rename address mapping function to IOVA
In reply to Thomas MonjalonThe function rte_mem_virt2phy() is kept and used in functions which works only with physical addresses.
For all other calls this function is replaced by rte_mem_virt2iova() which does a direct mapping (no conversion) in the VA case.
Note: the new function rte_mem_virt2iova() function matches the behaviour implemented in rte_mem_virt2phy() by the commit 680f6c12600f ("mem: honor IOVA mode in virt2phy")
--- drivers/bus/dpaa/base/qbman/qman.c | 2 +- drivers/bus/dpaa/base/qbman/qman.h | 2 +- drivers/net/bnxt/bnxt_ethdev.c | 8 ++++---- drivers/net/bnxt/bnxt_hwrm.c | 20 ++++++++++---------- drivers/net/bnxt/bnxt_ring.c | 4 ++-- drivers/net/bnxt/bnxt_vnic.c | 4 ++-- drivers/net/liquidio/lio_rxtx.c | 2 +- lib/librte_cryptodev/rte_cryptodev.c | 2 +- lib/librte_eal/bsdapp/eal/eal_memory.c | 5 +++++ lib/librte_eal/common/include/rte_memory.h | 10 ++++++++++ lib/librte_eal/linuxapp/eal/eal_memory.c | 11 ++++++++--- lib/librte_eal/rte_eal_version.map | 1 + lib/librte_mempool/rte_mempool.c | 4 ++-- lib/librte_vhost/vhost_user.c | 4 ++-- test/test/test_mempool.c | 4 ++-- 15 files changed, 52 insertions(+), 31 deletions(-)
drivers/bus/dpaa/base/qbman/qman.c +1 -1
@@ -1351,7 +1351,7 @@ int qman_init_fq(struct qman_fq *fq, u32 flags, struct qm_mcc_initfq *opts)memset (&mcc->initfq.fqd.context_a,0 ,sizeof (mcc->initfq.fqd.context_a)); }else { - phys_fq =rte_mem_virt2phy (fq); + phys_fq =rte_mem_virt2iova (fq);qm_fqd_stashing_set64 (&mcc->initfq.fqd, phys_fq); } }
drivers/bus/dpaa/base/qbman/qman.h +1 -1
@@ -240,7 +240,7 @@ struct qm_portal {#define EQCR_CARRYCLEAR (p) \ (void *)((unsigned long)(p) & (~(unsigned long)(QM_EQCR_SIZE << 6))) -extern dma_addr_t rte_mem_virt2phy (const void *addr); +extern dma_addr_t rte_mem_virt2iova (const void *addr);/* Bit-wise logic to convert a ring pointer to a ring index */ static inline u8 EQCR_PTR2IDX (struct qm_eqcr_entry *e)
drivers/net/bnxt/bnxt_ethdev.c +4 -4
@@ -2852,8 +2852,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); - mz_phys_addr =rte_mem_virt2phy (mz->addr); +"Using rte_mem_virt2iova()\n" ); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map address to physical memory\n" );
@@ -2887,8 +2887,8 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); - mz_phys_addr =rte_mem_virt2phy (mz->addr); +"Using rte_mem_virt2iova()\n" ); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map address to physical memory\n" );
drivers/net/bnxt/bnxt_hwrm.c +10 -10
@@ -277,7 +277,7 @@ int bnxt_hwrm_cfa_l2_set_rx_mask(struct bnxt *bp,if (!(mask &HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLAN_NONVLAN )) mask |=HWRM_CFA_L2_SET_RX_MASK_INPUT_MASK_VLANONLY ; req.vlan_tag_tbl_addr =rte_cpu_to_le_64 ( -rte_mem_virt2phy (vlan_table)); +rte_mem_virt2iova (vlan_table)); req.num_vlan_tags =rte_cpu_to_le_32 ((uint32_t )vlan_count); } req.mask =rte_cpu_to_le_32 (mask);
@@ -318,7 +318,7 @@ int bnxt_hwrm_cfa_vlan_antispoof_cfg(struct bnxt *bp, uint16_t fid, req.fid =rte_cpu_to_le_16 (fid); req.vlan_tag_mask_tbl_addr = -rte_cpu_to_le_64 (rte_mem_virt2phy (vlan_table)); +rte_cpu_to_le_64 (rte_mem_virt2iova (vlan_table)); req.num_vlan_entries =rte_cpu_to_le_32 ((uint32_t )vlan_count); rc =bnxt_hwrm_send_message (bp, &req,sizeof (req));
@@ -644,7 +644,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) }rte_mem_lock_page (bp->hwrm_cmd_resp_addr); bp->hwrm_cmd_resp_dma_addr = -rte_mem_virt2phy (bp->hwrm_cmd_resp_addr); +rte_mem_virt2iova (bp->hwrm_cmd_resp_addr);if (bp->hwrm_cmd_resp_dma_addr ==0 ) {RTE_LOG (ERR ,PMD ,"Unable to map response buffer to physical memory.\n" );
@@ -670,7 +670,7 @@ int bnxt_hwrm_ver_get(struct bnxt *bp) }rte_mem_lock_page (bp->hwrm_short_cmd_req_addr); bp->hwrm_short_cmd_req_dma_addr = -rte_mem_virt2phy (bp->hwrm_short_cmd_req_addr); +rte_mem_virt2iova (bp->hwrm_short_cmd_req_addr);if (bp->hwrm_short_cmd_req_dma_addr ==0 ) {rte_free (bp->hwrm_short_cmd_req_addr); RTE_LOG(ERR, PMD,
@@ -1753,7 +1753,7 @@ int bnxt_alloc_hwrm_resources(struct bnxt *bp)if (bp->hwrm_cmd_resp_addr ==NULL )return -ENOMEM ; bp->hwrm_cmd_resp_dma_addr = -rte_mem_virt2phy (bp->hwrm_cmd_resp_addr); +rte_mem_virt2iova (bp->hwrm_cmd_resp_addr);if (bp->hwrm_cmd_resp_dma_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -2622,7 +2622,7 @@ int bnxt_hwrm_func_buf_rgtr(struct bnxt *bp) page_getenum(bp->pf.active_vfs * HWRM_MAX_REQ_LEN)); req.req_buf_len =rte_cpu_to_le_16 (HWRM_MAX_REQ_LEN ); req.req_buf_page_addr[0 ] = -rte_cpu_to_le_64 (rte_mem_virt2phy (bp->pf.vf_req_buf)); +rte_cpu_to_le_64 (rte_mem_virt2iova (bp->pf.vf_req_buf));if (req.req_buf_page_addr[0 ] ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map buffer address to physical memory\n" );
@@ -3044,7 +3044,7 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)rte_mem_lock_page (buf);if (buf ==NULL )return -ENOMEM ; - dma_handle =rte_mem_virt2phy (buf); + dma_handle =rte_mem_virt2iova (buf);if (dma_handle ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -3080,7 +3080,7 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index,if (!buf)return -ENOMEM ; - dma_handle =rte_mem_virt2phy (buf); + dma_handle =rte_mem_virt2iova (buf);if (dma_handle ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -3141,7 +3141,7 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,if (!buf)return -ENOMEM ; - dma_handle =rte_mem_virt2phy (buf); + dma_handle =rte_mem_virt2iova (buf);if (dma_handle ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map response address to physical memory\n" );
@@ -3196,7 +3196,7 @@ static int bnxt_hwrm_func_vf_vnic_query(struct bnxt *bp, uint16_t vf, req.vf_id =rte_cpu_to_le_16 (bp->pf.first_vf_id + vf); req.max_vnic_id_cnt =rte_cpu_to_le_32 (bp->pf.total_vnics); - req.vnic_id_tbl_addr =rte_cpu_to_le_64 (rte_mem_virt2phy (vnic_ids)); + req.vnic_id_tbl_addr =rte_cpu_to_le_64 (rte_mem_virt2iova (vnic_ids));if (req.vnic_id_tbl_addr ==0 ) {HWRM_UNLOCK ();
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -177,10 +177,10 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); +"Using rte_mem_virt2iova()\n" );for (sz =0 ; sz < total_alloc_len; sz +=getpagesize ())rte_mem_lock_page (((char *)mz->addr) + sz); - mz_phys_addr =rte_mem_virt2phy (mz->addr); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map ring address to physical memory\n" );
drivers/net/bnxt/bnxt_vnic.c +2 -2
@@ -197,8 +197,8 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );RTE_LOG (WARNING ,PMD , -"Using rte_mem_virt2phy()\n" ); - mz_phys_addr =rte_mem_virt2phy (mz->addr); +"Using rte_mem_virt2iova()\n" ); + mz_phys_addr =rte_mem_virt2iova (mz->addr);if (mz_phys_addr ==0 ) {RTE_LOG (ERR ,PMD ,"unable to map vnic address to physical memory\n" );
drivers/net/liquidio/lio_rxtx.c +1 -1
@@ -1790,7 +1790,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) m = m->next; } - phyaddr =rte_mem_virt2phy (g->sg); + phyaddr =rte_mem_virt2iova (g->sg);if (phyaddr ==RTE_BAD_PHYS_ADDR ) {PMD_TX_LOG (lio_dev,ERR ,"bad phys addr\n" ); goto xmit_failed;
lib/librte_cryptodev/rte_cryptodev.c +1 -1
@@ -1284,7 +1284,7 @@ rte_crypto_op_init(struct rte_mempool *mempool,__rte_crypto_op_reset (op, type); - op->phys_addr =rte_mem_virt2phy (_op_data); + op->phys_addr =rte_mem_virt2iova (_op_data); op->mempool = mempool; }
lib/librte_eal/bsdapp/eal/eal_memory.c +5 -0
@@ -58,6 +58,11 @@ rte_mem_virt2phy(const void *virtaddr) (void )virtaddr;return RTE_BAD_IOVA ; } +rte_iova_t +rte_mem_virt2iova (const void *virtaddr) +{ +return rte_mem_virt2phy (virtaddr); +}int rte_eal_hugepage_init (void )
lib/librte_eal/common/include/rte_memory.h +10 -0
@@ -146,6 +146,16 @@ int rte_mem_lock_page(const void *virt);*/ phys_addr_t rte_mem_virt2phy (const void *virt); +/** +* Get IO virtual address of any mapped virtual address in the current process. +* +* @param virt +* The virtual address. +* @return +* The IO address or RTE_BAD_IOVA on error. +*/ +rte_iova_t rte_mem_virt2iova (const void *virt); +/** * Get the layout of the available physical memory. *
lib/librte_eal/linuxapp/eal/eal_memory.c +8 -3
@@ -128,9 +128,6 @@ rte_mem_virt2phy(const void *virtaddr)int page_size;off_t offset; -if (rte_eal_iova_mode () ==RTE_IOVA_VA ) -return (uintptr_t )virtaddr; -/* Cannot parse /proc/self/pagemap, no need to log errors everywhere */ if (!phys_addrs_available)return RTE_BAD_IOVA ;
@@ -180,6 +177,14 @@ rte_mem_virt2phy(const void *virtaddr)return physaddr; } +rte_iova_t +rte_mem_virt2iova (const void *virtaddr) +{ +if (rte_eal_iova_mode () ==RTE_IOVA_VA ) +return (uintptr_t )virtaddr; +return rte_mem_virt2phy (virtaddr); +} +/* * For each hugepage in hugepg_tbl, fill the physaddr value. We find * it by browsing the /proc/self/pagemap special file.
lib/librte_eal/rte_eal_version.map +1 -0
@@ -234,6 +234,7 @@ DPDK_17.11 { rte_eal_vfio_intr_mode; rte_lcore_has_role; rte_memcpy_ptr; + rte_mem_virt2iova; vfio_enable; vfio_is_enabled; vfio_noiommu_is_enabled;
lib/librte_mempool/rte_mempool.c +2 -2
@@ -503,7 +503,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,for (off =0 ; off + pg_sz <= len && mp->populated_size < mp->size; off += phys_len) { - paddr =rte_mem_virt2phy (addr + off); + paddr =rte_mem_virt2iova (addr + off);if (paddr ==RTE_BAD_PHYS_ADDR &&rte_eal_has_hugepages ()) { ret = -EINVAL ;
@@ -514,7 +514,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,for (phys_len = pg_sz; off + phys_len < len; phys_len += pg_sz) {phys_addr_t paddr_tmp; - paddr_tmp =rte_mem_virt2phy (addr + off + phys_len); + paddr_tmp =rte_mem_virt2iova (addr + off + phys_len);if (paddr_tmp != paddr + phys_len)break ;
lib/librte_vhost/vhost_user.c +2 -2
@@ -526,7 +526,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg,uint64_t host_phys_addr;uint64_t size; - host_phys_addr =rte_mem_virt2phy ((void *)(uintptr_t )host_user_addr); + host_phys_addr =rte_mem_virt2iova ((void *)(uintptr_t )host_user_addr); size = page_size - (guest_phys_addr & (page_size -1 )); size =RTE_MIN (size, reg_size);
@@ -537,7 +537,7 @@ add_guest_pages(struct virtio_net *dev, struct rte_vhost_mem_region *reg,while (reg_size >0 ) { size =RTE_MIN (reg_size, page_size); - host_phys_addr =rte_mem_virt2phy ((void *)(uintptr_t ) + host_phys_addr =rte_mem_virt2iova ((void *)(uintptr_t ) host_user_addr);add_one_guest_page (dev, guest_phys_addr, host_phys_addr, size);
test/test/test_mempool.c +2 -2
@@ -144,9 +144,9 @@ test_mempool_basic(struct rte_mempool *mp, int use_external_cache) MEMPOOL_HEADER_SIZE(mp, mp->cache_size))GOTO_ERR (ret, out); -#ifndef RTE_EXEC_ENV_BSDAPP /* rte_mem_virt2phy() not supported on bsd */ +#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_virt2phy (obj)) +if (rte_mempool_virt2phy (mp, obj) !=rte_mem_virt2iova (obj))GOTO_ERR (ret, out);#endif
Signature · 1 line
2.14.2
Re: [PATCH v4 04/15] mem: rename address mapping function to IOVA
Quoted 11 lines · Thomas Monjalon
The function
rte_mem_virt2phy()is kept and used in functions which works only with physical addresses.
For all other calls this function is replaced byrte_mem_virt2iova()which does a direct mapping (no conversion) in the VA case.Note: the new function
rte_mem_virt2iova()function matches the behaviour implemented inrte_mem_virt2phy()by the commit680f6c12600f("mem: honor IOVA mode in virt2phy")Signed-off-by Thomas Monjalon <[email protected]>---
Thanks.
PATCH v4 5/15 malloc: rename address mapping function to IOVA
In reply to Thomas MonjalonThe function rte_malloc_virt2phy() is renamed to rte_malloc_virt2iova(). The deprecated name is kept as an alias to avoid breaking the API.
--- 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(-)
app/test-crypto-perf/cperf_test_vector_parsing.c +2 -2
@@ -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;
app/test-crypto-perf/cperf_test_vectors.c +3 -3
@@ -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 ;
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
@@ -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 ;
drivers/net/ark/ark_ethdev_rx.c +2 -2
@@ -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))) {
drivers/net/ark/ark_ethdev_tx.c +2 -2
@@ -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);
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
@@ -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;
drivers/net/sfc/sfc_tso.c +1 -1
@@ -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 ;
examples/l2fwd-crypto/main.c +1 -1
@@ -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
lib/librte_eal/common/eal_common_memzone.c +1 -1
@@ -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;
lib/librte_eal/common/include/rte_malloc.h +12 -5
@@ -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 }
lib/librte_eal/common/rte_malloc.c +8 -8
@@ -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; }
lib/librte_eal/rte_eal_version.map +1 -1
@@ -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;
Signature · 1 line
2.14.2
Re: [PATCH v4 05/15] malloc: rename address mapping function to IOVA
Quoted 5 lines · Thomas Monjalon
The function
rte_malloc_virt2phy()is renamed torte_malloc_virt2iova(). The deprecated name is kept as an alias to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>---
PATCH v4 6/15 malloc: use pointer diff macro in IOVA mapping
In reply to Thomas MonjalonFrom: Santosh Shukla <[email protected]>
Use RTE_PTR_DIFF macro in rte_mem_virt2iova api.
--- lib/librte_eal/common/rte_malloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
lib/librte_eal/common/rte_malloc.c +1 -1
@@ -262,6 +262,6 @@ rte_malloc_virt2iova(const void *addr) iova = (uintptr_t )addr; else iova = elem->ms->iova + - ((uintptr_t )addr - (uintptr_t )elem->ms->addr); +RTE_PTR_DIFF (addr, elem->ms->addr);return iova; }
Signature · 1 line
2.14.2
PATCH v4 7/15 memzone: rename address from physical to IOVA
In reply to Thomas MonjalonThe struct rte_memzone field .phys_addr is renamed to .iova. The deprecated name is kept in an anonymous union to avoid breaking the API.
--- drivers/crypto/qat/qat_qp.c | 2 +- drivers/net/bnx2x/bnx2x.c | 2 +- drivers/net/bnx2x/bnx2x_rxtx.c | 6 +-- drivers/net/bnxt/bnxt_ethdev.c | 4 +- drivers/net/bnxt/bnxt_ring.c | 4 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- drivers/net/cxgbe/sge.c | 2 +- drivers/net/e1000/em_rxtx.c | 4 +- drivers/net/e1000/igb_rxtx.c | 4 +- drivers/net/ena/base/ena_plat_dpdk.h | 4 +- drivers/net/enic/enic_main.c | 6 +-- drivers/net/fm10k/fm10k_ethdev.c | 4 +- drivers/net/i40e/i40e_ethdev.c | 2 +- drivers/net/i40e/i40e_fdir.c | 2 +- drivers/net/i40e/i40e_rxtx.c | 8 +-- drivers/net/ixgbe/ixgbe_rxtx.c | 4 +- drivers/net/liquidio/lio_rxtx.c | 6 +-- drivers/net/nfp/nfp_net.c | 4 +- drivers/net/qede/base/bcm_osal.c | 10 ++-- drivers/net/qede/qede_fdir.c | 2 +- drivers/net/sfc/sfc.c | 2 +- drivers/net/thunderx/nicvf_ethdev.c | 6 +-- drivers/net/virtio/virtio_ethdev.c | 8 +-- drivers/net/vmxnet3/vmxnet3_ethdev.c | 8 +-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 +- lib/librte_eal/common/eal_common_memzone.c | 6 +-- lib/librte_eal/common/include/rte_memzone.h | 6 ++- lib/librte_mempool/rte_mempool.c | 4 +- test/test/test_memzone.c | 80 ++++++++++++++--------------- 29 files changed, 105 insertions(+), 101 deletions(-)
drivers/crypto/qat/qat_qp.c +1 -1
@@ -373,7 +373,7 @@ qat_queue_create(struct rte_cryptodev *dev, struct qat_queue *queue, } queue->base_addr = (char *)qp_mz->addr; - queue->base_phys_addr = qp_mz->phys_addr; + queue->base_phys_addr = qp_mz->iova;if (qat_qp_check_queue_alignment (queue->base_phys_addr, queue_size_bytes)) { PMD_DRV_LOG(ERR, "Invalid alignment on queue create "
drivers/net/bnx2x/bnx2x.c +1 -1
@@ -184,7 +184,7 @@ bnx2x_dma_alloc(struct bnx2x_softc *sc, size_t size, struct bnx2x_dma *dma,PMD_DRV_LOG (ERR ,"DMA alloc failed for %s" , msg);return -ENOMEM ; } - dma->paddr = (uint64_t ) z->phys_addr; + dma->paddr = (uint64_t ) z->iova; dma->vaddr = z->addr;PMD_DRV_LOG (DEBUG ,"%s: virt=%p phys=%" PRIx64, msg, dma->vaddr, dma->paddr);
drivers/net/bnx2x/bnx2x_rxtx.c +3 -3
@@ -108,7 +108,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,bnx2x_rx_queue_release (rxq);return -ENOMEM ; } - fp->rx_desc_mapping = rxq->rx_ring_phys_addr = (uint64_t )dma->phys_addr; + fp->rx_desc_mapping = rxq->rx_ring_phys_addr = (uint64_t )dma->iova; rxq->rx_ring = (uint64_t *)dma->addr;memset ((void *)rxq->rx_ring,0 , dma_size);
@@ -154,7 +154,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,PMD_RX_LOG (ERR ,"RCQ alloc failed" );return -ENOMEM ; } - fp->rx_comp_mapping = rxq->cq_ring_phys_addr = (uint64_t )dma->phys_addr; + fp->rx_comp_mapping = rxq->cq_ring_phys_addr = (uint64_t )dma->iova; rxq->cq_ring = (union eth_rx_cqe *)dma->addr;/* Link the CQ chain pages. */
@@ -289,7 +289,7 @@ bnx2x_dev_tx_queue_setup(struct rte_eth_dev *dev,bnx2x_tx_queue_release (txq);return -ENOMEM ; } - fp->tx_desc_mapping = txq->tx_ring_phys_addr = (uint64_t )tz->phys_addr; + fp->tx_desc_mapping = txq->tx_ring_phys_addr = (uint64_t )tz->iova; txq->tx_ring = (union eth_tx_bd_types *) tz->addr;memset (txq->tx_ring,0 , tsize);
drivers/net/bnxt/bnxt_ethdev.c +2 -2
@@ -2847,7 +2847,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)return -ENOMEM ; }memset (mz->addr,0 , mz->len); - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova;if ((unsigned long )mz->addr == mz_phys_addr) {RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );
@@ -2882,7 +2882,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)return -ENOMEM ; }memset (mz->addr,0 , mz->len); - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova;if ((unsigned long )mz->addr == mz_phys_addr) {RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );
drivers/net/bnxt/bnxt_ring.c +2 -2
@@ -172,7 +172,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,return -ENOMEM ; }memset (mz->addr,0 , mz->len); - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova;if ((unsigned long )mz->addr == mz_phys_addr) {RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );
@@ -231,7 +231,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx, rx_ring->bd = ((char *)mz->addr + ag_ring_start); rx_ring_info->ag_desc_ring = (struct rx_prod_pkt_bd *)rx_ring->bd; - rx_ring->bd_dma = mz->phys_addr + ag_ring_start; + rx_ring->bd_dma = mz->iova + ag_ring_start; rx_ring_info->ag_desc_mapping = rx_ring->bd_dma; rx_ring->mem_zone = (const void *)mz;
drivers/net/bnxt/bnxt_vnic.c +1 -1
@@ -192,7 +192,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp)if (!mz)return -ENOMEM ; } - mz_phys_addr = mz->phys_addr; + mz_phys_addr = mz->iova;if ((unsigned long )mz->addr == mz_phys_addr) {RTE_LOG (WARNING ,PMD ,"Memzone physical address same as virtual.\n" );
drivers/net/cxgbe/sge.c +1 -1
@@ -1318,7 +1318,7 @@ static void *alloc_ring(size_t nelem, size_t elem_size,if (metadata) *(void **)metadata = s; - *phys = (uint64_t )tz->phys_addr; + *phys = (uint64_t )tz->iova;return tz->addr; }
drivers/net/e1000/em_rxtx.c +2 -2
@@ -1289,7 +1289,7 @@ eth_em_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->tdt_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_TDT (queue_idx)); - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (struct e1000_data_desc *) tz->addr; PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
@@ -1416,7 +1416,7 @@ eth_em_rx_queue_setup(struct rte_eth_dev *dev, rxq->rdt_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_RDT (queue_idx)); rxq->rdh_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_RDH (queue_idx)); - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (struct e1000_rx_desc *) rz->addr; PMD_INIT_LOG(DEBUG, "sw_ring=%p hw_ring=%p dma_addr=0x%"PRIx64,
drivers/net/e1000/igb_rxtx.c +2 -2
@@ -1553,7 +1553,7 @@ eth_igb_tx_queue_setup(struct rte_eth_dev *dev, txq->port_id = dev->data->port_id; txq->tdt_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_TDT (txq->reg_idx)); - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (union e1000_adv_tx_desc *) tz->addr;/* Allocate software ring */
@@ -1690,7 +1690,7 @@ eth_igb_rx_queue_setup(struct rte_eth_dev *dev, } rxq->rdt_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_RDT (rxq->reg_idx)); rxq->rdh_reg_addr =E1000_PCI_REG_ADDR (hw,E1000_RDH (rxq->reg_idx)); - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union e1000_adv_rx_desc *) rz->addr;/* Allocate software ring. */
drivers/net/ena/base/ena_plat_dpdk.h +2 -2
@@ -191,7 +191,7 @@ typedef uint64_t dma_addr_t; mz =rte_memzone_reserve (z_name, size,SOCKET_ID_ANY ,0 ); \memset (mz->addr,0 , size); \ virt = mz->addr; \ - phys = mz->phys_addr; \ + phys = mz->iova; \ handle = mz; \ }while (0 ) #define ENA_MEM_FREE_COHERENT(dmadev, size, virt, phys, handle) \
@@ -209,7 +209,7 @@ typedef uint64_t dma_addr_t; mz =rte_memzone_reserve (z_name, size, node,0 ); \memset (mz->addr,0 , size); \ virt = mz->addr; \ - phys = mz->phys_addr; \ + phys = mz->iova; \ }while (0 ) #define ENA_MEM_ALLOC_NODE(dmadev, size, virt, node, dev_node) \
drivers/net/enic/enic_main.c +3 -3
@@ -283,7 +283,7 @@ void enic_init_vnic_resources(struct enic *enic)0 /* cq_entry_enable */ ,1 /* cq_message_enable */ ,0 /* interrupt offset */ , - (u64)enic->wq[index].cqmsg_rz->phys_addr); + (u64)enic->wq[index].cqmsg_rz->iova); } vnic_intr_init(&enic->intr,
@@ -362,7 +362,7 @@ enic_alloc_consistent(void *priv, size_t size, } vaddr = rz->addr; - *dma_handle = (dma_addr_t )rz->phys_addr; + *dma_handle = (dma_addr_t )rz->iova; mze =rte_malloc ("enic memzone entry" ,sizeof (struct enic_memzone_entry ),0 );
@@ -395,7 +395,7 @@ enic_free_consistent(void *priv,rte_spinlock_lock (&enic->memzone_list_lock); LIST_FOREACH(mze, &enic->memzone_list, entries) {if (mze->rz->addr == vaddr && - mze->rz->phys_addr == dma_handle) + mze->rz->iova == dma_handle)break ; }if (mze ==NULL ) {
drivers/net/fm10k/fm10k_ethdev.c +2 -2
@@ -1893,7 +1893,7 @@ fm10k_rx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,return -ENOMEM ; } q->hw_ring = mz->addr; - q->hw_ring_phys_addr = mz->phys_addr; + q->hw_ring_phys_addr = mz->iova;/* Check if number of descs satisfied Vector requirement */ if (!rte_is_power_of_2 (nb_desc)) {
@@ -2053,7 +2053,7 @@ fm10k_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_id,return -ENOMEM ; } q->hw_ring = mz->addr; - q->hw_ring_phys_addr = mz->phys_addr; + q->hw_ring_phys_addr = mz->iova;/* * allocate memory for the RS bit tracker. Enough slots to hold the
drivers/net/i40e/i40e_ethdev.c +1 -1
@@ -3842,7 +3842,7 @@ i40e_allocate_dma_mem_d(__attribute__((unused)) struct i40e_hw *hw, mem->size = size; mem->va = mz->addr; - mem->pa = mz->phys_addr; + mem->pa = mz->iova; mem->zone = (const void *)mz; PMD_DRV_LOG(DEBUG, "memzone %s allocated with physical address: %"PRIu64,
drivers/net/i40e/i40e_fdir.c +1 -1
@@ -265,7 +265,7 @@ i40e_fdir_setup(struct i40e_pf *pf) goto fail_mem; } pf->fdir.prg_pkt = mz->addr; - pf->fdir.dma_addr = mz->phys_addr; + pf->fdir.dma_addr = mz->iova; pf->fdir.match_counter_index =I40E_COUNTER_INDEX_FDIR (hw->pf_id); PMD_DRV_LOG(INFO, "FDIR setup successfully, with programming queue %u.",
drivers/net/i40e/i40e_rxtx.c +4 -4
@@ -1823,7 +1823,7 @@ i40e_dev_rx_queue_setup(struct rte_eth_dev *dev,/* Zero all the descriptors in the ring. */ memset (rz->addr,0 , ring_size); - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union i40e_rx_desc *)rz->addr; len = (uint16_t )(nb_desc +RTE_PMD_I40E_RX_MAX_BURST );
@@ -2161,7 +2161,7 @@ i40e_dev_tx_queue_setup(struct rte_eth_dev *dev, txq->vsi = vsi; txq->tx_deferred_start = tx_conf->tx_deferred_start; - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (struct i40e_tx_desc *)tz->addr;/* Allocate software ring */
@@ -2695,7 +2695,7 @@ i40e_fdir_setup_tx_resources(struct i40e_pf *pf) txq->reg_idx = pf->fdir.fdir_vsi->base_queue; txq->vsi = pf->fdir.fdir_vsi; - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (struct i40e_tx_desc *)tz->addr;/* * don't need to allocate software ring and reset for the fdir
@@ -2751,7 +2751,7 @@ i40e_fdir_setup_rx_resources(struct i40e_pf *pf) rxq->reg_idx = pf->fdir.fdir_vsi->base_queue; rxq->vsi = pf->fdir.fdir_vsi; - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union i40e_rx_desc *)rz->addr;/*
drivers/net/ixgbe/ixgbe_rxtx.c +2 -2
@@ -2599,7 +2599,7 @@ ixgbe_dev_tx_queue_setup(struct rte_eth_dev *dev,else txq->tdt_reg_addr =IXGBE_PCI_REG_ADDR (hw,IXGBE_TDT (txq->reg_idx)); - txq->tx_ring_phys_addr = tz->phys_addr; + txq->tx_ring_phys_addr = tz->iova; txq->tx_ring = (union ixgbe_adv_tx_desc *) tz->addr;/* Allocate software ring */
@@ -2901,7 +2901,7 @@ ixgbe_dev_rx_queue_setup(struct rte_eth_dev *dev,IXGBE_PCI_REG_ADDR (hw,IXGBE_RDH (rxq->reg_idx)); } - rxq->rx_ring_phys_addr = rz->phys_addr; + rxq->rx_ring_phys_addr = rz->iova; rxq->rx_ring = (union ixgbe_adv_rx_desc *) rz->addr;/*
drivers/net/liquidio/lio_rxtx.c +3 -3
@@ -172,7 +172,7 @@ lio_alloc_info_buffer(struct lio_device *lio_dev,if (droq->info_mz ==NULL )return NULL ; - droq->info_list_dma = droq->info_mz->phys_addr; + droq->info_list_dma = droq->info_mz->iova; droq->info_alloc_size = droq->info_mz->len; droq->info_base_addr = (size_t )droq->info_mz->addr;
@@ -222,7 +222,7 @@ lio_init_droq(struct lio_device *lio_dev, uint32_t q_no,return -1 ; } - droq->desc_ring_dma = droq->desc_ring_mz->phys_addr; + droq->desc_ring_dma = droq->desc_ring_mz->iova; droq->desc_ring = (struct lio_droq_desc *)droq->desc_ring_mz->addr; lio_dev_dbg(lio_dev, "droq[%d]: desc_ring: virt: 0x%p, dma: %lx\n",
@@ -734,7 +734,7 @@ lio_init_instr_queue(struct lio_device *lio_dev,return -1 ; } - iq->base_addr_dma = iq->iq_mz->phys_addr; + iq->base_addr_dma = iq->iq_mz->iova; iq->base_addr = (uint8_t *)iq->iq_mz->addr; iq->max_count = num_descs;
drivers/net/nfp/nfp_net.c +2 -2
@@ -1562,7 +1562,7 @@ nfp_net_rx_queue_setup(struct rte_eth_dev *dev, }/* Saving physical and virtual addresses for the RX ring */ - rxq->dma = (uint64_t )tz->phys_addr; + rxq->dma = (uint64_t )tz->iova; rxq->rxds = (struct nfp_net_rx_desc *)tz->addr;/* mbuf pointers array for referencing mbufs linked to RX descriptors */
@@ -1718,7 +1718,7 @@ nfp_net_tx_queue_setup(struct rte_eth_dev *dev, uint16_t queue_idx, txq->txq_flags = tx_conf->txq_flags;/* Saving physical and virtual addresses for the TX ring */ - txq->dma = (uint64_t )tz->phys_addr; + txq->dma = (uint64_t )tz->iova; txq->txds = (struct nfp_net_tx_desc *)tz->addr;/* mbuf pointers array for referencing mbufs linked to TX descriptors */
drivers/net/qede/base/bcm_osal.c +5 -5
@@ -144,12 +144,12 @@ void *osal_dma_alloc_coherent(struct ecore_dev *p_dev, *phys =0 ;return OSAL_NULL ; } - *phys = mz->phys_addr; + *phys = mz->iova; ecore_mz_mapping[ecore_mz_count++] = mz;DP_VERBOSE (p_dev,ECORE_MSG_SP ,"Allocated dma memory size=%zu phys=0x%lx" " virt=%p core=%d\n" , - mz->len, (unsigned long )mz->phys_addr, mz->addr, core_id); + mz->len, (unsigned long )mz->iova, mz->addr, core_id);return mz->addr; }
@@ -182,12 +182,12 @@ void *osal_dma_alloc_coherent_aligned(struct ecore_dev *p_dev, *phys =0 ;return OSAL_NULL ; } - *phys = mz->phys_addr; + *phys = mz->iova; ecore_mz_mapping[ecore_mz_count++] = mz;DP_VERBOSE (p_dev,ECORE_MSG_SP ,"Allocated aligned dma memory size=%zu phys=0x%lx" " virt=%p core=%d\n" , - mz->len, (unsigned long )mz->phys_addr, mz->addr, core_id); + mz->len, (unsigned long )mz->iova, mz->addr, core_id);return mz->addr; }
@@ -196,7 +196,7 @@ void osal_dma_free_mem(struct ecore_dev *p_dev, dma_addr_t phys)uint16_t j;for (j =0 ; j < ecore_mz_count; j++) { -if (phys == ecore_mz_mapping[j]->phys_addr) { +if (phys == ecore_mz_mapping[j]->iova) {DP_VERBOSE (p_dev,ECORE_MSG_SP ,"Free memzone %s\n" , ecore_mz_mapping[j]->name);rte_memzone_free (ecore_mz_mapping[j]);
drivers/net/qede/qede_fdir.c +1 -1
@@ -172,7 +172,7 @@ qede_config_cmn_fdir_filter(struct rte_eth_dev *eth_dev, }/* configure filter with ECORE_SPQ_MODE_EBLOCK */ rc =ecore_configure_rfs_ntuple_filter (p_hwfn,NULL , - (dma_addr_t )mz->phys_addr, + (dma_addr_t )mz->iova, pkt_len, fdir_filter->action.rx_queue,0 , add);
drivers/net/sfc/sfc.c +1 -1
@@ -61,7 +61,7 @@ sfc_dma_alloc(const struct sfc_adapter *sa, const char *name, uint16_t id,return ENOMEM ; } - esmp->esm_addr = mz->phys_addr; + esmp->esm_addr = mz->iova;if (esmp->esm_addr ==RTE_BAD_PHYS_ADDR ) { (void )rte_memzone_free (mz);return EFAULT ;
drivers/net/thunderx/nicvf_ethdev.c +3 -3
@@ -605,7 +605,7 @@ nicvf_qset_cq_alloc(struct rte_eth_dev *dev, struct nicvf *nic,memset (rz->addr,0 , ring_size); - rxq->phys = rz->phys_addr; + rxq->phys = rz->iova; rxq->desc = rz->addr; rxq->qlen_mask = desc_cnt -1 ;
@@ -629,7 +629,7 @@ nicvf_qset_sq_alloc(struct rte_eth_dev *dev, struct nicvf *nic,memset (rz->addr,0 , ring_size); - sq->phys = rz->phys_addr; + sq->phys = rz->iova; sq->desc = rz->addr; sq->qlen_mask = desc_cnt -1 ;
@@ -663,7 +663,7 @@ nicvf_qset_rbdr_alloc(struct rte_eth_dev *dev, struct nicvf *nic,memset (rz->addr,0 , ring_size); - rbdr->phys = rz->phys_addr; + rbdr->phys = rz->iova; rbdr->tail =0 ; rbdr->next_tail =0 ; rbdr->desc = rz->addr;
drivers/net/virtio/virtio_ethdev.c +4 -4
@@ -428,10 +428,10 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)memset (mz->addr,0 , mz->len); - vq->vq_ring_mem = mz->phys_addr; + vq->vq_ring_mem = mz->iova; vq->vq_ring_virt_mem = mz->addr;PMD_INIT_LOG (DEBUG ,"vq->vq_ring_mem: 0x%" PRIx64, - (uint64_t )mz->phys_addr); + (uint64_t )mz->iova);PMD_INIT_LOG (DEBUG ,"vq->vq_ring_virt_mem: 0x%" PRIx64, (uint64_t )(uintptr_t )mz->addr);
@@ -476,13 +476,13 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx) txvq->port_id = dev->data->port_id; txvq->mz = mz; txvq->virtio_net_hdr_mz = hdr_mz; - txvq->virtio_net_hdr_mem = hdr_mz->phys_addr; + txvq->virtio_net_hdr_mem = hdr_mz->iova; }else if (queue_type ==VTNET_CQ ) { cvq = &vq->cq; cvq->vq = vq; cvq->mz = mz; cvq->virtio_net_hdr_mz = hdr_mz; - cvq->virtio_net_hdr_mem = hdr_mz->phys_addr; + cvq->virtio_net_hdr_mem = hdr_mz->iova;memset (cvq->virtio_net_hdr_mz->addr,0 ,PAGE_SIZE ); hw->cvq = cvq;
drivers/net/vmxnet3/vmxnet3_ethdev.c +4 -4
@@ -484,7 +484,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)memset (mz->addr,0 , mz->len); hw->shared = mz->addr; - hw->sharedPA = mz->phys_addr; + hw->sharedPA = mz->iova;/* * Allocate a memzone for Vmxnet3_RxQueueDesc - Vmxnet3_TxQueueDesc
@@ -505,7 +505,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev) hw->tqd_start = (Vmxnet3_TxQueueDesc *)mz->addr; hw->rqd_start = (Vmxnet3_RxQueueDesc *)(hw->tqd_start + hw->num_tx_queues); - hw->queueDescPA = mz->phys_addr; + hw->queueDescPA = mz->iova; hw->queue_desc_len = (uint16_t )size;if (dev->data->dev_conf.rxmode.mq_mode ==ETH_MQ_RX_RSS ) {
@@ -521,7 +521,7 @@ vmxnet3_dev_configure(struct rte_eth_dev *dev)memset (mz->addr,0 , mz->len); hw->rss_conf = mz->addr; - hw->rss_confPA = mz->phys_addr; + hw->rss_confPA = mz->iova; }return 0 ;
@@ -569,7 +569,7 @@ vmxnet3_dev_setup_memreg(struct rte_eth_dev *dev) }memset (mz->addr,0 , mz->len); hw->memRegs = mz->addr; - hw->memRegsPA = mz->phys_addr; + hw->memRegsPA = mz->iova; } num = hw->num_rx_queues;
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -2
@@ -979,7 +979,7 @@ vmxnet3_dev_tx_queue_setup(struct rte_eth_dev *dev,/* cmd_ring initialization */ ring->base = mz->addr; - ring->basePA = mz->phys_addr; + ring->basePA = mz->iova;/* comp_ring initialization */ comp_ring->base = ring->base + ring->size;
@@ -1090,7 +1090,7 @@ vmxnet3_dev_rx_queue_setup(struct rte_eth_dev *dev,/* cmd_ring0 initialization */ ring0->base = mz->addr; - ring0->basePA = mz->phys_addr; + ring0->basePA = mz->iova;/* cmd_ring1 initialization */ ring1->base = ring0->base + ring0->size;
lib/librte_eal/common/eal_common_memzone.c +3 -3
@@ -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_virt2iova (mz_addr); + mz->iova =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;
@@ -391,10 +391,10 @@ rte_memzone_dump(FILE *f)for (i=0 ; i<RTE_MAX_MEMZONE ; i++) {if (mcfg->memzone[i].addr ==NULL )break ; - fprintf(f, "Zone %u: name:<%s>, phys:0x%"PRIx64", len:0x%zx" + fprintf(f, "Zone %u: name:<%s>, IO:0x%"PRIx64", len:0x%zx" ", virt:%p, socket_id:%"PRId32", flags:%"PRIx32"\n", i, mcfg->memzone[i].name, - mcfg->memzone[i].phys_addr, + mcfg->memzone[i].iova, mcfg->memzone[i].len, mcfg->memzone[i].addr, mcfg->memzone[i].socket_id,
lib/librte_eal/common/include/rte_memzone.h +5 -1
@@ -78,7 +78,11 @@ struct rte_memzone {#define RTE_MEMZONE_NAMESIZE 32/**< Maximum length of memory zone name.*/ char name[RTE_MEMZONE_NAMESIZE ];/**< Name of the memory zone. */ -phys_addr_t phys_addr;/**< Start physical address. */ +RTE_STD_C11 + union { +phys_addr_t phys_addr;/**< deprecated - Start physical address. */ +rte_iova_t iova;/**< Start IO address. */ + };RTE_STD_C11 union {void *addr;/**< Start virtual address. */
lib/librte_mempool/rte_mempool.c +2 -2
@@ -601,7 +601,7 @@ rte_mempool_populate_default(struct rte_mempool *mp)if (mp->flags &MEMPOOL_F_NO_PHYS_CONTIG ) paddr =RTE_BAD_PHYS_ADDR ;else - paddr = mz->phys_addr; + paddr = mz->iova;if (rte_eal_has_hugepages ()) ret = rte_mempool_populate_phys(mp, mz->addr,
@@ -1213,7 +1213,7 @@ rte_mempool_dump(FILE *f, struct rte_mempool *mp)fprintf (f,"mempool <%s>@%p\n" , mp->name, mp);fprintf (f," flags=%x\n" , mp->flags);fprintf (f," pool=%p\n" , mp->pool_data); -fprintf (f," phys_addr=0x%" PRIx64"\n" , mp->mz->phys_addr); +fprintf (f," iova=0x%" PRIx64"\n" , mp->mz->iova);fprintf (f," nb_mem_chunks=%u\n" , mp->nb_mem_chunks);fprintf (f," size=%" PRIu32"\n" , mp->size);fprintf (f," populated_size=%" PRIu32"\n" , mp->populated_size);
test/test/test_memzone.c +40 -40
168 lines not on this page · raw message
Signature · 1 line
2.14.2
Re: [PATCH v4 07/15] memzone: rename address from physical to IOVA
Quoted 6 lines · Thomas Monjalon
The struct
rte_memzonefield .phys_addr is renamed to .iova. The deprecated name is kept in an anonymous union to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>---
PATCH v4 8/15 mempool: rename addresses from physical to IOVA
In reply to Thomas MonjalonThe struct fields phys_addr_t rte_mempool_objhdr.physaddr and rte_mempool_memhdr.phys_addr are renamed to rte_iova_t iova. The deprecated names are kept in an anonymous union to avoid breaking the API.
--- drivers/mempool/dpaa2/dpaa2_hw_mempool.h | 2 +- drivers/mempool/octeontx/octeontx_fpavf.c | 2 +- drivers/mempool/octeontx/rte_mempool_octeontx.c | 2 +- drivers/net/thunderx/nicvf_ethdev.h | 2 +- drivers/net/vmxnet3/vmxnet3_ethdev.c | 2 +- lib/librte_mempool/rte_mempool.c | 64 ++++++++++++------------- lib/librte_mempool/rte_mempool.h | 40 +++++++++------- lib/librte_mempool/rte_mempool_ops.c | 4 +- 8 files changed, 62 insertions(+), 56 deletions(-)
drivers/mempool/dpaa2/dpaa2_hw_mempool.h +1 -1
@@ -39,7 +39,7 @@struct buf_pool_cfg {void *addr;/**< The address from where DPAA2 will carve out the buffers */ -phys_addr_t phys_addr; +rte_iova_t phys_addr;/**< Physical address of the memory provided in addr */ uint32_t num;/**< Number of buffers */
drivers/mempool/octeontx/octeontx_fpavf.c +1 -1
@@ -221,7 +221,7 @@ octeontx_fpapf_pool_setup(unsigned int gpool, unsigned int buf_size, signed short buf_offset, unsigned int max_buf_count) { void *memptr = NULL; -phys_addr_t phys_addr; +rte_iova_t phys_addr;unsigned int memsz;struct fpavf_res *fpa =NULL ;uint64_t reg;
drivers/mempool/octeontx/rte_mempool_octeontx.c +1 -1
@@ -220,7 +220,7 @@ octeontx_fpavf_get_capabilities(const struct rte_mempool *mp,static int octeontx_fpavf_register_memory_area (const struct rte_mempool *mp, -char *vaddr,phys_addr_t paddr,size_t len) +char *vaddr,rte_iova_t paddr,size_t len) {struct octeontx_pool_info *pool_info;
drivers/net/thunderx/nicvf_ethdev.h +1 -1
@@ -78,7 +78,7 @@ nicvf_mempool_phy_offset(struct rte_mempool *mp) hdr =STAILQ_FIRST (&mp->mem_list);assert (hdr !=NULL ); -return (uint64_t )((uintptr_t )hdr->addr - hdr->phys_addr); +return (uint64_t )((uintptr_t )hdr->addr - hdr->iova); } static inline uint16_t
drivers/net/vmxnet3/vmxnet3_ethdev.c +1 -1
@@ -604,7 +604,7 @@ vmxnet3_dev_setup_memreg(struct rte_eth_dev *dev)Vmxnet3_MemoryRegion *mr = &hw->memRegs->memRegs[j]; mr->startPA = - (uintptr_t )STAILQ_FIRST (&mp[i]->mem_list)->phys_addr; + (uintptr_t )STAILQ_FIRST (&mp[i]->mem_list)->iova; mr->length =STAILQ_FIRST (&mp[i]->mem_list)->len <=INT32_MAX ?STAILQ_FIRST (&mp[i]->mem_list)->len :INT32_MAX ; mr->txQueueBits = index[i];
lib/librte_mempool/rte_mempool.c +32 -32
174 lines not on this page · raw message
lib/librte_mempool/rte_mempool.h +23 -17
@@ -157,7 +157,11 @@ struct rte_mempool_objsz {struct rte_mempool_objhdr {STAILQ_ENTRY (rte_mempool_objhdr) next;/**< Next in list. */ struct rte_mempool *mp;/**< The mempool owning the object. */ -phys_addr_t physaddr;/**< Physical address of the object. */ +RTE_STD_C11 + union { + rte_iova_t iova; /**< IO address of the object. */ +phys_addr_t physaddr;/**< deprecated - Physical address of the object. */ + };#ifdef RTE_LIBRTE_MEMPOOL_DEBUG uint64_t cookie;/**< Debug cookie. */ #endif
@@ -203,7 +207,11 @@ struct rte_mempool_memhdr {STAILQ_ENTRY (rte_mempool_memhdr) next;/**< Next in list. */ struct rte_mempool *mp;/**< The mempool owning the chunk */ void *addr;/**< Virtual address of the chunk */ -phys_addr_t phys_addr;/**< Physical address of the chunk */ +RTE_STD_C11 + union { +rte_iova_t iova;/**< IO address of the chunk */ +phys_addr_t phys_addr;/**< Physical address of the chunk */ + };size_t len;/**< length of the chunk */ rte_mempool_memchunk_free_cb_t *free_cb;/**< Free callback */ void *opaque;/**< Argument passed to the free callback */
@@ -417,7 +425,7 @@ typedef int (*rte_mempool_get_capabilities_t)(const struct rte_mempool *mp,* Notify new memory area to mempool. */ typedef int (*rte_mempool_ops_register_memory_area_t ) -(const struct rte_mempool *mp,char *vaddr,phys_addr_t paddr,size_t len); +(const struct rte_mempool *mp,char *vaddr,rte_iova_t iova,size_t len);/** Structure defining mempool operations structure */ struct rte_mempool_ops {
@@ -570,8 +578,8 @@ rte_mempool_ops_get_capabilities(const struct rte_mempool *mp,* Pointer to the memory pool. * @param vaddr * Pointer to the buffer virtual address. -* @param paddr -* Pointer to the buffer physical address. +* @param iova +* Pointer to the buffer IO address. * @param len * Pool size. * @return
@@ -581,7 +589,7 @@ rte_mempool_ops_get_capabilities(const struct rte_mempool *mp,*/ int rte_mempool_ops_register_memory_area (const struct rte_mempool *mp, -char *vaddr,phys_addr_t paddr,size_t len); +char *vaddr,rte_iova_t iova,size_t len);/** * @internal wrapper for mempool_ops free callback.
@@ -797,11 +805,10 @@ rte_mempool_create(const char *name, unsigned n, unsigned elt_size,* @param vaddr * Virtual address of the externally allocated memory buffer. * Will be used to store mempool objects. -* @param paddr -* Array of physical addresses of the pages that comprises given memory -* buffer. +* @param iova +* Array of IO addresses of the pages that comprises given memory buffer. * @param pg_num -* Number of elements in the paddr array. +* Number of elements in the iova array. * @param pg_shift * LOG2 of the physical pages size. * @return
@@ -814,7 +821,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size, rte_mempool_ctor_t *mp_init, void *mp_init_arg, rte_mempool_obj_cb_t *obj_init, void *obj_init_arg, int socket_id, unsigned flags, void *vaddr, - const phys_addr_t paddr[], uint32_t pg_num, uint32_t pg_shift); + const rte_iova_t iova[], uint32_t pg_num, uint32_t pg_shift);/** * Create an empty mempool
@@ -1462,7 +1469,7 @@ rte_mempool_virt2phy(__rte_unused const struct rte_mempool *mp, const void *elt)const struct rte_mempool_objhdr *hdr; hdr = (const struct rte_mempool_objhdr *)RTE_PTR_SUB (elt,sizeof (*hdr)); -return hdr->physaddr; +return hdr->iova; }/**
@@ -1573,11 +1580,10 @@ size_t rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz,* @param total_elt_sz * The size of each element, including header and trailer, as returned * by rte_mempool_calc_obj_size(). -* @param paddr -* Array of physical addresses of the pages that comprises given memory -* buffer. +* @param iova +* Array of IO addresses of the pages that comprises given memory buffer. * @param pg_num -* Number of elements in the paddr array. +* Number of elements in the iova array. * @param pg_shift * LOG2 of the physical pages size. * @param flags
@@ -1589,7 +1595,7 @@ size_t rte_mempool_xmem_size(uint32_t elt_num, size_t total_elt_sz,* is the actual number of elements that can be stored in that buffer. */ ssize_t rte_mempool_xmem_usage (void *vaddr,uint32_t elt_num, -size_t total_elt_sz,const phys_addr_t paddr[],uint32_t pg_num, +size_t total_elt_sz,const rte_iova_t iova[],uint32_t pg_num,uint32_t pg_shift,unsigned int flags);/**
lib/librte_mempool/rte_mempool_ops.c +2 -2
@@ -142,14 +142,14 @@ rte_mempool_ops_get_capabilities(const struct rte_mempool *mp,/* wrapper to notify new memory area to external mempool */ int rte_mempool_ops_register_memory_area (const struct rte_mempool *mp,char *vaddr, -phys_addr_t paddr,size_t len) +rte_iova_t iova,size_t len) {struct rte_mempool_ops *ops; ops =rte_mempool_get_ops (mp->ops_index);RTE_FUNC_PTR_OR_ERR_RET (ops->register_memory_area, -ENOTSUP ); -return ops->register_memory_area (mp, vaddr, paddr, len); +return ops->register_memory_area (mp, vaddr, iova, len); }/* sets mempool ops previously registered by rte_mempool_register_ops. */
Signature · 1 line
2.14.2
Re: [PATCH v4 08/15] mempool: rename addresses from physical to IOVA
Quoted 7 lines · Thomas Monjalon
The struct fields
phys_addr_trte_mempool_objhdr.physaddr and rte_mempool_memhdr.phys_addr are renamed torte_iova_tiova. The deprecated names are kept in an anonymous union to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>---
Re: [PATCH v4 08/15] mempool: rename addresses from physical to IOVA
In reply to Thomas MonjalonQuoted 6 lines · Thomas Monjalon
The struct fields
phys_addr_trte_mempool_objhdr.physaddr and rte_mempool_memhdr.phys_addr are renamed torte_iova_tiova. The deprecated names are kept in an anonymous union to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>
PATCH v4 9/15 mempool: rename address mapping function to IOVA
In reply to Thomas MonjalonThe 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.
--- 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(-)
app/test-crypto-perf/cperf_test_common.c +2 -2
@@ -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 {
drivers/crypto/qat/qat_crypto.c +1 -1
@@ -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 ;
drivers/crypto/qat/qat_qp.c +2 -4
@@ -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); }
drivers/mempool/dpaa/dpaa_mempool.c +2 -2
@@ -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 ; }
drivers/mempool/dpaa2/dpaa2_hw_mempool.c +2 -2
@@ -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;
lib/librte_eal/bsdapp/eal/eal_memory.c +1 -1
@@ -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 ; }
lib/librte_mbuf/rte_mbuf.c +1 -1
@@ -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 */
lib/librte_mbuf/rte_mbuf.h +1 -1
@@ -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 ;
lib/librte_mempool/rte_mempool.h +12 -7
@@ -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. *
test/test/test_mempool.c +1 -1
@@ -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
Signature · 1 line
2.14.2
Re: [PATCH v4 09/15] mempool: rename address mapping function to IOVA
Quoted 6 lines · Thomas Monjalon
The function
rte_mempool_virt2phy()is renamed torte_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 <[email protected]>---
Re: [PATCH v4 09/15] mempool: rename address mapping function to IOVA
In reply to Thomas MonjalonQuoted 5 lines · Thomas Monjalon
The function
rte_mempool_virt2phy()is renamed torte_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 <[email protected]>
PATCH v4 10/15 mempool: rename populate functions to IOVA
In reply to Thomas MonjalonThe functions rte_mempool_populate_phys() and rte_mempool_populate_phys_tab() are renamed to rte_mempool_populate_iova() and rte_mempool_populate_iova_tab(). The deprecated functions are kept as aliases to avoid breaking the API.
--- lib/librte_mempool/rte_mempool.c | 51 ++++++++++++++++++++---------- lib/librte_mempool/rte_mempool.h | 27 ++++++++++------ lib/librte_mempool/rte_mempool_version.map | 2 ++ 3 files changed, 54 insertions(+), 26 deletions(-)
lib/librte_mempool/rte_mempool.c +34 -17
@@ -357,8 +357,8 @@ rte_mempool_free_memchunks(struct rte_mempool *mp)* on error. */ int -rte_mempool_populate_phys (struct rte_mempool *mp,char *vaddr, -phys_addr_t paddr,size_t len,rte_mempool_memchunk_free_cb_t *free_cb, +rte_mempool_populate_iova (struct rte_mempool *mp,char *vaddr, +rte_iova_t iova,size_t len,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque) {unsigned total_elt_sz;
@@ -368,7 +368,7 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,int ret;/* Notify memory area to mempool */ - ret =rte_mempool_ops_register_memory_area (mp, vaddr, paddr, len); + ret =rte_mempool_ops_register_memory_area (mp, vaddr, iova, len);if (ret != -ENOTSUP && ret <0 )return ret;
@@ -402,7 +402,7 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr, memhdr->mp = mp; memhdr->addr = vaddr; - memhdr->iova = paddr; + memhdr->iova = iova; memhdr->len = len; memhdr->free_cb = free_cb; memhdr->opaque = opaque;
@@ -417,11 +417,11 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,while (off + total_elt_sz <= len && mp->populated_size < mp->size) { off += mp->header_size; -if (paddr ==RTE_BAD_PHYS_ADDR ) +if (iova ==RTE_BAD_IOVA )mempool_add_elem (mp, (char *)vaddr + off, -RTE_BAD_PHYS_ADDR ); +RTE_BAD_IOVA );else -mempool_add_elem (mp, (char *)vaddr + off, paddr + off); +mempool_add_elem (mp, (char *)vaddr + off, iova + off); off += mp->elt_size + mp->trailer_size; i++; }
@@ -435,12 +435,20 @@ rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,return i; } +int +rte_mempool_populate_phys (struct rte_mempool *mp,char *vaddr, +phys_addr_t paddr,size_t len,rte_mempool_memchunk_free_cb_t *free_cb, +void *opaque) +{ +return rte_mempool_populate_iova (mp, vaddr, paddr, len, free_cb, opaque); +} +/* Add objects in the pool, using a table of physical pages. Return the * number of objects added, or a negative value on error. */ int -rte_mempool_populate_phys_tab (struct rte_mempool *mp,char *vaddr, -const phys_addr_t paddr[],uint32_t pg_num,uint32_t pg_shift, +rte_mempool_populate_iova_tab (struct rte_mempool *mp,char *vaddr, +const rte_iova_t iova[],uint32_t pg_num,uint32_t pg_shift,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque) {uint32_t i, n;
@@ -452,18 +460,18 @@ rte_mempool_populate_phys_tab(struct rte_mempool *mp, char *vaddr,return -EEXIST ;if (mp->flags &MEMPOOL_F_NO_PHYS_CONTIG ) -return rte_mempool_populate_phys (mp, vaddr,RTE_BAD_PHYS_ADDR , +return rte_mempool_populate_iova (mp, vaddr,RTE_BAD_IOVA , pg_num * pg_sz, free_cb, opaque);for (i =0 ; i < pg_num && mp->populated_size < mp->size; i += n) {/* populate with the largest group of contiguous pages */ for (n =1 ; (i + n) < pg_num && - paddr[i + n -1 ] + pg_sz == paddr[i + n]; n++) + iova[i + n -1 ] + pg_sz == iova[i + n]; n++) ; - ret =rte_mempool_populate_phys (mp, vaddr + i * pg_sz, - paddr[i], n * pg_sz, free_cb, opaque); + ret =rte_mempool_populate_iova (mp, vaddr + i * pg_sz, + iova[i], n * pg_sz, free_cb, opaque);if (ret <0 ) {rte_mempool_free_memchunks (mp);return ret;
@@ -475,6 +483,15 @@ rte_mempool_populate_phys_tab(struct rte_mempool *mp, char *vaddr,return cnt; } +int +rte_mempool_populate_phys_tab (struct rte_mempool *mp,char *vaddr, +const phys_addr_t paddr[],uint32_t pg_num,uint32_t pg_shift, +rte_mempool_memchunk_free_cb_t *free_cb,void *opaque) +{ +return rte_mempool_populate_iova_tab (mp, vaddr, paddr, pg_num, pg_shift, + free_cb, opaque); +} +/* Populate the mempool with a virtual area. Return the number of * objects added, or a negative value on error. */
@@ -497,7 +514,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,return -EINVAL ;if (mp->flags &MEMPOOL_F_NO_PHYS_CONTIG ) -return rte_mempool_populate_phys (mp, addr,RTE_BAD_PHYS_ADDR , +return rte_mempool_populate_iova (mp, addr,RTE_BAD_IOVA , len, free_cb, opaque); for (off = 0; off + pg_sz <= len &&
@@ -520,7 +537,7 @@ rte_mempool_populate_virt(struct rte_mempool *mp, char *addr,break ; } - ret =rte_mempool_populate_phys (mp, addr + off, iova, + ret =rte_mempool_populate_iova (mp, addr + off, iova, phys_len, free_cb, opaque);if (ret <0 ) goto fail;
@@ -604,7 +621,7 @@ rte_mempool_populate_default(struct rte_mempool *mp) iova = mz->iova;if (rte_eal_has_hugepages ()) - ret =rte_mempool_populate_phys (mp, mz->addr, + ret =rte_mempool_populate_iova (mp, mz->addr, iova, mz->len, rte_mempool_memchunk_mz_free, (void *)(uintptr_t )mz);
@@ -990,7 +1007,7 @@ rte_mempool_xmem_create(const char *name, unsigned n, unsigned elt_size,if (mp_init)mp_init (mp, mp_init_arg); - ret =rte_mempool_populate_phys_tab (mp, vaddr, iova, pg_num, pg_shift, + ret =rte_mempool_populate_iova_tab (mp, vaddr, iova, pg_num, pg_shift,NULL ,NULL );if (ret <0 || ret != (int )mp->size) goto fail;
lib/librte_mempool/rte_mempool.h +18 -9
@@ -880,7 +880,7 @@ rte_mempool_free(struct rte_mempool *mp);* Add a virtually and physically contiguous memory chunk in the pool * where objects can be instantiated. * -* If the given physical address is unknown (paddr = RTE_BAD_PHYS_ADDR), +* If the given IO address is unknown (iova = RTE_BAD_IOVA), * the chunk doesn't need to be physically contiguous (only virtually), * and allocated objects may span two pages. *
@@ -888,8 +888,8 @@ rte_mempool_free(struct rte_mempool *mp);* A pointer to the mempool structure. * @param vaddr * The virtual address of memory that should be used to store objects. -* @param paddr -* The physical address +* @param iova +* The IO address * @param len * The length of memory in bytes. * @param free_cb
@@ -901,6 +901,11 @@ rte_mempool_free(struct rte_mempool *mp);* On error, the chunk is not added in the memory list of the * mempool and a negative errno is returned. */ +int rte_mempool_populate_iova (struct rte_mempool *mp,char *vaddr, +rte_iova_t iova,size_t len,rte_mempool_memchunk_free_cb_t *free_cb, +void *opaque); + +__rte_deprecated int rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,phys_addr_t paddr,size_t len,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque);
@@ -909,18 +914,17 @@ int rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,* Add physical memory for objects in the pool at init * * Add a virtually contiguous memory chunk in the pool where objects can -* be instantiated. The physical addresses corresponding to the virtual -* area are described in paddr[], pg_num, pg_shift. +* be instantiated. The IO addresses corresponding to the virtual +* area are described in iova[], pg_num, pg_shift. * * @param mp * A pointer to the mempool structure. * @param vaddr * The virtual address of memory that should be used to store objects. -* @param paddr -* An array of physical addresses of each page composing the virtual -* area. +* @param iova +* An array of IO addresses of each page composing the virtual area. * @param pg_num -* Number of elements in the paddr array. +* Number of elements in the iova array. * @param pg_shift * LOG2 of the physical pages size. * @param free_cb
@@ -932,6 +936,11 @@ int rte_mempool_populate_phys(struct rte_mempool *mp, char *vaddr,* On error, the chunks are not added in the memory list of the * mempool and a negative errno is returned. */ +int rte_mempool_populate_iova_tab (struct rte_mempool *mp,char *vaddr, +const rte_iova_t iova[],uint32_t pg_num,uint32_t pg_shift, +rte_mempool_memchunk_free_cb_t *free_cb,void *opaque); + +__rte_deprecated int rte_mempool_populate_phys_tab(struct rte_mempool *mp, char *vaddr,const phys_addr_t paddr[],uint32_t pg_num,uint32_t pg_shift,rte_mempool_memchunk_free_cb_t *free_cb,void *opaque);
lib/librte_mempool/rte_mempool_version.map +2 -0
@@ -47,5 +47,7 @@ DPDK_17.11 { rte_mempool_ops_get_capabilities; rte_mempool_ops_register_memory_area; + rte_mempool_populate_iova; + rte_mempool_populate_iova_tab; } DPDK_16.07;
Signature · 1 line
2.14.2
Re: [PATCH v4 10/15] mempool: rename populate functions to IOVA
Quoted 6 lines · Thomas Monjalon
The functions
rte_mempool_populate_phys()andrte_mempool_populate_phys_tab()are renamed torte_mempool_populate_iova()andrte_mempool_populate_iova_tab(). The deprecated functions are kept as aliases to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>
I agree with the changes of that patch too.
However, after the patches, few references to phys address still remain in rte_mempool.h. Some examples below:
/** Mempool over one chunk of physically continuous memory */
#define MEMPOOL_PG_NUM_DEFAULT 1
...
* The memory chunks where objects are stored. Each chunk is virtually
* and physically contiguous.
...
#define MEMPOOL_F_NO_PHYS_CONTIG 0x0020 /**< Don't need physically contiguous objs. */ /**
* This capability flag is advertised by a mempool handler, if the whole
* memory area containing the objects must be physically contiguous.
* Note: This flag should not be passed by application.
*/
#define MEMPOOL_F_CAPA_PHYS_CONTIG 0x0040
...
* - Mempool driver must also set MEMPOOL_F_CAPA_PHYS_CONTIG flag along with
* MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS.
...
* - Otherwise, rte_mempool_populate_phys fails thus pool create fails.
...
* - MEMPOOL_F_NO_PHYS_CONTIG: If set, allocated objects won't
* necessarily be contiguous in physical memory.
...
...
I think we should also change them to IO.
Re: [PATCH v4 10/15] mempool: rename populate functions to IOVA
06/11/2017 16:49, Olivier MATZ:
Quoted 36 lines · Thomas Monjalon
Quoted 6 lines
The functions
rte_mempool_populate_phys()andrte_mempool_populate_phys_tab()are renamed torte_mempool_populate_iova()andrte_mempool_populate_iova_tab(). The deprecated functions are kept as aliases to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>I agree with the changes of that patch too.
However, after the patches, few references to phys address still remain inrte_mempool.h. Some examples below:/** Mempool over one chunk of physically continuous memory */
#defineMEMPOOL_PG_NUM_DEFAULT1
...
* The memory chunks where objects are stored. Each chunk is virtually
* and physically contiguous.
...
#defineMEMPOOL_F_NO_PHYS_CONTIG0x0020/**< Don't need physically contiguous objs. */ /**
* This capability flag is advertised by a mempool handler, if the whole
* memory area containing the objects must be physically contiguous.
* Note: This flag should not be passed by application.
*/
#defineMEMPOOL_F_CAPA_PHYS_CONTIG0x0040
...
* - Mempool driver must also setMEMPOOL_F_CAPA_PHYS_CONTIGflag along with
*MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS.
...
* - Otherwise,rte_mempool_populate_physfails thus pool create fails.
...
* -MEMPOOL_F_NO_PHYS_CONTIG: If set, allocated objects won't
* necessarily be contiguous in physical memory.
...
...
Quoted 1 line
I think we should also change them to IO.
Yes I did not change them because I was not sure how to word it. Feel free to send a patch for the flags and few other doxygen comments. Thanks
Olivier MATZ
Acked-byRe: [PATCH v4 10/15] mempool: rename populate functions to IOVA
Quoted 37 lines · Thomas Monjalon
06/11/2017 16:49, Olivier MATZ:
Quoted 36 lines · Thomas Monjalon
Quoted 6 lines
The functions
rte_mempool_populate_phys()andrte_mempool_populate_phys_tab()are renamed torte_mempool_populate_iova()andrte_mempool_populate_iova_tab(). The deprecated functions are kept as aliases to avoid breaking the API.Signed-off-by Thomas Monjalon <[email protected]>I agree with the changes of that patch too.
However, after the patches, few references to phys address still remain inrte_mempool.h. Some examples below:/** Mempool over one chunk of physically continuous memory */
#defineMEMPOOL_PG_NUM_DEFAULT1
...
* The memory chunks where objects are stored. Each chunk is virtually
* and physically contiguous.
...
#defineMEMPOOL_F_NO_PHYS_CONTIG0x0020/**< Don't need physically contiguous objs. */ /**
* This capability flag is advertised by a mempool handler, if the whole
* memory area containing the objects must be physically contiguous.
* Note: This flag should not be passed by application.
*/
#defineMEMPOOL_F_CAPA_PHYS_CONTIG0x0040
...
* - Mempool driver must also setMEMPOOL_F_CAPA_PHYS_CONTIGflag along with
*MEMPOOL_F_CAPA_BLK_ALIGNED_OBJECTS.
...
* - Otherwise,rte_mempool_populate_physfails thus pool create fails.
...
* -MEMPOOL_F_NO_PHYS_CONTIG: If set, allocated objects won't
* necessarily be contiguous in physical memory.
...
...
Quoted 4 lines
Quoted 1 line
I think we should also change them to IO.
Yes I did not change them because I was not sure how to word it. Feel free to send a patch for the flags and few other doxygen comments.
Ok, we can do it in another iteration.
Thanks for the rework.
PATCH v4 11/15 mbuf: rename physical address to IOVA
In reply to Thomas MonjalonFrom: Santosh Shukla <[email protected]>
Rename buf_physaddr to buf_iova.
Keep the deprecated name in an anonymous union to avoid breaking the API.
--- app/test-crypto-perf/cperf_test_common.c | 4 ++-- doc/guides/prog_guide/img/mbuf1.svg | 2 +- drivers/bus/fslmc/portal/dpaa2_hw_pvt.h | 2 +- drivers/crypto/dpaa_sec/dpaa_sec.c | 4 ++-- drivers/net/ark/ark_ethdev_rx.c | 8 ++++---- drivers/net/bnx2x/bnx2x_rxtx.c | 4 ++-- drivers/net/bnxt/bnxt_ring.h | 2 +- drivers/net/cxgbe/sge.c | 4 ++-- drivers/net/dpaa/dpaa_rxtx.c | 6 +++--- drivers/net/ena/ena_ethdev.c | 6 +++--- drivers/net/enic/enic_main.c | 2 +- drivers/net/enic/enic_rxtx.c | 6 +++--- drivers/net/fm10k/fm10k.h | 4 ++-- drivers/net/fm10k/fm10k_rxtx_vec.c | 4 ++-- drivers/net/i40e/i40e_rxtx_vec_altivec.c | 4 ++-- drivers/net/i40e/i40e_rxtx_vec_neon.c | 6 +++--- drivers/net/i40e/i40e_rxtx_vec_sse.c | 6 +++--- drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c | 6 +++--- drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c | 6 +++--- drivers/net/nfp/nfp_net.c | 2 +- drivers/net/virtio/virtio_ethdev.c | 2 +- drivers/net/virtio/virtqueue.h | 2 +- lib/librte_kni/rte_kni.c | 2 +- lib/librte_mbuf/rte_mbuf.c | 6 +++--- lib/librte_mbuf/rte_mbuf.h | 18 +++++++++++------- lib/librte_vhost/virtio_net.c | 2 +- test/test/test_mbuf.c | 2 +- 27 files changed, 63 insertions(+), 59 deletions(-)
app/test-crypto-perf/cperf_test_common.c +2 -2
@@ -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_virt2iova (obj) + + m->buf_iova =rte_mempool_virt2iova (obj) + mbuf_offset + mbuf_hdr_size; m->buf_len = segment_sz; m->data_len = segment_sz;
@@ -81,7 +81,7 @@ fill_multi_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 = next_seg_phys_addr; + m->buf_iova = next_seg_phys_addr; next_seg_phys_addr += mbuf_hdr_size + segment_sz; m->buf_len = segment_sz; m->data_len = segment_sz;
doc/guides/prog_guide/img/mbuf1.svg +1 -1
@@ -482,7 +482,7 @@ sodipodi:role="line" x="187.85715" y="347.7193" - id="tspan5240">(m->buf_physaddr is the</tspan><tspan + id="tspan5240">(m->buf_iova is the</tspan><tspan sodipodi:role="line" x="187.85715" y="360.2193"
drivers/bus/fslmc/portal/dpaa2_hw_pvt.h +1 -1
@@ -314,7 +314,7 @@ static phys_addr_t dpaa2_mem_vtop(uint64_t vaddr)* These routines are called with help of below MACRO's */ -#define DPAA2_MBUF_VADDR_TO_IOVA (mbuf) ((mbuf)->buf_physaddr) +#define DPAA2_MBUF_VADDR_TO_IOVA (mbuf) ((mbuf)->buf_iova)#define DPAA2_OP_VADDR_TO_IOVA (op) (op->phys_addr)/**
drivers/crypto/dpaa_sec/dpaa_sec.c +2 -2
@@ -798,9 +798,9 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses) uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, ses->iv.offset); - src_start_addr = sym->m_src->buf_physaddr + sym->m_src->data_off; + src_start_addr = sym->m_src->buf_iova + sym->m_src->data_off;if (sym->m_dst) - dst_start_addr = sym->m_dst->buf_physaddr + sym->m_dst->data_off; + dst_start_addr = sym->m_dst->buf_iova + sym->m_dst->data_off;else dst_start_addr = src_start_addr;
drivers/net/ark/ark_ethdev_rx.c +4 -4
@@ -499,22 +499,22 @@ eth_ark_rx_seed_mbufs(struct ark_rx_queue *queue)case 0 :while (count != nb) { queue->paddress_q[seed_m++] = - (*mbufs++)->buf_physaddr; + (*mbufs++)->buf_iova; count++;/* FALLTHROUGH */ case 3 : queue->paddress_q[seed_m++] = - (*mbufs++)->buf_physaddr; + (*mbufs++)->buf_iova; count++;/* FALLTHROUGH */ case 2 : queue->paddress_q[seed_m++] = - (*mbufs++)->buf_physaddr; + (*mbufs++)->buf_iova; count++;/* FALLTHROUGH */ case 1 : queue->paddress_q[seed_m++] = - (*mbufs++)->buf_physaddr; + (*mbufs++)->buf_iova; count++;/* FALLTHROUGH */
drivers/net/bnx2x/bnx2x_rxtx.c +2 -2
@@ -140,7 +140,7 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,return -ENOMEM ; } rxq->sw_ring[idx] = mbuf; - rxq->rx_ring[idx] = mbuf->buf_physaddr; + rxq->rx_ring[idx] = mbuf->buf_iova; } rxq->pkt_first_seg =NULL ; rxq->pkt_last_seg =NULL ;
@@ -400,7 +400,7 @@ bnx2x_recv_pkts(void *p_rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rx_mb = rxq->sw_ring[bd_cons]; rxq->sw_ring[bd_cons] = new_mb; - rxq->rx_ring[bd_prod] = new_mb->buf_physaddr; + rxq->rx_ring[bd_prod] = new_mb->buf_iova; rx_pref =NEXT_RX_BD (bd_cons) &MAX_RX_BD (rxq);rte_prefetch0 (rxq->sw_ring[rx_pref]);
drivers/net/bnxt/bnxt_ring.h +1 -1
@@ -41,7 +41,7 @@#define RING_NEXT (ring, idx) (((idx) + 1) & (ring)->ring_mask)#define RTE_MBUF_DATA_DMA_ADDR (mb) \ - ((uint64_t)((mb)->buf_physaddr + (mb)->data_off)) + ((uint64_t)((mb)->buf_iova + (mb)->data_off))#define DB_IDX_MASK 0xffffff#define DB_IDX_VALID (0x1 << 26)
drivers/net/cxgbe/sge.c +2 -2
@@ -149,7 +149,7 @@ static int map_mbuf(struct rte_mbuf *mbuf, dma_addr_t *addr)struct rte_mbuf *m = mbuf;for (; m; m = m->next, addr++) { - *addr = m->buf_physaddr +rte_pktmbuf_headroom (m); + *addr = m->buf_iova +rte_pktmbuf_headroom (m);if (*addr ==0 ) goto out_err; }
@@ -423,7 +423,7 @@ static unsigned int refill_fl_usembufs(struct adapter *adap, struct sge_fl *q, mbuf->nb_segs =1 ; mbuf->port = rxq->rspq.port_id; - mapping = (dma_addr_t )RTE_ALIGN (mbuf->buf_physaddr + + mapping = (dma_addr_t )RTE_ALIGN (mbuf->buf_iova + mbuf->data_off, adap->sge.fl_align); mapping |= buf_size_idx;
drivers/net/dpaa/dpaa_rxtx.c +3 -3
@@ -77,7 +77,7 @@ (_fd)->opaque =QM_FD_CONTIG <<DPAA_FD_FORMAT_SHIFT ; \ (_fd)->opaque |= ((_mbuf)->data_off) <<DPAA_FD_OFFSET_SHIFT ; \ (_fd)->opaque |= (_mbuf)->pkt_len; \ - (_fd)->addr = (_mbuf)->buf_physaddr; \ + (_fd)->addr = (_mbuf)->buf_iova; \ (_fd)->bpid = _bpid; \ }while (0 )
@@ -514,7 +514,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, sgt = temp->buf_addr + temp->data_off; fd->format =QM_FD_SG ; - fd->addr = temp->buf_physaddr; + fd->addr = temp->buf_iova; fd->offset = temp->data_off; fd->bpid = bpid; fd->length20 = mbuf->pkt_len;
@@ -523,7 +523,7 @@ dpaa_eth_mbuf_to_sg_fd(struct rte_mbuf *mbuf, sg_temp = &sgt[i++]; sg_temp->opaque =0 ; sg_temp->val =0 ; - sg_temp->addr = cur_seg->buf_physaddr; + sg_temp->addr = cur_seg->buf_iova; sg_temp->offset = cur_seg->data_off; sg_temp->length = cur_seg->data_len;if (RTE_MBUF_DIRECT (cur_seg)) {
drivers/net/ena/ena_ethdev.c +3 -3
@@ -1167,7 +1167,7 @@ static int ena_populate_rx_queue(struct ena_ring *rxq, unsigned int count)rte_prefetch0 (mbufs[((next_to_use +4 ) & ring_mask)]);/* prepare physical address for DMA transaction */ - ebuf.paddr = mbuf->buf_physaddr +RTE_PKTMBUF_HEADROOM ; + ebuf.paddr = mbuf->buf_iova +RTE_PKTMBUF_HEADROOM ; ebuf.len = mbuf->buf_len -RTE_PKTMBUF_HEADROOM ;/* pass resource to device */ rc = ena_com_add_single_rx_desc(rxq->ena_com_io_sq,
@@ -1726,7 +1726,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,* consideration pushed header */ if (mbuf->data_len > ena_tx_ctx.header_len) { - ebuf->paddr = mbuf->buf_physaddr + + ebuf->paddr = mbuf->buf_iova + mbuf->data_off + ena_tx_ctx.header_len; ebuf->len = mbuf->data_len - ena_tx_ctx.header_len;
@@ -1735,7 +1735,7 @@ static uint16_t eth_ena_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, }while ((mbuf = mbuf->next) !=NULL ) { - ebuf->paddr = mbuf->buf_physaddr + mbuf->data_off; + ebuf->paddr = mbuf->buf_iova + mbuf->data_off; ebuf->len = mbuf->data_len; ebuf++; tx_info->num_of_bufs++;
drivers/net/enic/enic_main.c +1 -1
@@ -316,7 +316,7 @@ enic_alloc_rx_queue_mbufs(struct enic *enic, struct vnic_rq *rq) } mb->data_off =RTE_PKTMBUF_HEADROOM ; - dma_addr = (dma_addr_t)(mb->buf_physaddr + dma_addr = (dma_addr_t)(mb->buf_iova +RTE_PKTMBUF_HEADROOM ); rq_enet_desc_enc(rqd, dma_addr, (rq->is_sop ? RQ_ENET_TYPE_ONLY_SOP
drivers/net/enic/enic_rxtx.c +3 -3
@@ -386,7 +386,7 @@ enic_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,/* Push descriptor for newly allocated mbuf */ nmb->data_off =RTE_PKTMBUF_HEADROOM ; - dma_addr = (dma_addr_t)(nmb->buf_physaddr + + dma_addr = (dma_addr_t)(nmb->buf_iova +RTE_PKTMBUF_HEADROOM ); rq_enet_desc_enc(rqd_ptr, dma_addr, (rq->is_sop ? RQ_ENET_TYPE_ONLY_SOP
@@ -578,7 +578,7 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, vlan_id =0 ; vlan_tag_insert =0 ; bus_addr = (dma_addr_t) - (tx_pkt->buf_physaddr + tx_pkt->data_off); + (tx_pkt->buf_iova + tx_pkt->data_off); descs = (struct wq_enet_desc *)wq->ring.descs; desc_p = descs + head_idx;
@@ -630,7 +630,7 @@ uint16_t enic_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,if (tx_pkt->next ==NULL ) eop =1 ; desc_p = descs + head_idx; - bus_addr = (dma_addr_t)(tx_pkt->buf_physaddr + bus_addr = (dma_addr_t)(tx_pkt->buf_iova + tx_pkt->data_off); wq_enet_desc_enc((struct wq_enet_desc *) &desc_tmp, bus_addr, data_len,
drivers/net/fm10k/fm10k.h +2 -2
@@ -253,11 +253,11 @@ struct fm10k_txq_ops { };#define MBUF_DMA_ADDR (mb) \ - ((uint64_t) ((mb)->buf_physaddr + (mb)->data_off)) + ((uint64_t) ((mb)->buf_iova + (mb)->data_off))/* enforce 512B alignment on default Rx DMA addresses */ #define MBUF_DMA_ADDR_DEFAULT (mb) \ - ((uint64_t) RTE_ALIGN(((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM),\ + ((uint64_t) RTE_ALIGN(((mb)->buf_iova + RTE_PKTMBUF_HEADROOM),\ FM10K_RX_DATABUF_ALIGN))static inline void fifo_reset (struct fifo *fifo,uint32_t len)
drivers/net/fm10k/fm10k_rxtx_vec.c +2 -2
@@ -330,8 +330,8 @@ fm10k_rxq_rearm(struct fm10k_rx_queue *rxq) p1 = (uintptr_t )&mb1->rearm_data; *(uint64_t *)p1 = rxq->mbuf_initializer; -/* load buf_addr(lo 64bit) and buf_physaddr(hi 64bit) */ -RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , buf_physaddr) != +/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */ +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , buf_iova) != offsetof(struct rte_mbuf , buf_addr) +8 ); vaddr0 =_mm_loadu_si128 ((__m128i *)&mb0->buf_addr); vaddr1 =_mm_loadu_si128 ((__m128i *)&mb1->buf_addr);
drivers/net/i40e/i40e_rxtx_vec_altivec.c +2 -2
@@ -100,7 +100,7 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) p1 = (uintptr_t )&mb1->rearm_data; *(uint64_t *)p1 = rxq->mbuf_initializer; -/* load buf_addr(lo 64bit) and buf_physaddr(hi 64bit) */ +/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */ vaddr0 =vec_ld (0 , (vector unsigned long *)&mb0->buf_addr); vaddr1 =vec_ld (0 , (vector unsigned long *)&mb1->buf_addr);
@@ -538,7 +538,7 @@ vtx1(volatile struct i40e_tx_desc *txdp, ((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));vector unsigned long descriptor = (vector unsigned long ){ - pkt->buf_physaddr + pkt->data_off, high_qw}; + pkt->buf_iova + pkt->data_off, high_qw}; *(vector unsigned long *)txdp = descriptor; }
drivers/net/i40e/i40e_rxtx_vec_neon.c +3 -3
@@ -81,13 +81,13 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) mb0 = rxep[0 ].mbuf; mb1 = rxep[1 ].mbuf; - paddr = mb0->buf_physaddr +RTE_PKTMBUF_HEADROOM ; + paddr = mb0->buf_iova +RTE_PKTMBUF_HEADROOM ; dma_addr0 =vdupq_n_u64 (paddr);/* flush desc with pa dma_addr */ vst1q_u64 ((uint64_t *)&rxdp++->read, dma_addr0); - paddr = mb1->buf_physaddr +RTE_PKTMBUF_HEADROOM ; + paddr = mb1->buf_iova +RTE_PKTMBUF_HEADROOM ; dma_addr1 =vdupq_n_u64 (paddr);vst1q_u64 ((uint64_t *)&rxdp++->read, dma_addr1); }
@@ -515,7 +515,7 @@ vtx1(volatile struct i40e_tx_desc *txdp, ((uint64_t )flags <<I40E_TXD_QW1_CMD_SHIFT ) | ((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT)); -uint64x2_t descriptor = {pkt->buf_physaddr + pkt->data_off, high_qw}; +uint64x2_t descriptor = {pkt->buf_iova + pkt->data_off, high_qw};vst1q_u64 ((uint64_t *)txdp, descriptor); }
drivers/net/i40e/i40e_rxtx_vec_sse.c +3 -3
@@ -86,8 +86,8 @@ i40e_rxq_rearm(struct i40e_rx_queue *rxq) mb0 = rxep[0 ].mbuf; mb1 = rxep[1 ].mbuf; -/* load buf_addr(lo 64bit) and buf_physaddr(hi 64bit) */ -RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , buf_physaddr) != +/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */ +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , buf_iova) != offsetof(struct rte_mbuf , buf_addr) +8 ); vaddr0 =_mm_loadu_si128 ((__m128i *)&mb0->buf_addr); vaddr1 =_mm_loadu_si128 ((__m128i *)&mb1->buf_addr);
@@ -549,7 +549,7 @@ vtx1(volatile struct i40e_tx_desc *txdp, ((uint64_t)pkt->data_len << I40E_TXD_QW1_TX_BUF_SZ_SHIFT));__m128i descriptor =_mm_set_epi64x (high_qw, - pkt->buf_physaddr + pkt->data_off); + pkt->buf_iova + pkt->data_off);_mm_store_si128 ((__m128i *)txdp, descriptor); }
drivers/net/ixgbe/ixgbe_rxtx_vec_neon.c +3 -3
@@ -87,13 +87,13 @@ ixgbe_rxq_rearm(struct ixgbe_rx_queue *rxq)* Data to be rearmed is 6 bytes long. */ vst1_u8 ((uint8_t *)&mb0->rearm_data, p); - paddr = mb0->buf_physaddr +RTE_PKTMBUF_HEADROOM ; + paddr = mb0->buf_iova +RTE_PKTMBUF_HEADROOM ; dma_addr0 =vsetq_lane_u64 (paddr, zero,0 );/* flush desc with pa dma_addr */ vst1q_u64 ((uint64_t *)&rxdp++->read, dma_addr0);vst1_u8 ((uint8_t *)&mb1->rearm_data, p); - paddr = mb1->buf_physaddr +RTE_PKTMBUF_HEADROOM ; + paddr = mb1->buf_iova +RTE_PKTMBUF_HEADROOM ; dma_addr1 =vsetq_lane_u64 (paddr, zero,0 );vst1q_u64 ((uint64_t *)&rxdp++->read, dma_addr1); }
@@ -414,7 +414,7 @@ vtx1(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf *pkt, uint64_t flags) {uint64x2_t descriptor = { - pkt->buf_physaddr + pkt->data_off, + pkt->buf_iova + pkt->data_off, (uint64_t )pkt->pkt_len <<46 | flags | pkt->data_len};vst1q_u64 ((uint64_t *)&txdp->read, descriptor);
drivers/net/ixgbe/ixgbe_rxtx_vec_sse.c +3 -3
@@ -86,8 +86,8 @@ ixgbe_rxq_rearm(struct ixgbe_rx_queue *rxq) mb0 = rxep[0 ].mbuf; mb1 = rxep[1 ].mbuf; -/* load buf_addr(lo 64bit) and buf_physaddr(hi 64bit) */ -RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , buf_physaddr) != +/* load buf_addr(lo 64bit) and buf_iova(hi 64bit) */ +RTE_BUILD_BUG_ON (offsetof(struct rte_mbuf , buf_iova) != offsetof(struct rte_mbuf , buf_addr) +8 ); vaddr0 =_mm_loadu_si128 ((__m128i *)&(mb0->buf_addr)); vaddr1 =_mm_loadu_si128 ((__m128i *)&(mb1->buf_addr));
@@ -667,7 +667,7 @@ vtx1(volatile union ixgbe_adv_tx_desc *txdp, {__m128i descriptor =_mm_set_epi64x ((uint64_t )pkt->pkt_len <<46 | flags | pkt->data_len, - pkt->buf_physaddr + pkt->data_off); + pkt->buf_iova + pkt->data_off);_mm_store_si128 ((__m128i *)&txdp->read, descriptor); }
drivers/net/nfp/nfp_net.c +1 -1
@@ -106,7 +106,7 @@ static uint16_t nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,#define NFP_QCP_MAX_ADD 0x7f#define RTE_MBUF_DMA_ADDR_DEFAULT (mb) \ - (uint64_t)((mb)->buf_physaddr + RTE_PKTMBUF_HEADROOM) + (uint64_t)((mb)->buf_iova + RTE_PKTMBUF_HEADROOM)/* nfp_qcp_ptr - Read or Write Pointer of a queue */ enum nfp_qcp_ptr {
drivers/net/virtio/virtio_ethdev.c +1 -1
@@ -493,7 +493,7 @@ virtio_init_queue(struct rte_eth_dev *dev, uint16_t vtpci_queue_idx)* VIRTIO_MBUF_DATA_DMA_ADDR in virtqueue.h for more information. */ if (!hw->virtio_user_dev) - vq->offset = offsetof(struct rte_mbuf , buf_physaddr); + vq->offset = offsetof(struct rte_mbuf , buf_iova);else { vq->vq_ring_mem = (uintptr_t )mz->addr; vq->offset = offsetof(struct rte_mbuf , buf_addr);
drivers/net/virtio/virtqueue.h +1 -1
@@ -79,7 +79,7 @@ struct rte_mbuf;#define VIRTIO_MBUF_ADDR (mb, vq) \ ((uint64_t)(*(uintptr_t *)((uintptr_t)(mb) + (vq)->offset)))#else -#define VIRTIO_MBUF_ADDR (mb, vq) ((mb)->buf_physaddr) +#define VIRTIO_MBUF_ADDR (mb, vq) ((mb)->buf_iova)#endif /**
lib/librte_kni/rte_kni.c +1 -1
@@ -456,7 +456,7 @@ va2pa(struct rte_mbuf *m) {return (void *)((unsigned long )m - ((unsigned long )m->buf_addr - - (unsigned long )m->buf_physaddr)); + (unsigned long )m->buf_iova)); } static void
lib/librte_mbuf/rte_mbuf.c +3 -3
@@ -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_virt2iova (m) + mbuf_size; + m->buf_iova =rte_mempool_virt2iova (m) + mbuf_size; m->buf_len = (uint16_t )buf_len;/* keep some headroom between start of buffer and data */
@@ -211,7 +211,7 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header)/* generic checks */ if (m->pool ==NULL )rte_panic ("bad mbuf pool\n" ); -if (m->buf_physaddr ==0 ) +if (m->buf_iova ==0 )rte_panic ("bad phys addr\n" );if (m->buf_addr ==NULL )rte_panic ("bad virt addr\n" );
@@ -244,7 +244,7 @@ rte_pktmbuf_dump(FILE *f, const struct rte_mbuf *m, unsigned dump_len)__rte_mbuf_sanity_check (m,1 );fprintf (f,"dump mbuf at %p, phys=%" PRIx64", buf_len=%u\n" , - m, (uint64_t )m->buf_physaddr, (unsigned )m->buf_len); + m, (uint64_t )m->buf_iova, (unsigned )m->buf_len);fprintf (f," pkt_len=%" PRIu32", ol_flags=%" PRIx64", nb_segs=%u, " "in_port=%u\n" , m->pkt_len, m->ol_flags, (unsigned )m->nb_segs, (unsigned )m->port);
lib/librte_mbuf/rte_mbuf.h +11 -7
@@ -432,7 +432,11 @@ struct rte_mbuf {* same mbuf cacheline0 layout for 32-bit and 64-bit. This makes * working on vector drivers easier. */ - phys_addr_t buf_physaddr __rte_aligned(sizeof(phys_addr_t)); +RTE_STD_C11 + union { +rte_iova_t buf_iova; +rte_iova_t buf_physaddr;/**< deprecated */ + }__rte_aligned (sizeof (rte_iova_t));/* next 8 bytes are initialised on RX descriptor rearm */ MARKER64 rearm_data;
@@ -631,7 +635,7 @@ static inline uint16_t rte_pktmbuf_priv_size(struct rte_mempool *mp);static inline phys_addr_t rte_mbuf_data_dma_addr (const struct rte_mbuf *mb) { -return mb->buf_physaddr + mb->data_off; +return mb->buf_iova + mb->data_off; }/**
@@ -649,7 +653,7 @@ rte_mbuf_data_dma_addr(const struct rte_mbuf *mb)static inline phys_addr_t rte_mbuf_data_dma_addr_default (const struct rte_mbuf *mb) { -return mb->buf_physaddr +RTE_PKTMBUF_HEADROOM ; +return mb->buf_iova +RTE_PKTMBUF_HEADROOM ; }/**
@@ -840,7 +844,7 @@ rte_mbuf_sanity_check(const struct rte_mbuf *m, int is_header);* For standard needs, prefer rte_pktmbuf_alloc(). * * The caller can expect that the following fields of the mbuf structure -* are initialized: buf_addr, buf_physaddr, buf_len, refcnt=1, nb_segs=1, +* are initialized: buf_addr, buf_iova, buf_len, refcnt=1, nb_segs=1, * next=NULL, pool, priv_size. The other fields must be initialized * by the caller. *
@@ -1250,7 +1254,7 @@ static inline void rte_pktmbuf_attach(struct rte_mbuf *mi, struct rte_mbuf *m)rte_mbuf_refcnt_update (md,1 ); mi->priv_size = m->priv_size; - mi->buf_physaddr = m->buf_physaddr; + mi->buf_iova = m->buf_iova; mi->buf_addr = m->buf_addr; mi->buf_len = m->buf_len;
@@ -1298,7 +1302,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_virt2iova (m) + mbuf_size; + m->buf_iova =rte_mempool_virt2iova (m) + mbuf_size; m->buf_len = (uint16_t )buf_len;rte_pktmbuf_reset_headroom (m); m->data_len =0 ;
@@ -1569,7 +1573,7 @@ static inline struct rte_mbuf *rte_pktmbuf_lastseg(struct rte_mbuf *m)* The offset into the data to calculate address from. */ #define rte_pktmbuf_mtophys_offset (m, o) \ - (phys_addr_t)((m)->buf_physaddr + (m)->data_off + (o)) + (rte_iova_t)((m)->buf_iova + (m)->data_off + (o))/** * A macro that returns the physical address that points to the start of the
lib/librte_vhost/virtio_net.c +1 -1
@@ -978,7 +978,7 @@ copy_desc_to_mbuf(struct virtio_net *dev, struct vhost_virtqueue *vq, cur->data_len = cpy_len; cur->data_off =0 ; cur->buf_addr = (void *)(uintptr_t )desc_addr; - cur->buf_physaddr = hpa; + cur->buf_iova = hpa;/* * In zero copy mode, one mbuf can only reference data
test/test/test_mbuf.c +1 -1
@@ -906,7 +906,7 @@ test_failing_mbuf_sanity_check(struct rte_mempool *pktmbuf_pool) } badbuf = *buf; - badbuf.buf_physaddr =0 ; + badbuf.buf_iova =0 ;if (verify_mbuf_check_panics (&badbuf)) {printf ("Error with bad-physaddr mbuf test\n" );return -1 ;
Signature · 1 line
2.14.2
Re: [PATCH v4 11/15] mbuf: rename physical address to IOVA
Quoted 9 lines · Thomas Monjalon
From: Santosh Shukla <[email protected]>
Rename
buf_physaddrtobuf_iova.
Keep the deprecated name in an anonymous union to avoid breaking the API.Signed-off-by Santosh Shukla <[email protected]>Reviewed-by Anatoly Burakov <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>
Just be aware that I still see some references to ->buf_physaddr.
$ git grep buf_physaddr drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: op->sym->aead.digest.phys_addr = mbuf->buf_physaddr; drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: mbuf->buf_physaddr = (uint64_t)op; drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: op = (struct rte_crypto_op *)mbuf->buf_physaddr; drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: mbuf->buf_physaddr = op->sym->aead.digest.phys_addr; drivers/crypto/dpaa_sec/dpaa_sec.c: src_start_addr = sym->m_src->buf_physaddr + sym->m_src->data_off; drivers/crypto/dpaa_sec/dpaa_sec.c: dst_start_addr = sym->m_dst->buf_physaddr + sym->m_dst->data_off; lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h: uint64_t buf_physaddr; lib/librte_eal/linuxapp/kni/kni_net.c: (unsigned long)m->buf_physaddr); lib/librte_eal/linuxapp/kni/kni_net.c: return phys_to_virt(m->buf_physaddr + m->data_off); lib/librte_eal/linuxapp/kni/kni_net.c: (unsigned long)m->buf_physaddr)); lib/librte_mbuf/rte_mbuf.h: rte_iova_t buf_physaddr; /**< deprecated */
Apart from that,
Re: [PATCH v4 11/15] mbuf: rename physical address to IOVA
06/11/2017 16:52, Olivier MATZ:
Quoted 13 lines · Thomas Monjalon
Quoted 9 lines
From: Santosh Shukla <[email protected]>
Rename
buf_physaddrtobuf_iova.
Keep the deprecated name in an anonymous union to avoid breaking the API.Signed-off-by Santosh Shukla <[email protected]>Reviewed-by Anatoly Burakov <[email protected]>Signed-off-by Thomas Monjalon <[email protected]>Just be aware that I still see some references to ->buf_physaddr.
Quoted 12 lines
$ git grep buf_physaddr drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: op->sym->aead.digest.phys_addr = mbuf->buf_physaddr; drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: mbuf->buf_physaddr = (uint64_t)op; drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: op = (struct rte_crypto_op *)mbuf->buf_physaddr; drivers/crypto/dpaa2_sec/dpaa2_sec_dpseci.c: mbuf->buf_physaddr = op->sym->aead.digest.phys_addr; drivers/crypto/dpaa_sec/dpaa_sec.c: src_start_addr = sym->m_src->buf_physaddr + sym->m_src->data_off; drivers/crypto/dpaa_sec/dpaa_sec.c: dst_start_addr = sym->m_dst->buf_physaddr + sym->m_dst->data_off; lib/librte_eal/linuxapp/eal/include/exec-env/rte_kni_common.h: uint64_t buf_physaddr; lib/librte_eal/linuxapp/kni/kni_net.c: (unsigned long)m->buf_physaddr); lib/librte_eal/linuxapp/kni/kni_net.c: return phys_to_virt(m->buf_physaddr + m->data_off); lib/librte_eal/linuxapp/kni/kni_net.c: (unsigned long)m->buf_physaddr)); lib/librte_mbuf/rte_mbuf.h: rte_iova_t buf_physaddr; /**< deprecated */
Yes, it is on purpose.
KNI is known to work only with physical addresses for now.
I am not sure about NXP buses, but I had the feeling that it deserves a separate work.
PATCH v4 12/15 mbuf: rename data address helpers to IOVA
In reply to Thomas MonjalonThe following inline functions and macros have been renamed to be consistent with the IOVA wording:
rte_mbuf_data_dma_addr -> rte_mbuf_data_iovarte_mbuf_data_dma_addr_default -> rte_mbuf_data_iova_defaultrte_pktmbuf_mtophys -> rte_pktmbuf_iovarte_pktmbuf_mtophys_offset -> rte_pktmbuf_iova_offset
The deprecated functions and macros are kept to avoid breaking the API.
--- app/test-crypto-perf/cperf_ops.c | 6 +++--- drivers/crypto/dpaa_sec/dpaa_sec.c | 6 +++--- drivers/crypto/mrvl/rte_mrvl_pmd.c | 4 ++-- drivers/crypto/qat/qat_crypto.c | 18 ++++++++-------- drivers/net/ark/ark_ethdev_tx.c | 2 +- drivers/net/bnx2x/bnx2x.c | 2 +- drivers/net/e1000/em_rxtx.c | 8 +++---- drivers/net/e1000/igb_rxtx.c | 8 +++---- drivers/net/i40e/i40e_rxtx.c | 14 ++++++------ drivers/net/ixgbe/ixgbe_rxtx.c | 14 ++++++------ drivers/net/liquidio/lio_rxtx.c | 8 +++---- drivers/net/liquidio/lio_rxtx.h | 2 +- drivers/net/mrvl/mrvl_ethdev.c | 8 +++---- drivers/net/nfp/nfp_net.c | 2 +- drivers/net/octeontx/octeontx_rxtx.c | 2 +- drivers/net/qede/qede_rxtx.c | 16 +++++++------- drivers/net/sfc/sfc_ef10_rx.c | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 4 ++-- drivers/net/sfc/sfc_rx.c | 2 +- drivers/net/sfc/sfc_tso.c | 2 +- drivers/net/sfc/sfc_tx.c | 2 +- drivers/net/thunderx/nicvf_rxtx.h | 4 ++-- drivers/net/vmxnet3/vmxnet3_rxtx.c | 4 ++-- examples/ipsec-secgw/esp.c | 12 +++++------ examples/l2fwd-crypto/main.c | 4 ++-- lib/librte_mbuf/rte_mbuf.h | 41 ++++++++++++++++++++++++++--------- test/test/test_cryptodev.c | 42 ++++++++++++++++++------------------ test/test/test_cryptodev.h | 2 +- 28 files changed, 131 insertions(+), 110 deletions(-)
app/test-crypto-perf/cperf_ops.c +3 -3
@@ -221,7 +221,7 @@ cperf_set_ops_auth(struct rte_crypto_op **ops, sym_op->auth.digest.data =rte_pktmbuf_mtod_offset (buf, uint8_t *, offset); sym_op->auth.digest.phys_addr = -rte_pktmbuf_mtophys_offset (buf, offset); +rte_pktmbuf_iova_offset (buf, offset); }
@@ -318,7 +318,7 @@ cperf_set_ops_cipher_auth(struct rte_crypto_op **ops, sym_op->auth.digest.data =rte_pktmbuf_mtod_offset (buf, uint8_t *, offset); sym_op->auth.digest.phys_addr = -rte_pktmbuf_mtophys_offset (buf, offset); +rte_pktmbuf_iova_offset (buf, offset); } if (options->auth_algo == RTE_CRYPTO_AUTH_SNOW3G_UIA2 ||
@@ -425,7 +425,7 @@ cperf_set_ops_aead(struct rte_crypto_op **ops, sym_op->aead.digest.data =rte_pktmbuf_mtod_offset (buf, uint8_t *, offset); sym_op->aead.digest.phys_addr = -rte_pktmbuf_mtophys_offset (buf, offset); +rte_pktmbuf_iova_offset (buf, offset); } }
drivers/crypto/dpaa_sec/dpaa_sec.c +3 -3
@@ -577,7 +577,7 @@ build_auth_only(struct rte_crypto_op *op, dpaa_sec_session *ses) ctx->op = op; old_digest = ctx->digest; - start_addr =rte_pktmbuf_mtophys (mbuf); + start_addr =rte_pktmbuf_iova (mbuf);/* output */ sg = &cf->sg[0 ];qm_sg_entry_set64 (sg, sym->auth.digest.phys_addr);
@@ -637,10 +637,10 @@ build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses) cf = &ctx->job; ctx->op = op; - src_start_addr =rte_pktmbuf_mtophys (sym->m_src); + src_start_addr =rte_pktmbuf_iova (sym->m_src);if (sym->m_dst) - dst_start_addr =rte_pktmbuf_mtophys (sym->m_dst); + dst_start_addr =rte_pktmbuf_iova (sym->m_dst);else dst_start_addr = src_start_addr;
drivers/crypto/mrvl/rte_mrvl_pmd.c +2 -2
@@ -480,7 +480,7 @@ mrvl_request_prepare(struct sam_cio_op_params *request, request->num_bufs =1 ; request->src = src_bd; src_bd->vaddr = rte_pktmbuf_mtod(op->sym->m_src, void *); - src_bd->paddr =rte_pktmbuf_mtophys (op->sym->m_src); + src_bd->paddr =rte_pktmbuf_iova (op->sym->m_src); src_bd->len =rte_pktmbuf_data_len (op->sym->m_src);/* Empty source. */
@@ -502,7 +502,7 @@ mrvl_request_prepare(struct sam_cio_op_params *request, request->dst = dst_bd; dst_bd->vaddr = rte_pktmbuf_mtod(dst_mbuf, void *); - dst_bd->paddr =rte_pktmbuf_mtophys (dst_mbuf); + dst_bd->paddr =rte_pktmbuf_iova (dst_mbuf);/* * We can use all available space in dst_mbuf,
drivers/crypto/qat/qat_crypto.c +9 -9
@@ -1119,7 +1119,7 @@ qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buff_start, {int nr =1 ; -uint32_t buf_len =rte_pktmbuf_mtophys (buf) - +uint32_t buf_len =rte_pktmbuf_iova (buf) - buff_start +rte_pktmbuf_data_len (buf); list->bufers[0 ].addr = buff_start;
@@ -1143,7 +1143,7 @@ qat_sgl_fill_array(struct rte_mbuf *buf, uint64_t buff_start, list->bufers[nr].len =rte_pktmbuf_data_len (buf); list->bufers[nr].resrvd =0 ; - list->bufers[nr].addr =rte_pktmbuf_mtophys (buf); + list->bufers[nr].addr =rte_pktmbuf_iova (buf); buf_len += list->bufers[nr].len; buf = buf->next;
@@ -1499,26 +1499,26 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,* so as not to overwrite data in dest buffer */ src_buf_start = -rte_pktmbuf_mtophys_offset (op->sym->m_src, min_ofs); +rte_pktmbuf_iova_offset (op->sym->m_src, min_ofs); dst_buf_start = -rte_pktmbuf_mtophys_offset (op->sym->m_dst, min_ofs); +rte_pktmbuf_iova_offset (op->sym->m_dst, min_ofs); }else {/* In-place operation * Start DMA at nearest aligned address below min_ofs */ src_buf_start = -rte_pktmbuf_mtophys_offset (op->sym->m_src, min_ofs) +rte_pktmbuf_iova_offset (op->sym->m_src, min_ofs) &QAT_64_BTYE_ALIGN_MASK ; -if (unlikely ((rte_pktmbuf_mtophys (op->sym->m_src) - +if (unlikely ((rte_pktmbuf_iova (op->sym->m_src) -rte_pktmbuf_headroom (op->sym->m_src)) > src_buf_start)) {/* alignment has pushed addr ahead of start of mbuf * so revert and take the performance hit */ src_buf_start = -rte_pktmbuf_mtophys_offset (op->sym->m_src, +rte_pktmbuf_iova_offset (op->sym->m_src, min_ofs); } dst_buf_start = src_buf_start;
@@ -1526,7 +1526,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,if (do_cipher || do_aead) { cipher_param->cipher_offset = - (uint32_t )rte_pktmbuf_mtophys_offset ( + (uint32_t )rte_pktmbuf_iova_offset ( op->sym->m_src, cipher_ofs) - src_buf_start; cipher_param->cipher_length = cipher_len; }else {
@@ -1535,7 +1535,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg, }if (do_auth || do_aead) { - auth_param->auth_off = (uint32_t )rte_pktmbuf_mtophys_offset ( + auth_param->auth_off = (uint32_t )rte_pktmbuf_iova_offset ( op->sym->m_src, auth_ofs) - src_buf_start; auth_param->auth_len = auth_len; }else {
drivers/net/ark/ark_ethdev_tx.c +1 -1
@@ -93,7 +93,7 @@ eth_ark_tx_meta_from_mbuf(struct ark_tx_meta *meta,const struct rte_mbuf *mbuf, uint8_t flags) { - meta->physaddr = rte_mbuf_data_dma_addr(mbuf); + meta->physaddr = rte_mbuf_data_iova(mbuf); meta->delta_ns =0 ; meta->data_len =rte_pktmbuf_data_len (mbuf); meta->flags = flags;
drivers/net/bnx2x/bnx2x.c +1 -1
@@ -2135,7 +2135,7 @@ int bnx2x_tx_encap(struct bnx2x_tx_queue *txq, struct rte_mbuf *m0) tx_start_bd = &txq->tx_ring[TX_BD (bd_prod, txq)].start_bd; tx_start_bd->addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr (m0)); +rte_cpu_to_le_64 (rte_mbuf_data_iova (m0)); tx_start_bd->nbytes =rte_cpu_to_le_16 (m0->data_len); tx_start_bd->bd_flags.as_bitfield =ETH_TX_BD_FLAGS_START_BD ; tx_start_bd->general_data =
drivers/net/e1000/em_rxtx.c +4 -4
@@ -577,7 +577,7 @@ eth_em_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,* Set up Transmit Data Descriptor. */ slen = m_seg->data_len; - buf_dma_addr =rte_mbuf_data_dma_addr (m_seg); + buf_dma_addr =rte_mbuf_data_iova (m_seg); txd->buffer_addr =rte_cpu_to_le_64 (buf_dma_addr); txd->lower.data =rte_cpu_to_le_32 (cmd_type_len | slen);
@@ -799,7 +799,7 @@ eth_em_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm = rxe->mbuf; rxe->mbuf = nmb; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb)); rxdp->buffer_addr = dma_addr; rxdp->status =0 ;
@@ -979,7 +979,7 @@ eth_em_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ rxm = rxe->mbuf; rxe->mbuf = nmb; - dma =rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); + dma =rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb)); rxdp->buffer_addr = dma; rxdp->status =0 ;
@@ -1652,7 +1652,7 @@ em_alloc_rx_queue_mbufs(struct em_rx_queue *rxq) } dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (mbuf)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mbuf));/* Clear HW ring memory */ rxq->rx_ring[i] = rxd_init;
drivers/net/e1000/igb_rxtx.c +4 -4
@@ -597,7 +597,7 @@ eth_igb_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,* Set up transmit descriptor. */ slen = (uint16_t ) m_seg->data_len; - buf_dma_addr =rte_mbuf_data_dma_addr (m_seg); + buf_dma_addr =rte_mbuf_data_iova (m_seg); txd->read.buffer_addr =rte_cpu_to_le_64 (buf_dma_addr); txd->read.cmd_type_len =
@@ -925,7 +925,7 @@ eth_igb_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm = rxe->mbuf; rxe->mbuf = nmb; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb)); rxdp->read.hdr_addr =0 ; rxdp->read.pkt_addr = dma_addr;
@@ -1119,7 +1119,7 @@ eth_igb_recv_scattered_pkts(void *rx_queue, struct rte_mbuf **rx_pkts,*/ rxm = rxe->mbuf; rxe->mbuf = nmb; - dma =rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); + dma =rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb)); rxdp->read.pkt_addr = dma; rxdp->read.hdr_addr =0 ;
@@ -2203,7 +2203,7 @@ igb_alloc_rx_queue_mbufs(struct igb_rx_queue *rxq)return -ENOMEM ; } dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (mbuf)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mbuf)); rxd = &rxq->rx_ring[i]; rxd->read.hdr_addr =0 ; rxd->read.pkt_addr = dma_addr;
drivers/net/i40e/i40e_rxtx.c +7 -7
@@ -589,7 +589,7 @@ i40e_rx_alloc_bufs(struct i40e_rx_queue *rxq) mb->nb_segs =1 ; mb->port = rxq->port_id; dma_addr =rte_cpu_to_le_64 (\ -rte_mbuf_data_dma_addr_default (mb)); +rte_mbuf_data_iova_default (mb)); rxdp[i].read.hdr_addr =0 ; rxdp[i].read.pkt_addr = dma_addr; }
@@ -752,7 +752,7 @@ i40e_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) rxm = rxe->mbuf; rxe->mbuf = nmb; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb)); rxdp->read.hdr_addr =0 ; rxdp->read.pkt_addr = dma_addr;
@@ -869,7 +869,7 @@ i40e_recv_scattered_pkts(void *rx_queue, rxm = rxe->mbuf; rxe->mbuf = nmb; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb));/* Set data buffer address and data length of the mbuf */ rxdp->read.hdr_addr =0 ;
@@ -1202,7 +1202,7 @@ i40e_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)/* Setup TX Descriptor */ slen = m_seg->data_len; - buf_dma_addr =rte_mbuf_data_dma_addr (m_seg); + buf_dma_addr =rte_mbuf_data_iova (m_seg);PMD_TX_LOG (DEBUG ,"mbuf: %p, TDD[%u]:\n" "buf_dma_addr: %#"PRIx64";\n"
@@ -1301,7 +1301,7 @@ tx4(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts)uint32_t i;for (i =0 ; i <4 ; i++, txdp++, pkts++) { - dma_addr =rte_mbuf_data_dma_addr (*pkts); + dma_addr =rte_mbuf_data_iova (*pkts); txdp->buffer_addr =rte_cpu_to_le_64 (dma_addr); txdp->cmd_type_offset_bsz = i40e_build_ctob((uint32_t)I40E_TD_CMD, 0,
@@ -1315,7 +1315,7 @@ tx1(volatile struct i40e_tx_desc *txdp, struct rte_mbuf **pkts) {uint64_t dma_addr; - dma_addr =rte_mbuf_data_dma_addr (*pkts); + dma_addr =rte_mbuf_data_iova (*pkts); txdp->buffer_addr =rte_cpu_to_le_64 (dma_addr); txdp->cmd_type_offset_bsz = i40e_build_ctob((uint32_t)I40E_TD_CMD, 0,
@@ -2451,7 +2451,7 @@ i40e_alloc_rx_queue_mbufs(struct i40e_rx_queue *rxq) mbuf->port = rxq->port_id; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (mbuf)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mbuf)); rxd = &rxq->rx_ring[i]; rxd->read.pkt_addr = dma_addr;
drivers/net/ixgbe/ixgbe_rxtx.c +7 -7
@@ -185,7 +185,7 @@ tx4(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts)int i;for (i =0 ; i <4 ; ++i, ++txdp, ++pkts) { - buf_dma_addr =rte_mbuf_data_dma_addr (*pkts); + buf_dma_addr =rte_mbuf_data_iova (*pkts); pkt_len = (*pkts)->data_len;/* write data to descriptor */
@@ -208,7 +208,7 @@ tx1(volatile union ixgbe_adv_tx_desc *txdp, struct rte_mbuf **pkts)uint64_t buf_dma_addr;uint32_t pkt_len; - buf_dma_addr =rte_mbuf_data_dma_addr (*pkts); + buf_dma_addr =rte_mbuf_data_iova (*pkts); pkt_len = (*pkts)->data_len;/* write data to descriptor */
@@ -924,7 +924,7 @@ ixgbe_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,* Set up Transmit Data Descriptor. */ slen = m_seg->data_len; - buf_dma_addr =rte_mbuf_data_dma_addr (m_seg); + buf_dma_addr =rte_mbuf_data_iova (m_seg); txd->read.buffer_addr =rte_cpu_to_le_64 (buf_dma_addr); txd->read.cmd_type_len =
@@ -1633,7 +1633,7 @@ ixgbe_rx_alloc_bufs(struct ixgbe_rx_queue *rxq, bool reset_mbuf) mb->data_off =RTE_PKTMBUF_HEADROOM ;/* populate the descriptors */ - dma_addr =rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (mb)); + dma_addr =rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mb)); rxdp[i].read.hdr_addr =0 ; rxdp[i].read.pkt_addr = dma_addr; }
@@ -1865,7 +1865,7 @@ ixgbe_recv_pkts(void *rx_queue, struct rte_mbuf **rx_pkts, rxm = rxe->mbuf; rxe->mbuf = nmb; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb)); rxdp->read.hdr_addr =0 ; rxdp->read.pkt_addr = dma_addr;
@@ -2159,7 +2159,7 @@ ixgbe_recv_pkts_lro(void *rx_queue, struct rte_mbuf **rx_pkts, uint16_t nb_pkts,if (!bulk_alloc) {__le64 dma = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (nmb)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (nmb));/* * Update RX descriptor with the physical address of the * new data buffer of the new allocated mbuf.
@@ -4188,7 +4188,7 @@ ixgbe_alloc_rx_queue_mbufs(struct ixgbe_rx_queue *rxq) mbuf->port = rxq->port_id; dma_addr = -rte_cpu_to_le_64 (rte_mbuf_data_dma_addr_default (mbuf)); +rte_cpu_to_le_64 (rte_mbuf_data_iova_default (mbuf)); rxd = &rxq->rx_ring[i]; rxd->read.hdr_addr =0 ; rxd->read.pkt_addr = dma_addr;
drivers/net/liquidio/lio_rxtx.c +4 -4
@@ -1298,7 +1298,7 @@ lio_alloc_soft_command(struct lio_device *lio_dev, uint32_t datasize, sc = rte_pktmbuf_mtod(m, struct lio_soft_command *);memset (sc,0 ,LIO_SOFT_COMMAND_BUFFER_SIZE ); sc->size =LIO_SOFT_COMMAND_BUFFER_SIZE ; - sc->dma_addr =rte_mbuf_data_dma_addr (m); + sc->dma_addr =rte_mbuf_data_iova (m); sc->mbuf = m; dma_addr = sc->dma_addr;
@@ -1739,7 +1739,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) cmdsetup.s.u.datasize = pkt_len;lio_prepare_pci_cmd (lio_dev, &ndata.cmd, &cmdsetup, tag); - ndata.cmd.cmd3.dptr =rte_mbuf_data_dma_addr (m); + ndata.cmd.cmd3.dptr =rte_mbuf_data_iova (m); ndata.reqtype =LIO_REQTYPE_NORESP_NET ; }else {struct lio_buf_free_info *finfo;
@@ -1771,7 +1771,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) &cmdsetup, tag);memset (g->sg,0 , g->sg_size); - g->sg[0 ].ptr[0 ] =rte_mbuf_data_dma_addr (m); + g->sg[0 ].ptr[0 ] =rte_mbuf_data_iova (m);lio_add_sg_size (&g->sg[0 ], m->data_len,0 ); pkt_len = m->data_len; finfo->mbuf = m;
@@ -1782,7 +1782,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) m = m->next;while (frags--) { g->sg[(i >>2 )].ptr[(i &3 )] = -rte_mbuf_data_dma_addr (m); +rte_mbuf_data_iova (m);lio_add_sg_size (&g->sg[(i >>2 )], m->data_len, (i &3 )); pkt_len += m->data_len;
drivers/net/liquidio/lio_rxtx.h +1 -1
@@ -688,7 +688,7 @@ lio_map_ring(void *buf) {phys_addr_t dma_addr; - dma_addr =rte_mbuf_data_dma_addr_default (((struct rte_mbuf *)buf)); + dma_addr =rte_mbuf_data_iova_default (((struct rte_mbuf *)buf));return (uint64_t )dma_addr; }
drivers/net/mrvl/mrvl_ethdev.c +4 -4
@@ -1153,7 +1153,7 @@ mrvl_fill_bpool(struct mrvl_rxq *rxq, int num) } entries[i].buff.addr = -rte_mbuf_data_dma_addr_default (mbufs[i]); +rte_mbuf_data_iova_default (mbufs[i]); entries[i].buff.cookie = (pp2_cookie_t )(uint64_t )mbufs[i]; entries[i].bpool = bpool; }
@@ -1598,7 +1598,7 @@ mrvl_rx_pkt_burst(void *rxq, struct rte_mbuf **rx_pkts, uint16_t nb_pkts) status =pp2_ppio_inq_desc_get_l2_pkt_error (&descs[i]);if (unlikely (status !=PP2_DESC_ERR_OK )) {struct pp2_buff_inf binf = { - .addr =rte_mbuf_data_dma_addr_default (mbuf), + .addr =rte_mbuf_data_iova_default (mbuf), .cookie = (pp2_cookie_t )(uint64_t )mbuf, };
@@ -1854,7 +1854,7 @@ mrvl_tx_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) sq->ent[sq->head].buff.cookie = (pp2_cookie_t )(uint64_t )mbuf; sq->ent[sq->head].buff.addr = -rte_mbuf_data_dma_addr_default (mbuf); +rte_mbuf_data_iova_default (mbuf); sq->ent[sq->head].bpool = (unlikely (mbuf->port ==0xff || mbuf->refcnt >1 )) ?NULL : mrvl_port_to_bpool_lookup[mbuf->port];
@@ -1863,7 +1863,7 @@ mrvl_tx_pkt_burst(void *txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)pp2_ppio_outq_desc_reset (&descs[i]);pp2_ppio_outq_desc_set_phys_addr (&descs[i], -rte_pktmbuf_mtophys (mbuf)); +rte_pktmbuf_iova (mbuf));pp2_ppio_outq_desc_set_pkt_offset (&descs[i],0 );pp2_ppio_outq_desc_set_pkt_len (&descs[i],rte_pktmbuf_pkt_len (mbuf));
drivers/net/nfp/nfp_net.c +1 -1
@@ -2266,7 +2266,7 @@ nfp_net_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) *lmbuf = pkt; dma_size = pkt->data_len; - dma_addr =rte_mbuf_data_dma_addr (pkt); + dma_addr =rte_mbuf_data_iova (pkt);PMD_TX_LOG (DEBUG ,"Working with mbuf at dma address:" "%" PRIx64"\n" , dma_addr);
drivers/net/octeontx/octeontx_rxtx.c +1 -1
@@ -70,7 +70,7 @@ __octeontx_xmit_pkts(void *lmtline_va, void *ioreg_va, int64_t *fc_status_va, cmd_buf[0 ] |= (1ULL <<58 );/* SET DF */ /* Setup PKO_SEND_GATHER_S */ - cmd_buf[(1 <<1 ) |1 ] =rte_mbuf_data_dma_addr (tx_pkt); + cmd_buf[(1 <<1 ) |1 ] =rte_mbuf_data_iova (tx_pkt); cmd_buf[(1 <<1 ) |0 ] =PKO_SEND_GATHER_SUBDC |PKO_SEND_GATHER_LDTYPE (0x1ull ) | PKO_SEND_GATHER_GAUAR((long)gaura_id) |
drivers/net/qede/qede_rxtx.c +8 -8
@@ -28,7 +28,7 @@ static inline int qede_alloc_rx_buffer(struct qede_rx_queue *rxq) } rxq->sw_rx_ring[idx].mbuf = new_mb; rxq->sw_rx_ring[idx].page_offset =0 ; - mapping =rte_mbuf_data_dma_addr_default (new_mb); + mapping =rte_mbuf_data_iova_default (new_mb);/* Advance PROD and get BD pointer */ rx_bd = (struct eth_rx_bd *)ecore_chain_produce (&rxq->rx_bd_ring); rx_bd->addr.hi =rte_cpu_to_le_32 (U64_HI (mapping));
@@ -1064,7 +1064,7 @@ qede_reuse_page(__rte_unused struct qede_dev *qdev, curr_prod = &rxq->sw_rx_ring[idx]; *curr_prod = *curr_cons; - new_mapping =rte_mbuf_data_dma_addr_default (curr_prod->mbuf) + + new_mapping =rte_mbuf_data_iova_default (curr_prod->mbuf) + curr_prod->page_offset; rx_bd_prod->addr.hi =rte_cpu_to_le_32 (U64_HI (new_mapping));
@@ -1565,7 +1565,7 @@ qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,memset (*bd2,0 ,sizeof (struct eth_tx_2nd_bd )); nb_segs++; } - mapping =rte_mbuf_data_dma_addr (m_seg); + mapping =rte_mbuf_data_iova (m_seg);QEDE_BD_SET_ADDR_LEN (*bd2, mapping, m_seg->data_len);PMD_TX_LOG (DEBUG , txq,"BD2 len %04x" , m_seg->data_len); }else if (nb_segs ==1 ) {
@@ -1575,7 +1575,7 @@ qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,memset (*bd3,0 ,sizeof (struct eth_tx_3rd_bd )); nb_segs++; } - mapping =rte_mbuf_data_dma_addr (m_seg); + mapping =rte_mbuf_data_iova (m_seg);QEDE_BD_SET_ADDR_LEN (*bd3, mapping, m_seg->data_len);PMD_TX_LOG (DEBUG , txq,"BD3 len %04x" , m_seg->data_len); }else {
@@ -1583,7 +1583,7 @@ qede_encode_sg_bd(struct qede_tx_queue *p_txq, struct rte_mbuf *m_seg,ecore_chain_produce (&txq->tx_pbl);memset (tx_bd,0 ,sizeof (*tx_bd)); nb_segs++; - mapping =rte_mbuf_data_dma_addr (m_seg); + mapping =rte_mbuf_data_iova (m_seg);QEDE_BD_SET_ADDR_LEN (tx_bd, mapping, m_seg->data_len);PMD_TX_LOG (DEBUG , txq,"BD len %04x" , m_seg->data_len); }
@@ -1966,7 +1966,7 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) nbds++;/* Map MBUF linear data for DMA and set in the BD1 */ -QEDE_BD_SET_ADDR_LEN (bd1,rte_mbuf_data_dma_addr (mbuf), +QEDE_BD_SET_ADDR_LEN (bd1,rte_mbuf_data_iova (mbuf), mbuf->data_len); bd1->data.bitfields =rte_cpu_to_le_16 (bd1_bf); bd1->data.bd_flags.bitfields = bd1_bd_flags_bf;
@@ -1979,11 +1979,11 @@ qede_xmit_pkts(void *p_txq, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) nbds++;/* BD1 */ -QEDE_BD_SET_ADDR_LEN (bd1,rte_mbuf_data_dma_addr (mbuf), +QEDE_BD_SET_ADDR_LEN (bd1,rte_mbuf_data_iova (mbuf), hdr_size);/* BD2 */ QEDE_BD_SET_ADDR_LEN (bd2, (hdr_size + -rte_mbuf_data_dma_addr (mbuf)), +rte_mbuf_data_iova (mbuf)), mbuf->data_len - hdr_size); bd2->data.bitfields1 =rte_cpu_to_le_16 (bd2_bf1);if (mplsoudp_flg) {
drivers/net/sfc/sfc_ef10_rx.c +1 -1
@@ -189,7 +189,7 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq)* structure members. */ - phys_addr =rte_mbuf_data_dma_addr_default (m); + phys_addr =rte_mbuf_data_iova_default (m);EFX_POPULATE_QWORD_2 (rxq->rxq_hw_ring[id],ESF_DZ_RX_KER_BYTE_CNT , buf_size,ESF_DZ_RX_KER_BUF_ADDR , phys_addr);
drivers/net/sfc/sfc_ef10_tx.c +2 -2
@@ -341,7 +341,7 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) pkt_len = m_seg->pkt_len; do { - phys_addr_t seg_addr = rte_mbuf_data_dma_addr(m_seg); + phys_addr_t seg_addr = rte_mbuf_data_iova(m_seg); unsigned int seg_len = rte_pktmbuf_data_len(m_seg); unsigned int id = added & ptr_mask;
@@ -464,7 +464,7 @@ sfc_ef10_simple_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,SFC_ASSERT (rte_pktmbuf_data_len (pkt) <=SFC_EF10_TX_DMA_DESC_LEN_MAX ); -sfc_ef10_tx_qdesc_dma_create (rte_mbuf_data_dma_addr (pkt), +sfc_ef10_tx_qdesc_dma_create (rte_mbuf_data_iova (pkt),rte_pktmbuf_data_len (pkt), true, &txq->txq_hw_ring[id]);
drivers/net/sfc/sfc_rx.c +1 -1
@@ -128,7 +128,7 @@ sfc_efx_rx_qrefill(struct sfc_efx_rxq *rxq)SFC_ASSERT (m->nb_segs ==1 ); m->port = port_id; - addr[i] =rte_pktmbuf_mtophys (m); + addr[i] =rte_pktmbuf_iova (m); } efx_rx_qpost(rxq->common, addr, rxq->buf_size,
drivers/net/sfc/sfc_tso.c +1 -1
@@ -141,7 +141,7 @@ sfc_efx_tso_do(struct sfc_efx_txq *txq, unsigned int idx,if (unlikely (tcph_off > encp->enc_tx_tso_tcp_header_offset_limit))return EMSGSIZE ; - header_paddr =rte_pktmbuf_mtophys (m); + header_paddr =rte_pktmbuf_iova (m);/* * Sometimes headers may be split across multiple mbufs. In such cases
drivers/net/sfc/sfc_tx.c +1 -1
@@ -765,7 +765,7 @@ sfc_efx_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts)size_t seg_len; seg_len = m_seg->data_len; - next_frag =rte_mbuf_data_dma_addr (m_seg); + next_frag =rte_mbuf_data_iova (m_seg);/* * If we've started TSO transaction few steps earlier,
drivers/net/thunderx/nicvf_rxtx.h +2 -2
@@ -60,7 +60,7 @@ fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt) sqe.gather.subdesc_type =SQ_DESC_TYPE_GATHER ; sqe.gather.ld_type =NIC_SEND_LD_TYPE_E_LDT ; sqe.gather.size = pkt->data_len; - sqe.gather.addr =rte_mbuf_data_dma_addr (pkt); + sqe.gather.addr =rte_mbuf_data_iova (pkt); entry->buff[0 ] = sqe.buff[0 ]; entry->buff[1 ] = sqe.buff[1 ];
@@ -80,7 +80,7 @@ fill_sq_desc_gather(union sq_entry_t *entry, struct rte_mbuf *pkt) entry->buff[0 ] = (uint64_t )SQ_DESC_TYPE_GATHER <<60 | (uint64_t )NIC_SEND_LD_TYPE_E_LDT <<58 | pkt->data_len; - entry->buff[1] = rte_mbuf_data_dma_addr(pkt); + entry->buff[1] = rte_mbuf_data_iova(pkt); }#endif
drivers/net/vmxnet3/vmxnet3_rxtx.c +2 -2
@@ -509,7 +509,7 @@ vmxnet3_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts,rte_cpu_to_le_64 (txq->data_ring.basePA + offset); }else { - gdesc->txd.addr =rte_mbuf_data_dma_addr (m_seg); + gdesc->txd.addr =rte_mbuf_data_iova (m_seg); } gdesc->dword[2 ] = dw2 | m_seg->data_len;
@@ -617,7 +617,7 @@ vmxnet3_renew_desc(vmxnet3_rx_queue_t *rxq, uint8_t ring_id,*/ buf_info->m = mbuf; buf_info->len = (uint16_t )(mbuf->buf_len -RTE_PKTMBUF_HEADROOM ); - buf_info->bufPA =rte_mbuf_data_dma_addr_default (mbuf); + buf_info->bufPA =rte_mbuf_data_iova_default (mbuf);/* Load Rx Descriptor with the buffer's GPA */ rxd->addr = buf_info->bufPA;
examples/ipsec-secgw/esp.c +6 -6
@@ -106,12 +106,12 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, aad =get_aad (m);memcpy (aad, iv -sizeof (struct esp_hdr ),8 ); sym_cop->aead.aad.data = aad; - sym_cop->aead.aad.phys_addr =rte_pktmbuf_mtophys_offset (m, + sym_cop->aead.aad.phys_addr =rte_pktmbuf_iova_offset (m, aad - rte_pktmbuf_mtod(m, uint8_t *)); sym_cop->aead.digest.data = rte_pktmbuf_mtod_offset(m, void*,rte_pktmbuf_pkt_len (m) - sa->digest_len); - sym_cop->aead.digest.phys_addr =rte_pktmbuf_mtophys_offset (m, + sym_cop->aead.digest.phys_addr =rte_pktmbuf_iova_offset (m,rte_pktmbuf_pkt_len (m) - sa->digest_len); }else { sym_cop->cipher.data.offset = ip_hdr_len + sizeof(struct esp_hdr) +
@@ -157,7 +157,7 @@ esp_inbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->auth.digest.data = rte_pktmbuf_mtod_offset(m, void*,rte_pktmbuf_pkt_len (m) - sa->digest_len); - sym_cop->auth.digest.phys_addr =rte_pktmbuf_mtophys_offset (m, + sym_cop->auth.digest.phys_addr =rte_pktmbuf_iova_offset (m,rte_pktmbuf_pkt_len (m) - sa->digest_len); }
@@ -405,12 +405,12 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, aad =get_aad (m);memcpy (aad, esp,8 ); sym_cop->aead.aad.data = aad; - sym_cop->aead.aad.phys_addr =rte_pktmbuf_mtophys_offset (m, + sym_cop->aead.aad.phys_addr =rte_pktmbuf_iova_offset (m, aad - rte_pktmbuf_mtod(m, uint8_t *)); sym_cop->aead.digest.data = rte_pktmbuf_mtod_offset(m, uint8_t *,rte_pktmbuf_pkt_len (m) - sa->digest_len); - sym_cop->aead.digest.phys_addr =rte_pktmbuf_mtophys_offset (m, + sym_cop->aead.digest.phys_addr =rte_pktmbuf_iova_offset (m,rte_pktmbuf_pkt_len (m) - sa->digest_len); }else {switch (sa->cipher_algo) {
@@ -458,7 +458,7 @@ esp_outbound(struct rte_mbuf *m, struct ipsec_sa *sa, sym_cop->auth.digest.data = rte_pktmbuf_mtod_offset(m, uint8_t *,rte_pktmbuf_pkt_len (m) - sa->digest_len); - sym_cop->auth.digest.phys_addr =rte_pktmbuf_mtophys_offset (m, + sym_cop->auth.digest.phys_addr =rte_pktmbuf_iova_offset (m,rte_pktmbuf_pkt_len (m) - sa->digest_len); }
examples/l2fwd-crypto/main.c +2 -2
@@ -497,7 +497,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, uint8_t *) + ipdata_offset + data_len; } - op->sym->auth.digest.phys_addr =rte_pktmbuf_mtophys_offset (m, + op->sym->auth.digest.phys_addr =rte_pktmbuf_iova_offset (m,rte_pktmbuf_pkt_len (m) - cparams->digest_length);/* For wireless algorithms, offset/length must be in bits */
@@ -558,7 +558,7 @@ l2fwd_simple_crypto_enqueue(struct rte_mbuf *m, uint8_t *) + ipdata_offset + data_len; } - op->sym->aead.digest.phys_addr =rte_pktmbuf_mtophys_offset (m, + op->sym->aead.digest.phys_addr =rte_pktmbuf_iova_offset (m,rte_pktmbuf_pkt_len (m) - cparams->digest_length);if (cparams->aad.length) {
lib/librte_mbuf/rte_mbuf.h +31 -10
88 lines not on this page · raw message
test/test/test_cryptodev.c +21 -21
161 lines not on this page · raw message
test/test/test_cryptodev.h +1 -1
@@ -164,7 +164,7 @@ pktmbuf_mtophys_offset(struct rte_mbuf *mbuf, int offset) {printf ("pktmbuf_mtophys_offset: offset out of buffer\n" );return 0 ; } -return rte_pktmbuf_mtophys_offset (m, offset); +return rte_pktmbuf_iova_offset (m, offset); } static inline struct rte_mbuf *
Signature · 1 line
2.14.2
Re: [PATCH v4 12/15] mbuf: rename data address helpers to IOVA
Quoted 11 lines · Thomas Monjalon
The following inline functions and macros have been renamed to be consistent with the IOVA wording:
rte_mbuf_data_dma_addr->rte_mbuf_data_iovarte_mbuf_data_dma_addr_default->rte_mbuf_data_iova_defaultrte_pktmbuf_mtophys->rte_pktmbuf_iovarte_pktmbuf_mtophys_offset->rte_pktmbuf_iova_offsetThe deprecated functions and macros are kept to avoid breaking the API.
Signed-off-by Thomas Monjalon <[email protected]>
Same here, there are some remaining references after I apply the patches (maybe we are not on the same base commit id).
$ git grep 'mbuf.*phys'
...
lib/librte_mbuf/rte_mbuf.c: fprintf(f, "dump mbuf at %p, phys=%"PRIx64", buf_len=%u\n",
...
test/test/test_cryptodev.h:pktmbuf_mtophys_offset(struct rte_mbuf *mbuf, int offset) {
test/test/test_cryptodev.h: printf("pktmbuf_mtophys_offset: offset out of buffer\n");
test/test/test_cryptodev_blockcipher.c: pktmbuf_mtophys_offset(iobuf,
test/test/test_cryptodev_blockcipher.c: pktmbuf_mtophys_offset(sym_op->m_src,Apart from that,
Re: [PATCH v4 12/15] mbuf: rename data address helpers to IOVA
06/11/2017 16:56, Olivier MATZ:
Quoted 16 lines · Thomas Monjalon
Quoted 11 lines
The following inline functions and macros have been renamed to be consistent with the IOVA wording:
rte_mbuf_data_dma_addr->rte_mbuf_data_iovarte_mbuf_data_dma_addr_default->rte_mbuf_data_iova_defaultrte_pktmbuf_mtophys->rte_pktmbuf_iovarte_pktmbuf_mtophys_offset->rte_pktmbuf_iova_offsetThe deprecated functions and macros are kept to avoid breaking the API.
Signed-off-by Thomas Monjalon <[email protected]>Same here, there are some remaining references after I apply the patches (maybe we are not on the same base commit id).
Quoted 8 lines
$ git grep 'mbuf.*phys'
...
lib/librte_mbuf/rte_mbuf.c: fprintf(f, "dump mbuf at %p, phys=%"PRIx64", buf_len=%u\n",
...
test/test/test_cryptodev.h:pktmbuf_mtophys_offset(struct rte_mbuf *mbuf, int offset) {
test/test/test_cryptodev.h: printf("pktmbuf_mtophys_offset: offset out of buffer\n");
test/test/test_cryptodev_blockcipher.c: pktmbuf_mtophys_offset(iobuf,
test/test/test_cryptodev_blockcipher.c: pktmbuf_mtophys_offset(sym_op->m_src,You are right.
I will fix those occurences.
Thanks for the review.
PATCH v4 13/15 cryptodev: rename physical address type to IOVA
In reply to Thomas MonjalonFrom: Santosh Shukla <[email protected]>
Renamed data type from phys_addr_t to rte_iova_t.
--- app/test-crypto-perf/cperf_test_common.c | 2 +- app/test-crypto-perf/cperf_test_vectors.h | 4 ++-- doc/guides/prog_guide/cryptodev_lib.rst | 6 +++--- drivers/crypto/dpaa_sec/dpaa_sec.c | 18 +++++++++--------- drivers/crypto/qat/qat_adf/qat_algs.h | 6 +++--- drivers/crypto/qat/qat_crypto.c | 2 +- drivers/crypto/qat/qat_crypto.h | 2 +- examples/l2fwd-crypto/main.c | 2 +- lib/librte_cryptodev/rte_crypto.h | 2 +- lib/librte_cryptodev/rte_crypto_sym.h | 6 +++--- lib/librte_cryptodev/rte_cryptodev.h | 2 +- test/test/test_cryptodev.h | 2 +- 12 files changed, 27 insertions(+), 27 deletions(-)
app/test-crypto-perf/cperf_test_common.c +1 -1
@@ -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_virt2iova (obj) + +rte_iova_t next_seg_phys_addr =rte_mempool_virt2iova (obj) + mbuf_offset + mbuf_hdr_size; do {
app/test-crypto-perf/cperf_test_vectors.h +2 -2
@@ -78,13 +78,13 @@ struct cperf_test_vector {struct {uint8_t *data; -phys_addr_t phys_addr; +rte_iova_t phys_addr;uint16_t length; } aad;struct {uint8_t *data; -phys_addr_t phys_addr; +rte_iova_t phys_addr;uint16_t length; } digest;
doc/guides/prog_guide/cryptodev_lib.rst +3 -3
@@ -539,12 +539,12 @@ chain. struct { uint8_t *data; - phys_addr_t phys_addr; + rte_iova_t phys_addr; } digest; /**< Digest parameters */ struct { uint8_t *data; - phys_addr_t phys_addr; + rte_iova_t phys_addr; } aad; /**< Additional authentication parameters */ } aead;
@@ -566,7 +566,7 @@ chain. struct { uint8_t *data; - phys_addr_t phys_addr; + rte_iova_t phys_addr; } digest; /**< Digest parameters */ } auth; };
drivers/crypto/dpaa_sec/dpaa_sec.c +9 -9
@@ -110,7 +110,7 @@ dpaa_sec_alloc_ctx(dpaa_sec_session *ses)return ctx; } -static inline phys_addr_t +static inline rte_iova_t dpaa_mem_vtop (void *vaddr) {const struct rte_memseg *memseg =rte_eal_get_physmem_layout ();
@@ -124,14 +124,14 @@ dpaa_mem_vtop(void *vaddr) paddr = memseg[i].phys_addr + (vaddr_64 - memseg[i].addr_64); -return (phys_addr_t )paddr; +return (rte_iova_t )paddr; } } -return (phys_addr_t)(NULL ); +return (rte_iova_t)(NULL ); }static inline void * -dpaa_mem_ptov (phys_addr_t paddr) +dpaa_mem_ptov (rte_iova_t paddr) {const struct rte_memseg *memseg =rte_eal_get_physmem_layout ();int i;
@@ -158,7 +158,7 @@ ern_sec_fq_handler(struct qman_portal *qm __rte_unused,* all the packets in this queue could be dispatched into caam */ static int -dpaa_sec_init_rx (struct qman_fq *fq_in,phys_addr_t hwdesc, +dpaa_sec_init_rx (struct qman_fq *fq_in,rte_iova_t hwdesc,uint32_t fqid_out) {struct qm_mcc_initfq fq_opts;
@@ -566,7 +566,7 @@ build_auth_only(struct rte_crypto_op *op, dpaa_sec_session *ses)struct dpaa_sec_job *cf;struct dpaa_sec_op_ctx *ctx;struct qm_sg_entry *sg; -phys_addr_t start_addr; +rte_iova_t start_addr;uint8_t *old_digest; ctx =dpaa_sec_alloc_ctx (ses);
@@ -626,7 +626,7 @@ build_cipher_only(struct rte_crypto_op *op, dpaa_sec_session *ses)struct dpaa_sec_job *cf;struct dpaa_sec_op_ctx *ctx;struct qm_sg_entry *sg; -phys_addr_t src_start_addr, dst_start_addr; +rte_iova_t src_start_addr, dst_start_addr; uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, ses->iv.offset);
@@ -682,7 +682,7 @@ build_cipher_auth_gcm(struct rte_crypto_op *op, dpaa_sec_session *ses)struct dpaa_sec_op_ctx *ctx;struct qm_sg_entry *sg;uint32_t length =0 ; -phys_addr_t src_start_addr, dst_start_addr; +rte_iova_t src_start_addr, dst_start_addr; uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, ses->iv.offset);
@@ -793,7 +793,7 @@ build_cipher_auth(struct rte_crypto_op *op, dpaa_sec_session *ses)struct dpaa_sec_job *cf;struct dpaa_sec_op_ctx *ctx;struct qm_sg_entry *sg; -phys_addr_t src_start_addr, dst_start_addr; +rte_iova_t src_start_addr, dst_start_addr;uint32_t length =0 ; uint8_t *IV_ptr = rte_crypto_op_ctod_offset(op, uint8_t *, ses->iv.offset);
drivers/crypto/qat/qat_adf/qat_algs.h +3 -3
@@ -104,8 +104,8 @@ struct qat_alg_buf_list {struct qat_crypto_op_cookie {struct qat_alg_buf_list qat_sgl_list_src;struct qat_alg_buf_list qat_sgl_list_dst; -phys_addr_t qat_sgl_src_phys_addr; -phys_addr_t qat_sgl_dst_phys_addr; +rte_iova_t qat_sgl_src_phys_addr; +rte_iova_t qat_sgl_dst_phys_addr; };/* Common content descriptor */
@@ -124,7 +124,7 @@ struct qat_session {void *bpi_ctx;struct qat_alg_cd cd;uint8_t *cd_cur_ptr; -phys_addr_t cd_paddr; +rte_iova_t cd_paddr;struct icp_qat_fw_la_bulk_req fw_req;uint8_t aad_len;struct qat_crypto_instance *inst;
drivers/crypto/qat/qat_crypto.c +1 -1
@@ -1376,7 +1376,7 @@ qat_write_hw_desc_entry(struct rte_crypto_op *op, uint8_t *out_msg,* This address may used for setting AAD physical pointer * into IV offset from op */ -phys_addr_t aad_phys_addr_aead = op->sym->aead.aad.phys_addr; +rte_iova_t aad_phys_addr_aead = op->sym->aead.aad.phys_addr;if (ctx->qat_hash_alg ==ICP_QAT_HW_AUTH_ALGO_GALOIS_128 || ctx->qat_hash_alg ==
drivers/crypto/qat/qat_crypto.h +1 -1
@@ -70,7 +70,7 @@ enum qat_device_gen {struct qat_queue {char memz_name[RTE_MEMZONE_NAMESIZE ];void *base_addr;/* Base address */ -phys_addr_t base_phys_addr;/* Queue physical address */ +rte_iova_t base_phys_addr;/* Queue physical address */ uint32_t head;/* Shadow copy of the head */ uint32_t tail;/* Shadow copy of the tail */ uint32_t modulo;
examples/l2fwd-crypto/main.c +1 -1
@@ -140,7 +140,7 @@ enum l2fwd_crypto_xform_chain {struct l2fwd_key {uint8_t *data;uint32_t length; -phys_addr_t phys_addr; +rte_iova_t phys_addr; };struct l2fwd_iv {
lib/librte_cryptodev/rte_crypto.h +1 -1
@@ -118,7 +118,7 @@ struct rte_crypto_op {struct rte_mempool *mempool;/**< crypto operation mempool which operation is allocated from */ -phys_addr_t phys_addr; +rte_iova_t phys_addr;/**< physical address of crypto operation */ RTE_STD_C11
lib/librte_cryptodev/rte_crypto_sym.h +3 -3
@@ -548,7 +548,7 @@ struct rte_crypto_sym_op {* For GCM (@ref RTE_CRYPTO_AEAD_AES_GCM), for * "digest result" read "authentication tag T". */ -phys_addr_t phys_addr; +rte_iova_t phys_addr;/**< Physical address of digest */ } digest;/**< Digest parameters */ struct {
@@ -583,7 +583,7 @@ struct rte_crypto_sym_op {* of the block size (16 bytes). * */ -phys_addr_t phys_addr;/**< physical address */ +rte_iova_t phys_addr;/**< physical address */ } aad;/**< Additional authentication parameters */ } aead;
@@ -680,7 +680,7 @@ struct rte_crypto_sym_op {* will overwrite any data at this location. * */ -phys_addr_t phys_addr; +rte_iova_t phys_addr;/**< Physical address of digest */ } digest;/**< Digest parameters */ } auth;
lib/librte_cryptodev/rte_cryptodev.h +1 -1
@@ -110,7 +110,7 @@ extern const char **rte_cyptodev_names;* to calculate address from. */ #define rte_crypto_op_ctophys_offset (c, o) \ - (phys_addr_t)((c)->phys_addr + (o)) + (rte_iova_t)((c)->phys_addr + (o))/** * Crypto parameters range description
test/test/test_cryptodev.h +1 -1
@@ -153,7 +153,7 @@ pktmbuf_mtod_offset(struct rte_mbuf *mbuf, int offset) { return rte_pktmbuf_mtod_offset(m, uint8_t *, offset); } -static inline phys_addr_t +static inline rte_iova_t pktmbuf_mtophys_offset (struct rte_mbuf *mbuf,int offset) {struct rte_mbuf *m;
Signature · 1 line
2.14.2
PATCH v4 14/15 drivers/net: rename physical address type to IOVA
In reply to Thomas MonjalonFrom: Santosh Shukla <[email protected]>
Renamed data type from phys_addr_t to rte_iova_t.
--- drivers/net/ark/ark_ddm.c | 2 +- drivers/net/ark/ark_ddm.h | 4 +-- drivers/net/ark/ark_ethdev_rx.c | 12 ++++----- drivers/net/ark/ark_ethdev_tx.c | 2 +- drivers/net/ark/ark_mpu.c | 2 +- drivers/net/ark/ark_mpu.h | 4 +-- drivers/net/ark/ark_udm.c | 2 +- drivers/net/ark/ark_udm.h | 4 +-- drivers/net/avp/avp_ethdev.c | 2 +- drivers/net/avp/rte_avp_common.h | 20 +++++++-------- drivers/net/bnx2x/bnx2x.c | 40 +++++++++++++++--------------- drivers/net/bnx2x/bnx2x.h | 22 ++++++++-------- drivers/net/bnx2x/bnx2x_rxtx.c | 4 +-- drivers/net/bnx2x/bnx2x_stats.c | 2 +- drivers/net/bnx2x/bnx2x_vfpf.c | 2 +- drivers/net/bnx2x/ecore_sp.h | 2 +- drivers/net/bnxt/bnxt.h | 10 ++++---- drivers/net/bnxt/bnxt_cpr.h | 4 +-- drivers/net/bnxt/bnxt_ethdev.c | 2 +- drivers/net/bnxt/bnxt_hwrm.c | 6 ++--- drivers/net/bnxt/bnxt_ring.c | 2 +- drivers/net/bnxt/bnxt_ring.h | 2 +- drivers/net/bnxt/bnxt_rxr.h | 4 +-- drivers/net/bnxt/bnxt_txr.h | 2 +- drivers/net/bnxt/bnxt_vnic.c | 2 +- drivers/net/bnxt/bnxt_vnic.h | 6 ++--- drivers/net/liquidio/lio_rxtx.c | 4 +-- drivers/net/liquidio/lio_rxtx.h | 4 +-- drivers/net/octeontx/base/octeontx_pkovf.c | 2 +- drivers/net/qede/base/bcm_osal.h | 2 +- drivers/net/sfc/efsys.h | 2 +- drivers/net/sfc/sfc.c | 2 +- drivers/net/sfc/sfc_ef10_rx.c | 2 +- drivers/net/sfc/sfc_ef10_tx.c | 4 +-- drivers/net/thunderx/base/nicvf_hw.c | 2 +- drivers/net/thunderx/base/nicvf_hw.h | 2 +- drivers/net/thunderx/base/nicvf_hw_defs.h | 6 ++--- drivers/net/thunderx/nicvf_ethdev.c | 4 +-- drivers/net/thunderx/nicvf_ethdev.h | 4 +-- drivers/net/thunderx/nicvf_struct.h | 6 ++--- drivers/net/virtio/virtio_rxtx.h | 4 +-- drivers/net/virtio/virtqueue.h | 4 +-- lib/librte_vhost/vhost.h | 2 +- 43 files changed, 111 insertions(+), 111 deletions(-)
drivers/net/ark/ark_ddm.c +1 -1
@@ -93,7 +93,7 @@ ark_ddm_reset(struct ark_ddm_t *ddm) }void -ark_ddm_setup (struct ark_ddm_t *ddm,phys_addr_t cons_addr,uint32_t interval) +ark_ddm_setup (struct ark_ddm_t *ddm,rte_iova_t cons_addr,uint32_t interval) { ddm->setup.cons_write_index_addr = cons_addr; ddm->setup.write_index_interval = interval /4 ;/* 4 ns period */
drivers/net/ark/ark_ddm.h +2 -2
@@ -127,7 +127,7 @@ struct ark_ddm_cpld_ps_t {#define ARK_DDM_SETUP 0x00e0struct ark_ddm_setup_t { -phys_addr_t cons_write_index_addr; +rte_iova_t cons_write_index_addr;uint32_t write_index_interval;/* 4ns each */ volatile uint32_t cons_index; };
@@ -165,7 +165,7 @@ void ark_ddm_start(struct ark_ddm_t *ddm);int ark_ddm_stop (struct ark_ddm_t *ddm,const int wait);void ark_ddm_reset (struct ark_ddm_t *ddm);void ark_ddm_stats_reset (struct ark_ddm_t *ddm); -void ark_ddm_setup (struct ark_ddm_t *ddm,phys_addr_t cons_addr, +void ark_ddm_setup (struct ark_ddm_t *ddm,rte_iova_t cons_addr,uint32_t interval);void ark_ddm_dump_stats (struct ark_ddm_t *ddm,const char *msg);void ark_ddm_dump (struct ark_ddm_t *ddm,const char *msg);
drivers/net/ark/ark_ethdev_rx.c +6 -6
@@ -61,7 +61,7 @@ struct ark_rx_queue {struct rte_mbuf **reserve_q;/* array of physical addresses of the mbuf data pointer */ /* This point is a virtual address */ -phys_addr_t *paddress_q; +rte_iova_t *paddress_q;struct rte_mempool *mb_pool;struct ark_udm_t *udm;
@@ -95,9 +95,9 @@ eth_ark_rx_hw_setup(struct rte_eth_dev *dev,struct ark_rx_queue *queue, uint16_t rx_queue_id __rte_unused, uint16_t rx_queue_idx) { - phys_addr_t queue_base; -phys_addr_t phys_addr_q_base; -phys_addr_t phys_addr_prod_index; + rte_iova_t queue_base; +rte_iova_t phys_addr_q_base; +rte_iova_t phys_addr_prod_index; queue_base =rte_malloc_virt2iova (queue); phys_addr_prod_index = queue_base +
@@ -106,7 +106,7 @@ eth_ark_rx_hw_setup(struct rte_eth_dev *dev, phys_addr_q_base =rte_malloc_virt2iova (queue->paddress_q);/* Verify HW */ -if (ark_mpu_verify (queue->mpu,sizeof (phys_addr_t))) { +if (ark_mpu_verify (queue->mpu,sizeof (rte_iova_t))) {PMD_DRV_LOG (ERR ,"Illegal configuration rx queue\n" );return -1 ; }
@@ -204,7 +204,7 @@ eth_ark_dev_rx_queue_setup(struct rte_eth_dev *dev, socket_id); queue->paddress_q =rte_zmalloc_socket ("Ark_rx_queue paddr" , - nb_desc *sizeof (phys_addr_t), + nb_desc *sizeof (rte_iova_t),64 , socket_id);
drivers/net/ark/ark_ethdev_tx.c +1 -1
@@ -310,7 +310,7 @@ eth_ark_tx_queue_setup(struct rte_eth_dev *dev,static int eth_ark_tx_hw_queue_config (struct ark_tx_queue *queue) { -phys_addr_t queue_base, ring_base, cons_index_addr; +rte_iova_t queue_base, ring_base, cons_index_addr;uint32_t write_interval_ns;/* Verify HW -- MPU */
drivers/net/ark/ark_mpu.c +1 -1
@@ -118,7 +118,7 @@ ark_mpu_reset_stats(struct ark_mpu_t *mpu) }int -ark_mpu_configure (struct ark_mpu_t *mpu,phys_addr_t ring,uint32_t ring_size, +ark_mpu_configure (struct ark_mpu_t *mpu,rte_iova_t ring,uint32_t ring_size,int is_tx) {ark_mpu_reset (mpu);
drivers/net/ark/ark_mpu.h +2 -2
@@ -75,7 +75,7 @@ struct ark_mpu_hw_t {#define ARK_MPU_CFG 0x040struct ark_mpu_cfg_t { -phys_addr_t ring_base;/* phys_addr_t is a uint64_t */ +rte_iova_t ring_base;/* rte_iova_t is a uint64_t */ uint32_t ring_size;uint32_t ring_mask;uint32_t min_host_move;
@@ -137,7 +137,7 @@ int ark_mpu_verify(struct ark_mpu_t *mpu, uint32_t obj_size);void ark_mpu_stop (struct ark_mpu_t *mpu);void ark_mpu_start (struct ark_mpu_t *mpu);int ark_mpu_reset (struct ark_mpu_t *mpu); -int ark_mpu_configure (struct ark_mpu_t *mpu,phys_addr_t ring, +int ark_mpu_configure (struct ark_mpu_t *mpu,rte_iova_t ring,uint32_t ring_size,int is_tx);void ark_mpu_dump (struct ark_mpu_t *mpu,const char *msg,uint16_t idx);
drivers/net/ark/ark_udm.c +1 -1
@@ -122,7 +122,7 @@ ark_udm_configure(struct ark_udm_t *udm, }void -ark_udm_write_addr (struct ark_udm_t *udm,phys_addr_t addr) +ark_udm_write_addr (struct ark_udm_t *udm,rte_iova_t addr) { udm->rt_cfg.hw_prod_addr = addr; }
drivers/net/ark/ark_udm.h +2 -2
@@ -137,7 +137,7 @@ struct ark_udm_tlp_ps_t {#define ARK_UDM_RT_CFG 0x00e0struct ark_udm_rt_cfg_t { -phys_addr_t hw_prod_addr; +rte_iova_t hw_prod_addr;uint32_t write_interval;/* 4ns cycles */ volatile uint32_t prod_idx;/* RO */ };
@@ -171,7 +171,7 @@ void ark_udm_configure(struct ark_udm_t *udm,uint32_t headroom, uint32_t dataroom, uint32_t write_interval_ns); -void ark_udm_write_addr (struct ark_udm_t *udm,phys_addr_t addr); +void ark_udm_write_addr (struct ark_udm_t *udm,rte_iova_t addr);void ark_udm_stats_reset (struct ark_udm_t *udm);void ark_udm_dump_stats (struct ark_udm_t *udm,const char *msg); void ark_udm_dump_queue_stats(struct ark_udm_t *udm, const char *msg,
drivers/net/avp/avp_ethdev.c +1 -1
@@ -387,7 +387,7 @@ avp_dev_translate_buffer(struct avp_dev *avp, void *host_mbuf_address)/* translate from host physical address to guest virtual address */ static void *avp_dev_translate_address (struct rte_eth_dev *eth_dev, -phys_addr_t host_phys_addr) +rte_iova_t host_phys_addr) {struct rte_pci_device *pci_dev =RTE_ETH_DEV_TO_PCI (eth_dev);struct rte_mem_resource *resource;
drivers/net/avp/rte_avp_common.h +10 -10
@@ -243,7 +243,7 @@ struct rte_avp_desc {*/ struct rte_avp_memmap {void *addr; -phys_addr_t phys_addr; +rte_iova_t phys_addr;uint64_t length; };
@@ -345,7 +345,7 @@ RTE_AVP_MAKE_VERSION(RTE_AVP_RELEASE_VERSION_1, \*/ struct rte_avp_mempool_info {void *addr; -phys_addr_t phys_addr; +rte_iova_t phys_addr;uint64_t length; };
@@ -359,10 +359,10 @@ struct rte_avp_device_info {char ifname[RTE_AVP_NAMESIZE ];/**< Network device name for AVP */ -phys_addr_t tx_phys; -phys_addr_t rx_phys; -phys_addr_t alloc_phys; -phys_addr_t free_phys; +rte_iova_t tx_phys; +rte_iova_t rx_phys; +rte_iova_t alloc_phys; +rte_iova_t free_phys;uint32_t features;/**< Supported feature bitmap */ uint8_t min_rx_queues;/**< Minimum supported receive/free queues */
@@ -379,14 +379,14 @@ struct rte_avp_device_info {uint32_t free_size;/**< Size of each free queue */ /* Used by Ethtool */ -phys_addr_t req_phys; -phys_addr_t resp_phys; -phys_addr_t sync_phys; +rte_iova_t req_phys; +rte_iova_t resp_phys; +rte_iova_t sync_phys;void *sync_va;/* mbuf mempool (used when a single memory area is supported) */ void *mbuf_va; -phys_addr_t mbuf_phys; +rte_iova_t mbuf_phys;/* mbuf mempools */ struct rte_avp_mempool_info pool[RTE_AVP_MAX_MEMPOOLS ];
drivers/net/bnx2x/bnx2x.c +20 -20
@@ -419,7 +419,7 @@ void bnx2x_read_dmae(struct bnx2x_softc *sc, uint32_t src_addr, uint32_t len32) }void -bnx2x_write_dmae (struct bnx2x_softc *sc,phys_addr_t dma_addr,uint32_t dst_addr, +bnx2x_write_dmae (struct bnx2x_softc *sc,rte_iova_t dma_addr,uint32_t dst_addr,uint32_t len32) {struct dmae_command dmae;
@@ -447,7 +447,7 @@ bnx2x_write_dmae(struct bnx2x_softc *sc, phys_addr_t dma_addr, uint32_t dst_addr }static void -bnx2x_write_dmae_phys_len (struct bnx2x_softc *sc,phys_addr_t phys_addr, +bnx2x_write_dmae_phys_len (struct bnx2x_softc *sc,rte_iova_t phys_addr,uint32_t addr,uint32_t len) {uint32_t dmae_wr_max =DMAE_LEN32_WR_MAX (sc);
@@ -823,14 +823,14 @@ bnx2x_fw_command(struct bnx2x_softc *sc, uint32_t command, uint32_t param)static void __storm_memset_dma_mapping (struct bnx2x_softc *sc,uint32_t addr, -phys_addr_t mapping) +rte_iova_t mapping) {REG_WR (sc, addr,U64_LO (mapping));REG_WR (sc, (addr +4 ),U64_HI (mapping)); }static void -storm_memset_spq_addr (struct bnx2x_softc *sc,phys_addr_t mapping, +storm_memset_spq_addr (struct bnx2x_softc *sc,rte_iova_t mapping,uint16_t abs_fid) { uint32_t addr = (XSEM_REG_FAST_MEMORY +
@@ -1498,7 +1498,7 @@ bnx2x_set_q_rx_mode(struct bnx2x_softc *sc, uint8_t cl_id, ramrod_param.rdata =BNX2X_SP (sc, rx_mode_rdata); ramrod_param.rdata_mapping = - (phys_addr_t )BNX2X_SP_MAPPING (sc, rx_mode_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, rx_mode_rdata),bnx2x_set_bit (ECORE_FILTER_RX_MODE_PENDING , &sc->sp_state); ramrod_param.ramrod_flags = ramrod_flags;
@@ -4599,9 +4599,9 @@ static void bnx2x_init_func_obj(struct bnx2x_softc *sc)ecore_init_func_obj (sc, &sc->func_obj,BNX2X_SP (sc, func_rdata), - (phys_addr_t )BNX2X_SP_MAPPING (sc, func_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, func_rdata),BNX2X_SP (sc, func_afex_rdata), - (phys_addr_t )BNX2X_SP_MAPPING (sc, func_afex_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, func_afex_rdata), &bnx2x_func_sp_drv); }
@@ -4772,7 +4772,7 @@ static void bnx2x_map_sb_state_machines(struct hc_index_data *index_data) }static void -bnx2x_init_sb (struct bnx2x_softc *sc,phys_addr_t busaddr,int vfid, +bnx2x_init_sb (struct bnx2x_softc *sc,rte_iova_t busaddr,int vfid,uint8_t vf_valid,int fw_sb_id,int igu_sb_id) {struct hc_status_block_data_e2 sb_data_e2;
@@ -4918,7 +4918,7 @@ static void bnx2x_init_eth_fp(struct bnx2x_softc *sc, int idx) sc->max_cos,SC_FUNC (sc),BNX2X_SP (sc, q_rdata), - (phys_addr_t )BNX2X_SP_MAPPING (sc, q_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, q_rdata), q_type);/* configure classification DBs */
@@ -4928,7 +4928,7 @@ static void bnx2x_init_eth_fp(struct bnx2x_softc *sc, int idx) idx,SC_FUNC (sc),BNX2X_SP (sc, mac_rdata), - (phys_addr_t )BNX2X_SP_MAPPING (sc, mac_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, mac_rdata),ECORE_FILTER_MAC_PENDING , &sc->sp_state, ECORE_OBJ_TYPE_RX_TX, &sc->macs_pool); }
@@ -5028,7 +5028,7 @@ static void bnx2x_init_tx_rings(struct bnx2x_softc *sc)static void bnx2x_init_def_sb (struct bnx2x_softc *sc) {struct host_sp_status_block *def_sb = sc->def_sb; -phys_addr_t mapping = sc->def_sb_dma.paddr; +rte_iova_t mapping = sc->def_sb_dma.paddr;int igu_sp_sb_index;int igu_seg_id;int port =SC_PORT (sc);
@@ -5700,7 +5700,7 @@ static void bnx2x_init_objs(struct bnx2x_softc *sc)SC_FUNC (sc),SC_FUNC (sc),BNX2X_SP (sc, mcast_rdata), - (phys_addr_t )BNX2X_SP_MAPPING (sc, mcast_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, mcast_rdata),ECORE_FILTER_MCAST_PENDING , &sc->sp_state, o_type);
@@ -5724,7 +5724,7 @@ static void bnx2x_init_objs(struct bnx2x_softc *sc)SC_FUNC (sc),SC_FUNC (sc),BNX2X_SP (sc, rss_rdata), - (phys_addr_t )BNX2X_SP_MAPPING (sc, rss_rdata), + (rte_iova_t )BNX2X_SP_MAPPING (sc, rss_rdata),ECORE_FILTER_RSS_CONF_PENDING , &sc->sp_state, ECORE_OBJ_TYPE_RX); }
@@ -6445,9 +6445,9 @@ bnx2x_pf_rx_q_prep(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp, pause->pri_map =1 ;/* rxq setup */ - rxq_init->dscr_map = (phys_addr_t )rxq->rx_ring_phys_addr; - rxq_init->rcq_map = (phys_addr_t )rxq->cq_ring_phys_addr; - rxq_init->rcq_np_map = (phys_addr_t)(rxq->cq_ring_phys_addr + + rxq_init->dscr_map = (rte_iova_t )rxq->rx_ring_phys_addr; + rxq_init->rcq_map = (rte_iova_t )rxq->cq_ring_phys_addr; + rxq_init->rcq_np_map = (rte_iova_t)(rxq->cq_ring_phys_addr +BNX2X_PAGE_SIZE );/*
@@ -6486,7 +6486,7 @@ bnx2x_pf_tx_q_prep(struct bnx2x_softc *sc, struct bnx2x_fastpath *fp,PMD_TX_LOG (ERR ,"ERROR: TX queue is NULL" );return ; } - txq_init->dscr_map = (phys_addr_t )txq->tx_ring_phys_addr; + txq_init->dscr_map = (rte_iova_t )txq->tx_ring_phys_addr; txq_init->sb_cq_index =HC_INDEX_ETH_FIRST_TX_CQ_CONS + cos; txq_init->traffic_type =LLFC_TRAFFIC_TYPE_NW ; txq_init->fw_sb_id = fp->fw_sb_id;
@@ -11059,7 +11059,7 @@ static int bnx2x_init_hw_func(struct bnx2x_softc *sc)for (i =0 ; i <L2_ILT_LINES (sc); i++) { ilt->lines[cdu_ilt_start + i].page = sc->context[i].vcxt; ilt->lines[cdu_ilt_start + i].page_mapping = - (phys_addr_t )sc->context[i].vcxt_dma.paddr; + (rte_iova_t )sc->context[i].vcxt_dma.paddr; ilt->lines[cdu_ilt_start + i].size = sc->context[i].size; }ecore_ilt_init_op (sc,INITOP_SET );
@@ -11357,7 +11357,7 @@ static void bnx2x_reset_port(struct bnx2x_softc *sc) } } -static void bnx2x_ilt_wr (struct bnx2x_softc *sc,uint32_t index,phys_addr_t addr) +static void bnx2x_ilt_wr (struct bnx2x_softc *sc,uint32_t index,rte_iova_t addr) {int reg;uint32_t wb_write[2 ];
@@ -11587,7 +11587,7 @@ static int ecore_gunzip(struct bnx2x_softc *sc, const uint8_t * zbuf, int len) }static void -ecore_write_dmae_phys_len (struct bnx2x_softc *sc,phys_addr_t phys_addr, +ecore_write_dmae_phys_len (struct bnx2x_softc *sc,rte_iova_t phys_addr,uint32_t addr,uint32_t len) {bnx2x_write_dmae_phys_len (sc, phys_addr, addr, len);
drivers/net/bnx2x/bnx2x.h +11 -11
@@ -318,7 +318,7 @@ struct bnx2x_bar {/* Used to manage DMA allocations. */ struct bnx2x_dma {struct bnx2x_softc *sc; -phys_addr_t paddr; +rte_iova_t paddr;void *vaddr;int nseg;char msg[RTE_MEMZONE_NAMESIZE -6 ];
@@ -371,10 +371,10 @@ struct bnx2x_fastpath {struct bnx2x_dma sb_dma;union bnx2x_host_hc_status_block status_block; -phys_addr_t tx_desc_mapping; +rte_iova_t tx_desc_mapping; -phys_addr_t rx_desc_mapping; -phys_addr_t rx_comp_mapping; +rte_iova_t rx_desc_mapping; +rte_iova_t rx_comp_mapping;uint16_t *sb_index_values;uint16_t *sb_running_index;
@@ -469,7 +469,7 @@ union cdu_context {struct hw_context {struct bnx2x_dma vcxt_dma;union cdu_context *vcxt; -//phys_addr_t cxt_mapping; +//rte_iova_t cxt_mapping; size_t size; };
@@ -1243,7 +1243,7 @@ struct bnx2x_softc {uint32_t gz_outlen;#define GUNZIP_BUF (sc) (sc->gz_buf)#define GUNZIP_OUTLEN (sc) (sc->gz_outlen) -#define GUNZIP_PHYS (sc) (phys_addr_t)(sc->gz_buf_dma.paddr) +#define GUNZIP_PHYS (sc) (rte_iova_t)(sc->gz_buf_dma.paddr)#define FW_BUF_SIZE 0x40000struct raw_op *init_ops;
@@ -1311,14 +1311,14 @@ struct bnx2x_softc {*/ int fw_stats_req_size;struct bnx2x_fw_stats_req *fw_stats_req; -phys_addr_t fw_stats_req_mapping; +rte_iova_t fw_stats_req_mapping;/* * FW statistics data shortcut (points at the beginning of fw_stats * buffer + fw_stats_req_size). */ int fw_stats_data_size;struct bnx2x_fw_stats_data *fw_stats_data; -phys_addr_t fw_stats_data_mapping; +rte_iova_t fw_stats_data_mapping;/* tracking a pending STAT_QUERY ramrod */ uint16_t stats_pending;
@@ -1403,8 +1403,8 @@ union bnx2x_stats_show_data {#define FUNC_FLG_LEADING 0x0020/* PF only */ struct bnx2x_func_init_params { -phys_addr_t fw_stat_map;/* (dma) valid if FUNC_FLG_STATS */ -phys_addr_t spq_map;/* (dma) valid if FUNC_FLG_SPQ */ +rte_iova_t fw_stat_map;/* (dma) valid if FUNC_FLG_STATS */ +rte_iova_t spq_map;/* (dma) valid if FUNC_FLG_SPQ */ uint16_t func_flgs;uint16_t func_id;/* abs function id */ uint16_t pf_id;
@@ -1749,7 +1749,7 @@ uint32_t bnx2x_dmae_opcode(struct bnx2x_softc *sc, uint8_t src_type, uint8_t comp_type);void bnx2x_post_dmae (struct bnx2x_softc *sc,struct dmae_command *dmae,int idx);void bnx2x_read_dmae (struct bnx2x_softc *sc,uint32_t src_addr,uint32_t len32); -void bnx2x_write_dmae (struct bnx2x_softc *sc,phys_addr_t dma_addr, +void bnx2x_write_dmae (struct bnx2x_softc *sc,rte_iova_t dma_addr,uint32_t dst_addr,uint32_t len32);void bnx2x_set_ctx_validation (struct bnx2x_softc *sc,struct eth_context *cxt,uint32_t cid);
drivers/net/bnx2x/bnx2x_rxtx.c +2 -2
@@ -71,8 +71,8 @@ bnx2x_dev_rx_queue_setup(struct rte_eth_dev *dev,struct bnx2x_softc *sc = dev->data->dev_private;struct bnx2x_fastpath *fp = &sc->fp[queue_idx];struct eth_rx_cqe_next_page *nextpg; -phys_addr_t *rx_bd; -phys_addr_t busaddr; +rte_iova_t *rx_bd; +rte_iova_t busaddr;/* First allocate the rx queue data structure */ rxq = rte_zmalloc_socket("ethdev RX queue", sizeof(struct bnx2x_rx_queue),
drivers/net/bnx2x/bnx2x_stats.c +1 -1
@@ -1338,7 +1338,7 @@ bnx2x_prep_fw_stats_req(struct bnx2x_softc *sc)int i;int first_queue_query_index;struct stats_query_header *stats_hdr = &sc->fw_stats_req->hdr; -phys_addr_t cur_data_offset; +rte_iova_t cur_data_offset;struct stats_query_entry *cur_query_entry; stats_hdr->cmd_num = sc->fw_stats_num;
drivers/net/bnx2x/bnx2x_vfpf.c +1 -1
@@ -113,7 +113,7 @@ bnx2x_vf_finalize(struct bnx2x_softc *sc,#define BNX2X_VF_CHANNEL_TRIES 100static int -bnx2x_do_req4pf (struct bnx2x_softc *sc,phys_addr_t phys_addr) +bnx2x_do_req4pf (struct bnx2x_softc *sc,rte_iova_t phys_addr) {uint8_t *status = &sc->vf2pf_mbox->resp.common_reply.status;uint8_t i;
drivers/net/bnx2x/ecore_sp.h +1 -1
@@ -36,7 +36,7 @@#include "ecore_reg.h" struct bnx2x_softc ; -typedef phys_addr_t ecore_dma_addr_t ;/* expected to be 64 bit wide */ +typedef rte_iova_t ecore_dma_addr_t ;/* expected to be 64 bit wide */ typedef volatile int ecore_atomic_t ;
drivers/net/bnxt/bnxt.h +5 -5
@@ -133,7 +133,7 @@ struct bnxt_pf_info {uint16_t max_vfs;uint32_t func_cfg_flags;void *vf_req_buf; -phys_addr_t vf_req_buf_dma_addr; +rte_iova_t vf_req_buf_dma_addr;uint32_t vf_req_fwd[8 ];uint16_t total_vnics;struct bnxt_child_vf_info *vf_info;
@@ -203,14 +203,14 @@ struct bnxt {struct bnxt_rx_queue **rx_queues;const void *rx_mem_zone;struct rx_port_stats *hw_rx_port_stats; -phys_addr_t hw_rx_port_stats_map; +rte_iova_t hw_rx_port_stats_map;unsigned int tx_nr_rings;unsigned int tx_cp_nr_rings;struct bnxt_tx_queue **tx_queues;const void *tx_mem_zone;struct tx_port_stats *hw_tx_port_stats; -phys_addr_t hw_tx_port_stats_map; +rte_iova_t hw_tx_port_stats_map;/* Default completion ring */ struct bnxt_cp_ring_info *def_cp_ring;
@@ -236,9 +236,9 @@ struct bnxt {uint16_t hwrm_cmd_seq;void *hwrm_cmd_resp_addr; -phys_addr_t hwrm_cmd_resp_dma_addr; +rte_iova_t hwrm_cmd_resp_dma_addr;void *hwrm_short_cmd_req_addr; -phys_addr_t hwrm_short_cmd_req_dma_addr; +rte_iova_t hwrm_short_cmd_req_dma_addr;rte_spinlock_t hwrm_lock;uint16_t max_req_len;uint16_t max_resp_len;
drivers/net/bnxt/bnxt_cpr.h +2 -2
@@ -86,10 +86,10 @@ struct bnxt_cp_ring_info {struct cmpl_base *cp_desc_ring; -phys_addr_t cp_desc_mapping; +rte_iova_t cp_desc_mapping;struct ctx_hw_stats *hw_stats; -phys_addr_t hw_stats_map; +rte_iova_t hw_stats_map;uint32_t hw_stats_ctx_id;struct bnxt_ring *cp_ring_struct;
drivers/net/bnxt/bnxt_ethdev.c +1 -1
@@ -2796,7 +2796,7 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)const struct rte_memzone *mz =NULL ;static int version_printed;uint32_t total_alloc_len; -phys_addr_t mz_phys_addr; +rte_iova_t mz_phys_addr;struct bnxt *bp;int rc;
drivers/net/bnxt/bnxt_hwrm.c +3 -3
@@ -3026,7 +3026,7 @@ int bnxt_get_nvram_directory(struct bnxt *bp, uint32_t len, uint8_t *data)uint32_t entry_length;uint8_t *buf;size_t buflen; -phys_addr_t dma_handle; +rte_iova_t dma_handle;struct hwrm_nvm_get_dir_entries_input req = {0 };struct hwrm_nvm_get_dir_entries_output *resp = bp->hwrm_cmd_resp_addr;
@@ -3071,7 +3071,7 @@ int bnxt_hwrm_get_nvram_item(struct bnxt *bp, uint32_t index, {int rc;uint8_t *buf; -phys_addr_t dma_handle; +rte_iova_t dma_handle;struct hwrm_nvm_read_input req = {0 };struct hwrm_nvm_read_output *resp = bp->hwrm_cmd_resp_addr;
@@ -3125,7 +3125,7 @@ int bnxt_hwrm_flash_nvram(struct bnxt *bp, uint16_t dir_type,int rc;struct hwrm_nvm_write_input req = {0 };struct hwrm_nvm_write_output *resp = bp->hwrm_cmd_resp_addr; -phys_addr_t dma_handle; +rte_iova_t dma_handle;uint8_t *buf;HWRM_PREP (req,NVM_WRITE );
drivers/net/bnxt/bnxt_ring.c +1 -1
@@ -98,7 +98,7 @@ int bnxt_alloc_rings(struct bnxt *bp, uint16_t qidx,struct rte_pci_device *pdev = bp->pdev;const struct rte_memzone *mz =NULL ;char mz_name[RTE_MEMZONE_NAMESIZE ]; -phys_addr_t mz_phys_addr; +rte_iova_t mz_phys_addr;int sz; int stats_len = (tx_ring_info || rx_ring_info) ?
drivers/net/bnxt/bnxt_ring.h +1 -1
@@ -70,7 +70,7 @@struct bnxt_ring {void *bd; -phys_addr_t bd_dma; +rte_iova_t bd_dma;uint32_t ring_size;uint32_t ring_mask;
drivers/net/bnxt/bnxt_rxr.h +2 -2
@@ -101,8 +101,8 @@ struct bnxt_rx_ring_info {struct bnxt_sw_rx_bd *rx_buf_ring;/* sw ring */ struct bnxt_sw_rx_bd *ag_buf_ring;/* sw ring */ -phys_addr_t rx_desc_mapping; -phys_addr_t ag_desc_mapping; +rte_iova_t rx_desc_mapping; +rte_iova_t ag_desc_mapping;struct bnxt_ring *rx_ring_struct;struct bnxt_ring *ag_ring_struct;
drivers/net/bnxt/bnxt_txr.h +1 -1
@@ -49,7 +49,7 @@ struct bnxt_tx_ring_info {struct tx_bd_long *tx_desc_ring;struct bnxt_sw_tx_bd *tx_buf_ring; -phys_addr_t tx_desc_mapping; +rte_iova_t tx_desc_mapping;#define BNXT_DEV_STATE_CLOSING 0x1uint32_t dev_state;
drivers/net/bnxt/bnxt_vnic.c +1 -1
@@ -175,7 +175,7 @@ int bnxt_alloc_vnic_attributes(struct bnxt *bp) BNXT_MAX_MC_ADDRS * ETHER_ADDR_LEN);uint16_t max_vnics;int i; -phys_addr_t mz_phys_addr; +rte_iova_t mz_phys_addr; max_vnics = bp->max_vnics; snprintf(mz_name, RTE_MEMZONE_NAMESIZE,
drivers/net/bnxt/bnxt_vnic.h +3 -3
@@ -53,11 +53,11 @@ struct bnxt_vnic_info {uint16_t dflt_ring_grp;uint16_t mru;uint16_t hash_type; -phys_addr_t rss_table_dma_addr; +rte_iova_t rss_table_dma_addr;uint16_t *rss_table; -phys_addr_t rss_hash_key_dma_addr; +rte_iova_t rss_hash_key_dma_addr;void *rss_hash_key; -phys_addr_t mc_list_dma_addr; +rte_iova_t mc_list_dma_addr;char *mc_list;uint32_t mc_addr_cnt;#define BNXT_MAX_MC_ADDRS 16
drivers/net/liquidio/lio_rxtx.c +2 -2
@@ -1744,7 +1744,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) }else {struct lio_buf_free_info *finfo;struct lio_gather *g; -phys_addr_t phyaddr; +rte_iova_t phyaddr;int i, frags; finfo = (struct lio_buf_free_info *)rte_malloc(NULL,
@@ -1791,7 +1791,7 @@ lio_dev_xmit_pkts(void *tx_queue, struct rte_mbuf **pkts, uint16_t nb_pkts) } phyaddr =rte_mem_virt2iova (g->sg); -if (phyaddr ==RTE_BAD_PHYS_ADDR ) { +if (phyaddr ==RTE_BAD_IOVA ) {PMD_TX_LOG (lio_dev,ERR ,"bad phys addr\n" ); goto xmit_failed; }
drivers/net/liquidio/lio_rxtx.h +2 -2
@@ -686,7 +686,7 @@ lio_swap_8B_data(uint64_t *data, uint32_t blocks)static inline uint64_t lio_map_ring (void *buf) { -phys_addr_t dma_addr; +rte_iova_t dma_addr; dma_addr =rte_mbuf_data_iova_default (((struct rte_mbuf *)buf));
@@ -696,7 +696,7 @@ lio_map_ring(void *buf)static inline uint64_t lio_map_ring_info (struct lio_droq *droq,uint32_t i) { -phys_addr_t dma_addr; +rte_iova_t dma_addr; dma_addr = droq->info_list_dma + (i *LIO_DROQ_INFO_SIZE );
drivers/net/octeontx/base/octeontx_pkovf.c +1 -1
@@ -46,7 +46,7 @@struct octeontx_pko_iomem {uint8_t *va; -phys_addr_t iova; +rte_iova_t iova;size_t size; };
drivers/net/qede/base/bcm_osal.h +1 -1
@@ -63,7 +63,7 @@ typedef u32 OSAL_BE32;#define osal_uintptr_t uintptr_t -typedef phys_addr_t dma_addr_t ; +typedef rte_iova_t dma_addr_t ;typedef rte_spinlock_t osal_spinlock_t ;
drivers/net/sfc/efsys.h +1 -1
@@ -253,7 +253,7 @@ typedef struct __efsys_identifier_s efsys_identifier_t;/* DMA */ -typedef phys_addr_t efsys_dma_addr_t ; +typedef rte_iova_t efsys_dma_addr_t ; typedef struct efsys_mem_s { const struct rte_memzone *esm_mz;
drivers/net/sfc/sfc.c +1 -1
@@ -62,7 +62,7 @@ sfc_dma_alloc(const struct sfc_adapter *sa, const char *name, uint16_t id, } esmp->esm_addr = mz->iova; -if (esmp->esm_addr ==RTE_BAD_PHYS_ADDR ) { +if (esmp->esm_addr ==RTE_BAD_IOVA ) { (void )rte_memzone_free (mz);return EFAULT ; }
drivers/net/sfc/sfc_ef10_rx.c +1 -1
@@ -177,7 +177,7 @@ sfc_ef10_rx_qrefill(struct sfc_ef10_rxq *rxq) ++i, ++id) {struct rte_mbuf *m = objs[i];struct sfc_ef10_rx_sw_desc *rxd; -phys_addr_t phys_addr; +rte_iova_t phys_addr;SFC_ASSERT ((id & ~ptr_mask) ==0 ); rxd = &rxq->sw_ring[id];
drivers/net/sfc/sfc_ef10_tx.c +2 -2
@@ -195,7 +195,7 @@ sfc_ef10_tx_reap(struct sfc_ef10_txq *txq) }static void -sfc_ef10_tx_qdesc_dma_create (phys_addr_t addr,uint16_t size,bool eop, +sfc_ef10_tx_qdesc_dma_create (rte_iova_t addr,uint16_t size,bool eop,efx_qword_t *edp) { EFX_POPULATE_QWORD_4(*edp,
@@ -341,7 +341,7 @@ sfc_ef10_xmit_pkts(void *tx_queue, struct rte_mbuf **tx_pkts, uint16_t nb_pkts) pkt_len = m_seg->pkt_len; do { - phys_addr_t seg_addr = rte_mbuf_data_iova(m_seg); + rte_iova_t seg_addr = rte_mbuf_data_iova(m_seg); unsigned int seg_len = rte_pktmbuf_data_len(m_seg); unsigned int id = added & ptr_mask;
drivers/net/thunderx/base/nicvf_hw.c +1 -1
@@ -509,7 +509,7 @@ nicvf_qset_rbdr_precharge(void *dev, struct nicvf *nic,struct rbdr_entry_t *desc, *desc0;struct nicvf_rbdr *rbdr = nic->rbdr;uint32_t count; -nicvf_phys_addr_t phy; +nicvf_iova_addr_t phy;assert (rbdr !=NULL ); desc = rbdr->desc;
drivers/net/thunderx/base/nicvf_hw.h +1 -1
@@ -88,7 +88,7 @@ enum nicvf_err_e { NICVF_ERR_RSS_GET_SZ, /* -8171 */ }; -typedef nicvf_phys_addr_t (*rbdr_pool_get_handler )(void *dev,void *opaque); +typedef nicvf_iova_addr_t (*rbdr_pool_get_handler )(void *dev,void *opaque);struct nicvf_hw_rx_qstats {uint64_t q_rx_bytes;
drivers/net/thunderx/base/nicvf_hw_defs.h +3 -3
@@ -213,7 +213,7 @@#define NICVF_STATIC_ASSERT (s) _Static_assert(s, #s)#define assert_primary (nic) assert((nic)->sqs_mode == 0) -typedef uint64_t nicvf_phys_addr_t ; +typedef uint64_t nicvf_iova_addr_t ;/* vNIC HW Enumerations */
@@ -840,7 +840,7 @@ struct rbdr_entry_t { uint64_t buf_addr:42; uint64_t cache_align:7; }; -nicvf_phys_addr_t full_addr; +nicvf_iova_addr_t full_addr; };#else union {
@@ -849,7 +849,7 @@ struct rbdr_entry_t { uint64_t buf_addr:42; uint64_t rsvd0:15; }; -nicvf_phys_addr_t full_addr; +nicvf_iova_addr_t full_addr; };#endif };
drivers/net/thunderx/nicvf_ethdev.c +2 -2
@@ -680,7 +680,7 @@ nicvf_qset_rbdr_alloc(struct rte_eth_dev *dev, struct nicvf *nic,static void nicvf_rbdr_release_mbuf (struct rte_eth_dev *dev,struct nicvf *nic, -nicvf_phys_addr_t phy) +nicvf_iova_addr_t phy) {uint16_t qidx;void *obj;
@@ -1429,7 +1429,7 @@ nicvf_dev_info_get(struct rte_eth_dev *dev, struct rte_eth_dev_info *dev_info) }; } -static nicvf_phys_addr_t +static nicvf_iova_addr_t rbdr_rte_mempool_get (void *dev,void *opaque) {uint16_t qidx;
drivers/net/thunderx/nicvf_ethdev.h +2 -2
@@ -104,7 +104,7 @@ nicvf_netdev_qidx(struct nicvf *nic, uint8_t local_qidx)* P = V - offset */ static inline uintptr_t -nicvf_mbuff_phy2virt (phys_addr_t phy,uint64_t mbuf_phys_off) +nicvf_mbuff_phy2virt (rte_iova_t phy,uint64_t mbuf_phys_off) {return (uintptr_t )(phy + mbuf_phys_off); }
@@ -112,7 +112,7 @@ nicvf_mbuff_phy2virt(phys_addr_t phy, uint64_t mbuf_phys_off)static inline uintptr_t nicvf_mbuff_virt2phy (uintptr_t virt,uint64_t mbuf_phys_off) { -return (phys_addr_t)(virt - mbuf_phys_off); +return (rte_iova_t)(virt - mbuf_phys_off); } static inline void
drivers/net/thunderx/nicvf_struct.h +3 -3
@@ -46,7 +46,7 @@ struct nicvf_rbdr {uintptr_t rbdr_status;uintptr_t rbdr_door;struct rbdr_entry_t *desc; -nicvf_phys_addr_t phys; +nicvf_iova_addr_t phys;uint32_t buffsz;uint32_t tail;uint32_t next_tail;
@@ -56,7 +56,7 @@ struct nicvf_rbdr {struct nicvf_txq {union sq_entry_t *desc; -nicvf_phys_addr_t phys; +nicvf_iova_addr_t phys;struct rte_mbuf **txbuffs;uintptr_t sq_head;uintptr_t sq_door;
@@ -87,7 +87,7 @@ struct nicvf_rxq {uintptr_t cq_status;uintptr_t cq_door;union mbuf_initializer mbuf_initializer; -nicvf_phys_addr_t phys; +nicvf_iova_addr_t phys;union cq_entry_t *desc;struct nicvf_rbdr *shared_rbdr;struct nicvf *nic;
drivers/net/virtio/virtio_rxtx.h +2 -2
@@ -66,7 +66,7 @@ struct virtnet_tx {struct virtqueue *vq;/**< memzone to populate hdr. */ const struct rte_memzone *virtio_net_hdr_mz; -phys_addr_t virtio_net_hdr_mem;/**< hdr for each xmit packet */ +rte_iova_t virtio_net_hdr_mem;/**< hdr for each xmit packet */ uint16_t queue_id;/**< DPDK queue index. */ uint16_t port_id;/**< Device port identifier. */
@@ -81,7 +81,7 @@ struct virtnet_ctl {struct virtqueue *vq;/**< memzone to populate hdr. */ const struct rte_memzone *virtio_net_hdr_mz; -phys_addr_t virtio_net_hdr_mem;/**< hdr for each xmit packet */ +rte_iova_t virtio_net_hdr_mem;/**< hdr for each xmit packet */ uint16_t port_id;/**< Device port identifier. */ const struct rte_memzone *mz;/**< mem zone to populate CTL ring. */ };
drivers/net/virtio/virtqueue.h +2 -2
@@ -203,8 +203,8 @@ struct virtqueue {struct virtnet_ctl cq; }; -phys_addr_t vq_ring_mem;/**< physical address of vring, -* or virtual address for virtio_user. */ +rte_iova_t vq_ring_mem;/**< physical address of vring, +* or virtual address for virtio_user. */ /** * Head of the free chain in the descriptor table. If
lib/librte_vhost/vhost.h +1 -1
@@ -338,7 +338,7 @@ extern uint64_t VHOST_FEATURES;extern struct virtio_net *vhost_devices[MAX_VHOST_DEVICE ];/* Convert guest physical address to host physical address */ -static __rte_always_inline phys_addr_t +static __rte_always_inline rte_iova_tgpa_to_hpa (struct virtio_net *dev,uint64_t gpa,uint64_t size) {uint32_t i;
Signature · 1 line
2.14.2
PATCH v4 15/15 doc: add IOVA aware API changes in release notes
In reply to Thomas MonjalonThe wording changes have been done in the API without breaking the ABI. The deprecated fields and symbols can be removed later when an another ABI change will be required.
The deprecation notice can be removed.
The release notes describe the new available API with IOVA wording.
--- doc/guides/rel_notes/deprecation.rst | 7 ------- doc/guides/rel_notes/release_17_11.rst | 17 +++++++++++++++++ 2 files changed, 17 insertions(+), 7 deletions(-)
doc/guides/rel_notes/deprecation.rst +0 -7
@@ -21,13 +21,6 @@ Deprecation Notices - ``rte_eal_devargs_type_count`` - ``rte_eal_parse_devargs_str``, replaced by ``rte_eal_devargs_parse`` -* eal: An ABI change is planned for 17.11 to make DPDK aware of IOVA address - translation scheme. - Reference to phys address in EAL data-structure or functions may change to - IOVA address or more appropriate name. - The change will be only for the name. - Functional aspects of the API or data-structure will remain same. - * pci: Several exposed functions are misnamed. The following functions are deprecated starting from v17.11 and are replaced:
doc/guides/rel_notes/release_17_11.rst +17 -0
@@ -321,6 +321,23 @@ API Changes * ``rte_mem_phy2mch`` was used in Xen dom0 to obtain the physical address; remove this API as Xen dom0 support was removed. +* **Some data type, structure members and functions related to physical address + are deprecated and have new alias with IOVA wording.** + + * ``phys_addr_t`` can be often replaced by ``rte_iova_t`` of same size. + * ``RTE_BAD_PHYS_ADDR`` is often replaced by ``RTE_BAD_IOVA`` of same value. + * ``rte_memseg.phys_addr`` is aliased with ``rte_memseg.iova_addr``. + * ``rte_mem_virt2phy()`` can often be replaced by ``rte_mem_virt2iova``. + * ``rte_malloc_virt2phy`` is aliased with ``rte_malloc_virt2iova``. + * ``rte_memzone.phys_addr`` is aliased with ``rte_memzone.iova``. + * ``rte_mempool_objhdr.physaddr`` is aliased with ``rte_mempool_objhdr.iova``. + * ``rte_mempool_memhdr.phys_addr`` is aliased with ``rte_mempool_memhdr.iova``. + * ``rte_mempool_virt2phy()`` can be replaced by ``rte_mempool_virt2iova()``. + * ``rte_mempool_populate_phys*()`` are aliased with ``rte_mempool_populate_iova*()`` + * ``rte_mbuf.buf_physaddr`` is aliased with ``rte_mbuf.buf_iova``. + * ``rte_mbuf_data_dma_addr*()`` are aliased with ``rte_mbuf_data_iova*()``. + * ``rte_pktmbuf_mtophys*`` are aliased with ``rte_pktmbuf_iova*()``. + * **PCI bus API moved outside of the EAL** The PCI bus previously implemented within the EAL has been moved.
Signature · 1 line
2.14.2
Re: [PATCH v4 15/15] doc: add IOVA aware API changes in release notes
Quoted 9 lines · Thomas Monjalon
The wording changes have been done in the API without breaking the ABI. The deprecated fields and symbols can be removed later when an another ABI change will be required.
The deprecation notice can be removed.The release notes describe the new available API with IOVA wording.
Signed-off-by Thomas Monjalon <[email protected]>---
Re: [PATCH v4 15/15] doc: add IOVA aware API changes in release notes
In reply to Thomas MonjalonQuoted 12 lines
-----Original Message-----
From: dev [mailto:[email protected]] On Behalf Of Thomas Monjalon
Sent: Monday, November 6, 2017 1:42 AM
To: Santosh Shukla <[email protected]>
Cc: [email protected]; Gonzalez Monroy, Sergio <[email protected]>; Burakov, Anatoly <[email protected]>; [email protected]
Subject: [dpdk-dev] [PATCH v4 15/15] doc: add IOVA aware API changes in release notes
Quoted 8 lines
The wording changes have been done in the API without breaking the ABI. The deprecated fields and symbols can be removed later when an another ABI change will be required.
The deprecation notice can be removed.The release notes describe the new available API with IOVA wording.
Signed-off-by Thomas Monjalon <[email protected]>
Re: [PATCH v4 00/15] make DPDK IOVA aware
In reply to Thomas Monjalon06/11/2017 02:41, Thomas Monjalon:
Quoted 7 lines
Santosh Shukla (5):
mem: rename segment address from physical to IOVA
malloc: use pointer diff macro in IOVA mapping
mbuf: rename physical address to IOVA
cryptodev: rename physical address type to IOVAdrivers/net: rename physical address type to IOVA
Quoted 11 lines
Thomas Monjalon (10):
mem: hide physical address error in VA mode
mem: introduce IOVA type
mem: rename address mapping function to IOVA
malloc: rename address mapping function to IOVA
memzone: rename address from physical to IOVA
mempool: rename addresses from physical to IOVA
mempool: rename address mapping function to IOVA
mempool: rename populate functions to IOVA
mbuf: rename data address helpers to IOVA
doc: add IOVA aware API changes in release notes
Applied with suggested fixes