Lines Matching refs:mvm

21 int iwl_mvm_send_cmd(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd)  in iwl_mvm_send_cmd()  argument
26 if (WARN_ON(mvm->d3_test_active)) in iwl_mvm_send_cmd()
36 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_cmd()
38 ret = iwl_trans_send_cmd(mvm->trans, cmd); in iwl_mvm_send_cmd()
57 int iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id, in iwl_mvm_send_cmd_pdu() argument
67 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_cmd_pdu()
73 int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd, in iwl_mvm_send_cmd_status() argument
80 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_cmd_status()
83 if (WARN_ON(mvm->d3_test_active)) in iwl_mvm_send_cmd_status()
97 ret = iwl_trans_send_cmd(mvm->trans, cmd); in iwl_mvm_send_cmd_status()
126 int iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id, u16 len, in iwl_mvm_send_cmd_pdu_status() argument
135 return iwl_mvm_send_cmd_status(mvm, &cmd, status); in iwl_mvm_send_cmd_pdu_status()
195 void iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_rx_fw_error() argument
200 IWL_ERR(mvm, "FW Error notification: type 0x%08X cmd_id 0x%02X\n", in iwl_mvm_rx_fw_error()
202 IWL_ERR(mvm, "FW Error notification: seq 0x%04X service 0x%08X\n", in iwl_mvm_rx_fw_error()
205 IWL_ERR(mvm, "FW Error notification: timestamp 0x%016llX\n", in iwl_mvm_rx_fw_error()
228 u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx) in iwl_mvm_next_antenna() argument
253 int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq) in iwl_mvm_send_lq_cmd() argument
263 iwl_mvm_has_tlc_offload(mvm))) in iwl_mvm_send_lq_cmd()
266 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_lq_cmd()
279 void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_update_smps() argument
287 lockdep_assert_held(&mvm->mutex); in iwl_mvm_update_smps()
290 if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1) in iwl_mvm_update_smps()
318 int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear) in iwl_mvm_request_statistics() argument
335 if (iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, in iwl_mvm_request_statistics()
339 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_request_statistics()
343 iwl_mvm_handle_rx_statistics(mvm, cmd.resp_pkt); in iwl_mvm_request_statistics()
351 iwl_init_notification_wait(&mvm->notif_wait, &stats_wait, in iwl_mvm_request_statistics()
355 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_request_statistics()
357 iwl_remove_notification(&mvm->notif_wait, &stats_wait); in iwl_mvm_request_statistics()
364 ret = iwl_wait_notification(&mvm->notif_wait, &stats_wait, HZ / 5); in iwl_mvm_request_statistics()
370 iwl_mvm_accu_radio_stats(mvm); in iwl_mvm_request_statistics()
375 void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm) in iwl_mvm_accu_radio_stats() argument
377 mvm->accu_radio_stats.rx_time += mvm->radio_stats.rx_time; in iwl_mvm_accu_radio_stats()
378 mvm->accu_radio_stats.tx_time += mvm->radio_stats.tx_time; in iwl_mvm_accu_radio_stats()
379 mvm->accu_radio_stats.on_time_rf += mvm->radio_stats.on_time_rf; in iwl_mvm_accu_radio_stats()
380 mvm->accu_radio_stats.on_time_scan += mvm->radio_stats.on_time_scan; in iwl_mvm_accu_radio_stats()
407 bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm, in iwl_mvm_rx_diversity_allowed() argument
415 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_diversity_allowed()
420 if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1) in iwl_mvm_rx_diversity_allowed()
423 if (mvm->cfg->rx_with_siso_diversity) in iwl_mvm_rx_diversity_allowed()
427 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_rx_diversity_allowed()
433 void iwl_mvm_send_low_latency_cmd(struct iwl_mvm *mvm, in iwl_mvm_send_low_latency_cmd() argument
440 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_send_low_latency_cmd()
450 if (iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, LOW_LATENCY_CMD), in iwl_mvm_send_low_latency_cmd()
452 IWL_ERR(mvm, "Failed to send low latency command\n"); in iwl_mvm_send_low_latency_cmd()
455 int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_update_low_latency() argument
463 lockdep_assert_held(&mvm->mutex); in iwl_mvm_update_low_latency()
473 iwl_mvm_send_low_latency_cmd(mvm, low_latency, mvmvif->id); in iwl_mvm_update_low_latency()
475 res = iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_update_low_latency()
479 iwl_mvm_bt_coex_vif_change(mvm); in iwl_mvm_update_low_latency()
481 return iwl_mvm_power_update_mac(mvm); in iwl_mvm_update_low_latency()
506 bool iwl_mvm_low_latency(struct iwl_mvm *mvm) in iwl_mvm_low_latency() argument
511 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_low_latency()
517 bool iwl_mvm_low_latency_band(struct iwl_mvm *mvm, enum nl80211_band band) in iwl_mvm_low_latency_band() argument
522 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_low_latency_band()
549 struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm) in iwl_mvm_get_bss_vif() argument
554 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_get_bss_vif()
558 IWL_ERR(mvm, "More than one managed interface active!\n"); in iwl_mvm_get_bss_vif()
580 struct ieee80211_vif *iwl_mvm_get_vif_by_macid(struct iwl_mvm *mvm, u32 macid) in iwl_mvm_get_vif_by_macid() argument
586 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_vif_by_macid()
589 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_get_vif_by_macid()
611 bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm) in iwl_mvm_is_vif_assoc() argument
617 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_is_vif_assoc()
624 unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, in iwl_mvm_get_wd_timeout() argument
632 mvm->trans->trans_cfg->base_params->wd_timeout; in iwl_mvm_get_wd_timeout()
634 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS)) { in iwl_mvm_get_wd_timeout()
639 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_get_wd_timeout()
646 trigger = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS); in iwl_mvm_get_wd_timeout()
675 return mvm->trans->trans_cfg->base_params->wd_timeout; in iwl_mvm_get_wd_timeout()
679 void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_connection_loss() argument
685 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_connection_loss()
696 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, "%s", errmsg); in iwl_mvm_connection_loss()
702 void iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm, in iwl_mvm_event_frame_timeout_callback() argument
710 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_frame_timeout_callback()
720 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_event_frame_timeout_callback()
734 iwl_mvm_tcm_load(struct iwl_mvm *mvm, u32 airtime, unsigned long elapsed) in iwl_mvm_tcm_load() argument
748 struct iwl_mvm *mvm = _data; in iwl_mvm_tcm_iter() local
755 low_latency = mvm->tcm.result.low_latency[mvmvif->id]; in iwl_mvm_tcm_iter()
757 if (!mvm->tcm.result.change[mvmvif->id] && in iwl_mvm_tcm_iter()
759 iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_tcm_iter()
765 iwl_mvm_update_low_latency(mvm, vif, low_latency, in iwl_mvm_tcm_iter()
768 iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_tcm_iter()
772 static void iwl_mvm_tcm_results(struct iwl_mvm *mvm) in iwl_mvm_tcm_results() argument
774 mutex_lock(&mvm->mutex); in iwl_mvm_tcm_results()
777 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_tcm_results()
778 iwl_mvm_tcm_iter, mvm); in iwl_mvm_tcm_results()
780 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_tcm_results()
781 iwl_mvm_config_scan(mvm); in iwl_mvm_tcm_results()
783 mutex_unlock(&mvm->mutex); in iwl_mvm_tcm_results()
788 struct iwl_mvm *mvm; in iwl_mvm_tcm_uapsd_nonagg_detected_wk() local
795 mvm = mvmvif->mvm; in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
797 if (mvm->tcm.data[mvmvif->id].opened_rx_ba_sessions) in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
801 memcpy(mvm->uapsd_noagg_bssids[mvm->uapsd_noagg_bssid_write_idx].addr, in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
803 mvm->uapsd_noagg_bssid_write_idx++; in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
804 if (mvm->uapsd_noagg_bssid_write_idx >= IWL_MVM_UAPSD_NOAGG_LIST_LEN) in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
805 mvm->uapsd_noagg_bssid_write_idx = 0; in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
807 iwl_mvm_connection_loss(mvm, vif, in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
811 static void iwl_mvm_uapsd_agg_disconnect(struct iwl_mvm *mvm, in iwl_mvm_uapsd_agg_disconnect() argument
828 if (mvm->tcm.data[mvmvif->id].uapsd_nonagg_detect.detected) in iwl_mvm_uapsd_agg_disconnect()
831 mvm->tcm.data[mvmvif->id].uapsd_nonagg_detect.detected = true; in iwl_mvm_uapsd_agg_disconnect()
832 IWL_INFO(mvm, in iwl_mvm_uapsd_agg_disconnect()
837 static void iwl_mvm_check_uapsd_agg_expected_tpt(struct iwl_mvm *mvm, in iwl_mvm_check_uapsd_agg_expected_tpt() argument
841 u64 bytes = mvm->tcm.data[mac].uapsd_nonagg_detect.rx_bytes; in iwl_mvm_check_uapsd_agg_expected_tpt()
846 rate = ewma_rate_read(&mvm->tcm.data[mac].uapsd_nonagg_detect.rate); in iwl_mvm_check_uapsd_agg_expected_tpt()
848 if (!rate || mvm->tcm.data[mac].opened_rx_ba_sessions || in iwl_mvm_check_uapsd_agg_expected_tpt()
849 mvm->tcm.data[mac].uapsd_nonagg_detect.detected) in iwl_mvm_check_uapsd_agg_expected_tpt()
852 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_check_uapsd_agg_expected_tpt()
874 vif = rcu_dereference(mvm->vif_id_to_mac[mac]); in iwl_mvm_check_uapsd_agg_expected_tpt()
876 iwl_mvm_uapsd_agg_disconnect(mvm, vif); in iwl_mvm_check_uapsd_agg_expected_tpt()
892 static unsigned long iwl_mvm_calc_tcm_stats(struct iwl_mvm *mvm, in iwl_mvm_calc_tcm_stats() argument
896 unsigned int elapsed = jiffies_to_msecs(ts - mvm->tcm.ts); in iwl_mvm_calc_tcm_stats()
898 jiffies_to_msecs(ts - mvm->tcm.uapsd_nonagg_ts); in iwl_mvm_calc_tcm_stats()
905 bool handle_ll = time_after(ts, mvm->tcm.ll_ts + MVM_LL_PERIOD); in iwl_mvm_calc_tcm_stats()
908 mvm->tcm.ll_ts = ts; in iwl_mvm_calc_tcm_stats()
910 mvm->tcm.uapsd_nonagg_ts = ts; in iwl_mvm_calc_tcm_stats()
912 mvm->tcm.result.elapsed = elapsed; in iwl_mvm_calc_tcm_stats()
914 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_calc_tcm_stats()
920 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[mac]; in iwl_mvm_calc_tcm_stats()
927 load = iwl_mvm_tcm_load(mvm, airtime, elapsed); in iwl_mvm_calc_tcm_stats()
928 mvm->tcm.result.change[mac] = load != mvm->tcm.result.load[mac]; in iwl_mvm_calc_tcm_stats()
929 mvm->tcm.result.load[mac] = load; in iwl_mvm_calc_tcm_stats()
930 mvm->tcm.result.airtime[mac] = airtime; in iwl_mvm_calc_tcm_stats()
938 mvm->tcm.result.low_latency[mac] = true; in iwl_mvm_calc_tcm_stats()
940 mvm->tcm.result.low_latency[mac] = false; in iwl_mvm_calc_tcm_stats()
947 low_latency |= mvm->tcm.result.low_latency[mac]; in iwl_mvm_calc_tcm_stats()
949 if (!mvm->tcm.result.low_latency[mac] && handle_uapsd) in iwl_mvm_calc_tcm_stats()
950 iwl_mvm_check_uapsd_agg_expected_tpt(mvm, uapsd_elapsed, in iwl_mvm_calc_tcm_stats()
959 load = iwl_mvm_tcm_load(mvm, total_airtime, elapsed); in iwl_mvm_calc_tcm_stats()
960 mvm->tcm.result.global_load = load; in iwl_mvm_calc_tcm_stats()
963 band_load = iwl_mvm_tcm_load(mvm, band_airtime[i], elapsed); in iwl_mvm_calc_tcm_stats()
964 mvm->tcm.result.band_load[i] = band_load; in iwl_mvm_calc_tcm_stats()
996 void iwl_mvm_recalc_tcm(struct iwl_mvm *mvm) in iwl_mvm_recalc_tcm() argument
1000 time_after(ts, mvm->tcm.uapsd_nonagg_ts + in iwl_mvm_recalc_tcm()
1003 spin_lock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1004 if (mvm->tcm.paused || !time_after(ts, mvm->tcm.ts + MVM_TCM_PERIOD)) { in iwl_mvm_recalc_tcm()
1005 spin_unlock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1008 spin_unlock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1010 if (handle_uapsd && iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_recalc_tcm()
1011 mutex_lock(&mvm->mutex); in iwl_mvm_recalc_tcm()
1012 if (iwl_mvm_request_statistics(mvm, true)) in iwl_mvm_recalc_tcm()
1014 mutex_unlock(&mvm->mutex); in iwl_mvm_recalc_tcm()
1017 spin_lock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1019 if (!mvm->tcm.paused && time_after(ts, mvm->tcm.ts + MVM_TCM_PERIOD)) { in iwl_mvm_recalc_tcm()
1021 unsigned long work_delay = iwl_mvm_calc_tcm_stats(mvm, ts, in iwl_mvm_recalc_tcm()
1026 mvm->tcm.ts = ts; in iwl_mvm_recalc_tcm()
1028 schedule_delayed_work(&mvm->tcm.work, work_delay); in iwl_mvm_recalc_tcm()
1030 spin_unlock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1032 iwl_mvm_tcm_results(mvm); in iwl_mvm_recalc_tcm()
1038 struct iwl_mvm *mvm = container_of(delayed_work, struct iwl_mvm, in iwl_mvm_tcm_work() local
1041 iwl_mvm_recalc_tcm(mvm); in iwl_mvm_tcm_work()
1044 void iwl_mvm_pause_tcm(struct iwl_mvm *mvm, bool with_cancel) in iwl_mvm_pause_tcm() argument
1046 spin_lock_bh(&mvm->tcm.lock); in iwl_mvm_pause_tcm()
1047 mvm->tcm.paused = true; in iwl_mvm_pause_tcm()
1048 spin_unlock_bh(&mvm->tcm.lock); in iwl_mvm_pause_tcm()
1050 cancel_delayed_work_sync(&mvm->tcm.work); in iwl_mvm_pause_tcm()
1053 void iwl_mvm_resume_tcm(struct iwl_mvm *mvm) in iwl_mvm_resume_tcm() argument
1058 spin_lock_bh(&mvm->tcm.lock); in iwl_mvm_resume_tcm()
1059 mvm->tcm.ts = jiffies; in iwl_mvm_resume_tcm()
1060 mvm->tcm.ll_ts = jiffies; in iwl_mvm_resume_tcm()
1062 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[mac]; in iwl_mvm_resume_tcm()
1069 if (mvm->tcm.result.low_latency[mac]) in iwl_mvm_resume_tcm()
1074 mvm->tcm.paused = false; in iwl_mvm_resume_tcm()
1080 if (mvm->tcm.result.global_load > IWL_MVM_TRAFFIC_LOW) in iwl_mvm_resume_tcm()
1081 schedule_delayed_work(&mvm->tcm.work, MVM_TCM_PERIOD); in iwl_mvm_resume_tcm()
1083 schedule_delayed_work(&mvm->tcm.work, MVM_LL_PERIOD); in iwl_mvm_resume_tcm()
1085 spin_unlock_bh(&mvm->tcm.lock); in iwl_mvm_resume_tcm()
1088 void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tcm_add_vif() argument
1096 void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tcm_rm_vif() argument
1103 u32 iwl_mvm_get_systime(struct iwl_mvm *mvm) in iwl_mvm_get_systime() argument
1107 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000 && in iwl_mvm_get_systime()
1108 mvm->trans->cfg->gp2_reg_addr) in iwl_mvm_get_systime()
1109 reg_addr = mvm->trans->cfg->gp2_reg_addr; in iwl_mvm_get_systime()
1111 return iwl_read_prph(mvm->trans, reg_addr); in iwl_mvm_get_systime()
1114 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, int clock_type, in iwl_mvm_get_sync_time() argument
1119 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_sync_time()
1122 ps_disabled = mvm->ps_disabled; in iwl_mvm_get_sync_time()
1124 mvm->ps_disabled = true; in iwl_mvm_get_sync_time()
1125 iwl_mvm_power_update_device(mvm); in iwl_mvm_get_sync_time()
1128 *gp2 = iwl_mvm_get_systime(mvm); in iwl_mvm_get_sync_time()
1136 mvm->ps_disabled = ps_disabled; in iwl_mvm_get_sync_time()
1137 iwl_mvm_power_update_device(mvm); in iwl_mvm_get_sync_time()