Lines Matching refs:mvm
23 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_set_rekey_data() local
26 mutex_lock(&mvm->mutex); in iwl_mvm_set_rekey_data()
37 mutex_unlock(&mvm->mutex); in iwl_mvm_set_rekey_data()
115 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_program_keys() local
155 mutex_lock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
156 ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, 0, sizeof(wkc), &wkc); in iwl_mvm_wowlan_program_keys()
159 mvm->ptk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
160 mvm->ptk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
161 mvm->gtk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
162 mvm->gtk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
163 mutex_unlock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
190 mutex_lock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
196 mvm->ptk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
197 mvm->ptk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
198 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 0); in iwl_mvm_wowlan_program_keys()
206 mvm->gtk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
207 mvm->gtk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
208 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 1); in iwl_mvm_wowlan_program_keys()
210 mutex_unlock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
225 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_get_rsc_tsc_data() local
288 if (sta && iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_wowlan_get_rsc_tsc_data()
303 mvm->trans->num_rx_queues); in iwl_mvm_wowlan_get_rsc_tsc_data()
344 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_get_rsc_v5_data() local
424 mvm->trans->num_rx_queues); in iwl_mvm_wowlan_get_rsc_v5_data()
452 static int iwl_mvm_wowlan_config_rsc_tsc(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config_rsc_tsc() argument
456 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_TSC_RSC_PARAM, in iwl_mvm_wowlan_config_rsc_tsc()
473 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_wowlan_config_rsc_tsc()
478 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_TSC_RSC_PARAM, in iwl_mvm_wowlan_config_rsc_tsc()
501 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_wowlan_config_rsc_tsc()
506 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_TSC_RSC_PARAM, in iwl_mvm_wowlan_config_rsc_tsc()
637 static int iwl_mvm_send_patterns_v1(struct iwl_mvm *mvm, in iwl_mvm_send_patterns_v1() argument
672 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_patterns_v1()
677 static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, in iwl_mvm_send_patterns() argument
687 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, in iwl_mvm_send_patterns()
721 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_patterns()
726 static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_d3_reprogram() argument
739 if (WARN_ON_ONCE(iwl_mvm_is_cdb_supported(mvm) || in iwl_mvm_d3_reprogram()
759 ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, &chandef, in iwl_mvm_d3_reprogram()
770 ret = iwl_mvm_mac_ctxt_add(mvm, vif); in iwl_mvm_d3_reprogram()
788 ret = iwl_mvm_send_cmd_pdu_status(mvm, BINDING_CONTEXT_CMD, in iwl_mvm_d3_reprogram()
792 IWL_ERR(mvm, "Failed to add binding: %d\n", ret); in iwl_mvm_d3_reprogram()
797 IWL_ERR(mvm, "Binding command failed: %u\n", status); in iwl_mvm_d3_reprogram()
801 ret = iwl_mvm_sta_send_to_fw(mvm, ap_sta, false, 0); in iwl_mvm_d3_reprogram()
804 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->deflink.ap_sta_id], in iwl_mvm_d3_reprogram()
807 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_d3_reprogram()
812 quota = iwl_mvm_quota_cmd_get_quota(mvm, "a_cmd, 0); in iwl_mvm_d3_reprogram()
820 quota = iwl_mvm_quota_cmd_get_quota(mvm, "a_cmd, i); in iwl_mvm_d3_reprogram()
824 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, in iwl_mvm_d3_reprogram()
825 iwl_mvm_quota_cmd_size(mvm), "a_cmd); in iwl_mvm_d3_reprogram()
827 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); in iwl_mvm_d3_reprogram()
829 if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm, false)) in iwl_mvm_d3_reprogram()
830 IWL_ERR(mvm, "Failed to initialize D3 LAR information\n"); in iwl_mvm_d3_reprogram()
835 static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm, in iwl_mvm_get_last_nonqos_seq() argument
855 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_get_last_nonqos_seq()
872 void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_set_last_nonqos_seq() argument
889 if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, 0, in iwl_mvm_set_last_nonqos_seq()
891 IWL_ERR(mvm, "failed to set non-QoS seqno\n"); in iwl_mvm_set_last_nonqos_seq()
894 static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm) in iwl_mvm_switch_to_d3() argument
896 iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true); in iwl_mvm_switch_to_d3()
898 iwl_mvm_stop_device(mvm); in iwl_mvm_switch_to_d3()
909 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_switch_to_d3()
912 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_switch_to_d3()
914 mvm->ptk_ivlen = 0; in iwl_mvm_switch_to_d3()
915 mvm->ptk_icvlen = 0; in iwl_mvm_switch_to_d3()
916 mvm->ptk_ivlen = 0; in iwl_mvm_switch_to_d3()
917 mvm->ptk_icvlen = 0; in iwl_mvm_switch_to_d3()
919 return iwl_mvm_load_d3_fw(mvm); in iwl_mvm_switch_to_d3()
923 iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm, in iwl_mvm_get_wowlan_config() argument
941 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_CONFIGURATION, 0) < 6) { in iwl_mvm_get_wowlan_config()
943 int ret = iwl_mvm_get_last_nonqos_seq(mvm, vif); in iwl_mvm_get_wowlan_config()
951 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_CONFIGURATION, 0) < 7) in iwl_mvm_get_wowlan_config()
1001 static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config_key_params() argument
1005 bool unified = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config_key_params()
1025 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_program_keys, in iwl_mvm_wowlan_config_key_params()
1032 ret = iwl_mvm_wowlan_config_rsc_tsc(mvm, vif, mvm_link); in iwl_mvm_wowlan_config_key_params()
1036 if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config_key_params()
1038 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_TKIP_PARAM, in iwl_mvm_wowlan_config_key_params()
1054 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_get_tkip_data, in iwl_mvm_wowlan_config_key_params()
1059 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_wowlan_config_key_params()
1077 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_wowlan_config_key_params()
1084 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_gtk_type_iter, in iwl_mvm_wowlan_config_key_params()
1111 IWL_DEBUG_WOWLAN(mvm, "setting akm %d\n", in iwl_mvm_wowlan_config_key_params()
1114 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_KEK_KCK_MATERIAL, in iwl_mvm_wowlan_config_key_params()
1124 iwl_mvm_wowlan_config(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config() argument
1132 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config()
1135 mvm->offload_tid = wowlan_config_cmd_v6->offloading_tid; in iwl_mvm_wowlan_config()
1138 ret = iwl_mvm_switch_to_d3(mvm); in iwl_mvm_wowlan_config()
1142 ret = iwl_mvm_d3_reprogram(mvm, vif, ap_sta); in iwl_mvm_wowlan_config()
1147 ret = iwl_mvm_wowlan_config_key_params(mvm, vif, mvm_link); in iwl_mvm_wowlan_config()
1151 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_CONFIGURATION, 0) > 6) { in iwl_mvm_wowlan_config()
1163 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, in iwl_mvm_wowlan_config()
1167 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, in iwl_mvm_wowlan_config()
1174 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config()
1176 ret = iwl_mvm_send_patterns(mvm, mvm_link, wowlan); in iwl_mvm_wowlan_config()
1178 ret = iwl_mvm_send_patterns_v1(mvm, wowlan); in iwl_mvm_wowlan_config()
1182 return iwl_mvm_send_proto_offload(mvm, vif, false, true, 0, in iwl_mvm_wowlan_config()
1187 iwl_mvm_netdetect_config(struct iwl_mvm *mvm, in iwl_mvm_netdetect_config() argument
1193 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_netdetect_config()
1197 ret = iwl_mvm_switch_to_d3(mvm); in iwl_mvm_netdetect_config()
1206 ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true); in iwl_mvm_netdetect_config()
1211 ret = iwl_mvm_sched_scan_start(mvm, vif, nd_config, &mvm->nd_ies, in iwl_mvm_netdetect_config()
1216 if (WARN_ON(mvm->nd_match_sets || mvm->nd_channels)) in iwl_mvm_netdetect_config()
1221 mvm->nd_match_sets = kmemdup(nd_config->match_sets, in iwl_mvm_netdetect_config()
1225 if (mvm->nd_match_sets) in iwl_mvm_netdetect_config()
1226 mvm->n_nd_match_sets = nd_config->n_match_sets; in iwl_mvm_netdetect_config()
1230 mvm->nd_channels = kmemdup(nd_config->channels, in iwl_mvm_netdetect_config()
1234 if (mvm->nd_channels) in iwl_mvm_netdetect_config()
1235 mvm->n_nd_channels = nd_config->n_channels; in iwl_mvm_netdetect_config()
1240 static void iwl_mvm_free_nd(struct iwl_mvm *mvm) in iwl_mvm_free_nd() argument
1242 kfree(mvm->nd_match_sets); in iwl_mvm_free_nd()
1243 mvm->nd_match_sets = NULL; in iwl_mvm_free_nd()
1244 mvm->n_nd_match_sets = 0; in iwl_mvm_free_nd()
1245 kfree(mvm->nd_channels); in iwl_mvm_free_nd()
1246 mvm->nd_channels = NULL; in iwl_mvm_free_nd()
1247 mvm->n_nd_channels = 0; in iwl_mvm_free_nd()
1254 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in __iwl_mvm_suspend() local
1275 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_suspend()
1287 vif = iwl_mvm_get_bss_vif(mvm); in __iwl_mvm_suspend()
1291 ret = iwl_mvm_block_esr_sync(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN); in __iwl_mvm_suspend()
1295 mutex_lock(&mvm->mutex); in __iwl_mvm_suspend()
1297 set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in __iwl_mvm_suspend()
1317 mvm, wowlan, wowlan->nd_config, vif); in __iwl_mvm_suspend()
1321 mvm->net_detect = true; in __iwl_mvm_suspend()
1330 mvm->fw_id_to_mac_id[mvm_link->ap_sta_id], in __iwl_mvm_suspend()
1331 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_suspend()
1338 mvm, ap_sta->txq[wowlan_config_cmd.offloading_tid]); in __iwl_mvm_suspend()
1342 ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd, in __iwl_mvm_suspend()
1346 ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd, in __iwl_mvm_suspend()
1351 mvm->net_detect = false; in __iwl_mvm_suspend()
1354 ret = iwl_mvm_power_update_device(mvm); in __iwl_mvm_suspend()
1358 ret = iwl_mvm_power_update_mac(mvm); in __iwl_mvm_suspend()
1363 if (mvm->d3_wake_sysassert) in __iwl_mvm_suspend()
1373 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_9000) in __iwl_mvm_suspend()
1374 iwl_fw_dbg_stop_restart_recording(&mvm->fwrt, NULL, true); in __iwl_mvm_suspend()
1376 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_D3; in __iwl_mvm_suspend()
1379 ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd); in __iwl_mvm_suspend()
1385 mvm->d3_test_pme_ptr = in __iwl_mvm_suspend()
1391 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_suspend()
1393 ret = iwl_trans_d3_suspend(mvm->trans, test, !unified_image); in __iwl_mvm_suspend()
1396 iwl_mvm_free_nd(mvm); in __iwl_mvm_suspend()
1398 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in __iwl_mvm_suspend()
1401 mutex_unlock(&mvm->mutex); in __iwl_mvm_suspend()
1408 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_suspend() local
1410 iwl_mvm_pause_tcm(mvm, true); in iwl_mvm_suspend()
1412 mutex_lock(&mvm->mutex); in iwl_mvm_suspend()
1413 iwl_fw_runtime_suspend(&mvm->fwrt); in iwl_mvm_suspend()
1414 mutex_unlock(&mvm->mutex); in iwl_mvm_suspend()
1486 static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_report_wakeup_reasons() argument
1502 pm_wakeup_event(mvm->dev, 0); in iwl_mvm_report_wakeup_reasons()
1571 ivlen = mvm->gtk_ivlen; in iwl_mvm_report_wakeup_reasons()
1572 icvlen += mvm->gtk_icvlen; in iwl_mvm_report_wakeup_reasons()
1574 ivlen = mvm->ptk_ivlen; in iwl_mvm_report_wakeup_reasons()
1575 icvlen += mvm->ptk_icvlen; in iwl_mvm_report_wakeup_reasons()
1664 static void iwl_mvm_set_aes_ptk_rx_seq(struct iwl_mvm *mvm, in iwl_mvm_set_aes_ptk_rx_seq() argument
1675 if (!iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_set_aes_ptk_rx_seq()
1689 for (i = 1; i < mvm->trans->num_rx_queues; i++) in iwl_mvm_set_aes_ptk_rx_seq()
1827 struct iwl_mvm *mvm; member
1951 iwl_mvm_set_aes_ptk_rx_seq(data->mvm, status, sta, key); in iwl_mvm_d3_update_keys()
2045 struct iwl_mvm *mvm) in iwl_mvm_mlo_gtk_rekey() argument
2051 IWL_DEBUG_WOWLAN(mvm, "Num of MLO Keys: %d\n", status->num_mlo_keys); in iwl_mvm_mlo_gtk_rekey()
2060 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_mlo_key_ciphers, old_keys); in iwl_mvm_mlo_gtk_rekey()
2123 IWL_DEBUG_WOWLAN(mvm, in iwl_mvm_mlo_gtk_rekey()
2129 IWL_DEBUG_WOWLAN(mvm, "Add MLO key id %d, link id %d\n", in iwl_mvm_mlo_gtk_rekey()
2157 struct iwl_mvm *mvm, u32 gtk_cipher) in iwl_mvm_gtk_rekey() argument
2195 IWL_DEBUG_WOWLAN(mvm, in iwl_mvm_gtk_rekey()
2275 static int iwl_mvm_lookup_wowlan_status_ver(struct iwl_mvm *mvm) in iwl_mvm_lookup_wowlan_status_ver() argument
2279 if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_lookup_wowlan_status_ver()
2284 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, in iwl_mvm_lookup_wowlan_status_ver()
2287 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, in iwl_mvm_lookup_wowlan_status_ver()
2293 static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, in iwl_mvm_setup_connection_keep() argument
2299 .mvm = mvm, in iwl_mvm_setup_connection_keep()
2310 if (iwl_mvm_lookup_wowlan_status_ver(mvm) > 6 || in iwl_mvm_setup_connection_keep()
2311 iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_setup_connection_keep()
2316 if (iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_setup_connection_keep()
2322 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_setup_connection_keep()
2334 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_setup_connection_keep()
2340 IWL_DEBUG_WOWLAN(mvm, "num of GTK rekeying %d\n", in iwl_mvm_setup_connection_keep()
2343 if (!iwl_mvm_gtk_rekey(status, vif, mvm, gtkdata.gtk_cipher)) in iwl_mvm_setup_connection_keep()
2358 if (!iwl_mvm_mlo_gtk_rekey(status, vif, mvm)) in iwl_mvm_setup_connection_keep()
2366 if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, in iwl_mvm_setup_connection_keep()
2486 static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm, in iwl_mvm_parse_wowlan_info_notif() argument
2495 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n"); in iwl_mvm_parse_wowlan_info_notif()
2500 if (mvm->fast_resume) in iwl_mvm_parse_wowlan_info_notif()
2510 if (IWL_FW_CHECK(mvm, in iwl_mvm_parse_wowlan_info_notif()
2526 if (IWL_FW_CHECK(mvm, in iwl_mvm_parse_wowlan_info_notif()
2537 iwl_mvm_parse_wowlan_info_notif_v4(struct iwl_mvm *mvm, in iwl_mvm_parse_wowlan_info_notif_v4() argument
2550 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n"); in iwl_mvm_parse_wowlan_info_notif_v4()
2555 if (mvm->fast_resume) in iwl_mvm_parse_wowlan_info_notif_v4()
2575 if (IWL_FW_CHECK(mvm, in iwl_mvm_parse_wowlan_info_notif_v4()
2586 iwl_mvm_parse_wowlan_info_notif_v2(struct iwl_mvm *mvm, in iwl_mvm_parse_wowlan_info_notif_v2() argument
2594 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n"); in iwl_mvm_parse_wowlan_info_notif_v2()
2617 iwl_mvm_parse_wowlan_status_common_ ## _ver(struct iwl_mvm *mvm, \
2625 IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); \
2631 IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); \
2676 iwl_mvm_send_wowlan_get_status(struct iwl_mvm *mvm, u8 sta_id) in iwl_mvm_parse_wowlan_status_common()
2690 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, in iwl_mvm_parse_wowlan_status_common()
2696 lockdep_assert_held(&mvm->mutex); in iwl_mvm_parse_wowlan_status_common()
2698 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_parse_wowlan_status_common()
2700 IWL_ERR(mvm, "failed to query wakeup status (%d)\n", ret); in iwl_mvm_parse_wowlan_status_common()
2707 notif_ver = iwl_mvm_lookup_wowlan_status_ver(mvm); in iwl_mvm_parse_wowlan_status_common()
2712 status = iwl_mvm_parse_wowlan_status_common_v6(mvm, v6, len); in iwl_mvm_parse_wowlan_status_common()
2743 status = iwl_mvm_parse_wowlan_status_common_v7(mvm, v7, len); in iwl_mvm_parse_wowlan_status_common()
2756 status = iwl_mvm_parse_wowlan_status_common_v9(mvm, v9, len); in iwl_mvm_parse_wowlan_status_common()
2768 status = iwl_mvm_parse_wowlan_status_common_v12(mvm, v12, len); in iwl_mvm_parse_wowlan_status_common()
2778 IWL_ERR(mvm, in iwl_mvm_parse_wowlan_status_common()
2790 static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_query_wakeup_reasons() argument
2800 int wowlan_info_ver = iwl_fw_lookup_notif_ver(mvm->fw, in iwl_mvm_query_wakeup_reasons()
2811 IWL_DEBUG_WOWLAN(mvm, "wakeup reason 0x%x\n", in iwl_mvm_query_wakeup_reasons()
2814 mvm_ap_sta = iwl_mvm_sta_from_staid_protected(mvm, mvm_link->ap_sta_id); in iwl_mvm_query_wakeup_reasons()
2828 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { in iwl_mvm_query_wakeup_reasons()
2829 i = mvm->offload_tid; in iwl_mvm_query_wakeup_reasons()
2830 iwl_trans_set_q_ptrs(mvm->trans, in iwl_mvm_query_wakeup_reasons()
2835 iwl_mvm_report_wakeup_reasons(mvm, vif, status); in iwl_mvm_query_wakeup_reasons()
2837 keep = iwl_mvm_setup_connection_keep(mvm, vif, status); in iwl_mvm_query_wakeup_reasons()
2839 mutex_unlock(&mvm->mutex); in iwl_mvm_query_wakeup_reasons()
2852 iwl_mvm_netdetect_query_results(struct iwl_mvm *mvm, in iwl_mvm_netdetect_query_results() argument
2862 int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_netdetect_query_results()
2864 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_netdetect_query_results()
2866 IWL_ERR(mvm, "failed to query matched profiles (%d)\n", ret); in iwl_mvm_netdetect_query_results()
2870 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_netdetect_query_results()
2883 IWL_ERR(mvm, "Invalid scan offload profiles query response!\n"); in iwl_mvm_netdetect_query_results()
2894 mvm->last_netdetect_scans = le32_to_cpu(query->n_scans_done); in iwl_mvm_netdetect_query_results()
2902 static int iwl_mvm_query_num_match_chans(struct iwl_mvm *mvm, in iwl_mvm_query_num_match_chans() argument
2908 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_query_num_match_chans()
2926 static void iwl_mvm_query_set_freqs(struct iwl_mvm *mvm, in iwl_mvm_query_set_freqs() argument
2934 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_query_set_freqs()
2942 mvm->nd_channels[i]->center_freq; in iwl_mvm_query_set_freqs()
2950 mvm->nd_channels[i]->center_freq; in iwl_mvm_query_set_freqs()
2983 static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, in iwl_mvm_query_netdetect_reasons() argument
3007 if (!iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_query_netdetect_reasons()
3009 IWL_INFO(mvm, "Query FW for ND results\n"); in iwl_mvm_query_netdetect_reasons()
3010 ret = iwl_mvm_netdetect_query_results(mvm, d3_data->nd_results); in iwl_mvm_query_netdetect_reasons()
3013 IWL_INFO(mvm, "Notification based ND results\n"); in iwl_mvm_query_netdetect_reasons()
3023 if (mvm->n_nd_match_sets) { in iwl_mvm_query_netdetect_reasons()
3026 IWL_ERR(mvm, "no net detect match information available\n"); in iwl_mvm_query_netdetect_reasons()
3037 for_each_set_bit(i, &matched_profiles, mvm->n_nd_match_sets) { in iwl_mvm_query_netdetect_reasons()
3041 n_channels = iwl_mvm_query_num_match_chans(mvm, in iwl_mvm_query_netdetect_reasons()
3056 idx = mvm->n_nd_match_sets - i - 1; in iwl_mvm_query_netdetect_reasons()
3057 match->ssid.ssid_len = mvm->nd_match_sets[idx].ssid.ssid_len; in iwl_mvm_query_netdetect_reasons()
3058 memcpy(match->ssid.ssid, mvm->nd_match_sets[idx].ssid.ssid, in iwl_mvm_query_netdetect_reasons()
3061 if (mvm->n_nd_channels < n_channels) in iwl_mvm_query_netdetect_reasons()
3064 iwl_mvm_query_set_freqs(mvm, d3_data->nd_results, match, i); in iwl_mvm_query_netdetect_reasons()
3072 iwl_mvm_free_nd(mvm); in iwl_mvm_query_netdetect_reasons()
3074 mutex_unlock(&mvm->mutex); in iwl_mvm_query_netdetect_reasons()
3101 static enum rt_status iwl_mvm_check_rt_status(struct iwl_mvm *mvm, in iwl_mvm_check_rt_status() argument
3107 if (iwl_fwrt_read_err_table(mvm->trans, in iwl_mvm_check_rt_status()
3108 mvm->trans->dbg.lmac_error_event_table[0], in iwl_mvm_check_rt_status()
3111 IWL_WARN(mvm, "Rfkill was toggled during suspend\n"); in iwl_mvm_check_rt_status()
3127 if (iwl_fwrt_read_err_table(mvm->trans, in iwl_mvm_check_rt_status()
3128 mvm->trans->dbg.lmac_error_event_table[1], in iwl_mvm_check_rt_status()
3133 if (iwl_fwrt_read_err_table(mvm->trans, in iwl_mvm_check_rt_status()
3134 mvm->trans->dbg.umac_error_event_table, in iwl_mvm_check_rt_status()
3147 iwl_mvm_choose_query_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_choose_query_wakeup_reasons() argument
3151 lockdep_assert_held(&mvm->mutex); in iwl_mvm_choose_query_wakeup_reasons()
3156 u8 sta_id = mvm->net_detect ? IWL_INVALID_STA : in iwl_mvm_choose_query_wakeup_reasons()
3162 d3_data->status = iwl_mvm_send_wowlan_get_status(mvm, sta_id); in iwl_mvm_choose_query_wakeup_reasons()
3165 if (mvm->net_detect) { in iwl_mvm_choose_query_wakeup_reasons()
3166 iwl_mvm_query_netdetect_reasons(mvm, vif, d3_data); in iwl_mvm_choose_query_wakeup_reasons()
3168 bool keep = iwl_mvm_query_wakeup_reasons(mvm, vif, in iwl_mvm_choose_query_wakeup_reasons()
3173 mvm->keep_vif = vif; in iwl_mvm_choose_query_wakeup_reasons()
3188 static int iwl_mvm_wowlan_store_wake_pkt(struct iwl_mvm *mvm, in iwl_mvm_wowlan_store_wake_pkt() argument
3196 IWL_ERR(mvm, "Invalid WoWLAN wake packet notification!\n"); in iwl_mvm_wowlan_store_wake_pkt()
3201 IWL_ERR(mvm, "Got wake packet notification but wowlan status data is NULL\n"); in iwl_mvm_wowlan_store_wake_pkt()
3207 IWL_ERR(mvm, "Got wakeup packet but wakeup reason is %x\n", in iwl_mvm_wowlan_store_wake_pkt()
3230 static void iwl_mvm_nd_match_info_handler(struct iwl_mvm *mvm, in iwl_mvm_nd_match_info_handler() argument
3236 struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); in iwl_mvm_nd_match_info_handler()
3239 iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_nd_match_info_handler()
3245 IWL_ERR(mvm, "Invalid scan match info notification\n"); in iwl_mvm_nd_match_info_handler()
3249 if (!mvm->net_detect) { in iwl_mvm_nd_match_info_handler()
3250 IWL_ERR(mvm, "Unexpected scan match info notification\n"); in iwl_mvm_nd_match_info_handler()
3255 IWL_ERR(mvm, in iwl_mvm_nd_match_info_handler()
3261 mvm->last_netdetect_scans = le32_to_cpu(notif->n_scans_done); in iwl_mvm_nd_match_info_handler()
3265 IWL_INFO(mvm, "number of matched profiles=%u\n", in iwl_mvm_nd_match_info_handler()
3274 mvm->scan_status = 0; in iwl_mvm_nd_match_info_handler()
3275 for (i = 0; i < mvm->max_scans; i++) in iwl_mvm_nd_match_info_handler()
3276 mvm->scan_uid_status[i] = 0; in iwl_mvm_nd_match_info_handler()
3282 struct iwl_mvm *mvm = in iwl_mvm_wait_d3_notif() local
3287 int wowlan_info_ver = iwl_fw_lookup_notif_ver(mvm->fw, in iwl_mvm_wait_d3_notif()
3298 IWL_DEBUG_WOWLAN(mvm, in iwl_mvm_wait_d3_notif()
3316 iwl_mvm_parse_wowlan_info_notif_v2(mvm, notif_v2, in iwl_mvm_wait_d3_notif()
3325 iwl_mvm_parse_wowlan_info_notif_v2(mvm, notif_v2, in iwl_mvm_wait_d3_notif()
3332 iwl_mvm_parse_wowlan_info_notif_v4(mvm, notif, in iwl_mvm_wait_d3_notif()
3339 iwl_mvm_parse_wowlan_info_notif(mvm, notif, in iwl_mvm_wait_d3_notif()
3357 IWL_ERR(mvm, in iwl_mvm_wait_d3_notif()
3362 ret = iwl_mvm_wowlan_store_wake_pkt(mvm, notif, in iwl_mvm_wait_d3_notif()
3366 IWL_ERR(mvm, in iwl_mvm_wait_d3_notif()
3376 IWL_ERR(mvm, in iwl_mvm_wait_d3_notif()
3387 iwl_mvm_nd_match_info_handler(mvm, d3_data, notif, len); in iwl_mvm_wait_d3_notif()
3405 static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test) in iwl_mvm_resume_firmware() argument
3413 bool reset = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_resume_firmware()
3416 ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test, !reset); in iwl_mvm_resume_firmware()
3421 IWL_INFO(mvm, "Device was reset during suspend\n"); in iwl_mvm_resume_firmware()
3430 if (mvm->trans->trans_cfg->device_family <= IWL_DEVICE_FAMILY_22000 && in iwl_mvm_resume_firmware()
3431 fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_D0I3_END_FIRST)) { in iwl_mvm_resume_firmware()
3432 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_resume_firmware()
3434 IWL_ERR(mvm, "Failed to send D0I3_END_CMD first (%d)\n", in iwl_mvm_resume_firmware()
3443 static int iwl_mvm_d3_notif_wait(struct iwl_mvm *mvm, in iwl_mvm_d3_notif_wait() argument
3458 if (mvm->fast_resume) in iwl_mvm_d3_notif_wait()
3459 iwl_init_notification_wait(&mvm->notif_wait, &wait_d3_notif, in iwl_mvm_d3_notif_wait()
3464 iwl_init_notification_wait(&mvm->notif_wait, &wait_d3_notif, in iwl_mvm_d3_notif_wait()
3469 ret = iwl_mvm_resume_firmware(mvm, d3_data->test); in iwl_mvm_d3_notif_wait()
3471 iwl_remove_notification(&mvm->notif_wait, &wait_d3_notif); in iwl_mvm_d3_notif_wait()
3475 return iwl_wait_notification(&mvm->notif_wait, &wait_d3_notif, in iwl_mvm_d3_notif_wait()
3479 static inline bool iwl_mvm_d3_resume_notif_based(struct iwl_mvm *mvm) in iwl_mvm_d3_resume_notif_based() argument
3481 return iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_d3_resume_notif_based()
3483 iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_d3_resume_notif_based()
3485 iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_d3_resume_notif_based()
3489 static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) in __iwl_mvm_resume() argument
3502 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_resume()
3504 bool d0i3_first = fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_resume()
3506 bool resume_notif_based = iwl_mvm_d3_resume_notif_based(mvm); in __iwl_mvm_resume()
3510 mutex_lock(&mvm->mutex); in __iwl_mvm_resume()
3516 if (!test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status)) { in __iwl_mvm_resume()
3517 IWL_INFO(mvm, in __iwl_mvm_resume()
3522 mvm->last_reset_or_resume_time_jiffies = jiffies; in __iwl_mvm_resume()
3525 vif = iwl_mvm_get_bss_vif(mvm); in __iwl_mvm_resume()
3529 iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); in __iwl_mvm_resume()
3531 rt_status = iwl_mvm_check_rt_status(mvm, vif); in __iwl_mvm_resume()
3533 set_bit(STATUS_FW_ERROR, &mvm->trans->status); in __iwl_mvm_resume()
3535 IWL_ERR(mvm, "FW Error occurred during suspend. Restarting.\n"); in __iwl_mvm_resume()
3536 iwl_mvm_dump_nic_error_log(mvm); in __iwl_mvm_resume()
3537 iwl_dbg_tlv_time_point(&mvm->fwrt, in __iwl_mvm_resume()
3540 iwl_fw_dbg_collect_desc(&mvm->fwrt, in __iwl_mvm_resume()
3551 IWL_ERR(mvm, "Failed to allocate wowlan status\n"); in __iwl_mvm_resume()
3556 ret = iwl_mvm_d3_notif_wait(mvm, &d3_data); in __iwl_mvm_resume()
3560 ret = iwl_mvm_resume_firmware(mvm, test); in __iwl_mvm_resume()
3565 iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN); in __iwl_mvm_resume()
3568 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in __iwl_mvm_resume()
3578 iwl_mvm_update_changed_regdom(mvm); in __iwl_mvm_resume()
3581 iwl_mvm_ppag_send_cmd(mvm); in __iwl_mvm_resume()
3585 iwl_mvm_sar_select_profile(mvm, 1, 1); in __iwl_mvm_resume()
3587 if (mvm->net_detect && unified_image) { in __iwl_mvm_resume()
3594 ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_NETDETECT, in __iwl_mvm_resume()
3599 keep = iwl_mvm_choose_query_wakeup_reasons(mvm, vif, &d3_data); in __iwl_mvm_resume()
3604 mutex_unlock(&mvm->mutex); in __iwl_mvm_resume()
3609 iwl_mvm_free_nd(mvm); in __iwl_mvm_resume()
3611 if (!d3_data.test && !mvm->net_detect) in __iwl_mvm_resume()
3612 ieee80211_iterate_active_interfaces_mtx(mvm->hw, in __iwl_mvm_resume()
3617 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in __iwl_mvm_resume()
3625 if (!iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in __iwl_mvm_resume()
3627 ret = iwl_mvm_send_cmd_pdu(mvm, D0I3_END_CMD, 0, 0, NULL); in __iwl_mvm_resume()
3640 set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in __iwl_mvm_resume()
3643 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in __iwl_mvm_resume()
3650 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_resume() local
3653 ret = __iwl_mvm_resume(mvm, false); in iwl_mvm_resume()
3655 iwl_mvm_resume_tcm(mvm); in iwl_mvm_resume()
3657 iwl_fw_runtime_resume(&mvm->fwrt); in iwl_mvm_resume()
3664 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_set_wakeup() local
3666 device_set_wakeup_enable(mvm->trans->dev, enabled); in iwl_mvm_set_wakeup()
3669 void iwl_mvm_fast_suspend(struct iwl_mvm *mvm) in iwl_mvm_fast_suspend() argument
3674 lockdep_assert_held(&mvm->mutex); in iwl_mvm_fast_suspend()
3676 IWL_DEBUG_WOWLAN(mvm, "Starting fast suspend flow\n"); in iwl_mvm_fast_suspend()
3678 mvm->fast_resume = true; in iwl_mvm_fast_suspend()
3679 set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in iwl_mvm_fast_suspend()
3681 WARN_ON(iwl_mvm_power_update_device(mvm)); in iwl_mvm_fast_suspend()
3682 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_D3; in iwl_mvm_fast_suspend()
3683 ret = iwl_mvm_send_cmd_pdu(mvm, D3_CONFIG_CMD, CMD_SEND_IN_D3, in iwl_mvm_fast_suspend()
3686 IWL_ERR(mvm, in iwl_mvm_fast_suspend()
3689 ret = iwl_trans_d3_suspend(mvm->trans, false, false); in iwl_mvm_fast_suspend()
3691 IWL_ERR(mvm, "fast suspend: trans_d3_suspend failed %d\n", ret); in iwl_mvm_fast_suspend()
3694 int iwl_mvm_fast_resume(struct iwl_mvm *mvm) in iwl_mvm_fast_resume() argument
3703 lockdep_assert_held(&mvm->mutex); in iwl_mvm_fast_resume()
3705 IWL_DEBUG_WOWLAN(mvm, "Starting the fast resume flow\n"); in iwl_mvm_fast_resume()
3707 mvm->last_reset_or_resume_time_jiffies = jiffies; in iwl_mvm_fast_resume()
3708 iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); in iwl_mvm_fast_resume()
3710 rt_status = iwl_mvm_check_rt_status(mvm, NULL); in iwl_mvm_fast_resume()
3712 set_bit(STATUS_FW_ERROR, &mvm->trans->status); in iwl_mvm_fast_resume()
3714 IWL_ERR(mvm, in iwl_mvm_fast_resume()
3716 iwl_mvm_dump_nic_error_log(mvm); in iwl_mvm_fast_resume()
3717 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_fast_resume()
3720 iwl_fw_dbg_collect_desc(&mvm->fwrt, in iwl_mvm_fast_resume()
3724 mvm->trans->state = IWL_TRANS_NO_FW; in iwl_mvm_fast_resume()
3729 ret = iwl_mvm_d3_notif_wait(mvm, &d3_data); in iwl_mvm_fast_resume()
3732 IWL_ERR(mvm, "Couldn't get the d3 notif %d\n", ret); in iwl_mvm_fast_resume()
3733 mvm->trans->state = IWL_TRANS_NO_FW; in iwl_mvm_fast_resume()
3737 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in iwl_mvm_fast_resume()
3738 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in iwl_mvm_fast_resume()
3739 mvm->fast_resume = false; in iwl_mvm_fast_resume()
3747 struct iwl_mvm *mvm = inode->i_private; in iwl_mvm_d3_test_open() local
3750 if (mvm->d3_test_active) in iwl_mvm_d3_test_open()
3755 iwl_mvm_pause_tcm(mvm, true); in iwl_mvm_d3_test_open()
3757 iwl_fw_runtime_suspend(&mvm->fwrt); in iwl_mvm_d3_test_open()
3761 wiphy_lock(mvm->hw->wiphy); in iwl_mvm_d3_test_open()
3762 err = __iwl_mvm_suspend(mvm->hw, mvm->hw->wiphy->wowlan_config, true); in iwl_mvm_d3_test_open()
3763 wiphy_unlock(mvm->hw->wiphy); in iwl_mvm_d3_test_open()
3770 mvm->d3_test_active = true; in iwl_mvm_d3_test_open()
3771 mvm->keep_vif = NULL; in iwl_mvm_d3_test_open()
3778 struct iwl_mvm *mvm = file->private_data; in iwl_mvm_d3_test_read() local
3784 if (mvm->d3_test_pme_ptr) { in iwl_mvm_d3_test_read()
3785 pme_asserted = iwl_trans_read_mem32(mvm->trans, in iwl_mvm_d3_test_read()
3786 mvm->d3_test_pme_ptr); in iwl_mvm_d3_test_read()
3795 IWL_ERR(mvm, in iwl_mvm_d3_test_read()
3817 struct iwl_mvm *mvm = inode->i_private; in iwl_mvm_d3_test_release() local
3818 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_d3_test_release()
3821 mvm->d3_test_active = false; in iwl_mvm_d3_test_release()
3823 iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); in iwl_mvm_d3_test_release()
3826 wiphy_lock(mvm->hw->wiphy); in iwl_mvm_d3_test_release()
3827 __iwl_mvm_resume(mvm, true); in iwl_mvm_d3_test_release()
3828 wiphy_unlock(mvm->hw->wiphy); in iwl_mvm_d3_test_release()
3831 iwl_mvm_resume_tcm(mvm); in iwl_mvm_d3_test_release()
3833 iwl_fw_runtime_resume(&mvm->fwrt); in iwl_mvm_d3_test_release()
3835 iwl_abort_notification_waits(&mvm->notif_wait); in iwl_mvm_d3_test_release()
3839 ieee80211_restart_hw(mvm->hw); in iwl_mvm_d3_test_release()
3842 while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_d3_test_release()
3849 IWL_ERR(mvm, "Timed out waiting for HW restart!\n"); in iwl_mvm_d3_test_release()
3853 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_d3_test_release()
3854 iwl_mvm_d3_test_disconn_work_iter, mvm->keep_vif); in iwl_mvm_d3_test_release()