Lines Matching +full:inactive +full:- +full:delay +full:- +full:ms
1 // SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
3 * Copyright (C) 2012-2014, 2018-2025 Intel Corporation
4 * Copyright (C) 2013-2015 Intel Mobile Communications GmbH
10 #include "fw/notif-wait.h"
11 #include "iwl-trans.h"
12 #include "fw-api.h"
13 #include "time-event.h"
15 #include "iwl-io.h"
16 #include "iwl-prph.h"
28 lockdep_assert_held(&mvm->time_event_lock); in iwl_mvm_te_clear_data()
30 if (!te_data || !te_data->vif) in iwl_mvm_te_clear_data()
33 list_del(&te_data->list); in iwl_mvm_te_clear_data()
39 INIT_LIST_HEAD(&te_data->list); in iwl_mvm_te_clear_data()
41 te_data->running = false; in iwl_mvm_te_clear_data()
42 te_data->uid = 0; in iwl_mvm_te_clear_data()
43 te_data->id = TE_MAX; in iwl_mvm_te_clear_data()
44 te_data->vif = NULL; in iwl_mvm_te_clear_data()
45 te_data->link_id = -1; in iwl_mvm_te_clear_data()
51 struct ieee80211_vif *vif = mvm->p2p_device_vif; in iwl_mvm_cleanup_roc()
53 lockdep_assert_held(&mvm->mutex); in iwl_mvm_cleanup_roc()
61 * Also flush the offchannel queue -- this is called when the time in iwl_mvm_cleanup_roc()
66 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status)) { in iwl_mvm_cleanup_roc()
73 * can only be set when we had a P2P-Device VIF, and we have a in iwl_mvm_cleanup_roc()
80 iwl_mvm_flush_sta(mvm, mvmvif->deflink.bcast_sta.sta_id, in iwl_mvm_cleanup_roc()
81 mvmvif->deflink.bcast_sta.tfd_queue_msk); in iwl_mvm_cleanup_roc()
83 if (mvm->mld_api_is_used) { in iwl_mvm_cleanup_roc()
85 &vif->bss_conf); in iwl_mvm_cleanup_roc()
87 iwl_mvm_link_changed(mvm, vif, &vif->bss_conf, in iwl_mvm_cleanup_roc()
111 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) { in iwl_mvm_cleanup_roc()
114 iwl_mvm_flush_sta(mvm, mvm->aux_sta.sta_id, in iwl_mvm_cleanup_roc()
115 mvm->aux_sta.tfd_queue_msk); in iwl_mvm_cleanup_roc()
122 if (mvm->mld_api_is_used) in iwl_mvm_cleanup_roc()
124 else if (iwl_mvm_has_new_station_api(mvm->fw)) in iwl_mvm_cleanup_roc()
130 mutex_unlock(&mvm->mutex); in iwl_mvm_cleanup_roc()
137 mutex_lock(&mvm->mutex); in iwl_mvm_roc_done_wk()
151 schedule_work(&mvm->roc_done_wk); in iwl_mvm_roc_finished()
160 csa_vif = rcu_dereference(mvm->csa_vif); in iwl_mvm_csa_noa_start()
161 if (!csa_vif || !csa_vif->bss_conf.csa_active) in iwl_mvm_csa_noa_start()
181 RCU_INIT_POINTER(mvm->csa_vif, NULL); in iwl_mvm_csa_noa_start()
195 if (vif->type != NL80211_IFTYPE_STATION) in iwl_mvm_te_check_disconnect()
198 if (!mvmvif->csa_bcn_pending && vif->cfg.assoc && in iwl_mvm_te_check_disconnect()
199 vif->bss_conf.dtim_period) in iwl_mvm_te_check_disconnect()
204 if (mvmvif->csa_bcn_pending) { in iwl_mvm_te_check_disconnect()
209 mvmvif->deflink.ap_sta_id); in iwl_mvm_te_check_disconnect()
215 if (vif->cfg.assoc) { in iwl_mvm_te_check_disconnect()
220 iwl_dbg_tlv_time_point(&mvm->fwrt, in iwl_mvm_te_check_disconnect()
224 mvmvif->session_prot_connection_loss = true; in iwl_mvm_te_check_disconnect()
236 struct ieee80211_vif *vif = te_data->vif; in iwl_mvm_te_handle_notify_csa()
239 if (!notif->status) in iwl_mvm_te_handle_notify_csa()
242 switch (te_data->vif->type) { in iwl_mvm_te_handle_notify_csa()
244 if (!notif->status) in iwl_mvm_te_handle_notify_csa()
245 mvmvif->csa_failed = true; in iwl_mvm_te_handle_notify_csa()
249 if (!notif->status) { in iwl_mvm_te_handle_notify_csa()
254 iwl_mvm_csa_client_absent(mvm, te_data->vif); in iwl_mvm_te_handle_notify_csa()
255 cancel_delayed_work(&mvmvif->csa_work); in iwl_mvm_te_handle_notify_csa()
256 ieee80211_chswitch_done(te_data->vif, true, 0); in iwl_mvm_te_handle_notify_csa()
276 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt, in iwl_mvm_te_check_trigger()
277 ieee80211_vif_to_wdev(te_data->vif), in iwl_mvm_te_check_trigger()
282 te_trig = (void *)trig->data; in iwl_mvm_te_check_trigger()
284 for (i = 0; i < ARRAY_SIZE(te_trig->time_events); i++) { in iwl_mvm_te_check_trigger()
285 u32 trig_te_id = le32_to_cpu(te_trig->time_events[i].id); in iwl_mvm_te_check_trigger()
287 le32_to_cpu(te_trig->time_events[i].action_bitmap); in iwl_mvm_te_check_trigger()
289 le32_to_cpu(te_trig->time_events[i].status_bitmap); in iwl_mvm_te_check_trigger()
291 if (trig_te_id != te_data->id || in iwl_mvm_te_check_trigger()
292 !(trig_action_bitmap & le32_to_cpu(notif->action)) || in iwl_mvm_te_check_trigger()
293 !(trig_status_bitmap & BIT(le32_to_cpu(notif->status)))) in iwl_mvm_te_check_trigger()
296 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig, in iwl_mvm_te_check_trigger()
298 te_data->id, in iwl_mvm_te_check_trigger()
299 le32_to_cpu(notif->action), in iwl_mvm_te_check_trigger()
300 le32_to_cpu(notif->status)); in iwl_mvm_te_check_trigger()
316 lockdep_assert_held(&mvm->time_event_lock); in iwl_mvm_te_handle_notif()
318 IWL_DEBUG_TE(mvm, "Handle time event notif - UID = 0x%x action %d\n", in iwl_mvm_te_handle_notif()
319 le32_to_cpu(notif->unique_id), in iwl_mvm_te_handle_notif()
320 le32_to_cpu(notif->action)); in iwl_mvm_te_handle_notif()
332 if (!le32_to_cpu(notif->status)) { in iwl_mvm_te_handle_notif()
335 if (notif->action & cpu_to_le32(TE_V2_NOTIF_HOST_EVENT_START)) in iwl_mvm_te_handle_notif()
342 if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, msg)) { in iwl_mvm_te_handle_notif()
348 if (le32_to_cpu(notif->action) & TE_V2_NOTIF_HOST_EVENT_END) { in iwl_mvm_te_handle_notif()
350 "TE ended - current time %lu, estimated end %lu\n", in iwl_mvm_te_handle_notif()
351 jiffies, te_data->end_jiffies); in iwl_mvm_te_handle_notif()
353 switch (te_data->vif->type) { in iwl_mvm_te_handle_notif()
355 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_te_handle_notif()
364 if (te_data->id == TE_CHANNEL_SWITCH_PERIOD) { in iwl_mvm_te_handle_notif()
374 iwl_mvm_te_check_disconnect(mvm, te_data->vif, in iwl_mvm_te_handle_notif()
375 !te_data->vif->cfg.assoc ? in iwl_mvm_te_handle_notif()
384 } else if (le32_to_cpu(notif->action) & TE_V2_NOTIF_HOST_EVENT_START) { in iwl_mvm_te_handle_notif()
385 te_data->running = true; in iwl_mvm_te_handle_notif()
386 te_data->end_jiffies = TU_TO_EXP_TIME(te_data->duration); in iwl_mvm_te_handle_notif()
388 if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_te_handle_notif()
389 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status); in iwl_mvm_te_handle_notif()
390 ieee80211_ready_on_channel(mvm->hw); in iwl_mvm_te_handle_notif()
391 } else if (te_data->id == TE_CHANNEL_SWITCH_PERIOD) { in iwl_mvm_te_handle_notif()
411 if (mvmvif->roc_activity == data->activity) { in iwl_mvm_rx_roc_iterator()
412 data->found = true; in iwl_mvm_rx_roc_iterator()
413 if (data->end_activity) in iwl_mvm_rx_roc_iterator()
414 mvmvif->roc_activity = ROC_NUM_ACTIVITIES; in iwl_mvm_rx_roc_iterator()
422 struct iwl_roc_notif *notif = (void *)pkt->data; in iwl_mvm_rx_roc_notif()
423 u32 activity = le32_to_cpu(notif->activity); in iwl_mvm_rx_roc_notif()
424 bool started = le32_to_cpu(notif->success) && in iwl_mvm_rx_roc_notif()
425 le32_to_cpu(notif->started); in iwl_mvm_rx_roc_notif()
432 ieee80211_iterate_active_interfaces_atomic(mvm->hw, in iwl_mvm_rx_roc_notif()
444 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); in iwl_mvm_rx_roc_notif()
445 ieee80211_ready_on_channel(mvm->hw); in iwl_mvm_rx_roc_notif()
448 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_rx_roc_notif()
460 list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) { in iwl_mvm_aux_roc_te_handle_notif()
461 if (le32_to_cpu(notif->unique_id) == te_data->uid) { in iwl_mvm_aux_roc_te_handle_notif()
467 return -EINVAL; in iwl_mvm_aux_roc_te_handle_notif()
472 "Aux ROC time event notification - UID = 0x%x action %d (error = %d)\n", in iwl_mvm_aux_roc_te_handle_notif()
473 le32_to_cpu(notif->unique_id), in iwl_mvm_aux_roc_te_handle_notif()
474 le32_to_cpu(notif->action), le32_to_cpu(notif->status)); in iwl_mvm_aux_roc_te_handle_notif()
476 if (!le32_to_cpu(notif->status) || in iwl_mvm_aux_roc_te_handle_notif()
477 le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_END) { in iwl_mvm_aux_roc_te_handle_notif()
479 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_aux_roc_te_handle_notif()
481 list_del(&te_data->list); /* remove from list */ in iwl_mvm_aux_roc_te_handle_notif()
482 te_data->running = false; in iwl_mvm_aux_roc_te_handle_notif()
483 te_data->vif = NULL; in iwl_mvm_aux_roc_te_handle_notif()
484 te_data->uid = 0; in iwl_mvm_aux_roc_te_handle_notif()
485 te_data->id = TE_MAX; in iwl_mvm_aux_roc_te_handle_notif()
486 } else if (le32_to_cpu(notif->action) == TE_V2_NOTIF_HOST_EVENT_START) { in iwl_mvm_aux_roc_te_handle_notif()
487 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); in iwl_mvm_aux_roc_te_handle_notif()
488 te_data->running = true; in iwl_mvm_aux_roc_te_handle_notif()
489 ieee80211_ready_on_channel(mvm->hw); /* Start TE */ in iwl_mvm_aux_roc_te_handle_notif()
493 le32_to_cpu(notif->action)); in iwl_mvm_aux_roc_te_handle_notif()
494 return -EINVAL; in iwl_mvm_aux_roc_te_handle_notif()
507 struct iwl_time_event_notif *notif = (void *)pkt->data; in iwl_mvm_rx_time_event_notif()
510 IWL_DEBUG_TE(mvm, "Time event notification - UID = 0x%x action %d\n", in iwl_mvm_rx_time_event_notif()
511 le32_to_cpu(notif->unique_id), in iwl_mvm_rx_time_event_notif()
512 le32_to_cpu(notif->action)); in iwl_mvm_rx_time_event_notif()
514 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
519 list_for_each_entry_safe(te_data, tmp, &mvm->time_event_list, list) { in iwl_mvm_rx_time_event_notif()
520 if (le32_to_cpu(notif->unique_id) == te_data->uid) in iwl_mvm_rx_time_event_notif()
524 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_time_event_notif()
536 if (WARN_ON(pkt->hdr.cmd != TIME_EVENT_NOTIFICATION)) in iwl_mvm_te_notif()
544 resp = (void *)pkt->data; in iwl_mvm_te_notif()
546 /* te_data->uid is already set in the TIME_EVENT_CMD response */ in iwl_mvm_te_notif()
547 if (le32_to_cpu(resp->unique_id) != te_data->uid) in iwl_mvm_te_notif()
550 IWL_DEBUG_TE(mvm, "TIME_EVENT_NOTIFICATION response - UID = 0x%x\n", in iwl_mvm_te_notif()
551 te_data->uid); in iwl_mvm_te_notif()
552 if (!resp->status) in iwl_mvm_te_notif()
568 if (WARN_ON(pkt->hdr.cmd != TIME_EVENT_CMD)) in iwl_mvm_time_event_response()
576 resp = (void *)pkt->data; in iwl_mvm_time_event_response()
579 if (WARN_ON_ONCE(le32_to_cpu(resp->id) != te_data->id)) in iwl_mvm_time_event_response()
582 te_data->uid = le32_to_cpu(resp->unique_id); in iwl_mvm_time_event_response()
583 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n", in iwl_mvm_time_event_response()
584 te_data->uid); in iwl_mvm_time_event_response()
597 lockdep_assert_held(&mvm->mutex); in iwl_mvm_time_event_send_add()
600 le32_to_cpu(te_cmd->duration)); in iwl_mvm_time_event_send_add()
602 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
603 if (WARN_ON(te_data->id != TE_MAX)) { in iwl_mvm_time_event_send_add()
604 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
605 return -EIO; in iwl_mvm_time_event_send_add()
607 te_data->vif = vif; in iwl_mvm_time_event_send_add()
608 te_data->duration = le32_to_cpu(te_cmd->duration); in iwl_mvm_time_event_send_add()
609 te_data->id = le32_to_cpu(te_cmd->id); in iwl_mvm_time_event_send_add()
610 list_add_tail(&te_data->list, &mvm->time_event_list); in iwl_mvm_time_event_send_add()
611 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
622 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event, in iwl_mvm_time_event_send_add()
631 iwl_remove_notification(&mvm->notif_wait, &wait_time_event); in iwl_mvm_time_event_send_add()
636 ret = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1); in iwl_mvm_time_event_send_add()
642 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
644 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_time_event_send_add()
655 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; in iwl_mvm_protect_session()
660 lockdep_assert_held(&mvm->mutex); in iwl_mvm_protect_session()
662 if (te_data->running && in iwl_mvm_protect_session()
663 time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) { in iwl_mvm_protect_session()
665 jiffies_to_msecs(te_data->end_jiffies - jiffies)); in iwl_mvm_protect_session()
669 if (te_data->running) { in iwl_mvm_protect_session()
670 IWL_DEBUG_TE(mvm, "extend 0x%x: only %u ms left\n", in iwl_mvm_protect_session()
671 te_data->uid, in iwl_mvm_protect_session()
672 jiffies_to_msecs(te_data->end_jiffies - jiffies)); in iwl_mvm_protect_session()
686 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); in iwl_mvm_protect_session()
710 iwl_init_notification_wait(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
715 /* If TE was sent OK - wait for the notification that started */ in iwl_mvm_protect_session()
718 iwl_remove_notification(&mvm->notif_wait, &wait_te_notif); in iwl_mvm_protect_session()
719 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_te_notif, in iwl_mvm_protect_session()
731 int ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_get_session_prot_id()
736 return mvmvif->id; in iwl_mvm_get_session_prot_id()
738 if (WARN(link_id < 0 || !mvmvif->link[link_id], in iwl_mvm_get_session_prot_id()
740 return -EINVAL; in iwl_mvm_get_session_prot_id()
742 if (WARN(!mvmvif->link[link_id]->active, in iwl_mvm_get_session_prot_id()
743 "Session Protection on an inactive link: %u\n", link_id)) in iwl_mvm_get_session_prot_id()
744 return -EINVAL; in iwl_mvm_get_session_prot_id()
746 return mvmvif->link[link_id]->fw_link_id; in iwl_mvm_get_session_prot_id()
778 u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0); in iwl_mvm_roc_rm_cmd()
782 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_rm_cmd()
794 struct ieee80211_vif *vif = te_data->vif; in __iwl_mvm_remove_time_event()
799 u8 roc_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in __iwl_mvm_remove_time_event()
805 mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); in __iwl_mvm_remove_time_event()
806 iftype = te_data->vif->type; in __iwl_mvm_remove_time_event()
812 spin_lock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
815 *uid = te_data->uid; in __iwl_mvm_remove_time_event()
816 id = te_data->id; in __iwl_mvm_remove_time_event()
817 link_id = te_data->link_id; in __iwl_mvm_remove_time_event()
823 spin_unlock_bh(&mvm->time_event_lock); in __iwl_mvm_remove_time_event()
826 (roc_ver >= 3 && mvmvif->roc_activity == ROC_ACTIVITY_HOTSPOT)) { in __iwl_mvm_remove_time_event()
827 if (mvmvif->roc_activity < ROC_NUM_ACTIVITIES) { in __iwl_mvm_remove_time_event()
828 iwl_mvm_roc_rm_cmd(mvm, mvmvif->roc_activity); in __iwl_mvm_remove_time_event()
829 mvmvif->roc_activity = ROC_NUM_ACTIVITIES; in __iwl_mvm_remove_time_event()
833 } else if (fw_has_capa(&mvm->fw->ucode_capa, in __iwl_mvm_remove_time_event()
836 /* When session protection is used, the te_data->id field in __iwl_mvm_remove_time_event()
838 * For AUX ROC, HOT_SPOT_CMD is used and the te_data->id in __iwl_mvm_remove_time_event()
875 u16 len = sizeof(aux_cmd) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_remove_aux_roc_te()
886 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); in iwl_mvm_remove_aux_roc_te()
916 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); in iwl_mvm_remove_time_event()
929 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; in iwl_mvm_stop_session_protection()
932 lockdep_assert_held(&mvm->mutex); in iwl_mvm_stop_session_protection()
934 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_stop_session_protection()
935 id = te_data->id; in iwl_mvm_stop_session_protection()
936 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_stop_session_protection()
938 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_stop_session_protection()
960 struct iwl_session_prot_notif *notif = (void *)pkt->data; in iwl_mvm_rx_session_protect_notif()
961 int id = le32_to_cpu(notif->mac_link_id); in iwl_mvm_rx_session_protect_notif()
975 if (vif->type != NL80211_IFTYPE_P2P_DEVICE) { in iwl_mvm_rx_session_protect_notif()
977 &mvmvif->time_event_data; in iwl_mvm_rx_session_protect_notif()
979 if (!le32_to_cpu(notif->status)) { in iwl_mvm_rx_session_protect_notif()
982 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_session_protect_notif()
984 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_session_protect_notif()
987 if (le32_to_cpu(notif->start)) { in iwl_mvm_rx_session_protect_notif()
988 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_session_protect_notif()
989 te_data->running = le32_to_cpu(notif->start); in iwl_mvm_rx_session_protect_notif()
990 te_data->end_jiffies = in iwl_mvm_rx_session_protect_notif()
991 TU_TO_EXP_TIME(te_data->duration); in iwl_mvm_rx_session_protect_notif()
992 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_session_protect_notif()
999 !vif->cfg.assoc ? in iwl_mvm_rx_session_protect_notif()
1002 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_rx_session_protect_notif()
1004 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_rx_session_protect_notif()
1010 if (!le32_to_cpu(notif->status) || !le32_to_cpu(notif->start)) { in iwl_mvm_rx_session_protect_notif()
1012 mvmvif->time_event_data.id = SESSION_PROTECT_CONF_MAX_ID; in iwl_mvm_rx_session_protect_notif()
1013 mvmvif->time_event_data.link_id = -1; in iwl_mvm_rx_session_protect_notif()
1015 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status); in iwl_mvm_rx_session_protect_notif()
1017 ieee80211_remain_on_channel_expired(mvm->hw); in iwl_mvm_rx_session_protect_notif()
1018 } else if (le32_to_cpu(notif->start)) { in iwl_mvm_rx_session_protect_notif()
1019 if (WARN_ON(mvmvif->time_event_data.id != in iwl_mvm_rx_session_protect_notif()
1020 le32_to_cpu(notif->conf_id))) in iwl_mvm_rx_session_protect_notif()
1022 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status); in iwl_mvm_rx_session_protect_notif()
1023 ieee80211_ready_on_channel(mvm->hw); /* Start TE */ in iwl_mvm_rx_session_protect_notif()
1039 u32 *delay) in iwl_mvm_roc_duration_and_delay() argument
1045 *delay = AUX_ROC_MIN_DELAY; in iwl_mvm_roc_duration_and_delay()
1052 link_conf->dtim_period * link_conf->beacon_int); in iwl_mvm_roc_duration_and_delay()
1057 * If we are associated we want the delay time to be at least one in iwl_mvm_roc_duration_and_delay()
1060 * remain off-channel for the max duration. in iwl_mvm_roc_duration_and_delay()
1062 * like the delay to be for 2-3 dtim intervals, in case there are in iwl_mvm_roc_duration_and_delay()
1067 if (vif->cfg.assoc && !WARN_ON(!dtim_interval)) { in iwl_mvm_roc_duration_and_delay()
1068 *delay = min_t(u32, dtim_interval * 3, AUX_ROC_MAX_DELAY); in iwl_mvm_roc_duration_and_delay()
1069 /* We cannot remain off-channel longer than the DTIM interval */ in iwl_mvm_roc_duration_and_delay()
1071 *duration_tu = dtim_interval - AUX_ROC_SAFETY_BUFFER; in iwl_mvm_roc_duration_and_delay()
1073 *duration_tu = dtim_interval - in iwl_mvm_roc_duration_and_delay()
1085 u32 duration_tu, delay; in iwl_mvm_roc_add_cmd() local
1089 .sta_id = cpu_to_le32(mvm->aux_sta.sta_id), in iwl_mvm_roc_add_cmd()
1091 u8 ver = iwl_fw_lookup_cmd_ver(mvm->fw, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0); in iwl_mvm_roc_add_cmd()
1095 lockdep_assert_held(&mvm->mutex); in iwl_mvm_roc_add_cmd()
1097 if (WARN_ON(mvmvif->roc_activity != ROC_NUM_ACTIVITIES)) in iwl_mvm_roc_add_cmd()
1098 return -EBUSY; in iwl_mvm_roc_add_cmd()
1102 channel->hw_value, in iwl_mvm_roc_add_cmd()
1103 iwl_mvm_phy_band_from_nl80211(channel->band), in iwl_mvm_roc_add_cmd()
1107 &delay); in iwl_mvm_roc_add_cmd()
1109 roc_req.max_delay = cpu_to_le32(delay); in iwl_mvm_roc_add_cmd()
1113 duration, delay); in iwl_mvm_roc_add_cmd()
1116 channel->hw_value, duration_tu, activity); in iwl_mvm_roc_add_cmd()
1119 memcpy(roc_req.node_addr, vif->addr, ETH_ALEN); in iwl_mvm_roc_add_cmd()
1124 mvmvif->roc_activity = activity; in iwl_mvm_roc_add_cmd()
1143 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_p2p_roc_session_protection()
1149 mvmvif->time_event_data.link_id = 0; in iwl_mvm_start_p2p_roc_session_protection()
1153 mvmvif->time_event_data.id = in iwl_mvm_start_p2p_roc_session_protection()
1157 mvmvif->time_event_data.id = in iwl_mvm_start_p2p_roc_session_protection()
1162 return -EINVAL; in iwl_mvm_start_p2p_roc_session_protection()
1165 cmd.conf_id = cpu_to_le32(mvmvif->time_event_data.id); in iwl_mvm_start_p2p_roc_session_protection()
1175 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; in iwl_mvm_start_p2p_roc()
1178 lockdep_assert_held(&mvm->mutex); in iwl_mvm_start_p2p_roc()
1179 if (te_data->running) { in iwl_mvm_start_p2p_roc()
1181 return -EBUSY; in iwl_mvm_start_p2p_roc()
1184 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_start_p2p_roc()
1192 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); in iwl_mvm_start_p2p_roc()
1203 return -EINVAL; in iwl_mvm_start_p2p_roc()
1230 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_roc_te()
1232 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_get_roc_te()
1241 list_for_each_entry(te_data, &mvm->time_event_list, list) { in iwl_mvm_get_roc_te()
1242 if (te_data->vif->type == NL80211_IFTYPE_P2P_DEVICE) in iwl_mvm_get_roc_te()
1249 te_data = list_first_entry_or_null(&mvm->aux_roc_te_list, in iwl_mvm_get_roc_te()
1253 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_get_roc_te()
1272 u8 roc_ver = iwl_fw_lookup_cmd_ver(mvm->fw, in iwl_mvm_stop_roc()
1274 int iftype = vif->type; in iwl_mvm_stop_roc()
1276 mutex_lock(&mvm->mutex); in iwl_mvm_stop_roc()
1279 if (mvmvif->roc_activity < ROC_NUM_ACTIVITIES) { in iwl_mvm_stop_roc()
1280 iwl_mvm_roc_rm_cmd(mvm, mvmvif->roc_activity); in iwl_mvm_stop_roc()
1281 mvmvif->roc_activity = ROC_NUM_ACTIVITIES; in iwl_mvm_stop_roc()
1284 } else if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_stop_roc()
1286 te_data = &mvmvif->time_event_data; in iwl_mvm_stop_roc()
1289 if (te_data->id >= SESSION_PROTECT_CONF_MAX_ID) { in iwl_mvm_stop_roc()
1292 mutex_unlock(&mvm->mutex); in iwl_mvm_stop_roc()
1296 te_data->id, in iwl_mvm_stop_roc()
1297 te_data->link_id); in iwl_mvm_stop_roc()
1300 &mvmvif->hs_time_event_data); in iwl_mvm_stop_roc()
1308 mutex_unlock(&mvm->mutex); in iwl_mvm_stop_roc()
1312 mvmvif = iwl_mvm_vif_from_mac80211(te_data->vif); in iwl_mvm_stop_roc()
1313 iftype = te_data->vif->type; in iwl_mvm_stop_roc()
1326 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status); in iwl_mvm_stop_roc()
1328 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status); in iwl_mvm_stop_roc()
1338 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; in iwl_mvm_remove_csa_period()
1341 lockdep_assert_held(&mvm->mutex); in iwl_mvm_remove_csa_period()
1343 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_remove_csa_period()
1344 id = te_data->id; in iwl_mvm_remove_csa_period()
1345 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_remove_csa_period()
1358 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; in iwl_mvm_schedule_csa_period()
1361 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_csa_period()
1363 if (te_data->running) { in iwl_mvm_schedule_csa_period()
1366 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_csa_period()
1367 id = te_data->id; in iwl_mvm_schedule_csa_period()
1368 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_csa_period()
1372 return -EBUSY; in iwl_mvm_schedule_csa_period()
1385 cpu_to_le32(FW_CMD_ID_AND_COLOR(mvmvif->id, mvmvif->color)); in iwl_mvm_schedule_csa_period()
1408 if (WARN_ON(pkt->hdr.cmd != SESSION_PROTECTION_NOTIF || in iwl_mvm_session_prot_notif()
1409 pkt->hdr.group_id != MAC_CONF_GROUP)) in iwl_mvm_session_prot_notif()
1417 resp = (void *)pkt->data; in iwl_mvm_session_prot_notif()
1419 if (!resp->status) in iwl_mvm_session_prot_notif()
1433 struct iwl_mvm_time_event_data *te_data = &mvmvif->time_event_data; in iwl_mvm_schedule_session_protection()
1447 lockdep_assert_held(&mvm->mutex); in iwl_mvm_schedule_session_protection()
1449 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_session_protection()
1450 if (te_data->running && te_data->link_id == link_id && in iwl_mvm_schedule_session_protection()
1451 time_after(te_data->end_jiffies, TU_TO_EXP_TIME(min_duration))) { in iwl_mvm_schedule_session_protection()
1453 jiffies_to_msecs(te_data->end_jiffies - jiffies)); in iwl_mvm_schedule_session_protection()
1454 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_session_protection()
1464 te_data->id = le32_to_cpu(cmd.conf_id); in iwl_mvm_schedule_session_protection()
1465 te_data->duration = le32_to_cpu(cmd.duration_tu); in iwl_mvm_schedule_session_protection()
1466 te_data->vif = vif; in iwl_mvm_schedule_session_protection()
1467 te_data->link_id = link_id; in iwl_mvm_schedule_session_protection()
1468 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_session_protection()
1483 iwl_init_notification_wait(&mvm->notif_wait, &wait_notif, in iwl_mvm_schedule_session_protection()
1490 iwl_remove_notification(&mvm->notif_wait, &wait_notif); in iwl_mvm_schedule_session_protection()
1492 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_notif, in iwl_mvm_schedule_session_protection()
1502 spin_lock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_session_protection()
1504 spin_unlock_bh(&mvm->time_event_lock); in iwl_mvm_schedule_session_protection()