mirror of
https://github.com/torvalds/linux.git
synced 2024-11-24 13:11:40 +00:00
bnxt_en: attempt to reinitialize after aborted reset
Drawing a hard line on aborted resets prevents a NIC open in some scenarios that may otherwise be recoverable. For example, if a firmware recovery happened while a PF was down and an attempt was made to bring up an associated VF in this state, then it was impossible to ever bring up this VF without a rebind or reload of its driver. Attempt to reinitialize the firmware when an aborted reset (or failed init after a reset) is discovered during open - it may succeed. Also take care to allow the user to retry opening the NIC even after an aborted reset. Signed-off-by: Edwin Peer <edwin.peer@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Acked-by: Willem de Bruijn <willemb@google.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
a44daa8fcb
commit
6882c36cf8
@ -9768,6 +9768,25 @@ static void bnxt_preset_reg_win(struct bnxt *bp)
|
||||
|
||||
static int bnxt_init_dflt_ring_mode(struct bnxt *bp);
|
||||
|
||||
static int bnxt_reinit_after_abort(struct bnxt *bp)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if (test_bit(BNXT_STATE_IN_FW_RESET, &bp->state))
|
||||
return -EBUSY;
|
||||
|
||||
rc = bnxt_fw_init_one(bp);
|
||||
if (!rc) {
|
||||
bnxt_clear_int_mode(bp);
|
||||
rc = bnxt_init_int_mode(bp);
|
||||
if (!rc) {
|
||||
clear_bit(BNXT_STATE_ABORT_ERR, &bp->state);
|
||||
set_bit(BNXT_STATE_FW_RESET_DET, &bp->state);
|
||||
}
|
||||
}
|
||||
return rc;
|
||||
}
|
||||
|
||||
static int __bnxt_open_nic(struct bnxt *bp, bool irq_re_init, bool link_re_init)
|
||||
{
|
||||
int rc = 0;
|
||||
@ -9926,8 +9945,14 @@ static int bnxt_open(struct net_device *dev)
|
||||
int rc;
|
||||
|
||||
if (test_bit(BNXT_STATE_ABORT_ERR, &bp->state)) {
|
||||
netdev_err(bp->dev, "A previous firmware reset did not complete, aborting\n");
|
||||
return -ENODEV;
|
||||
rc = bnxt_reinit_after_abort(bp);
|
||||
if (rc) {
|
||||
if (rc == -EBUSY)
|
||||
netdev_err(bp->dev, "A previous firmware reset has not completed, aborting\n");
|
||||
else
|
||||
netdev_err(bp->dev, "Failed to reinitialize after aborted firmware reset\n");
|
||||
return -ENODEV;
|
||||
}
|
||||
}
|
||||
|
||||
rc = bnxt_hwrm_if_change(bp, true);
|
||||
|
Loading…
Reference in New Issue
Block a user