Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 05739794 authored by Johannes Berg's avatar Johannes Berg
Browse files

iwlwifi: mvm: disconnect if time event scheduling fails



If scheduling an important time event fails, or if we get
an unexpected notification from the firmware, there isn't
much we can do to recover, so just drop the connection and
let higher layers retry it.

Reviewed-by: default avatarIlan Peer <ilan.peer@intel.com>
Signed-off-by: default avatarJohannes Berg <johannes.berg@intel.com>
parent 4f0c848a
Loading
Loading
Loading
Loading
+23 −10
Original line number Diff line number Diff line
@@ -138,6 +138,20 @@ static void iwl_mvm_roc_finished(struct iwl_mvm *mvm)
	schedule_work(&mvm->roc_done_wk);
}

static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm,
					struct ieee80211_vif *vif,
					const char *errmsg)
{
	if (vif->type != NL80211_IFTYPE_STATION)
		return false;
	if (vif->bss_conf.assoc && vif->bss_conf.dtim_period)
		return false;
	if (errmsg)
		IWL_ERR(mvm, "%s\n", errmsg);
	ieee80211_connection_loss(vif);
	return true;
}

/*
 * Handles a FW notification for an event that is known to the driver.
 *
@@ -163,8 +177,13 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
	 * P2P Device discoveribility, while there are other higher priority
	 * events in the system).
	 */
	WARN_ONCE(!le32_to_cpu(notif->status),
		  "Failed to schedule time event\n");
	if (WARN_ONCE(!le32_to_cpu(notif->status),
		      "Failed to schedule time event\n")) {
		if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, NULL)) {
			iwl_mvm_te_clear_data(mvm, te_data);
			return;
		}
	}

	if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_END) {
		IWL_DEBUG_TE(mvm,
@@ -180,14 +199,8 @@ static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
		 * By now, we should have finished association
		 * and know the dtim period.
		 */
		if (te_data->vif->type == NL80211_IFTYPE_STATION &&
		    (!te_data->vif->bss_conf.assoc ||
		     !te_data->vif->bss_conf.dtim_period)) {
			IWL_ERR(mvm,
				"No assocation and the time event is over already...\n");
			ieee80211_connection_loss(te_data->vif);
		}

		iwl_mvm_te_check_disconnect(mvm, te_data->vif,
			"No assocation and the time event is over already...");
		iwl_mvm_te_clear_data(mvm, te_data);
	} else if (le32_to_cpu(notif->action) & TE_NOTIF_HOST_EVENT_START) {
		te_data->running = true;