Commit 6882c36c authored by Edwin Peer's avatar Edwin Peer Committed by Jakub Kicinski

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: default avatarEdwin Peer <edwin.peer@broadcom.com>
Signed-off-by: default avatarMichael Chan <michael.chan@broadcom.com>
Acked-by: default avatarWillem de Bruijn <willemb@google.com>
Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent a44daa8f
......@@ -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);
......
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