Commit c5b744d3 authored by Kashyap Desai's avatar Kashyap Desai Committed by Jakub Kicinski

bnxt_en: reclaim max resources if sriov enable fails

If bnxt_sriov_enable() fails after some resources have been reserved
for the VFs, the current code is not unwinding properly and the
reserved resources become unavailable afterwards.  Fix it by
properly unwinding with a call to bnxt_hwrm_func_qcaps() to
reset all maximum resources.

Also, add the missing bnxt_ulp_sriov_cfg() call to let the RDMA
driver know to abort.

Fixes: c0c050c5 ("bnxt_en: New Broadcom ethernet driver.")
Signed-off-by: default avatarKashyap Desai <kashyap.desai@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent f946964a
...@@ -7790,7 +7790,7 @@ static void bnxt_hwrm_dbg_qcaps(struct bnxt *bp) ...@@ -7790,7 +7790,7 @@ static void bnxt_hwrm_dbg_qcaps(struct bnxt *bp)
static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp); static int bnxt_hwrm_queue_qportcfg(struct bnxt *bp);
static int bnxt_hwrm_func_qcaps(struct bnxt *bp) int bnxt_hwrm_func_qcaps(struct bnxt *bp)
{ {
int rc; int rc;
......
...@@ -2314,6 +2314,7 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset); ...@@ -2314,6 +2314,7 @@ int bnxt_cancel_reservations(struct bnxt *bp, bool fw_reset);
int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp); int bnxt_hwrm_alloc_wol_fltr(struct bnxt *bp);
int bnxt_hwrm_free_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); int bnxt_hwrm_func_resc_qcaps(struct bnxt *bp, bool all);
int bnxt_hwrm_func_qcaps(struct bnxt *bp);
int bnxt_hwrm_fw_set_time(struct bnxt *); int bnxt_hwrm_fw_set_time(struct bnxt *);
int bnxt_open_nic(struct bnxt *, bool, bool); int bnxt_open_nic(struct bnxt *, bool, bool);
int bnxt_half_open_nic(struct bnxt *bp); int bnxt_half_open_nic(struct bnxt *bp);
......
...@@ -823,8 +823,10 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) ...@@ -823,8 +823,10 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
goto err_out2; goto err_out2;
rc = pci_enable_sriov(bp->pdev, *num_vfs); rc = pci_enable_sriov(bp->pdev, *num_vfs);
if (rc) if (rc) {
bnxt_ulp_sriov_cfg(bp, 0);
goto err_out2; goto err_out2;
}
return 0; return 0;
...@@ -832,6 +834,9 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs) ...@@ -832,6 +834,9 @@ static int bnxt_sriov_enable(struct bnxt *bp, int *num_vfs)
/* Free the resources reserved for various VF's */ /* Free the resources reserved for various VF's */
bnxt_hwrm_func_vf_resource_free(bp, *num_vfs); bnxt_hwrm_func_vf_resource_free(bp, *num_vfs);
/* Restore the max resources */
bnxt_hwrm_func_qcaps(bp);
err_out1: err_out1:
bnxt_free_vf_resources(bp); bnxt_free_vf_resources(bp);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment