Lines Matching refs:mvm

27 	struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);  in iwl_mvm_set_rekey_data()  local
30 mutex_lock(&mvm->mutex); in iwl_mvm_set_rekey_data()
41 mutex_unlock(&mvm->mutex); in iwl_mvm_set_rekey_data()
119 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_program_keys() local
159 mutex_lock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
160 ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, 0, sizeof(wkc), &wkc); in iwl_mvm_wowlan_program_keys()
163 mvm->ptk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
164 mvm->ptk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
165 mvm->gtk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
166 mvm->gtk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
167 mutex_unlock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
194 mutex_lock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
200 mvm->ptk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
201 mvm->ptk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
202 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 0); in iwl_mvm_wowlan_program_keys()
210 mvm->gtk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
211 mvm->gtk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
212 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, 1); in iwl_mvm_wowlan_program_keys()
214 mutex_unlock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
229 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_get_rsc_tsc_data() local
292 if (sta && iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_wowlan_get_rsc_tsc_data()
307 mvm->trans->num_rx_queues); in iwl_mvm_wowlan_get_rsc_tsc_data()
348 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_get_rsc_v5_data() local
428 mvm->trans->num_rx_queues); in iwl_mvm_wowlan_get_rsc_v5_data()
456 static int iwl_mvm_wowlan_config_rsc_tsc(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config_rsc_tsc() argument
460 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_TSC_RSC_PARAM, in iwl_mvm_wowlan_config_rsc_tsc()
477 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_wowlan_config_rsc_tsc()
482 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_TSC_RSC_PARAM, in iwl_mvm_wowlan_config_rsc_tsc()
505 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_wowlan_config_rsc_tsc()
510 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_TSC_RSC_PARAM, in iwl_mvm_wowlan_config_rsc_tsc()
641 static int iwl_mvm_send_patterns_v1(struct iwl_mvm *mvm, in iwl_mvm_send_patterns_v1() argument
676 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_patterns_v1()
681 static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, in iwl_mvm_send_patterns() argument
691 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, in iwl_mvm_send_patterns()
725 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_patterns()
730 static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_d3_reprogram() argument
743 if (WARN_ON_ONCE(iwl_mvm_is_cdb_supported(mvm) || in iwl_mvm_d3_reprogram()
763 ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->deflink.phy_ctxt, &chandef, in iwl_mvm_d3_reprogram()
774 ret = iwl_mvm_mac_ctxt_add(mvm, vif); in iwl_mvm_d3_reprogram()
792 ret = iwl_mvm_send_cmd_pdu_status(mvm, BINDING_CONTEXT_CMD, in iwl_mvm_d3_reprogram()
796 IWL_ERR(mvm, "Failed to add binding: %d\n", ret); in iwl_mvm_d3_reprogram()
801 IWL_ERR(mvm, "Binding command failed: %u\n", status); in iwl_mvm_d3_reprogram()
805 ret = iwl_mvm_sta_send_to_fw(mvm, ap_sta, false, 0); in iwl_mvm_d3_reprogram()
808 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->deflink.ap_sta_id], in iwl_mvm_d3_reprogram()
811 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_d3_reprogram()
816 quota = iwl_mvm_quota_cmd_get_quota(mvm, &quota_cmd, 0); in iwl_mvm_d3_reprogram()
824 quota = iwl_mvm_quota_cmd_get_quota(mvm, &quota_cmd, i); in iwl_mvm_d3_reprogram()
828 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, in iwl_mvm_d3_reprogram()
829 iwl_mvm_quota_cmd_size(mvm), &quota_cmd); in iwl_mvm_d3_reprogram()
831 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); in iwl_mvm_d3_reprogram()
833 if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm, false)) in iwl_mvm_d3_reprogram()
834 IWL_ERR(mvm, "Failed to initialize D3 LAR information\n"); in iwl_mvm_d3_reprogram()
839 static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm, in iwl_mvm_get_last_nonqos_seq() argument
859 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_get_last_nonqos_seq()
876 void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_set_last_nonqos_seq() argument
893 if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, 0, in iwl_mvm_set_last_nonqos_seq()
895 IWL_ERR(mvm, "failed to set non-QoS seqno\n"); in iwl_mvm_set_last_nonqos_seq()
898 static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm) in iwl_mvm_switch_to_d3() argument
900 iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_REGULAR, true); in iwl_mvm_switch_to_d3()
902 iwl_mvm_stop_device(mvm); in iwl_mvm_switch_to_d3()
913 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_switch_to_d3()
916 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_switch_to_d3()
918 mvm->ptk_ivlen = 0; in iwl_mvm_switch_to_d3()
919 mvm->ptk_icvlen = 0; in iwl_mvm_switch_to_d3()
920 mvm->ptk_ivlen = 0; in iwl_mvm_switch_to_d3()
921 mvm->ptk_icvlen = 0; in iwl_mvm_switch_to_d3()
923 return iwl_mvm_load_d3_fw(mvm); in iwl_mvm_switch_to_d3()
927 iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm, in iwl_mvm_get_wowlan_config() argument
945 if (iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_CONFIGURATION, 0) < 6) { in iwl_mvm_get_wowlan_config()
947 int ret = iwl_mvm_get_last_nonqos_seq(mvm, vif); in iwl_mvm_get_wowlan_config()
1004 static int iwl_mvm_wowlan_config_key_params(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config_key_params() argument
1008 bool unified = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config_key_params()
1028 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_program_keys, in iwl_mvm_wowlan_config_key_params()
1035 ret = iwl_mvm_wowlan_config_rsc_tsc(mvm, vif, mvm_link); in iwl_mvm_wowlan_config_key_params()
1039 if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config_key_params()
1041 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, WOWLAN_TKIP_PARAM, in iwl_mvm_wowlan_config_key_params()
1057 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_get_tkip_data, in iwl_mvm_wowlan_config_key_params()
1062 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_wowlan_config_key_params()
1080 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_wowlan_config_key_params()
1087 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_wowlan_gtk_type_iter, in iwl_mvm_wowlan_config_key_params()
1114 IWL_DEBUG_WOWLAN(mvm, "setting akm %d\n", in iwl_mvm_wowlan_config_key_params()
1117 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_KEK_KCK_MATERIAL, in iwl_mvm_wowlan_config_key_params()
1127 iwl_mvm_wowlan_config(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config() argument
1135 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config()
1138 mvm->offload_tid = wowlan_config_cmd->offloading_tid; in iwl_mvm_wowlan_config()
1141 ret = iwl_mvm_switch_to_d3(mvm); in iwl_mvm_wowlan_config()
1145 ret = iwl_mvm_d3_reprogram(mvm, vif, ap_sta); in iwl_mvm_wowlan_config()
1150 ret = iwl_mvm_wowlan_config_key_params(mvm, vif, mvm_link); in iwl_mvm_wowlan_config()
1154 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, in iwl_mvm_wowlan_config()
1160 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_wowlan_config()
1162 ret = iwl_mvm_send_patterns(mvm, mvm_link, wowlan); in iwl_mvm_wowlan_config()
1164 ret = iwl_mvm_send_patterns_v1(mvm, wowlan); in iwl_mvm_wowlan_config()
1168 return iwl_mvm_send_proto_offload(mvm, vif, false, true, 0, in iwl_mvm_wowlan_config()
1173 iwl_mvm_netdetect_config(struct iwl_mvm *mvm, in iwl_mvm_netdetect_config() argument
1179 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_netdetect_config()
1183 ret = iwl_mvm_switch_to_d3(mvm); in iwl_mvm_netdetect_config()
1192 ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_SCHED, true); in iwl_mvm_netdetect_config()
1197 ret = iwl_mvm_sched_scan_start(mvm, vif, nd_config, &mvm->nd_ies, in iwl_mvm_netdetect_config()
1202 if (WARN_ON(mvm->nd_match_sets || mvm->nd_channels)) in iwl_mvm_netdetect_config()
1207 mvm->nd_match_sets = kmemdup(nd_config->match_sets, in iwl_mvm_netdetect_config()
1211 if (mvm->nd_match_sets) in iwl_mvm_netdetect_config()
1212 mvm->n_nd_match_sets = nd_config->n_match_sets; in iwl_mvm_netdetect_config()
1216 mvm->nd_channels = kmemdup(nd_config->channels, in iwl_mvm_netdetect_config()
1220 if (mvm->nd_channels) in iwl_mvm_netdetect_config()
1221 mvm->n_nd_channels = nd_config->n_channels; in iwl_mvm_netdetect_config()
1226 static void iwl_mvm_free_nd(struct iwl_mvm *mvm) in iwl_mvm_free_nd() argument
1228 kfree(mvm->nd_match_sets); in iwl_mvm_free_nd()
1229 mvm->nd_match_sets = NULL; in iwl_mvm_free_nd()
1230 mvm->n_nd_match_sets = 0; in iwl_mvm_free_nd()
1231 kfree(mvm->nd_channels); in iwl_mvm_free_nd()
1232 mvm->nd_channels = NULL; in iwl_mvm_free_nd()
1233 mvm->n_nd_channels = 0; in iwl_mvm_free_nd()
1240 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in __iwl_mvm_suspend() local
1261 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_suspend()
1273 vif = iwl_mvm_get_bss_vif(mvm); in __iwl_mvm_suspend()
1277 ret = iwl_mvm_block_esr_sync(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN); in __iwl_mvm_suspend()
1281 mutex_lock(&mvm->mutex); in __iwl_mvm_suspend()
1283 set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in __iwl_mvm_suspend()
1303 mvm, wowlan, wowlan->nd_config, vif); in __iwl_mvm_suspend()
1307 mvm->net_detect = true; in __iwl_mvm_suspend()
1316 mvm->fw_id_to_mac_id[mvm_link->ap_sta_id], in __iwl_mvm_suspend()
1317 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_suspend()
1324 mvm, ap_sta->txq[wowlan_config_cmd.offloading_tid]); in __iwl_mvm_suspend()
1328 ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd, in __iwl_mvm_suspend()
1332 ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd, in __iwl_mvm_suspend()
1337 mvm->net_detect = false; in __iwl_mvm_suspend()
1340 ret = iwl_mvm_power_update_device(mvm); in __iwl_mvm_suspend()
1344 ret = iwl_mvm_power_update_mac(mvm); in __iwl_mvm_suspend()
1349 if (mvm->d3_wake_sysassert) in __iwl_mvm_suspend()
1359 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_9000) in __iwl_mvm_suspend()
1360 iwl_fw_dbg_stop_restart_recording(&mvm->fwrt, NULL, true); in __iwl_mvm_suspend()
1362 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_D3; in __iwl_mvm_suspend()
1365 ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd); in __iwl_mvm_suspend()
1371 mvm->d3_test_pme_ptr = in __iwl_mvm_suspend()
1377 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_suspend()
1379 ret = iwl_trans_d3_suspend(mvm->trans, test, !unified_image); in __iwl_mvm_suspend()
1382 iwl_mvm_free_nd(mvm); in __iwl_mvm_suspend()
1385 if (mvm->fw_restart > 0) { in __iwl_mvm_suspend()
1386 mvm->fw_restart--; in __iwl_mvm_suspend()
1387 ieee80211_restart_hw(mvm->hw); in __iwl_mvm_suspend()
1391 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in __iwl_mvm_suspend()
1394 mutex_unlock(&mvm->mutex); in __iwl_mvm_suspend()
1401 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_suspend() local
1403 iwl_mvm_pause_tcm(mvm, true); in iwl_mvm_suspend()
1405 iwl_fw_runtime_suspend(&mvm->fwrt); in iwl_mvm_suspend()
1476 static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_report_wakeup_reasons() argument
1492 pm_wakeup_event(mvm->dev, 0); in iwl_mvm_report_wakeup_reasons()
1561 ivlen = mvm->gtk_ivlen; in iwl_mvm_report_wakeup_reasons()
1562 icvlen += mvm->gtk_icvlen; in iwl_mvm_report_wakeup_reasons()
1564 ivlen = mvm->ptk_ivlen; in iwl_mvm_report_wakeup_reasons()
1565 icvlen += mvm->ptk_icvlen; in iwl_mvm_report_wakeup_reasons()
1654 static void iwl_mvm_set_aes_ptk_rx_seq(struct iwl_mvm *mvm, in iwl_mvm_set_aes_ptk_rx_seq() argument
1665 if (!iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_set_aes_ptk_rx_seq()
1679 for (i = 1; i < mvm->trans->num_rx_queues; i++) in iwl_mvm_set_aes_ptk_rx_seq()
1817 struct iwl_mvm *mvm; member
1941 iwl_mvm_set_aes_ptk_rx_seq(data->mvm, status, sta, key); in iwl_mvm_d3_update_keys()
2035 struct iwl_mvm *mvm) in iwl_mvm_mlo_gtk_rekey() argument
2041 IWL_DEBUG_WOWLAN(mvm, "Num of MLO Keys: %d\n", status->num_mlo_keys); in iwl_mvm_mlo_gtk_rekey()
2050 ieee80211_iter_keys(mvm->hw, vif, iwl_mvm_mlo_key_ciphers, old_keys); in iwl_mvm_mlo_gtk_rekey()
2113 IWL_DEBUG_WOWLAN(mvm, in iwl_mvm_mlo_gtk_rekey()
2119 IWL_DEBUG_WOWLAN(mvm, "Add MLO key id %d, link id %d\n", in iwl_mvm_mlo_gtk_rekey()
2147 struct iwl_mvm *mvm, u32 gtk_cipher) in iwl_mvm_gtk_rekey() argument
2185 IWL_DEBUG_WOWLAN(mvm, in iwl_mvm_gtk_rekey()
2265 static int iwl_mvm_lookup_wowlan_status_ver(struct iwl_mvm *mvm) in iwl_mvm_lookup_wowlan_status_ver() argument
2269 if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_lookup_wowlan_status_ver()
2274 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, in iwl_mvm_lookup_wowlan_status_ver()
2277 notif_ver = iwl_fw_lookup_notif_ver(mvm->fw, LEGACY_GROUP, in iwl_mvm_lookup_wowlan_status_ver()
2283 static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, in iwl_mvm_setup_connection_keep() argument
2289 .mvm = mvm, in iwl_mvm_setup_connection_keep()
2300 if (iwl_mvm_lookup_wowlan_status_ver(mvm) > 6 || in iwl_mvm_setup_connection_keep()
2301 iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_setup_connection_keep()
2306 if (iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_setup_connection_keep()
2312 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_setup_connection_keep()
2324 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_setup_connection_keep()
2330 IWL_DEBUG_WOWLAN(mvm, "num of GTK rekeying %d\n", in iwl_mvm_setup_connection_keep()
2333 if (!iwl_mvm_gtk_rekey(status, vif, mvm, gtkdata.gtk_cipher)) in iwl_mvm_setup_connection_keep()
2348 if (!iwl_mvm_mlo_gtk_rekey(status, vif, mvm)) in iwl_mvm_setup_connection_keep()
2356 if (iwl_fw_lookup_notif_ver(mvm->fw, LONG_GROUP, in iwl_mvm_setup_connection_keep()
2476 static void iwl_mvm_parse_wowlan_info_notif(struct iwl_mvm *mvm, in iwl_mvm_parse_wowlan_info_notif() argument
2485 IWL_ERR(mvm, "iwl_wowlan_info_notif data is NULL\n"); in iwl_mvm_parse_wowlan_info_notif()
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()
2520 if (IWL_FW_CHECK(mvm, in iwl_mvm_parse_wowlan_info_notif()
2531 iwl_mvm_parse_wowlan_info_notif_v2(struct iwl_mvm *mvm, in iwl_mvm_parse_wowlan_info_notif_v2() argument
2539 IWL_ERR(mvm, "iwl_wowlan_info_notif data is NULL\n"); in iwl_mvm_parse_wowlan_info_notif_v2()
2545 IWL_ERR(mvm, "Invalid WoWLAN info notification!\n"); in iwl_mvm_parse_wowlan_info_notif_v2()
2568 iwl_mvm_parse_wowlan_status_common_ ## _ver(struct iwl_mvm *mvm, \
2576 IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); \
2582 IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); \
2627 iwl_mvm_send_wowlan_get_status(struct iwl_mvm *mvm, u8 sta_id) in iwl_mvm_parse_wowlan_status_common()
2641 u8 cmd_ver = iwl_fw_lookup_cmd_ver(mvm->fw, cmd.id, in iwl_mvm_parse_wowlan_status_common()
2647 lockdep_assert_held(&mvm->mutex); in iwl_mvm_parse_wowlan_status_common()
2649 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_parse_wowlan_status_common()
2651 IWL_ERR(mvm, "failed to query wakeup status (%d)\n", ret); in iwl_mvm_parse_wowlan_status_common()
2658 notif_ver = iwl_mvm_lookup_wowlan_status_ver(mvm); in iwl_mvm_parse_wowlan_status_common()
2663 status = iwl_mvm_parse_wowlan_status_common_v6(mvm, v6, len); in iwl_mvm_parse_wowlan_status_common()
2694 status = iwl_mvm_parse_wowlan_status_common_v7(mvm, v7, len); in iwl_mvm_parse_wowlan_status_common()
2707 status = iwl_mvm_parse_wowlan_status_common_v9(mvm, v9, len); in iwl_mvm_parse_wowlan_status_common()
2719 status = iwl_mvm_parse_wowlan_status_common_v12(mvm, v12, len); in iwl_mvm_parse_wowlan_status_common()
2729 IWL_ERR(mvm, in iwl_mvm_parse_wowlan_status_common()
2741 static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_query_wakeup_reasons() argument
2758 IWL_DEBUG_WOWLAN(mvm, "wakeup reason 0x%x\n", in iwl_mvm_query_wakeup_reasons()
2761 mvm_ap_sta = iwl_mvm_sta_from_staid_protected(mvm, mvm_link->ap_sta_id); in iwl_mvm_query_wakeup_reasons()
2772 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_22000) { in iwl_mvm_query_wakeup_reasons()
2773 i = mvm->offload_tid; in iwl_mvm_query_wakeup_reasons()
2774 iwl_trans_set_q_ptrs(mvm->trans, in iwl_mvm_query_wakeup_reasons()
2779 iwl_mvm_report_wakeup_reasons(mvm, vif, status); in iwl_mvm_query_wakeup_reasons()
2781 keep = iwl_mvm_setup_connection_keep(mvm, vif, status); in iwl_mvm_query_wakeup_reasons()
2783 mutex_unlock(&mvm->mutex); in iwl_mvm_query_wakeup_reasons()
2796 iwl_mvm_netdetect_query_results(struct iwl_mvm *mvm, in iwl_mvm_netdetect_query_results() argument
2806 int max_profiles = iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_netdetect_query_results()
2808 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_netdetect_query_results()
2810 IWL_ERR(mvm, "failed to query matched profiles (%d)\n", ret); in iwl_mvm_netdetect_query_results()
2814 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_netdetect_query_results()
2827 IWL_ERR(mvm, "Invalid scan offload profiles query response!\n"); in iwl_mvm_netdetect_query_results()
2838 mvm->last_netdetect_scans = le32_to_cpu(query->n_scans_done); in iwl_mvm_netdetect_query_results()
2846 static int iwl_mvm_query_num_match_chans(struct iwl_mvm *mvm, in iwl_mvm_query_num_match_chans() argument
2852 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_query_num_match_chans()
2870 static void iwl_mvm_query_set_freqs(struct iwl_mvm *mvm, in iwl_mvm_query_set_freqs() argument
2877 if (fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_query_set_freqs()
2885 mvm->nd_channels[i]->center_freq; in iwl_mvm_query_set_freqs()
2893 mvm->nd_channels[i]->center_freq; in iwl_mvm_query_set_freqs()
2924 static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, in iwl_mvm_query_netdetect_reasons() argument
2948 if (!iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_query_netdetect_reasons()
2950 IWL_INFO(mvm, "Query FW for ND results\n"); in iwl_mvm_query_netdetect_reasons()
2951 ret = iwl_mvm_netdetect_query_results(mvm, d3_data->nd_results); in iwl_mvm_query_netdetect_reasons()
2954 IWL_INFO(mvm, "Notification based ND results\n"); in iwl_mvm_query_netdetect_reasons()
2964 if (mvm->n_nd_match_sets) { in iwl_mvm_query_netdetect_reasons()
2967 IWL_ERR(mvm, "no net detect match information available\n"); in iwl_mvm_query_netdetect_reasons()
2976 for_each_set_bit(i, &matched_profiles, mvm->n_nd_match_sets) { in iwl_mvm_query_netdetect_reasons()
2980 n_channels = iwl_mvm_query_num_match_chans(mvm, in iwl_mvm_query_netdetect_reasons()
2994 idx = mvm->n_nd_match_sets - i - 1; in iwl_mvm_query_netdetect_reasons()
2995 match->ssid.ssid_len = mvm->nd_match_sets[idx].ssid.ssid_len; in iwl_mvm_query_netdetect_reasons()
2996 memcpy(match->ssid.ssid, mvm->nd_match_sets[idx].ssid.ssid, in iwl_mvm_query_netdetect_reasons()
2999 if (mvm->n_nd_channels < n_channels) in iwl_mvm_query_netdetect_reasons()
3002 iwl_mvm_query_set_freqs(mvm, d3_data->nd_results, match, i); in iwl_mvm_query_netdetect_reasons()
3008 iwl_mvm_free_nd(mvm); in iwl_mvm_query_netdetect_reasons()
3010 mutex_unlock(&mvm->mutex); in iwl_mvm_query_netdetect_reasons()
3050 static bool iwl_mvm_check_rt_status(struct iwl_mvm *mvm, in iwl_mvm_check_rt_status() argument
3056 if (iwl_mvm_rt_status(mvm->trans, in iwl_mvm_check_rt_status()
3057 mvm->trans->dbg.lmac_error_event_table[0], in iwl_mvm_check_rt_status()
3070 if (iwl_mvm_rt_status(mvm->trans, in iwl_mvm_check_rt_status()
3071 mvm->trans->dbg.lmac_error_event_table[1], NULL)) in iwl_mvm_check_rt_status()
3075 if (iwl_mvm_rt_status(mvm->trans, in iwl_mvm_check_rt_status()
3076 mvm->trans->dbg.umac_error_event_table, NULL)) in iwl_mvm_check_rt_status()
3088 iwl_mvm_choose_query_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_choose_query_wakeup_reasons() argument
3092 lockdep_assert_held(&mvm->mutex); in iwl_mvm_choose_query_wakeup_reasons()
3097 u8 sta_id = mvm->net_detect ? IWL_MVM_INVALID_STA : in iwl_mvm_choose_query_wakeup_reasons()
3103 d3_data->status = iwl_mvm_send_wowlan_get_status(mvm, sta_id); in iwl_mvm_choose_query_wakeup_reasons()
3106 if (mvm->net_detect) { in iwl_mvm_choose_query_wakeup_reasons()
3107 iwl_mvm_query_netdetect_reasons(mvm, vif, d3_data); in iwl_mvm_choose_query_wakeup_reasons()
3109 bool keep = iwl_mvm_query_wakeup_reasons(mvm, vif, in iwl_mvm_choose_query_wakeup_reasons()
3114 mvm->keep_vif = vif; in iwl_mvm_choose_query_wakeup_reasons()
3129 static int iwl_mvm_wowlan_store_wake_pkt(struct iwl_mvm *mvm, in iwl_mvm_wowlan_store_wake_pkt() argument
3137 IWL_ERR(mvm, "Invalid WoWLAN wake packet notification!\n"); in iwl_mvm_wowlan_store_wake_pkt()
3142 IWL_ERR(mvm, "Got wake packet notification but wowlan status data is NULL\n"); in iwl_mvm_wowlan_store_wake_pkt()
3148 IWL_ERR(mvm, "Got wakeup packet but wakeup reason is %x\n", in iwl_mvm_wowlan_store_wake_pkt()
3171 static void iwl_mvm_nd_match_info_handler(struct iwl_mvm *mvm, in iwl_mvm_nd_match_info_handler() argument
3177 struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); in iwl_mvm_nd_match_info_handler()
3180 iwl_umac_scan_get_max_profiles(mvm->fw); in iwl_mvm_nd_match_info_handler()
3186 IWL_ERR(mvm, "Invalid scan match info notification\n"); in iwl_mvm_nd_match_info_handler()
3190 if (!mvm->net_detect) { in iwl_mvm_nd_match_info_handler()
3191 IWL_ERR(mvm, "Unexpected scan match info notification\n"); in iwl_mvm_nd_match_info_handler()
3196 IWL_ERR(mvm, in iwl_mvm_nd_match_info_handler()
3202 mvm->last_netdetect_scans = le32_to_cpu(notif->n_scans_done); in iwl_mvm_nd_match_info_handler()
3206 IWL_INFO(mvm, "number of matched profiles=%u\n", in iwl_mvm_nd_match_info_handler()
3215 mvm->scan_status = 0; in iwl_mvm_nd_match_info_handler()
3216 for (i = 0; i < mvm->max_scans; i++) in iwl_mvm_nd_match_info_handler()
3217 mvm->scan_uid_status[i] = 0; in iwl_mvm_nd_match_info_handler()
3223 struct iwl_mvm *mvm = in iwl_mvm_wait_d3_notif() local
3228 int wowlan_info_ver = iwl_fw_lookup_notif_ver(mvm->fw, in iwl_mvm_wait_d3_notif()
3239 IWL_DEBUG_WOWLAN(mvm, in iwl_mvm_wait_d3_notif()
3257 iwl_mvm_parse_wowlan_info_notif_v2(mvm, notif_v2, in iwl_mvm_wait_d3_notif()
3266 iwl_mvm_parse_wowlan_info_notif_v2(mvm, notif_v2, in iwl_mvm_wait_d3_notif()
3273 iwl_mvm_parse_wowlan_info_notif(mvm, notif, in iwl_mvm_wait_d3_notif()
3292 IWL_ERR(mvm, in iwl_mvm_wait_d3_notif()
3297 ret = iwl_mvm_wowlan_store_wake_pkt(mvm, notif, in iwl_mvm_wait_d3_notif()
3301 IWL_ERR(mvm, in iwl_mvm_wait_d3_notif()
3311 IWL_ERR(mvm, in iwl_mvm_wait_d3_notif()
3322 iwl_mvm_nd_match_info_handler(mvm, d3_data, notif, len); in iwl_mvm_wait_d3_notif()
3340 static int iwl_mvm_resume_firmware(struct iwl_mvm *mvm, bool test) in iwl_mvm_resume_firmware() argument
3348 bool reset = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_resume_firmware()
3351 ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test, !reset); in iwl_mvm_resume_firmware()
3356 IWL_INFO(mvm, "Device was reset during suspend\n"); in iwl_mvm_resume_firmware()
3365 if (mvm->trans->trans_cfg->device_family <= IWL_DEVICE_FAMILY_22000 && in iwl_mvm_resume_firmware()
3366 fw_has_capa(&mvm->fw->ucode_capa, IWL_UCODE_TLV_CAPA_D0I3_END_FIRST)) { in iwl_mvm_resume_firmware()
3367 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_resume_firmware()
3369 IWL_ERR(mvm, "Failed to send D0I3_END_CMD first (%d)\n", in iwl_mvm_resume_firmware()
3378 static int iwl_mvm_d3_notif_wait(struct iwl_mvm *mvm, in iwl_mvm_d3_notif_wait() argument
3393 if (mvm->fast_resume) in iwl_mvm_d3_notif_wait()
3394 iwl_init_notification_wait(&mvm->notif_wait, &wait_d3_notif, in iwl_mvm_d3_notif_wait()
3399 iwl_init_notification_wait(&mvm->notif_wait, &wait_d3_notif, in iwl_mvm_d3_notif_wait()
3404 ret = iwl_mvm_resume_firmware(mvm, d3_data->test); in iwl_mvm_d3_notif_wait()
3406 iwl_remove_notification(&mvm->notif_wait, &wait_d3_notif); in iwl_mvm_d3_notif_wait()
3410 return iwl_wait_notification(&mvm->notif_wait, &wait_d3_notif, in iwl_mvm_d3_notif_wait()
3414 static inline bool iwl_mvm_d3_resume_notif_based(struct iwl_mvm *mvm) in iwl_mvm_d3_resume_notif_based() argument
3416 return iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_d3_resume_notif_based()
3418 iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_d3_resume_notif_based()
3420 iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in iwl_mvm_d3_resume_notif_based()
3424 static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) in __iwl_mvm_resume() argument
3437 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_resume()
3439 bool d0i3_first = fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_resume()
3441 bool resume_notif_based = iwl_mvm_d3_resume_notif_based(mvm); in __iwl_mvm_resume()
3444 mutex_lock(&mvm->mutex); in __iwl_mvm_resume()
3450 if (!test_bit(IWL_MVM_STATUS_IN_D3, &mvm->status)) { in __iwl_mvm_resume()
3451 IWL_INFO(mvm, in __iwl_mvm_resume()
3456 mvm->last_reset_or_resume_time_jiffies = jiffies; in __iwl_mvm_resume()
3459 vif = iwl_mvm_get_bss_vif(mvm); in __iwl_mvm_resume()
3463 iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); in __iwl_mvm_resume()
3465 if (iwl_mvm_check_rt_status(mvm, vif)) { in __iwl_mvm_resume()
3466 set_bit(STATUS_FW_ERROR, &mvm->trans->status); in __iwl_mvm_resume()
3467 iwl_mvm_dump_nic_error_log(mvm); in __iwl_mvm_resume()
3468 iwl_dbg_tlv_time_point(&mvm->fwrt, in __iwl_mvm_resume()
3470 iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert, in __iwl_mvm_resume()
3479 IWL_ERR(mvm, "Failed to allocate wowlan status\n"); in __iwl_mvm_resume()
3484 ret = iwl_mvm_d3_notif_wait(mvm, &d3_data); in __iwl_mvm_resume()
3488 ret = iwl_mvm_resume_firmware(mvm, test); in __iwl_mvm_resume()
3493 iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_WOWLAN); in __iwl_mvm_resume()
3496 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in __iwl_mvm_resume()
3506 iwl_mvm_update_changed_regdom(mvm); in __iwl_mvm_resume()
3509 iwl_mvm_ppag_send_cmd(mvm); in __iwl_mvm_resume()
3513 iwl_mvm_sar_select_profile(mvm, 1, 1); in __iwl_mvm_resume()
3515 if (mvm->net_detect && unified_image) { in __iwl_mvm_resume()
3522 ret = iwl_mvm_scan_stop(mvm, IWL_MVM_SCAN_NETDETECT, in __iwl_mvm_resume()
3527 keep = iwl_mvm_choose_query_wakeup_reasons(mvm, vif, &d3_data); in __iwl_mvm_resume()
3532 mutex_unlock(&mvm->mutex); in __iwl_mvm_resume()
3537 iwl_mvm_free_nd(mvm); in __iwl_mvm_resume()
3539 if (!d3_data.test && !mvm->net_detect) in __iwl_mvm_resume()
3540 ieee80211_iterate_active_interfaces_mtx(mvm->hw, in __iwl_mvm_resume()
3545 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in __iwl_mvm_resume()
3553 if (!iwl_fw_lookup_notif_ver(mvm->fw, PROT_OFFLOAD_GROUP, in __iwl_mvm_resume()
3555 ret = iwl_mvm_send_cmd_pdu(mvm, D0I3_END_CMD, 0, 0, NULL); in __iwl_mvm_resume()
3568 set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in __iwl_mvm_resume()
3571 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in __iwl_mvm_resume()
3578 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_resume() local
3581 ret = __iwl_mvm_resume(mvm, false); in iwl_mvm_resume()
3583 iwl_mvm_resume_tcm(mvm); in iwl_mvm_resume()
3585 iwl_fw_runtime_resume(&mvm->fwrt); in iwl_mvm_resume()
3592 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_set_wakeup() local
3594 device_set_wakeup_enable(mvm->trans->dev, enabled); in iwl_mvm_set_wakeup()
3597 void iwl_mvm_fast_suspend(struct iwl_mvm *mvm) in iwl_mvm_fast_suspend() argument
3602 lockdep_assert_held(&mvm->mutex); in iwl_mvm_fast_suspend()
3604 IWL_DEBUG_WOWLAN(mvm, "Starting fast suspend flow\n"); in iwl_mvm_fast_suspend()
3606 mvm->fast_resume = true; in iwl_mvm_fast_suspend()
3607 set_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in iwl_mvm_fast_suspend()
3609 WARN_ON(iwl_mvm_power_update_device(mvm)); in iwl_mvm_fast_suspend()
3610 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_D3; in iwl_mvm_fast_suspend()
3611 ret = iwl_mvm_send_cmd_pdu(mvm, D3_CONFIG_CMD, CMD_SEND_IN_D3, in iwl_mvm_fast_suspend()
3614 IWL_ERR(mvm, in iwl_mvm_fast_suspend()
3617 WARN_ON(iwl_mvm_power_update_mac(mvm)); in iwl_mvm_fast_suspend()
3619 ret = iwl_trans_d3_suspend(mvm->trans, false, false); in iwl_mvm_fast_suspend()
3621 IWL_ERR(mvm, "fast suspend: trans_d3_suspend failed %d\n", ret); in iwl_mvm_fast_suspend()
3624 int iwl_mvm_fast_resume(struct iwl_mvm *mvm) in iwl_mvm_fast_resume() argument
3632 lockdep_assert_held(&mvm->mutex); in iwl_mvm_fast_resume()
3634 IWL_DEBUG_WOWLAN(mvm, "Starting the fast resume flow\n"); in iwl_mvm_fast_resume()
3636 mvm->last_reset_or_resume_time_jiffies = jiffies; in iwl_mvm_fast_resume()
3637 iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); in iwl_mvm_fast_resume()
3639 if (iwl_mvm_check_rt_status(mvm, NULL)) { in iwl_mvm_fast_resume()
3640 set_bit(STATUS_FW_ERROR, &mvm->trans->status); in iwl_mvm_fast_resume()
3641 iwl_mvm_dump_nic_error_log(mvm); in iwl_mvm_fast_resume()
3642 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_fast_resume()
3644 iwl_fw_dbg_collect_desc(&mvm->fwrt, &iwl_dump_desc_assert, in iwl_mvm_fast_resume()
3648 ret = iwl_mvm_d3_notif_wait(mvm, &d3_data); in iwl_mvm_fast_resume()
3649 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in iwl_mvm_fast_resume()
3650 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in iwl_mvm_fast_resume()
3651 mvm->fast_resume = false; in iwl_mvm_fast_resume()
3654 IWL_ERR(mvm, "Couldn't get the d3 notif %d\n", ret); in iwl_mvm_fast_resume()
3662 struct iwl_mvm *mvm = inode->i_private; in iwl_mvm_d3_test_open() local
3665 if (mvm->d3_test_active) in iwl_mvm_d3_test_open()
3670 iwl_mvm_pause_tcm(mvm, true); in iwl_mvm_d3_test_open()
3672 iwl_fw_runtime_suspend(&mvm->fwrt); in iwl_mvm_d3_test_open()
3676 wiphy_lock(mvm->hw->wiphy); in iwl_mvm_d3_test_open()
3677 err = __iwl_mvm_suspend(mvm->hw, mvm->hw->wiphy->wowlan_config, true); in iwl_mvm_d3_test_open()
3678 wiphy_unlock(mvm->hw->wiphy); in iwl_mvm_d3_test_open()
3685 mvm->d3_test_active = true; in iwl_mvm_d3_test_open()
3686 mvm->keep_vif = NULL; in iwl_mvm_d3_test_open()
3693 struct iwl_mvm *mvm = file->private_data; in iwl_mvm_d3_test_read() local
3699 if (mvm->d3_test_pme_ptr) { in iwl_mvm_d3_test_read()
3700 pme_asserted = iwl_trans_read_mem32(mvm->trans, in iwl_mvm_d3_test_read()
3701 mvm->d3_test_pme_ptr); in iwl_mvm_d3_test_read()
3714 IWL_ERR(mvm, in iwl_mvm_d3_test_read()
3736 struct iwl_mvm *mvm = inode->i_private; in iwl_mvm_d3_test_release() local
3737 bool unified_image = fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_d3_test_release()
3740 mvm->d3_test_active = false; in iwl_mvm_d3_test_release()
3742 iwl_fw_dbg_read_d3_debug_data(&mvm->fwrt); in iwl_mvm_d3_test_release()
3745 wiphy_lock(mvm->hw->wiphy); in iwl_mvm_d3_test_release()
3746 __iwl_mvm_resume(mvm, true); in iwl_mvm_d3_test_release()
3747 wiphy_unlock(mvm->hw->wiphy); in iwl_mvm_d3_test_release()
3750 iwl_mvm_resume_tcm(mvm); in iwl_mvm_d3_test_release()
3752 iwl_fw_runtime_resume(&mvm->fwrt); in iwl_mvm_d3_test_release()
3754 iwl_abort_notification_waits(&mvm->notif_wait); in iwl_mvm_d3_test_release()
3758 ieee80211_restart_hw(mvm->hw); in iwl_mvm_d3_test_release()
3761 while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_d3_test_release()
3772 IWL_ERR(mvm, "Timed out waiting for HW restart!\n"); in iwl_mvm_d3_test_release()
3776 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_d3_test_release()
3777 iwl_mvm_d3_test_disconn_work_iter, mvm->keep_vif); in iwl_mvm_d3_test_release()