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, CMD_ASYNC); 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 void iwl_mvm_rx_time_event_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_time_event_notif() argument
420 IWL_DEBUG_TE(mvm, "Time event notification - UID = 0x%x action %d\n", in iwl_mvm_rx_time_event_notif()
424 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
426 if (!iwl_mvm_aux_roc_te_handle_notif(mvm, notif)) in iwl_mvm_rx_time_event_notif()
429 list_for_each_entry_safe(te_data, tmp, &mvm->time_event_list, list) { in iwl_mvm_rx_time_event_notif()
431 iwl_mvm_te_handle_notif(mvm, te_data, notif); in iwl_mvm_rx_time_event_notif()
434 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
440 struct iwl_mvm *mvm = in iwl_mvm_te_notif() local
450 IWL_ERR(mvm, "Invalid TIME_EVENT_NOTIFICATION response\n"); in iwl_mvm_te_notif()
460 IWL_DEBUG_TE(mvm, "TIME_EVENT_NOTIFICATION response - UID = 0x%x\n", in iwl_mvm_te_notif()
463 IWL_ERR(mvm, in iwl_mvm_te_notif()
472 struct iwl_mvm *mvm = in iwl_mvm_time_event_response() local
482 IWL_ERR(mvm, "Invalid TIME_EVENT_CMD response\n"); in iwl_mvm_time_event_response()
493 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_time_event_response()
498 static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, in iwl_mvm_time_event_send_add() argument
507 lockdep_assert_held(&mvm->mutex); in iwl_mvm_time_event_send_add()
509 IWL_DEBUG_TE(mvm, "Add new TE, duration %d TU\n", in iwl_mvm_time_event_send_add()
512 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
514 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
520 list_add_tail(&te_data->list, &mvm->time_event_list); in iwl_mvm_time_event_send_add()
521 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
532 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_time_event_send_add()
537 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, in iwl_mvm_time_event_send_add()
540 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); in iwl_mvm_time_event_send_add()
541 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_time_event_send_add()
546 ret = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_time_event_send_add()
552 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
553 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_time_event_send_add()
554 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
559 void iwl_mvm_protect_session(struct iwl_mvm *mvm, in iwl_mvm_protect_session() argument
570 lockdep_assert_held(&mvm->mutex); in iwl_mvm_protect_session()
574 IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", in iwl_mvm_protect_session()
580 IWL_DEBUG_TE(mvm, "extend 0x%x: only %u ms left\n", in iwl_mvm_protect_session()
591 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_protect_session()
612 iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_protect_session()
620 iwl_init_notification_wait(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
626 if (iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd)) { in iwl_mvm_protect_session()
627 IWL_ERR(mvm, "Failed to add TE to protect session\n"); in iwl_mvm_protect_session()
628 iwl_remove_notification(&mvm->notif_wait, &wait_te_notif); in iwl_mvm_protect_session()
629 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
631 IWL_ERR(mvm, "Failed to protect session until TE\n"); in iwl_mvm_protect_session()
635 static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm, in __iwl_mvm_remove_time_event() argument
645 spin_lock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
654 iwl_mvm_te_clear_data(mvm, te_data); in __iwl_mvm_remove_time_event()
655 spin_unlock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
663 IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", *uid); in __iwl_mvm_remove_time_event()
676 static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm, in iwl_mvm_remove_aux_roc_te() argument
684 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid)) in iwl_mvm_remove_aux_roc_te()
691 IWL_DEBUG_TE(mvm, "Removing BSS AUX ROC TE 0x%x\n", in iwl_mvm_remove_aux_roc_te()
693 ret = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, in iwl_mvm_remove_aux_roc_te()
705 void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, in iwl_mvm_remove_time_event() argument
713 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid)) in iwl_mvm_remove_time_event()
722 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); in iwl_mvm_remove_time_event()
723 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, in iwl_mvm_remove_time_event()
729 void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm, in iwl_mvm_stop_session_protection() argument
735 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_session_protection()
736 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_stop_session_protection()
739 int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_start_p2p_roc() argument
746 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_p2p_roc()
748 IWL_WARN(mvm, "P2P_DEVICE remain on channel already running\n"); in iwl_mvm_start_p2p_roc()
756 flush_work(&mvm->roc_done_wk); in iwl_mvm_start_p2p_roc()
791 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_start_p2p_roc()
794 void iwl_mvm_stop_roc(struct iwl_mvm *mvm) in iwl_mvm_stop_roc() argument
800 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_roc()
802 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_stop_roc()
811 list_for_each_entry(te_data, &mvm->time_event_list, list) { in iwl_mvm_stop_roc()
822 te_data = list_first_entry_or_null(&mvm->aux_roc_te_list, in iwl_mvm_stop_roc()
829 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_stop_roc()
832 IWL_WARN(mvm, "No remain on channel event\n"); in iwl_mvm_stop_roc()
837 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_stop_roc()
839 iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data); in iwl_mvm_stop_roc()
841 iwl_mvm_roc_finished(mvm); in iwl_mvm_stop_roc()
844 int iwl_mvm_schedule_csa_period(struct iwl_mvm *mvm, in iwl_mvm_schedule_csa_period() argument
852 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_csa_period()
855 IWL_DEBUG_TE(mvm, "CS period is already scheduled\n"); in iwl_mvm_schedule_csa_period()
871 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_schedule_csa_period()