net/bnxt: remove redundant header file inclusion
[dpdk.git] / drivers / net / bnxt / bnxt_ethdev.c
index 4fc182b..84f7b87 100644 (file)
@@ -14,7 +14,6 @@
 #include <rte_alarm.h>
 
 #include "bnxt.h"
-#include "bnxt_cpr.h"
 #include "bnxt_filter.h"
 #include "bnxt_hwrm.h"
 #include "bnxt_irq.h"
@@ -27,7 +26,6 @@
 #include "bnxt_vnic.h"
 #include "hsi_struct_def_dpdk.h"
 #include "bnxt_nvm_defs.h"
-#include "bnxt_util.h"
 
 #define DRV_MODULE_NAME                "bnxt"
 static const char bnxt_version[] =
@@ -163,7 +161,8 @@ static const struct rte_pci_id bnxt_pci_id_map[] = {
                                     DEV_RX_OFFLOAD_JUMBO_FRAME | \
                                     DEV_RX_OFFLOAD_KEEP_CRC | \
                                     DEV_RX_OFFLOAD_VLAN_EXTEND | \
-                                    DEV_RX_OFFLOAD_TCP_LRO)
+                                    DEV_RX_OFFLOAD_TCP_LRO | \
+                                    DEV_RX_OFFLOAD_SCATTER)
 
 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);
@@ -223,6 +222,7 @@ static void bnxt_free_mem(struct bnxt *bp, bool reconfig)
                bnxt_free_rx_rings(bp);
        }
        bnxt_free_async_cp_ring(bp);
+       bnxt_free_rxtx_nq_ring(bp);
 }
 
 static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
@@ -253,6 +253,10 @@ static int bnxt_alloc_mem(struct bnxt *bp, bool reconfig)
        if (rc)
                goto alloc_mem_err;
 
+       rc = bnxt_alloc_rxtx_nq_ring(bp);
+       if (rc)
+               goto alloc_mem_err;
+
        return 0;
 
 alloc_mem_err:
@@ -308,6 +312,25 @@ static int bnxt_init_chip(struct bnxt *bp)
                goto err_out;
        }
 
+       if (!(bp->vnic_cap_flags & BNXT_VNIC_CAP_COS_CLASSIFY))
+               goto skip_cosq_cfg;
+
+       for (j = 0, i = 0; i < BNXT_COS_QUEUE_COUNT; i++) {
+               if (bp->rx_cos_queue[i].id != 0xff) {
+                       struct bnxt_vnic_info *vnic = &bp->vnic_info[j++];
+
+                       if (!vnic) {
+                               PMD_DRV_LOG(ERR,
+                                           "Num pools more than FW profile\n");
+                               rc = -EINVAL;
+                               goto err_out;
+                       }
+                       vnic->cos_queue_id = bp->rx_cos_queue[i].id;
+                       bp->rx_cosq_cnt++;
+               }
+       }
+
+skip_cosq_cfg:
        rc = bnxt_mq_rx_configure(bp);
        if (rc) {
                PMD_DRV_LOG(ERR, "MQ mode configure failure rc: %x\n", rc);
@@ -644,11 +667,28 @@ static int bnxt_dev_configure_op(struct rte_eth_dev *eth_dev)
                        return -ENOSPC;
                }
 
+               /* If a resource has already been allocated - in this case
+                * it is the async completion ring, free it. Reallocate it after
+                * resource reservation. This will ensure the resource counts
+                * are calculated correctly.
+                */
+               if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) {
+                       bnxt_disable_int(bp);
+                       bnxt_free_cp_ring(bp, bp->async_cp_ring);
+               }
+
                rc = bnxt_hwrm_func_reserve_vf_resc(bp, false);
                if (rc) {
                        PMD_DRV_LOG(ERR, "HWRM resource alloc fail:%x\n", rc);
                        return -ENOSPC;
                }
+
+               if (!BNXT_HAS_NQ(bp) && bp->async_cp_ring) {
+                       rc = bnxt_alloc_async_cp_ring(bp);
+                       if (rc)
+                               return rc;
+                       bnxt_enable_int(bp);
+               }
        } else {
                /* legacy driver needs to get updated values */
                rc = bnxt_hwrm_func_qcaps(bp);
@@ -725,6 +765,9 @@ static int bnxt_scattered_rx(struct rte_eth_dev *eth_dev)
        uint16_t buf_size;
        int i;
 
+       if (eth_dev->data->dev_conf.rxmode.offloads & DEV_RX_OFFLOAD_SCATTER)
+               return 1;
+
        for (i = 0; i < eth_dev->data->nb_rx_queues; i++) {
                struct bnxt_rx_queue *rxq = eth_dev->data->rx_queues[i];
 
@@ -885,7 +928,7 @@ static int bnxt_dev_set_link_up_op(struct rte_eth_dev *eth_dev)
                eth_dev->data->dev_link.link_status = 1;
 
        bnxt_print_link_info(eth_dev);
-       return 0;
+       return rc;
 }
 
 static int bnxt_dev_set_link_down_op(struct rte_eth_dev *eth_dev)
@@ -4540,7 +4583,7 @@ static int bnxt_init_fw(struct bnxt *bp)
        if (rc)
                return -EIO;
 
-       rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp);
+       rc = bnxt_hwrm_vnic_qcaps(bp);
        if (rc)
                return rc;
 
@@ -4548,16 +4591,19 @@ static int bnxt_init_fw(struct bnxt *bp)
        if (rc)
                return rc;
 
-       /* Get the MAX capabilities for this function */
+       /* Get the MAX capabilities for this function.
+        * This function also allocates context memory for TQM rings and
+        * informs the firmware about this allocated backing store memory.
+        */
        rc = bnxt_hwrm_func_qcaps(bp);
        if (rc)
                return rc;
 
-       rc = bnxt_hwrm_vnic_qcaps(bp);
+       rc = bnxt_hwrm_func_qcfg(bp, &mtu);
        if (rc)
                return rc;
 
-       rc = bnxt_hwrm_func_qcfg(bp, &mtu);
+       rc = bnxt_hwrm_cfa_adv_flow_mgmt_qcaps(bp);
        if (rc)
                return rc;