bnxt_en: Allocate the larger per-ring statistics block for 57500 chips.
authorMichael Chan <michael.chan@broadcom.com>
Mon, 29 Jul 2019 10:10:29 +0000 (06:10 -0400)
committerDavid S. Miller <davem@davemloft.net>
Mon, 29 Jul 2019 21:19:09 +0000 (14:19 -0700)
The new TPA implemantation has additional TPA counters that extend the
per-ring statistics block.  Allocate the proper size accordingly.

Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/broadcom/bnxt/bnxt.c
drivers/net/ethernet/broadcom/bnxt/bnxt.h

index 9269a94455a98d988c48705e27108122acd4d80e..f607873b96bd7015f7a7da2367eb78f36002a83e 100644 (file)
@@ -3635,7 +3635,7 @@ static void bnxt_free_ring_stats(struct bnxt *bp)
        if (!bp->bnapi)
                return;
 
-       size = sizeof(struct ctx_hw_stats);
+       size = bp->hw_ring_stats_size;
 
        for (i = 0; i < bp->cp_nr_rings; i++) {
                struct bnxt_napi *bnapi = bp->bnapi[i];
@@ -3654,7 +3654,7 @@ static int bnxt_alloc_stats(struct bnxt *bp)
        u32 size, i;
        struct pci_dev *pdev = bp->pdev;
 
-       size = sizeof(struct ctx_hw_stats);
+       size = bp->hw_ring_stats_size;
 
        for (i = 0; i < bp->cp_nr_rings; i++) {
                struct bnxt_napi *bnapi = bp->bnapi[i];
@@ -4989,6 +4989,11 @@ static int bnxt_hwrm_vnic_qcaps(struct bnxt *bp)
                    VNIC_QCAPS_RESP_FLAGS_ROCE_MIRRORING_CAPABLE_VNIC_CAP)
                        bp->flags |= BNXT_FLAG_ROCE_MIRROR_CAP;
                bp->max_tpa_v2 = le16_to_cpu(resp->max_aggs_supported);
+               if (bp->max_tpa_v2)
+                       bp->hw_ring_stats_size =
+                               sizeof(struct ctx_hw_stats_ext);
+               else
+                       bp->hw_ring_stats_size = sizeof(struct ctx_hw_stats);
        }
        mutex_unlock(&bp->hwrm_cmd_lock);
        return rc;
@@ -6186,6 +6191,7 @@ static int bnxt_hwrm_stat_ctx_alloc(struct bnxt *bp)
 
        bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_STAT_CTX_ALLOC, -1, -1);
 
+       req.stats_dma_length = cpu_to_le16(bp->hw_ring_stats_size);
        req.update_period_ms = cpu_to_le32(bp->stats_coal_ticks / 1000);
 
        mutex_lock(&bp->hwrm_cmd_lock);
index 309cf99bcda93429322094f0706f6bbd274a48e5..6c710d70adbd12f4e7d628a6e7bb262ce9ddeb77 100644 (file)
@@ -1607,6 +1607,7 @@ struct bnxt {
        int                     hw_port_stats_size;
        u16                     fw_rx_stats_ext_size;
        u16                     fw_tx_stats_ext_size;
+       u16                     hw_ring_stats_size;
        u8                      pri2cos[8];
        u8                      pri2cos_valid;