Skip to content

Commit 5ecb6fc

Browse files
kadesai16NipaLocal
authored andcommitted
bnxt_en: delay pci_alloc_irq_vectors() in the AER path
This patch is similar to the last patch to delay the pci_alloc_irq_vectors() call in the AER path until after calling bnxt_reserve_rings(). bnxt_reserve_rings() needs to properly map the MSIX table first before we call pci_alloc_irq_vectors() which may immediately write to the MSIX table in some architectures. Move the bnxt_init_int_mode() call from bnxt_io_slot_reset() to bnxt_io_resume() after calling bnxt_reserve_rings(). With this change, the AER path may call bnxt_open() -> bnxt_hwrm_if_change() with bp->irq_tbl set to NULL. bp->irq_tbl is cleared when we call bnxt_clear_int_mode() in bnxt_io_slot_reset(). So we cannot use !bp->irq_tbl to detect aborted FW reset. Add a new BNXT_FW_RESET_STATE_ABORT to detect aborted FW reset in bnxt_hwrm_if_change(). Signed-off-by: Kashyap Desai <[email protected]> Signed-off-by: Michael Chan <[email protected]> Signed-off-by: NipaLocal <nipa@local>
1 parent 11a7256 commit 5ecb6fc

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

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

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12367,12 +12367,15 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
1236712367
{
1236812368
struct hwrm_func_drv_if_change_output *resp;
1236912369
struct hwrm_func_drv_if_change_input *req;
12370-
bool fw_reset = !bp->irq_tbl;
1237112370
bool resc_reinit = false;
1237212371
bool caps_change = false;
1237312372
int rc, retry = 0;
12373+
bool fw_reset;
1237412374
u32 flags = 0;
1237512375

12376+
fw_reset = (bp->fw_reset_state == BNXT_FW_RESET_STATE_ABORT);
12377+
bp->fw_reset_state = 0;
12378+
1237612379
if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
1237712380
return 0;
1237812381

@@ -14875,7 +14878,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
1487514878
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1487614879
if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
1487714880
bnxt_dl_health_fw_status_update(bp, false);
14878-
bp->fw_reset_state = 0;
14881+
bp->fw_reset_state = BNXT_FW_RESET_STATE_ABORT;
1487914882
netif_close(bp->dev);
1488014883
}
1488114884

@@ -16975,10 +16978,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
1697516978
if (!err)
1697616979
result = PCI_ERS_RESULT_RECOVERED;
1697716980

16981+
/* IRQ will be initialized later in bnxt_io_resume */
1697816982
bnxt_ulp_irq_stop(bp);
1697916983
bnxt_clear_int_mode(bp);
16980-
err = bnxt_init_int_mode(bp);
16981-
bnxt_ulp_irq_restart(bp, err);
1698216984
}
1698316985

1698416986
reset_exit:
@@ -17007,10 +17009,13 @@ static void bnxt_io_resume(struct pci_dev *pdev)
1700717009

1700817010
err = bnxt_hwrm_func_qcaps(bp);
1700917011
if (!err) {
17010-
if (netif_running(netdev))
17012+
if (netif_running(netdev)) {
1701117013
err = bnxt_open(netdev);
17012-
else
17014+
} else {
1701317015
err = bnxt_reserve_rings(bp, true);
17016+
if (!err)
17017+
err = bnxt_init_int_mode(bp);
17018+
}
1701417019
}
1701517020

1701617021
if (!err)

drivers/net/ethernet/broadcom/bnxt/bnxt.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2615,6 +2615,7 @@ struct bnxt {
26152615
#define BNXT_FW_RESET_STATE_POLL_FW 4
26162616
#define BNXT_FW_RESET_STATE_OPENING 5
26172617
#define BNXT_FW_RESET_STATE_POLL_FW_DOWN 6
2618+
#define BNXT_FW_RESET_STATE_ABORT 7
26182619

26192620
u16 fw_reset_min_dsecs;
26202621
#define BNXT_DFLT_FW_RST_MIN_DSECS 20

0 commit comments

Comments
 (0)