net/ice: fix build when Rx descriptor size is 16
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index d583839..181e607 100644 (file)
@@ -941,6 +941,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
        if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_LINK_ADMIN_STATUS_SUPPORTED)
                bp->fw_cap |= BNXT_FW_CAP_LINK_ADMIN;
 
+       if (!(flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_VLAN_ACCELERATION_TX_DISABLED)) {
+               bp->fw_cap |= BNXT_FW_CAP_VLAN_TX_INSERT;
+               PMD_DRV_LOG(DEBUG, "VLAN acceleration for TX is enabled\n");
+       }
 unlock:
        HWRM_UNLOCK();
 
@@ -1001,6 +1005,11 @@ int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
        if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_RX_CMPL_V2_CAP)
                bp->vnic_cap_flags |= BNXT_VNIC_CAP_RX_CMPL_V2;
 
+       if (flags & HWRM_VNIC_QCAPS_OUTPUT_FLAGS_VLAN_STRIP_CAP) {
+               bp->vnic_cap_flags |= BNXT_VNIC_CAP_VLAN_RX_STRIP;
+               PMD_DRV_LOG(DEBUG, "Rx VLAN strip capability enabled\n");
+       }
+
        bp->max_tpa_v2 = rte_le_to_cpu_16(resp->max_aggs_supported);
 
        HWRM_UNLOCK();
@@ -1050,9 +1059,9 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
        HWRM_PREP(&req, HWRM_FUNC_DRV_RGTR, BNXT_USE_CHIMP_MB);
        req.enables = rte_cpu_to_le_32(HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_VER |
                        HWRM_FUNC_DRV_RGTR_INPUT_ENABLES_ASYNC_EVENT_FWD);
-       req.ver_maj = RTE_VER_YEAR;
-       req.ver_min = RTE_VER_MONTH;
-       req.ver_upd = RTE_VER_MINOR;
+       req.ver_maj_8b = RTE_VER_YEAR;
+       req.ver_min_8b = RTE_VER_MONTH;
+       req.ver_upd_8b = RTE_VER_MINOR;
 
        if (BNXT_PF(bp)) {
                req.enables |= rte_cpu_to_le_32(
@@ -1085,7 +1094,8 @@ int bnxt_hwrm_func_driver_register(struct bnxt *bp)
                rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_DEFAULT_VNIC_CHANGE);
 
        req.async_event_fwd[2] |=
-               rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST);
+               rte_cpu_to_le_32(ASYNC_CMPL_EVENT_ID_ECHO_REQUEST |
+                                ASYNC_CMPL_EVENT_ID_ERROR_REPORT);
 
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
@@ -1360,7 +1370,7 @@ error:
        return rc;
 }
 
