Lines Matching refs:mvm
84 void iwl_mvm_te_clear_data(struct iwl_mvm *mvm, in iwl_mvm_te_clear_data() argument
87 lockdep_assert_held(&mvm->time_event_lock); in iwl_mvm_te_clear_data()
101 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, roc_done_wk); in iwl_mvm_roc_done_wk() local
111 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status)) { in iwl_mvm_roc_done_wk()
113 iwl_mvm_unref(mvm, IWL_MVM_REF_ROC); in iwl_mvm_roc_done_wk()
115 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) { in iwl_mvm_roc_done_wk()
116 queues |= BIT(mvm->aux_queue); in iwl_mvm_roc_done_wk()
117 iwl_mvm_unref(mvm, IWL_MVM_REF_ROC_AUX); in iwl_mvm_roc_done_wk()
132 iwl_mvm_flush_tx_path(mvm, queues, false); in iwl_mvm_roc_done_wk()
135 static void iwl_mvm_roc_finished(struct iwl_mvm *mvm) in iwl_mvm_roc_finished() argument
144 schedule_work(&mvm->roc_done_wk); in iwl_mvm_roc_finished()
147 static void iwl_mvm_csa_noa_start(struct iwl_mvm *mvm) in iwl_mvm_csa_noa_start() argument
153 csa_vif = rcu_dereference(mvm->csa_vif); in iwl_mvm_csa_noa_start()
157 IWL_DEBUG_TE(mvm, "CSA NOA started\n"); in iwl_mvm_csa_noa_start()
166 IWL_WARN(mvm, "CSA NOA started too early\n"); in iwl_mvm_csa_noa_start()
174 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_csa_noa_start()
182 static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm, in iwl_mvm_te_check_disconnect() argument
191 IWL_ERR(mvm, "%s\n", errmsg); in iwl_mvm_te_check_disconnect()
193 iwl_mvm_connection_loss(mvm, vif, errmsg); in iwl_mvm_te_check_disconnect()
198 iwl_mvm_te_handle_notify_csa(struct iwl_mvm *mvm, in iwl_mvm_te_handle_notify_csa() argument
206 IWL_DEBUG_TE(mvm, "CSA time event failed to start\n"); in iwl_mvm_te_handle_notify_csa()
212 iwl_mvm_csa_noa_start(mvm); in iwl_mvm_te_handle_notify_csa()
216 iwl_mvm_connection_loss(mvm, vif, in iwl_mvm_te_handle_notify_csa()
220 iwl_mvm_csa_client_absent(mvm, te_data->vif); in iwl_mvm_te_handle_notify_csa()
230 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_te_handle_notify_csa()
233 static void iwl_mvm_te_check_trigger(struct iwl_mvm *mvm, in iwl_mvm_te_check_trigger() argument
241 if (!iwl_fw_dbg_trigger_enabled(mvm->fw, FW_DBG_TRIGGER_TIME_EVENT)) in iwl_mvm_te_check_trigger()
244 trig = iwl_fw_dbg_get_trigger(mvm->fw, FW_DBG_TRIGGER_TIME_EVENT); in iwl_mvm_te_check_trigger()
247 if (!iwl_fw_dbg_trigger_check_stop(mvm, te_data->vif, trig)) in iwl_mvm_te_check_trigger()
262 iwl_mvm_fw_dbg_collect_trig(mvm, trig, in iwl_mvm_te_check_trigger()
278 static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, in iwl_mvm_te_handle_notif() argument
282 lockdep_assert_held(&mvm->time_event_lock); in iwl_mvm_te_handle_notif()
284 IWL_DEBUG_TE(mvm, "Handle time event notif - UID = 0x%x action %d\n", in iwl_mvm_te_handle_notif()
288 iwl_mvm_te_check_trigger(mvm, notif, te_data); in iwl_mvm_te_handle_notif()
306 IWL_DEBUG_TE(mvm, "%s\n", msg); in iwl_mvm_te_handle_notif()
308 if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, msg)) { in iwl_mvm_te_handle_notif()
309 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_te_handle_notif()
315 IWL_DEBUG_TE(mvm, in iwl_mvm_te_handle_notif()
321 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_te_handle_notif()
322 iwl_mvm_roc_finished(mvm); in iwl_mvm_te_handle_notif()
329 iwl_mvm_te_check_disconnect(mvm, te_data->vif, in iwl_mvm_te_handle_notif()
336 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_te_handle_notif()
342 set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); in iwl_mvm_te_handle_notif()
343 iwl_mvm_ref(mvm, IWL_MVM_REF_ROC); in iwl_mvm_te_handle_notif()
344 ieee80211_ready_on_channel(mvm->hw); in iwl_mvm_te_handle_notif()
346 iwl_mvm_te_handle_notify_csa(mvm, te_data, notif); in iwl_mvm_te_handle_notif()
349 IWL_WARN(mvm, "Got TE with unknown action\n"); in iwl_mvm_te_handle_notif()
356 static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm, in iwl_mvm_aux_roc_te_handle_notif() argument
362 list_for_each_entry_safe(te_data, tmp, &mvm->aux_roc_te_list, list) { in iwl_mvm_aux_roc_te_handle_notif()
371 iwl_mvm_te_check_trigger(mvm, notif, te_data); in iwl_mvm_aux_roc_te_handle_notif()
374 IWL_DEBUG_TE(mvm, in iwl_mvm_aux_roc_te_handle_notif()
381 IWL_DEBUG_TE(mvm, in iwl_mvm_aux_roc_te_handle_notif()
388 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_aux_roc_te_handle_notif()
389 iwl_mvm_roc_finished(mvm); /* flush aux queue */ in iwl_mvm_aux_roc_te_handle_notif()
396 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); in iwl_mvm_aux_roc_te_handle_notif()
398 iwl_mvm_ref(mvm, IWL_MVM_REF_ROC_AUX); in iwl_mvm_aux_roc_te_handle_notif()
399 ieee80211_ready_on_channel(mvm->hw); /* Start TE */ in iwl_mvm_aux_roc_te_handle_notif()
401 IWL_DEBUG_TE(mvm, in iwl_mvm_aux_roc_te_handle_notif()
413 int iwl_mvm_rx_time_event_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_time_event_notif() argument
421 IWL_DEBUG_TE(mvm, "Time event notification - UID = 0x%x action %d\n", in iwl_mvm_rx_time_event_notif()
425 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
427 if (!iwl_mvm_aux_roc_te_handle_notif(mvm, notif)) in iwl_mvm_rx_time_event_notif()
430 list_for_each_entry_safe(te_data, tmp, &mvm->time_event_list, list) { in iwl_mvm_rx_time_event_notif()
432 iwl_mvm_te_handle_notif(mvm, te_data, notif); in iwl_mvm_rx_time_event_notif()
435 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
443 struct iwl_mvm *mvm = in iwl_mvm_te_notif() local
453 IWL_ERR(mvm, "Invalid TIME_EVENT_NOTIFICATION response\n"); in iwl_mvm_te_notif()
463 IWL_DEBUG_TE(mvm, "TIME_EVENT_NOTIFICATION response - UID = 0x%x\n", in iwl_mvm_te_notif()
466 IWL_ERR(mvm, in iwl_mvm_te_notif()
475 struct iwl_mvm *mvm = in iwl_mvm_time_event_response() local
485 IWL_ERR(mvm, "Invalid TIME_EVENT_CMD response\n"); in iwl_mvm_time_event_response()
496 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_time_event_response()
501 static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, in iwl_mvm_time_event_send_add() argument
510 lockdep_assert_held(&mvm->mutex); in iwl_mvm_time_event_send_add()
512 IWL_DEBUG_TE(mvm, "Add new TE, duration %d TU\n", in iwl_mvm_time_event_send_add()
515 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
517 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
523 list_add_tail(&te_data->list, &mvm->time_event_list); in iwl_mvm_time_event_send_add()
524 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
535 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_time_event_send_add()
540 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, in iwl_mvm_time_event_send_add()
543 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); in iwl_mvm_time_event_send_add()
544 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_time_event_send_add()
549 ret = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_time_event_send_add()
555 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
556 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_time_event_send_add()
557 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
562 void iwl_mvm_protect_session(struct iwl_mvm *mvm, in iwl_mvm_protect_session() argument
573 lockdep_assert_held(&mvm->mutex); in iwl_mvm_protect_session()
577 IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", in iwl_mvm_protect_session()
583 IWL_DEBUG_TE(mvm, "extend 0x%x: only %u ms left\n", in iwl_mvm_protect_session()
594 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_protect_session()
603 cpu_to_le32(iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG)); in iwl_mvm_protect_session()
616 iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_protect_session()
624 iwl_init_notification_wait(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
630 if (iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd)) { in iwl_mvm_protect_session()
631 IWL_ERR(mvm, "Failed to add TE to protect session\n"); in iwl_mvm_protect_session()
632 iwl_remove_notification(&mvm->notif_wait, &wait_te_notif); in iwl_mvm_protect_session()
633 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
635 IWL_ERR(mvm, "Failed to protect session until TE\n"); in iwl_mvm_protect_session()
639 static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm, in __iwl_mvm_remove_time_event() argument
649 spin_lock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
658 iwl_mvm_te_clear_data(mvm, te_data); in __iwl_mvm_remove_time_event()
659 spin_unlock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
667 IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", *uid); in __iwl_mvm_remove_time_event()
680 static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm, in iwl_mvm_remove_aux_roc_te() argument
688 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid)) in iwl_mvm_remove_aux_roc_te()
695 IWL_DEBUG_TE(mvm, "Removing BSS AUX ROC TE 0x%x\n", in iwl_mvm_remove_aux_roc_te()
697 ret = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, in iwl_mvm_remove_aux_roc_te()
709 void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, in iwl_mvm_remove_time_event() argument
717 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid)) in iwl_mvm_remove_time_event()
726 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); in iwl_mvm_remove_time_event()
727 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, in iwl_mvm_remove_time_event()
733 void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm, in iwl_mvm_stop_session_protection() argument
739 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_session_protection()
740 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_stop_session_protection()
743 int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_start_p2p_roc() argument
750 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_p2p_roc()
752 IWL_WARN(mvm, "P2P_DEVICE remain on channel already running\n"); in iwl_mvm_start_p2p_roc()
760 flush_work(&mvm->roc_done_wk); in iwl_mvm_start_p2p_roc()
795 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_start_p2p_roc()
798 void iwl_mvm_stop_roc(struct iwl_mvm *mvm) in iwl_mvm_stop_roc() argument
804 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_roc()
807 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_stop_roc()
816 list_for_each_entry(te_data, &mvm->time_event_list, list) { in iwl_mvm_stop_roc()
831 list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) { in iwl_mvm_stop_roc()
837 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_stop_roc()
840 IWL_WARN(mvm, "No remain on channel event\n"); in iwl_mvm_stop_roc()
845 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_stop_roc()
847 iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data); in iwl_mvm_stop_roc()
849 iwl_mvm_roc_finished(mvm); in iwl_mvm_stop_roc()
852 int iwl_mvm_schedule_csa_period(struct iwl_mvm *mvm, in iwl_mvm_schedule_csa_period() argument
860 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_csa_period()
863 IWL_DEBUG_TE(mvm, "CS period is already scheduled\n"); in iwl_mvm_schedule_csa_period()
879 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_schedule_csa_period()