net/bnxt: support timesync
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 786e41c..6f8a633 100644 (file)
@@ -145,7 +145,8 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
        ETH_RSS_NONFRAG_IPV6_TCP |      \
        ETH_RSS_NONFRAG_IPV6_UDP)
 
-static void bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
+static int bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask);
+static void bnxt_print_link_info(struct rte_eth_dev *eth_dev);
 
 /***********************/
 
@@ -370,6 +371,7 @@ static int bnxt_init_chip(struct bnxt *bp)
                        goto err_out;
                }
        }
+       bnxt_print_link_info(bp->eth_dev);
 
        return 0;
 
@@ -533,20 +535,6 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
        return 0;
 }
 
-static inline int
-rte_bnxt_atomic_write_link_status(struct rte_eth_dev *eth_dev,
-                               struct rte_eth_link *link)
-{
-       struct rte_eth_link *dst = &eth_dev->data->dev_link;
-       struct rte_eth_link *src = link;
-
-       if (rte_atomic64_cmpset((uint64_t *)dst, *(uint64_t *)dst,
-                                       *(uint64_t *)src) == 0)
-               return 1;
-
-       return 0;
-}
-
 static void bnxt_print_link_info(struct rte_eth_dev *eth_dev)
 {
        struct rte_eth_link *link = &eth_dev->data->dev_link;
@@ -585,13 +573,15 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
        if (rc)
                goto error;
 
-       bnxt_link_update_op(eth_dev, 0);
+       bnxt_link_update_op(eth_dev, 1);
 
        if (eth_dev->data->dev_conf.rxmode.hw_vlan_filter)
                vlan_mask |= ETH_VLAN_FILTER_MASK;
        if (eth_dev->data->dev_conf.rxmode.hw_vlan_strip)
                vlan_mask |= ETH_VLAN_STRIP_MASK;
-       bnxt_vlan_offload_set_op(eth_dev, vlan_mask);
+       rc = bnxt_vlan_offload_set_op(eth_dev, vlan_mask);
+       if (rc)
+               goto error;
 
        return 0;
 
@@ -605,9 +595,14 @@ error:
 static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = (struct bnxt *)eth_dev->data->dev_private;
+       int rc = 0;
 
-       eth_dev->data->dev_link.link_status = 1;
-       bnxt_set_hwrm_link_config(bp, true);
+       if (!bp->link_info.link_up)
+               rc = bnxt_set_hwrm_link_config(bp, true);
+       if (!rc)
+               eth_dev->data->dev_link.link_status = 1;
+
+       bnxt_print_link_info(eth_dev);
        return 0;
 }
 
@@ -617,6 +612,8 @@ static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
 
        eth_dev->data->dev_link.link_status = 0;
        bnxt_set_hwrm_link_config(bp, false);
+       bp->link_info.link_up = 0;
+
        return 0;
 }
 
@@ -662,13 +659,14 @@ static void bnxt_mac_addr_remove_op(struct rte_eth_dev *eth_dev,
        uint64_t pool_mask = eth_dev->data->mac_pool_sel[index];
        struct bnxt_vnic_info *vnic;
        struct bnxt_filter_info *filter, *temp_filter;
-       int i;
+       uint32_t pool = RTE_MIN(MAX_FF_POOLS, ETH_64_POOLS);
+       uint32_t i;
 
        /*
         * Loop through all VNICs from the specified filter flow pools to
         * remove the corresponding MAC addr filter
         */
-       for (i = 0; i < MAX_FF_POOLS; i++) {
+       for (i = 0; i < pool; i++) {
                if (!(pool_mask & (1ULL << i)))
                        continue;
 
@@ -757,7 +755,8 @@ out:
        /* Timed out or success */
        if (new.link_status != eth_dev->data->dev_link.link_status ||
        new.link_speed != eth_dev->data->dev_link.link_speed) {
-               rte_bnxt_atomic_write_link_status(eth_dev, &new);
+               memcpy(&eth_dev->data->dev_link, &new,
+                       sizeof(struct rte_eth_link));
                bnxt_print_link_info(eth_dev);
        }
 
@@ -870,7 +869,7 @@ static int bnxt_reta_query_op(struct rte_eth_dev *eth_dev,
                        "(%d)\n", reta_size, HW_HASH_INDEX_SIZE);
                return -EINVAL;
        }
-       /* EW - need to revisit here copying from u64 to u16 */
+       /* EW - need to revisit here copying from uint64_t to uint16_t */
        memcpy(reta_conf, vnic->rss_table, reta_size);
 
        if (rte_intr_allow_others(intr_handle)) {
@@ -1349,7 +1348,7 @@ static int bnxt_vlan_filter_set_op(struct rte_eth_dev *eth_dev,
                return bnxt_del_vlan_filter(bp, vlan_id);
 }
 
-static void
+static int
 bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 {
        struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
@@ -1381,6 +1380,8 @@ bnxt_vlan_offload_set_op(struct rte_eth_dev *dev, int mask)
 
        if (mask & ETH_VLAN_EXTEND_MASK)
                RTE_LOG(ERR, PMD, "Extend VLAN Not supported\n");
+
+       return 0;
 }
 
 static void
@@ -1727,10 +1728,12 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,
                RTE_LOG(ERR, PMD, "unsupported ether_type(0x%04x) in"
                        " ethertype filter.", efilter->ether_type);
                *ret = -EINVAL;
+               goto exit;
        }
        if (efilter->queue >= bp->rx_nr_rings) {
                RTE_LOG(ERR, PMD, "Invalid queue %d\n", efilter->queue);
                *ret = -EINVAL;
+               goto exit;
        }
 
        vnic0 = STAILQ_FIRST(&bp->ff_pool[0]);
@@ -1738,6 +1741,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,
        if (vnic == NULL) {
                RTE_LOG(ERR, PMD, "Invalid queue %d\n", efilter->queue);
                *ret = -EINVAL;
+               goto exit;
        }
 
        if (efilter->flags & RTE_ETHTYPE_FLAGS_DROP) {
@@ -1766,6 +1770,7 @@ bnxt_match_and_validate_ether_filter(struct bnxt *bp,
        if (match)
                *ret = -EEXIST;
 
+exit:
        return mfilter;
 }
 
@@ -1947,25 +1952,29 @@ parse_ntuple_filter(struct bnxt *bp,
 }
 
 static struct bnxt_filter_info*
-bnxt_match_ntuple_filter(struct bnxt_vnic_info *vnic,
+bnxt_match_ntuple_filter(struct bnxt *bp,
                         struct bnxt_filter_info *bfilter)
 {
        struct bnxt_filter_info *mfilter = NULL;
+       int i;
 
-       STAILQ_FOREACH(mfilter, &vnic->filter, next) {
-               if (bfilter->src_ipaddr[0] == mfilter->src_ipaddr[0] &&
-                   bfilter->src_ipaddr_mask[0] ==
-                   mfilter->src_ipaddr_mask[0] &&
-                   bfilter->src_port == mfilter->src_port &&
-                   bfilter->src_port_mask == mfilter->src_port_mask &&
-                   bfilter->dst_ipaddr[0] == mfilter->dst_ipaddr[0] &&
-                   bfilter->dst_ipaddr_mask[0] ==
-                   mfilter->dst_ipaddr_mask[0] &&
-                   bfilter->dst_port == mfilter->dst_port &&
-                   bfilter->dst_port_mask == mfilter->dst_port_mask &&
-                   bfilter->flags == mfilter->flags &&
-                   bfilter->enables == mfilter->enables)
-                       return mfilter;
+       for (i = bp->nr_vnics - 1; i >= 0; i--) {
+               struct bnxt_vnic_info *vnic = &bp->vnic_info[i];
+               STAILQ_FOREACH(mfilter, &vnic->filter, next) {
+                       if (bfilter->src_ipaddr[0] == mfilter->src_ipaddr[0] &&
+                           bfilter->src_ipaddr_mask[0] ==
+                           mfilter->src_ipaddr_mask[0] &&
+                           bfilter->src_port == mfilter->src_port &&
+                           bfilter->src_port_mask == mfilter->src_port_mask &&
+                           bfilter->dst_ipaddr[0] == mfilter->dst_ipaddr[0] &&
+                           bfilter->dst_ipaddr_mask[0] ==
+                           mfilter->dst_ipaddr_mask[0] &&
+                           bfilter->dst_port == mfilter->dst_port &&
+                           bfilter->dst_port_mask == mfilter->dst_port_mask &&
+                           bfilter->flags == mfilter->flags &&
+                           bfilter->enables == mfilter->enables)
+                               return mfilter;
+               }
        }
        return NULL;
 }
@@ -2014,7 +2023,7 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
        bfilter->ethertype = 0x800;
        bfilter->enables |= NTUPLE_FLTR_ALLOC_INPUT_EN_ETHERTYPE;
 
-       mfilter = bnxt_match_ntuple_filter(vnic, bfilter);
+       mfilter = bnxt_match_ntuple_filter(bp, bfilter);
 
        if (mfilter != NULL && filter_op == RTE_ETH_FILTER_ADD) {
                RTE_LOG(ERR, PMD, "filter exists.");
@@ -2034,6 +2043,11 @@ bnxt_cfg_ntuple_filter(struct bnxt *bp,
                        goto free_filter;
                STAILQ_INSERT_TAIL(&vnic->filter, bfilter, next);
        } else {
+               if (mfilter == NULL) {
+                       /* This should not happen. But for Coverity! */
+                       ret = -ENOENT;
+                       goto free_filter;
+               }
                ret = bnxt_hwrm_clear_ntuple_filter(bp, mfilter);
 
                STAILQ_REMOVE(&vnic->filter, mfilter, bnxt_filter_info,
@@ -2393,6 +2407,7 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
                ret = bnxt_parse_fdir_filter(bp, fdir, filter);
                if (ret != 0)
                        goto free_filter;
+               filter->filter_type = HWRM_CFA_NTUPLE_FILTER;
 
                match = bnxt_match_fdir(bp, filter);
                if (match != NULL && filter_op == RTE_ETH_FILTER_ADD) {
@@ -2413,7 +2428,6 @@ bnxt_fdir_filter(struct rte_eth_dev *dev,
                        STAILQ_FIRST(&bp->ff_pool[fdir->action.rx_queue]);
 
                if (filter_op == RTE_ETH_FILTER_ADD) {
-                       filter->filter_type = HWRM_CFA_NTUPLE_FILTER;
                        ret = bnxt_hwrm_set_ntuple_filter(bp,
                                                          filter->dst_id,
                                                          filter);
@@ -2522,7 +2536,260 @@ bnxt_dev_supported_ptypes_get_op(struct rte_eth_dev *dev)
        return NULL;
 }
 
+static int bnxt_map_regs(struct bnxt *bp, uint32_t *reg_arr, int count,
+                        int reg_win)
+{
+       uint32_t reg_base = *reg_arr & 0xfffff000;
+       uint32_t win_off;
+       int i;
+
+       for (i = 0; i < count; i++) {
+               if ((reg_arr[i] & 0xfffff000) != reg_base)
+                       return -ERANGE;
+       }
+       win_off = BNXT_GRCPF_REG_WINDOW_BASE_OUT + (reg_win - 1) * 4;
+       rte_cpu_to_le_32(rte_write32(reg_base, (uint8_t *)bp->bar0 + win_off));
+       return 0;
+}
+
+static int bnxt_map_ptp_regs(struct bnxt *bp)
+{
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+       uint32_t *reg_arr;
+       int rc, i;
+
+       reg_arr = ptp->rx_regs;
+       rc = bnxt_map_regs(bp, reg_arr, BNXT_PTP_RX_REGS, 5);
+       if (rc)
+               return rc;
+
+       reg_arr = ptp->tx_regs;
+       rc = bnxt_map_regs(bp, reg_arr, BNXT_PTP_TX_REGS, 6);
+       if (rc)
+               return rc;
+
+       for (i = 0; i < BNXT_PTP_RX_REGS; i++)
+               ptp->rx_mapped_regs[i] = 0x5000 + (ptp->rx_regs[i] & 0xfff);
+
+       for (i = 0; i < BNXT_PTP_TX_REGS; i++)
+               ptp->tx_mapped_regs[i] = 0x6000 + (ptp->tx_regs[i] & 0xfff);
+
+       return 0;
+}
+
+static void bnxt_unmap_ptp_regs(struct bnxt *bp)
+{
+       rte_cpu_to_le_32(rte_write32(0, (uint8_t *)bp->bar0 +
+                        BNXT_GRCPF_REG_WINDOW_BASE_OUT + 16));
+       rte_cpu_to_le_32(rte_write32(0, (uint8_t *)bp->bar0 +
+                        BNXT_GRCPF_REG_WINDOW_BASE_OUT + 20));
+}
+
+static uint64_t bnxt_cc_read(struct bnxt *bp)
+{
+       uint64_t ns;
+
+       ns = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                             BNXT_GRCPF_REG_SYNC_TIME));
+       ns |= (uint64_t)(rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                                         BNXT_GRCPF_REG_SYNC_TIME + 4))) << 32;
+       return ns;
+}
+
+static int bnxt_get_tx_ts(struct bnxt *bp, uint64_t *ts)
+{
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+       uint32_t fifo;
+
+       fifo = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->tx_mapped_regs[BNXT_PTP_TX_FIFO]));
+       if (fifo & BNXT_PTP_TX_FIFO_EMPTY)
+               return -EAGAIN;
+
+       fifo = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->tx_mapped_regs[BNXT_PTP_TX_FIFO]));
+       *ts = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->tx_mapped_regs[BNXT_PTP_TX_TS_L]));
+       *ts |= (uint64_t)rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->tx_mapped_regs[BNXT_PTP_TX_TS_H])) << 32;
+
+       return 0;
+}
+
+static int bnxt_get_rx_ts(struct bnxt *bp, uint64_t *ts)
+{
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+       struct bnxt_pf_info *pf = &bp->pf;
+       uint16_t port_id;
+       uint32_t fifo;
+
+       if (!ptp)
+               return -ENODEV;
+
+       fifo = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->rx_mapped_regs[BNXT_PTP_RX_FIFO]));
+       if (!(fifo & BNXT_PTP_RX_FIFO_PENDING))
+               return -EAGAIN;
+
+       port_id = pf->port_id;
+       rte_cpu_to_le_32(rte_write32(1 << port_id, (uint8_t *)bp->bar0 +
+              ptp->rx_mapped_regs[BNXT_PTP_RX_FIFO_ADV]));
+
+       fifo = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                                  ptp->rx_mapped_regs[BNXT_PTP_RX_FIFO]));
+       if (fifo & BNXT_PTP_RX_FIFO_PENDING) {
+/*             bnxt_clr_rx_ts(bp);       TBD  */
+               return -EBUSY;
+       }
+
+       *ts = rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->rx_mapped_regs[BNXT_PTP_RX_TS_L]));
+       *ts |= (uint64_t)rte_le_to_cpu_32(rte_read32((uint8_t *)bp->bar0 +
+                               ptp->rx_mapped_regs[BNXT_PTP_RX_TS_H])) << 32;
+
+       return 0;
+}
 
