Lines Matching refs:mvm
92 iwl_get_coex_type(struct iwl_mvm *mvm, const struct ieee80211_vif *vif) in iwl_get_coex_type() argument
119 if (mvm->cfg->bt_shared_single_ant) { in iwl_get_coex_type()
125 primary_ch_phy_id = le32_to_cpu(mvm->last_bt_ci_cmd.primary_ch_phy_id); in iwl_get_coex_type()
127 le32_to_cpu(mvm->last_bt_ci_cmd.secondary_ch_phy_id); in iwl_get_coex_type()
130 ret = le32_to_cpu(mvm->last_bt_notif.primary_ch_lut); in iwl_get_coex_type()
132 ret = le32_to_cpu(mvm->last_bt_notif.secondary_ch_lut); in iwl_get_coex_type()
140 int iwl_mvm_send_bt_init_conf(struct iwl_mvm *mvm) in iwl_mvm_send_bt_init_conf() argument
145 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_bt_init_conf()
147 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) { in iwl_mvm_send_bt_init_conf()
148 switch (mvm->bt_force_ant_mode) { in iwl_mvm_send_bt_init_conf()
170 if (iwl_mvm_is_mplut_supported(mvm)) in iwl_mvm_send_bt_init_conf()
176 memset(&mvm->last_bt_notif, 0, sizeof(mvm->last_bt_notif)); in iwl_mvm_send_bt_init_conf()
177 memset(&mvm->last_bt_ci_cmd, 0, sizeof(mvm->last_bt_ci_cmd)); in iwl_mvm_send_bt_init_conf()
179 return iwl_mvm_send_cmd_pdu(mvm, BT_CONFIG, 0, sizeof(bt_cmd), &bt_cmd); in iwl_mvm_send_bt_init_conf()
182 static int iwl_mvm_bt_coex_reduced_txp(struct iwl_mvm *mvm, u8 sta_id, in iwl_mvm_bt_coex_reduced_txp() argument
189 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id); in iwl_mvm_bt_coex_reduced_txp()
202 IWL_DEBUG_COEX(mvm, "%sable reduced Tx Power for sta %d\n", in iwl_mvm_bt_coex_reduced_txp()
208 return iwl_mvm_send_cmd_pdu(mvm, BT_COEX_UPDATE_REDUCED_TXP, in iwl_mvm_bt_coex_reduced_txp()
214 struct iwl_mvm *mvm; member
223 void iwl_mvm_bt_coex_enable_rssi_event(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_enable_rssi_event() argument
238 static void iwl_mvm_bt_coex_tcm_based_ci(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_tcm_based_ci() argument
243 if (!time_after(now, mvm->bt_coex_last_tcm_ts + MVM_COEX_TCM_PERIOD)) in iwl_mvm_bt_coex_tcm_based_ci()
246 mvm->bt_coex_last_tcm_ts = now; in iwl_mvm_bt_coex_tcm_based_ci()
266 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_bt_notif_iterator() local
273 lockdep_assert_held(&mvm->mutex); in iwl_mvm_bt_notif_iterator()
293 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, in iwl_mvm_bt_notif_iterator()
295 iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, in iwl_mvm_bt_notif_iterator()
297 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); in iwl_mvm_bt_notif_iterator()
302 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2)) in iwl_mvm_bt_notif_iterator()
318 (mvm->last_bt_notif.rrc_status & BIT(mvmvif->phy_ctxt->id))) in iwl_mvm_bt_notif_iterator()
321 IWL_DEBUG_COEX(data->mvm, in iwl_mvm_bt_notif_iterator()
326 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_BT_COEX, in iwl_mvm_bt_notif_iterator()
357 data->primary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
359 data->secondary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
374 data->primary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
376 data->secondary_load = mvm->tcm.result.load[mvmvif->id]; in iwl_mvm_bt_notif_iterator()
384 if (iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT || in iwl_mvm_bt_notif_iterator()
385 mvm->cfg->bt_shared_single_ant || !vif->cfg.assoc || in iwl_mvm_bt_notif_iterator()
386 le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF) { in iwl_mvm_bt_notif_iterator()
387 iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false); in iwl_mvm_bt_notif_iterator()
388 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, false, 0); in iwl_mvm_bt_notif_iterator()
399 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true)) in iwl_mvm_bt_notif_iterator()
400 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); in iwl_mvm_bt_notif_iterator()
402 if (iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, false)) in iwl_mvm_bt_notif_iterator()
403 IWL_ERR(mvm, "Couldn't send BT_CONFIG cmd\n"); in iwl_mvm_bt_notif_iterator()
407 iwl_mvm_bt_coex_enable_rssi_event(mvm, vif, true, ave_rssi); in iwl_mvm_bt_notif_iterator()
410 static void iwl_mvm_bt_coex_notif_handle(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_notif_handle() argument
413 .mvm = mvm, in iwl_mvm_bt_coex_notif_handle()
414 .notif = &mvm->last_bt_notif, in iwl_mvm_bt_coex_notif_handle()
420 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_bt_coex_notif_handle()
425 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_bt_coex_notif_handle()
428 iwl_mvm_bt_coex_tcm_based_ci(mvm, &data); in iwl_mvm_bt_coex_notif_handle()
479 if (memcmp(&cmd, &mvm->last_bt_ci_cmd, sizeof(cmd))) { in iwl_mvm_bt_coex_notif_handle()
480 if (iwl_mvm_send_cmd_pdu(mvm, BT_COEX_CI, 0, in iwl_mvm_bt_coex_notif_handle()
482 IWL_ERR(mvm, "Failed to send BT_CI cmd\n"); in iwl_mvm_bt_coex_notif_handle()
483 memcpy(&mvm->last_bt_ci_cmd, &cmd, sizeof(cmd)); in iwl_mvm_bt_coex_notif_handle()
487 void iwl_mvm_rx_bt_coex_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_bt_coex_notif() argument
493 IWL_DEBUG_COEX(mvm, "BT Coex Notification received\n"); in iwl_mvm_rx_bt_coex_notif()
494 IWL_DEBUG_COEX(mvm, "\tBT ci compliance %d\n", notif->bt_ci_compliance); in iwl_mvm_rx_bt_coex_notif()
495 IWL_DEBUG_COEX(mvm, "\tBT primary_ch_lut %d\n", in iwl_mvm_rx_bt_coex_notif()
497 IWL_DEBUG_COEX(mvm, "\tBT secondary_ch_lut %d\n", in iwl_mvm_rx_bt_coex_notif()
499 IWL_DEBUG_COEX(mvm, "\tBT activity grading %d\n", in iwl_mvm_rx_bt_coex_notif()
503 memcpy(&mvm->last_bt_notif, notif, sizeof(mvm->last_bt_notif)); in iwl_mvm_rx_bt_coex_notif()
505 iwl_mvm_bt_coex_notif_handle(mvm); in iwl_mvm_rx_bt_coex_notif()
508 void iwl_mvm_bt_rssi_event(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_bt_rssi_event() argument
514 lockdep_assert_held(&mvm->mutex); in iwl_mvm_bt_rssi_event()
517 if (unlikely(mvm->bt_force_ant_mode != BT_FORCE_ANT_DIS)) in iwl_mvm_bt_rssi_event()
528 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) == BT_OFF) in iwl_mvm_bt_rssi_event()
531 IWL_DEBUG_COEX(mvm, "RSSI for %pM is now %s\n", vif->bss_conf.bssid, in iwl_mvm_bt_rssi_event()
538 if (rssi_event == RSSI_EVENT_LOW || mvm->cfg->bt_shared_single_ant || in iwl_mvm_bt_rssi_event()
539 iwl_get_coex_type(mvm, vif) == BT_COEX_LOOSE_LUT) in iwl_mvm_bt_rssi_event()
540 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, in iwl_mvm_bt_rssi_event()
543 ret = iwl_mvm_bt_coex_reduced_txp(mvm, mvmvif->ap_sta_id, true); in iwl_mvm_bt_rssi_event()
546 IWL_ERR(mvm, "couldn't send BT_CONFIG HCMD upon RSSI event\n"); in iwl_mvm_bt_rssi_event()
552 u16 iwl_mvm_coex_agg_time_limit(struct iwl_mvm *mvm, in iwl_mvm_coex_agg_time_limit() argument
560 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id)) in iwl_mvm_coex_agg_time_limit()
563 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_coex_agg_time_limit()
567 lut_type = iwl_get_coex_type(mvm, mvmsta->vif); in iwl_mvm_coex_agg_time_limit()
576 bool iwl_mvm_bt_coex_is_mimo_allowed(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_is_mimo_allowed() argument
584 if (mvm->last_bt_notif.ttc_status & BIT(phy_ctxt->id)) in iwl_mvm_bt_coex_is_mimo_allowed()
587 if (le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_bt_coex_is_mimo_allowed()
598 lut_type = iwl_get_coex_type(mvm, mvmsta->vif); in iwl_mvm_bt_coex_is_mimo_allowed()
602 bool iwl_mvm_bt_coex_is_ant_avail(struct iwl_mvm *mvm, u8 ant) in iwl_mvm_bt_coex_is_ant_avail() argument
605 if (mvm->cfg->bt_shared_single_ant) in iwl_mvm_bt_coex_is_ant_avail()
608 if (ant & mvm->cfg->non_shared_ant) in iwl_mvm_bt_coex_is_ant_avail()
611 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < in iwl_mvm_bt_coex_is_ant_avail()
615 bool iwl_mvm_bt_coex_is_shared_ant_avail(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_is_shared_ant_avail() argument
618 if (mvm->cfg->bt_shared_single_ant) in iwl_mvm_bt_coex_is_shared_ant_avail()
621 return le32_to_cpu(mvm->last_bt_notif.bt_activity_grading) < BT_HIGH_TRAFFIC; in iwl_mvm_bt_coex_is_shared_ant_avail()
624 bool iwl_mvm_bt_coex_is_tpc_allowed(struct iwl_mvm *mvm, in iwl_mvm_bt_coex_is_tpc_allowed() argument
627 u32 bt_activity = le32_to_cpu(mvm->last_bt_notif.bt_activity_grading); in iwl_mvm_bt_coex_is_tpc_allowed()
635 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
637 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_COEX_SCHEMA_2) && in iwl_mvm_bt_coex_get_single_ant_msk()
638 (mvm->cfg->non_shared_ant & enabled_ants)) in iwl_mvm_bt_coex_get_single_ant_msk()
639 return mvm->cfg->non_shared_ant; in iwl_mvm_bt_coex_get_single_ant_msk()
644 u8 iwl_mvm_bt_coex_tx_prio(struct iwl_mvm *mvm, struct ieee80211_hdr *hdr, in iwl_mvm_bt_coex_tx_prio() argument
648 bool mplut_enabled = iwl_mvm_is_mplut_supported(mvm); in iwl_mvm_bt_coex_tx_prio()
653 if (unlikely(mvm->bt_tx_prio)) in iwl_mvm_bt_coex_tx_prio()
654 return mvm->bt_tx_prio - 1; in iwl_mvm_bt_coex_tx_prio()
682 void iwl_mvm_bt_coex_vif_change(struct iwl_mvm *mvm) in iwl_mvm_bt_coex_vif_change() argument
684 iwl_mvm_bt_coex_notif_handle(mvm); in iwl_mvm_bt_coex_vif_change()