Skip to content

Commit

Permalink
wifi: iwlwifi: mvm: clean up FW restart a bit
Browse files Browse the repository at this point in the history
Approximately three years ago, in commit ddb6b76
("iwlwifi: yoyo: support TLV-based firmware reset"), the code
was (likely erroneously) changed to no longer treat error
interrupts as firmware errors. As a result, this meant that
the fw_restart counter was only applied in case of command
queue being stuck, which never seems to happen. Also, there's
no longer any way to set the mvm->fw_restart to a value that
doesn't match exactly the module parameter behaviour.

Instead of trying to fix this, simply remove the logic that
limits the number of restarts, it's clearly unused.

However, restore the logic that restart isn't unconditional,
by checking the module parameter.

Since the "fw_error" argument to iwl_mvm_nic_restart() is now
always true (except in the "never happens" case of CMD queue
stuck), just remove it too and treat command queue stuck the
same way as everything else.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20241227095718.b0489daf323c.I0cd3233b2214c5f06e059f746041b19d08647e40@changeid
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
  • Loading branch information
Johannes Berg committed Jan 13, 2025
1 parent 7ad788a commit 99baaf9
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 29 deletions.
7 changes: 0 additions & 7 deletions drivers/net/wireless/intel/iwlwifi/mvm/d3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1395,13 +1395,6 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
if (ret < 0) {
iwl_mvm_free_nd(mvm);

if (!unified_image) {
if (mvm->fw_restart > 0) {
mvm->fw_restart--;
ieee80211_restart_hw(mvm->hw);
}
}

clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status);
}
out_noreset:
Expand Down
4 changes: 0 additions & 4 deletions drivers/net/wireless/intel/iwlwifi/mvm/debugfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -1167,10 +1167,6 @@ static ssize_t iwl_dbgfs_fw_restart_write(struct iwl_mvm *mvm, char *buf,

mutex_lock(&mvm->mutex);

/* allow one more restart that we're provoking here */
if (mvm->fw_restart >= 0)
mvm->fw_restart++;

if (count == 6 && !strcmp(buf, "nolog\n")) {
set_bit(IWL_MVM_STATUS_SUPPRESS_ERROR_LOG_ONCE, &mvm->status);
set_bit(STATUS_SUPPRESS_CMD_ERROR_ONCE, &mvm->trans->status);
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/mvm/mac80211.c
Original file line number Diff line number Diff line change
Expand Up @@ -5387,7 +5387,7 @@ iwl_mvm_switch_vif_chanctx_swap(struct iwl_mvm *mvm,

out_restart:
/* things keep failing, better restart the hw */
iwl_mvm_nic_restart(mvm, false);
iwl_mvm_nic_restart(mvm);
return ret;
}

Expand Down Expand Up @@ -5423,7 +5423,7 @@ iwl_mvm_switch_vif_chanctx_reassign(struct iwl_mvm *mvm,

out_restart:
/* things keep failing, better restart the hw */
iwl_mvm_nic_restart(mvm, false);
iwl_mvm_nic_restart(mvm);
return ret;
}

Expand Down
4 changes: 1 addition & 3 deletions drivers/net/wireless/intel/iwlwifi/mvm/mvm.h
Original file line number Diff line number Diff line change
Expand Up @@ -1174,8 +1174,6 @@ struct iwl_mvm {

struct ieee80211_bss_conf __rcu *link_id_to_link_conf[IWL_FW_MAX_LINK_ID + 1];

/* -1 for always, 0 for never, >0 for that many times */
s8 fw_restart;
u8 *error_recovery_buf;

#ifdef CONFIG_IWLWIFI_LEDS
Expand Down Expand Up @@ -2588,7 +2586,7 @@ void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif);
u8 iwl_mvm_tcm_load_percentage(u32 airtime, u32 elapsed);

void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error);
void iwl_mvm_nic_restart(struct iwl_mvm *mvm);
unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm,
struct ieee80211_vif *vif);
void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
Expand Down
19 changes: 8 additions & 11 deletions drivers/net/wireless/intel/iwlwifi/mvm/ops.c
Original file line number Diff line number Diff line change
Expand Up @@ -1354,7 +1354,6 @@ iwl_op_mode_mvm_start(struct iwl_trans *trans, const struct iwl_cfg *cfg,
}
}

