memzone: rename address from physical to IOVA
authorThomas Monjalon <thomas@monjalon.net>
Sat, 4 Nov 2017 01:22:28 +0000 (02:22 +0100)
committerThomas Monjalon <thomas@monjalon.net>
Mon, 6 Nov 2017 21:25:44 +0000 (22:25 +0100)
The struct rte_memzone field .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 <thomas@monjalon.net>
Acked-by: Santosh Shukla <santosh.shukla@caviumnetworks.com>
29 files changed:
drivers/crypto/qat/qat_qp.c
drivers/net/bnx2x/bnx2x.c
drivers/net/bnx2x/bnx2x_rxtx.c
drivers/net/bnxt/bnxt_ethdev.c
drivers/net/bnxt/bnxt_ring.c
drivers/net/bnxt/bnxt_vnic.c
drivers/net/cxgbe/sge.c
drivers/net/e1000/em_rxtx.c
drivers/net/e1000/igb_rxtx.c
drivers/net/ena/base/ena_plat_dpdk.h
drivers/net/enic/enic_main.c
drivers/net/fm10k/fm10k_ethdev.c
drivers/net/i40e/i40e_ethdev.c
drivers/net/i40e/i40e_fdir.c
drivers/net/i40e/i40e_rxtx.c
drivers/net/ixgbe/ixgbe_rxtx.c
drivers/net/liquidio/lio_rxtx.c
drivers/net/nfp/nfp_net.c
drivers/net/qede/base/bcm_osal.c
drivers/net/qede/qede_fdir.c
drivers/net/sfc/sfc.c
drivers/net/thunderx/nicvf_ethdev.c
drivers/net/virtio/virtio_ethdev.c
drivers/net/vmxnet3/vmxnet3_ethdev.c
drivers/net/vmxnet3/vmxnet3_rxtx.c
lib/librte_eal/common/eal_common_memzone.c
lib/librte_eal/common/include/rte_memzone.h
lib/librte_mempool/rte_mempool.c
test/test/test_memzone.c

index 814ba17..94aeb9f 100644 (file)
@@ -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 "
index 44222af..6b4526b 100644 (file)
@@ -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);
index c72067f..99d7d28 100644 (file)
@@ -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);
 
index 9dc3901..ccd50a7 100644 (file)
@@ -2847,7 +2847,7 @@ skip_init:
                                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 @@ skip_init:
                                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");
index efec204..b196dd1 100644 (file)
@@ -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;
 
index cbcf992..937ad65 100644 (file)
@@ -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");
index 33f7f0b..9f91515 100644 (file)
@@ -1318,7 +1318,7 @@ alloc_sw_ring:
        if (metadata)
                *(void **)metadata = s;
 
-       *phys = (uint64_t)tz->phys_addr;
+       *phys = (uint64_t)tz->iova;
        return tz->addr;
 }
 
index d4d5fe6..32ca920 100644 (file)
@@ -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,
index 8eee44e..4590179 100644 (file)
@@ -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. */
index 71a8c1e..accecf5 100644 (file)
@@ -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) \
index f2e06e8..3a2a8d1 100644 (file)
@@ -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) {
index 7e52a2c..2d05a46 100644 (file)
@@ -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
index bcd9ef1..c2c477e 100644 (file)
@@ -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,
index a95a2c9..3d7170d 100644 (file)
@@ -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.",
index 904d37f..943e1c1 100644 (file)
@@ -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;
 
        /*
index 37bb57b..daaf02d 100644 (file)
@@ -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;
 
        /*
index 773dfd3..71099e1 100644 (file)
@@ -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;
index 8c1c1f0..7f1a026 100644 (file)
@@ -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 */
index e3a2cb4..fe42f32 100644 (file)
@@ -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]);
index f8d60f5..da6364e 100644 (file)
@@ -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);
index 390823a..1c12740 100644 (file)
@@ -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;
index 24ac3f9..ea56139 100644 (file)
@@ -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;
index a8ae788..c6756ed 100644 (file)
@@ -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;
index 9037d80..0fce5d9 100644 (file)
@@ -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;
index 01c85f1..aac23d8 100644 (file)
@@ -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;
index ab68110..ea072a2 100644 (file)
@@ -251,7 +251,7 @@ memzone_reserve_aligned_thread_unsafe(const char *name, size_t len,
 
        mcfg->memzone_cnt++;
        snprintf(mz->name, sizeof(mz->name), "%s", name);
-       mz->phys_addr = rte_malloc_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,
index 1d0827f..6f0ba18 100644 (file)
@@ -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. */
index f62054e..aad3294 100644 (file)
@@ -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);
index 7ae31cf..c9394c4 100644 (file)
@@ -78,7 +78,7 @@
 
 /* Test if memory overlaps: return 1 if true, or 0 if false. */
 static int
