net/bnxt: save the number of EM flow count
[dpdk.git] / drivers / net / bnxt / bnxt_hwrm.c
index 8f0d33d..84cda5e 100644 (file)
@@ -589,8 +589,10 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
        bp->max_cp_rings = rte_le_to_cpu_16(resp->max_cmpl_rings);
        bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
        bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
-       bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
        bp->first_vf_id = rte_le_to_cpu_16(resp->first_vf_id);
+       bp->max_rx_em_flows = rte_le_to_cpu_16(resp->max_rx_em_flows);
+       bp->max_l2_ctx =
+               rte_le_to_cpu_16(resp->max_l2_ctxs) + bp->max_rx_em_flows;
        /* TODO: For now, do not support VMDq/RFS on VFs. */
        if (BNXT_PF(bp)) {
                if (bp->pf.max_vfs)
@@ -611,6 +613,9 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
                }
        }
 
+       if (flags & HWRM_FUNC_QCAPS_OUTPUT_FLAGS_EXT_STATS_SUPPORTED)
+               bp->flags |= BNXT_FLAG_EXT_STATS_SUPPORTED;
+
        HWRM_UNLOCK();
 
        return rc;
@@ -793,7 +798,12 @@ int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp)
                bp->max_tx_rings = rte_le_to_cpu_16(resp->max_tx_rings);
                bp->max_rx_rings = rte_le_to_cpu_16(resp->max_rx_rings);
                bp->max_ring_grps = rte_le_to_cpu_32(resp->max_hw_ring_grps);
-               bp->max_l2_ctx = rte_le_to_cpu_16(resp->max_l2_ctxs);
+               /* func_resource_qcaps does not return max_rx_em_flows.
+                * So use the value provided by func_qcaps.
+                */
+               bp->max_l2_ctx =
+                       rte_le_to_cpu_16(resp->max_l2_ctxs) +
+                       bp->max_rx_em_flows;
                bp->max_vnics = rte_le_to_cpu_16(resp->max_vnics);
                bp->max_stat_ctx = rte_le_to_cpu_16(resp->max_stat_ctx);
        }
@@ -2086,6 +2096,7 @@ static void bnxt_free_cp_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;
 }
 
 void bnxt_free_hwrm_rx_ring(struct bnxt *bp, int queue_index)
@@ -4495,13 +4506,13 @@ int bnxt_hwrm_ext_port_qstats(struct bnxt *bp)
        req.port_id = rte_cpu_to_le_16(pf->port_id);
        if (bp->flags & BNXT_FLAG_EXT_TX_PORT_STATS) {
                req.tx_stat_host_addr =
-                       rte_cpu_to_le_64(bp->hw_tx_port_stats_map);
+                       rte_cpu_to_le_64(bp->hw_tx_port_stats_ext_map);
                req.tx_stat_size =
                        rte_cpu_to_le_16(sizeof(struct tx_port_stats_ext));
        }
        if (bp->flags & BNXT_FLAG_EXT_RX_PORT_STATS) {
                req.rx_stat_host_addr =
-                       rte_cpu_to_le_64(bp->hw_rx_port_stats_map);
+                       rte_cpu_to_le_64(bp->hw_rx_port_stats_ext_map);
                req.rx_stat_size =
                        rte_cpu_to_le_16(sizeof(struct rx_port_stats_ext));
        }
@@ -4604,3 +4615,28 @@ int bnxt_hwrm_tunnel_redirect_info(struct bnxt *bp, uint8_t tun_type,
 
        return rc;
 }
+
+int bnxt_hwrm_set_mac(struct bnxt *bp)
+{
+       struct hwrm_func_vf_cfg_output *resp = bp->hwrm_cmd_resp_addr;
+       struct hwrm_func_vf_cfg_input req = {0};
+       int rc = 0;
+
+       if (!BNXT_VF(bp))
+               return 0;
+
+       HWRM_PREP(req, FUNC_VF_CFG, BNXT_USE_CHIMP_MB);
+
+       req.enables =
+               rte_cpu_to_le_32(HWRM_FUNC_VF_CFG_INPUT_ENABLES_DFLT_MAC_ADDR);
+       memcpy(req.dflt_mac_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
+
+       rc = bnxt_hwrm_send_message(bp, &req, sizeof(req), BNXT_USE_CHIMP_MB);
+
+       HWRM_CHECK_RESULT();
+
+       memcpy(bp->dflt_mac_addr, bp->mac_addr, RTE_ETHER_ADDR_LEN);
+       HWRM_UNLOCK();
+
+       return rc;
+}