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

Commit b88bb291 authored by John W. Linville's avatar John W. Linville
Browse files
parents 40a10fd7 999609f1
Loading
Loading
Loading
Loading
+8 −4
Original line number Diff line number Diff line
@@ -715,7 +715,8 @@ static int iwl_mvm_bt_udpate_ctrl_kill_msk(struct iwl_mvm *mvm,
	return ret;
}

int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable)
static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
				       bool enable)
{
	struct iwl_bt_coex_cmd *bt_cmd;
	/* Send ASYNC since this can be sent from an atomic context */
@@ -733,8 +734,7 @@ int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, bool enable)
		return 0;

	/* nothing to do */
	if (mvmsta->bt_reduced_txpower_dbg ||
	    mvmsta->bt_reduced_txpower == enable)
	if (mvmsta->bt_reduced_txpower == enable)
		return 0;

	bt_cmd = kzalloc(sizeof(*bt_cmd), GFP_ATOMIC);
@@ -831,8 +831,11 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
		iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
				    smps_mode);
		data->reduced_tx_power = false;
		if (vif->type == NL80211_IFTYPE_STATION)
		if (vif->type == NL80211_IFTYPE_STATION) {
			iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,
						    false);
			iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
		}
		return;
	}

@@ -905,6 +908,7 @@ static void iwl_mvm_bt_notif_iterator(void *_data, u8 *mac,
	    mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc ||
	    !data->notif->bt_status) {
		data->reduced_tx_power = false;
		iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false);
		iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
		return;
	}
+3 −5
Original line number Diff line number Diff line
@@ -663,10 +663,8 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,

	if (WARN_ON(!vif->bss_conf.assoc))
		return -EINVAL;
	/* hack */
	vif->bss_conf.assoc = false;

	ret = iwl_mvm_mac_ctxt_add(mvm, vif);
	vif->bss_conf.assoc = true;
	if (ret)
		return ret;

@@ -702,7 +700,7 @@ static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
		return ret;
	rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta);

	ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
	ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false);
	if (ret)
		return ret;

@@ -1030,7 +1028,7 @@ static int __iwl_mvm_suspend(struct ieee80211_hw *hw,
	if (ret)
		goto out;

	ret = iwl_mvm_power_update_mac(mvm, vif);
	ret = iwl_mvm_power_update_mac(mvm);
	if (ret)
		goto out;

+3 −41
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ static ssize_t iwl_dbgfs_pm_params_write(struct ieee80211_vif *vif, char *buf,

	mutex_lock(&mvm->mutex);
	iwl_dbgfs_update_pm(mvm, vif, param, val);
	ret = iwl_mvm_power_update_mac(mvm, vif);
	ret = iwl_mvm_power_update_mac(mvm);
	mutex_unlock(&mvm->mutex);

	return ret ?: count;
@@ -262,10 +262,9 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file,
			struct iwl_mvm_sta *mvm_sta = (void *)sta->drv_priv;

			pos += scnprintf(buf+pos, bufsz-pos,
					 "ap_sta_id %d - reduced Tx power %d force %d\n",
					 "ap_sta_id %d - reduced Tx power %d\n",
					 ap_sta_id,
					 mvm_sta->bt_reduced_txpower,
					 mvm_sta->bt_reduced_txpower_dbg);
					 mvm_sta->bt_reduced_txpower);
		}
	}

@@ -283,41 +282,6 @@ static ssize_t iwl_dbgfs_mac_params_read(struct file *file,
	return simple_read_from_buffer(user_buf, count, ppos, buf, pos);
}

static ssize_t iwl_dbgfs_reduced_txp_write(struct ieee80211_vif *vif,
					   char *buf, size_t count,
					   loff_t *ppos)
{
	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);
	struct iwl_mvm *mvm = mvmvif->mvm;
	struct iwl_mvm_sta *mvmsta;
	bool reduced_tx_power;
	int ret;

	if (mvmvif->ap_sta_id >= ARRAY_SIZE(mvm->fw_id_to_mac_id))
		return -ENOTCONN;

	if (strtobool(buf, &reduced_tx_power) != 0)
		return -EINVAL;

	mutex_lock(&mvm->mutex);

	mvmsta = iwl_mvm_sta_from_staid_protected(mvm, mvmvif->ap_sta_id);
	if (IS_ERR_OR_NULL(mvmsta)) {
		mutex_unlock(&mvm->mutex);
		return -ENOTCONN;
	}

	mvmsta->bt_reduced_txpower_dbg = false;
	ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id,
					  reduced_tx_power);
	if (!ret)
		mvmsta->bt_reduced_txpower_dbg = true;

	mutex_unlock(&mvm->mutex);

	return ret ? : count;
}