-is_memory_overlap(phys_addr_t ptr1, size_t len1, phys_addr_t ptr2, size_t len2)
+is_memory_overlap(rte_iova_t ptr1, size_t len1, rte_iova_t ptr2, size_t len2)
 {
        if (ptr2 >= ptr1 && (ptr2 - ptr1) < len1)
                return 1;
@@ -510,7 +510,7 @@ test_memzone_aligned(void)
                printf("Unable to reserve 64-byte aligned memzone!\n");
                return -1;
        }
-       if ((memzone_aligned_32->phys_addr & RTE_CACHE_LINE_MASK) != 0)
+       if ((memzone_aligned_32->iova & RTE_CACHE_LINE_MASK) != 0)
                return -1;
        if (((uintptr_t) memzone_aligned_32->addr & RTE_CACHE_LINE_MASK) != 0)
                return -1;
@@ -521,7 +521,7 @@ test_memzone_aligned(void)
                printf("Unable to reserve 128-byte aligned memzone!\n");
                return -1;
        }
-       if ((memzone_aligned_128->phys_addr & 127) != 0)
+       if ((memzone_aligned_128->iova & 127) != 0)
                return -1;
        if (((uintptr_t) memzone_aligned_128->addr & 127) != 0)
                return -1;
@@ -532,7 +532,7 @@ test_memzone_aligned(void)
                printf("Unable to reserve 256-byte aligned memzone!\n");
                return -1;
        }
-       if ((memzone_aligned_256->phys_addr & 255) != 0)
+       if ((memzone_aligned_256->iova & 255) != 0)
                return -1;
        if (((uintptr_t) memzone_aligned_256->addr & 255) != 0)
                return -1;
@@ -543,7 +543,7 @@ test_memzone_aligned(void)
                printf("Unable to reserve 512-byte aligned memzone!\n");
                return -1;
        }
-       if ((memzone_aligned_512->phys_addr & 511) != 0)
+       if ((memzone_aligned_512->iova & 511) != 0)
                return -1;
        if (((uintptr_t) memzone_aligned_512->addr & 511) != 0)
                return -1;
@@ -554,7 +554,7 @@ test_memzone_aligned(void)
                printf("Unable to reserve 1024-byte aligned memzone!\n");
                return -1;
        }
-       if ((memzone_aligned_1024->phys_addr & 1023) != 0)
+       if ((memzone_aligned_1024->iova & 1023) != 0)
                return -1;
        if (((uintptr_t) memzone_aligned_1024->addr & 1023) != 0)
                return -1;
@@ -563,35 +563,35 @@ test_memzone_aligned(void)
 
        /* check that zones don't overlap */
        printf("check overlapping\n");
