Lines Matching refs:mvm
12 #include "mvm.h"
92 iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif)
100 * Checking that we hold mvm->mutex is a good idea, but the rate
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);
135 int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm)
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) {
165 if (iwl_mvm_is_mplut_supported(mvm))
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));
174 return iwl_mvm_send_cmd_pdu(mvm, BT_CONFIG, 0, sizeof(bt_cmd), &bt_cmd);
177 static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id,
184 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210)
187 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id);
200 IWL_DEBUG_COEX(mvm, "%sable reduced Tx Power for sta %d\n",
206 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_REDUCED_TXP,
212 struct iwl_mvm *mvm;
221 void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm,
234 static void iwl_mvm_bt_coex_tcm_based_ci(struct iwl_mvm *mvm,
239 if (!time_after(now, mvm->bt_coex_last_tcm_ts + MVM_COEX_TCM_PERIOD))
242 mvm->bt_coex_last_tcm_ts = now;
261 iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
268 iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
272 if (mvm->last_bt_notif.wifi_loss_low_rssi == BT_OFF)
289 wifi_loss_rate = mvm->last_bt_notif.wifi_loss_mid_high_rssi;
295 mvm->last_bt_notif.wifi_loss_low_rssi :
296 mvm->last_bt_notif.wifi_loss_mid_high_rssi;
301 mvm->last_bt_notif.wifi_loss_low_rssi :
302 mvm->last_bt_notif.wifi_loss_mid_high_rssi;
307 void iwl_mvm_bt_coex_update_link_esr(struct iwl_mvm *mvm,
319 if (!iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif,
323 iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_COEX,
327 static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
341 lockdep_assert_held(&mvm->mutex);
362 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
364 iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
366 iwl_mvm_bt_coex_enable_rssi_event(mvm, link_info, false,
372 iwl_mvm_bt_coex_update_link_esr(mvm, vif, link_id);
374 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2))
390 (mvm->last_bt_notif.rrc_status & BIT(link_info->phy_ctxt->id)))
393 IWL_DEBUG_COEX(data->mvm,
399 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
431 data->primary_load = mvm->tcm.result.load[mvmvif->id];
433 data->secondary_load = mvm->tcm.result.load[mvmvif->id];
449 data->primary_load = mvm->tcm.result.load[mvmvif->id];
451 data->secondary_load = mvm->tcm.result.load[mvmvif->id];
458 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT ||
459 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF ||
461 iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id, false);
462 iwl_mvm_bt_coex_enable_rssi_event(mvm, link_info, false, 0);
473 if (iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
475 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
477 if (iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
479 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
483 iwl_mvm_bt_coex_enable_rssi_event(mvm, link_info, true, ave_rssi);
492 struct iwl_mvm *mvm = data->mvm;
495 lockdep_assert_held(&mvm->mutex);
509 iwl_mvm_bt_notif_per_link(mvm, vif, data, link_id);
512 static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
515 .mvm = mvm,
516 .notif = &mvm->last_bt_notif,
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) {
535 iwl_mvm_bt_coex_tcm_based_ci(mvm, &data);
586 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) {
587 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0,
589 IWL_ERR(mvm, "Failed to send BT_CI cmd\n");
590 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd));
594 void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
600 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n");
601 IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance);
602 IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n",
604 IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n",
606 IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n",
610 memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif));
612 iwl_mvm_bt_coex_notif_handle(mvm);
615 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
621 lockdep_assert_held(&mvm->mutex);
624 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
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,
646 iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT)
647 ret = iwl_mvm_bt_coex_reduced_txp(mvm,
651 ret = iwl_mvm_bt_coex_reduced_txp(mvm,
656 IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n");
662 u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
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);
686 bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
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);
712 bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant)
714 if (ant & mvm->cfg->non_shared_ant)
717 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
721 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm)
723 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC;
726 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
729 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
737 u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants)
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;
746 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
750 bool mplut_enabled = iwl_mvm_is_mplut_supported(mvm);
755 if (unlikely(mvm->bt_tx_prio))
756 return mvm->bt_tx_prio - 1;
784 void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm)
786 iwl_mvm_bt_coex_notif_handle(mvm);