Skip to content

Commit 0a75709

Browse files
committed
Merge branch 'bnxt_en-error-recovery-follow-up-patches'
Michael Chan says: ==================== bnxt_en: error recovery follow-up patches. A follow-up patchset for the recently added health and error recovery feature. The first fix is to prevent .ndo_set_rx_mode() from proceeding when reset is in progress. The 2nd fix is for the firmware coredump command. The 3rd and 4th patches update the error recovery process slightly to add a state that polls and waits for the firmware to be down. ==================== Signed-off-by: David S. Miller <[email protected]>
2 parents 8f7baad + 4037eb7 commit 0a75709

File tree

4 files changed

+156
-52
lines changed

4 files changed

+156
-52
lines changed

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

Lines changed: 48 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6947,6 +6947,8 @@ static int __bnxt_hwrm_func_qcaps(struct bnxt *bp)
69476947
bp->fw_cap |= BNXT_FW_CAP_EXT_STATS_SUPPORTED;
69486948
if (flags & FUNC_QCAPS_RESP_FLAGS_ERROR_RECOVERY_CAPABLE)
69496949
bp->fw_cap |= BNXT_FW_CAP_ERROR_RECOVERY;
6950+
if (flags & FUNC_QCAPS_RESP_FLAGS_ERR_RECOVER_RELOAD)
6951+
bp->fw_cap |= BNXT_FW_CAP_ERR_RECOVER_RELOAD;
69506952

