Lines Matching refs:mvm

83 void iwl_mvm_te_clear_data(struct iwl_mvm *mvm,  in iwl_mvm_te_clear_data()  argument
86 lockdep_assert_held(&mvm->time_event_lock); in iwl_mvm_te_clear_data()
100 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, roc_done_wk); in iwl_mvm_roc_done_wk() local
109 clear_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); in iwl_mvm_roc_done_wk()
110 clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); in iwl_mvm_roc_done_wk()
124 iwl_mvm_flush_sta(mvm, &mvm->aux_sta, true, CMD_ASYNC); in iwl_mvm_roc_done_wk()
127 if (test_and_clear_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status)) { in iwl_mvm_roc_done_wk()
137 if (!WARN_ON(!mvm->p2p_device_vif)) { in iwl_mvm_roc_done_wk()
138 mvmvif = iwl_mvm_vif_from_mac80211(mvm->p2p_device_vif); in iwl_mvm_roc_done_wk()
139 iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true, in iwl_mvm_roc_done_wk()
145 static void iwl_mvm_roc_finished(struct iwl_mvm *mvm) in iwl_mvm_roc_finished() argument
154 schedule_work(&mvm->roc_done_wk); in iwl_mvm_roc_finished()
157 static void iwl_mvm_csa_noa_start(struct iwl_mvm *mvm) in iwl_mvm_csa_noa_start() argument
163 csa_vif = rcu_dereference(mvm->csa_vif); in iwl_mvm_csa_noa_start()
167 IWL_DEBUG_TE(mvm, "CSA NOA started\n"); in iwl_mvm_csa_noa_start()
176 IWL_WARN(mvm, "CSA NOA started too early\n"); in iwl_mvm_csa_noa_start()
184 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_csa_noa_start()
192 static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm, in iwl_mvm_te_check_disconnect() argument
205 IWL_ERR(mvm, "%s\n", errmsg); in iwl_mvm_te_check_disconnect()
207 iwl_mvm_connection_loss(mvm, vif, errmsg); in iwl_mvm_te_check_disconnect()
212 iwl_mvm_te_handle_notify_csa(struct iwl_mvm *mvm, in iwl_mvm_te_handle_notify_csa() argument
220 IWL_DEBUG_TE(mvm, "CSA time event failed to start\n"); in iwl_mvm_te_handle_notify_csa()
226 iwl_mvm_csa_noa_start(mvm); in iwl_mvm_te_handle_notify_csa()
230 iwl_mvm_connection_loss(mvm, vif, in iwl_mvm_te_handle_notify_csa()
234 iwl_mvm_csa_client_absent(mvm, te_data->vif); in iwl_mvm_te_handle_notify_csa()
245 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_te_handle_notify_csa()
248 static void iwl_mvm_te_check_trigger(struct iwl_mvm *mvm, in iwl_mvm_te_check_trigger() argument
256 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, in iwl_mvm_te_check_trigger()
276 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_te_check_trigger()
292 static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm, in iwl_mvm_te_handle_notif() argument
296 lockdep_assert_held(&mvm->time_event_lock); in iwl_mvm_te_handle_notif()
298 IWL_DEBUG_TE(mvm, "Handle time event notif - UID = 0x%x action %d\n", in iwl_mvm_te_handle_notif()
302 iwl_mvm_te_check_trigger(mvm, notif, te_data); in iwl_mvm_te_handle_notif()
320 IWL_DEBUG_TE(mvm, "%s\n", msg); in iwl_mvm_te_handle_notif()
322 if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, msg)) { in iwl_mvm_te_handle_notif()
323 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_te_handle_notif()
329 IWL_DEBUG_TE(mvm, in iwl_mvm_te_handle_notif()
335 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_te_handle_notif()
336 set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); in iwl_mvm_te_handle_notif()
337 iwl_mvm_roc_finished(mvm); in iwl_mvm_te_handle_notif()
344 iwl_mvm_te_check_disconnect(mvm, te_data->vif, in iwl_mvm_te_handle_notif()
351 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_te_handle_notif()
357 set_bit(IWL_MVM_STATUS_ROC_RUNNING, &mvm->status); in iwl_mvm_te_handle_notif()
358 ieee80211_ready_on_channel(mvm->hw); in iwl_mvm_te_handle_notif()
360 iwl_mvm_te_handle_notify_csa(mvm, te_data, notif); in iwl_mvm_te_handle_notif()
363 IWL_WARN(mvm, "Got TE with unknown action\n"); in iwl_mvm_te_handle_notif()
370 static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm, in iwl_mvm_aux_roc_te_handle_notif() argument
376 list_for_each_entry_safe(te_data, tmp, &mvm->aux_roc_te_list, list) { in iwl_mvm_aux_roc_te_handle_notif()
385 iwl_mvm_te_check_trigger(mvm, notif, te_data); in iwl_mvm_aux_roc_te_handle_notif()
387 IWL_DEBUG_TE(mvm, in iwl_mvm_aux_roc_te_handle_notif()
395 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_aux_roc_te_handle_notif()
396 iwl_mvm_roc_finished(mvm); /* flush aux queue */ in iwl_mvm_aux_roc_te_handle_notif()
403 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); in iwl_mvm_aux_roc_te_handle_notif()
405 ieee80211_ready_on_channel(mvm->hw); /* Start TE */ in iwl_mvm_aux_roc_te_handle_notif()
407 IWL_DEBUG_TE(mvm, in iwl_mvm_aux_roc_te_handle_notif()
419 void iwl_mvm_rx_time_event_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_time_event_notif() argument
426 IWL_DEBUG_TE(mvm, "Time event notification - UID = 0x%x action %d\n", in iwl_mvm_rx_time_event_notif()
430 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
432 if (!iwl_mvm_aux_roc_te_handle_notif(mvm, notif)) in iwl_mvm_rx_time_event_notif()
435 list_for_each_entry_safe(te_data, tmp, &mvm->time_event_list, list) { in iwl_mvm_rx_time_event_notif()
437 iwl_mvm_te_handle_notif(mvm, te_data, notif); in iwl_mvm_rx_time_event_notif()
440 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
446 struct iwl_mvm *mvm = in iwl_mvm_te_notif() local
456 IWL_ERR(mvm, "Invalid TIME_EVENT_NOTIFICATION response\n"); in iwl_mvm_te_notif()
466 IWL_DEBUG_TE(mvm, "TIME_EVENT_NOTIFICATION response - UID = 0x%x\n", in iwl_mvm_te_notif()
469 IWL_ERR(mvm, in iwl_mvm_te_notif()
478 struct iwl_mvm *mvm = in iwl_mvm_time_event_response() local
488 IWL_ERR(mvm, "Invalid TIME_EVENT_CMD response\n"); in iwl_mvm_time_event_response()
499 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_time_event_response()
504 static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm, in iwl_mvm_time_event_send_add() argument
513 lockdep_assert_held(&mvm->mutex); in iwl_mvm_time_event_send_add()
515 IWL_DEBUG_TE(mvm, "Add new TE, duration %d TU\n", in iwl_mvm_time_event_send_add()
518 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
520 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
526 list_add_tail(&te_data->list, &mvm->time_event_list); in iwl_mvm_time_event_send_add()
527 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
538 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_time_event_send_add()
543 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, in iwl_mvm_time_event_send_add()
546 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret); in iwl_mvm_time_event_send_add()
547 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_time_event_send_add()
552 ret = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_time_event_send_add()
558 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
559 iwl_mvm_te_clear_data(mvm, te_data); in iwl_mvm_time_event_send_add()
560 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
565 void iwl_mvm_protect_session(struct iwl_mvm *mvm, in iwl_mvm_protect_session() argument
576 lockdep_assert_held(&mvm->mutex); in iwl_mvm_protect_session()
580 IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n", in iwl_mvm_protect_session()
586 IWL_DEBUG_TE(mvm, "extend 0x%x: only %u ms left\n", in iwl_mvm_protect_session()
597 iwl_mvm_stop_session_protection(mvm, vif); in iwl_mvm_protect_session()
618 iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_protect_session()
626 iwl_init_notification_wait(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
632 if (iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd)) { in iwl_mvm_protect_session()
633 IWL_ERR(mvm, "Failed to add TE to protect session\n"); in iwl_mvm_protect_session()
634 iwl_remove_notification(&mvm->notif_wait, &wait_te_notif); in iwl_mvm_protect_session()
635 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
637 IWL_ERR(mvm, "Failed to protect session until TE\n"); in iwl_mvm_protect_session()
641 static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm, in __iwl_mvm_remove_time_event() argument
651 spin_lock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
660 iwl_mvm_te_clear_data(mvm, te_data); in __iwl_mvm_remove_time_event()
661 spin_unlock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
669 IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", *uid); in __iwl_mvm_remove_time_event()
682 static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm, in iwl_mvm_remove_aux_roc_te() argument
687 u16 len = sizeof(aux_cmd) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_remove_aux_roc_te()
692 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid)) in iwl_mvm_remove_aux_roc_te()
699 IWL_DEBUG_TE(mvm, "Removing BSS AUX ROC TE 0x%x\n", in iwl_mvm_remove_aux_roc_te()
701 ret = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0, in iwl_mvm_remove_aux_roc_te()
713 void iwl_mvm_remove_time_event(struct iwl_mvm *mvm, in iwl_mvm_remove_time_event() argument
721 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid)) in iwl_mvm_remove_time_event()
730 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id)); in iwl_mvm_remove_time_event()
731 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0, in iwl_mvm_remove_time_event()
737 void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm, in iwl_mvm_stop_session_protection() argument
744 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_session_protection()
746 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_stop_session_protection()
748 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_stop_session_protection()
751 IWL_DEBUG_TE(mvm, in iwl_mvm_stop_session_protection()
757 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_stop_session_protection()
760 int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_start_p2p_roc() argument
767 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_p2p_roc()
769 IWL_WARN(mvm, "P2P_DEVICE remain on channel already running\n"); in iwl_mvm_start_p2p_roc()
806 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_start_p2p_roc()
809 static struct iwl_mvm_time_event_data *iwl_mvm_get_roc_te(struct iwl_mvm *mvm) in iwl_mvm_get_roc_te() argument
813 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_roc_te()
815 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_get_roc_te()
824 list_for_each_entry(te_data, &mvm->time_event_list, list) { in iwl_mvm_get_roc_te()
832 te_data = list_first_entry_or_null(&mvm->aux_roc_te_list, in iwl_mvm_get_roc_te()
836 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_get_roc_te()
840 void iwl_mvm_cleanup_roc_te(struct iwl_mvm *mvm) in iwl_mvm_cleanup_roc_te() argument
845 te_data = iwl_mvm_get_roc_te(mvm); in iwl_mvm_cleanup_roc_te()
847 __iwl_mvm_remove_time_event(mvm, te_data, &uid); in iwl_mvm_cleanup_roc_te()
850 void iwl_mvm_stop_roc(struct iwl_mvm *mvm) in iwl_mvm_stop_roc() argument
855 te_data = iwl_mvm_get_roc_te(mvm); in iwl_mvm_stop_roc()
857 IWL_WARN(mvm, "No remain on channel event\n"); in iwl_mvm_stop_roc()
864 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_stop_roc()
865 set_bit(IWL_MVM_STATUS_NEED_FLUSH_P2P, &mvm->status); in iwl_mvm_stop_roc()
867 iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data); in iwl_mvm_stop_roc()
870 iwl_mvm_roc_finished(mvm); in iwl_mvm_stop_roc()
873 int iwl_mvm_schedule_csa_period(struct iwl_mvm *mvm, in iwl_mvm_schedule_csa_period() argument
881 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_csa_period()
886 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_csa_period()
888 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_csa_period()
891 IWL_DEBUG_TE(mvm, "CS period is already scheduled\n"); in iwl_mvm_schedule_csa_period()
900 iwl_mvm_remove_time_event(mvm, mvmvif, te_data); in iwl_mvm_schedule_csa_period()
917 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd); in iwl_mvm_schedule_csa_period()