Skip to content

Commit 728d92a

Browse files
rotemkeremMiriam-Rachel
authored andcommitted
wifi: iwlwifi: add STATUS_FW_ERROR API
Add iwl_trans_notify_fw_error() and iwl_trans_is_fw_error() for use by op modes. These helpers provide a clean interface for marking and checking firmware error state. This hides the trans internal implementation details from callers. Signed-off-by: Rotem Kerem <[email protected]> Signed-off-by: Miri Korenblit <[email protected]> Link: https://patch.msgid.link/20250909061931.23f5160b3265.Iba325ffa4c6c6f7fc3a702fb6c1827b0857d0db3@changeid
1 parent ff46e2e commit 728d92a

File tree

5 files changed

+21
-10
lines changed

5 files changed

+21
-10
lines changed

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ iwl_fw_error_dump_file(struct iwl_fw_runtime *fwrt,
830830
}
831831

832832
/* reading RXF/TXF sizes */
833-
if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status)) {
833+
if (iwl_trans_is_fw_error(fwrt->trans)) {
834834
fifo_len = iwl_fw_rxf_len(fwrt, mem_cfg);
835835
fifo_len += iwl_fw_txf_len(fwrt, mem_cfg);
836836

@@ -3116,7 +3116,7 @@ static void iwl_send_dbg_dump_complete_cmd(struct iwl_fw_runtime *fwrt,
31163116
.len[0] = sizeof(hcmd_data),
31173117
};
31183118

3119-
if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
3119+
if (iwl_trans_is_fw_error(fwrt->trans))
31203120
return;
31213121

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

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

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1209,6 +1209,20 @@ static inline bool iwl_trans_is_dead(struct iwl_trans *trans)
12091209
return test_bit(STATUS_TRANS_DEAD, &trans->status);
12101210
}
12111211

1212+
static inline bool iwl_trans_is_fw_error(struct iwl_trans *trans)
1213+
{
1214+
return test_bit(STATUS_FW_ERROR, &trans->status);
1215+
}
1216+
1217+
/*
1218+
* This function notifies the transport layer of firmware error, the recovery
1219+
* will be handled by the op mode
1220+
*/
1221+
static inline void iwl_trans_notify_fw_error(struct iwl_trans *trans)
1222+
{
1223+
trans->state = IWL_TRANS_NO_FW;
1224+
set_bit(STATUS_FW_ERROR, &trans->status);
1225+
}
12121226
/*****************************************************
12131227
* PCIe handling
12141228
*****************************************************/

drivers/net/wireless/intel/iwlwifi/mld/d3.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1213,8 +1213,7 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld,
12131213
ret = iwl_trans_d3_resume(mld->trans, false);
12141214
if (ret) {
12151215
/* Avoid sending commands if the FW is dead */
1216-
mld->trans->state = IWL_TRANS_NO_FW;
1217-
set_bit(STATUS_FW_ERROR, &mld->trans->status);
1216+
iwl_trans_notify_fw_error(mld->trans);
12181217
iwl_remove_notification(&mld->notif_wait, &wait_d3_notif);
12191218
return ret;
12201219
}
@@ -1267,8 +1266,7 @@ int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld)
12671266
if (ret) {
12681267
IWL_ERR(mld, "d3 suspend: trans_d3_suspend failed %d\n", ret);
12691268
/* We are going to stop the FW. Avoid sending commands in that flow */
1270-
mld->trans->state = IWL_TRANS_NO_FW;
1271-
set_bit(STATUS_FW_ERROR, &mld->trans->status);
1269+
iwl_trans_notify_fw_error(mld->trans);
12721270
} else {
12731271
/* Async notification might send hcmds, which is not allowed in suspend */
12741272
iwl_mld_cancel_async_notifications(mld);

drivers/net/wireless/intel/iwlwifi/mvm/d3.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3102,7 +3102,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm)
31023102

31033103
rt_status = iwl_mvm_check_rt_status(mvm, vif);
31043104
if (rt_status != FW_ALIVE) {
3105-
set_bit(STATUS_FW_ERROR, &mvm->trans->status);
3105+
iwl_trans_notify_fw_error(mvm->trans);
31063106
if (rt_status == FW_ERROR) {
31073107
IWL_ERR(mvm, "FW Error occurred during suspend. Restarting.\n");
31083108
iwl_mvm_dump_nic_error_log(mvm);
@@ -3272,7 +3272,7 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm)
32723272

32733273
rt_status = iwl_mvm_check_rt_status(mvm, NULL);
32743274
if (rt_status != FW_ALIVE) {
3275-
set_bit(STATUS_FW_ERROR, &mvm->trans->status);
3275+
iwl_trans_notify_fw_error(mvm->trans);
32763276
if (rt_status == FW_ERROR) {
32773277
IWL_ERR(mvm,
32783278
"iwl_mvm_check_rt_status failed, device is gone during suspend\n");
@@ -3284,7 +3284,6 @@ int iwl_mvm_fast_resume(struct iwl_mvm *mvm)
32843284
&iwl_dump_desc_assert,
32853285
false, 0);
32863286
}
3287-
mvm->trans->state = IWL_TRANS_NO_FW;
32883287
ret = -ENODEV;
32893288

32903289
goto out;

drivers/net/wireless/intel/iwlwifi/pcie/gen1_2/trans.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3539,7 +3539,7 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask,
35393539
struct iwl_trans_dump_data *dump_data;
35403540
u32 len, num_rbs = 0, monitor_len = 0;
35413541
int i, ptr;
3542-
bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) &&
3542+
bool dump_rbs = iwl_trans_is_fw_error(trans) &&
35433543
!trans->mac_cfg->mq_rx_supported &&
35443544
dump_mask & BIT(IWL_FW_ERROR_DUMP_RB);
35453545

0 commit comments

Comments
 (0)