mvm->fw_restart = iwlwifi_mod_params.fw_restart ? -1 : 0;
mvm->bios_enable_puncturing = iwl_uefi_get_puncturing(&mvm->fwrt);

if (iwl_mvm_has_new_tx_api(mvm)) {
Expand Down Expand Up @@ -2026,7 +2025,7 @@ static void iwl_mvm_reprobe_wk(struct work_struct *wk)
module_put(THIS_MODULE);
}

void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)
void iwl_mvm_nic_restart(struct iwl_mvm *mvm)
{
iwl_abort_notification_waits(&mvm->notif_wait);
iwl_dbg_tlv_del_timers(mvm->trans);
Expand All @@ -2049,9 +2048,7 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)
* If WoWLAN fw asserted, don't restart either, mac80211
* can't recover this since we're already half suspended.
*/
if (!mvm->fw_restart && fw_error) {
iwl_fw_error_collect(&mvm->fwrt, false);
} else if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
struct iwl_mvm_reprobe *reprobe;

IWL_ERR(mvm,
Expand Down Expand Up @@ -2103,10 +2100,10 @@ void iwl_mvm_nic_restart(struct iwl_mvm *mvm, bool fw_error)

iwl_fw_error_collect(&mvm->fwrt, false);

if (fw_error && mvm->fw_restart > 0) {
mvm->fw_restart--;
ieee80211_restart_hw(mvm->hw);
} else if (mvm->fwrt.trans->dbg.restart_required) {
if (!iwlwifi_mod_params.fw_restart)
return;

if (mvm->fwrt.trans->dbg.restart_required) {
IWL_DEBUG_INFO(mvm, "FW restart requested after debug collection\n");
mvm->fwrt.trans->dbg.restart_required = false;
ieee80211_restart_hw(mvm->hw);
Expand Down Expand Up @@ -2140,15 +2137,15 @@ static void iwl_mvm_nic_error(struct iwl_op_mode *op_mode,
if (!test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status))
return;

iwl_mvm_nic_restart(mvm, false);
iwl_mvm_nic_restart(mvm);
}

static void iwl_mvm_cmd_queue_full(struct iwl_op_mode *op_mode)
{
struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode);

WARN_ON(1);
iwl_mvm_nic_restart(mvm, true);
iwl_mvm_nic_restart(mvm);
}

static void iwl_op_mode_mvm_time_point(struct iwl_op_mode *op_mode,
Expand Down
4 changes: 2 additions & 2 deletions drivers/net/wireless/intel/iwlwifi/mvm/scan.c
Original file line number Diff line number Diff line change
Expand Up @@ -3477,7 +3477,7 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
* restart_hw, so do not report if FW is about to be
* restarted.
*/
if (!mvm->fw_restart)
if (!iwlwifi_mod_params.fw_restart)
ieee80211_sched_scan_stopped(mvm->hw);
mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
mvm->scan_uid_status[uid] = 0;
Expand Down Expand Up @@ -3528,7 +3528,7 @@ void iwl_mvm_report_scan_aborted(struct iwl_mvm *mvm)
* restarted.
*/
if ((mvm->scan_status & IWL_MVM_SCAN_SCHED) &&
!mvm->fw_restart) {
!iwlwifi_mod_params.fw_restart) {
ieee80211_sched_scan_stopped(mvm->hw);
mvm->sched_scan_pass_all = SCHED_SCAN_PASS_ALL_DISABLED;
}
Expand Down

0 comments on commit 99baaf9

Please sign in to comment.