Skip to content

Commit

Permalink
bnxt_en: close & open NIC, only when the interface is in running state.
Browse files Browse the repository at this point in the history
bnxt_restore_pf_fw_resources routine frees PF resources by calling
close_nic and allocates the resources back, by doing open_nic. However,
this is not needed, if the PF is already in closed state.

This bug causes the driver to call open the device and call request_irq()
when it is not needed.  Ultimately, pci_disable_msix() will crash
when bnxt_en is unloaded.

This patch fixes the problem by skipping __bnxt_close_nic and
__bnxt_open_nic inside bnxt_restore_pf_fw_resources routine, if the
interface is not running.

Fixes: 80fcaf4 ("bnxt_en: Restore MSIX after disabling SRIOV.")
Signed-off-by: Venkat Duvvuru <venkatkumar.duvvuru@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
  • Loading branch information
Venkat Duvvuru authored and David S. Miller committed Mar 12, 2018
1 parent 6ae777e commit 1a03778
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions drivers/net/ethernet/broadcom/bnxt/bnxt.c
Original file line number Diff line number Diff line change
Expand Up @@ -8432,13 +8432,20 @@ int bnxt_restore_pf_fw_resources(struct bnxt *bp)
return 0;

bnxt_hwrm_func_qcaps(bp);
__bnxt_close_nic(bp, true, false);

if (netif_running(bp->dev))
__bnxt_close_nic(bp, true, false);

bnxt_clear_int_mode(bp);
rc = bnxt_init_int_mode(bp);
if (rc)
dev_close(bp->dev);
else
rc = bnxt_open_nic(bp, true, false);

if (netif_running(bp->dev)) {
if (rc)
dev_close(bp->dev);
else
rc = bnxt_open_nic(bp, true, false);
}

return rc;
}

Expand Down

0 comments on commit 1a03778

Please sign in to comment.