net/octeontx2: support CN98xx
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 4d64a98..e8b4c05 100644 (file)
@@ -221,8 +221,6 @@ static void bnxt_free_cos_queues(struct bnxt *bp)
 
 static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
 {
-       bnxt_free_flow_stats_info(bp);
-
        bnxt_free_filter_mem(bp);
        bnxt_free_vnic_attributes(bp);
        bnxt_free_vnic_mem(bp);
@@ -778,7 +776,7 @@ static int bnxt_shutdown_nic(struct bnxt *bp)
  * Device configuration and status function
  */
 
-static uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
+uint32_t bnxt_get_speed_capabilities(struct bnxt *bp)
 {
        uint32_t link_speed = bp->link_info->support_speeds;
        uint32_t speed_capa = 0;
@@ -1095,7 +1093,7 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
                DEV_RX_OFFLOAD_OUTER_IPV4_CKSUM |
                DEV_RX_OFFLOAD_RSS_HASH |
                DEV_RX_OFFLOAD_VLAN_FILTER)) &&
-           !bp->truflow) {
+           !BNXT_TRUFLOW_EN(bp)) {
                PMD_DRV_LOG(INFO, "Using vector mode receive for port %d\n",
                            eth_dev->data->port_id);
                bp->flags |= BNXT_FLAG_RX_VECTOR_PKT_MODE;
@@ -1221,7 +1219,7 @@ static int bnxt_dev_start_op(struct rte_eth_dev *eth_dev)
        bnxt_schedule_fw_health_check(bp);
        pthread_mutex_unlock(&bp->def_cp_lock);
 
-       if (bp->truflow)
+       if (BNXT_TRUFLOW_EN(bp))
                bnxt_ulp_init(bp);
 
        return 0;
@@ -1267,7 +1265,7 @@ static void bnxt_dev_stop_op(struct rte_eth_dev *eth_dev)
        struct rte_pci_device *pci_dev = RTE_ETH_DEV_TO_PCI(eth_dev);
        struct rte_intr_handle *intr_handle = &pci_dev->intr_handle;
 
-       if (bp->truflow)
+       if (BNXT_TRUFLOW_EN(bp))
                bnxt_ulp_deinit(bp);
 
        eth_dev->data->dev_started = 0;
@@ -3647,7 +3645,7 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
        case RTE_ETH_FILTER_GENERIC:
                if (filter_op != RTE_ETH_FILTER_GET)
                        return -EINVAL;
-               if (bp->truflow)
+               if (BNXT_TRUFLOW_EN(bp))
                        *(const void **)arg = &bnxt_ulp_rte_flow_ops;
                else
                        *(const void **)arg = &bnxt_flow_ops;
@@ -4980,7 +4978,7 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
                return -ENOMEM;
        }
 
-       if (bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN)) {
+       if (!BNXT_HAS_DFLT_MAC_SET(bp)) {
                if (BNXT_PF(bp))
                        return -EINVAL;
 
@@ -4993,14 +4991,11 @@ static int bnxt_setup_mac_addr(struct rte_eth_dev *eth_dev)
                            bp->mac_addr[3], bp->mac_addr[4], bp->mac_addr[5]);
 
                rc = bnxt_hwrm_set_mac(bp);
-               if (!rc)
-                       memcpy(&bp->eth_dev->data->mac_addrs[0], bp->mac_addr,
-                              RTE_ETHER_ADDR_LEN);
-               return rc;
+               if (rc)
+                       return rc;
        }
 
        /* Copy the permanent MAC from the FUNC_QCAPS response */
-       memcpy(bp->mac_addr, bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN);
        memcpy(&eth_dev->data->mac_addrs[0], bp->mac_addr, RTE_ETHER_ADDR_LEN);
 
        return rc;
@@ -5011,7 +5006,7 @@ static int bnxt_restore_dflt_mac(struct bnxt *bp)
        int rc = 0;
 
        /* MAC is already configured in FW */
-       if (!bnxt_check_zero_bytes(bp->dflt_mac_addr, RTE_ETHER_ADDR_LEN))
+       if (BNXT_HAS_DFLT_MAC_SET(bp))
                return 0;
 
        /* Restore the old MAC configured */
@@ -5353,8 +5348,8 @@ bnxt_parse_devarg_truflow(__rte_unused const char *key,
                return -EINVAL;
        }
 
-       bp->truflow = truflow;
-       if (bp->truflow)
+       bp->flags |= BNXT_FLAG_TRUFLOW_EN;
+       if (BNXT_TRUFLOW_EN(bp))
                PMD_DRV_LOG(INFO, "Host-based truflow feature enabled.\n");
 
        return 0;
@@ -5616,6 +5611,7 @@ bnxt_uninit_resources(struct bnxt *bp, bool reconfig_dev)
        bnxt_uninit_ctx_mem(bp);
 
        bnxt_uninit_locks(bp);
+       bnxt_free_flow_stats_info(bp);
        rte_free(bp->ptp_cfg);
        bp->ptp_cfg = NULL;
        return rc;