Lines Matching defs:mvm

14 #include "mvm.h"
25 void iwl_mvm_te_clear_data(struct iwl_mvm *mvm,
28 lockdep_assert_held(&mvm->time_event_lock);
48 static void iwl_mvm_cleanup_roc(struct iwl_mvm *mvm)
50 struct ieee80211_vif *bss_vif = iwl_mvm_get_bss_vif(mvm);
51 struct ieee80211_vif *vif = mvm->p2p_device_vif;
53 lockdep_assert_held(&mvm->mutex);
66 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status)) {
80 iwl_mvm_flush_sta(mvm, mvmvif->deflink.bcast_sta.sta_id,
83 if (mvm->mld_api_is_used) {
84 iwl_mvm_mld_rm_bcast_sta(mvm, vif,
87 iwl_mvm_link_changed(mvm, vif, &vif->bss_conf,
91 iwl_mvm_rm_p2p_bcast_sta(mvm, vif);
92 iwl_mvm_binding_remove_vif(mvm, vif);
111 if (test_and_clear_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status)) {
114 iwl_mvm_flush_sta(mvm, mvm->aux_sta.sta_id,
115 mvm->aux_sta.tfd_queue_msk);
117 if (mvm->mld_api_is_used) {
118 iwl_mvm_mld_rm_aux_sta(mvm);
119 mutex_unlock(&mvm->mutex);
126 if (iwl_mvm_has_new_station_api(mvm->fw))
127 iwl_mvm_rm_aux_sta(mvm);
131 iwl_mvm_unblock_esr(mvm, bss_vif, IWL_MVM_ESR_BLOCKED_ROC);
132 mutex_unlock(&mvm->mutex);
137 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, roc_done_wk);
139 mutex_lock(&mvm->mutex);
141 iwl_mvm_cleanup_roc(mvm);
144 static void iwl_mvm_roc_finished(struct iwl_mvm *mvm)
153 schedule_work(&mvm->roc_done_wk);
156 static void iwl_mvm_csa_noa_start(struct iwl_mvm *mvm)
162 csa_vif = rcu_dereference(mvm->csa_vif);
166 IWL_DEBUG_TE(mvm, "CSA NOA started\n");
175 IWL_WARN(mvm, "CSA NOA started too early\n");
183 RCU_INIT_POINTER(mvm->csa_vif, NULL);
191 static bool iwl_mvm_te_check_disconnect(struct iwl_mvm *mvm,
204 IWL_ERR(mvm, "%s\n", errmsg);
210 mvmsta = iwl_mvm_sta_from_staid_rcu(mvm,
213 iwl_mvm_sta_modify_disable_tx(mvm, mvmsta, false);
222 iwl_dbg_tlv_time_point(&mvm->fwrt,
229 iwl_mvm_connection_loss(mvm, vif, errmsg);
234 iwl_mvm_te_handle_notify_csa(struct iwl_mvm *mvm,
242 IWL_DEBUG_TE(mvm, "CSA time event failed to start\n");
248 iwl_mvm_csa_noa_start(mvm);
252 iwl_mvm_connection_loss(mvm, vif,
256 iwl_mvm_csa_client_absent(mvm, te_data->vif);
267 iwl_mvm_te_clear_data(mvm, te_data);
270 static void iwl_mvm_te_check_trigger(struct iwl_mvm *mvm,
278 trig = iwl_fw_dbg_trigger_on(&mvm->fwrt,
298 iwl_fw_dbg_collect_trig(&mvm->fwrt, trig,
310 * @mvm: the mvm component
314 static void iwl_mvm_te_handle_notif(struct iwl_mvm *mvm,
318 lockdep_assert_held(&mvm->time_event_lock);
320 IWL_DEBUG_TE(mvm, "Handle time event notif - UID = 0x%x action %d\n",
324 iwl_mvm_te_check_trigger(mvm, notif, te_data);
342 IWL_DEBUG_TE(mvm, "%s\n", msg);
344 if (iwl_mvm_te_check_disconnect(mvm, te_data->vif, msg)) {
345 iwl_mvm_te_clear_data(mvm, te_data);
351 IWL_DEBUG_TE(mvm,
357 ieee80211_remain_on_channel_expired(mvm->hw);
358 iwl_mvm_roc_finished(mvm);
367 IWL_DEBUG_TE(mvm,
376 iwl_mvm_te_check_disconnect(mvm, te_data->vif,
385 iwl_mvm_te_clear_data(mvm, te_data);
391 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status);
392 ieee80211_ready_on_channel(mvm->hw);
394 iwl_mvm_te_handle_notify_csa(mvm, te_data, notif);
397 IWL_WARN(mvm, "Got TE with unknown action\n");
420 void iwl_mvm_rx_roc_notif(struct iwl_mvm *mvm,
434 ieee80211_iterate_active_interfaces_atomic(mvm->hw,
446 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status);
447 ieee80211_ready_on_channel(mvm->hw);
449 iwl_mvm_roc_finished(mvm);
450 ieee80211_remain_on_channel_expired(mvm->hw);
457 static int iwl_mvm_aux_roc_te_handle_notif(struct iwl_mvm *mvm,
462 list_for_each_entry(te_data, &mvm->aux_roc_te_list, list) {
471 iwl_mvm_te_check_trigger(mvm, notif, te_data);
473 IWL_DEBUG_TE(mvm,
481 ieee80211_remain_on_channel_expired(mvm->hw);
482 iwl_mvm_roc_finished(mvm); /* flush aux queue */
489 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status);
491 ieee80211_ready_on_channel(mvm->hw); /* Start TE */
493 IWL_DEBUG_TE(mvm,
505 void iwl_mvm_rx_time_event_notif(struct iwl_mvm *mvm,
512 IWL_DEBUG_TE(mvm, "Time event notification - UID = 0x%x action %d\n",
516 spin_lock_bh(&mvm->time_event_lock);
518 if (!iwl_mvm_aux_roc_te_handle_notif(mvm, notif))
521 list_for_each_entry_safe(te_data, tmp, &mvm->time_event_list, list) {
523 iwl_mvm_te_handle_notif(mvm, te_data, notif);
526 spin_unlock_bh(&mvm->time_event_lock);
532 struct iwl_mvm *mvm =
542 IWL_ERR(mvm, "Invalid TIME_EVENT_NOTIFICATION response\n");
552 IWL_DEBUG_TE(mvm, "TIME_EVENT_NOTIFICATION response - UID = 0x%x\n",
555 IWL_ERR(mvm,
564 struct iwl_mvm *mvm =
574 IWL_ERR(mvm, "Invalid TIME_EVENT_CMD response\n");
585 IWL_DEBUG_TE(mvm, "TIME_EVENT_CMD response - UID = 0x%x\n",
590 static int iwl_mvm_time_event_send_add(struct iwl_mvm *mvm,
599 lockdep_assert_held(&mvm->mutex);
601 IWL_DEBUG_TE(mvm, "Add new TE, duration %d TU\n",
604 spin_lock_bh(&mvm->time_event_lock);
606 spin_unlock_bh(&mvm->time_event_lock);
612 list_add_tail(&te_data->list, &mvm->time_event_list);
613 spin_unlock_bh(&mvm->time_event_lock);
624 iwl_init_notification_wait(&mvm->notif_wait, &wait_time_event,
629 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0,
632 IWL_ERR(mvm, "Couldn't send TIME_EVENT_CMD: %d\n", ret);
633 iwl_remove_notification(&mvm->notif_wait, &wait_time_event);
638 ret = iwl_wait_notification(&mvm->notif_wait, &wait_time_event, 1);
644 spin_lock_bh(&mvm->time_event_lock);
645 iwl_mvm_te_clear_data(mvm, te_data);
646 spin_unlock_bh(&mvm->time_event_lock);
651 void iwl_mvm_protect_session(struct iwl_mvm *mvm,
662 lockdep_assert_held(&mvm->mutex);
666 IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n",
672 IWL_DEBUG_TE(mvm, "extend 0x%x: only %u ms left\n",
683 iwl_mvm_stop_session_protection(mvm, vif);
704 iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd);
712 iwl_init_notification_wait(&mvm->notif_wait, &wait_te_notif,
718 if (iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd)) {
719 IWL_ERR(mvm, "Failed to add TE to protect session\n");
720 iwl_remove_notification(&mvm->notif_wait, &wait_te_notif);
721 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_te_notif,
723 IWL_ERR(mvm, "Failed to protect session until TE\n");
728 static int iwl_mvm_get_session_prot_id(struct iwl_mvm *mvm,
733 int ver = iwl_fw_lookup_cmd_ver(mvm->fw,
751 static void iwl_mvm_cancel_session_protection(struct iwl_mvm *mvm,
755 int mac_link_id = iwl_mvm_get_session_prot_id(mvm, vif, link_id);
766 ret = iwl_mvm_send_cmd_pdu(mvm,
770 IWL_ERR(mvm,
774 static void iwl_mvm_roc_rm_cmd(struct iwl_mvm *mvm, u32 activity)
782 lockdep_assert_held(&mvm->mutex);
783 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, ROC_CMD), 0,
786 IWL_ERR(mvm, "Couldn't send the ROC_CMD: %d\n", ret);
789 static bool __iwl_mvm_remove_time_event(struct iwl_mvm *mvm,
798 bool p2p_aux = iwl_mvm_has_p2p_over_aux(mvm);
799 u8 roc_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
812 spin_lock_bh(&mvm->time_event_lock);
822 iwl_mvm_te_clear_data(mvm, te_data);
823 spin_unlock_bh(&mvm->time_event_lock);
828 iwl_mvm_roc_rm_cmd(mvm, mvmvif->roc_activity);
830 iwl_mvm_roc_finished(mvm);
833 } else if (fw_has_capa(&mvm->fw->ucode_capa,
843 iwl_mvm_cancel_session_protection(mvm, vif, id,
846 iwl_mvm_roc_finished(mvm);
856 IWL_DEBUG_TE(mvm, "TE 0x%x has already ended\n", *uid);
870 static void iwl_mvm_remove_aux_roc_te(struct iwl_mvm *mvm,
875 u16 len = sizeof(aux_cmd) - iwl_mvm_chan_info_padding(mvm);
880 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid))
887 IWL_DEBUG_TE(mvm, "Removing BSS AUX ROC TE 0x%x\n",
889 ret = iwl_mvm_send_cmd_pdu(mvm, HOT_SPOT_CMD, 0,
901 void iwl_mvm_remove_time_event(struct iwl_mvm *mvm,
909 if (!__iwl_mvm_remove_time_event(mvm, te_data, &uid))
918 IWL_DEBUG_TE(mvm, "Removing TE 0x%x\n", le32_to_cpu(time_cmd.id));
919 ret = iwl_mvm_send_cmd_pdu(mvm, TIME_EVENT_CMD, 0,
922 IWL_ERR(mvm, "Couldn't remove the time event\n");
925 void iwl_mvm_stop_session_protection(struct iwl_mvm *mvm,
932 lockdep_assert_held(&mvm->mutex);
934 spin_lock_bh(&mvm->time_event_lock);
936 spin_unlock_bh(&mvm->time_event_lock);
938 if (fw_has_capa(&mvm->fw->ucode_capa,
941 IWL_DEBUG_TE(mvm,
947 IWL_DEBUG_TE(mvm,
953 iwl_mvm_remove_time_event(mvm, mvmvif, te_data);
956 void iwl_mvm_rx_session_protect_notif(struct iwl_mvm *mvm,
962 iwl_fw_lookup_notif_ver(mvm->fw, MAC_CONF_GROUP,
972 vif = iwl_mvm_rcu_dereference_vif_id(mvm, id, true);
975 iwl_mvm_rcu_fw_link_id_to_link_conf(mvm, id, true);
1001 iwl_mvm_te_check_disconnect(mvm, vif,
1003 spin_lock_bh(&mvm->time_event_lock);
1004 iwl_mvm_te_clear_data(mvm, te_data);
1005 spin_unlock_bh(&mvm->time_event_lock);
1009 spin_lock_bh(&mvm->time_event_lock);
1013 spin_unlock_bh(&mvm->time_event_lock);
1019 iwl_mvm_te_check_disconnect(mvm, vif,
1023 spin_lock_bh(&mvm->time_event_lock);
1024 iwl_mvm_te_clear_data(mvm, te_data);
1025 spin_unlock_bh(&mvm->time_event_lock);
1035 iwl_mvm_roc_finished(mvm);
1036 ieee80211_remain_on_channel_expired(mvm->hw);
1041 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status);
1042 ieee80211_ready_on_channel(mvm->hw); /* Start TE */
1098 int iwl_mvm_roc_add_cmd(struct iwl_mvm *mvm,
1108 .sta_id = cpu_to_le32(mvm->aux_sta.sta_id),
1112 lockdep_assert_held(&mvm->mutex);
1118 iwl_mvm_set_chan_info(mvm, &roc_req.channel_info,
1128 IWL_DEBUG_TE(mvm,
1131 IWL_DEBUG_TE(mvm,
1138 res = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, ROC_CMD),
1147 iwl_mvm_start_p2p_roc_session_protection(struct iwl_mvm *mvm,
1155 cpu_to_le32(iwl_mvm_get_session_prot_id(mvm, vif, 0)),
1160 lockdep_assert_held(&mvm->mutex);
1183 return iwl_mvm_send_cmd_pdu(mvm,
1188 int iwl_mvm_start_p2p_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
1195 lockdep_assert_held(&mvm->mutex);
1197 IWL_WARN(mvm, "P2P_DEVICE remain on channel already running\n");
1201 if (fw_has_capa(&mvm->fw->ucode_capa,
1203 return iwl_mvm_start_p2p_roc_session_protection(mvm, vif,
1240 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd);
1243 static struct iwl_mvm_time_event_data *iwl_mvm_get_roc_te(struct iwl_mvm *mvm)
1247 lockdep_assert_held(&mvm->mutex);
1249 spin_lock_bh(&mvm->time_event_lock);
1258 list_for_each_entry(te_data, &mvm->time_event_list, list) {
1266 te_data = list_first_entry_or_null(&mvm->aux_roc_te_list,
1270 spin_unlock_bh(&mvm->time_event_lock);
1274 void iwl_mvm_cleanup_roc_te(struct iwl_mvm *mvm)
1279 te_data = iwl_mvm_get_roc_te(mvm);
1281 __iwl_mvm_remove_time_event(mvm, te_data, &uid);
1284 void iwl_mvm_stop_roc(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
1288 bool p2p_aux = iwl_mvm_has_p2p_over_aux(mvm);
1289 u8 roc_ver = iwl_fw_lookup_cmd_ver(mvm->fw,
1293 mutex_lock(&mvm->mutex);
1297 iwl_mvm_roc_rm_cmd(mvm, mvmvif->roc_activity);
1301 } else if (fw_has_capa(&mvm->fw->ucode_capa,
1307 IWL_DEBUG_TE(mvm,
1309 mutex_unlock(&mvm->mutex);
1312 iwl_mvm_cancel_session_protection(mvm, vif,
1316 iwl_mvm_remove_aux_roc_te(mvm, mvmvif,
1322 te_data = iwl_mvm_get_roc_te(mvm);
1324 IWL_WARN(mvm, "No remain on channel event\n");
1325 mutex_unlock(&mvm->mutex);
1332 iwl_mvm_remove_time_event(mvm, mvmvif, te_data);
1334 iwl_mvm_remove_aux_roc_te(mvm, mvmvif, te_data);
1343 set_bit(IWL_MVM_STATUS_ROC_AUX_RUNNING, &mvm->status);
1345 set_bit(IWL_MVM_STATUS_ROC_P2P_RUNNING, &mvm->status);
1348 iwl_mvm_cleanup_roc(mvm);
1351 void iwl_mvm_remove_csa_period(struct iwl_mvm *mvm,
1358 lockdep_assert_held(&mvm->mutex);
1360 spin_lock_bh(&mvm->time_event_lock);
1362 spin_unlock_bh(&mvm->time_event_lock);
1367 iwl_mvm_remove_time_event(mvm, mvmvif, te_data);
1370 int iwl_mvm_schedule_csa_period(struct iwl_mvm *mvm,
1378 lockdep_assert_held(&mvm->mutex);
1383 spin_lock_bh(&mvm->time_event_lock);
1385 spin_unlock_bh(&mvm->time_event_lock);
1388 IWL_DEBUG_TE(mvm, "CS period is already scheduled\n");
1397 iwl_mvm_remove_time_event(mvm, mvmvif, te_data);
1414 return iwl_mvm_time_event_send_add(mvm, vif, te_data, &time_cmd);
1420 struct iwl_mvm *mvm =
1430 IWL_ERR(mvm, "Invalid SESSION_PROTECTION_NOTIF response\n");
1437 IWL_ERR(mvm,
1443 void iwl_mvm_schedule_session_protection(struct iwl_mvm *mvm,
1453 int mac_link_id = iwl_mvm_get_session_prot_id(mvm, vif, (s8)link_id);
1464 lockdep_assert_held(&mvm->mutex);
1466 spin_lock_bh(&mvm->time_event_lock);
1469 IWL_DEBUG_TE(mvm, "We have enough time in the current TE: %u\n",
1471 spin_unlock_bh(&mvm->time_event_lock);
1476 iwl_mvm_te_clear_data(mvm, te_data);
1485 spin_unlock_bh(&mvm->time_event_lock);
1487 IWL_DEBUG_TE(mvm, "Add new session protection, duration %d TU\n",
1491 if (iwl_mvm_send_cmd_pdu(mvm,
1500 iwl_init_notification_wait(&mvm->notif_wait, &wait_notif,
1504 if (iwl_mvm_send_cmd_pdu(mvm,
1507 iwl_remove_notification(&mvm->notif_wait, &wait_notif);
1509 } else if (iwl_wait_notification(&mvm->notif_wait, &wait_notif,
1511 IWL_ERR(mvm,
1517 IWL_ERR(mvm,
1519 spin_lock_bh(&mvm->time_event_lock);
1520 iwl_mvm_te_clear_data(mvm, te_data);
1521 spin_unlock_bh(&mvm->time_event_lock);