net/bnxt: use dedicated CPR for async events
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index 6f3a045..6437747 100644 (file)
@@ -737,9 +737,12 @@ int bnxt_hwrm_func_reserve_vf_resc(struct bnxt *bp, bool test)
        req.num_tx_rings = rte_cpu_to_le_16(bp->tx_nr_rings);
        req.num_rx_rings = rte_cpu_to_le_16(bp->rx_nr_rings *
                                            AGG_RING_MULTIPLIER);
-       req.num_stat_ctxs = rte_cpu_to_le_16(bp->rx_nr_rings + bp->tx_nr_rings);
+       req.num_stat_ctxs = rte_cpu_to_le_16(bp->rx_nr_rings +
+                                            bp->tx_nr_rings +
+                                            BNXT_NUM_ASYNC_CPR(bp));
        req.num_cmpl_rings = rte_cpu_to_le_16(bp->rx_nr_rings +
-                                             bp->tx_nr_rings);
+                                             bp->tx_nr_rings +
+                                             BNXT_NUM_ASYNC_CPR(bp));
        req.num_vnics = rte_cpu_to_le_16(bp->rx_nr_rings);
        if (bp->vf_resv_strategy ==
            HWRM_FUNC_RESOURCE_QCAPS_OUTPUT_VF_RESV_STRATEGY_MINIMAL_STATIC) {
@@ -1733,7 +1736,7 @@ bnxt_hwrm_vnic_rss_cfg_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
        int i;
        int rc = 0;
-       int nr_ctxs = bp->max_ring_grps;
+       int nr_ctxs = vnic->num_lb_ctxts;
        struct hwrm_vnic_rss_cfg_input req = {.req_type = 0 };
        struct hwrm_vnic_rss_cfg_output *resp = bp->hwrm_cmd_resp_addr;
 
@@ -2073,7 +2076,7 @@ int bnxt_free_all_hwrm_ring_grps(struct bnxt *bp)
        return rc;
 }
 
-static void bnxt_free_nq_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
+void bnxt_free_nq_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
 {
        struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
 
@@ -2083,9 +2086,10 @@ static void bnxt_free_nq_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
        memset(cpr->cp_desc_ring, 0, cpr->cp_ring_struct->ring_size *
                                     sizeof(*cpr->cp_desc_ring));
        cpr->cp_raw_cons = 0;
+       cpr->valid = 0;
 }
 
-static void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
+void bnxt_free_cp_ring(struct bnxt *bp, struct bnxt_cp_ring_info *cpr)
 {
        struct bnxt_ring *cp_ring = cpr->cp_ring_struct;
 
@@ -2884,14 +2888,7 @@ int bnxt_hwrm_func_qcfg_current_vf_vlan(struct bnxt *bp, int vf)
        HWRM_PREP(req, FUNC_QCFG, BNXT_USE_CHIMP_MB);
        req.fid = rte_cpu_to_le_16(bp->pf.vf_info[vf].fid);
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
-       if (rc) {
-               PMD_DRV_LOG(ERR, "hwrm_func_qcfg failed rc:%d\n", rc);
-               return -1;
-       } else if (resp->error_code) {
-               rc = rte_le_to_cpu_16(resp->error_code);
-               PMD_DRV_LOG(ERR, "hwrm_func_qcfg error %d\n", rc);
-               return -1;
-       }
+       HWRM_CHECK_RESULT();
        rc = rte_le_to_cpu_16(resp->vlan);
 
        HWRM_UNLOCK();
@@ -3219,7 +3216,7 @@ int bnxt_hwrm_func_cfg_def_cp(struct bnxt *bp)
        req.enables = rte_cpu_to_le_32(
                        HWRM_FUNC_CFG_INPUT_ENABLES_ASYNC_EVENT_CR);
        req.async_event_cr = rte_cpu_to_le_16(
-                       bp->def_cp_ring->cp_ring_struct->fw_ring_id);
+                       bp->async_cp_ring->cp_ring_struct->fw_ring_id);
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
        HWRM_CHECK_RESULT();
@@ -3239,7 +3236,7 @@ int bnxt_hwrm_vf_func_cfg_def_cp(struct bnxt *bp)
        req.enables = rte_cpu_to_le_32(
                        HWRM_FUNC_VF_CFG_INPUT_ENABLES_ASYNC_EVENT_CR);
        req.async_event_cr = rte_cpu_to_le_16(
-                       bp->def_cp_ring->cp_ring_struct->fw_ring_id);
+                       bp->async_cp_ring->cp_ring_struct->fw_ring_id);
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
        HWRM_CHECK_RESULT();
@@ -4116,9 +4113,9 @@ bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
        struct hwrm_vnic_rss_cfg_output *resp = bp->hwrm_cmd_resp_addr;
        uint8_t *rx_queue_state = bp->eth_dev->data->rx_queue_state;
        struct hwrm_vnic_rss_cfg_input req = {.req_type = 0 };
-       int nr_ctxs = bp->max_ring_grps;
        struct bnxt_rx_queue **rxqs = bp->rx_queues;
        uint16_t *ring_tbl = vnic->rss_table;
+       int nr_ctxs = vnic->num_lb_ctxts;
        int max_rings = bp->rx_nr_rings;
        int i, j, k, cnt;
        int rc = 0;
@@ -4134,7 +4131,9 @@ bnxt_vnic_rss_configure_thor(struct bnxt *bp, struct bnxt_vnic_info *vnic)
                req.hash_mode_flags = vnic->hash_mode;
 
                req.ring_grp_tbl_addr =
-                   rte_cpu_to_le_64(vnic->rss_table_dma_addr);
+                   rte_cpu_to_le_64(vnic->rss_table_dma_addr +
+                                    i * BNXT_RSS_ENTRIES_PER_CTX_THOR *
+                                    2 * sizeof(*ring_tbl));
                req.hash_key_tbl_addr =
                    rte_cpu_to_le_64(vnic->rss_hash_key_dma_addr);