bnxt_en: refactor bnxt_cancel_reservations()
authorVikas Gupta <vikas.gupta@broadcom.com>
Thu, 3 Nov 2022 23:33:24 +0000 (19:33 -0400)
committerJakub Kicinski <kuba@kernel.org>
Sat, 5 Nov 2022 02:29:01 +0000 (19:29 -0700)
Introduce bnxt_clear_reservations() to clear the reserved attributes only.
This will be used in the next patch to fix PCI AER handling.

Signed-off-by: Vikas Gupta <vikas.gupta@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c

index 04cf768..3743d97 100644 (file)
@@ -9983,17 +9983,12 @@ static int bnxt_try_recover_fw(struct bnxt *bp)
        return -ENODEV;
 }
 
-int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset)
+static void bnxt_clear_reservations(struct bnxt *bp, bool fw_reset)
 {
        struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
-       int rc;
 
        if (!BNXT_NEW_RM(bp))
-               return 0; /* no resource reservations required */
-
-       rc = bnxt_hwrm_func_resc_qcaps(bp, true);
-       if (rc)
-               netdev_err(bp->dev, "resc_qcaps failed\n");
+               return; /* no resource reservations required */
 
        hw_resc->resv_cp_rings = 0;
        hw_resc->resv_stat_ctxs = 0;
@@ -10006,6 +10001,20 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset)
                bp->tx_nr_rings = 0;
                bp->rx_nr_rings = 0;
        }
+}
+
+int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset)
+{
+       int rc;
+
+       if (!BNXT_NEW_RM(bp))
+               return 0; /* no resource reservations required */
+
+       rc = bnxt_hwrm_func_resc_qcaps(bp, true);
+       if (rc)
+               netdev_err(bp->dev, "resc_qcaps failed\n");
+
+       bnxt_clear_reservations(bp, fw_reset);
 
        return rc;
 }