Commit c1e458b9 authored by Ilan Peer's avatar Ilan Peer Committed by Johannes Berg
Browse files

wifi: iwlwifi: mvm: Move beacon filtering to be per link

parent e0637037
Loading
Loading
Loading
Loading
+9 −12
Original line number Diff line number Diff line
@@ -219,15 +219,13 @@ struct iwl_bt_iterator_data {

static inline
void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm,
				       struct ieee80211_vif *vif,
				       struct iwl_mvm_vif_link_info *link_info,
				       bool enable, int rssi)
{
	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);

	mvmvif->bf_data.last_bt_coex_event = rssi;
	mvmvif->bf_data.bt_coex_max_thold =
	link_info->bf_data.last_bt_coex_event = rssi;
	link_info->bf_data.bt_coex_max_thold =
		enable ? -IWL_MVM_BT_COEX_EN_RED_TXP_THRESH : 0;
	mvmvif->bf_data.bt_coex_min_thold =
	link_info->bf_data.bt_coex_min_thold =
		enable ? -IWL_MVM_BT_COEX_DIS_RED_TXP_THRESH : 0;
}

@@ -412,8 +410,8 @@ static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
					    smps_mode, link_id);
			iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
						    false);
			/* FIXME: should this be per link? */
			iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
			iwl_mvm_bt_coex_enable_rssi_event(mvm, link_info, false,
							  0);
		}
		return;
	}
@@ -508,13 +506,12 @@ static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
	    le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF ||
	    !vif->cfg.assoc) {
		iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id, false);
		/* FIXME: should this be per link? */
		iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
		iwl_mvm_bt_coex_enable_rssi_event(mvm, link_info, false, 0);
		return;
	}

	/* try to get the avg rssi from fw */
	ave_rssi = mvmvif->bf_data.ave_beacon_signal;
	ave_rssi = link_info->bf_data.ave_beacon_signal;

	/* if the RSSI isn't valid, fake it is very low */
	if (!ave_rssi)
@@ -530,7 +527,7 @@ static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
	}

	/* Begin to monitor the RSSI: it may influence the reduced Tx power */
	iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi);
	iwl_mvm_bt_coex_enable_rssi_event(mvm, link_info, true, ave_rssi);
}

/* must be called under rcu_read_lock */
+1 −1
Original line number Diff line number Diff line
@@ -407,7 +407,7 @@ static ssize_t iwl_dbgfs_bf_params_read(struct file *file,
	};

	iwl_mvm_beacon_filter_debugfs_parameters(vif, &cmd);
	if (mvmvif->bf_data.bf_enabled)
	if (mvmvif->bf_enabled)
		cmd.bf_enable_beacon_filter = cpu_to_le32(1);
	else
		cmd.bf_enable_beacon_filter = 0;
