bnxt_en: Do not modify max_stat_ctxs after RDMA driver requests/frees stat_ctxs
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Sun, 16 Dec 2018 23:46:22 +0000 (18:46 -0500)
committerDavid S. Miller <davem@davemloft.net>
Tue, 18 Dec 2018 07:08:53 +0000 (23:08 -0800)
Calling bnxt_set_max_func_stat_ctxs() to modify max stat_ctxs requested
or freed by the RDMA driver is wrong. After introducing reservation of
resources recently, the driver has to keep track of all stat_ctxs
including the ones used by the RDMA driver.  This will provide a better
foundation for accurate accounting of the stat_ctxs.

Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
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
drivers/net/ethernet/broadcom/bnxt/bnxt_ulp.c

index 8d6c811b5428da44b3941a81704ec7884c7412a9..a3410e5efe96cc3e5473c930b0b237577a762a36 100644 (file)
@@ -7035,11 +7035,6 @@ unsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp)
        return bp->hw_resc.max_stat_ctxs;
 }
 
-void bnxt_set_max_func_stat_ctxs(struct bnxt *bp, unsigned int max)
-{
-       bp->hw_resc.max_stat_ctxs = max;
-}
-
 unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp)
 {
        return bp->hw_resc.max_cp_rings;
index df9a8097325862826a928f2b37e5e78761a21495..4f4dfe8e227afb09af700e7bfb5b6fb913eff17d 100644 (file)
@@ -1687,7 +1687,6 @@ int bnxt_hwrm_vnic_cfg(struct bnxt *bp, u16 vnic_id);
 int __bnxt_hwrm_get_tx_rings(struct bnxt *bp, u16 fid, int *tx_rings);
 int bnxt_hwrm_set_coal(struct bnxt *);
 unsigned int bnxt_get_max_func_stat_ctxs(struct bnxt *bp);
-void bnxt_set_max_func_stat_ctxs(struct bnxt *bp, unsigned int max);
 unsigned int bnxt_get_avail_stat_ctxs_for_en(struct bnxt *bp);
 unsigned int bnxt_get_max_func_cp_rings(struct bnxt *bp);
 unsigned int bnxt_get_avail_cp_rings_for_en(struct bnxt *bp);
index 8ef71a001ebc79ddc626a90cba36cd6a750e6847..ea45a9b8179e311429191f06dfa429bd1a0aa19f 100644 (file)
@@ -50,8 +50,6 @@ static int bnxt_register_dev(struct bnxt_en_dev *edev, int ulp_id,
                if (max_stat_ctxs <= BNXT_MIN_ROCE_STAT_CTXS ||
                    bp->cp_nr_rings == max_stat_ctxs)
                        return -ENOMEM;
-               bnxt_set_max_func_stat_ctxs(bp, max_stat_ctxs -
-                                           BNXT_MIN_ROCE_STAT_CTXS);
        }
 
        atomic_set(&ulp->ref_count, 0);
@@ -82,14 +80,9 @@ static int bnxt_unregister_dev(struct bnxt_en_dev *edev, int ulp_id)
                netdev_err(bp->dev, "ulp id %d not registered\n", ulp_id);
                return -EINVAL;
        }
-       if (ulp_id == BNXT_ROCE_ULP) {
-               unsigned int max_stat_ctxs;
+       if (ulp_id == BNXT_ROCE_ULP && ulp->msix_requested)
+               edev->en_ops->bnxt_free_msix(edev, ulp_id);
 
-               max_stat_ctxs = bnxt_get_max_func_stat_ctxs(bp);
-               bnxt_set_max_func_stat_ctxs(bp, max_stat_ctxs + 1);
-               if (ulp->msix_requested)
-                       edev->en_ops->bnxt_free_msix(edev, ulp_id);
-       }
        if (ulp->max_async_event_id)
                bnxt_hwrm_func_rgtr_async_events(bp, NULL, 0);