69516953
bp->tx_push_thresh = 0;
69526954
if (flags & FUNC_QCAPS_RESP_FLAGS_PUSH_MODE_SUPPORTED)
@@ -9557,14 +9559,16 @@ static bool bnxt_uc_list_updated(struct bnxt *bp)
95579559
static void bnxt_set_rx_mode(struct net_device *dev)
95589560
{
95599561
struct bnxt *bp = netdev_priv(dev);
9560-
struct bnxt_vnic_info *vnic = &bp->vnic_info[0];
9561-
u32 mask = vnic->rx_mask;
9562+
struct bnxt_vnic_info *vnic;
95629563
bool mc_update = false;
95639564
bool uc_update;
9565+
u32 mask;
95649566

9565-
if (!netif_running(dev))
9567+
if (!test_bit(BNXT_STATE_OPEN, &bp->state))
95669568
return;
95679569

9570+
vnic = &bp->vnic_info[0];
9571+
mask = vnic->rx_mask;
95689572
mask &= ~(CFA_L2_SET_RX_MASK_REQ_MASK_PROMISCUOUS |
95699573
CFA_L2_SET_RX_MASK_REQ_MASK_MCAST |
95709574
CFA_L2_SET_RX_MASK_REQ_MASK_ALL_MCAST |
@@ -10095,6 +10099,8 @@ static void bnxt_force_fw_reset(struct bnxt *bp)
1009510099
wait_dsecs = fw_health->normal_func_wait_dsecs;
1009610100
bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
1009710101
}
10102+
10103+
bp->fw_reset_min_dsecs = fw_health->post_reset_wait_dsecs;
1009810104
bp->fw_reset_max_dsecs = fw_health->post_reset_max_wait_dsecs;
1009910105
bnxt_queue_fw_reset_work(bp, wait_dsecs * HZ / 10);
1010010106
}
@@ -10136,7 +10142,7 @@ void bnxt_fw_reset(struct bnxt *bp)
1013610142
bnxt_rtnl_lock_sp(bp);
1013710143
if (test_bit(BNXT_STATE_OPEN, &bp->state) &&
1013810144
!test_bit(BNXT_STATE_IN_FW_RESET, &bp->state)) {
10139-
int n = 0;
10145+
int n = 0, tmo;
1014010146

1014110147
set_bit(BNXT_STATE_IN_FW_RESET, &bp->state);
1014210148
if (bp->pf.active_vfs &&
@@ -10159,8 +10165,14 @@ void bnxt_fw_reset(struct bnxt *bp)
1015910165
goto fw_reset_exit;
1016010166
}
1016110167
bnxt_fw_reset_close(bp);
10162-
bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10163-
bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10);
10168+
if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) {
10169+
bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN;
10170+
tmo = HZ / 10;
10171+
} else {
10172+
bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10173+
tmo = bp->fw_reset_min_dsecs * HZ / 10;
10174+
}
10175+
bnxt_queue_fw_reset_work(bp, tmo);
1016410176
}
1016510177
fw_reset_exit:
1016610178
bnxt_rtnl_unlock_sp(bp);
@@ -10603,6 +10615,7 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1060310615
switch (bp->fw_reset_state) {
1060410616
case BNXT_FW_RESET_STATE_POLL_VF: {
1060510617
int n = bnxt_get_registered_vfs(bp);
10618+
int tmo;
1060610619

1060710620
if (n < 0) {
1060810621
netdev_err(bp->dev, "Firmware reset aborted, subsequent func_qcfg cmd failed, rc = %d, %d msecs since reset timestamp\n",
@@ -10624,11 +10637,38 @@ static void bnxt_fw_reset_task(struct work_struct *work)
1062410637
bp->fw_reset_timestamp = jiffies;
1062510638
rtnl_lock();
1062610639
bnxt_fw_reset_close(bp);
10627-
bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10640+
if (bp->fw_cap & BNXT_FW_CAP_ERR_RECOVER_RELOAD) {
10641+
bp->fw_reset_state = BNXT_FW_RESET_STATE_POLL_FW_DOWN;
10642+
tmo = HZ / 10;
10643+
} else {
10644+
bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10645+
tmo = bp->fw_reset_min_dsecs * HZ / 10;
10646+
}
1062810647
rtnl_unlock();
10629-
bnxt_queue_fw_reset_work(bp, bp->fw_reset_min_dsecs * HZ / 10);
10648+
bnxt_queue_fw_reset_work(bp, tmo);
1063010649
return;
1063110650
}
10651+
case BNXT_FW_RESET_STATE_POLL_FW_DOWN: {
10652+
u32 val;
10653+
10654+
val = bnxt_fw_health_readl(bp, BNXT_FW_HEALTH_REG);
10655+
if (!(val & BNXT_FW_STATUS_SHUTDOWN) &&
10656+
!time_after(jiffies, bp->fw_reset_timestamp +
10657+
(bp->fw_reset_max_dsecs * HZ / 10))) {
10658+
bnxt_queue_fw_reset_work(bp, HZ / 5);
10659+
return;
10660+
}
10661+
10662+
if (!bp->fw_health->master) {
10663+
u32 wait_dsecs = bp->fw_health->normal_func_wait_dsecs;
10664+
10665+
bp->fw_reset_state = BNXT_FW_RESET_STATE_ENABLE_DEV;
10666+
bnxt_queue_fw_reset_work(bp, wait_dsecs * HZ / 10);
10667+
return;
10668+
}
10669+
bp->fw_reset_state = BNXT_FW_RESET_STATE_RESET_FW;
10670+
}
10671+
/* fall through */
1063210672
case BNXT_FW_RESET_STATE_RESET_FW: {
1063310673
u32 wait_dsecs = bp->fw_health->post_reset_wait_dsecs;
1063410674

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -648,6 +648,7 @@ struct nqe_cn {
648648
#define SHORT_HWRM_CMD_TIMEOUT 20
649649
#define HWRM_CMD_TIMEOUT (bp->hwrm_cmd_timeout)
650650
#define HWRM_RESET_TIMEOUT ((HWRM_CMD_TIMEOUT) * 4)
651+
#define HWRM_COREDUMP_TIMEOUT ((HWRM_CMD_TIMEOUT) * 12)
651652
#define HWRM_RESP_ERR_CODE_MASK 0xffff
652653
#define HWRM_RESP_LEN_OFFSET 4
653654
#define HWRM_RESP_LEN_MASK 0xffff0000
@@ -1397,6 +1398,7 @@ struct bnxt_fw_reporter_ctx {
13971398
#define BNXT_FW_HEALTH_WIN_MAP_OFF 8
13981399

13991400
#define BNXT_FW_STATUS_HEALTHY 0x8000
1401+
#define BNXT_FW_STATUS_SHUTDOWN 0x100000
14001402

14011403
struct bnxt {
14021404
void __iomem *bar0;
@@ -1654,6 +1656,7 @@ struct bnxt {
16541656
#define BNXT_FW_CAP_CFA_RFS_RING_TBL_IDX 0x00010000
16551657
#define BNXT_FW_CAP_PCIE_STATS_SUPPORTED 0x00020000
16561658
#define BNXT_FW_CAP_EXT_STATS_SUPPORTED 0x00040000
1659+
#define BNXT_FW_CAP_ERR_RECOVER_RELOAD 0x00100000
16571660

16581661
#define BNXT_NEW_RM(bp) ((bp)->fw_cap & BNXT_FW_CAP_NEW_RM)
16591662
u32 hwrm_spec_code;
@@ -1743,6 +1746,7 @@ struct bnxt {
17431746
#define BNXT_FW_RESET_STATE_ENABLE_DEV 3
17441747
#define BNXT_FW_RESET_STATE_POLL_FW 4
17451748
#define BNXT_FW_RESET_STATE_OPENING 5
1749+
#define BNXT_FW_RESET_STATE_POLL_FW_DOWN 6
17461750

17471751
u16 fw_reset_min_dsecs;
17481752
#define BNXT_DFLT_FW_RST_MIN_DSECS 20

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3112,7 +3112,7 @@ static int bnxt_hwrm_dbg_coredump_initiate(struct bnxt *bp, u16 component_id,
31123112
req.component_id = cpu_to_le16(component_id);
31133113
req.segment_id = cpu_to_le16(segment_id);
31143114

3115-
return hwrm_send_message(bp, &req, sizeof(req), HWRM_CMD_TIMEOUT);
3115+
return hwrm_send_message(bp, &req, sizeof(req), HWRM_COREDUMP_TIMEOUT);
31163116
}
31173117

31183118
static int bnxt_hwrm_dbg_coredump_retrieve(struct bnxt *bp, u16 component_id,

0 commit comments

Comments
 (0)