Skip to content

Commit d407302

Browse files
Vasundhara Volamkuba-moo
authored andcommitted
bnxt_en: Fix logic that disables Bus Master during firmware reset.
The current logic that calls pci_disable_device() in __bnxt_close_nic() during firmware reset is flawed. If firmware is still alive, we're disabling the device too early, causing some firmware commands to not reach the firmware. Fix it by moving the logic to bnxt_reset_close(). If firmware is in fatal condition, we call pci_disable_device() before we free any of the rings to prevent DMA corruption of the freed rings. If firmware is still alive, we call pci_disable_device() after the last firmware message has been sent. Fixes: 3bc7d4a ("bnxt_en: Add BNXT_STATE_IN_FW_RESET state.") Signed-off-by: Vasundhara Volam <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 12de2ea commit d407302

File tree

1 file changed

+7
-4
lines changed
  • drivers/net/ethernet/broadcom/bnxt

1 file changed

+7
-4
lines changed

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

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9313,10 +9313,6 @@ static void __bnxt_close_nic(struct bnxt *bp, bool irq_re_init,
93139313
bnxt_debug_dev_exit(bp);
93149314
bnxt_disable_napi(bp);
93159315
del_timer_sync(&bp->timer);
9316-
if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state) &&
9317-
pci_is_enabled(bp->pdev))
9318-
pci_disable_device(bp->pdev);
9319-
93209316
bnxt_free_skbs(bp);
93219317

93229318
/* Save ring stats before shutdown */
@@ -10102,9 +10098,16 @@ static void bnxt_reset(struct bnxt *bp, bool silent)
1010210098
static void bnxt_fw_reset_close(struct bnxt *bp)
1010310099
{
1010410100
bnxt_ulp_stop(bp);
10101+
/* When firmware is fatal state, disable PCI device to prevent
10102+
* any potential bad DMAs before freeing kernel memory.
10103+
*/
10104+
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
10105+
pci_disable_device(bp->pdev);
1010510106
__bnxt_close_nic(bp, true, false);
1010610107
bnxt_clear_int_mode(bp);
1010710108
bnxt_hwrm_func_drv_unrgtr(bp);
10109+
if (pci_is_enabled(bp->pdev))
10110+
pci_disable_device(bp->pdev);
1010810111
bnxt_free_ctx_mem(bp);
1010910112
kfree(bp->ctx);
1011010113
bp->ctx = NULL;

0 commit comments

Comments
 (0)