Skip to content

Commit c2d20a3

Browse files
kadesai16davem330
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: David S. Miller <[email protected]>
1 parent 1ae04e4 commit c2d20a3

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

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

+11-6
Original file line numberDiff line numberDiff line change
@@ -12325,12 +12325,15 @@ static int bnxt_hwrm_if_change(struct bnxt *bp, bool up)
1232512325
{
1232612326
struct hwrm_func_drv_if_change_output *resp;
1232712327
struct hwrm_func_drv_if_change_input *req;
12328-
bool fw_reset = !bp->irq_tbl;
1232912328
bool resc_reinit = false;
1233012329
bool caps_change = false;
1233112330
int rc, retry = 0;
12331+
bool fw_reset;
1233212332
u32 flags = 0;
1233312333

12334+
fw_reset = (bp->fw_reset_state == BNXT_FW_RESET_STATE_ABORT);
12335+
bp->fw_reset_state = 0;
12336+
1233412337
if (!(bp->fw_cap & BNXT_FW_CAP_IF_CHANGE))
1233512338
return 0;
1233612339

@@ -14833,7 +14836,7 @@ static void bnxt_fw_reset_abort(struct bnxt *bp, int rc)
1483314836
clear_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1483414837
if (bp->fw_reset_state != BNXT_FW_RESET_STATE_POLL_VF)
1483514838
bnxt_dl_health_fw_status_update(bp, false);
14836-
bp->fw_reset_state = 0;
14839+
bp->fw_reset_state = BNXT_FW_RESET_STATE_ABORT;
1483714840
netif_close(bp->dev);
1483814841
}
1483914842

@@ -16931,10 +16934,9 @@ static pci_ers_result_t bnxt_io_slot_reset(struct pci_dev *pdev)
1693116934
if (!err)
1693216935
result = PCI_ERS_RESULT_RECOVERED;
1693316936

16937+
/* IRQ will be initialized later in bnxt_io_resume */
1693416938
bnxt_ulp_irq_stop(bp);
1693516939
bnxt_clear_int_mode(bp);
16936-
err = bnxt_init_int_mode(bp);
16937-
bnxt_ulp_irq_restart(bp, err);
1693816940
}
1693916941

1694016942
reset_exit:
@@ -16963,10 +16965,13 @@ static void bnxt_io_resume(struct pci_dev *pdev)
1696316965

1696416966
err = bnxt_hwrm_func_qcaps(bp);
1696516967
if (!err) {
16966-
if (netif_running(netdev))
16968+
if (netif_running(netdev)) {
1696716969
err = bnxt_open(netdev);
16968-
else
16970+
} else {
1696916971
err = bnxt_reserve_rings(bp, true);
16972+
if (!err)
16973+
err = bnxt_init_int_mode(bp);
16974+
}
1697016975
}
1697116976

1697216977
if (!err)

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

+1
Original file line numberDiff line numberDiff line change
@@ -2614,6 +2614,7 @@ struct bnxt {
26142614
#define BNXT_FW_RESET_STATE_POLL_FW 4
26152615
#define BNXT_FW_RESET_STATE_OPENING 5
26162616
#define BNXT_FW_RESET_STATE_POLL_FW_DOWN 6
2617+
#define BNXT_FW_RESET_STATE_ABORT 7
26172618

26182619
u16 fw_reset_min_dsecs;
26192620
#define BNXT_DFLT_FW_RST_MIN_DSECS 20

0 commit comments

Comments
 (0)