static void iwl_dbgfs_update_bf(struct ieee80211_vif *vif,
				enum iwl_dbgfs_bf_mask param, int value)
{
@@ -558,7 +522,6 @@ MVM_DEBUGFS_READ_FILE_OPS(mac_params);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(pm_params, 32);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(bf_params, 256);
MVM_DEBUGFS_READ_WRITE_FILE_OPS(low_latency, 10);
MVM_DEBUGFS_WRITE_FILE_OPS(reduced_txp, 10);

void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
{
@@ -590,7 +553,6 @@ void iwl_mvm_vif_dbgfs_register(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
					 S_IRUSR);

	MVM_DEBUGFS_ADD_FILE_VIF(mac_params, mvmvif->dbgfs_dir, S_IRUSR);
	MVM_DEBUGFS_ADD_FILE_VIF(reduced_txp, mvmvif->dbgfs_dir, S_IWUSR);
	MVM_DEBUGFS_ADD_FILE_VIF(low_latency, mvmvif->dbgfs_dir,
				 S_IRUSR | S_IWUSR);

+13 −13
Original line number Diff line number Diff line
@@ -713,14 +713,6 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
					IEEE80211_P2P_OPPPS_CTWINDOW_MASK);
		ctxt_sta = &cmd.p2p_sta.sta;
	} else {
		/* Allow beacons to pass through as long as we are not
		 * associated, or we do not have dtim period information.
		 */
		if (!vif->bss_conf.assoc || !vif->bss_conf.dtim_period)
			cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);
		else
			cmd.filter_flags &= ~cpu_to_le32(MAC_FILTER_IN_BEACON);

		ctxt_sta = &cmd.sta;
	}

@@ -729,6 +721,11 @@ static int iwl_mvm_mac_ctxt_cmd_sta(struct iwl_mvm *mvm,
	    !force_assoc_off) {
		u32 dtim_offs;

		/* Allow beacons to pass through as long as we are not
		 * associated, or we do not have dtim period information.
		 */
		cmd.filter_flags |= cpu_to_le32(MAC_FILTER_IN_BEACON);

		/*
		 * The DTIM count counts down, so when it is N that means N
		 * more beacon intervals happen until the DTIM TBTT. Therefore
@@ -1112,12 +1109,12 @@ static int iwl_mvm_mac_ctxt_cmd_go(struct iwl_mvm *mvm,
}

static int iwl_mvm_mac_ctx_send(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
				u32 action)
				u32 action, bool force_assoc_off)
{
	switch (vif->type) {
	case NL80211_IFTYPE_STATION:
		return iwl_mvm_mac_ctxt_cmd_sta(mvm, vif, action,
						action == FW_CTXT_ACTION_ADD);
						force_assoc_off);
		break;
	case NL80211_IFTYPE_AP:
		if (!vif->p2p)
@@ -1147,7 +1144,8 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
		      vif->addr, ieee80211_vif_type_p2p(vif)))
		return -EIO;

	ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD);
	ret = iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_ADD,
				   true);
	if (ret)
		return ret;

@@ -1158,7 +1156,8 @@ int iwl_mvm_mac_ctxt_add(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
	return 0;
}

int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
			     bool force_assoc_off)
{
	struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(vif);

@@ -1166,7 +1165,8 @@ int iwl_mvm_mac_ctxt_changed(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
		      vif->addr, ieee80211_vif_type_p2p(vif)))
		return -EIO;

	return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY);
	return iwl_mvm_mac_ctx_send(mvm, vif, FW_CTXT_ACTION_MODIFY,
				    force_assoc_off);
}

int iwl_mvm_mac_ctxt_remove(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
+22 −20
Original line number Diff line number Diff line
@@ -832,7 +832,7 @@ static int iwl_mvm_mac_add_interface(struct ieee80211_hw *hw,
	if (ret)
		goto out_release;

	ret = iwl_mvm_power_update_mac(mvm, vif);
	ret = iwl_mvm_power_update_mac(mvm);
	if (ret)
		goto out_release;

@@ -983,7 +983,7 @@ static void iwl_mvm_mac_remove_interface(struct ieee80211_hw *hw,
	if (mvm->vif_count && vif->type != NL80211_IFTYPE_P2P_DEVICE)
		mvm->vif_count--;

	iwl_mvm_power_update_mac(mvm, vif);
	iwl_mvm_power_update_mac(mvm);
	iwl_mvm_mac_ctxt_remove(mvm, vif);

out_release:
@@ -1271,7 +1271,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
	if (changes & BSS_CHANGED_ASSOC && bss_conf->assoc)
		iwl_mvm_mac_ctxt_recalc_tsf_id(mvm, vif);

	ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
	ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false);
	if (ret)
		IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);

@@ -1354,7 +1354,7 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
		WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
	} else if (changes & (BSS_CHANGED_PS | BSS_CHANGED_P2P_PS |
			      BSS_CHANGED_QOS)) {
		ret = iwl_mvm_power_update_mac(mvm, vif);
		ret = iwl_mvm_power_update_mac(mvm);
		if (ret)
			IWL_ERR(mvm, "failed to update power mode\n");
	}
@@ -1368,9 +1368,12 @@ static void iwl_mvm_bss_info_changed_station(struct iwl_mvm *mvm,
		IWL_DEBUG_MAC80211(mvm, "cqm info_changed\n");
		/* reset cqm events tracking */
		mvmvif->bf_data.last_cqm_event = 0;
		ret = iwl_mvm_update_beacon_filter(mvm, vif, false, 0);
		if (mvmvif->bf_data.bf_enabled) {
			ret = iwl_mvm_enable_beacon_filter(mvm, vif, 0);
			if (ret)
			IWL_ERR(mvm, "failed to update CQM thresholds\n");
				IWL_ERR(mvm,
					"failed to update CQM thresholds\n");
		}
	}

	if (changes & BSS_CHANGED_ARP_FILTER) {
@@ -1420,7 +1423,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
	mvmvif->ap_ibss_active = true;

	/* power updated needs to be done before quotas */
	iwl_mvm_power_update_mac(mvm, vif);
	iwl_mvm_power_update_mac(mvm);

	ret = iwl_mvm_update_quotas(mvm, vif);
	if (ret)
@@ -1428,7 +1431,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,

	/* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
	if (vif->p2p && mvm->p2p_device_vif)
		iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
		iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false);

	iwl_mvm_ref(mvm, IWL_MVM_REF_AP_IBSS);

@@ -1438,7 +1441,7 @@ static int iwl_mvm_start_ap_ibss(struct ieee80211_hw *hw,
	return 0;

out_quota_failed:
	iwl_mvm_power_update_mac(mvm, vif);
	iwl_mvm_power_update_mac(mvm);
	mvmvif->ap_ibss_active = false;
	iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
out_unbind:
@@ -1468,13 +1471,13 @@ static void iwl_mvm_stop_ap_ibss(struct ieee80211_hw *hw,

	/* Need to update the P2P Device MAC (only GO, IBSS is single vif) */
	if (vif->p2p && mvm->p2p_device_vif)
		iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif);
		iwl_mvm_mac_ctxt_changed(mvm, mvm->p2p_device_vif, false);

	iwl_mvm_update_quotas(mvm, NULL);
	iwl_mvm_send_rm_bcast_sta(mvm, &mvmvif->bcast_sta);
	iwl_mvm_binding_remove_vif(mvm, vif);

	iwl_mvm_power_update_mac(mvm, vif);
	iwl_mvm_power_update_mac(mvm);

	iwl_mvm_mac_ctxt_remove(mvm, vif);