+static int
+bnxt_timesync_write_time(struct rte_eth_dev *dev, const struct timespec *ts)
+{
+       uint64_t ns;
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+
+       if (!ptp)
+               return 0;
+
+       ns = rte_timespec_to_ns(ts);
+       /* Set the timecounters to a new value. */
+       ptp->tc.nsec = ns;
+
+       return 0;
+}
+
+static int
+bnxt_timesync_read_time(struct rte_eth_dev *dev, struct timespec *ts)
+{
+       uint64_t ns, systime_cycles;
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+
+       if (!ptp)
+               return 0;
+
+       systime_cycles = bnxt_cc_read(bp);
+       ns = rte_timecounter_update(&ptp->tc, systime_cycles);
+       *ts = rte_ns_to_timespec(ns);
+
+       return 0;
+}
+static int
+bnxt_timesync_enable(struct rte_eth_dev *dev)
+{
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+       uint32_t shift = 0;
+
+       if (!ptp)
+               return 0;
+
+       ptp->rx_filter = 1;
+       ptp->tx_tstamp_en = 1;
+       ptp->rxctl = BNXT_PTP_MSG_EVENTS;
+
+       if (!bnxt_hwrm_ptp_cfg(bp))
+               bnxt_map_ptp_regs(bp);
+
+       memset(&ptp->tc, 0, sizeof(struct rte_timecounter));
+       memset(&ptp->rx_tstamp_tc, 0, sizeof(struct rte_timecounter));
+       memset(&ptp->tx_tstamp_tc, 0, sizeof(struct rte_timecounter));
+
+       ptp->tc.cc_mask = BNXT_CYCLECOUNTER_MASK;
+       ptp->tc.cc_shift = shift;
+       ptp->tc.nsec_mask = (1ULL << shift) - 1;
+
+       ptp->rx_tstamp_tc.cc_mask = BNXT_CYCLECOUNTER_MASK;
+       ptp->rx_tstamp_tc.cc_shift = shift;
+       ptp->rx_tstamp_tc.nsec_mask = (1ULL << shift) - 1;
+
+       ptp->tx_tstamp_tc.cc_mask = BNXT_CYCLECOUNTER_MASK;
+       ptp->tx_tstamp_tc.cc_shift = shift;
+       ptp->tx_tstamp_tc.nsec_mask = (1ULL << shift) - 1;
+
+       return 0;
+}
+
+static int
+bnxt_timesync_disable(struct rte_eth_dev *dev)
+{
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+
+       if (!ptp)
+               return 0;
+
+       ptp->rx_filter = 0;
+       ptp->tx_tstamp_en = 0;
+       ptp->rxctl = 0;
+
+       bnxt_hwrm_ptp_cfg(bp);
+
+       bnxt_unmap_ptp_regs(bp);
+
+       return 0;
+}
+
+static int
+bnxt_timesync_read_rx_timestamp(struct rte_eth_dev *dev,
+                                struct timespec *timestamp,
+                                uint32_t flags __rte_unused)
+{
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+       uint64_t rx_tstamp_cycles = 0;
+       uint64_t ns;
+
+       if (!ptp)
+               return 0;
+
+       bnxt_get_rx_ts(bp, &rx_tstamp_cycles);
+       ns = rte_timecounter_update(&ptp->rx_tstamp_tc, rx_tstamp_cycles);
+       *timestamp = rte_ns_to_timespec(ns);
+       return  0;
+}
+
+static int
+bnxt_timesync_read_tx_timestamp(struct rte_eth_dev *dev,
+                                struct timespec *timestamp)
+{
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+       uint64_t tx_tstamp_cycles = 0;
+       uint64_t ns;
+
+       if (!ptp)
+               return 0;
+
+       bnxt_get_tx_ts(bp, &tx_tstamp_cycles);
+       ns = rte_timecounter_update(&ptp->tx_tstamp_tc, tx_tstamp_cycles);
+       *timestamp = rte_ns_to_timespec(ns);
+
+       return 0;
+}
+
+static int
+bnxt_timesync_adjust_time(struct rte_eth_dev *dev, int64_t delta)
+{
+       struct bnxt *bp = (struct bnxt *)dev->data->dev_private;
+       struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
+
+       if (!ptp)
+               return 0;
+
+       ptp->tc.nsec += delta;
+
+       return 0;
+}
 
 static int
 bnxt_get_eeprom_length_op(struct rte_eth_dev *dev)
