Lines Matching +full:tcm +full:- +full:mode

1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2013-2014, 2018-2020, 2022-2024 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
11 #include "iwl-modparams.h"
13 #include "iwl-debug.h"
100 * Checking that we hold mvm->mutex is a good idea, but the rate
109 chanctx_conf = rcu_dereference(vif->bss_conf.chanctx_conf);
112 chanctx_conf->def.chan->band != NL80211_BAND_2GHZ) {
119 phy_ctx_id = *((u16 *)chanctx_conf->drv_priv);
120 primary_ch_phy_id = le32_to_cpu(mvm->last_bt_ci_cmd.primary_ch_phy_id);
122 le32_to_cpu(mvm->last_bt_ci_cmd.secondary_ch_phy_id);
125 ret = le32_to_cpu(mvm->last_bt_notif.primary_ch_lut);
127 ret = le32_to_cpu(mvm->last_bt_notif.secondary_ch_lut);
128 /* else - default = TX TX disallowed */
138 u32 mode;
140 lockdep_assert_held(&mvm->mutex);
142 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) {
143 switch (mvm->bt_force_ant_mode) {
145 mode = BT_COEX_BT;
148 mode = BT_COEX_WIFI;
152 mode = 0;
155 bt_cmd.mode = cpu_to_le32(mode);
159 bt_cmd.mode = cpu_to_le32(BT_COEX_NW);
171 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif));
172 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd));
184 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
192 if (mvmsta->bt_reduced_txpower == enable)
195 value = mvmsta->deflink.sta_id;
204 mvmsta->bt_reduced_txpower = enable;
225 link_info->bf_data.last_bt_coex_event = rssi;
226 link_info->bf_data.bt_coex_max_thold =
227 enable ? -IWL_MVM_BT_COEX_EN_RED_TXP_THRESH : 0;
228 link_info->bf_data.bt_coex_min_thold =
229 enable ? -IWL_MVM_BT_COEX_DIS_RED_TXP_THRESH : 0;
239 if (!time_after(now, mvm->bt_coex_last_tcm_ts + MVM_COEX_TCM_PERIOD))
242 mvm->bt_coex_last_tcm_ts = now;
247 if (data->primary_ll)
250 if (data->primary_load >= data->secondary_load)
253 swap(data->primary, data->secondary);
268 iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
272 if (mvm->last_bt_notif.wifi_loss_low_rssi == BT_OFF)
284 * In case we don't know the RSSI - take the lower wifi loss,
285 * so we will more likely enter eSR, and if RSSI is low -
289 wifi_loss_rate = mvm->last_bt_notif.wifi_loss_mid_high_rssi;
291 else if (mvmvif->esr_active)
294 link_rssi <= -IWL_MVM_BT_COEX_DISABLE_ESR_THRESH ?
295 mvm->last_bt_notif.wifi_loss_low_rssi :
296 mvm->last_bt_notif.wifi_loss_mid_high_rssi;
300 link_rssi <= -IWL_MVM_BT_COEX_ENABLE_ESR_THRESH ?
301 mvm->last_bt_notif.wifi_loss_low_rssi :
302 mvm->last_bt_notif.wifi_loss_mid_high_rssi;
312 struct iwl_mvm_vif_link_info *link = mvmvif->link[link_id];
315 !iwl_mvm_vif_from_mac80211(vif)->authorized ||
320 (s8)link->beacon_stats.avg_signal,
322 /* In case we decided to exit eSR - stay with the primary */
332 /* default smps_mode is AUTOMATIC - only used for client modes */
341 lockdep_assert_held(&mvm->mutex);
343 link_info = mvmvif->link[link_id];
347 link_conf = rcu_dereference(vif->link_conf[link_id]);
355 chanctx_conf = rcu_dereference(link_conf->chanctx_conf);
359 chanctx_conf->def.chan->band != NL80211_BAND_2GHZ)) {
360 if (vif->type == NL80211_IFTYPE_STATION) {
364 iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
374 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2))
379 bt_activity_grading = le32_to_cpu(data->notif->bt_activity_grading);
386 if (!vif->cfg.assoc)
389 if (link_info->phy_ctxt &&
390 (mvm->last_bt_notif.rrc_status & BIT(link_info->phy_ctxt->id)))
393 IWL_DEBUG_COEX(data->mvm,
395 mvmvif->id, link_info->fw_link_id,
398 if (vif->type == NL80211_IFTYPE_STATION)
404 data->primary_ll = true;
406 data->secondary = data->primary;
407 data->primary = chanctx_conf;
410 if (vif->type == NL80211_IFTYPE_AP) {
411 if (!mvmvif->ap_ibss_active)
414 if (chanctx_conf == data->primary)
417 if (!data->primary_ll) {
422 data->secondary = data->primary;
423 data->primary = chanctx_conf;
425 /* there is low latency vif - we will be secondary */
426 data->secondary = chanctx_conf;
429 /* FIXME: TCM load per interface? or need something per link? */
430 if (data->primary == chanctx_conf)
431 data->primary_load = mvm->tcm.result.load[mvmvif->id];
432 else if (data->secondary == chanctx_conf)
433 data->secondary_load = mvm->tcm.result.load[mvmvif->id];
439 * latency mode, we are already in primary and just don't do much
441 if (!data->primary || data->primary == chanctx_conf)
442 data->primary = chanctx_conf;
443 else if (!data->secondary)
445 data->secondary = chanctx_conf;
447 /* FIXME: TCM load per interface? or need something per link? */
448 if (data->primary == chanctx_conf)
449 data->primary_load = mvm->tcm.result.load[mvmvif->id];
450 else if (data->secondary == chanctx_conf)
451 data->secondary_load = mvm->tcm.result.load[mvmvif->id];
459 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF ||
460 !vif->cfg.assoc) {
461 iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id, false);
467 ave_rssi = link_info->bf_data.ave_beacon_signal;
471 ave_rssi = -100;
472 if (ave_rssi > -IWL_MVM_BT_COEX_EN_RED_TXP_THRESH) {
473 if (iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
476 } else if (ave_rssi < -IWL_MVM_BT_COEX_DIS_RED_TXP_THRESH) {
477 if (iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
492 struct iwl_mvm *mvm = data->mvm;
495 lockdep_assert_held(&mvm->mutex);
497 switch (vif->type) {
501 if (!mvmvif->ap_ibss_active)
516 .notif = &mvm->last_bt_notif,
521 /* Ignore updates if we are in force mode */
522 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
527 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
530 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) {
539 if (WARN_ON(!chan->def.chan)) {
544 if (chan->def.width < NL80211_CHAN_WIDTH_40) {
547 if (chan->def.center_freq1 >
548 chan->def.chan->center_freq)
555 iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx];
557 cpu_to_le32(*((u16 *)data.primary->drv_priv));
562 if (WARN_ON(!data.secondary->def.chan)) {
567 if (chan->def.width < NL80211_CHAN_WIDTH_40) {
570 if (chan->def.center_freq1 >
571 chan->def.chan->center_freq)
578 iwl_ci_mask[chan->def.chan->hw_value][ci_bw_idx];
580 cpu_to_le32(*((u16 *)data.secondary->drv_priv));
586 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) {
590 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd));
598 struct iwl_bt_coex_profile_notif *notif = (void *)pkt->data;
601 IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance);
603 le32_to_cpu(notif->primary_ch_lut));
605 le32_to_cpu(notif->secondary_ch_lut));
607 le32_to_cpu(notif->bt_activity_grading));
610 memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif));
621 lockdep_assert_held(&mvm->mutex);
623 /* Ignore updates if we are in force mode */
624 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
628 * Rssi update while not associated - can happen since the statistics
631 if (mvmvif->deflink.ap_sta_id == IWL_MVM_INVALID_STA)
634 /* No BT - reports should be disabled */
635 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF)
638 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid,
648 mvmvif->deflink.ap_sta_id,
652 mvmvif->deflink.ap_sta_id,
666 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
667 struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->deflink.phy_ctxt;
670 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id))
673 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
677 lut_type = iwl_get_coex_type(mvm, mvmsta->vif);
690 struct iwl_mvm_vif *mvmvif = iwl_mvm_vif_from_mac80211(mvmsta->vif);
691 struct iwl_mvm_phy_ctxt *phy_ctxt = mvmvif->deflink.phy_ctxt;
694 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id))
697 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
708 lut_type = iwl_get_coex_type(mvm, mvmsta->vif);
714 if (ant & mvm->cfg->non_shared_ant)
717 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
723 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC;
729 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
739 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2) &&
740 (mvm->cfg->non_shared_ant & enabled_ants))
741 return mvm->cfg->non_shared_ant;
749 __le16 fc = hdr->frame_control;
752 if (info->band != NL80211_BAND_2GHZ)
755 if (unlikely(mvm->bt_tx_prio))
756 return mvm->bt_tx_prio - 1;
770 } else if (is_multicast_ether_addr(hdr->addr1)) {