Skip to content

Commit 094513f

Browse files
egrumbachjmberg-intel
authored andcommitted
wifi: iwlwifi: clear trans->state earlier upon error
When the firmware crashes, we first told the op_mode and only then, changed the transport's state. This is a problem if the op_mode's nic_error() handler needs to send a host command: it'll see that the transport's state still reflects that the firmware is alive. Today, this has no consequences since we set the STATUS_FW_ERROR bit and that will prevent sending host commands. iwl_fw_dbg_stop_restart_recording looks at this bit to know not to send a host command for example. To fix the hibernation, we needed to reset the firmware without having an error and checking STATUS_FW_ERROR to see whether the firmware is alive will no longer hold, so this change is necessary as well. Change the flow a bit. Change trans->state before calling the op_mode's nic_error() method and check trans->state instead of STATUS_FW_ERROR. This will keep the current behavior of iwl_fw_dbg_stop_restart_recording upon firmware error, and it'll allow us to call iwl_fw_dbg_stop_restart_recording safely even if STATUS_FW_ERROR is clear, but yet, the firmware is not alive. Signed-off-by: Emmanuel Grumbach <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20240825191257.9d7427fbdfd7.Ia056ca57029a382c921d6f7b6a6b28fc480f2f22@changeid [I missed this was a dependency for the hibernation fix, changed the commit message a bit accordingly] Signed-off-by: Johannes Berg <[email protected]>
1 parent 6d30bb8 commit 094513f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

drivers/net/wireless/intel/iwlwifi/fw/dbg.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3348,7 +3348,7 @@ void iwl_fw_dbg_stop_restart_recording(struct iwl_fw_runtime *fwrt,
33483348
{
33493349
int ret __maybe_unused = 0;
33503350

3351-
if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
3351+
if (!iwl_trans_fw_running(fwrt->trans))
33523352
return;
33533353

33543354
if (fw_has_capa(&fwrt->fw->ucode_capa,

drivers/net/wireless/intel/iwlwifi/iwl-trans.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1128,8 +1128,8 @@ static inline void iwl_trans_fw_error(struct iwl_trans *trans, bool sync)
11281128

11291129
/* prevent double restarts due to the same erroneous FW */
11301130
if (!test_and_set_bit(STATUS_FW_ERROR, &trans->status)) {
1131-
iwl_op_mode_nic_error(trans->op_mode, sync);
11321131
trans->state = IWL_TRANS_NO_FW;
1132+
iwl_op_mode_nic_error(trans->op_mode, sync);
11331133
}
11341134
}
11351135

0 commit comments

Comments
 (0)