-       if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
-                                       memzone_aligned_128->phys_addr, memzone_aligned_128->len))
+       if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len,
+                                       memzone_aligned_128->iova, memzone_aligned_128->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
-                                       memzone_aligned_256->phys_addr, memzone_aligned_256->len))
+       if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len,
+                                       memzone_aligned_256->iova, memzone_aligned_256->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
-                                       memzone_aligned_512->phys_addr, memzone_aligned_512->len))
+       if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len,
+                                       memzone_aligned_512->iova, memzone_aligned_512->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_32->phys_addr, memzone_aligned_32->len,
-                                       memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
+       if (is_memory_overlap(memzone_aligned_32->iova, memzone_aligned_32->len,
+                                       memzone_aligned_1024->iova, memzone_aligned_1024->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len,
-                                       memzone_aligned_256->phys_addr, memzone_aligned_256->len))
+       if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len,
+                                       memzone_aligned_256->iova, memzone_aligned_256->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len,
-                                       memzone_aligned_512->phys_addr, memzone_aligned_512->len))
+       if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len,
+                                       memzone_aligned_512->iova, memzone_aligned_512->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_128->phys_addr, memzone_aligned_128->len,
-                                       memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
+       if (is_memory_overlap(memzone_aligned_128->iova, memzone_aligned_128->len,
+                                       memzone_aligned_1024->iova, memzone_aligned_1024->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len,
-                                       memzone_aligned_512->phys_addr, memzone_aligned_512->len))
+       if (is_memory_overlap(memzone_aligned_256->iova, memzone_aligned_256->len,
+                                       memzone_aligned_512->iova, memzone_aligned_512->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_256->phys_addr, memzone_aligned_256->len,
-                                       memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
+       if (is_memory_overlap(memzone_aligned_256->iova, memzone_aligned_256->len,
+                                       memzone_aligned_1024->iova, memzone_aligned_1024->len))
                return -1;
-       if (is_memory_overlap(memzone_aligned_512->phys_addr, memzone_aligned_512->len,
-                                       memzone_aligned_1024->phys_addr, memzone_aligned_1024->len))
+       if (is_memory_overlap(memzone_aligned_512->iova, memzone_aligned_512->len,
+                                       memzone_aligned_1024->iova, memzone_aligned_1024->len))
                return -1;
        return 0;
 }
@@ -601,9 +601,9 @@ check_memzone_bounded(const char *name, uint32_t len,  uint32_t align,
        uint32_t bound)
 {
        const struct rte_memzone *mz;
-       phys_addr_t bmask;
+       rte_iova_t bmask;
 
-       bmask = ~((phys_addr_t)bound - 1);
+       bmask = ~((rte_iova_t)bound - 1);
 
        if ((mz = rte_memzone_reserve_bounded(name, len, SOCKET_ID_ANY, 0,
                        align, bound)) == NULL) {
@@ -612,7 +612,7 @@ check_memzone_bounded(const char *name, uint32_t len,  uint32_t align,
                return -1;
        }
 
-       if ((mz->phys_addr & ((phys_addr_t)align - 1)) != 0) {
+       if ((mz->iova & ((rte_iova_t)align - 1)) != 0) {
                printf("%s(%s): invalid phys addr alignment\n",
                        __func__, mz->name);
                return -1;
@@ -631,8 +631,8 @@ check_memzone_bounded(const char *name, uint32_t len,  uint32_t align,
                return -1;
        }
 
-       if ((mz->phys_addr & bmask) !=
-                       ((mz->phys_addr + mz->len - 1) & bmask)) {
+       if ((mz->iova & bmask) !=
+                       ((mz->iova + mz->len - 1) & bmask)) {
                printf("%s(%s): invalid memzone boundary %u crossed\n",
                        __func__, mz->name, bound);
                return -1;
@@ -787,11 +787,11 @@ test_memzone(void)
        /* check cache-line alignments */
        printf("check alignments and lengths\n");
 
-       if ((memzone1->phys_addr & RTE_CACHE_LINE_MASK) != 0)
+       if ((memzone1->iova & RTE_CACHE_LINE_MASK) != 0)
                return -1;
-       if ((memzone2->phys_addr & RTE_CACHE_LINE_MASK) != 0)
+       if ((memzone2->iova & RTE_CACHE_LINE_MASK) != 0)
                return -1;
-       if (memzone3 != NULL && (memzone3->phys_addr & RTE_CACHE_LINE_MASK) != 0)
+       if (memzone3 != NULL && (memzone3->iova & RTE_CACHE_LINE_MASK) != 0)
                return -1;
        if ((memzone1->len & RTE_CACHE_LINE_MASK) != 0 || memzone1->len == 0)
                return -1;
@@ -806,16 +806,16 @@ test_memzone(void)
        /* check that zones don't overlap */
        printf("check overlapping\n");
 
-       if (is_memory_overlap(memzone1->phys_addr, memzone1->len,
-                       memzone2->phys_addr, memzone2->len))
+       if (is_memory_overlap(memzone1->iova, memzone1->len,
+                       memzone2->iova, memzone2->len))
                return -1;
        if (memzone3 != NULL &&
-                       is_memory_overlap(memzone1->phys_addr, memzone1->len,
-                                       memzone3->phys_addr, memzone3->len))
+                       is_memory_overlap(memzone1->iova, memzone1->len,
+                                       memzone3->iova, memzone3->len))
                return -1;
        if (memzone3 != NULL &&
-                       is_memory_overlap(memzone2->phys_addr, memzone2->len,
-                                       memzone3->phys_addr, memzone3->len))
+                       is_memory_overlap(memzone2->iova, memzone2->len,
+                                       memzone3->iova, memzone3->len))
                return -1;
 
        printf("check socket ID\n");