Commit e5d153ec authored by Emmanuel Grumbach's avatar Emmanuel Grumbach Committed by Luca Coelho
Browse files

iwlwifi: mvm: fix CSA AP side



Once the all the stations completed the switch, we need
to clear csa_tx_blocked_vif. This was missing. We also
need to re-enable the broadcast / multicast stations.

Signed-off-by: default avatarEmmanuel Grumbach <emmanuel.grumbach@intel.com>
Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
Link: https://lore.kernel.org/r/iwlwifi.20210205110447.f5b813753bdb.Id58979b678974c3ccf44d8b381c68165ac55a3d3@changeid


Signed-off-by: default avatarLuca Coelho <luciano.coelho@intel.com>
parent d8367b12
Loading
Loading
Loading
Loading
+31 −0
Original line number Diff line number Diff line
@@ -1634,6 +1634,23 @@ static inline u8 iwl_mvm_nl80211_band_from_rx_msdu(u8 phy_band)
	}
}

struct iwl_rx_sta_csa {
	bool all_sta_unblocked;
	struct ieee80211_vif *vif;
};

static void iwl_mvm_rx_get_sta_block_tx(void *data, struct ieee80211_sta *sta)
{
	struct iwl_mvm_sta *mvmsta = iwl_mvm_sta_from_mac80211(sta);
	struct iwl_rx_sta_csa *rx_sta_csa = data;

	if (mvmsta->vif != rx_sta_csa->vif)
		return;

	if (mvmsta->disable_tx)
		rx_sta_csa->all_sta_unblocked = false;
}

void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
			struct iwl_rx_cmd_buffer *rxb, int queue)
{
@@ -1863,10 +1880,24 @@ void iwl_mvm_rx_mpdu_mq(struct iwl_mvm *mvm, struct napi_struct *napi,
		if (unlikely(tx_blocked_vif) && tx_blocked_vif == vif) {
			struct iwl_mvm_vif *mvmvif =
				iwl_mvm_vif_from_mac80211(tx_blocked_vif);
			struct iwl_rx_sta_csa rx_sta_csa = {
				.all_sta_unblocked = true,
				.vif = tx_blocked_vif,
			};

			if (mvmvif->csa_target_freq == rx_status->freq)
				iwl_mvm_sta_modify_disable_tx_ap(mvm, sta,
								 false);
			ieee80211_iterate_stations_atomic(mvm->hw,
							  iwl_mvm_rx_get_sta_block_tx,
							  &rx_sta_csa);

			if (rx_sta_csa.all_sta_unblocked) {
				RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL);
				/* Unblock BCAST / MCAST station */
				iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false);
				cancel_delayed_work_sync(&mvm->cs_tx_unblock_dwork);
			}
		}

		rs_update_last_rssi(mvm, mvmsta, rx_status);
+6 −5
Original line number Diff line number Diff line
// SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
/*
 * Copyright (C) 2012-2015, 2018-2020 Intel Corporation
 * Copyright (C) 2012-2015, 2018-2021 Intel Corporation
 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
 * Copyright (C) 2016-2017 Intel Deutschland GmbH
 */
@@ -3811,7 +3811,7 @@ static void iwl_mvm_int_sta_modify_disable_tx(struct iwl_mvm *mvm,
	};
	int ret;

	ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, 0,
	ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC,
				   iwl_mvm_add_sta_cmd_size(mvm), &cmd);
	if (ret)
		IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret);
@@ -3825,12 +3825,11 @@ void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm,
	struct iwl_mvm_sta *mvm_sta;
	int i;

	lockdep_assert_held(&mvm->mutex);
	rcu_read_lock();

	/* Block/unblock all the stations of the given mvmvif */
	for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
		sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
						lockdep_is_held(&mvm->mutex));
		sta = rcu_dereference(mvm->fw_id_to_mac_id[i]);
		if (IS_ERR_OR_NULL(sta))
			continue;

@@ -3842,6 +3841,8 @@ void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm,
		iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, disable);
	}

	rcu_read_unlock();

	if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE))
		return;