Lines Matching refs:mvm
5 #include "mvm.h"
9 u32 iwl_mvm_sta_fw_id_mask(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
38 lockdep_is_held(&mvm->mutex));
48 static int iwl_mvm_mld_send_sta_cmd(struct iwl_mvm *mvm,
51 int ret = iwl_mvm_send_cmd_pdu(mvm,
55 IWL_ERR(mvm, "STA_CONFIG_CMD send failed, ret=0x%x\n", ret);
62 static int iwl_mvm_mld_add_int_sta_to_fw(struct iwl_mvm *mvm,
68 lockdep_assert_held(&mvm->mutex);
77 if (fw_has_capa(&mvm->fw->ucode_capa,
87 return iwl_mvm_mld_send_sta_cmd(mvm, &cmd);
95 static int iwl_mvm_mld_rm_sta_from_fw(struct iwl_mvm *mvm, u32 sta_id)
103 if (!rcu_access_pointer(mvm->fw_id_to_mac_id[sta_id])) {
104 IWL_ERR(mvm, "Invalid station id %d\n", sta_id);
108 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, STA_REMOVE_CMD),
111 IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id);
118 static int iwl_mvm_add_aux_sta_to_fw(struct iwl_mvm *mvm,
129 ret = iwl_mvm_send_cmd_pdu(mvm, WIDE_ID(MAC_CONF_GROUP, AUX_STA_CMD),
132 IWL_ERR(mvm, "Failed to send AUX_STA_CMD\n");
139 int iwl_mvm_mld_add_int_sta_with_queue(struct iwl_mvm *mvm,
147 mvm->trans->trans_cfg->base_params->wd_timeout;
153 ret = iwl_mvm_add_aux_sta_to_fw(mvm, sta, link_id);
155 ret = iwl_mvm_mld_add_int_sta_to_fw(mvm, sta, addr, link_id);
163 txq = iwl_mvm_tvqm_enable_txq(mvm, NULL, sta->sta_id, tid,
166 iwl_mvm_mld_rm_sta_from_fw(mvm, sta->sta_id);
178 static int iwl_mvm_mld_add_int_sta(struct iwl_mvm *mvm,
187 lockdep_assert_held(&mvm->mutex);
190 ret = iwl_mvm_allocate_int_sta(mvm, int_sta, 0, iftype,
195 ret = iwl_mvm_mld_add_int_sta_with_queue(mvm, int_sta, addr, link_id,
198 iwl_mvm_dealloc_int_sta(mvm, int_sta);
209 int iwl_mvm_mld_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
219 iwl_mvm_get_wd_timeout(mvm, vif, false, false);
222 lockdep_assert_held(&mvm->mutex);
231 queue = &mvm->p2p_dev_queue;
237 return iwl_mvm_mld_add_int_sta(mvm, bsta, queue,
248 int iwl_mvm_mld_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
257 unsigned int timeout = iwl_mvm_get_wd_timeout(mvm, vif, false, false);
259 lockdep_assert_held(&mvm->mutex);
273 return iwl_mvm_mld_add_int_sta(mvm, msta, &mvm_link->cab_queue,
282 int iwl_mvm_mld_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
289 lockdep_assert_held(&mvm->mutex);
291 return iwl_mvm_mld_add_int_sta(mvm, &mvm->snif_sta, &mvm->snif_queue,
297 int iwl_mvm_mld_add_aux_sta(struct iwl_mvm *mvm, u32 lmac_id)
299 lockdep_assert_held(&mvm->mutex);
304 return iwl_mvm_mld_add_int_sta(mvm, &mvm->aux_sta, &mvm->aux_queue,
310 static int iwl_mvm_mld_disable_txq(struct iwl_mvm *mvm, u32 sta_mask,
319 if (mvm->sta_remove_requires_queue_remove) {
328 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0,
333 iwl_trans_txq_free(mvm->trans, queue);
341 static int iwl_mvm_mld_rm_int_sta(struct iwl_mvm *mvm,
347 lockdep_assert_held(&mvm->mutex);
353 iwl_mvm_flush_sta(mvm, int_sta->sta_id, int_sta->tfd_queue_msk);
355 iwl_mvm_mld_disable_txq(mvm, BIT(int_sta->sta_id), queuptr, tid);
357 ret = iwl_mvm_mld_rm_sta_from_fw(mvm, int_sta->sta_id);
359 IWL_WARN(mvm, "Failed sending remove station\n");
361 iwl_mvm_dealloc_int_sta(mvm, int_sta);
366 int iwl_mvm_mld_rm_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
373 lockdep_assert_held(&mvm->mutex);
384 queueptr = &mvm->p2p_dev_queue;
392 return iwl_mvm_mld_rm_int_sta(mvm, &link->bcast_sta,
399 int iwl_mvm_mld_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
405 lockdep_assert_held(&mvm->mutex);
410 return iwl_mvm_mld_rm_int_sta(mvm, &link->mcast_sta, true, 0,
414 int iwl_mvm_mld_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
416 lockdep_assert_held(&mvm->mutex);
418 return iwl_mvm_mld_rm_int_sta(mvm, &mvm->snif_sta, false,
419 IWL_MAX_TID_COUNT, &mvm->snif_queue);
422 int iwl_mvm_mld_rm_aux_sta(struct iwl_mvm *mvm)
424 lockdep_assert_held(&mvm->mutex);
426 return iwl_mvm_mld_rm_int_sta(mvm, &mvm->aux_sta, false,
427 IWL_MAX_TID_COUNT, &mvm->aux_queue);
431 static int iwl_mvm_mld_cfg_sta(struct iwl_mvm *mvm, struct ieee80211_sta *sta,
459 if (fw_has_capa(&mvm->fw->ucode_capa,
505 iwl_mvm_set_sta_pkt_ext(mvm, link_sta, &cmd.pkt_ext);
515 return iwl_mvm_mld_send_sta_cmd(mvm, &cmd);
518 void iwl_mvm_mld_free_sta_link(struct iwl_mvm *mvm,
524 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta_link->sta_id],
526 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[mvm_sta_link->sta_id], NULL);
533 static void iwl_mvm_mld_sta_rm_all_sta_links(struct iwl_mvm *mvm,
541 lockdep_is_held(&mvm->mutex));
546 iwl_mvm_mld_free_sta_link(mvm, mvm_sta, link, link_id, false);
550 static int iwl_mvm_mld_alloc_sta_link(struct iwl_mvm *mvm,
559 u32 sta_id = iwl_mvm_find_free_sta_id(mvm,
575 rcu_assign_pointer(mvm->fw_id_to_mac_id[link->sta_id], sta);
576 rcu_assign_pointer(mvm->fw_id_to_link_sta[link->sta_id],
583 static int iwl_mvm_mld_alloc_sta_links(struct iwl_mvm *mvm,
592 lockdep_assert_held(&mvm->mutex);
598 ret = iwl_mvm_mld_alloc_sta_link(mvm, vif, sta, link_id);
606 iwl_mvm_mld_sta_rm_all_sta_links(mvm, mvm_sta);
622 static int iwl_mvm_alloc_sta_after_restart(struct iwl_mvm *mvm,
644 lockdep_is_held(&mvm->mutex));
655 ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta,
660 rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], sta);
661 rcu_assign_pointer(mvm->fw_id_to_link_sta[sta_id], link_sta);
665 iwl_mvm_realloc_queues_after_restart(mvm, sta);
670 int iwl_mvm_mld_add_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
680 lockdep_assert_held(&mvm->mutex);
682 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
683 ret = iwl_mvm_mld_alloc_sta_links(mvm, vif, sta);
689 ret = iwl_mvm_sta_init(mvm, vif, sta, IWL_MVM_INVALID_STA,
692 ret = iwl_mvm_alloc_sta_after_restart(mvm, vif, sta);
699 ret = iwl_mvm_mld_update_sta(mvm, vif, sta);
708 lockdep_is_held(&mvm->mutex));
715 ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
734 lockdep_is_held(&mvm->mutex));
736 iwl_mvm_mld_rm_sta_from_fw(mvm, mvm_link_sta->sta_id);
740 iwl_mvm_mld_sta_rm_all_sta_links(mvm, mvm_sta);
744 int iwl_mvm_mld_update_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
752 lockdep_assert_held(&mvm->mutex);
759 lockdep_is_held(&mvm->mutex));
764 ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
768 IWL_ERR(mvm, "Failed to update sta link %d\n", link_id);
776 static void iwl_mvm_mld_disable_sta_queues(struct iwl_mvm *mvm,
781 u32 sta_mask = iwl_mvm_sta_fw_id_mask(mvm, sta, -1);
784 lockdep_assert_held(&mvm->mutex);
790 iwl_mvm_mld_disable_txq(mvm, sta_mask,
803 int iwl_mvm_mld_rm_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
811 lockdep_assert_held(&mvm->mutex);
817 lockdep_is_held(&mvm->mutex));
822 ret = iwl_mvm_flush_sta_tids(mvm, mvm_link_sta->sta_id,
828 ret = iwl_mvm_wait_sta_queues_empty(mvm, mvm_sta);
832 iwl_mvm_mld_disable_sta_queues(mvm, vif, sta);
837 lockdep_is_held(&mvm->mutex));
840 stay_in_fw = iwl_mvm_sta_del(mvm, vif, sta, link_sta, &ret);
845 ret = iwl_mvm_mld_rm_sta_from_fw(mvm,
848 iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_link_sta,
857 int iwl_mvm_mld_rm_sta_id(struct iwl_mvm *mvm, u8 sta_id)
861 lockdep_assert_held(&mvm->mutex);
866 ret = iwl_mvm_mld_rm_sta_from_fw(mvm, sta_id);
868 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL);
869 RCU_INIT_POINTER(mvm->fw_id_to_link_sta[sta_id], NULL);
873 void iwl_mvm_mld_sta_modify_disable_tx(struct iwl_mvm *mvm,
883 if (WARN_ON(iwl_mvm_has_no_host_disable_tx(mvm)))
886 ret = iwl_mvm_send_cmd_pdu(mvm,
890 IWL_ERR(mvm,
895 void iwl_mvm_mld_sta_modify_disable_tx_ap(struct iwl_mvm *mvm,
908 iwl_mvm_mld_sta_modify_disable_tx(mvm, mvm_sta, disable);
913 void iwl_mvm_mld_modify_all_sta_disable_tx(struct iwl_mvm *mvm,
924 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
925 sta = rcu_dereference(mvm->fw_id_to_mac_id[i]);
934 iwl_mvm_mld_sta_modify_disable_tx(mvm, mvm_sta, disable);
940 static int iwl_mvm_mld_update_sta_queues(struct iwl_mvm *mvm,
959 lockdep_assert_held(&mvm->mutex);
973 ret = iwl_mvm_send_cmd(mvm, &hcmd);
981 static int iwl_mvm_mld_update_sta_baids(struct iwl_mvm *mvm,
994 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status))
999 for (baid = 0; baid < ARRAY_SIZE(mvm->baid_map); baid++) {
1003 data = rcu_dereference_protected(mvm->baid_map[baid],
1004 lockdep_is_held(&mvm->mutex));
1017 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, CMD_SEND_IN_RFKILL,
1027 static int iwl_mvm_mld_update_sta_resources(struct iwl_mvm *mvm,
1035 ret = iwl_mvm_mld_update_sta_queues(mvm, sta,
1041 ret = iwl_mvm_mld_update_sta_keys(mvm, vif, sta,
1047 return iwl_mvm_mld_update_sta_baids(mvm, old_sta_mask, new_sta_mask);
1050 int iwl_mvm_mld_update_sta_links(struct iwl_mvm *mvm,
1067 lockdep_assert_held(&mvm->mutex);
1073 lockdep_is_held(&mvm->mutex));
1086 ret = iwl_mvm_mld_update_sta_resources(mvm, vif, sta,
1099 lockdep_is_held(&mvm->mutex));
1107 ret = iwl_mvm_mld_rm_sta_from_fw(mvm, mvm_sta_link->sta_id);
1114 iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_sta_link, link_id,
1130 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) {
1133 lockdep_is_held(&mvm->mutex));
1143 rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], sta);
1144 rcu_assign_pointer(mvm->fw_id_to_link_sta[sta_id],
1151 ret = iwl_mvm_mld_alloc_sta_link(mvm, vif, sta,
1162 lockdep_is_held(&mvm->mutex));
1177 ret = iwl_mvm_mld_cfg_sta(mvm, sta, vif, link_sta, link_conf,
1184 iwl_mvm_rs_add_sta_link(mvm, mvm_sta_link);
1188 ret = iwl_mvm_mld_update_sta_resources(mvm, vif, sta,
1204 lockdep_is_held(&mvm->mutex));
1206 iwl_mvm_mld_rm_sta_from_fw(mvm, mvm_sta_link->sta_id);
1214 lockdep_is_held(&mvm->mutex));
1216 iwl_mvm_mld_free_sta_link(mvm, mvm_sta, mvm_sta_link, link_id,