net/bnxt: fix NAT template
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 1dc85e6..0829493 100644 (file)
@@ -194,6 +194,9 @@ static void bnxt_free_link_info(struct bnxt *bp)
 
 static void bnxt_free_leds_info(struct bnxt *bp)
 {
+       if (BNXT_VF(bp))
+               return;
+
        rte_free(bp->leds);
        bp->leds = NULL;
 }
@@ -263,6 +266,9 @@ static int bnxt_alloc_link_info(struct bnxt *bp)
 
 static int bnxt_alloc_leds_info(struct bnxt *bp)
 {
+       if (BNXT_VF(bp))
+               return 0;
+
        bp->leds = rte_zmalloc("bnxt_leds",
                               BNXT_MAX_LED * sizeof(struct bnxt_led_info),
                               0);
@@ -1076,7 +1082,7 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 {
        struct bnxt *bp = eth_dev->data->dev_private;
 
-#ifdef RTE_ARCH_X86
+#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 #ifndef RTE_LIBRTE_IEEE1588
        /*
         * Vector mode receive can be enabled only if scatter rx is not
@@ -1116,7 +1122,7 @@ bnxt_receive_function(struct rte_eth_dev *eth_dev)
 static eth_tx_burst_t
 bnxt_transmit_function(__rte_unused struct rte_eth_dev *eth_dev)
 {
-#ifdef RTE_ARCH_X86
+#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
 #ifndef RTE_LIBRTE_IEEE1588
        struct bnxt *bp = eth_dev->data->dev_private;
 
@@ -1398,8 +1404,7 @@ static void bnxt_dev_close_op(struct rte_eth_dev *eth_dev)
        bnxt_cancel_fc_thread(bp);
 
        if (BNXT_TRUFLOW_EN(bp)) {
-               if (bp->rep_info != NULL)
-                       bnxt_destroy_df_rules(bp);
+               bnxt_destroy_df_rules(bp);
                bnxt_ulp_deinit(bp);
        }
 
@@ -1651,7 +1656,7 @@ static int bnxt_promiscuous_disable_op(struct rte_eth_dev *eth_dev)
        if (rc != 0)
                vnic->flags = old_flags;
 
-       if (BNXT_TRUFLOW_EN(bp) && bp->rep_info != NULL)
+       if (BNXT_TRUFLOW_EN(bp))
                bnxt_create_df_rules(bp);
 
        return rc;
@@ -2495,15 +2500,15 @@ bnxt_vlan_tpid_set_op(struct rte_eth_dev *dev, enum rte_vlan_type vlan_type,
                        bp->outer_tpid_bd =
                                TX_BD_LONG_CFA_META_VLAN_TPID_TPID8100;
                                break;
-               case 0x9100:
+               case RTE_ETHER_TYPE_QINQ1:
                        bp->outer_tpid_bd =
                                TX_BD_LONG_CFA_META_VLAN_TPID_TPID9100;
                                break;
-               case 0x9200:
+               case RTE_ETHER_TYPE_QINQ2:
                        bp->outer_tpid_bd =
                                TX_BD_LONG_CFA_META_VLAN_TPID_TPID9200;
                                break;
-               case 0x9300:
+               case RTE_ETHER_TYPE_QINQ3:
                        bp->outer_tpid_bd =
                                 TX_BD_LONG_CFA_META_VLAN_TPID_TPID9300;
                                break;
@@ -2679,7 +2684,7 @@ bnxt_rx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
                         "Scalar");
                return 0;
        }
-#ifdef RTE_ARCH_X86
+#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
        if (pkt_burst == bnxt_recv_pkts_vec) {
                snprintf(mode->info, sizeof(mode->info), "%s",
                         "Vector SSE");
@@ -2701,7 +2706,7 @@ bnxt_tx_burst_mode_get(struct rte_eth_dev *dev, __rte_unused uint16_t queue_id,
                         "Scalar");
                return 0;
        }
-#ifdef RTE_ARCH_X86
+#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
        if (pkt_burst == bnxt_xmit_pkts_vec) {
                snprintf(mode->info, sizeof(mode->info), "%s",
                         "Vector SSE");
@@ -2730,7 +2735,7 @@ int bnxt_mtu_set_op(struct rte_eth_dev *eth_dev, uint16_t new_mtu)
        new_pkt_size = new_mtu + RTE_ETHER_HDR_LEN + RTE_ETHER_CRC_LEN +
                       VLAN_TAG_SIZE * BNXT_NUM_VLANS;
 
-#ifdef RTE_ARCH_X86
+#if defined(RTE_ARCH_X86) || defined(RTE_ARCH_ARM64)
        /*
         * If vector-mode tx/rx is active, disallow any MTU change that would
         * require scattered receive support.
@@ -3746,7 +3751,7 @@ free_filter:
        return ret;
 }
 
-static int
+int
 bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
                    enum rte_filter_type filter_type,
                    enum rte_filter_op filter_op, void *arg)
@@ -3754,7 +3759,12 @@ bnxt_filter_ctrl_op(struct rte_eth_dev *dev,
        struct bnxt *bp = dev->data->dev_private;
        int ret = 0;
 
-       ret = is_bnxt_in_error(dev->data->dev_private);
+       if (BNXT_ETH_DEV_IS_REPRESENTOR(dev)) {
+               struct bnxt_vf_representor *vfr = dev->data->dev_private;
+               bp = vfr->parent_dev->data->dev_private;
+       }
+
+       ret = is_bnxt_in_error(bp);
        if (ret)
                return ret;
 
@@ -5461,10 +5471,6 @@ static int bnxt_init_fw(struct bnxt *bp)
 
        bnxt_hwrm_port_phy_qcaps(bp);
 
-       rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp);
-       if (rc)
-               return rc;
-
        bnxt_alloc_error_recovery_info(bp);
        /* Get the adapter error recovery support info */
        rc = bnxt_hwrm_error_recovery_qcfg(bp);