bnxt_en: refactor bnxt_cancel_reservations()

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>
This commit is contained in:
Vikas Gupta 2022-11-03 19:33:24 -04:00 committed by Jakub Kicinski
parent 1118b2049d
commit b4c6642577

View 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;
}