-int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags)
+int bnxt_hwrm_func_driver_unregister(struct bnxt *bp)
 {
        int rc;
        struct hwrm_func_drv_unrgtr_input req = {.req_type = 0 };
@@ -1370,7 +1380,6 @@ int bnxt_hwrm_func_driver_unregister(struct bnxt *bp, uint32_t flags)
                return 0;
 
        HWRM_PREP(&req, HWRM_FUNC_DRV_UNRGTR, BNXT_USE_CHIMP_MB);
-       req.flags = flags;
 
        rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
 
@@ -1863,6 +1872,10 @@ int bnxt_hwrm_ring_grp_alloc(struct bnxt *bp, unsigned int idx)
        struct hwrm_ring_grp_alloc_input req = {.req_type = 0 };
        struct hwrm_ring_grp_alloc_output *resp = bp->hwrm_cmd_resp_addr;
 
+       /* Don't attempt to re-create the ring group if it is already created */
+       if (bp->grp_info[idx].fw_grp_id != INVALID_HW_RING_ID)
+               return 0;
+
        HWRM_PREP(&req, HWRM_RING_GRP_ALLOC, BNXT_USE_CHIMP_MB);
 
        req.cr = rte_cpu_to_le_16(bp->grp_info[idx].cp_fw_ring_id);
@@ -1887,6 +1900,9 @@ int bnxt_hwrm_ring_grp_free(struct bnxt *bp, unsigned int idx)
        struct hwrm_ring_grp_free_input req = {.req_type = 0 };
        struct hwrm_ring_grp_free_output *resp = bp->hwrm_cmd_resp_addr;
 
+       if (bp->grp_info[idx].fw_grp_id == INVALID_HW_RING_ID)
+               return 0;
+
        HWRM_PREP(&req, HWRM_RING_GRP_FREE, BNXT_USE_CHIMP_MB);
 
        req.ring_group_id = rte_cpu_to_le_16(bp->grp_info[idx].fw_grp_id);
@@ -2716,12 +2732,23 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
        struct bnxt_ring *ring = rxr->rx_ring_struct;
        struct bnxt_cp_ring_info *cpr = rxq->cp_ring;
 
+       if (BNXT_HAS_RING_GRPS(bp))
+               bnxt_hwrm_ring_grp_free(bp, queue_index);
+
        bnxt_hwrm_ring_free(bp, ring,
                            HWRM_RING_FREE_INPUT_RING_TYPE_RX,
                            cpr->cp_ring_struct->fw_ring_id);
        if (BNXT_HAS_RING_GRPS(bp))
                bp->grp_info[queue_index].rx_fw_ring_id = INVALID_HW_RING_ID;
 
+       /* Check agg ring struct explicitly.
+        * bnxt_need_agg_ring() returns the current state of offload flags,
+        * but we may have to deal with agg ring struct before the offload
+        * flags are updated.
+        */
+       if (!bnxt_need_agg_ring(bp->eth_dev) || rxr->ag_ring_struct == NULL)
+               goto no_agg;
+
        ring = rxr->ag_ring_struct;
        bnxt_hwrm_ring_free(bp, ring,
                            BNXT_CHIP_P5(bp) ?
@@ -2731,6 +2758,7 @@ void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
        if (BNXT_HAS_RING_GRPS(bp))
                bp->grp_info[queue_index].ag_fw_ring_id = INVALID_HW_RING_ID;
 
+no_agg:
        bnxt_hwrm_stat_ctx_free(bp, cpr);
 
        bnxt_free_cp_ring(bp, cpr);
@@ -3389,16 +3417,6 @@ int bnxt_hwrm_parent_pf_qcfg(struct bnxt *bp)
        bp->parent->fid = rte_le_to_cpu_16(resp->fid);
        bp->parent->port_id = rte_le_to_cpu_16(resp->port_id);
 
-       /* FIXME: Temporary workaround - remove when firmware issue is fixed. */
-       if (bp->parent->vnic == 0) {
-               PMD_DRV_LOG(DEBUG, "parent VNIC unavailable.\n");
-               /* Use hard-coded values appropriate for current Wh+ fw. */
-               if (bp->parent->fid == 2)
-                       bp->parent->vnic = 0x100;
-               else
-                       bp->parent->vnic = 1;
-       }
-
        HWRM_UNLOCK();
 
        return 0;
@@ -5084,6 +5102,7 @@ static int
 bnxt_vnic_rss_configure_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 {
        struct hwrm_vnic_rss_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+       uint8_t *rxq_state = bp->eth_dev->data->rx_queue_state;
        struct hwrm_vnic_rss_cfg_input req = {.req_type = 0 };
        struct bnxt_rx_queue **rxqs = bp->rx_queues;
        uint16_t *ring_tbl = vnic->rss_table;
@@ -5117,7 +5136,7 @@ bnxt_vnic_rss_configure_p5(struct bnxt *bp, struct bnxt_vnic_info *vnic)
 
                        /* Find next active ring. */
                        for (cnt = 0; cnt < max_rings; cnt++) {
-                               if (rxqs[k]->rx_started)
+                               if (rxq_state[k] != RTE_ETH_QUEUE_STATE_STOPPED)
                                        break;
                                if (++k == max_rings)
                                        k = 0;
@@ -5706,11 +5725,11 @@ int bnxt_hwrm_error_recovery_qcfg(struct bnxt *bp)
        /* FW returned values are in units of 100msec */
        info->driver_polling_freq =
                rte_le_to_cpu_32(resp->driver_polling_freq) * 100;
-       info->master_func_wait_period =
+       info->primary_func_wait_period =
                rte_le_to_cpu_32(resp->master_func_wait_period) * 100;
        info->normal_func_wait_period =
                rte_le_to_cpu_32(resp->normal_func_wait_period) * 100;
-       info->master_func_wait_period_after_reset =
+       info->primary_func_wait_period_after_reset =
                rte_le_to_cpu_32(resp->master_func_wait_period_after_reset) * 100;
        info->max_bailout_time_after_reset =
                rte_le_to_cpu_32(resp->max_bailout_time_after_reset) * 100;