Commit 728d92a3 authored by Rotem Kerem's avatar Rotem Kerem Committed by Miri Korenblit
Browse files

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: default avatarRotem Kerem <rotem.kerem@intel.com>
Signed-off-by: default avatarMiri Korenblit <miriam.rachel.korenblit@intel.com>
Link: https://patch.msgid.link/20250909061931.23f5160b3265.Iba325ffa4c6c6f7fc3a702fb6c1827b0857d0db3@changeid
parent ff46e2e7
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -830,7 +830,7 @@ iwl_fw_error_dump_file(struct iwl_fw_runtime *fwrt,
	}

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

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

	if (test_bit(STATUS_FW_ERROR, &fwrt->trans->status))
	if (iwl_trans_is_fw_error(fwrt->trans))
		return;

	if (fw_has_capa(&fwrt->fw->ucode_capa,
+14 −0
Original line number Diff line number Diff line
@@ -1209,6 +1209,20 @@ static inline bool iwl_trans_is_dead(struct iwl_trans *trans)
	return test_bit(STATUS_TRANS_DEAD, &trans->status);
}

static inline bool iwl_trans_is_fw_error(struct iwl_trans *trans)
{
	return test_bit(STATUS_FW_ERROR, &trans->status);
}

/*
 * This function notifies the transport layer of firmware error, the recovery
 * will be handled by the op mode
 */
static inline void iwl_trans_notify_fw_error(struct iwl_trans *trans)
{
	trans->state = IWL_TRANS_NO_FW;
	set_bit(STATUS_FW_ERROR, &trans->status);
}
/*****************************************************
 * PCIe handling
 *****************************************************/
+2 −4
Original line number Diff line number Diff line
@@ -1213,8 +1213,7 @@ static int iwl_mld_wait_d3_notif(struct iwl_mld *mld,
	ret = iwl_trans_d3_resume(mld->trans, false);
	if (ret) {
		/* Avoid sending commands if the FW is dead */
		mld->trans->state = IWL_TRANS_NO_FW;
		set_bit(STATUS_FW_ERROR, &mld->trans->status);
		iwl_trans_notify_fw_error(mld->trans);
		iwl_remove_notification(&mld->notif_wait, &wait_d3_notif);
		return ret;
	}
@@ -1267,8 +1266,7 @@ int iwl_mld_no_wowlan_suspend(struct iwl_mld *mld)
	if (ret) {
		IWL_ERR(mld, "d3 suspend: trans_d3_suspend failed %d\n", ret);
		/* We are going to stop the FW. Avoid sending commands in that flow */
		mld->trans->state = IWL_TRANS_NO_FW;
		set_bit(STATUS_FW_ERROR, &mld->trans->status);
		iwl_trans_notify_fw_error(mld->trans);
	} else {
		/* Async notification might send hcmds, which is not allowed in suspend */
		iwl_mld_cancel_async_notifications(mld);
+2 −3
Original line number Diff line number Diff line
@@ -3102,7 +3102,7 @@ static int __iwl_mvm_resume(struct iwl_mvm *mvm)

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

	rt_status = iwl_mvm_check_rt_status(mvm, NULL);
	if (rt_status != FW_ALIVE) {
		set_bit(STATUS_FW_ERROR, &mvm->trans->status);
		iwl_trans_notify_fw_error(mvm->trans);
		if (rt_status == FW_ERROR) {
			IWL_ERR(mvm,
				"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)
						&iwl_dump_desc_assert,
						false, 0);
		}
		mvm->trans->state = IWL_TRANS_NO_FW;
		ret = -ENODEV;

		goto out;
+1 −1
Original line number Diff line number Diff line
@@ -3539,7 +3539,7 @@ iwl_trans_pcie_dump_data(struct iwl_trans *trans, u32 dump_mask,
	struct iwl_trans_dump_data *dump_data;
	u32 len, num_rbs = 0, monitor_len = 0;
	int i, ptr;
	bool dump_rbs = test_bit(STATUS_FW_ERROR, &trans->status) &&
	bool dump_rbs = iwl_trans_is_fw_error(trans) &&
			!trans->mac_cfg->mq_rx_supported &&
			dump_mask & BIT(IWL_FW_ERROR_DUMP_RB);