@@ -2718,6 +2985,13 @@ static const struct eth_dev_ops bnxt_dev_ops = {
        .get_eeprom_length    = bnxt_get_eeprom_length_op,
        .get_eeprom           = bnxt_get_eeprom_op,
        .set_eeprom           = bnxt_set_eeprom_op,
+       .timesync_enable      = bnxt_timesync_enable,
+       .timesync_disable     = bnxt_timesync_disable,
+       .timesync_read_time   = bnxt_timesync_read_time,
+       .timesync_write_time   = bnxt_timesync_write_time,
+       .timesync_adjust_time = bnxt_timesync_adjust_time,
+       .timesync_read_rx_timestamp = bnxt_timesync_read_rx_timestamp,
+       .timesync_read_tx_timestamp = bnxt_timesync_read_tx_timestamp,
 };
 
 static bool bnxt_vf_pciid(uint16_t id)
@@ -2782,7 +3056,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;
 
@@ -2790,7 +3064,6 @@ bnxt_dev_init(struct rte_eth_dev *eth_dev)
                RTE_LOG(INFO, PMD, "%s\n", bnxt_version);
 
        rte_eth_copy_pci_info(eth_dev, pci_dev);
-       eth_dev->data->dev_flags |= RTE_ETH_DEV_DETACHABLE;
 
        bp = eth_dev->data->dev_private;
 
@@ -2834,13 +3107,13 @@ 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");
                        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");
@@ -2869,13 +3142,13 @@ 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");
                        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");
@@ -2958,6 +3231,8 @@ skip_init:
        ALLOW_FUNC(HWRM_VNIC_RSS_COS_LB_CTX_FREE);
        ALLOW_FUNC(HWRM_CFA_L2_FILTER_FREE);
        ALLOW_FUNC(HWRM_STAT_CTX_FREE);
+       ALLOW_FUNC(HWRM_PORT_PHY_QCFG);
+       ALLOW_FUNC(HWRM_VNIC_TPA_CFG);
        rc = bnxt_hwrm_func_driver_register(bp);
        if (rc) {
                RTE_LOG(ERR, PMD,