Skip to content

Commit b4fff20

Browse files
Michael Chandavem330
authored andcommitted
bnxt_en: Do not send firmware messages if firmware is in error state.
Add a flag to mark that the firmware has encountered fatal condition. The driver will not send any more firmware messages and will return error to the caller. Fix up some clean up functions to continue and not abort when the firmware message function returns error. This is preparation work to fully handle firmware error recovery under fatal conditions. Signed-off-by: Michael Chan <[email protected]> Signed-off-by: David S. Miller <[email protected]>
1 parent 2cd8696 commit b4fff20

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

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

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4173,6 +4173,9 @@ static int bnxt_hwrm_do_send_msg(struct bnxt *bp, void *msg, u32 msg_len,
41734173
u32 bar_offset = BNXT_GRCPF_REG_CHIMP_COMM;
41744174
u16 dst = BNXT_HWRM_CHNL_CHIMP;
41754175

4176+
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
4177+
return -EBUSY;
4178+
41764179
if (msg_len > BNXT_HWRM_MAX_REQ_LEN) {
41774180
if (msg_len > bp->hwrm_max_ext_req_len ||
41784181
!bp->hwrm_short_cmd_req_addr)
@@ -5042,8 +5045,6 @@ static int bnxt_hwrm_vnic_free_one(struct bnxt *bp, u16 vnic_id)
50425045
cpu_to_le32(bp->vnic_info[vnic_id].fw_vnic_id);
50435046

50445047
rc = hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
5045-
if (rc)
5046-
return rc;
50475048
bp->vnic_info[vnic_id].fw_vnic_id = INVALID_HW_RING_ID;
50485049
}
50495050
return rc;
@@ -5183,8 +5184,6 @@ static int bnxt_hwrm_ring_grp_free(struct bnxt *bp)
51835184

51845185
rc = _hwrm_send_message(bp, &req, sizeof(req),
51855186
HWRM_CMD_TIMEOUT);
5186-
if (rc)
5187-
break;
51885187
bp->grp_info[i].fw_grp_id = INVALID_HW_RING_ID;
51895188
}
51905189
mutex_unlock(&bp->hwrm_cmd_lock);
@@ -5503,6 +5502,9 @@ static int hwrm_ring_free_send_msg(struct bnxt *bp,
55035502
struct hwrm_ring_free_output *resp = bp->hwrm_cmd_resp_addr;
55045503
u16 error_code;
55055504

5505+
if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
5506+
return 0;
5507+
55065508
bnxt_hwrm_cmd_hdr_init(bp, &req, HWRM_RING_FREE, cmpl_ring_id, -1);
55075509
req.ring_type = ring_type;
55085510
req.ring_id = cpu_to_le16(ring->fw_ring_id);
@@ -6300,8 +6302,6 @@ static int bnxt_hwrm_stat_ctx_free(struct bnxt *bp)
63006302

63016303
rc = _hwrm_send_message(bp, &req, sizeof(req),
63026304
HWRM_CMD_TIMEOUT);
6303-
if (rc)
6304-
break;
63056305

63066306
cpr->hw_stats_ctx_id = INVALID_STATS_CTX_ID;
63076307
}
@@ -7415,6 +7415,8 @@ static int bnxt_set_tpa(struct bnxt *bp, bool set_tpa)
74157415

74167416
if (set_tpa)
74177417
tpa_flags = bp->flags & BNXT_FLAG_TPA;
7418+
else if (test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state))
7419+
return 0;
74187420
for (i = 0; i < bp->nr_vnics; i++) {
74197421
rc = bnxt_hwrm_vnic_set_tpa(bp, i, tpa_flags);
74207422
if (rc) {
@@ -10009,7 +10011,8 @@ void bnxt_fw_reset(struct bnxt *bp)
1000910011
if (test_bit(BNXT_STATE_OPEN, &bp->state) &&
1001010012
!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
1001110013
set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
10012-
if (BNXT_PF(bp) && bp->pf.active_vfs) {
10014+
if (BNXT_PF(bp) && bp->pf.active_vfs &&
10015+
!test_bit(BNXT_STATE_FW_FATAL_COND, &bp->state)) {
1001310016
rc = bnxt_hwrm_func_qcfg(bp);
1001410017
if (rc) {
1001510018
netdev_err(bp->dev, "Firmware reset aborted, first func_qcfg cmd failed, rc = %d\n",
@@ -10439,6 +10442,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1043910442
bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10);
1044010443
return;
1044110444
case BNXT_FW_RESET_STATE_ENABLE_DEV:
10445+
clear_bit(BNXT_STATE_FW_FATAL_COND, &bp->state);
1044210446
if (pci_enable_device(bp->pdev)) {
1044310447
netdev_err(bp->dev, "Cannot re-enable PCI device\n");
1044410448
goto fw_reset_abort;

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1617,6 +1617,7 @@ struct bnxt {
16171617
#define BNXT_STATE_FW_RESET_DET 3
16181618
#define BNXT_STATE_IN_FW_RESET 4
16191619
#define BNXT_STATE_ABORT_ERR 5
1620+
#define BNXT_STATE_FW_FATAL_COND 6
16201621

16211622
struct bnxt_irq *irq_tbl;
16221623
int total_irqs;

0 commit comments

Comments
 (0)