Lines Matching refs:mvm

147 iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif)  in iwl_get_coex_type()  argument
174 if (mvm->cfg->bt_shared_single_ant) { in iwl_get_coex_type()
180 primary_ch_phy_id = le32_to_cpu(mvm->last_bt_ci_cmd.primary_ch_phy_id); in iwl_get_coex_type()
182 le32_to_cpu(mvm->last_bt_ci_cmd.secondary_ch_phy_id); in iwl_get_coex_type()
185 ret = le32_to_cpu(mvm->last_bt_notif.primary_ch_lut); in iwl_get_coex_type()
187 ret = le32_to_cpu(mvm->last_bt_notif.secondary_ch_lut); in iwl_get_coex_type()
195 int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm) in iwl_mvm_send_bt_init_conf() argument
200 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_bt_init_conf()
202 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { in iwl_mvm_send_bt_init_conf()
203 switch (mvm->bt_force_ant_mode) { in iwl_mvm_send_bt_init_conf()
226 if (iwl_mvm_is_mplut_supported(mvm)) in iwl_mvm_send_bt_init_conf()
232 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_mvm_send_bt_init_conf()
233 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_mvm_send_bt_init_conf()
235 return iwl_mvm_send_cmd_pdu(mvm, BT_CONFIG, 0, sizeof(bt_cmd), &bt_cmd); in iwl_mvm_send_bt_init_conf()
238 static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, in iwl_mvm_bt_coex_reduced_txp() argument
245 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id); in iwl_mvm_bt_coex_reduced_txp()
258 IWL_DEBUG_COEX(mvm, "%sable reduced Tx Power for sta %d\n", in iwl_mvm_bt_coex_reduced_txp()
264 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_REDUCED_TXP, in iwl_mvm_bt_coex_reduced_txp()
270 struct iwl_mvm *mvm; member
279 void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_enable_rssi_event() argument
294 static void iwl_mvm_bt_coex_tcm_based_ci(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_tcm_based_ci() argument
299 if (!time_after(now, mvm->bt_coex_last_tcm_ts + MVM_COEX_TCM_PERIOD)) in iwl_mvm_bt_coex_tcm_based_ci()
302 mvm->bt_coex_last_tcm_ts = now; in iwl_mvm_bt_coex_tcm_based_ci()
322 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_bt_notif_iterator() local
329 lockdep_assert_held(&mvm->mutex); in iwl_mvm_bt_notif_iterator()
349 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, in iwl_mvm_bt_notif_iterator()
351 iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, in iwl_mvm_bt_notif_iterator()
353 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); in iwl_mvm_bt_notif_iterator()
358 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2)) in iwl_mvm_bt_notif_iterator()
374 (mvm->last_bt_notif.rrc_status & BIT(mvmvif->phy_ctxt->id))) in iwl_mvm_bt_notif_iterator()
377 IWL_DEBUG_COEX(data->mvm, in iwl_mvm_bt_notif_iterator()
382 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, in iwl_mvm_bt_notif_iterator()
413 data->primary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
415 data->secondary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
430 data->primary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
432 data->secondary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
440 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || in iwl_mvm_bt_notif_iterator()
441 mvm->cfg->bt_shared_single_ant || !vif->bss_conf.assoc || in iwl_mvm_bt_notif_iterator()
442 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF) { in iwl_mvm_bt_notif_iterator()
443 iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false); in iwl_mvm_bt_notif_iterator()
444 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); in iwl_mvm_bt_notif_iterator()
455 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true)) in iwl_mvm_bt_notif_iterator()
456 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); in iwl_mvm_bt_notif_iterator()
458 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) in iwl_mvm_bt_notif_iterator()
459 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); in iwl_mvm_bt_notif_iterator()
463 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi); in iwl_mvm_bt_notif_iterator()
466 static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_notif_handle() argument
469 .mvm = mvm, in iwl_mvm_bt_coex_notif_handle()
470 .notif = &mvm->last_bt_notif, in iwl_mvm_bt_coex_notif_handle()
476 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_bt_coex_notif_handle()
481 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_bt_coex_notif_handle()
484 iwl_mvm_bt_coex_tcm_based_ci(mvm, &data); in iwl_mvm_bt_coex_notif_handle()
535 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { in iwl_mvm_bt_coex_notif_handle()
536 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0, in iwl_mvm_bt_coex_notif_handle()
538 IWL_ERR(mvm, "Failed to send BT_CI cmd\n"); in iwl_mvm_bt_coex_notif_handle()
539 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); in iwl_mvm_bt_coex_notif_handle()
543 void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_bt_coex_notif() argument
549 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); in iwl_mvm_rx_bt_coex_notif()
550 IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); in iwl_mvm_rx_bt_coex_notif()
551 IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n", in iwl_mvm_rx_bt_coex_notif()
553 IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n", in iwl_mvm_rx_bt_coex_notif()
555 IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n", in iwl_mvm_rx_bt_coex_notif()
559 memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif)); in iwl_mvm_rx_bt_coex_notif()
561 iwl_mvm_bt_coex_notif_handle(mvm); in iwl_mvm_rx_bt_coex_notif()
564 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_bt_rssi_event() argument
570 lockdep_assert_held(&mvm->mutex); in iwl_mvm_bt_rssi_event()
573 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_bt_rssi_event()
584 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF) in iwl_mvm_bt_rssi_event()
587 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid, in iwl_mvm_bt_rssi_event()
594 if (rssi_event == RSSI_EVENT_LOW || mvm->cfg->bt_shared_single_ant || in iwl_mvm_bt_rssi_event()
595 iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT) in iwl_mvm_bt_rssi_event()
596 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, in iwl_mvm_bt_rssi_event()
599 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true); in iwl_mvm_bt_rssi_event()
602 IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n"); in iwl_mvm_bt_rssi_event()
608 u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, in iwl_mvm_coex_agg_time_limit() argument
616 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id)) in iwl_mvm_coex_agg_time_limit()
619 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_coex_agg_time_limit()
623 lut_type = iwl_get_coex_type(mvm, mvmsta->vif); in iwl_mvm_coex_agg_time_limit()
632 bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_is_mimo_allowed() argument
640 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id)) in iwl_mvm_bt_coex_is_mimo_allowed()
643 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_bt_coex_is_mimo_allowed()
654 lut_type = iwl_get_coex_type(mvm, mvmsta->vif); in iwl_mvm_bt_coex_is_mimo_allowed()
658 bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant) in iwl_mvm_bt_coex_is_ant_avail() argument
661 if (mvm->cfg->bt_shared_single_ant) in iwl_mvm_bt_coex_is_ant_avail()
664 if (ant & mvm->cfg->non_shared_ant) in iwl_mvm_bt_coex_is_ant_avail()
667 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_bt_coex_is_ant_avail()
671 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_is_shared_ant_avail() argument
674 if (mvm->cfg->bt_shared_single_ant) in iwl_mvm_bt_coex_is_shared_ant_avail()
677 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC; in iwl_mvm_bt_coex_is_shared_ant_avail()
680 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_is_tpc_allowed() argument
683 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); in iwl_mvm_bt_coex_is_tpc_allowed()
691 u8 iwl_mvm_bt_coex_get_single_ant_msk(struct iwl_mvm *mvm, u8 enabled_ants) in iwl_mvm_bt_coex_get_single_ant_msk() argument
693 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2) && in iwl_mvm_bt_coex_get_single_ant_msk()
694 (mvm->cfg->non_shared_ant & enabled_ants)) in iwl_mvm_bt_coex_get_single_ant_msk()
695 return mvm->cfg->non_shared_ant; in iwl_mvm_bt_coex_get_single_ant_msk()
700 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, in iwl_mvm_bt_coex_tx_prio() argument
704 bool mplut_enabled = iwl_mvm_is_mplut_supported(mvm); in iwl_mvm_bt_coex_tx_prio()
709 if (unlikely(mvm->bt_tx_prio)) in iwl_mvm_bt_coex_tx_prio()
710 return mvm->bt_tx_prio - 1; in iwl_mvm_bt_coex_tx_prio()
738 void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_vif_change() argument
740 iwl_mvm_bt_coex_notif_handle(mvm); in iwl_mvm_bt_coex_vif_change()