@@ -1495,7 +1498,7 @@ iwl_mvm_bss_info_changed_ap_ibss(struct iwl_mvm *mvm,

	if (changes & (BSS_CHANGED_ERP_CTS_PROT | BSS_CHANGED_HT |
		       BSS_CHANGED_BANDWIDTH) &&
	    iwl_mvm_mac_ctxt_changed(mvm, vif))
	    iwl_mvm_mac_ctxt_changed(mvm, vif, false))
		IWL_ERR(mvm, "failed to update MAC %pM\n", vif->addr);

	/* Need to send a new beacon template to the FW */
@@ -1734,7 +1737,6 @@ static int iwl_mvm_mac_sta_state(struct ieee80211_hw *hw,
	} else if (old_state == IEEE80211_STA_ASSOC &&
		   new_state == IEEE80211_STA_AUTHORIZED) {
		/* enable beacon filtering */
		if (vif->bss_conf.dtim_period)
		WARN_ON(iwl_mvm_enable_beacon_filter(mvm, vif, 0));
		ret = 0;
	} else if (old_state == IEEE80211_STA_AUTHORIZED &&
@@ -1797,7 +1799,7 @@ static int iwl_mvm_mac_conf_tx(struct ieee80211_hw *hw,
		int ret;

		mutex_lock(&mvm->mutex);
		ret = iwl_mvm_mac_ctxt_changed(mvm, vif);
		ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false);
		mutex_unlock(&mvm->mutex);
		return ret;
	}
@@ -2237,7 +2239,7 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
	 * Power state must be updated before quotas,
	 * otherwise fw will complain.
	 */
	iwl_mvm_power_update_mac(mvm, vif);
	iwl_mvm_power_update_mac(mvm);

	/* Setting the quota at this stage is only required for monitor
	 * interfaces. For the other types, the bss_info changed flow
@@ -2253,14 +2255,14 @@ static int iwl_mvm_assign_vif_chanctx(struct ieee80211_hw *hw,
	/* Handle binding during CSA */
	if (vif->type == NL80211_IFTYPE_AP) {
		iwl_mvm_update_quotas(mvm, vif);
		iwl_mvm_mac_ctxt_changed(mvm, vif);
		iwl_mvm_mac_ctxt_changed(mvm, vif, false);
	}

	goto out_unlock;

 out_remove_binding:
	iwl_mvm_binding_remove_vif(mvm, vif);
	iwl_mvm_power_update_mac(mvm, vif);
	iwl_mvm_power_update_mac(mvm);
 out_unlock:
	mutex_unlock(&mvm->mutex);
	if (ret)
@@ -2299,10 +2301,10 @@ static void iwl_mvm_unassign_vif_chanctx(struct ieee80211_hw *hw,
	}

	iwl_mvm_binding_remove_vif(mvm, vif);
	iwl_mvm_power_update_mac(mvm, vif);

out_unlock:
	mvmvif->phy_ctxt = NULL;
	iwl_mvm_power_update_mac(mvm);
	mutex_unlock(&mvm->mutex);
}

Loading