Skip to content

Commit d900aad

Browse files
Edwin Peerdavem330
authored andcommitted
bnxt_en: refactor cancellation of resource reservations
Resource reservations will also need to be reset after FUNC_DRV_UNRGTR in the following devlink driver_reinit patch. Extract this logic into a reusable function. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent c7dd4a5 commit d900aad

File tree

2 files changed

+29
-19
lines changed

2 files changed

+29
-19
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 28 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -9691,6 +9691,33 @@ static int bnxt_try_recover_fw(struct bnxt *bp)
96919691
return -ENODEV;
96929692
}
96939693

9694+
int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset)
9695+
{
9696+
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
9697+
int rc;
9698+
9699+
if (!BNXT_NEW_RM(bp))
9700+
return 0; /* no resource reservations required */
9701+
9702+
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
9703+
if (rc)
9704+
netdev_err(bp->dev, "resc_qcaps failed\n");
9705+
9706+
hw_resc->resv_cp_rings = 0;
9707+
hw_resc->resv_stat_ctxs = 0;
9708+
hw_resc->resv_irqs = 0;
9709+
hw_resc->resv_tx_rings = 0;
9710+
hw_resc->resv_rx_rings = 0;
9711+
hw_resc->resv_hw_ring_grps = 0;
9712+
hw_resc->resv_vnics = 0;
9713+
if (!fw_reset) {
9714+
bp->tx_nr_rings = 0;
9715+
bp->rx_nr_rings = 0;
9716+
}
9717+
9718+
return rc;
9719+
}
9720+
96949721
static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
96959722
{
96969723
struct hwrm_func_drv_if_change_output *resp;
@@ -9774,25 +9801,7 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
97749801
return rc;
97759802
}
97769803
}
9777-
if (BNXT_NEW_RM(bp)) {
9778-
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
9779-
9780-
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
9781-
if (rc)
9782-
netdev_err(bp->dev, "resc_qcaps failed\n");
9783-
9784-
hw_resc->resv_cp_rings = 0;
9785-
hw_resc->resv_stat_ctxs = 0;
9786-
hw_resc->resv_irqs = 0;
9787-
hw_resc->resv_tx_rings = 0;
9788-
hw_resc->resv_rx_rings = 0;
9789-
hw_resc->resv_hw_ring_grps = 0;
9790-
hw_resc->resv_vnics = 0;
9791-
if (!fw_reset) {
9792-
bp->tx_nr_rings = 0;
9793-
bp->rx_nr_rings = 0;
9794-
}
9795-
}
9804+
rc = bnxt_cancel_reservations(bp, fw_reset);
97969805
}
97979806
return rc;
97989807
}

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2246,6 +2246,7 @@ void bnxt_tx_enable(struct bnxt *bp);
22462246
int bnxt_update_link(struct bnxt *bp, bool chng_link_state);
22472247
int bnxt_hwrm_set_pause(struct bnxt *);
22482248
int bnxt_hwrm_set_link_setting(struct bnxt *, bool, bool);
2249+
int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset);
22492250
int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp);
22502251
int bnxt_hwrm_free_wol_fltr(struct bnxt *bp);
22512252
int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all);

0 commit comments

Comments
 (0)