bnxt_en: Fix logic that disables Bus Master during firmware reset.
authorVasundhara Volam <vasundhara-v.volam@broadcom.com>
Sun, 2 Feb 2020 07:41:37 +0000 (02:41 -0500)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 11 Feb 2020 12:35:06 +0000 (04:35 -0800)
commit9f5c4fac341ceefdd38d9bd477a2bd34d65610d4
tree330e49e46f2784dddd7afd866a42e5b1c8c37a5f
parentfddd3f73ad0891dcafd78a6b8595ea7dda30bcab
bnxt_en: Fix logic that disables Bus Master during firmware reset.

[ Upstream commit d407302895d3f3ca3a333c711744a95e0b1b0150 ]

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: 3bc7d4a352ef ("bnxt_en: Add BNXT_STATE_IN_FW_RESET state.")
Signed-off-by: Vasundhara Volam <vasundhara-v.volam@broadcom.com>
Signed-off-by: Michael Chan <michael.chan@broadcom.com>
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/net/ethernet/broadcom/bnxt/bnxt.c