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,
236 static void iwl_mvm_bt_coex_tcm_based_ci(struct iwl_mvm *mvm,
241 if (!time_after(now, mvm->bt_coex_last_tcm_ts + MVM_COEX_TCM_PERIOD))
244 mvm->bt_coex_last_tcm_ts = now;
258 static void iwl_mvm_bt_coex_enable_esr(struct iwl_mvm *mvm,
264 lockdep_assert_held(&mvm->mutex);
281 iwl_mvm_mld_select_links(mvm, vif, false);
289 link_id = iwl_mvm_mld_get_primary_link(mvm, vif, vif->active_links);
301 iwl_mvm_bt_coex_calculate_esr_mode(struct iwl_mvm *mvm,
308 iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP,
313 lockdep_assert_held(&mvm->mutex);
315 if (mvm->last_bt_notif.wifi_loss_low_rssi == BT_OFF)
339 wifi_loss_rate = mvm->last_bt_notif.wifi_loss_mid_high_rssi;
345 mvm->last_bt_notif.wifi_loss_low_rssi :
346 mvm->last_bt_notif.wifi_loss_mid_high_rssi;
351 mvm->last_bt_notif.wifi_loss_low_rssi :
352 mvm->last_bt_notif.wifi_loss_mid_high_rssi;
357 void iwl_mvm_bt_coex_update_vif_esr(struct iwl_mvm *mvm,
362 int primary_link = iwl_mvm_mld_get_primary_link(mvm, vif,
370 enable = iwl_mvm_bt_coex_calculate_esr_mode(mvm, vif, link_id,
373 iwl_mvm_bt_coex_enable_esr(mvm, vif, enable);
376 static void iwl_mvm_bt_notif_per_link(struct iwl_mvm *mvm,
390 lockdep_assert_held(&mvm->mutex);
411 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
413 iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
416 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
421 iwl_mvm_bt_coex_update_vif_esr(mvm, vif, link_id);
423 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2))
439 (mvm->last_bt_notif.rrc_status & BIT(link_info->phy_ctxt->id)))
442 IWL_DEBUG_COEX(data->mvm,
448 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX,
480 data->primary_load = mvm->tcm.result.load[mvmvif->id];
482 data->secondary_load = mvm->tcm.result.load[mvmvif->id];
498 data->primary_load = mvm->tcm.result.load[mvmvif->id];
500 data->secondary_load = mvm->tcm.result.load[mvmvif->id];
507 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT ||
508 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF ||
510 iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id, false);
512 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0);
523 if (iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
525 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
527 if (iwl_mvm_bt_coex_reduced_txp(mvm, link_info->ap_sta_id,
529 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n");
533 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi);
542 struct iwl_mvm *mvm = data->mvm;
545 lockdep_assert_held(&mvm->mutex);
560 iwl_mvm_bt_coex_enable_esr(mvm, vif, true);
563 iwl_mvm_bt_notif_per_link(mvm, vif, data, link_id);
566 static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm)
569 .mvm = mvm,
570 .notif = &mvm->last_bt_notif,
576 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
581 mvm->hw, IEEE80211_IFACE_ITER_NORMAL,
584 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) {
589 iwl_mvm_bt_coex_tcm_based_ci(mvm, &data);
640 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) {
641 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0,
643 IWL_ERR(mvm, "Failed to send BT_CI cmd\n");
644 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd));
648 void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm,
654 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n");
655 IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance);
656 IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n",
658 IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n",
660 IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n",
664 memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif));
666 iwl_mvm_bt_coex_notif_handle(mvm);
669 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
675 lockdep_assert_held(&mvm->mutex);
678 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS))
689 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF)
692 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid,
700 iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT)
701 ret = iwl_mvm_bt_coex_reduced_txp(mvm,
705 ret = iwl_mvm_bt_coex_reduced_txp(mvm,
710 IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n");
716 u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm,
724 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id))
727 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
731 lut_type = iwl_get_coex_type(mvm, mvmsta->vif);
740 bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm,
748 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id))
751 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
762 lut_type = iwl_get_coex_type(mvm, mvmsta->vif);
766 bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant)
768 if (ant & mvm->cfg->non_shared_ant)
771 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) <
775 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm)
777 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC;
780 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm,
783 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading);
791 u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants)
793 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2) &&
794 (mvm->cfg->non_shared_ant & enabled_ants))
795 return mvm->cfg->non_shared_ant;
800 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr,
804 bool mplut_enabled = iwl_mvm_is_mplut_supported(mvm);
809 if (unlikely(mvm->bt_tx_prio))
810 return mvm->bt_tx_prio - 1;
838 void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm)
840 iwl_mvm_bt_coex_notif_handle(mvm);