Lines Matching refs:mvm

76 int iwl_mvm_send_cmd(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd)  in iwl_mvm_send_cmd()  argument
81 if (WARN_ON(mvm->d3_test_active)) in iwl_mvm_send_cmd()
91 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_cmd()
93 ret = iwl_trans_send_cmd(mvm->trans, cmd); in iwl_mvm_send_cmd()
109 int iwl_mvm_send_cmd_pdu(struct iwl_mvm *mvm, u32 id, in iwl_mvm_send_cmd_pdu() argument
119 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_cmd_pdu()
125 int iwl_mvm_send_cmd_status(struct iwl_mvm *mvm, struct iwl_host_cmd *cmd, in iwl_mvm_send_cmd_status() argument
132 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_cmd_status()
135 if (WARN_ON(mvm->d3_test_active)) in iwl_mvm_send_cmd_status()
149 ret = iwl_trans_send_cmd(mvm->trans, cmd); in iwl_mvm_send_cmd_status()
178 int iwl_mvm_send_cmd_pdu_status(struct iwl_mvm *mvm, u32 id, u16 len, in iwl_mvm_send_cmd_pdu_status() argument
187 return iwl_mvm_send_cmd_status(mvm, &cmd, status); in iwl_mvm_send_cmd_pdu_status()
246 void iwl_mvm_rx_fw_error(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_rx_fw_error() argument
251 IWL_ERR(mvm, "FW Error notification: type 0x%08X cmd_id 0x%02X\n", in iwl_mvm_rx_fw_error()
253 IWL_ERR(mvm, "FW Error notification: seq 0x%04X service 0x%08X\n", in iwl_mvm_rx_fw_error()
256 IWL_ERR(mvm, "FW Error notification: timestamp 0x%016llX\n", in iwl_mvm_rx_fw_error()
278 u8 iwl_mvm_next_antenna(struct iwl_mvm *mvm, u8 valid, u8 last_idx) in iwl_mvm_next_antenna() argument
422 static void iwl_mvm_dump_umac_error_log(struct iwl_mvm *mvm) in iwl_mvm_dump_umac_error_log() argument
424 struct iwl_trans *trans = mvm->trans; in iwl_mvm_dump_umac_error_log()
426 u32 base = mvm->trans->dbg.umac_error_event_table; in iwl_mvm_dump_umac_error_log()
429 !(mvm->trans->dbg.error_event_table_tlv_status & in iwl_mvm_dump_umac_error_log()
436 mvm->fwrt.dump.umac_err_id = table.error_id; in iwl_mvm_dump_umac_error_log()
441 mvm->status, table.valid); in iwl_mvm_dump_umac_error_log()
444 IWL_ERR(mvm, "0x%08X | %s\n", table.error_id, in iwl_mvm_dump_umac_error_log()
446 IWL_ERR(mvm, "0x%08X | umac branchlink1\n", table.blink1); in iwl_mvm_dump_umac_error_log()
447 IWL_ERR(mvm, "0x%08X | umac branchlink2\n", table.blink2); in iwl_mvm_dump_umac_error_log()
448 IWL_ERR(mvm, "0x%08X | umac interruptlink1\n", table.ilink1); in iwl_mvm_dump_umac_error_log()
449 IWL_ERR(mvm, "0x%08X | umac interruptlink2\n", table.ilink2); in iwl_mvm_dump_umac_error_log()
450 IWL_ERR(mvm, "0x%08X | umac data1\n", table.data1); in iwl_mvm_dump_umac_error_log()
451 IWL_ERR(mvm, "0x%08X | umac data2\n", table.data2); in iwl_mvm_dump_umac_error_log()
452 IWL_ERR(mvm, "0x%08X | umac data3\n", table.data3); in iwl_mvm_dump_umac_error_log()
453 IWL_ERR(mvm, "0x%08X | umac major\n", table.umac_major); in iwl_mvm_dump_umac_error_log()
454 IWL_ERR(mvm, "0x%08X | umac minor\n", table.umac_minor); in iwl_mvm_dump_umac_error_log()
455 IWL_ERR(mvm, "0x%08X | frame pointer\n", table.frame_pointer); in iwl_mvm_dump_umac_error_log()
456 IWL_ERR(mvm, "0x%08X | stack pointer\n", table.stack_pointer); in iwl_mvm_dump_umac_error_log()
457 IWL_ERR(mvm, "0x%08X | last host cmd\n", table.cmd_header); in iwl_mvm_dump_umac_error_log()
458 IWL_ERR(mvm, "0x%08X | isr status reg\n", table.nic_isr_pref); in iwl_mvm_dump_umac_error_log()
461 static void iwl_mvm_dump_lmac_error_log(struct iwl_mvm *mvm, u8 lmac_num) in iwl_mvm_dump_lmac_error_log() argument
463 struct iwl_trans *trans = mvm->trans; in iwl_mvm_dump_lmac_error_log()
465 u32 val, base = mvm->trans->dbg.lmac_error_event_table[lmac_num]; in iwl_mvm_dump_lmac_error_log()
467 if (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) { in iwl_mvm_dump_lmac_error_log()
469 base = mvm->fw->init_errlog_ptr; in iwl_mvm_dump_lmac_error_log()
472 base = mvm->fw->inst_errlog_ptr; in iwl_mvm_dump_lmac_error_log()
476 IWL_ERR(mvm, in iwl_mvm_dump_lmac_error_log()
479 (mvm->fwrt.cur_fw_img == IWL_UCODE_INIT) in iwl_mvm_dump_lmac_error_log()
502 mvm->fwrt.dump.lmac_err_id[lmac_num] = table.error_id; in iwl_mvm_dump_lmac_error_log()
507 mvm->status, table.valid); in iwl_mvm_dump_lmac_error_log()
512 IWL_ERR(mvm, "Loaded firmware version: %s\n", mvm->fw->fw_version); in iwl_mvm_dump_lmac_error_log()
514 IWL_ERR(mvm, "0x%08X | %-28s\n", table.error_id, in iwl_mvm_dump_lmac_error_log()
516 IWL_ERR(mvm, "0x%08X | trm_hw_status0\n", table.trm_hw_status0); in iwl_mvm_dump_lmac_error_log()
517 IWL_ERR(mvm, "0x%08X | trm_hw_status1\n", table.trm_hw_status1); in iwl_mvm_dump_lmac_error_log()
518 IWL_ERR(mvm, "0x%08X | branchlink2\n", table.blink2); in iwl_mvm_dump_lmac_error_log()
519 IWL_ERR(mvm, "0x%08X | interruptlink1\n", table.ilink1); in iwl_mvm_dump_lmac_error_log()
520 IWL_ERR(mvm, "0x%08X | interruptlink2\n", table.ilink2); in iwl_mvm_dump_lmac_error_log()
521 IWL_ERR(mvm, "0x%08X | data1\n", table.data1); in iwl_mvm_dump_lmac_error_log()
522 IWL_ERR(mvm, "0x%08X | data2\n", table.data2); in iwl_mvm_dump_lmac_error_log()
523 IWL_ERR(mvm, "0x%08X | data3\n", table.data3); in iwl_mvm_dump_lmac_error_log()
524 IWL_ERR(mvm, "0x%08X | beacon time\n", table.bcon_time); in iwl_mvm_dump_lmac_error_log()
525 IWL_ERR(mvm, "0x%08X | tsf low\n", table.tsf_low); in iwl_mvm_dump_lmac_error_log()
526 IWL_ERR(mvm, "0x%08X | tsf hi\n", table.tsf_hi); in iwl_mvm_dump_lmac_error_log()
527 IWL_ERR(mvm, "0x%08X | time gp1\n", table.gp1); in iwl_mvm_dump_lmac_error_log()
528 IWL_ERR(mvm, "0x%08X | time gp2\n", table.gp2); in iwl_mvm_dump_lmac_error_log()
529 IWL_ERR(mvm, "0x%08X | uCode revision type\n", table.fw_rev_type); in iwl_mvm_dump_lmac_error_log()
530 IWL_ERR(mvm, "0x%08X | uCode version major\n", table.major); in iwl_mvm_dump_lmac_error_log()
531 IWL_ERR(mvm, "0x%08X | uCode version minor\n", table.minor); in iwl_mvm_dump_lmac_error_log()
532 IWL_ERR(mvm, "0x%08X | hw version\n", table.hw_ver); in iwl_mvm_dump_lmac_error_log()
533 IWL_ERR(mvm, "0x%08X | board version\n", table.brd_ver); in iwl_mvm_dump_lmac_error_log()
534 IWL_ERR(mvm, "0x%08X | hcmd\n", table.hcmd); in iwl_mvm_dump_lmac_error_log()
535 IWL_ERR(mvm, "0x%08X | isr0\n", table.isr0); in iwl_mvm_dump_lmac_error_log()
536 IWL_ERR(mvm, "0x%08X | isr1\n", table.isr1); in iwl_mvm_dump_lmac_error_log()
537 IWL_ERR(mvm, "0x%08X | isr2\n", table.isr2); in iwl_mvm_dump_lmac_error_log()
538 IWL_ERR(mvm, "0x%08X | isr3\n", table.isr3); in iwl_mvm_dump_lmac_error_log()
539 IWL_ERR(mvm, "0x%08X | isr4\n", table.isr4); in iwl_mvm_dump_lmac_error_log()
540 IWL_ERR(mvm, "0x%08X | last cmd Id\n", table.last_cmd_id); in iwl_mvm_dump_lmac_error_log()
541 IWL_ERR(mvm, "0x%08X | wait_event\n", table.wait_event); in iwl_mvm_dump_lmac_error_log()
542 IWL_ERR(mvm, "0x%08X | l2p_control\n", table.l2p_control); in iwl_mvm_dump_lmac_error_log()
543 IWL_ERR(mvm, "0x%08X | l2p_duration\n", table.l2p_duration); in iwl_mvm_dump_lmac_error_log()
544 IWL_ERR(mvm, "0x%08X | l2p_mhvalid\n", table.l2p_mhvalid); in iwl_mvm_dump_lmac_error_log()
545 IWL_ERR(mvm, "0x%08X | l2p_addr_match\n", table.l2p_addr_match); in iwl_mvm_dump_lmac_error_log()
546 IWL_ERR(mvm, "0x%08X | lmpm_pmg_sel\n", table.lmpm_pmg_sel); in iwl_mvm_dump_lmac_error_log()
547 IWL_ERR(mvm, "0x%08X | timestamp\n", table.u_timestamp); in iwl_mvm_dump_lmac_error_log()
548 IWL_ERR(mvm, "0x%08X | flow_handler\n", table.flow_handler); in iwl_mvm_dump_lmac_error_log()
551 static void iwl_mvm_dump_iml_error_log(struct iwl_mvm *mvm) in iwl_mvm_dump_iml_error_log() argument
553 struct iwl_trans *trans = mvm->trans; in iwl_mvm_dump_iml_error_log()
563 IWL_ERR(mvm, "0x%08X | IML/ROM error/state\n", error); in iwl_mvm_dump_iml_error_log()
564 IWL_ERR(mvm, "0x%08X | IML/ROM data1\n", in iwl_mvm_dump_iml_error_log()
568 void iwl_mvm_dump_nic_error_log(struct iwl_mvm *mvm) in iwl_mvm_dump_nic_error_log() argument
570 if (!test_bit(STATUS_DEVICE_ENABLED, &mvm->trans->status)) { in iwl_mvm_dump_nic_error_log()
571 IWL_ERR(mvm, in iwl_mvm_dump_nic_error_log()
576 iwl_mvm_dump_lmac_error_log(mvm, 0); in iwl_mvm_dump_nic_error_log()
578 if (mvm->trans->dbg.lmac_error_event_table[1]) in iwl_mvm_dump_nic_error_log()
579 iwl_mvm_dump_lmac_error_log(mvm, 1); in iwl_mvm_dump_nic_error_log()
581 iwl_mvm_dump_umac_error_log(mvm); in iwl_mvm_dump_nic_error_log()
583 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_mvm_dump_nic_error_log()
584 iwl_mvm_dump_iml_error_log(mvm); in iwl_mvm_dump_nic_error_log()
586 iwl_fw_error_print_fseq_regs(&mvm->fwrt); in iwl_mvm_dump_nic_error_log()
589 int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, int sta_id, in iwl_mvm_reconfig_scd() argument
605 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_reconfig_scd()
608 if (WARN(mvm->queue_info[queue].tid_bitmap == 0, in iwl_mvm_reconfig_scd()
612 IWL_DEBUG_TX_QUEUES(mvm, "Reconfig SCD for TXQ #%d\n", queue); in iwl_mvm_reconfig_scd()
614 ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd); in iwl_mvm_reconfig_scd()
631 int iwl_mvm_send_lq_cmd(struct iwl_mvm *mvm, struct iwl_lq_cmd *lq) in iwl_mvm_send_lq_cmd() argument
641 iwl_mvm_has_tlc_offload(mvm))) in iwl_mvm_send_lq_cmd()
644 return iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_lq_cmd()
657 void iwl_mvm_update_smps(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_update_smps() argument
665 lockdep_assert_held(&mvm->mutex); in iwl_mvm_update_smps()
668 if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1) in iwl_mvm_update_smps()
690 int iwl_mvm_request_statistics(struct iwl_mvm *mvm, bool clear) in iwl_mvm_request_statistics() argument
703 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_request_statistics()
707 iwl_mvm_handle_rx_statistics(mvm, cmd.resp_pkt); in iwl_mvm_request_statistics()
711 iwl_mvm_accu_radio_stats(mvm); in iwl_mvm_request_statistics()
716 void iwl_mvm_accu_radio_stats(struct iwl_mvm *mvm) in iwl_mvm_accu_radio_stats() argument
718 mvm->accu_radio_stats.rx_time += mvm->radio_stats.rx_time; in iwl_mvm_accu_radio_stats()
719 mvm->accu_radio_stats.tx_time += mvm->radio_stats.tx_time; in iwl_mvm_accu_radio_stats()
720 mvm->accu_radio_stats.on_time_rf += mvm->radio_stats.on_time_rf; in iwl_mvm_accu_radio_stats()
721 mvm->accu_radio_stats.on_time_scan += mvm->radio_stats.on_time_scan; in iwl_mvm_accu_radio_stats()
738 bool iwl_mvm_rx_diversity_allowed(struct iwl_mvm *mvm) in iwl_mvm_rx_diversity_allowed() argument
742 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_diversity_allowed()
744 if (num_of_ant(iwl_mvm_get_valid_rx_ant(mvm)) == 1) in iwl_mvm_rx_diversity_allowed()
747 if (mvm->cfg->rx_with_siso_diversity) in iwl_mvm_rx_diversity_allowed()
751 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_rx_diversity_allowed()
757 void iwl_mvm_send_low_latency_cmd(struct iwl_mvm *mvm, in iwl_mvm_send_low_latency_cmd() argument
764 if (!fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_send_low_latency_cmd()
774 if (iwl_mvm_send_cmd_pdu(mvm, iwl_cmd_id(LOW_LATENCY_CMD, in iwl_mvm_send_low_latency_cmd()
777 IWL_ERR(mvm, "Failed to send low latency command\n"); in iwl_mvm_send_low_latency_cmd()
780 int iwl_mvm_update_low_latency(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_update_low_latency() argument
788 lockdep_assert_held(&mvm->mutex); in iwl_mvm_update_low_latency()
798 iwl_mvm_send_low_latency_cmd(mvm, low_latency, mvmvif->id); in iwl_mvm_update_low_latency()
800 res = iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_update_low_latency()
804 iwl_mvm_bt_coex_vif_change(mvm); in iwl_mvm_update_low_latency()
806 return iwl_mvm_power_update_mac(mvm); in iwl_mvm_update_low_latency()
831 bool iwl_mvm_low_latency(struct iwl_mvm *mvm) in iwl_mvm_low_latency() argument
836 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_low_latency()
842 bool iwl_mvm_low_latency_band(struct iwl_mvm *mvm, enum nl80211_band band) in iwl_mvm_low_latency_band() argument
847 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_low_latency_band()
874 struct ieee80211_vif *iwl_mvm_get_bss_vif(struct iwl_mvm *mvm) in iwl_mvm_get_bss_vif() argument
879 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_get_bss_vif()
883 IWL_ERR(mvm, "More than one managed interface active!\n"); in iwl_mvm_get_bss_vif()
906 bool iwl_mvm_is_vif_assoc(struct iwl_mvm *mvm) in iwl_mvm_is_vif_assoc() argument
912 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_is_vif_assoc()
919 unsigned int iwl_mvm_get_wd_timeout(struct iwl_mvm *mvm, in iwl_mvm_get_wd_timeout() argument
927 mvm->trans->trans_cfg->base_params->wd_timeout; in iwl_mvm_get_wd_timeout()
929 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS)) { in iwl_mvm_get_wd_timeout()
934 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_get_wd_timeout()
941 trigger = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_TXQ_TIMERS); in iwl_mvm_get_wd_timeout()
970 return mvm->trans->trans_cfg->base_params->wd_timeout; in iwl_mvm_get_wd_timeout()
974 void iwl_mvm_connection_loss(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_connection_loss() argument
980 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_connection_loss()
991 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, "%s", errmsg); in iwl_mvm_connection_loss()
997 void iwl_mvm_event_frame_timeout_callback(struct iwl_mvm *mvm, in iwl_mvm_event_frame_timeout_callback() argument
1005 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, ieee80211_vif_to_wdev(vif), in iwl_mvm_event_frame_timeout_callback()
1015 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_event_frame_timeout_callback()
1029 iwl_mvm_tcm_load(struct iwl_mvm *mvm, u32 airtime, unsigned long elapsed) in iwl_mvm_tcm_load() argument
1042 struct iwl_mvm *mvm; member
1049 struct iwl_mvm *mvm = data->mvm; in iwl_mvm_tcm_iter() local
1056 low_latency = mvm->tcm.result.low_latency[mvmvif->id]; in iwl_mvm_tcm_iter()
1058 if (!mvm->tcm.result.change[mvmvif->id] && in iwl_mvm_tcm_iter()
1060 iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_tcm_iter()
1066 iwl_mvm_update_low_latency(mvm, vif, low_latency, in iwl_mvm_tcm_iter()
1069 iwl_mvm_update_quotas(mvm, false, NULL); in iwl_mvm_tcm_iter()
1075 static void iwl_mvm_tcm_results(struct iwl_mvm *mvm) in iwl_mvm_tcm_results() argument
1078 .mvm = mvm, in iwl_mvm_tcm_results()
1082 mutex_lock(&mvm->mutex); in iwl_mvm_tcm_results()
1085 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_tcm_results()
1088 if (fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_UMAC_SCAN)) in iwl_mvm_tcm_results()
1089 iwl_mvm_config_scan(mvm); in iwl_mvm_tcm_results()
1091 mutex_unlock(&mvm->mutex); in iwl_mvm_tcm_results()
1096 struct iwl_mvm *mvm; in iwl_mvm_tcm_uapsd_nonagg_detected_wk() local
1103 mvm = mvmvif->mvm; in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1105 if (mvm->tcm.data[mvmvif->id].opened_rx_ba_sessions) in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1109 memcpy(mvm->uapsd_noagg_bssids[mvm->uapsd_noagg_bssid_write_idx].addr, in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1111 mvm->uapsd_noagg_bssid_write_idx++; in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1112 if (mvm->uapsd_noagg_bssid_write_idx >= IWL_MVM_UAPSD_NOAGG_LIST_LEN) in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1113 mvm->uapsd_noagg_bssid_write_idx = 0; in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1115 iwl_mvm_connection_loss(mvm, vif, in iwl_mvm_tcm_uapsd_nonagg_detected_wk()
1119 static void iwl_mvm_uapsd_agg_disconnect(struct iwl_mvm *mvm, in iwl_mvm_uapsd_agg_disconnect() argument
1136 if (mvm->tcm.data[mvmvif->id].uapsd_nonagg_detect.detected) in iwl_mvm_uapsd_agg_disconnect()
1139 mvm->tcm.data[mvmvif->id].uapsd_nonagg_detect.detected = true; in iwl_mvm_uapsd_agg_disconnect()
1140 IWL_INFO(mvm, in iwl_mvm_uapsd_agg_disconnect()
1145 static void iwl_mvm_check_uapsd_agg_expected_tpt(struct iwl_mvm *mvm, in iwl_mvm_check_uapsd_agg_expected_tpt() argument
1149 u64 bytes = mvm->tcm.data[mac].uapsd_nonagg_detect.rx_bytes; in iwl_mvm_check_uapsd_agg_expected_tpt()
1154 rate = ewma_rate_read(&mvm->tcm.data[mac].uapsd_nonagg_detect.rate); in iwl_mvm_check_uapsd_agg_expected_tpt()
1156 if (!rate || mvm->tcm.data[mac].opened_rx_ba_sessions || in iwl_mvm_check_uapsd_agg_expected_tpt()
1157 mvm->tcm.data[mac].uapsd_nonagg_detect.detected) in iwl_mvm_check_uapsd_agg_expected_tpt()
1160 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_check_uapsd_agg_expected_tpt()
1182 vif = rcu_dereference(mvm->vif_id_to_mac[mac]); in iwl_mvm_check_uapsd_agg_expected_tpt()
1184 iwl_mvm_uapsd_agg_disconnect(mvm, vif); in iwl_mvm_check_uapsd_agg_expected_tpt()
1200 static unsigned long iwl_mvm_calc_tcm_stats(struct iwl_mvm *mvm, in iwl_mvm_calc_tcm_stats() argument
1204 unsigned int elapsed = jiffies_to_msecs(ts - mvm->tcm.ts); in iwl_mvm_calc_tcm_stats()
1206 jiffies_to_msecs(ts - mvm->tcm.uapsd_nonagg_ts); in iwl_mvm_calc_tcm_stats()
1213 bool handle_ll = time_after(ts, mvm->tcm.ll_ts + MVM_LL_PERIOD); in iwl_mvm_calc_tcm_stats()
1216 mvm->tcm.ll_ts = ts; in iwl_mvm_calc_tcm_stats()
1218 mvm->tcm.uapsd_nonagg_ts = ts; in iwl_mvm_calc_tcm_stats()
1220 mvm->tcm.result.elapsed = elapsed; in iwl_mvm_calc_tcm_stats()
1222 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_calc_tcm_stats()
1228 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[mac]; in iwl_mvm_calc_tcm_stats()
1235 load = iwl_mvm_tcm_load(mvm, airtime, elapsed); in iwl_mvm_calc_tcm_stats()
1236 mvm->tcm.result.change[mac] = load != mvm->tcm.result.load[mac]; in iwl_mvm_calc_tcm_stats()
1237 mvm->tcm.result.load[mac] = load; in iwl_mvm_calc_tcm_stats()
1238 mvm->tcm.result.airtime[mac] = airtime; in iwl_mvm_calc_tcm_stats()
1246 mvm->tcm.result.low_latency[mac] = true; in iwl_mvm_calc_tcm_stats()
1248 mvm->tcm.result.low_latency[mac] = false; in iwl_mvm_calc_tcm_stats()
1255 low_latency |= mvm->tcm.result.low_latency[mac]; in iwl_mvm_calc_tcm_stats()
1257 if (!mvm->tcm.result.low_latency[mac] && handle_uapsd) in iwl_mvm_calc_tcm_stats()
1258 iwl_mvm_check_uapsd_agg_expected_tpt(mvm, uapsd_elapsed, in iwl_mvm_calc_tcm_stats()
1267 load = iwl_mvm_tcm_load(mvm, total_airtime, elapsed); in iwl_mvm_calc_tcm_stats()
1268 mvm->tcm.result.global_change = load != mvm->tcm.result.global_load; in iwl_mvm_calc_tcm_stats()
1269 mvm->tcm.result.global_load = load; in iwl_mvm_calc_tcm_stats()
1272 band_load = iwl_mvm_tcm_load(mvm, band_airtime[i], elapsed); in iwl_mvm_calc_tcm_stats()
1273 mvm->tcm.result.band_load[i] = band_load; in iwl_mvm_calc_tcm_stats()
1305 void iwl_mvm_recalc_tcm(struct iwl_mvm *mvm) in iwl_mvm_recalc_tcm() argument
1309 time_after(ts, mvm->tcm.uapsd_nonagg_ts + in iwl_mvm_recalc_tcm()
1312 spin_lock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1313 if (mvm->tcm.paused || !time_after(ts, mvm->tcm.ts + MVM_TCM_PERIOD)) { in iwl_mvm_recalc_tcm()
1314 spin_unlock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1317 spin_unlock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1319 if (handle_uapsd && iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_recalc_tcm()
1320 mutex_lock(&mvm->mutex); in iwl_mvm_recalc_tcm()
1321 if (iwl_mvm_request_statistics(mvm, true)) in iwl_mvm_recalc_tcm()
1323 mutex_unlock(&mvm->mutex); in iwl_mvm_recalc_tcm()
1326 spin_lock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1328 if (!mvm->tcm.paused && time_after(ts, mvm->tcm.ts + MVM_TCM_PERIOD)) { in iwl_mvm_recalc_tcm()
1330 unsigned long work_delay = iwl_mvm_calc_tcm_stats(mvm, ts, in iwl_mvm_recalc_tcm()
1335 mvm->tcm.ts = ts; in iwl_mvm_recalc_tcm()
1337 schedule_delayed_work(&mvm->tcm.work, work_delay); in iwl_mvm_recalc_tcm()
1339 spin_unlock(&mvm->tcm.lock); in iwl_mvm_recalc_tcm()
1341 iwl_mvm_tcm_results(mvm); in iwl_mvm_recalc_tcm()
1347 struct iwl_mvm *mvm = container_of(delayed_work, struct iwl_mvm, in iwl_mvm_tcm_work() local
1350 iwl_mvm_recalc_tcm(mvm); in iwl_mvm_tcm_work()
1353 void iwl_mvm_pause_tcm(struct iwl_mvm *mvm, bool with_cancel) in iwl_mvm_pause_tcm() argument
1355 spin_lock_bh(&mvm->tcm.lock); in iwl_mvm_pause_tcm()
1356 mvm->tcm.paused = true; in iwl_mvm_pause_tcm()
1357 spin_unlock_bh(&mvm->tcm.lock); in iwl_mvm_pause_tcm()
1359 cancel_delayed_work_sync(&mvm->tcm.work); in iwl_mvm_pause_tcm()
1362 void iwl_mvm_resume_tcm(struct iwl_mvm *mvm) in iwl_mvm_resume_tcm() argument
1367 spin_lock_bh(&mvm->tcm.lock); in iwl_mvm_resume_tcm()
1368 mvm->tcm.ts = jiffies; in iwl_mvm_resume_tcm()
1369 mvm->tcm.ll_ts = jiffies; in iwl_mvm_resume_tcm()
1371 struct iwl_mvm_tcm_mac *mdata = &mvm->tcm.data[mac]; in iwl_mvm_resume_tcm()
1378 if (mvm->tcm.result.low_latency[mac]) in iwl_mvm_resume_tcm()
1383 mvm->tcm.paused = false; in iwl_mvm_resume_tcm()
1389 if (mvm->tcm.result.global_load > IWL_MVM_TRAFFIC_LOW) in iwl_mvm_resume_tcm()
1390 schedule_delayed_work(&mvm->tcm.work, MVM_TCM_PERIOD); in iwl_mvm_resume_tcm()
1392 schedule_delayed_work(&mvm->tcm.work, MVM_LL_PERIOD); in iwl_mvm_resume_tcm()
1394 spin_unlock_bh(&mvm->tcm.lock); in iwl_mvm_resume_tcm()
1397 void iwl_mvm_tcm_add_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tcm_add_vif() argument
1405 void iwl_mvm_tcm_rm_vif(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tcm_rm_vif() argument
1412 u32 iwl_mvm_get_systime(struct iwl_mvm *mvm) in iwl_mvm_get_systime() argument
1416 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000 && in iwl_mvm_get_systime()
1417 mvm->trans->cfg->gp2_reg_addr) in iwl_mvm_get_systime()
1418 reg_addr = mvm->trans->cfg->gp2_reg_addr; in iwl_mvm_get_systime()
1420 return iwl_read_prph(mvm->trans, reg_addr); in iwl_mvm_get_systime()
1423 void iwl_mvm_get_sync_time(struct iwl_mvm *mvm, u32 *gp2, u64 *boottime) in iwl_mvm_get_sync_time() argument
1427 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_sync_time()
1430 ps_disabled = mvm->ps_disabled; in iwl_mvm_get_sync_time()
1432 mvm->ps_disabled = true; in iwl_mvm_get_sync_time()
1433 iwl_mvm_power_update_device(mvm); in iwl_mvm_get_sync_time()
1436 *gp2 = iwl_mvm_get_systime(mvm); in iwl_mvm_get_sync_time()
1440 mvm->ps_disabled = ps_disabled; in iwl_mvm_get_sync_time()
1441 iwl_mvm_power_update_device(mvm); in iwl_mvm_get_sync_time()