+16 −7
Original line number Diff line number Diff line
@@ -1097,7 +1097,8 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
	iwl_mvm_te_clear_data(mvm, &mvmvif->time_event_data);
	spin_unlock_bh(&mvm->time_event_lock);

	memset(&mvmvif->bf_data, 0, sizeof(mvmvif->bf_data));
	mvmvif->bf_enabled = false;
	mvmvif->ba_enabled = false;
	mvmvif->ap_sta = NULL;

	for_each_mvm_vif_valid_link(mvmvif, link_id) {
@@ -1106,6 +1107,8 @@ static void iwl_mvm_cleanup_iterator(void *data, u8 *mac,
		mvmvif->link[link_id]->phy_ctxt = NULL;
		mvmvif->link[link_id]->active = 0;
		mvmvif->link[link_id]->igtk = NULL;
		memset(&mvmvif->link[link_id]->bf_data, 0,
		       sizeof(mvmvif->link[link_id]->bf_data));
	}

	probe_data = rcu_dereference_protected(mvmvif->deflink.probe_resp_data,
@@ -2538,6 +2541,7 @@ void iwl_mvm_bss_info_changed_station_assoc(struct iwl_mvm *mvm,
{
	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
	int ret;
	int link_id;

	/* The firmware tracks the MU-MIMO group on its own.
	 * However, on HW restart we should restore this data.
@@ -2553,7 +2557,8 @@ void iwl_mvm_bss_info_changed_station_assoc(struct iwl_mvm *mvm,
	iwl_mvm_recalc_multicast(mvm);

	/* reset rssi values */
	mvmvif->bf_data.ave_beacon_signal = 0;
	for_each_mvm_vif_valid_link(mvmvif, link_id)
		mvmvif->link[link_id]->bf_data.ave_beacon_signal = 0;

	iwl_mvm_bt_coex_vif_change(mvm);
	iwl_mvm_update_smps_on_active_links(mvm, vif, IWL_MVM_SMPS_REQ_TT,
@@ -2594,10 +2599,14 @@ iwl_mvm_bss_info_changed_station_common(struct iwl_mvm *mvm,
	}

	if (changes & BSS_CHANGED_CQM) {
		IWL_DEBUG_MAC80211(mvm, "cqm info_changed\n");
		/* reset cqm events tracking */
		mvmvif->bf_data.last_cqm_event = 0;
		if (mvmvif->bf_data.bf_enabled) {
		struct iwl_mvm_vif_link_info *link_info =
			mvmvif->link[link_conf->link_id];

		IWL_DEBUG_MAC80211(mvm, "CQM info_changed\n");
		if (link_info)
			link_info->bf_data.last_cqm_event = 0;

		if (mvmvif->bf_enabled) {
			/* FIXME: need to update per link when FW API will
			 * support it
			 */
@@ -5391,7 +5400,7 @@ static int iwl_mvm_old_pre_chan_sw_sta(struct iwl_mvm *mvm,
	if (chsw->block_tx)
		iwl_mvm_csa_client_absent(mvm, vif);

	if (mvmvif->bf_data.bf_enabled) {
	if (mvmvif->bf_enabled) {
		int ret = iwl_mvm_disable_beacon_filter(mvm, vif);

		if (ret)
+9 −8
Original line number Diff line number Diff line
@@ -255,18 +255,14 @@ enum iwl_mvm_low_latency_cause {
};

/**
* struct iwl_mvm_vif_bf_data - beacon filtering related data
* @bf_enabled: indicates if beacon filtering is enabled
* @ba_enabled: indicated if beacon abort is enabled
* struct iwl_mvm_link_bf_data - beacon filtering related data
* @ave_beacon_signal: average beacon signal
* @last_cqm_event: rssi of the last cqm event
* @bt_coex_min_thold: minimum threshold for BT coex
* @bt_coex_max_thold: maximum threshold for BT coex
* @last_bt_coex_event: rssi of the last BT coex event
*/
struct iwl_mvm_vif_bf_data {
	bool bf_enabled;
	bool ba_enabled;
struct iwl_mvm_link_bf_data {
	int ave_beacon_signal;
	int last_cqm_event;
	int bt_coex_min_thold;
@@ -309,6 +305,7 @@ struct iwl_probe_resp_data {
 * @listen_lmac: indicates this link is allocated to the listen LMAC
 * @mcast_sta: multicast station
 * @phy_ctxt: phy context allocated to this link, if any
 * @bf_data: beacon filtering data
 */
struct iwl_mvm_vif_link_info {
	u8 bssid[ETH_ALEN];
@@ -344,6 +341,8 @@ struct iwl_mvm_vif_link_info {
	struct ieee80211_tx_queue_params queue_params[IEEE80211_NUM_ACS];

	u16 mgmt_queue;

	struct iwl_mvm_link_bf_data bf_data;
};

/**
@@ -373,8 +372,9 @@ struct iwl_mvm_vif_link_info {
 * @csa_bcn_pending: indicates that we are waiting for a beacon on a new channel
 * @features: hw features active for this vif
 * @ap_beacon_time: AP beacon time for synchronisation (on older FW)
 * @bf_enabled: indicates if beacon filtering is enabled
 * @ba_enabled: indicated if beacon abort is enabled
 * @bcn_prot: beacon protection data (keys; FIXME: needs to be per link)
 * @bf_data: beacon filtering data
 * @deflink: default link data for use in non-MLO
 * @link: link data for each link in MLO
 * @esr_active: indicates eSR mode is active
@@ -401,7 +401,8 @@ struct iwl_mvm_vif {
	bool ps_disabled;

	u32 ap_beacon_time;
	struct iwl_mvm_vif_bf_data bf_data;
	bool bf_enabled;
	bool ba_enabled;

#ifdef CONFIG_PM
	/* WoWLAN GTK rekey data */
+8 −8
Original line number Diff line number Diff line
@@ -79,7 +79,7 @@ void iwl_mvm_beacon_filter_set_cqm_params(struct iwl_mvm *mvm,
		cmd->bf_roaming_state =
			cpu_to_le32(-vif->bss_conf.cqm_rssi_thold);
	}
	cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->bf_data.ba_enabled);
	cmd->ba_enable_beacon_abort = cpu_to_le32(mvmvif->ba_enabled);
}

static void iwl_mvm_power_log(struct iwl_mvm *mvm,
@@ -826,7 +826,7 @@ static int _iwl_mvm_enable_beacon_filter(struct iwl_mvm *mvm,
	ret = iwl_mvm_beacon_filter_send_cmd(mvm, cmd);

	if (!ret)
		mvmvif->bf_data.bf_enabled = true;
		mvmvif->bf_enabled = true;

	return ret;
}
@@ -855,7 +855,7 @@ static int _iwl_mvm_disable_beacon_filter(struct iwl_mvm *mvm,
	ret = iwl_mvm_beacon_filter_send_cmd(mvm, &cmd);

	if (!ret)
		mvmvif->bf_data.bf_enabled = false;
		mvmvif->bf_enabled = false;

	return ret;
}
@@ -903,13 +903,13 @@ static int iwl_mvm_power_set_ba(struct iwl_mvm *mvm,
		.bf_enable_beacon_filter = cpu_to_le32(1),
	};

	if (!mvmvif->bf_data.bf_enabled)
	if (!mvmvif->bf_enabled)
		return 0;

	if (test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status))
		cmd.ba_escape_timer = cpu_to_le32(IWL_BA_ESCAPE_TIMER_D3);

	mvmvif->bf_data.ba_enabled = !(!mvmvif->pm_enabled ||
	mvmvif->ba_enabled = !(!mvmvif->pm_enabled ||
			       mvm->ps_disabled ||
			       !vif->cfg.ps ||
			       iwl_mvm_vif_low_latency(mvmvif));
Loading