Lines Matching refs:mvm
81 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_set_rekey_data() local
87 mutex_lock(&mvm->mutex); in iwl_mvm_set_rekey_data()
95 mutex_unlock(&mvm->mutex); in iwl_mvm_set_rekey_data()
149 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_wowlan_program_keys() local
161 mutex_lock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
198 ret = iwl_mvm_send_cmd_pdu(mvm, WEP_KEY, 0, sizeof(wkc), &wkc); in iwl_mvm_wowlan_program_keys()
201 mvm->ptk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
202 mvm->ptk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
203 mvm->gtk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
204 mvm->gtk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
318 mvm->ptk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
319 mvm->ptk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
328 mvm->gtk_ivlen = key->iv_len; in iwl_mvm_wowlan_program_keys()
329 mvm->gtk_icvlen = key->icv_len; in iwl_mvm_wowlan_program_keys()
332 ret = iwl_mvm_set_sta_key(mvm, vif, sta, key, true); in iwl_mvm_wowlan_program_keys()
335 mutex_unlock(&mvm->mutex); in iwl_mvm_wowlan_program_keys()
338 static int iwl_mvm_send_patterns(struct iwl_mvm *mvm, in iwl_mvm_send_patterns() argument
374 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_patterns()
512 static int iwl_mvm_send_remote_wake_cfg(struct iwl_mvm *mvm, in iwl_mvm_send_remote_wake_cfg() argument
598 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_send_remote_wake_cfg()
604 static int iwl_mvm_d3_reprogram(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_d3_reprogram() argument
631 ret = iwl_mvm_phy_ctxt_add(mvm, mvmvif->phy_ctxt, &chandef, in iwl_mvm_d3_reprogram()
642 ret = iwl_mvm_mac_ctxt_add(mvm, vif); in iwl_mvm_d3_reprogram()
660 ret = iwl_mvm_send_cmd_pdu_status(mvm, BINDING_CONTEXT_CMD, in iwl_mvm_d3_reprogram()
664 IWL_ERR(mvm, "Failed to add binding: %d\n", ret); in iwl_mvm_d3_reprogram()
669 IWL_ERR(mvm, "Binding command failed: %u\n", status); in iwl_mvm_d3_reprogram()
673 ret = iwl_mvm_sta_send_to_fw(mvm, ap_sta, false); in iwl_mvm_d3_reprogram()
676 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], ap_sta); in iwl_mvm_d3_reprogram()
678 ret = iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_d3_reprogram()
692 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_QUOTA_CMD, 0, in iwl_mvm_d3_reprogram()
695 IWL_ERR(mvm, "Failed to send quota: %d\n", ret); in iwl_mvm_d3_reprogram()
697 if (iwl_mvm_is_lar_supported(mvm) && iwl_mvm_init_fw_regd(mvm)) in iwl_mvm_d3_reprogram()
698 IWL_ERR(mvm, "Failed to initialize D3 LAR information\n"); in iwl_mvm_d3_reprogram()
703 static int iwl_mvm_get_last_nonqos_seq(struct iwl_mvm *mvm, in iwl_mvm_get_last_nonqos_seq() argument
723 err = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_get_last_nonqos_seq()
740 void iwl_mvm_set_last_nonqos_seq(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_set_last_nonqos_seq() argument
757 if (iwl_mvm_send_cmd_pdu(mvm, NON_QOS_TX_COUNTER_CMD, 0, in iwl_mvm_set_last_nonqos_seq()
759 IWL_ERR(mvm, "failed to set non-QoS seqno\n"); in iwl_mvm_set_last_nonqos_seq()
762 static int iwl_mvm_switch_to_d3(struct iwl_mvm *mvm) in iwl_mvm_switch_to_d3() argument
764 iwl_mvm_cancel_scan(mvm); in iwl_mvm_switch_to_d3()
766 iwl_trans_stop_device(mvm->trans); in iwl_mvm_switch_to_d3()
778 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in iwl_mvm_switch_to_d3()
781 memset(mvm->fw_key_table, 0, sizeof(mvm->fw_key_table)); in iwl_mvm_switch_to_d3()
783 mvm->ptk_ivlen = 0; in iwl_mvm_switch_to_d3()
784 mvm->ptk_icvlen = 0; in iwl_mvm_switch_to_d3()
785 mvm->ptk_ivlen = 0; in iwl_mvm_switch_to_d3()
786 mvm->ptk_icvlen = 0; in iwl_mvm_switch_to_d3()
788 return iwl_mvm_load_d3_fw(mvm); in iwl_mvm_switch_to_d3()
792 iwl_mvm_get_wowlan_config(struct iwl_mvm *mvm, in iwl_mvm_get_wowlan_config() argument
807 ret = iwl_mvm_get_last_nonqos_seq(mvm, vif); in iwl_mvm_get_wowlan_config()
855 iwl_mvm_wowlan_config(struct iwl_mvm *mvm, in iwl_mvm_wowlan_config() argument
870 ret = iwl_mvm_switch_to_d3(mvm); in iwl_mvm_wowlan_config()
874 ret = iwl_mvm_d3_reprogram(mvm, vif, ap_sta); in iwl_mvm_wowlan_config()
888 mutex_unlock(&mvm->mutex); in iwl_mvm_wowlan_config()
889 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_wowlan_config()
892 mutex_lock(&mvm->mutex); in iwl_mvm_wowlan_config()
906 ret = iwl_mvm_send_cmd(mvm, &rsc_tsc_cmd); in iwl_mvm_wowlan_config()
912 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_wowlan_config()
930 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_wowlan_config()
939 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, in iwl_mvm_wowlan_config()
945 ret = iwl_mvm_send_patterns(mvm, wowlan); in iwl_mvm_wowlan_config()
949 ret = iwl_mvm_send_proto_offload(mvm, vif, false, 0); in iwl_mvm_wowlan_config()
953 ret = iwl_mvm_send_remote_wake_cfg(mvm, vif, wowlan->tcp); in iwl_mvm_wowlan_config()
961 iwl_mvm_netdetect_config(struct iwl_mvm *mvm, in iwl_mvm_netdetect_config() argument
969 ret = iwl_mvm_switch_to_d3(mvm); in iwl_mvm_netdetect_config()
978 ret = iwl_mvm_send_cmd_pdu(mvm, WOWLAN_CONFIGURATION, 0, in iwl_mvm_netdetect_config()
984 ret = iwl_mvm_scan_offload_start(mvm, vif, nd_config, &mvm->nd_ies); in iwl_mvm_netdetect_config()
988 if (WARN_ON(mvm->nd_match_sets || mvm->nd_channels)) in iwl_mvm_netdetect_config()
993 mvm->nd_match_sets = kmemdup(nd_config->match_sets, in iwl_mvm_netdetect_config()
997 if (mvm->nd_match_sets) in iwl_mvm_netdetect_config()
998 mvm->n_nd_match_sets = nd_config->n_match_sets; in iwl_mvm_netdetect_config()
1002 mvm->nd_channels = kmemdup(nd_config->channels, in iwl_mvm_netdetect_config()
1006 if (mvm->nd_channels) in iwl_mvm_netdetect_config()
1007 mvm->n_nd_channels = nd_config->n_channels; in iwl_mvm_netdetect_config()
1012 static void iwl_mvm_free_nd(struct iwl_mvm *mvm) in iwl_mvm_free_nd() argument
1014 kfree(mvm->nd_match_sets); in iwl_mvm_free_nd()
1015 mvm->nd_match_sets = NULL; in iwl_mvm_free_nd()
1016 mvm->n_nd_match_sets = 0; in iwl_mvm_free_nd()
1017 kfree(mvm->nd_channels); in iwl_mvm_free_nd()
1018 mvm->nd_channels = NULL; in iwl_mvm_free_nd()
1019 mvm->n_nd_channels = 0; in iwl_mvm_free_nd()
1026 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in __iwl_mvm_suspend() local
1056 mutex_lock(&mvm->mutex); in __iwl_mvm_suspend()
1058 vif = iwl_mvm_get_bss_vif(mvm); in __iwl_mvm_suspend()
1068 if (!wowlan->nd_config && !mvm->nd_config) { in __iwl_mvm_suspend()
1074 mvm, wowlan, wowlan->nd_config ?: mvm->nd_config, vif); in __iwl_mvm_suspend()
1078 mvm->net_detect = true; in __iwl_mvm_suspend()
1083 mvm->fw_id_to_mac_id[mvmvif->ap_sta_id], in __iwl_mvm_suspend()
1084 lockdep_is_held(&mvm->mutex)); in __iwl_mvm_suspend()
1090 ret = iwl_mvm_get_wowlan_config(mvm, wowlan, &wowlan_config_cmd, in __iwl_mvm_suspend()
1094 ret = iwl_mvm_wowlan_config(mvm, wowlan, &wowlan_config_cmd, in __iwl_mvm_suspend()
1099 mvm->net_detect = false; in __iwl_mvm_suspend()
1102 ret = iwl_mvm_power_update_device(mvm); in __iwl_mvm_suspend()
1106 ret = iwl_mvm_power_update_mac(mvm); in __iwl_mvm_suspend()
1111 if (mvm->d3_wake_sysassert) in __iwl_mvm_suspend()
1117 ret = iwl_mvm_send_cmd(mvm, &d3_cfg_cmd); in __iwl_mvm_suspend()
1123 mvm->d3_test_pme_ptr = in __iwl_mvm_suspend()
1129 clear_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_suspend()
1131 iwl_trans_d3_suspend(mvm->trans, test); in __iwl_mvm_suspend()
1134 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); in __iwl_mvm_suspend()
1135 ieee80211_restart_hw(mvm->hw); in __iwl_mvm_suspend()
1136 iwl_mvm_free_nd(mvm); in __iwl_mvm_suspend()
1139 mutex_unlock(&mvm->mutex); in __iwl_mvm_suspend()
1144 static int iwl_mvm_enter_d0i3_sync(struct iwl_mvm *mvm) in iwl_mvm_enter_d0i3_sync() argument
1150 iwl_init_notification_wait(&mvm->notif_wait, &wait_d3, in iwl_mvm_enter_d0i3_sync()
1154 ret = iwl_mvm_enter_d0i3(mvm->hw->priv); in iwl_mvm_enter_d0i3_sync()
1158 ret = iwl_wait_notification(&mvm->notif_wait, &wait_d3, HZ); in iwl_mvm_enter_d0i3_sync()
1163 iwl_remove_notification(&mvm->notif_wait, &wait_d3); in iwl_mvm_enter_d0i3_sync()
1169 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_suspend() local
1171 iwl_trans_suspend(mvm->trans); in iwl_mvm_suspend()
1174 if (mvm->trans->d0i3_mode == IWL_D0I3_MODE_ON_SUSPEND) { in iwl_mvm_suspend()
1175 int ret = iwl_mvm_enter_d0i3_sync(mvm); in iwl_mvm_suspend()
1181 mutex_lock(&mvm->d0i3_suspend_mutex); in iwl_mvm_suspend()
1182 __set_bit(D0I3_DEFER_WAKEUP, &mvm->d0i3_suspend_flags); in iwl_mvm_suspend()
1183 mutex_unlock(&mvm->d0i3_suspend_mutex); in iwl_mvm_suspend()
1200 static void iwl_mvm_report_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_report_wakeup_reasons() argument
1279 ivlen = mvm->gtk_ivlen; in iwl_mvm_report_wakeup_reasons()
1280 icvlen += mvm->gtk_icvlen; in iwl_mvm_report_wakeup_reasons()
1282 ivlen = mvm->ptk_ivlen; in iwl_mvm_report_wakeup_reasons()
1283 icvlen += mvm->ptk_icvlen; in iwl_mvm_report_wakeup_reasons()
1473 static bool iwl_mvm_setup_connection_keep(struct iwl_mvm *mvm, in iwl_mvm_setup_connection_keep() argument
1493 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_setup_connection_keep()
1508 ieee80211_iter_keys(mvm->hw, vif, in iwl_mvm_setup_connection_keep()
1559 iwl_mvm_get_wakeup_status(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_get_wakeup_status() argument
1561 u32 base = mvm->error_event_table; in iwl_mvm_get_wakeup_status()
1574 iwl_trans_read_mem_bytes(mvm->trans, base, in iwl_mvm_get_wakeup_status()
1578 IWL_INFO(mvm, "error table is valid (%d) with error (%d)\n", in iwl_mvm_get_wakeup_status()
1591 ret = iwl_mvm_send_cmd_pdu(mvm, OFFLOADS_QUERY_CMD, 0, 0, NULL); in iwl_mvm_get_wakeup_status()
1593 IWL_ERR(mvm, "failed to query offload statistics (%d)\n", ret); in iwl_mvm_get_wakeup_status()
1595 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_get_wakeup_status()
1597 IWL_ERR(mvm, "failed to query status (%d)\n", ret); in iwl_mvm_get_wakeup_status()
1611 IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); in iwl_mvm_get_wakeup_status()
1619 IWL_ERR(mvm, "Invalid WoWLAN status response!\n"); in iwl_mvm_get_wakeup_status()
1632 static bool iwl_mvm_query_wakeup_reasons(struct iwl_mvm *mvm, in iwl_mvm_query_wakeup_reasons() argument
1642 fw_status = iwl_mvm_get_wakeup_status(mvm, vif); in iwl_mvm_query_wakeup_reasons()
1659 mvm->fw_id_to_mac_id[0], in iwl_mvm_query_wakeup_reasons()
1660 lockdep_is_held(&mvm->mutex)); in iwl_mvm_query_wakeup_reasons()
1673 mutex_unlock(&mvm->mutex); in iwl_mvm_query_wakeup_reasons()
1675 iwl_mvm_report_wakeup_reasons(mvm, vif, &status); in iwl_mvm_query_wakeup_reasons()
1677 keep = iwl_mvm_setup_connection_keep(mvm, vif, fw_status); in iwl_mvm_query_wakeup_reasons()
1685 mutex_unlock(&mvm->mutex); in iwl_mvm_query_wakeup_reasons()
1695 iwl_mvm_netdetect_query_results(struct iwl_mvm *mvm, in iwl_mvm_netdetect_query_results() argument
1705 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_netdetect_query_results()
1707 IWL_ERR(mvm, "failed to query matched profiles (%d)\n", ret); in iwl_mvm_netdetect_query_results()
1719 IWL_ERR(mvm, "Invalid scan offload profiles query response!\n"); in iwl_mvm_netdetect_query_results()
1730 mvm->last_netdetect_scans = le32_to_cpu(query->n_scans_done); in iwl_mvm_netdetect_query_results()
1738 static void iwl_mvm_query_netdetect_reasons(struct iwl_mvm *mvm, in iwl_mvm_query_netdetect_reasons() argument
1752 fw_status = iwl_mvm_get_wakeup_status(mvm, vif); in iwl_mvm_query_netdetect_reasons()
1764 ret = iwl_mvm_netdetect_query_results(mvm, &query); in iwl_mvm_query_netdetect_reasons()
1771 if (mvm->n_nd_match_sets) { in iwl_mvm_query_netdetect_reasons()
1774 IWL_ERR(mvm, "no net detect match information available\n"); in iwl_mvm_query_netdetect_reasons()
1784 for_each_set_bit(i, &matched_profiles, mvm->n_nd_match_sets) { in iwl_mvm_query_netdetect_reasons()
1802 match->ssid.ssid_len = mvm->nd_match_sets[i].ssid.ssid_len; in iwl_mvm_query_netdetect_reasons()
1803 memcpy(match->ssid.ssid, mvm->nd_match_sets[i].ssid.ssid, in iwl_mvm_query_netdetect_reasons()
1806 if (mvm->n_nd_channels < n_channels) in iwl_mvm_query_netdetect_reasons()
1812 mvm->nd_channels[j]->center_freq; in iwl_mvm_query_netdetect_reasons()
1818 iwl_mvm_free_nd(mvm); in iwl_mvm_query_netdetect_reasons()
1820 mutex_unlock(&mvm->mutex); in iwl_mvm_query_netdetect_reasons()
1830 static void iwl_mvm_read_d3_sram(struct iwl_mvm *mvm) in iwl_mvm_read_d3_sram() argument
1833 const struct fw_img *img = &mvm->fw->img[IWL_UCODE_WOWLAN]; in iwl_mvm_read_d3_sram()
1837 if (!mvm->store_d3_resume_sram) in iwl_mvm_read_d3_sram()
1840 if (!mvm->d3_resume_sram) { in iwl_mvm_read_d3_sram()
1841 mvm->d3_resume_sram = kzalloc(len, GFP_KERNEL); in iwl_mvm_read_d3_sram()
1842 if (!mvm->d3_resume_sram) in iwl_mvm_read_d3_sram()
1846 iwl_trans_read_mem_bytes(mvm->trans, offs, mvm->d3_resume_sram, len); in iwl_mvm_read_d3_sram()
1861 static int __iwl_mvm_resume(struct iwl_mvm *mvm, bool test) in __iwl_mvm_resume() argument
1868 mutex_lock(&mvm->mutex); in __iwl_mvm_resume()
1871 vif = iwl_mvm_get_bss_vif(mvm); in __iwl_mvm_resume()
1875 ret = iwl_trans_d3_resume(mvm->trans, &d3_status, test); in __iwl_mvm_resume()
1880 IWL_INFO(mvm, "Device was reset during suspend\n"); in __iwl_mvm_resume()
1885 iwl_mvm_read_d3_sram(mvm); in __iwl_mvm_resume()
1891 iwl_mvm_update_changed_regdom(mvm); in __iwl_mvm_resume()
1893 if (mvm->net_detect) { in __iwl_mvm_resume()
1894 iwl_mvm_query_netdetect_reasons(mvm, vif); in __iwl_mvm_resume()
1898 keep = iwl_mvm_query_wakeup_reasons(mvm, vif); in __iwl_mvm_resume()
1901 mvm->keep_vif = vif; in __iwl_mvm_resume()
1908 iwl_mvm_free_nd(mvm); in __iwl_mvm_resume()
1909 mutex_unlock(&mvm->mutex); in __iwl_mvm_resume()
1913 ieee80211_iterate_active_interfaces_rtnl(mvm->hw, in __iwl_mvm_resume()
1919 set_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status); in __iwl_mvm_resume()
1920 set_bit(IWL_MVM_STATUS_D3_RECONFIG, &mvm->status); in __iwl_mvm_resume()
1928 iwl_mvm_ref(mvm, IWL_MVM_REF_UCODE_DOWN); in __iwl_mvm_resume()
1934 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_resume() local
1936 iwl_trans_resume(mvm->trans); in iwl_mvm_resume()
1938 if (mvm->hw->wiphy->wowlan_config->any) { in iwl_mvm_resume()
1940 if (mvm->trans->d0i3_mode == IWL_D0I3_MODE_ON_SUSPEND) { in iwl_mvm_resume()
1953 return __iwl_mvm_resume(mvm, false); in iwl_mvm_resume()
1958 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_set_wakeup() local
1960 device_set_wakeup_enable(mvm->trans->dev, enabled); in iwl_mvm_set_wakeup()
1966 struct iwl_mvm *mvm = inode->i_private; in iwl_mvm_d3_test_open() local
1969 if (mvm->d3_test_active) in iwl_mvm_d3_test_open()
1974 ieee80211_stop_queues(mvm->hw); in iwl_mvm_d3_test_open()
1979 err = __iwl_mvm_suspend(mvm->hw, mvm->hw->wiphy->wowlan_config, true); in iwl_mvm_d3_test_open()
1984 ieee80211_wake_queues(mvm->hw); in iwl_mvm_d3_test_open()
1987 mvm->d3_test_active = true; in iwl_mvm_d3_test_open()
1988 mvm->keep_vif = NULL; in iwl_mvm_d3_test_open()
1995 struct iwl_mvm *mvm = file->private_data; in iwl_mvm_d3_test_read() local
2000 if (mvm->d3_test_pme_ptr) { in iwl_mvm_d3_test_read()
2001 pme_asserted = iwl_trans_read_mem32(mvm->trans, in iwl_mvm_d3_test_read()
2002 mvm->d3_test_pme_ptr); in iwl_mvm_d3_test_read()
2027 struct iwl_mvm *mvm = inode->i_private; in iwl_mvm_d3_test_release() local
2030 mvm->d3_test_active = false; in iwl_mvm_d3_test_release()
2032 __iwl_mvm_resume(mvm, true); in iwl_mvm_d3_test_release()
2034 iwl_abort_notification_waits(&mvm->notif_wait); in iwl_mvm_d3_test_release()
2035 ieee80211_restart_hw(mvm->hw); in iwl_mvm_d3_test_release()
2038 while (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) && in iwl_mvm_d3_test_release()
2045 IWL_ERR(mvm, "Timed out waiting for HW restart to finish!\n"); in iwl_mvm_d3_test_release()
2048 mvm->hw, IEEE80211_IFACE_ITER_NORMAL, in iwl_mvm_d3_test_release()
2049 iwl_mvm_d3_test_disconn_work_iter, mvm->keep_vif); in iwl_mvm_d3_test_release()
2051 ieee80211_wake_queues(mvm->hw); in iwl_mvm_d3_test_release()