Lines Matching refs:mvm
80 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_nic_config() local
83 u32 phy_config = iwl_mvm_get_phy_config(mvm); in iwl_mvm_nic_config()
92 IWL_DEBUG_INFO(mvm, "Radio type=0x%x-0x%x-0x%x\n", radio_cfg_type, in iwl_mvm_nic_config()
95 if (mvm->trans->trans_cfg->device_family >= IWL_DEVICE_FAMILY_AX210) in iwl_mvm_nic_config()
99 reg_val = CSR_HW_REV_STEP_DASH(mvm->trans->hw_rev); in iwl_mvm_nic_config()
117 if (mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_8000) in iwl_mvm_nic_config()
120 if (iwl_fw_dbg_is_d3_debug_enabled(&mvm->fwrt)) in iwl_mvm_nic_config()
123 iwl_trans_set_bits_mask(mvm->trans, CSR_HW_IF_CONFIG_REG, in iwl_mvm_nic_config()
138 if (!mvm->trans->cfg->apmg_not_supported) in iwl_mvm_nic_config()
139 iwl_set_bits_mask_prph(mvm->trans, APMG_PS_CTRL_REG, in iwl_mvm_nic_config()
144 static void iwl_mvm_rx_esr_mode_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_esr_mode_notif() argument
149 struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); in iwl_mvm_rx_esr_mode_notif()
156 iwl_mvm_unblock_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW); in iwl_mvm_rx_esr_mode_notif()
158 iwl_mvm_block_esr(mvm, vif, IWL_MVM_ESR_BLOCKED_FW, in iwl_mvm_rx_esr_mode_notif()
162 static void iwl_mvm_rx_esr_trans_fail_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_esr_trans_fail_notif() argument
167 struct ieee80211_vif *vif = iwl_mvm_get_bss_vif(mvm); in iwl_mvm_rx_esr_trans_fail_notif()
174 IWL_DEBUG_INFO(mvm, "Failed to %s eSR on link %d, reason %d\n", in iwl_mvm_rx_esr_trans_fail_notif()
181 iwl_mvm_connection_loss(mvm, vif, "emlsr exit failed"); in iwl_mvm_rx_esr_trans_fail_notif()
185 bss_conf = iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, fw_link_id, false); in iwl_mvm_rx_esr_trans_fail_notif()
186 if (IWL_FW_CHECK(mvm, !bss_conf, in iwl_mvm_rx_esr_trans_fail_notif()
195 iwl_mvm_exit_esr(mvm, vif, IWL_MVM_ESR_EXIT_FAIL_ENTRY, in iwl_mvm_rx_esr_trans_fail_notif()
199 static void iwl_mvm_rx_monitor_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_monitor_notif() argument
212 vif = iwl_mvm_get_vif_by_macid(mvm, notif->link_id); in iwl_mvm_rx_monitor_notif()
225 if (mvm->cca_40mhz_workaround) in iwl_mvm_rx_monitor_notif()
232 mvm->cca_40mhz_workaround = 2; in iwl_mvm_rx_monitor_notif()
241 sband = mvm->hw->wiphy->bands[NL80211_BAND_2GHZ]; in iwl_mvm_rx_monitor_notif()
267 struct iwl_mvm *mvm = mvmvif->mvm; in iwl_mvm_update_link_smps() local
273 if (mvm->fw_static_smps_request && in iwl_mvm_update_link_smps()
278 iwl_mvm_update_smps(mvm, vif, IWL_MVM_SMPS_REQ_FW, mode, in iwl_mvm_update_link_smps()
296 static void iwl_mvm_rx_thermal_dual_chain_req(struct iwl_mvm *mvm, in iwl_mvm_rx_thermal_dual_chain_req() argument
303 if (IWL_FW_CHECK(mvm, iwl_mvm_has_rlc_offload(mvm), in iwl_mvm_rx_thermal_dual_chain_req()
312 mvm->fw_static_smps_request = in iwl_mvm_rx_thermal_dual_chain_req()
314 ieee80211_iterate_interfaces(mvm->hw, in iwl_mvm_rx_thermal_dual_chain_req()
349 void (*fn)(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
802 static u32 iwl_mvm_min_backoff(struct iwl_mvm *mvm) in iwl_mvm_min_backoff() argument
804 const struct iwl_pwr_tx_backoff *backoff = mvm->cfg->pwr_tx_backoffs; in iwl_mvm_min_backoff()
810 iwl_bios_get_pwr_limit(&mvm->fwrt, &dflt_pwr_limit); in iwl_mvm_min_backoff()
824 struct iwl_mvm *mvm = in iwl_mvm_tx_unblock_dwork() local
829 guard(mvm)(mvm); in iwl_mvm_tx_unblock_dwork() local
832 rcu_dereference_protected(mvm->csa_tx_blocked_vif, in iwl_mvm_tx_unblock_dwork()
833 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tx_unblock_dwork()
839 iwl_mvm_modify_all_sta_disable_tx(mvm, mvmvif, false); in iwl_mvm_tx_unblock_dwork()
840 RCU_INIT_POINTER(mvm->csa_tx_blocked_vif, NULL); in iwl_mvm_tx_unblock_dwork()
845 struct iwl_mvm *mvm = ctx; in iwl_mvm_fwrt_dump_start() local
847 mutex_lock(&mvm->mutex); in iwl_mvm_fwrt_dump_start()
852 struct iwl_mvm *mvm = ctx; in iwl_mvm_fwrt_dump_end() local
854 mutex_unlock(&mvm->mutex); in iwl_mvm_fwrt_dump_end()
859 struct iwl_mvm *mvm = (struct iwl_mvm *)ctx; in iwl_mvm_fwrt_send_hcmd() local
861 guard(mvm)(mvm); in iwl_mvm_fwrt_send_hcmd() local
862 return iwl_mvm_send_cmd(mvm, host_cmd); in iwl_mvm_fwrt_send_hcmd()
877 static int iwl_mvm_start_get_nvm(struct iwl_mvm *mvm) in iwl_mvm_start_get_nvm() argument
879 struct iwl_trans *trans = mvm->trans; in iwl_mvm_start_get_nvm()
883 if (WARN(!mvm->mei_registered, in iwl_mvm_start_get_nvm()
887 mvm->mei_nvm_data = iwl_mei_get_nvm(); in iwl_mvm_start_get_nvm()
888 if (mvm->mei_nvm_data) { in iwl_mvm_start_get_nvm()
894 mvm->nvm_data = in iwl_mvm_start_get_nvm()
896 mvm->mei_nvm_data, in iwl_mvm_start_get_nvm()
897 mvm->fw, in iwl_mvm_start_get_nvm()
898 mvm->set_tx_ant, in iwl_mvm_start_get_nvm()
899 mvm->set_rx_ant); in iwl_mvm_start_get_nvm()
903 IWL_ERR(mvm, in iwl_mvm_start_get_nvm()
909 wiphy_lock(mvm->hw->wiphy); in iwl_mvm_start_get_nvm()
910 mutex_lock(&mvm->mutex); in iwl_mvm_start_get_nvm()
912 ret = iwl_trans_start_hw(mvm->trans); in iwl_mvm_start_get_nvm()
914 mutex_unlock(&mvm->mutex); in iwl_mvm_start_get_nvm()
915 wiphy_unlock(mvm->hw->wiphy); in iwl_mvm_start_get_nvm()
920 ret = iwl_run_init_mvm_ucode(mvm); in iwl_mvm_start_get_nvm()
922 iwl_fw_dbg_error_collect(&mvm->fwrt, FW_DBG_TRIGGER_DRIVER); in iwl_mvm_start_get_nvm()
923 if (!ret && iwl_mvm_is_lar_supported(mvm)) { in iwl_mvm_start_get_nvm()
924 mvm->hw->wiphy->regulatory_flags |= REGULATORY_WIPHY_SELF_MANAGED; in iwl_mvm_start_get_nvm()
925 ret = iwl_mvm_init_mcc(mvm); in iwl_mvm_start_get_nvm()
928 iwl_mvm_stop_device(mvm); in iwl_mvm_start_get_nvm()
930 mutex_unlock(&mvm->mutex); in iwl_mvm_start_get_nvm()
931 wiphy_unlock(mvm->hw->wiphy); in iwl_mvm_start_get_nvm()
935 IWL_ERR(mvm, "Failed to run INIT ucode: %d\n", ret); in iwl_mvm_start_get_nvm()
938 mvm->fw_product_reset = false; in iwl_mvm_start_get_nvm()
943 static int iwl_mvm_start_post_nvm(struct iwl_mvm *mvm) in iwl_mvm_start_post_nvm() argument
948 iwl_mvm_toggle_tx_ant(mvm, &mvm->mgmt_last_antenna_idx); in iwl_mvm_start_post_nvm()
950 ret = iwl_mvm_mac_setup_register(mvm); in iwl_mvm_start_post_nvm()
954 mvm->hw_registered = true; in iwl_mvm_start_post_nvm()
956 iwl_mvm_dbgfs_register(mvm); in iwl_mvm_start_post_nvm()
958 wiphy_rfkill_set_hw_state_reason(mvm->hw->wiphy, in iwl_mvm_start_post_nvm()
959 mvm->mei_rfkill_blocked, in iwl_mvm_start_post_nvm()
962 iwl_mvm_mei_set_sw_rfkill_state(mvm); in iwl_mvm_start_post_nvm()
1038 struct iwl_mvm *mvm = ctx; in iwl_mvm_frob_txf() local
1041 if (iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_frob_txf()
1045 ieee80211_iter_keys_rcu(mvm->hw, NULL, iwl_mvm_frob_txf_key_iter, &txf); in iwl_mvm_frob_txf()
1096 struct iwl_mvm *mvm = ctx; in iwl_mvm_frob_mem() local
1099 switch (mvm->fwrt.cur_fw_img) { in iwl_mvm_frob_mem()
1106 excl = mvm->fw->dump_excl; in iwl_mvm_frob_mem()
1109 excl = mvm->fw->dump_excl_wowlan; in iwl_mvm_frob_mem()
1113 BUILD_BUG_ON(sizeof(mvm->fw->dump_excl) != in iwl_mvm_frob_mem()
1114 sizeof(mvm->fw->dump_excl_wowlan)); in iwl_mvm_frob_mem()
1116 for (i = 0; i < ARRAY_SIZE(mvm->fw->dump_excl); i++) { in iwl_mvm_frob_mem()
1146 struct iwl_mvm *mvm = priv; in iwl_mvm_me_conn_status() local
1153 prev_conn_info = rcu_dereference_protected(mvm->csme_conn_info, true); in iwl_mvm_me_conn_status()
1161 rcu_assign_pointer(mvm->csme_conn_info, curr_conn_info); in iwl_mvm_me_conn_status()
1170 struct iwl_mvm *mvm = priv; in iwl_mvm_mei_rfkill() local
1175 mvm->mei_rfkill_blocked = blocked; in iwl_mvm_mei_rfkill()
1176 if (!mvm->hw_registered) in iwl_mvm_mei_rfkill()
1179 wiphy_rfkill_set_hw_state_reason(mvm->hw->wiphy, in iwl_mvm_mei_rfkill()
1180 mvm->mei_rfkill_blocked, in iwl_mvm_mei_rfkill()
1186 struct iwl_mvm *mvm = priv; in iwl_mvm_mei_roaming_forbidden() local
1188 if (!mvm->hw_registered || !mvm->csme_vif) in iwl_mvm_mei_roaming_forbidden()
1191 iwl_mvm_send_roaming_forbidden_event(mvm, mvm->csme_vif, forbidden); in iwl_mvm_mei_roaming_forbidden()
1196 struct iwl_mvm *mvm = in iwl_mvm_sap_connected_wk() local
1200 ret = iwl_mvm_start_get_nvm(mvm); in iwl_mvm_sap_connected_wk()
1204 ret = iwl_mvm_start_post_nvm(mvm); in iwl_mvm_sap_connected_wk()
1211 IWL_ERR(mvm, "Couldn't get started...\n"); in iwl_mvm_sap_connected_wk()
1214 iwl_fw_flush_dumps(&mvm->fwrt); in iwl_mvm_sap_connected_wk()
1215 iwl_mvm_thermal_exit(mvm); in iwl_mvm_sap_connected_wk()
1216 iwl_fw_runtime_free(&mvm->fwrt); in iwl_mvm_sap_connected_wk()
1217 iwl_phy_db_free(mvm->phy_db); in iwl_mvm_sap_connected_wk()
1218 kfree(mvm->scan_cmd); in iwl_mvm_sap_connected_wk()
1219 iwl_trans_op_mode_leave(mvm->trans); in iwl_mvm_sap_connected_wk()
1220 kfree(mvm->nvm_data); in iwl_mvm_sap_connected_wk()
1221 kfree(mvm->mei_nvm_data); in iwl_mvm_sap_connected_wk()
1223 ieee80211_free_hw(mvm->hw); in iwl_mvm_sap_connected_wk()
1228 struct iwl_mvm *mvm = priv; in iwl_mvm_mei_sap_connected() local
1230 if (!mvm->hw_registered) in iwl_mvm_mei_sap_connected()
1231 schedule_work(&mvm->sap_connected_wk); in iwl_mvm_mei_sap_connected()
1236 struct iwl_mvm *mvm = priv; in iwl_mvm_mei_nic_stolen() local
1239 cfg80211_shutdown_all_interfaces(mvm->hw->wiphy); in iwl_mvm_mei_nic_stolen()
1257 iwl_mvm_select_links(mvmvif->mvm, vif); in iwl_mvm_find_link_selection_vif()
1263 struct iwl_mvm *mvm = in iwl_mvm_trig_link_selection() local
1266 mutex_lock(&mvm->mutex); in iwl_mvm_trig_link_selection()
1267 ieee80211_iterate_active_interfaces(mvm->hw, in iwl_mvm_trig_link_selection()
1271 mutex_unlock(&mvm->mutex); in iwl_mvm_trig_link_selection()
1280 struct iwl_mvm *mvm; in iwl_op_mode_mvm_start() local
1296 BUILD_BUG_ON(ARRAY_SIZE(mvm->fw_id_to_mac_id) != in iwl_op_mode_mvm_start()
1323 mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_op_mode_mvm_start()
1324 mvm->dev = trans->dev; in iwl_op_mode_mvm_start()
1325 mvm->trans = trans; in iwl_op_mode_mvm_start()
1326 mvm->cfg = cfg; in iwl_op_mode_mvm_start()
1327 mvm->fw = fw; in iwl_op_mode_mvm_start()
1328 mvm->hw = hw; in iwl_op_mode_mvm_start()
1330 iwl_fw_runtime_init(&mvm->fwrt, trans, fw, &iwl_mvm_fwrt_ops, mvm, in iwl_op_mode_mvm_start()
1331 &iwl_mvm_sanitize_ops, mvm, dbgfs_dir); in iwl_op_mode_mvm_start()
1333 iwl_mvm_get_bios_tables(mvm); in iwl_op_mode_mvm_start()
1334 iwl_uefi_get_sgom_table(trans, &mvm->fwrt); in iwl_op_mode_mvm_start()
1336 iwl_bios_setup_step(trans, &mvm->fwrt); in iwl_op_mode_mvm_start()
1338 mvm->init_status = 0; in iwl_op_mode_mvm_start()
1340 if (iwl_mvm_has_new_rx_api(mvm)) { in iwl_op_mode_mvm_start()
1358 mvm->bios_enable_puncturing = iwl_uefi_get_puncturing(&mvm->fwrt); in iwl_op_mode_mvm_start()
1360 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_op_mode_mvm_start()
1370 mvm->aux_queue = IWL_MVM_INVALID_QUEUE; in iwl_op_mode_mvm_start()
1371 mvm->snif_queue = IWL_MVM_INVALID_QUEUE; in iwl_op_mode_mvm_start()
1372 mvm->probe_queue = IWL_MVM_INVALID_QUEUE; in iwl_op_mode_mvm_start()
1373 mvm->p2p_dev_queue = IWL_MVM_INVALID_QUEUE; in iwl_op_mode_mvm_start()
1375 mvm->aux_queue = IWL_MVM_DQA_AUX_QUEUE; in iwl_op_mode_mvm_start()
1376 mvm->snif_queue = IWL_MVM_DQA_INJECT_MONITOR_QUEUE; in iwl_op_mode_mvm_start()
1377 mvm->probe_queue = IWL_MVM_DQA_AP_PROBE_RESP_QUEUE; in iwl_op_mode_mvm_start()
1378 mvm->p2p_dev_queue = IWL_MVM_DQA_P2P_DEVICE_QUEUE; in iwl_op_mode_mvm_start()
1381 mvm->sf_state = SF_UNINIT; in iwl_op_mode_mvm_start()
1382 if (iwl_mvm_has_unified_ucode(mvm)) in iwl_op_mode_mvm_start()
1383 iwl_fw_set_current_image(&mvm->fwrt, IWL_UCODE_REGULAR); in iwl_op_mode_mvm_start()
1385 iwl_fw_set_current_image(&mvm->fwrt, IWL_UCODE_INIT); in iwl_op_mode_mvm_start()
1386 mvm->drop_bcn_ap_mode = true; in iwl_op_mode_mvm_start()
1388 mutex_init(&mvm->mutex); in iwl_op_mode_mvm_start()
1389 spin_lock_init(&mvm->async_handlers_lock); in iwl_op_mode_mvm_start()
1390 INIT_LIST_HEAD(&mvm->time_event_list); in iwl_op_mode_mvm_start()
1391 INIT_LIST_HEAD(&mvm->aux_roc_te_list); in iwl_op_mode_mvm_start()
1392 INIT_LIST_HEAD(&mvm->async_handlers_list); in iwl_op_mode_mvm_start()
1393 spin_lock_init(&mvm->time_event_lock); in iwl_op_mode_mvm_start()
1394 INIT_LIST_HEAD(&mvm->ftm_initiator.loc_list); in iwl_op_mode_mvm_start()
1395 INIT_LIST_HEAD(&mvm->ftm_initiator.pasn_list); in iwl_op_mode_mvm_start()
1396 INIT_LIST_HEAD(&mvm->resp_pasn_list); in iwl_op_mode_mvm_start()
1398 INIT_WORK(&mvm->async_handlers_wk, iwl_mvm_async_handlers_wk); in iwl_op_mode_mvm_start()
1399 INIT_WORK(&mvm->roc_done_wk, iwl_mvm_roc_done_wk); in iwl_op_mode_mvm_start()
1400 INIT_WORK(&mvm->sap_connected_wk, iwl_mvm_sap_connected_wk); in iwl_op_mode_mvm_start()
1401 INIT_DELAYED_WORK(&mvm->tdls_cs.dwork, iwl_mvm_tdls_ch_switch_work); in iwl_op_mode_mvm_start()
1402 INIT_DELAYED_WORK(&mvm->scan_timeout_dwork, iwl_mvm_scan_timeout_wk); in iwl_op_mode_mvm_start()
1403 INIT_WORK(&mvm->add_stream_wk, iwl_mvm_add_new_dqa_stream_wk); in iwl_op_mode_mvm_start()
1404 INIT_LIST_HEAD(&mvm->add_stream_txqs); in iwl_op_mode_mvm_start()
1405 spin_lock_init(&mvm->add_stream_lock); in iwl_op_mode_mvm_start()
1407 wiphy_work_init(&mvm->async_handlers_wiphy_wk, in iwl_op_mode_mvm_start()
1410 wiphy_work_init(&mvm->trig_link_selection_wk, in iwl_op_mode_mvm_start()
1413 init_waitqueue_head(&mvm->rx_sync_waitq); in iwl_op_mode_mvm_start()
1415 mvm->queue_sync_state = 0; in iwl_op_mode_mvm_start()
1417 SET_IEEE80211_DEV(mvm->hw, mvm->trans->dev); in iwl_op_mode_mvm_start()
1419 spin_lock_init(&mvm->tcm.lock); in iwl_op_mode_mvm_start()
1420 INIT_DELAYED_WORK(&mvm->tcm.work, iwl_mvm_tcm_work); in iwl_op_mode_mvm_start()
1421 mvm->tcm.ts = jiffies; in iwl_op_mode_mvm_start()
1422 mvm->tcm.ll_ts = jiffies; in iwl_op_mode_mvm_start()
1423 mvm->tcm.uapsd_nonagg_ts = jiffies; in iwl_op_mode_mvm_start()
1425 INIT_DELAYED_WORK(&mvm->cs_tx_unblock_dwork, iwl_mvm_tx_unblock_dwork); in iwl_op_mode_mvm_start()
1427 mvm->cmd_ver.range_resp = in iwl_op_mode_mvm_start()
1428 iwl_fw_lookup_notif_ver(mvm->fw, LOCATION_GROUP, in iwl_op_mode_mvm_start()
1431 if (WARN_ON_ONCE(mvm->cmd_ver.range_resp > 9)) { in iwl_op_mode_mvm_start()
1448 mvm->trans->trans_cfg->device_family < IWL_DEVICE_FAMILY_AX210; in iwl_op_mode_mvm_start()
1460 snprintf(mvm->hw->wiphy->fw_version, in iwl_op_mode_mvm_start()
1461 sizeof(mvm->hw->wiphy->fw_version), in iwl_op_mode_mvm_start()
1464 trans_cfg.fw_reset_handshake = fw_has_capa(&mvm->fw->ucode_capa, in iwl_op_mode_mvm_start()
1468 iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_op_mode_mvm_start()
1472 mvm->sta_remove_requires_queue_remove = in iwl_op_mode_mvm_start()
1475 mvm->mld_api_is_used = iwl_mvm_has_mld_api(mvm->fw); in iwl_op_mode_mvm_start()
1478 iwl_trans_configure(mvm->trans, &trans_cfg); in iwl_op_mode_mvm_start()
1481 trans->dbg.dest_tlv = mvm->fw->dbg.dest_tlv; in iwl_op_mode_mvm_start()
1482 trans->dbg.n_dest_reg = mvm->fw->dbg.n_dest_reg; in iwl_op_mode_mvm_start()
1484 trans->iml = mvm->fw->iml; in iwl_op_mode_mvm_start()
1485 trans->iml_len = mvm->fw->iml_len; in iwl_op_mode_mvm_start()
1488 iwl_notification_wait_init(&mvm->notif_wait); in iwl_op_mode_mvm_start()
1491 mvm->phy_db = iwl_phy_db_init(trans); in iwl_op_mode_mvm_start()
1492 if (!mvm->phy_db) { in iwl_op_mode_mvm_start()
1493 IWL_ERR(mvm, "Cannot init phy_db\n"); in iwl_op_mode_mvm_start()
1499 mvm->nvm_file_name = iwlwifi_mod_params.nvm_file; in iwl_op_mode_mvm_start()
1501 IWL_DEBUG_EEPROM(mvm->trans->dev, in iwl_op_mode_mvm_start()
1504 scan_size = iwl_mvm_scan_size(mvm); in iwl_op_mode_mvm_start()
1506 mvm->scan_cmd = kmalloc(scan_size, GFP_KERNEL); in iwl_op_mode_mvm_start()
1507 if (!mvm->scan_cmd) { in iwl_op_mode_mvm_start()
1511 mvm->scan_cmd_size = scan_size; in iwl_op_mode_mvm_start()
1514 mvm->aux_sta.sta_id = IWL_INVALID_STA; in iwl_op_mode_mvm_start()
1515 mvm->snif_sta.sta_id = IWL_INVALID_STA; in iwl_op_mode_mvm_start()
1518 mvm->last_ebs_successful = true; in iwl_op_mode_mvm_start()
1520 min_backoff = iwl_mvm_min_backoff(mvm); in iwl_op_mode_mvm_start()
1521 iwl_mvm_thermal_initialize(mvm, min_backoff); in iwl_op_mode_mvm_start()
1523 if (!iwl_mvm_has_new_rx_stats_api(mvm)) in iwl_op_mode_mvm_start()
1524 memset(&mvm->rx_stats_v3, 0, in iwl_op_mode_mvm_start()
1527 memset(&mvm->rx_stats, 0, sizeof(struct mvm_statistics_rx)); in iwl_op_mode_mvm_start()
1529 iwl_mvm_ftm_initiator_smooth_config(mvm); in iwl_op_mode_mvm_start()
1531 iwl_mvm_init_time_sync(&mvm->time_sync); in iwl_op_mode_mvm_start()
1533 mvm->debugfs_dir = dbgfs_dir; in iwl_op_mode_mvm_start()
1535 mvm->mei_registered = !iwl_mei_register(mvm, &mei_ops); in iwl_op_mode_mvm_start()
1537 iwl_mvm_mei_scan_filter_init(&mvm->mei_scan_filter); in iwl_op_mode_mvm_start()
1539 err = iwl_mvm_start_get_nvm(mvm); in iwl_op_mode_mvm_start()
1546 if (trans->csme_own && mvm->mei_registered) in iwl_op_mode_mvm_start()
1553 err = iwl_mvm_start_post_nvm(mvm); in iwl_op_mode_mvm_start()
1560 iwl_mvm_thermal_exit(mvm); in iwl_op_mode_mvm_start()
1561 if (mvm->mei_registered) { in iwl_op_mode_mvm_start()
1566 iwl_fw_flush_dumps(&mvm->fwrt); in iwl_op_mode_mvm_start()
1567 iwl_fw_runtime_free(&mvm->fwrt); in iwl_op_mode_mvm_start()
1569 iwl_phy_db_free(mvm->phy_db); in iwl_op_mode_mvm_start()
1570 kfree(mvm->scan_cmd); in iwl_op_mode_mvm_start()
1573 ieee80211_free_hw(mvm->hw); in iwl_op_mode_mvm_start()
1577 void iwl_mvm_stop_device(struct iwl_mvm *mvm) in iwl_mvm_stop_device() argument
1579 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_device()
1581 iwl_fw_cancel_timestamp(&mvm->fwrt); in iwl_mvm_stop_device()
1583 clear_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status); in iwl_mvm_stop_device()
1585 iwl_mvm_pause_tcm(mvm, false); in iwl_mvm_stop_device()
1587 iwl_fw_dbg_stop_sync(&mvm->fwrt); in iwl_mvm_stop_device()
1588 iwl_trans_stop_device(mvm->trans); in iwl_mvm_stop_device()
1589 iwl_free_fw_paging(&mvm->fwrt); in iwl_mvm_stop_device()
1590 iwl_fw_dump_conf_clear(&mvm->fwrt); in iwl_mvm_stop_device()
1591 iwl_mvm_mei_device_state(mvm, false); in iwl_mvm_stop_device()
1596 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_op_mode_mvm_stop() local
1599 if (mvm->mei_registered) { in iwl_op_mode_mvm_stop()
1610 cancel_work_sync(&mvm->sap_connected_wk); in iwl_op_mode_mvm_stop()
1612 iwl_mvm_leds_exit(mvm); in iwl_op_mode_mvm_stop()
1614 iwl_mvm_thermal_exit(mvm); in iwl_op_mode_mvm_stop()
1624 if (mvm->hw_registered) in iwl_op_mode_mvm_stop()
1625 ieee80211_unregister_hw(mvm->hw); in iwl_op_mode_mvm_stop()
1627 kfree(mvm->scan_cmd); in iwl_op_mode_mvm_stop()
1628 kfree(mvm->mcast_filter_cmd); in iwl_op_mode_mvm_stop()
1629 mvm->mcast_filter_cmd = NULL; in iwl_op_mode_mvm_stop()
1631 kfree(mvm->error_recovery_buf); in iwl_op_mode_mvm_stop()
1632 mvm->error_recovery_buf = NULL; in iwl_op_mode_mvm_stop()
1634 iwl_mvm_ptp_remove(mvm); in iwl_op_mode_mvm_stop()
1636 iwl_trans_op_mode_leave(mvm->trans); in iwl_op_mode_mvm_stop()
1638 iwl_phy_db_free(mvm->phy_db); in iwl_op_mode_mvm_stop()
1639 mvm->phy_db = NULL; in iwl_op_mode_mvm_stop()
1641 kfree(mvm->nvm_data); in iwl_op_mode_mvm_stop()
1642 kfree(mvm->mei_nvm_data); in iwl_op_mode_mvm_stop()
1643 kfree(rcu_access_pointer(mvm->csme_conn_info)); in iwl_op_mode_mvm_stop()
1644 kfree(mvm->temp_nvm_data); in iwl_op_mode_mvm_stop()
1646 kfree(mvm->nvm_sections[i].data); in iwl_op_mode_mvm_stop()
1647 kfree(mvm->acs_survey); in iwl_op_mode_mvm_stop()
1649 cancel_delayed_work_sync(&mvm->tcm.work); in iwl_op_mode_mvm_stop()
1651 iwl_fw_runtime_free(&mvm->fwrt); in iwl_op_mode_mvm_stop()
1652 mutex_destroy(&mvm->mutex); in iwl_op_mode_mvm_stop()
1654 if (mvm->mei_registered) in iwl_op_mode_mvm_stop()
1657 ieee80211_free_hw(mvm->hw); in iwl_op_mode_mvm_stop()
1664 void (*fn)(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb);
1667 void iwl_mvm_async_handlers_purge(struct iwl_mvm *mvm) in iwl_mvm_async_handlers_purge() argument
1671 spin_lock_bh(&mvm->async_handlers_lock); in iwl_mvm_async_handlers_purge()
1672 list_for_each_entry_safe(entry, tmp, &mvm->async_handlers_list, list) { in iwl_mvm_async_handlers_purge()
1677 spin_unlock_bh(&mvm->async_handlers_lock); in iwl_mvm_async_handlers_purge()
1684 static void iwl_mvm_async_handlers_by_context(struct iwl_mvm *mvm, in iwl_mvm_async_handlers_by_context() argument
1695 spin_lock_bh(&mvm->async_handlers_lock); in iwl_mvm_async_handlers_by_context()
1696 list_for_each_entry_safe(entry, tmp, &mvm->async_handlers_list, list) { in iwl_mvm_async_handlers_by_context()
1702 spin_unlock_bh(&mvm->async_handlers_lock); in iwl_mvm_async_handlers_by_context()
1706 mutex_lock(&mvm->mutex); in iwl_mvm_async_handlers_by_context()
1707 entry->fn(mvm, &entry->rxb); in iwl_mvm_async_handlers_by_context()
1711 mutex_unlock(&mvm->mutex); in iwl_mvm_async_handlers_by_context()
1719 struct iwl_mvm *mvm = in iwl_mvm_async_handlers_wiphy_wk() local
1723 iwl_mvm_async_handlers_by_context(mvm, contexts); in iwl_mvm_async_handlers_wiphy_wk()
1728 struct iwl_mvm *mvm = in iwl_mvm_async_handlers_wk() local
1733 iwl_mvm_async_handlers_by_context(mvm, contexts); in iwl_mvm_async_handlers_wk()
1736 static inline void iwl_mvm_rx_check_trigger(struct iwl_mvm *mvm, in iwl_mvm_rx_check_trigger() argument
1743 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, NULL, in iwl_mvm_rx_check_trigger()
1759 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_rx_check_trigger()
1766 static void iwl_mvm_rx_common(struct iwl_mvm *mvm, in iwl_mvm_rx_common() argument
1774 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_rx_common()
1776 iwl_mvm_rx_check_trigger(mvm, pkt); in iwl_mvm_rx_common()
1783 iwl_notification_wait_notify(&mvm->notif_wait, pkt); in iwl_mvm_rx_common()
1792 if (IWL_FW_CHECK(mvm, pkt_len < rx_h->min_size, in iwl_mvm_rx_common()
1798 rx_h->fn(mvm, rxb); in iwl_mvm_rx_common()
1812 spin_lock(&mvm->async_handlers_lock); in iwl_mvm_rx_common()
1813 list_add_tail(&entry->list, &mvm->async_handlers_list); in iwl_mvm_rx_common()
1814 spin_unlock(&mvm->async_handlers_lock); in iwl_mvm_rx_common()
1816 wiphy_work_queue(mvm->hw->wiphy, in iwl_mvm_rx_common()
1817 &mvm->async_handlers_wiphy_wk); in iwl_mvm_rx_common()
1819 schedule_work(&mvm->async_handlers_wk); in iwl_mvm_rx_common()
1829 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_rx() local
1833 iwl_mvm_rx_rx_mpdu(mvm, napi, rxb); in iwl_mvm_rx()
1835 iwl_mvm_rx_rx_phy_cmd(mvm, rxb); in iwl_mvm_rx()
1837 iwl_mvm_rx_common(mvm, rxb, pkt); in iwl_mvm_rx()
1845 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_rx_mq() local
1849 iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, 0); in iwl_mvm_rx_mq()
1852 iwl_mvm_rx_queue_notif(mvm, napi, rxb, 0); in iwl_mvm_rx_mq()
1854 iwl_mvm_rx_frame_release(mvm, napi, rxb, 0); in iwl_mvm_rx_mq()
1856 iwl_mvm_rx_bar_frame_release(mvm, napi, rxb, 0); in iwl_mvm_rx_mq()
1858 iwl_mvm_rx_monitor_no_data(mvm, napi, rxb, 0); in iwl_mvm_rx_mq()
1860 iwl_mvm_rx_common(mvm, rxb, pkt); in iwl_mvm_rx_mq()
1863 static int iwl_mvm_is_static_queue(struct iwl_mvm *mvm, int queue) in iwl_mvm_is_static_queue() argument
1865 return queue == mvm->aux_queue || queue == mvm->probe_queue || in iwl_mvm_is_static_queue()
1866 queue == mvm->p2p_dev_queue || queue == mvm->snif_queue; in iwl_mvm_is_static_queue()
1872 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_queue_state_change() local
1881 sta_id = iwl_mvm_has_new_tx_api(mvm) ? in iwl_mvm_queue_state_change()
1882 mvm->tvqm_info[hw_queue].sta_id : in iwl_mvm_queue_state_change()
1883 mvm->queue_info[hw_queue].ra_sta_id; in iwl_mvm_queue_state_change()
1885 if (WARN_ON_ONCE(sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_queue_state_change()
1890 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_queue_state_change()
1895 if (iwl_mvm_is_static_queue(mvm, hw_queue)) { in iwl_mvm_queue_state_change()
1897 ieee80211_stop_queues(mvm->hw); in iwl_mvm_queue_state_change()
1899 ieee80211_wake_queues(mvm->hw); in iwl_mvm_queue_state_change()
1904 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_queue_state_change()
1905 int tid = mvm->tvqm_info[hw_queue].txq_tid; in iwl_mvm_queue_state_change()
1909 tid_bitmap = mvm->queue_info[hw_queue].tid_bitmap; in iwl_mvm_queue_state_change()
1927 iwl_mvm_mac_itxq_xmit(mvm->hw, txq); in iwl_mvm_queue_state_change()
1946 static void iwl_mvm_set_rfkill_state(struct iwl_mvm *mvm) in iwl_mvm_set_rfkill_state() argument
1948 wiphy_rfkill_set_hw_state(mvm->hw->wiphy, in iwl_mvm_set_rfkill_state()
1949 iwl_mvm_is_radio_killed(mvm)); in iwl_mvm_set_rfkill_state()
1952 void iwl_mvm_set_hw_ctkill_state(struct iwl_mvm *mvm, bool state) in iwl_mvm_set_hw_ctkill_state() argument
1955 set_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); in iwl_mvm_set_hw_ctkill_state()
1957 clear_bit(IWL_MVM_STATUS_HW_CTKILL, &mvm->status); in iwl_mvm_set_hw_ctkill_state()
1959 iwl_mvm_set_rfkill_state(mvm); in iwl_mvm_set_hw_ctkill_state()
1962 struct iwl_mvm_csme_conn_info *iwl_mvm_get_csme_conn_info(struct iwl_mvm *mvm) in iwl_mvm_get_csme_conn_info() argument
1964 return rcu_dereference_protected(mvm->csme_conn_info, in iwl_mvm_get_csme_conn_info()
1965 lockdep_is_held(&mvm->mutex)); in iwl_mvm_get_csme_conn_info()
1970 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_set_hw_rfkill_state() local
1971 bool rfkill_safe_init_done = READ_ONCE(mvm->rfkill_safe_init_done); in iwl_mvm_set_hw_rfkill_state()
1972 bool unified = iwl_mvm_has_unified_ucode(mvm); in iwl_mvm_set_hw_rfkill_state()
1975 set_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); in iwl_mvm_set_hw_rfkill_state()
1977 clear_bit(IWL_MVM_STATUS_HW_RFKILL, &mvm->status); in iwl_mvm_set_hw_rfkill_state()
1979 iwl_mvm_set_rfkill_state(mvm); in iwl_mvm_set_hw_rfkill_state()
1983 iwl_abort_notification_waits(&mvm->notif_wait); in iwl_mvm_set_hw_rfkill_state()
2001 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_free_skb() local
2005 iwl_trans_free_tx_cmd(mvm->trans, info->driver_data[1]); in iwl_mvm_free_skb()
2006 ieee80211_free_txskb(mvm->hw, skb); in iwl_mvm_free_skb()
2012 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_nic_error() local
2014 iwl_abort_notification_waits(&mvm->notif_wait); in iwl_mvm_nic_error()
2015 iwl_dbg_tlv_del_timers(mvm->trans); in iwl_mvm_nic_error()
2018 IWL_ERR(mvm, "Command queue full!\n"); in iwl_mvm_nic_error()
2019 else if (!test_bit(STATUS_TRANS_DEAD, &mvm->trans->status) && in iwl_mvm_nic_error()
2021 &mvm->status)) in iwl_mvm_nic_error()
2022 iwl_mvm_dump_nic_error_log(mvm); in iwl_mvm_nic_error()
2033 set_bit(IWL_MVM_STATUS_HW_RESTART_REQUESTED, &mvm->status); in iwl_mvm_nic_error()
2039 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_dump_error() local
2043 lockdep_assert_held(&mvm->mutex); in iwl_mvm_dump_error()
2044 iwl_fw_error_collect(&mvm->fwrt); in iwl_mvm_dump_error()
2046 mutex_lock(&mvm->mutex); in iwl_mvm_dump_error()
2048 iwl_fw_error_collect(&mvm->fwrt); in iwl_mvm_dump_error()
2049 mutex_unlock(&mvm->mutex); in iwl_mvm_dump_error()
2056 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_sw_reset() local
2063 if (!test_bit(IWL_MVM_STATUS_FIRMWARE_RUNNING, &mvm->status)) in iwl_mvm_sw_reset()
2076 iwl_mvm_report_scan_aborted(mvm); in iwl_mvm_sw_reset()
2083 if (mvm->fwrt.cur_fw_img == IWL_UCODE_REGULAR && mvm->hw_registered) { in iwl_mvm_sw_reset()
2084 if (mvm->fw->ucode_capa.error_log_size) { in iwl_mvm_sw_reset()
2085 u32 src_size = mvm->fw->ucode_capa.error_log_size; in iwl_mvm_sw_reset()
2086 u32 src_addr = mvm->fw->ucode_capa.error_log_addr; in iwl_mvm_sw_reset()
2090 mvm->error_recovery_buf = recover_buf; in iwl_mvm_sw_reset()
2091 iwl_trans_read_mem_bytes(mvm->trans, in iwl_mvm_sw_reset()
2098 if (mvm->fwrt.trans->dbg.restart_required) { in iwl_mvm_sw_reset()
2099 IWL_DEBUG_INFO(mvm, "FW restart requested after debug collection\n"); in iwl_mvm_sw_reset()
2100 mvm->fwrt.trans->dbg.restart_required = false; in iwl_mvm_sw_reset()
2101 ieee80211_restart_hw(mvm->hw); in iwl_mvm_sw_reset()
2103 } else if (mvm->trans->trans_cfg->device_family <= IWL_DEVICE_FAMILY_8000) { in iwl_mvm_sw_reset()
2104 ieee80211_restart_hw(mvm->hw); in iwl_mvm_sw_reset()
2116 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_op_mode_mvm_time_point() local
2118 iwl_dbg_tlv_time_point(&mvm->fwrt, tp_id, tp_data); in iwl_op_mode_mvm_time_point()
2124 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_op_mode_mvm_device_powered_off() local
2126 mutex_lock(&mvm->mutex); in iwl_op_mode_mvm_device_powered_off()
2127 clear_bit(IWL_MVM_STATUS_IN_D3, &mvm->status); in iwl_op_mode_mvm_device_powered_off()
2128 mvm->trans->system_pm_mode = IWL_PLAT_PM_MODE_DISABLED; in iwl_op_mode_mvm_device_powered_off()
2129 iwl_mvm_stop_device(mvm); in iwl_op_mode_mvm_device_powered_off()
2130 mvm->fast_resume = false; in iwl_op_mode_mvm_device_powered_off()
2131 mutex_unlock(&mvm->mutex); in iwl_op_mode_mvm_device_powered_off()
2164 struct iwl_mvm *mvm = IWL_OP_MODE_GET_MVM(op_mode); in iwl_mvm_rx_mq_rss() local
2168 if (unlikely(queue >= mvm->trans->num_rx_queues)) in iwl_mvm_rx_mq_rss()
2172 iwl_mvm_rx_frame_release(mvm, napi, rxb, queue); in iwl_mvm_rx_mq_rss()
2175 iwl_mvm_rx_queue_notif(mvm, napi, rxb, queue); in iwl_mvm_rx_mq_rss()
2177 iwl_mvm_rx_mpdu_mq(mvm, napi, rxb, queue); in iwl_mvm_rx_mq_rss()