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>
This commit is contained in:
Родитель
c7dd4a5b0a
Коммит
d900aadd86
|
@ -9691,6 +9691,33 @@ static int bnxt_try_recover_fw(struct bnxt *bp)
|
|||
return -ENODEV;
|
||||
}
|
||||
|
||||
int bnxt_cancel_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");
|
||||
|
||||
hw_resc->resv_cp_rings = 0;
|
||||
hw_resc->resv_stat_ctxs = 0;
|
||||
hw_resc->resv_irqs = 0;
|
||||
hw_resc->resv_tx_rings = 0;
|
||||
hw_resc->resv_rx_rings = 0;
|
||||
hw_resc->resv_hw_ring_grps = 0;
|
||||
hw_resc->resv_vnics = 0;
|
||||
if (!fw_reset) {
|
||||
bp->tx_nr_rings = 0;
|
||||
bp->rx_nr_rings = 0;
|
||||
}
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
|
||||
{
|
||||
struct hwrm_func_drv_if_change_output *resp;
|
||||
|
@ -9774,25 +9801,7 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
|
|||
return rc;
|
||||
}
|
||||
}
|
||||
if (BNXT_NEW_RM(bp)) {
|
||||
struct bnxt_hw_resc *hw_resc = &bp->hw_resc;
|
||||
|
||||
rc = bnxt_hwrm_func_resc_qcaps(bp, true);
|
||||
if (rc)
|
||||
netdev_err(bp->dev, "resc_qcaps failed\n");
|
||||
|
||||
hw_resc->resv_cp_rings = 0;
|
||||
hw_resc->resv_stat_ctxs = 0;
|
||||
hw_resc->resv_irqs = 0;
|
||||
hw_resc->resv_tx_rings = 0;
|
||||
hw_resc->resv_rx_rings = 0;
|
||||
hw_resc->resv_hw_ring_grps = 0;
|
||||
hw_resc->resv_vnics = 0;
|
||||
if (!fw_reset) {
|
||||
bp->tx_nr_rings = 0;
|
||||
bp->rx_nr_rings = 0;
|
||||
}
|
||||
}
|
||||
rc = bnxt_cancel_reservations(bp, fw_reset);
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
|
|
@ -2246,6 +2246,7 @@ void bnxt_tx_enable(struct bnxt *bp);
|
|||
int bnxt_update_link(struct bnxt *bp, bool chng_link_state);
|
||||
int bnxt_hwrm_set_pause(struct bnxt *);
|
||||
int bnxt_hwrm_set_link_setting(struct bnxt *, bool, bool);
|
||||
int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset);
|
||||
int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp);
|
||||
int bnxt_hwrm_free_wol_fltr(struct bnxt *bp);
|
||||
int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all);
|
||||
|
|
Загрузка…
Ссылка в новой задаче