]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
wifi: iwlwifi: avoid scheduling restart during restart
authorJohannes Berg <johannes.berg@intel.com>
Wed, 30 Apr 2025 12:23:12 +0000 (15:23 +0300)
committerMiri Korenblit <miriam.rachel.korenblit@intel.com>
Tue, 6 May 2025 17:22:54 +0000 (20:22 +0300)
When a restart is in progress, it can be async due to the next
worker being scheduled in mac80211 (restart work) or the driver
itself (reprobe). Avoid scheduling another restart during this
period.

Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: Miri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250430151952.db428503ec3c.I3f2be3d72a9d40cfb4e697cdab1cd2866a9262bc@changeid
drivers/net/wireless/intel/iwlwifi/iwl-trans.c
drivers/net/wireless/intel/iwlwifi/iwl-trans.h

index c1607b6d0759e0ee4be689f43181c22b0eb769af..75d70021ee0333050ac734d1baf51e29e12e6f67 100644 (file)
@@ -393,6 +393,8 @@ int iwl_trans_start_hw(struct iwl_trans *trans)
 {
        might_sleep();
 
+       clear_bit(STATUS_TRANS_RESET_IN_PROGRESS, &trans->status);
+
        return iwl_trans_pcie_start_hw(trans);
 }
 IWL_EXPORT_SYMBOL(iwl_trans_start_hw);
index b9dc1b8794ce857dc8db0f5653a3fcb1d701a66c..8fae7f59a73ed8add64cf860f122ab6aaaa168ee 100644 (file)
@@ -304,6 +304,8 @@ enum iwl_d3_status {
  *     via iwl_trans_finish_sw_reset()
  * @STATUS_RESET_PENDING: reset worker was scheduled, but didn't dump
  *     the firmware state yet
+ * @STATUS_TRANS_RESET_IN_PROGRESS: reset is still in progress, don't
+ *     attempt another reset yet
  */
 enum iwl_trans_status {
        STATUS_SYNC_HCMD_ACTIVE,
@@ -317,6 +319,7 @@ enum iwl_trans_status {
        STATUS_SUPPRESS_CMD_ERROR_ONCE,
        STATUS_IN_SW_RESET,
        STATUS_RESET_PENDING,
+       STATUS_TRANS_RESET_IN_PROGRESS,
 };
 
 static inline int
@@ -1152,6 +1155,9 @@ static inline void iwl_trans_schedule_reset(struct iwl_trans *trans,
 {
        if (test_bit(STATUS_TRANS_DEAD, &trans->status))
                return;
+       /* clear this on device init, not cleared on any unbind/reprobe */
+       if (test_and_set_bit(STATUS_TRANS_RESET_IN_PROGRESS, &trans->status))
+               return;
 
        trans->restart.mode.type = type;
        trans->restart.mode.context = IWL_ERR_CONTEXT_WORKER;