Lines Matching refs:mvm
18 static inline int iwl_mvm_add_sta_cmd_size(struct iwl_mvm *mvm) in iwl_mvm_add_sta_cmd_size() argument
20 if (iwl_mvm_has_new_rx_api(mvm) || in iwl_mvm_add_sta_cmd_size()
21 fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_add_sta_cmd_size()
27 static int iwl_mvm_find_free_sta_id(struct iwl_mvm *mvm, in iwl_mvm_find_free_sta_id() argument
34 WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)); in iwl_mvm_find_free_sta_id()
36 lockdep_assert_held(&mvm->mutex); in iwl_mvm_find_free_sta_id()
43 for (sta_id = 0; sta_id < mvm->fw->ucode_capa.num_stations; sta_id++) { in iwl_mvm_find_free_sta_id()
47 if (!rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_find_free_sta_id()
48 lockdep_is_held(&mvm->mutex))) in iwl_mvm_find_free_sta_id()
55 int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_sta_send_to_fw() argument
72 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_sta_send_to_fw()
78 if (!iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_sta_send_to_fw()
203 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, in iwl_mvm_sta_send_to_fw()
204 iwl_mvm_add_sta_cmd_size(mvm), in iwl_mvm_sta_send_to_fw()
211 IWL_DEBUG_ASSOC(mvm, "ADD_STA PASSED\n"); in iwl_mvm_sta_send_to_fw()
215 IWL_ERR(mvm, "ADD_STA failed\n"); in iwl_mvm_sta_send_to_fw()
249 sta = rcu_dereference(ba_data->mvm->fw_id_to_mac_id[ba_data->sta_id]); in iwl_mvm_rx_agg_session_expired()
270 static int iwl_mvm_invalidate_sta_queue(struct iwl_mvm *mvm, int queue, in iwl_mvm_invalidate_sta_queue() argument
280 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_invalidate_sta_queue()
283 sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_invalidate_sta_queue()
287 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_invalidate_sta_queue()
313 return iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, in iwl_mvm_invalidate_sta_queue()
314 iwl_mvm_add_sta_cmd_size(mvm), in iwl_mvm_invalidate_sta_queue()
318 static int iwl_mvm_disable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_disable_txq() argument
328 lockdep_assert_held(&mvm->mutex); in iwl_mvm_disable_txq()
330 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_disable_txq()
331 if (mvm->sta_remove_requires_queue_remove) { in iwl_mvm_disable_txq()
339 ret = iwl_mvm_send_cmd_pdu(mvm, cmd_id, 0, in iwl_mvm_disable_txq()
346 iwl_trans_txq_free(mvm->trans, queue); in iwl_mvm_disable_txq()
352 if (WARN_ON(mvm->queue_info[queue].tid_bitmap == 0)) in iwl_mvm_disable_txq()
355 mvm->queue_info[queue].tid_bitmap &= ~BIT(tid); in iwl_mvm_disable_txq()
357 cmd.action = mvm->queue_info[queue].tid_bitmap ? in iwl_mvm_disable_txq()
360 mvm->queue_info[queue].status = IWL_MVM_QUEUE_FREE; in iwl_mvm_disable_txq()
362 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_disable_txq()
365 mvm->queue_info[queue].tid_bitmap); in iwl_mvm_disable_txq()
371 cmd.sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_disable_txq()
372 cmd.tid = mvm->queue_info[queue].txq_tid; in iwl_mvm_disable_txq()
375 WARN(mvm->queue_info[queue].tid_bitmap, in iwl_mvm_disable_txq()
377 queue, mvm->queue_info[queue].tid_bitmap); in iwl_mvm_disable_txq()
380 mvm->queue_info[queue].tid_bitmap = 0; in iwl_mvm_disable_txq()
390 mvm->queue_info[queue].reserved = false; in iwl_mvm_disable_txq()
392 iwl_trans_txq_disable(mvm->trans, queue, false); in iwl_mvm_disable_txq()
393 ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, in iwl_mvm_disable_txq()
397 IWL_ERR(mvm, "Failed to disable queue %d (ret=%d)\n", in iwl_mvm_disable_txq()
402 static int iwl_mvm_get_queue_agg_tids(struct iwl_mvm *mvm, int queue) in iwl_mvm_get_queue_agg_tids() argument
411 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_queue_agg_tids()
413 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_get_queue_agg_tids()
416 sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_get_queue_agg_tids()
417 tid_bitmap = mvm->queue_info[queue].tid_bitmap; in iwl_mvm_get_queue_agg_tids()
419 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_get_queue_agg_tids()
420 lockdep_is_held(&mvm->mutex)); in iwl_mvm_get_queue_agg_tids()
442 static int iwl_mvm_remove_sta_queue_marking(struct iwl_mvm *mvm, int queue) in iwl_mvm_remove_sta_queue_marking() argument
451 lockdep_assert_held(&mvm->mutex); in iwl_mvm_remove_sta_queue_marking()
453 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_remove_sta_queue_marking()
456 sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_remove_sta_queue_marking()
457 tid_bitmap = mvm->queue_info[queue].tid_bitmap; in iwl_mvm_remove_sta_queue_marking()
461 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_remove_sta_queue_marking()
501 static int iwl_mvm_free_inactive_queue(struct iwl_mvm *mvm, int queue, in iwl_mvm_free_inactive_queue() argument
512 lockdep_assert_held(&mvm->mutex); in iwl_mvm_free_inactive_queue()
514 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_free_inactive_queue()
517 sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_free_inactive_queue()
518 tid = mvm->queue_info[queue].txq_tid; in iwl_mvm_free_inactive_queue()
522 mvmsta = iwl_mvm_sta_from_staid_protected(mvm, sta_id); in iwl_mvm_free_inactive_queue()
526 disable_agg_tids = iwl_mvm_remove_sta_queue_marking(mvm, queue); in iwl_mvm_free_inactive_queue()
529 iwl_mvm_invalidate_sta_queue(mvm, queue, in iwl_mvm_free_inactive_queue()
532 ret = iwl_mvm_disable_txq(mvm, old_sta, &queue_tmp, tid); in iwl_mvm_free_inactive_queue()
534 IWL_ERR(mvm, in iwl_mvm_free_inactive_queue()
543 iwl_mvm_invalidate_sta_queue(mvm, queue, 0, true); in iwl_mvm_free_inactive_queue()
548 static int iwl_mvm_get_shared_queue(struct iwl_mvm *mvm, in iwl_mvm_get_shared_queue() argument
559 lockdep_assert_held(&mvm->mutex); in iwl_mvm_get_shared_queue()
561 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_get_shared_queue()
573 ac_to_queue[mvm->queue_info[i].mac80211_ac] = i; in iwl_mvm_get_shared_queue()
606 if (!iwl_mvm_is_dqa_data_queue(mvm, queue) && in iwl_mvm_get_shared_queue()
607 !iwl_mvm_is_dqa_mgmt_queue(mvm, queue) && in iwl_mvm_get_shared_queue()
609 IWL_ERR(mvm, "No DATA queues available to share\n"); in iwl_mvm_get_shared_queue()
617 static int iwl_mvm_reconfig_scd(struct iwl_mvm *mvm, int queue, int fifo, in iwl_mvm_reconfig_scd() argument
633 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_reconfig_scd()
636 if (WARN(mvm->queue_info[queue].tid_bitmap == 0, in iwl_mvm_reconfig_scd()
640 IWL_DEBUG_TX_QUEUES(mvm, "Reconfig SCD for TXQ #%d\n", queue); in iwl_mvm_reconfig_scd()
642 ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd); in iwl_mvm_reconfig_scd()
655 static int iwl_mvm_redirect_queue(struct iwl_mvm *mvm, int queue, int tid, in iwl_mvm_redirect_queue() argument
666 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_redirect_queue()
677 if (ac <= mvm->queue_info[queue].mac80211_ac && !force) { in iwl_mvm_redirect_queue()
678 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_redirect_queue()
684 cmd.sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_redirect_queue()
685 cmd.tx_fifo = iwl_mvm_ac_to_tx_fifo[mvm->queue_info[queue].mac80211_ac]; in iwl_mvm_redirect_queue()
686 cmd.tid = mvm->queue_info[queue].txq_tid; in iwl_mvm_redirect_queue()
687 shared_queue = hweight16(mvm->queue_info[queue].tid_bitmap) > 1; in iwl_mvm_redirect_queue()
689 IWL_DEBUG_TX_QUEUES(mvm, "Redirecting TXQ #%d to FIFO #%d\n", in iwl_mvm_redirect_queue()
695 ret = iwl_trans_wait_tx_queues_empty(mvm->trans, BIT(queue)); in iwl_mvm_redirect_queue()
697 IWL_ERR(mvm, "Error draining queue %d before reconfig\n", in iwl_mvm_redirect_queue()
704 iwl_trans_txq_disable(mvm->trans, queue, false); in iwl_mvm_redirect_queue()
705 ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd); in iwl_mvm_redirect_queue()
707 IWL_ERR(mvm, "Failed SCD disable TXQ %d (ret=%d)\n", queue, in iwl_mvm_redirect_queue()
711 iwl_trans_txq_enable_cfg(mvm->trans, queue, ssn, NULL, wdg_timeout); in iwl_mvm_redirect_queue()
714 mvm->queue_info[queue].txq_tid = tid; in iwl_mvm_redirect_queue()
719 iwl_mvm_reconfig_scd(mvm, queue, iwl_mvm_ac_to_tx_fifo[ac], in iwl_mvm_redirect_queue()
723 mvm->queue_info[queue].mac80211_ac = ac; in iwl_mvm_redirect_queue()
732 iwl_trans_txq_set_shared_mode(mvm->trans, queue, true); in iwl_mvm_redirect_queue()
741 static int iwl_mvm_find_free_queue(struct iwl_mvm *mvm, u8 sta_id, in iwl_mvm_find_free_queue() argument
746 lockdep_assert_held(&mvm->mutex); in iwl_mvm_find_free_queue()
748 if (WARN(maxq >= mvm->trans->trans_cfg->base_params->num_of_queues, in iwl_mvm_find_free_queue()
750 mvm->trans->trans_cfg->base_params->num_of_queues)) in iwl_mvm_find_free_queue()
751 maxq = mvm->trans->trans_cfg->base_params->num_of_queues - 1; in iwl_mvm_find_free_queue()
754 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_find_free_queue()
759 if (mvm->queue_info[i].tid_bitmap == 0 && in iwl_mvm_find_free_queue()
760 mvm->queue_info[i].status == IWL_MVM_QUEUE_FREE) in iwl_mvm_find_free_queue()
766 static int iwl_mvm_tvqm_enable_txq(struct iwl_mvm *mvm, in iwl_mvm_tvqm_enable_txq() argument
774 mvm->trans->cfg->min_txq_size); in iwl_mvm_tvqm_enable_txq()
779 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_tvqm_enable_txq()
795 size = min_t(u32, size, mvm->trans->txqs.bc_tbl_size / sizeof(u16)); in iwl_mvm_tvqm_enable_txq()
801 queue = iwl_trans_txq_alloc(mvm->trans, 0, BIT(sta_id), in iwl_mvm_tvqm_enable_txq()
805 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_tvqm_enable_txq()
814 IWL_DEBUG_TX_QUEUES(mvm, "Enabling TXQ #%d for sta %d tid %d\n", in iwl_mvm_tvqm_enable_txq()
820 static int iwl_mvm_sta_alloc_queue_tvqm(struct iwl_mvm *mvm, in iwl_mvm_sta_alloc_queue_tvqm() argument
828 iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); in iwl_mvm_sta_alloc_queue_tvqm()
831 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_alloc_queue_tvqm()
833 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_alloc_queue_tvqm()
836 queue = iwl_mvm_tvqm_enable_txq(mvm, mvmsta->sta_id, tid, wdg_timeout); in iwl_mvm_sta_alloc_queue_tvqm()
841 mvm->tvqm_info[queue].txq_tid = tid; in iwl_mvm_sta_alloc_queue_tvqm()
842 mvm->tvqm_info[queue].sta_id = mvmsta->sta_id; in iwl_mvm_sta_alloc_queue_tvqm()
844 IWL_DEBUG_TX_QUEUES(mvm, "Allocated queue is %d\n", queue); in iwl_mvm_sta_alloc_queue_tvqm()
853 static bool iwl_mvm_update_txq_mapping(struct iwl_mvm *mvm, in iwl_mvm_update_txq_mapping() argument
860 if (mvm->queue_info[queue].tid_bitmap & BIT(tid)) { in iwl_mvm_update_txq_mapping()
861 IWL_ERR(mvm, "Trying to enable TXQ %d with existing TID %d\n", in iwl_mvm_update_txq_mapping()
867 if (mvm->queue_info[queue].tid_bitmap) in iwl_mvm_update_txq_mapping()
870 mvm->queue_info[queue].tid_bitmap |= BIT(tid); in iwl_mvm_update_txq_mapping()
871 mvm->queue_info[queue].ra_sta_id = sta_id; in iwl_mvm_update_txq_mapping()
875 mvm->queue_info[queue].mac80211_ac = in iwl_mvm_update_txq_mapping()
878 mvm->queue_info[queue].mac80211_ac = IEEE80211_AC_VO; in iwl_mvm_update_txq_mapping()
880 mvm->queue_info[queue].txq_tid = tid; in iwl_mvm_update_txq_mapping()
890 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_update_txq_mapping()
892 queue, mvm->queue_info[queue].tid_bitmap); in iwl_mvm_update_txq_mapping()
897 static bool iwl_mvm_enable_txq(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_enable_txq() argument
914 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_enable_txq()
918 if (!iwl_mvm_update_txq_mapping(mvm, sta, queue, cfg->sta_id, cfg->tid)) in iwl_mvm_enable_txq()
921 inc_ssn = iwl_trans_txq_enable_cfg(mvm->trans, queue, ssn, in iwl_mvm_enable_txq()
926 WARN(iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd), in iwl_mvm_enable_txq()
932 static void iwl_mvm_change_queue_tid(struct iwl_mvm *mvm, int queue) in iwl_mvm_change_queue_tid() argument
942 lockdep_assert_held(&mvm->mutex); in iwl_mvm_change_queue_tid()
944 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_change_queue_tid()
947 tid_bitmap = mvm->queue_info[queue].tid_bitmap; in iwl_mvm_change_queue_tid()
957 ret = iwl_mvm_send_cmd_pdu(mvm, SCD_QUEUE_CFG, 0, sizeof(cmd), &cmd); in iwl_mvm_change_queue_tid()
959 IWL_ERR(mvm, "Failed to update owner of TXQ %d (ret=%d)\n", in iwl_mvm_change_queue_tid()
964 mvm->queue_info[queue].txq_tid = tid; in iwl_mvm_change_queue_tid()
965 IWL_DEBUG_TX_QUEUES(mvm, "Changed TXQ %d ownership to tid %d\n", in iwl_mvm_change_queue_tid()
969 static void iwl_mvm_unshare_queue(struct iwl_mvm *mvm, int queue) in iwl_mvm_unshare_queue() argument
981 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_unshare_queue()
984 lockdep_assert_held(&mvm->mutex); in iwl_mvm_unshare_queue()
986 sta_id = mvm->queue_info[queue].ra_sta_id; in iwl_mvm_unshare_queue()
987 tid_bitmap = mvm->queue_info[queue].tid_bitmap; in iwl_mvm_unshare_queue()
992 IWL_ERR(mvm, "Failed to unshare q %d, active tids=0x%lx\n", in iwl_mvm_unshare_queue()
997 IWL_DEBUG_TX_QUEUES(mvm, "Unsharing TXQ %d, keeping tid %d\n", queue, in iwl_mvm_unshare_queue()
1000 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_unshare_queue()
1001 lockdep_is_held(&mvm->mutex)); in iwl_mvm_unshare_queue()
1007 wdg_timeout = iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); in iwl_mvm_unshare_queue()
1011 ret = iwl_mvm_redirect_queue(mvm, queue, tid, in iwl_mvm_unshare_queue()
1016 IWL_ERR(mvm, "Failed to redirect TXQ %d\n", queue); in iwl_mvm_unshare_queue()
1033 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, in iwl_mvm_unshare_queue()
1034 iwl_mvm_add_sta_cmd_size(mvm), &cmd); in iwl_mvm_unshare_queue()
1036 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_unshare_queue()
1041 iwl_trans_txq_set_shared_mode(mvm->trans, queue, false); in iwl_mvm_unshare_queue()
1045 mvm->queue_info[queue].status = IWL_MVM_QUEUE_READY; in iwl_mvm_unshare_queue()
1055 static bool iwl_mvm_remove_inactive_tids(struct iwl_mvm *mvm, in iwl_mvm_remove_inactive_tids() argument
1064 lockdep_assert_held(&mvm->mutex); in iwl_mvm_remove_inactive_tids()
1066 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_remove_inactive_tids()
1072 if (iwl_mvm_tid_queued(mvm, &mvmsta->tid_data[tid])) in iwl_mvm_remove_inactive_tids()
1081 if (tid_bitmap == mvm->queue_info[queue].tid_bitmap) { in iwl_mvm_remove_inactive_tids()
1082 IWL_DEBUG_TX_QUEUES(mvm, "Queue %d is inactive\n", queue); in iwl_mvm_remove_inactive_tids()
1094 mvm->queue_info[queue].tid_bitmap &= ~BIT(tid); in iwl_mvm_remove_inactive_tids()
1096 q_tid_bitmap = mvm->queue_info[queue].tid_bitmap; in iwl_mvm_remove_inactive_tids()
1109 if (!(q_tid_bitmap & BIT(mvm->queue_info[queue].txq_tid))) in iwl_mvm_remove_inactive_tids()
1112 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_remove_inactive_tids()
1117 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_remove_inactive_tids()
1119 mvm->queue_info[queue].tid_bitmap); in iwl_mvm_remove_inactive_tids()
1125 tid_bitmap = mvm->queue_info[queue].tid_bitmap; in iwl_mvm_remove_inactive_tids()
1128 if (hweight16(mvm->queue_info[queue].tid_bitmap) == 1 && in iwl_mvm_remove_inactive_tids()
1129 mvm->queue_info[queue].status == IWL_MVM_QUEUE_SHARED) { in iwl_mvm_remove_inactive_tids()
1130 IWL_DEBUG_TX_QUEUES(mvm, "Marking Q:%d for reconfig\n", in iwl_mvm_remove_inactive_tids()
1147 static int iwl_mvm_inactivity_check(struct iwl_mvm *mvm, u8 alloc_for_sta) in iwl_mvm_inactivity_check() argument
1155 lockdep_assert_held(&mvm->mutex); in iwl_mvm_inactivity_check()
1157 if (iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_inactivity_check()
1173 queue_tid_bitmap = mvm->queue_info[i].tid_bitmap; in iwl_mvm_inactivity_check()
1178 if (mvm->queue_info[i].status != IWL_MVM_QUEUE_READY && in iwl_mvm_inactivity_check()
1179 mvm->queue_info[i].status != IWL_MVM_QUEUE_SHARED) in iwl_mvm_inactivity_check()
1185 if (time_after(mvm->queue_info[i].last_frame_time[tid] + in iwl_mvm_inactivity_check()
1201 sta_id = mvm->queue_info[i].ra_sta_id; in iwl_mvm_inactivity_check()
1202 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_inactivity_check()
1215 ret = iwl_mvm_remove_inactive_tids(mvm, mvmsta, i, in iwl_mvm_inactivity_check()
1230 iwl_mvm_unshare_queue(mvm, i); in iwl_mvm_inactivity_check()
1232 iwl_mvm_change_queue_tid(mvm, i); in iwl_mvm_inactivity_check()
1237 ret = iwl_mvm_free_inactive_queue(mvm, free_queue, queue_owner, in iwl_mvm_inactivity_check()
1246 static int iwl_mvm_sta_alloc_queue(struct iwl_mvm *mvm, in iwl_mvm_sta_alloc_queue() argument
1251 .fifo = iwl_mvm_mac_ac_to_tx_fifo(mvm, ac), in iwl_mvm_sta_alloc_queue()
1257 iwl_mvm_get_wd_timeout(mvm, mvmsta->vif, false, false); in iwl_mvm_sta_alloc_queue()
1267 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_alloc_queue()
1269 if (iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_sta_alloc_queue()
1270 return iwl_mvm_sta_alloc_queue_tvqm(mvm, sta, ac, tid); in iwl_mvm_sta_alloc_queue()
1278 queue = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, in iwl_mvm_sta_alloc_queue()
1282 IWL_DEBUG_TX_QUEUES(mvm, "Found free MGMT queue #%d\n", in iwl_mvm_sta_alloc_queue()
1289 (mvm->queue_info[mvmsta->reserved_queue].status == in iwl_mvm_sta_alloc_queue()
1292 mvm->queue_info[queue].reserved = true; in iwl_mvm_sta_alloc_queue()
1293 IWL_DEBUG_TX_QUEUES(mvm, "Using reserved queue #%d\n", queue); in iwl_mvm_sta_alloc_queue()
1297 queue = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, in iwl_mvm_sta_alloc_queue()
1302 queue = iwl_mvm_inactivity_check(mvm, mvmsta->sta_id); in iwl_mvm_sta_alloc_queue()
1307 queue = iwl_mvm_get_shared_queue(mvm, tfd_queue_mask, ac); in iwl_mvm_sta_alloc_queue()
1310 mvm->queue_info[queue].status = IWL_MVM_QUEUE_SHARED; in iwl_mvm_sta_alloc_queue()
1321 mvm->queue_info[queue].status = IWL_MVM_QUEUE_READY; in iwl_mvm_sta_alloc_queue()
1325 IWL_ERR(mvm, "No available queues for tid %d on sta_id %d\n", in iwl_mvm_sta_alloc_queue()
1339 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_alloc_queue()
1346 disable_agg_tids = iwl_mvm_get_queue_agg_tids(mvm, queue); in iwl_mvm_sta_alloc_queue()
1349 IWL_DEBUG_TX_QUEUES(mvm, "Disabling aggs on queue %d\n", in iwl_mvm_sta_alloc_queue()
1351 iwl_mvm_invalidate_sta_queue(mvm, queue, in iwl_mvm_sta_alloc_queue()
1356 inc_ssn = iwl_mvm_enable_txq(mvm, sta, queue, ssn, &cfg, wdg_timeout); in iwl_mvm_sta_alloc_queue()
1365 iwl_trans_txq_set_shared_mode(mvm->trans, queue, true); in iwl_mvm_sta_alloc_queue()
1386 ret = iwl_mvm_sta_send_to_fw(mvm, sta, true, STA_MODIFY_QUEUES); in iwl_mvm_sta_alloc_queue()
1392 ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); in iwl_mvm_sta_alloc_queue()
1398 ret = iwl_mvm_redirect_queue(mvm, queue, tid, ac, ssn, in iwl_mvm_sta_alloc_queue()
1409 iwl_mvm_disable_txq(mvm, sta, &queue_tmp, tid); in iwl_mvm_sta_alloc_queue()
1416 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, in iwl_mvm_add_new_dqa_stream_wk() local
1419 mutex_lock(&mvm->mutex); in iwl_mvm_add_new_dqa_stream_wk()
1421 iwl_mvm_inactivity_check(mvm, IWL_MVM_INVALID_STA); in iwl_mvm_add_new_dqa_stream_wk()
1423 while (!list_empty(&mvm->add_stream_txqs)) { in iwl_mvm_add_new_dqa_stream_wk()
1428 mvmtxq = list_first_entry(&mvm->add_stream_txqs, in iwl_mvm_add_new_dqa_stream_wk()
1443 if (iwl_mvm_sta_alloc_queue(mvm, txq->sta, txq->ac, tid)) { in iwl_mvm_add_new_dqa_stream_wk()
1450 iwl_mvm_mac_itxq_xmit(mvm->hw, txq); in iwl_mvm_add_new_dqa_stream_wk()
1454 mutex_unlock(&mvm->mutex); in iwl_mvm_add_new_dqa_stream_wk()
1457 static int iwl_mvm_reserve_sta_stream(struct iwl_mvm *mvm, in iwl_mvm_reserve_sta_stream() argument
1465 if (WARN_ON(iwl_mvm_has_new_tx_api(mvm))) in iwl_mvm_reserve_sta_stream()
1469 iwl_mvm_inactivity_check(mvm, IWL_MVM_INVALID_STA); in iwl_mvm_reserve_sta_stream()
1473 !mvm->queue_info[IWL_MVM_DQA_BSS_CLIENT_QUEUE].tid_bitmap && in iwl_mvm_reserve_sta_stream()
1474 (mvm->queue_info[IWL_MVM_DQA_BSS_CLIENT_QUEUE].status == in iwl_mvm_reserve_sta_stream()
1478 queue = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, in iwl_mvm_reserve_sta_stream()
1483 queue = iwl_mvm_inactivity_check(mvm, mvmsta->sta_id); in iwl_mvm_reserve_sta_stream()
1485 IWL_ERR(mvm, "No available queues for new station\n"); in iwl_mvm_reserve_sta_stream()
1489 mvm->queue_info[queue].status = IWL_MVM_QUEUE_RESERVED; in iwl_mvm_reserve_sta_stream()
1493 IWL_DEBUG_TX_QUEUES(mvm, "Reserving data queue #%d for sta_id %d\n", in iwl_mvm_reserve_sta_stream()
1506 static void iwl_mvm_realloc_queues_after_restart(struct iwl_mvm *mvm, in iwl_mvm_realloc_queues_after_restart() argument
1511 iwl_mvm_get_wd_timeout(mvm, mvm_sta->vif, false, false); in iwl_mvm_realloc_queues_after_restart()
1520 mvm->queue_info[mvm_sta->reserved_queue].status = in iwl_mvm_realloc_queues_after_restart()
1533 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_realloc_queues_after_restart()
1534 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_realloc_queues_after_restart()
1537 txq_id = iwl_mvm_tvqm_enable_txq(mvm, mvm_sta->sta_id, in iwl_mvm_realloc_queues_after_restart()
1559 cfg.fifo = iwl_mvm_mac_ac_to_tx_fifo(mvm, ac); in iwl_mvm_realloc_queues_after_restart()
1564 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_realloc_queues_after_restart()
1568 iwl_mvm_enable_txq(mvm, sta, txq_id, seq, &cfg, wdg); in iwl_mvm_realloc_queues_after_restart()
1569 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_READY; in iwl_mvm_realloc_queues_after_restart()
1574 static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm, in iwl_mvm_add_int_sta_common() argument
1583 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_int_sta_common()
1588 if (iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA, 0) >= 12 && in iwl_mvm_add_int_sta_common()
1595 if (fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_add_int_sta_common()
1598 if (!iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_add_int_sta_common()
1605 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, in iwl_mvm_add_int_sta_common()
1606 iwl_mvm_add_sta_cmd_size(mvm), in iwl_mvm_add_int_sta_common()
1613 IWL_DEBUG_INFO(mvm, "Internal station added.\n"); in iwl_mvm_add_int_sta_common()
1617 IWL_ERR(mvm, "Add internal station failed, status=0x%x\n", in iwl_mvm_add_int_sta_common()
1624 int iwl_mvm_add_sta(struct iwl_mvm *mvm, in iwl_mvm_add_sta() argument
1635 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_sta()
1637 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_add_sta()
1638 sta_id = iwl_mvm_find_free_sta_id(mvm, in iwl_mvm_add_sta()
1649 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_add_sta()
1659 ret = iwl_mvm_add_int_sta_common(mvm, &tmp_sta, sta->addr, in iwl_mvm_add_sta()
1664 iwl_mvm_realloc_queues_after_restart(mvm, sta); in iwl_mvm_add_sta()
1666 sta_flags = iwl_mvm_has_new_tx_api(mvm) ? 0 : STA_MODIFY_QUEUES; in iwl_mvm_add_sta()
1674 if (!mvm->trans->trans_cfg->gen2) in iwl_mvm_add_sta()
1710 if (iwl_mvm_has_new_rx_api(mvm) && in iwl_mvm_add_sta()
1711 !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_add_sta()
1714 dup_data = kcalloc(mvm->trans->num_rx_queues, in iwl_mvm_add_sta()
1727 for (q = 0; q < mvm->trans->num_rx_queues; q++) in iwl_mvm_add_sta()
1733 if (!iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_add_sta()
1734 ret = iwl_mvm_reserve_sta_stream(mvm, sta, in iwl_mvm_add_sta()
1744 if (iwl_mvm_has_tlc_offload(mvm)) in iwl_mvm_add_sta()
1745 iwl_mvm_rs_add_sta(mvm, mvm_sta); in iwl_mvm_add_sta()
1749 iwl_mvm_toggle_tx_ant(mvm, &mvm_sta->tx_ant); in iwl_mvm_add_sta()
1752 ret = iwl_mvm_sta_send_to_fw(mvm, sta, sta_update, sta_flags); in iwl_mvm_add_sta()
1765 rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], sta); in iwl_mvm_add_sta()
1773 int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, in iwl_mvm_drain_sta() argument
1780 lockdep_assert_held(&mvm->mutex); in iwl_mvm_drain_sta()
1789 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, in iwl_mvm_drain_sta()
1790 iwl_mvm_add_sta_cmd_size(mvm), in iwl_mvm_drain_sta()
1797 IWL_DEBUG_INFO(mvm, "Frames for staid %d will drained in fw\n", in iwl_mvm_drain_sta()
1802 IWL_ERR(mvm, "Couldn't drain frames for staid %d\n", in iwl_mvm_drain_sta()
1815 static int iwl_mvm_rm_sta_common(struct iwl_mvm *mvm, u8 sta_id) in iwl_mvm_rm_sta_common() argument
1823 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_rm_sta_common()
1824 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rm_sta_common()
1828 IWL_ERR(mvm, "Invalid station id\n"); in iwl_mvm_rm_sta_common()
1832 ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, 0, in iwl_mvm_rm_sta_common()
1835 IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); in iwl_mvm_rm_sta_common()
1842 static void iwl_mvm_disable_sta_queues(struct iwl_mvm *mvm, in iwl_mvm_disable_sta_queues() argument
1849 lockdep_assert_held(&mvm->mutex); in iwl_mvm_disable_sta_queues()
1855 iwl_mvm_disable_txq(mvm, sta, &mvm_sta->tid_data[i].txq_id, i); in iwl_mvm_disable_sta_queues()
1868 int iwl_mvm_wait_sta_queues_empty(struct iwl_mvm *mvm, in iwl_mvm_wait_sta_queues_empty() argument
1884 ret = iwl_trans_wait_txq_empty(mvm->trans, txq_id); in iwl_mvm_wait_sta_queues_empty()
1892 int iwl_mvm_rm_sta(struct iwl_mvm *mvm, in iwl_mvm_rm_sta() argument
1901 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_sta()
1903 if (iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_rm_sta()
1906 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); in iwl_mvm_rm_sta()
1911 ret = iwl_mvm_flush_sta(mvm, mvm_sta, false); in iwl_mvm_rm_sta()
1914 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_rm_sta()
1915 ret = iwl_mvm_wait_sta_queues_empty(mvm, mvm_sta); in iwl_mvm_rm_sta()
1919 ret = iwl_trans_wait_tx_queues_empty(mvm->trans, in iwl_mvm_rm_sta()
1925 ret = iwl_mvm_drain_sta(mvm, mvm_sta, false); in iwl_mvm_rm_sta()
1927 iwl_mvm_disable_sta_queues(mvm, vif, sta); in iwl_mvm_rm_sta()
1939 status = &mvm->queue_info[reserved_txq].status; in iwl_mvm_rm_sta()
1963 if (WARN_ON_ONCE(mvm->tdls_cs.peer.sta_id == sta_id)) { in iwl_mvm_rm_sta()
1964 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_rm_sta()
1965 cancel_delayed_work(&mvm->tdls_cs.dwork); in iwl_mvm_rm_sta()
1975 ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); in iwl_mvm_rm_sta()
1976 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); in iwl_mvm_rm_sta()
1981 int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm, in iwl_mvm_rm_sta_id() argument
1985 int ret = iwl_mvm_rm_sta_common(mvm, sta_id); in iwl_mvm_rm_sta_id()
1987 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_sta_id()
1989 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); in iwl_mvm_rm_sta_id()
1993 int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm, in iwl_mvm_allocate_int_sta() argument
1998 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status) || in iwl_mvm_allocate_int_sta()
2000 sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype); in iwl_mvm_allocate_int_sta()
2009 rcu_assign_pointer(mvm->fw_id_to_mac_id[sta->sta_id], ERR_PTR(-EINVAL)); in iwl_mvm_allocate_int_sta()
2013 void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, struct iwl_mvm_int_sta *sta) in iwl_mvm_dealloc_int_sta() argument
2015 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta->sta_id], NULL); in iwl_mvm_dealloc_int_sta()
2020 static void iwl_mvm_enable_aux_snif_queue(struct iwl_mvm *mvm, u16 queue, in iwl_mvm_enable_aux_snif_queue() argument
2024 mvm->trans->trans_cfg->base_params->wd_timeout; in iwl_mvm_enable_aux_snif_queue()
2033 WARN_ON(iwl_mvm_has_new_tx_api(mvm)); in iwl_mvm_enable_aux_snif_queue()
2035 iwl_mvm_enable_txq(mvm, NULL, queue, 0, &cfg, wdg_timeout); in iwl_mvm_enable_aux_snif_queue()
2038 static int iwl_mvm_enable_aux_snif_queue_tvqm(struct iwl_mvm *mvm, u8 sta_id) in iwl_mvm_enable_aux_snif_queue_tvqm() argument
2041 mvm->trans->trans_cfg->base_params->wd_timeout; in iwl_mvm_enable_aux_snif_queue_tvqm()
2043 WARN_ON(!iwl_mvm_has_new_tx_api(mvm)); in iwl_mvm_enable_aux_snif_queue_tvqm()
2045 return iwl_mvm_tvqm_enable_txq(mvm, sta_id, IWL_MAX_TID_COUNT, in iwl_mvm_enable_aux_snif_queue_tvqm()
2049 static int iwl_mvm_add_int_sta_with_queue(struct iwl_mvm *mvm, int macidx, in iwl_mvm_add_int_sta_with_queue() argument
2057 if (!iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_add_int_sta_with_queue()
2058 iwl_mvm_enable_aux_snif_queue(mvm, *queue, sta->sta_id, fifo); in iwl_mvm_add_int_sta_with_queue()
2060 ret = iwl_mvm_add_int_sta_common(mvm, sta, addr, macidx, maccolor); in iwl_mvm_add_int_sta_with_queue()
2062 if (!iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_add_int_sta_with_queue()
2063 iwl_mvm_disable_txq(mvm, NULL, queue, in iwl_mvm_add_int_sta_with_queue()
2072 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_add_int_sta_with_queue()
2075 txq = iwl_mvm_enable_aux_snif_queue_tvqm(mvm, sta->sta_id); in iwl_mvm_add_int_sta_with_queue()
2077 iwl_mvm_rm_sta_common(mvm, sta->sta_id); in iwl_mvm_add_int_sta_with_queue()
2087 int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm, u32 lmac_id) in iwl_mvm_add_aux_sta() argument
2091 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_aux_sta()
2094 ret = iwl_mvm_allocate_int_sta(mvm, &mvm->aux_sta, BIT(mvm->aux_queue), in iwl_mvm_add_aux_sta()
2104 ret = iwl_mvm_add_int_sta_with_queue(mvm, lmac_id, 0, NULL, in iwl_mvm_add_aux_sta()
2105 &mvm->aux_sta, &mvm->aux_queue, in iwl_mvm_add_aux_sta()
2108 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); in iwl_mvm_add_aux_sta()
2115 int iwl_mvm_add_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_add_snif_sta() argument
2119 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_snif_sta()
2121 return iwl_mvm_add_int_sta_with_queue(mvm, mvmvif->id, mvmvif->color, in iwl_mvm_add_snif_sta()
2122 NULL, &mvm->snif_sta, in iwl_mvm_add_snif_sta()
2123 &mvm->snif_queue, in iwl_mvm_add_snif_sta()
2127 int iwl_mvm_rm_snif_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_rm_snif_sta() argument
2131 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_snif_sta()
2133 if (WARN_ON_ONCE(mvm->snif_sta.sta_id == IWL_MVM_INVALID_STA)) in iwl_mvm_rm_snif_sta()
2136 iwl_mvm_disable_txq(mvm, NULL, &mvm->snif_queue, IWL_MAX_TID_COUNT); in iwl_mvm_rm_snif_sta()
2137 ret = iwl_mvm_rm_sta_common(mvm, mvm->snif_sta.sta_id); in iwl_mvm_rm_snif_sta()
2139 IWL_WARN(mvm, "Failed sending remove station\n"); in iwl_mvm_rm_snif_sta()
2144 int iwl_mvm_rm_aux_sta(struct iwl_mvm *mvm) in iwl_mvm_rm_aux_sta() argument
2148 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_aux_sta()
2150 if (WARN_ON_ONCE(mvm->aux_sta.sta_id == IWL_MVM_INVALID_STA)) in iwl_mvm_rm_aux_sta()
2153 iwl_mvm_disable_txq(mvm, NULL, &mvm->aux_queue, IWL_MAX_TID_COUNT); in iwl_mvm_rm_aux_sta()
2154 ret = iwl_mvm_rm_sta_common(mvm, mvm->aux_sta.sta_id); in iwl_mvm_rm_aux_sta()
2156 IWL_WARN(mvm, "Failed sending remove station\n"); in iwl_mvm_rm_aux_sta()
2157 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); in iwl_mvm_rm_aux_sta()
2162 void iwl_mvm_dealloc_snif_sta(struct iwl_mvm *mvm) in iwl_mvm_dealloc_snif_sta() argument
2164 iwl_mvm_dealloc_int_sta(mvm, &mvm->snif_sta); in iwl_mvm_dealloc_snif_sta()
2175 int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_send_add_bcast_sta() argument
2184 iwl_mvm_get_wd_timeout(mvm, vif, false, false); in iwl_mvm_send_add_bcast_sta()
2193 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_add_bcast_sta()
2195 if (!iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_send_add_bcast_sta()
2198 queue = mvm->probe_queue; in iwl_mvm_send_add_bcast_sta()
2200 queue = mvm->p2p_dev_queue; in iwl_mvm_send_add_bcast_sta()
2208 iwl_mvm_enable_txq(mvm, NULL, queue, 0, &cfg, wdg_timeout); in iwl_mvm_send_add_bcast_sta()
2217 ret = iwl_mvm_add_int_sta_common(mvm, bsta, baddr, in iwl_mvm_send_add_bcast_sta()
2226 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_send_add_bcast_sta()
2227 queue = iwl_mvm_tvqm_enable_txq(mvm, bsta->sta_id, in iwl_mvm_send_add_bcast_sta()
2231 iwl_mvm_rm_sta_common(mvm, bsta->sta_id); in iwl_mvm_send_add_bcast_sta()
2237 mvm->probe_queue = queue; in iwl_mvm_send_add_bcast_sta()
2239 mvm->p2p_dev_queue = queue; in iwl_mvm_send_add_bcast_sta()
2245 static void iwl_mvm_free_bcast_sta_queues(struct iwl_mvm *mvm, in iwl_mvm_free_bcast_sta_queues() argument
2251 lockdep_assert_held(&mvm->mutex); in iwl_mvm_free_bcast_sta_queues()
2253 iwl_mvm_flush_sta(mvm, &mvmvif->bcast_sta, true); in iwl_mvm_free_bcast_sta_queues()
2258 queueptr = &mvm->probe_queue; in iwl_mvm_free_bcast_sta_queues()
2261 queueptr = &mvm->p2p_dev_queue; in iwl_mvm_free_bcast_sta_queues()
2270 iwl_mvm_disable_txq(mvm, NULL, queueptr, IWL_MAX_TID_COUNT); in iwl_mvm_free_bcast_sta_queues()
2271 if (iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_free_bcast_sta_queues()
2280 int iwl_mvm_send_rm_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_send_rm_bcast_sta() argument
2285 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_rm_bcast_sta()
2287 iwl_mvm_free_bcast_sta_queues(mvm, vif); in iwl_mvm_send_rm_bcast_sta()
2289 ret = iwl_mvm_rm_sta_common(mvm, mvmvif->bcast_sta.sta_id); in iwl_mvm_send_rm_bcast_sta()
2291 IWL_WARN(mvm, "Failed sending remove station\n"); in iwl_mvm_send_rm_bcast_sta()
2295 int iwl_mvm_alloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_alloc_bcast_sta() argument
2299 lockdep_assert_held(&mvm->mutex); in iwl_mvm_alloc_bcast_sta()
2301 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta, 0, in iwl_mvm_alloc_bcast_sta()
2313 int iwl_mvm_add_p2p_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_add_p2p_bcast_sta() argument
2319 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_p2p_bcast_sta()
2321 ret = iwl_mvm_alloc_bcast_sta(mvm, vif); in iwl_mvm_add_p2p_bcast_sta()
2325 ret = iwl_mvm_send_add_bcast_sta(mvm, vif); in iwl_mvm_add_p2p_bcast_sta()
2328 iwl_mvm_dealloc_int_sta(mvm, bsta); in iwl_mvm_add_p2p_bcast_sta()
2333 void iwl_mvm_dealloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_dealloc_bcast_sta() argument
2337 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta); in iwl_mvm_dealloc_bcast_sta()
2344 int iwl_mvm_rm_p2p_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_rm_p2p_bcast_sta() argument
2348 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_p2p_bcast_sta()
2350 ret = iwl_mvm_send_rm_bcast_sta(mvm, vif); in iwl_mvm_rm_p2p_bcast_sta()
2352 iwl_mvm_dealloc_bcast_sta(mvm, vif); in iwl_mvm_rm_p2p_bcast_sta()
2365 int iwl_mvm_add_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_add_mcast_sta() argument
2379 unsigned int timeout = iwl_mvm_get_wd_timeout(mvm, vif, false, false); in iwl_mvm_add_mcast_sta()
2382 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_mcast_sta()
2401 if (!iwl_mvm_has_new_tx_api(mvm) && in iwl_mvm_add_mcast_sta()
2402 fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) { in iwl_mvm_add_mcast_sta()
2403 iwl_mvm_enable_txq(mvm, NULL, mvmvif->cab_queue, 0, &cfg, in iwl_mvm_add_mcast_sta()
2407 ret = iwl_mvm_add_int_sta_common(mvm, msta, maddr, in iwl_mvm_add_mcast_sta()
2419 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_add_mcast_sta()
2420 int queue = iwl_mvm_tvqm_enable_txq(mvm, msta->sta_id, in iwl_mvm_add_mcast_sta()
2428 } else if (!fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_add_mcast_sta()
2430 iwl_mvm_enable_txq(mvm, NULL, mvmvif->cab_queue, 0, &cfg, in iwl_mvm_add_mcast_sta()
2435 iwl_mvm_dealloc_int_sta(mvm, msta); in iwl_mvm_add_mcast_sta()
2439 static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id, in __iwl_mvm_remove_sta_key() argument
2447 bool new_api = fw_has_api(&mvm->fw->ucode_capa, in __iwl_mvm_remove_sta_key()
2476 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, size, &u.cmd, in __iwl_mvm_remove_sta_key()
2481 IWL_DEBUG_WEP(mvm, "MODIFY_STA: remove sta key passed\n"); in __iwl_mvm_remove_sta_key()
2485 IWL_ERR(mvm, "MODIFY_STA: remove sta key failed\n"); in __iwl_mvm_remove_sta_key()
2496 int iwl_mvm_rm_mcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_rm_mcast_sta() argument
2501 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_mcast_sta()
2503 iwl_mvm_flush_sta(mvm, &mvmvif->mcast_sta, true); in iwl_mvm_rm_mcast_sta()
2505 iwl_mvm_disable_txq(mvm, NULL, &mvmvif->cab_queue, 0); in iwl_mvm_rm_mcast_sta()
2507 ret = iwl_mvm_rm_sta_common(mvm, mvmvif->mcast_sta.sta_id); in iwl_mvm_rm_mcast_sta()
2509 IWL_WARN(mvm, "Failed sending remove station\n"); in iwl_mvm_rm_mcast_sta()
2514 static void iwl_mvm_sync_rxq_del_ba(struct iwl_mvm *mvm, u8 baid) in iwl_mvm_sync_rxq_del_ba() argument
2520 iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_NOTIF_DEL_BA, true, in iwl_mvm_sync_rxq_del_ba()
2524 static void iwl_mvm_free_reorder(struct iwl_mvm *mvm, in iwl_mvm_free_reorder() argument
2529 iwl_mvm_sync_rxq_del_ba(mvm, data->baid); in iwl_mvm_free_reorder()
2531 for (i = 0; i < mvm->trans->num_rx_queues; i++) { in iwl_mvm_free_reorder()
2567 static void iwl_mvm_init_reorder_buffer(struct iwl_mvm *mvm, in iwl_mvm_init_reorder_buffer() argument
2573 for (i = 0; i < mvm->trans->num_rx_queues; i++) { in iwl_mvm_init_reorder_buffer()
2587 reorder_buf->mvm = mvm; in iwl_mvm_init_reorder_buffer()
2595 static int iwl_mvm_fw_baid_op_sta(struct iwl_mvm *mvm, in iwl_mvm_fw_baid_op_sta() argument
2619 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, in iwl_mvm_fw_baid_op_sta()
2620 iwl_mvm_add_sta_cmd_size(mvm), in iwl_mvm_fw_baid_op_sta()
2627 IWL_DEBUG_HT(mvm, "RX BA Session %sed in fw\n", in iwl_mvm_fw_baid_op_sta()
2629 if (WARN_ON(start && iwl_mvm_has_new_rx_api(mvm) && in iwl_mvm_fw_baid_op_sta()
2634 IWL_WARN(mvm, "RX BA Session refused by fw\n"); in iwl_mvm_fw_baid_op_sta()
2637 IWL_ERR(mvm, "RX BA Session failed %sing, status 0x%x\n", in iwl_mvm_fw_baid_op_sta()
2643 static int iwl_mvm_fw_baid_op_cmd(struct iwl_mvm *mvm, in iwl_mvm_fw_baid_op_cmd() argument
2663 } else if (iwl_fw_lookup_cmd_ver(mvm->fw, cmd_id, 1) == 1) { in iwl_mvm_fw_baid_op_cmd()
2671 ret = iwl_mvm_send_cmd_pdu_status(mvm, cmd_id, sizeof(cmd), in iwl_mvm_fw_baid_op_cmd()
2681 IWL_DEBUG_HT(mvm, "RX BA Session %sed in fw\n", in iwl_mvm_fw_baid_op_cmd()
2684 if (baid < 0 || baid >= ARRAY_SIZE(mvm->baid_map)) in iwl_mvm_fw_baid_op_cmd()
2690 static int iwl_mvm_fw_baid_op(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvm_sta, in iwl_mvm_fw_baid_op() argument
2694 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_fw_baid_op()
2696 return iwl_mvm_fw_baid_op_cmd(mvm, mvm_sta, start, in iwl_mvm_fw_baid_op()
2699 return iwl_mvm_fw_baid_op_sta(mvm, mvm_sta, start, in iwl_mvm_fw_baid_op()
2703 int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_sta_rx_agg() argument
2709 u32 max_ba_id_sessions = iwl_mvm_has_new_tx_api(mvm) ? IWL_MAX_BAID : in iwl_mvm_sta_rx_agg()
2712 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_rx_agg()
2714 if (start && mvm->rx_ba_sessions >= max_ba_id_sessions) { in iwl_mvm_sta_rx_agg()
2715 IWL_WARN(mvm, "Not enough RX BA SESSIONS\n"); in iwl_mvm_sta_rx_agg()
2719 if (iwl_mvm_has_new_rx_api(mvm) && start) { in iwl_mvm_sta_rx_agg()
2746 mvm->trans->num_rx_queues * in iwl_mvm_sta_rx_agg()
2760 if (iwl_mvm_has_new_rx_api(mvm) && !start) { in iwl_mvm_sta_rx_agg()
2768 if (start || !test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_sta_rx_agg()
2769 baid = iwl_mvm_fw_baid_op(mvm, mvm_sta, start, tid, ssn, buf_size, in iwl_mvm_sta_rx_agg()
2778 mvm->rx_ba_sessions++; in iwl_mvm_sta_rx_agg()
2780 if (!iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_sta_rx_agg()
2786 baid_data->rcu_ptr = &mvm->baid_map[baid]; in iwl_mvm_sta_rx_agg()
2789 baid_data->mvm = mvm; in iwl_mvm_sta_rx_agg()
2798 iwl_mvm_init_reorder_buffer(mvm, baid_data, ssn, buf_size); in iwl_mvm_sta_rx_agg()
2805 IWL_DEBUG_HT(mvm, "Sta %d(%d) is assigned to BAID %d\n", in iwl_mvm_sta_rx_agg()
2807 WARN_ON(rcu_access_pointer(mvm->baid_map[baid])); in iwl_mvm_sta_rx_agg()
2808 rcu_assign_pointer(mvm->baid_map[baid], baid_data); in iwl_mvm_sta_rx_agg()
2812 if (mvm->rx_ba_sessions > 0) in iwl_mvm_sta_rx_agg()
2814 mvm->rx_ba_sessions--; in iwl_mvm_sta_rx_agg()
2815 if (!iwl_mvm_has_new_rx_api(mvm)) in iwl_mvm_sta_rx_agg()
2821 baid_data = rcu_access_pointer(mvm->baid_map[baid]); in iwl_mvm_sta_rx_agg()
2826 iwl_mvm_free_reorder(mvm, baid_data); in iwl_mvm_sta_rx_agg()
2828 RCU_INIT_POINTER(mvm->baid_map[baid], NULL); in iwl_mvm_sta_rx_agg()
2830 IWL_DEBUG_HT(mvm, "BAID %d is free\n", baid); in iwl_mvm_sta_rx_agg()
2839 iwl_mvm_sync_rx_queues_internal(mvm, IWL_MVM_RXQ_EMPTY, in iwl_mvm_sta_rx_agg()
2849 int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_sta_tx_agg() argument
2857 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_tx_agg()
2870 if (!iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_sta_tx_agg()
2877 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, in iwl_mvm_sta_tx_agg()
2878 iwl_mvm_add_sta_cmd_size(mvm), in iwl_mvm_sta_tx_agg()
2888 IWL_ERR(mvm, "TX BA Session failed %sing, status 0x%x\n", in iwl_mvm_sta_tx_agg()
2919 int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_start() argument
2933 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_start()
2939 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_tx_agg_start()
2942 iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_sta_tx_agg_start()
2945 ret = iwl_mvm_sta_alloc_queue_tvqm(mvm, sta, ac, tid); in iwl_mvm_sta_tx_agg_start()
2960 ret = iwl_mvm_find_free_queue(mvm, mvmsta->sta_id, in iwl_mvm_sta_tx_agg_start()
2964 IWL_ERR(mvm, "Failed to allocate agg queue\n"); in iwl_mvm_sta_tx_agg_start()
2971 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_RESERVED; in iwl_mvm_sta_tx_agg_start()
2974 IWL_ERR(mvm, "tid_id %d out of range (0, %d)!\n", in iwl_mvm_sta_tx_agg_start()
2978 } else if (unlikely(mvm->queue_info[txq_id].status == in iwl_mvm_sta_tx_agg_start()
2981 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_tx_agg_start()
2987 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_tx_agg_start()
2996 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_tx_agg_start()
3006 if (mvm->trans->trans_cfg->gen2) in iwl_mvm_sta_tx_agg_start()
3023 int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_oper() argument
3030 iwl_mvm_get_wd_timeout(mvm, vif, sta->tdls, false); in iwl_mvm_sta_tx_agg_oper()
3047 if (WARN_ON_ONCE(iwl_mvm_has_tlc_offload(mvm))) in iwl_mvm_sta_tx_agg_oper()
3062 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_sta_tx_agg_oper()
3077 ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); in iwl_mvm_sta_tx_agg_oper()
3085 queue_status = mvm->queue_info[queue].status; in iwl_mvm_sta_tx_agg_oper()
3088 if (mvm->queue_info[queue].status == IWL_MVM_QUEUE_READY) in iwl_mvm_sta_tx_agg_oper()
3100 ret = iwl_trans_wait_tx_queues_empty(mvm->trans, in iwl_mvm_sta_tx_agg_oper()
3103 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_oper()
3108 ret = iwl_mvm_reconfig_scd(mvm, queue, cfg.fifo, in iwl_mvm_sta_tx_agg_oper()
3112 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_oper()
3119 iwl_mvm_enable_txq(mvm, sta, queue, ssn, in iwl_mvm_sta_tx_agg_oper()
3124 ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); in iwl_mvm_sta_tx_agg_oper()
3130 mvm->queue_info[queue].status = IWL_MVM_QUEUE_READY; in iwl_mvm_sta_tx_agg_oper()
3144 IWL_DEBUG_HT(mvm, "Tx aggregation enabled on ra = %pM tid = %d\n", in iwl_mvm_sta_tx_agg_oper()
3147 return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.rs_drv.lq); in iwl_mvm_sta_tx_agg_oper()
3150 static void iwl_mvm_unreserve_agg_queue(struct iwl_mvm *mvm, in iwl_mvm_unreserve_agg_queue() argument
3156 lockdep_assert_held(&mvm->mutex); in iwl_mvm_unreserve_agg_queue()
3158 if (iwl_mvm_has_new_tx_api(mvm)) in iwl_mvm_unreserve_agg_queue()
3168 if (mvm->queue_info[txq_id].status == IWL_MVM_QUEUE_RESERVED) { in iwl_mvm_unreserve_agg_queue()
3169 mvm->queue_info[txq_id].status = IWL_MVM_QUEUE_FREE; in iwl_mvm_unreserve_agg_queue()
3174 int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_stop() argument
3186 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_sta_tx_agg_stop()
3195 IWL_DEBUG_TX_QUEUES(mvm, "Stop AGG: sta %d tid %d q %d state %d\n", in iwl_mvm_sta_tx_agg_stop()
3200 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, tid_data); in iwl_mvm_sta_tx_agg_stop()
3206 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_tx_agg_stop()
3216 iwl_mvm_sta_tx_agg(mvm, sta, tid, txq_id, false); in iwl_mvm_sta_tx_agg_stop()
3226 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_tx_agg_stop()
3233 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_stop()
3236 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_stop()
3246 int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_flush() argument
3260 IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", in iwl_mvm_sta_tx_agg_flush()
3267 iwl_mvm_unreserve_agg_queue(mvm, mvmsta, tid_data); in iwl_mvm_sta_tx_agg_flush()
3270 iwl_mvm_drain_sta(mvm, mvmsta, true); in iwl_mvm_sta_tx_agg_flush()
3272 if (iwl_mvm_has_new_tx_api(mvm)) { in iwl_mvm_sta_tx_agg_flush()
3273 if (iwl_mvm_flush_sta_tids(mvm, mvmsta->sta_id, in iwl_mvm_sta_tx_agg_flush()
3275 IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); in iwl_mvm_sta_tx_agg_flush()
3276 iwl_trans_wait_txq_empty(mvm->trans, txq_id); in iwl_mvm_sta_tx_agg_flush()
3278 if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id))) in iwl_mvm_sta_tx_agg_flush()
3279 IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); in iwl_mvm_sta_tx_agg_flush()
3280 iwl_trans_wait_tx_queues_empty(mvm->trans, BIT(txq_id)); in iwl_mvm_sta_tx_agg_flush()
3283 iwl_mvm_drain_sta(mvm, mvmsta, false); in iwl_mvm_sta_tx_agg_flush()
3285 iwl_mvm_sta_tx_agg(mvm, sta, tid, txq_id, false); in iwl_mvm_sta_tx_agg_flush()
3291 static int iwl_mvm_set_fw_key_idx(struct iwl_mvm *mvm) in iwl_mvm_set_fw_key_idx() argument
3295 lockdep_assert_held(&mvm->mutex); in iwl_mvm_set_fw_key_idx()
3304 if (test_bit(i, mvm->fw_key_table)) in iwl_mvm_set_fw_key_idx()
3306 if (mvm->fw_key_deleted[i] > max) { in iwl_mvm_set_fw_key_idx()
3307 max = mvm->fw_key_deleted[i]; in iwl_mvm_set_fw_key_idx()
3318 static struct iwl_mvm_sta *iwl_mvm_get_key_sta(struct iwl_mvm *mvm, in iwl_mvm_get_key_sta() argument
3336 sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_get_key_sta()
3337 lockdep_is_held(&mvm->mutex)); in iwl_mvm_get_key_sta()
3367 static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, in iwl_mvm_send_sta_key() argument
3383 bool new_api = fw_has_api(&mvm->fw->ucode_capa, in iwl_mvm_send_sta_key()
3385 int api_ver = iwl_fw_lookup_cmd_ver(mvm->fw, ADD_STA_KEY, in iwl_mvm_send_sta_key()
3501 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, CMD_ASYNC, size, in iwl_mvm_send_sta_key()
3504 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, size, in iwl_mvm_send_sta_key()
3509 IWL_DEBUG_WEP(mvm, "MODIFY_STA: set dynamic key passed\n"); in iwl_mvm_send_sta_key()
3513 IWL_ERR(mvm, "MODIFY_STA: set dynamic key failed\n"); in iwl_mvm_send_sta_key()
3520 static int iwl_mvm_send_sta_igtk(struct iwl_mvm *mvm, in iwl_mvm_send_sta_igtk() argument
3535 if (WARN_ON(!iwl_mvm_has_new_rx_api(mvm) && in iwl_mvm_send_sta_igtk()
3578 IWL_DEBUG_INFO(mvm, "%s %sIGTK (%d) for sta %u\n", in iwl_mvm_send_sta_igtk()
3583 if (!iwl_mvm_has_new_rx_api(mvm)) { in iwl_mvm_send_sta_igtk()
3593 return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, 0, in iwl_mvm_send_sta_igtk()
3596 return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, 0, in iwl_mvm_send_sta_igtk()
3601 static inline u8 *iwl_mvm_get_mac_addr(struct iwl_mvm *mvm, in iwl_mvm_get_mac_addr() argument
3613 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_get_mac_addr()
3614 lockdep_is_held(&mvm->mutex)); in iwl_mvm_get_mac_addr()
3622 static int __iwl_mvm_set_sta_key(struct iwl_mvm *mvm, in __iwl_mvm_set_sta_key() argument
3646 IWL_ERR(mvm, "Failed to find station id\n"); in __iwl_mvm_set_sta_key()
3651 addr = iwl_mvm_get_mac_addr(mvm, vif, sta); in __iwl_mvm_set_sta_key()
3656 return iwl_mvm_send_sta_key(mvm, sta_id, keyconf, mcast, in __iwl_mvm_set_sta_key()
3661 return iwl_mvm_send_sta_key(mvm, sta_id, keyconf, mcast, in __iwl_mvm_set_sta_key()
3665 int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, in iwl_mvm_set_sta_key() argument
3677 lockdep_assert_held(&mvm->mutex); in iwl_mvm_set_sta_key()
3682 mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta); in iwl_mvm_set_sta_key()
3684 IWL_ERR(mvm, "Failed to find station\n"); in iwl_mvm_set_sta_key()
3696 mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_set_sta_key()
3697 lockdep_is_held(&mvm->mutex)); in iwl_mvm_set_sta_key()
3699 IWL_ERR(mvm, "Invalid station id\n"); in iwl_mvm_set_sta_key()
3715 ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, false); in iwl_mvm_set_sta_key()
3731 key_offset = iwl_mvm_set_fw_key_idx(mvm); in iwl_mvm_set_sta_key()
3737 ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, key_offset, mcast); in iwl_mvm_set_sta_key()
3750 ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, in iwl_mvm_set_sta_key()
3753 __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast); in iwl_mvm_set_sta_key()
3758 __set_bit(key_offset, mvm->fw_key_table); in iwl_mvm_set_sta_key()
3761 IWL_DEBUG_WEP(mvm, "key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", in iwl_mvm_set_sta_key()
3767 int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, in iwl_mvm_remove_sta_key() argument
3777 lockdep_assert_held(&mvm->mutex); in iwl_mvm_remove_sta_key()
3780 mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta); in iwl_mvm_remove_sta_key()
3787 IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n", in iwl_mvm_remove_sta_key()
3793 return iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, true); in iwl_mvm_remove_sta_key()
3795 if (!__test_and_clear_bit(keyconf->hw_key_idx, mvm->fw_key_table)) { in iwl_mvm_remove_sta_key()
3796 IWL_ERR(mvm, "offset %d not used in fw key table.\n", in iwl_mvm_remove_sta_key()
3803 if (mvm->fw_key_deleted[i] < U8_MAX) in iwl_mvm_remove_sta_key()
3804 mvm->fw_key_deleted[i]++; in iwl_mvm_remove_sta_key()
3806 mvm->fw_key_deleted[keyconf->hw_key_idx] = 0; in iwl_mvm_remove_sta_key()
3809 IWL_DEBUG_WEP(mvm, "station non-existent, early return.\n"); in iwl_mvm_remove_sta_key()
3813 ret = __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast); in iwl_mvm_remove_sta_key()
3820 ret = __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, !mcast); in iwl_mvm_remove_sta_key()
3825 void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, in iwl_mvm_update_tkip_key() argument
3837 mvm_sta = iwl_mvm_get_key_sta(mvm, vif, sta); in iwl_mvm_update_tkip_key()
3840 iwl_mvm_send_sta_key(mvm, mvm_sta->sta_id, keyconf, mcast, in iwl_mvm_update_tkip_key()
3848 void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_ps_wake() argument
3860 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, in iwl_mvm_sta_modify_ps_wake()
3861 iwl_mvm_add_sta_cmd_size(mvm), &cmd); in iwl_mvm_sta_modify_ps_wake()
3863 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_sta_modify_ps_wake()
3866 void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_sleep_tx_count() argument
3908 n_queued = iwl_mvm_tid_queued(mvm, tid_data); in iwl_mvm_sta_modify_sleep_tx_count()
3940 iwl_trans_block_txq_ptrs(mvm->trans, true); in iwl_mvm_sta_modify_sleep_tx_count()
3942 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, in iwl_mvm_sta_modify_sleep_tx_count()
3944 iwl_mvm_add_sta_cmd_size(mvm), &cmd); in iwl_mvm_sta_modify_sleep_tx_count()
3946 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_sta_modify_sleep_tx_count()
3949 void iwl_mvm_rx_eosp_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_eosp_notif() argument
3957 if (WARN_ON_ONCE(sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_rx_eosp_notif()
3961 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_rx_eosp_notif()
3967 void iwl_mvm_sta_modify_disable_tx(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_disable_tx() argument
3979 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, in iwl_mvm_sta_modify_disable_tx()
3980 iwl_mvm_add_sta_cmd_size(mvm), &cmd); in iwl_mvm_sta_modify_disable_tx()
3982 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_sta_modify_disable_tx()
3985 void iwl_mvm_sta_modify_disable_tx_ap(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_disable_tx_ap() argument
4004 if (!ieee80211_hw_check(mvm->hw, AP_LINK_PS)) in iwl_mvm_sta_modify_disable_tx_ap()
4005 ieee80211_sta_block_awake(mvm->hw, sta, disable); in iwl_mvm_sta_modify_disable_tx_ap()
4007 iwl_mvm_sta_modify_disable_tx(mvm, mvm_sta, disable); in iwl_mvm_sta_modify_disable_tx_ap()
4012 static void iwl_mvm_int_sta_modify_disable_tx(struct iwl_mvm *mvm, in iwl_mvm_int_sta_modify_disable_tx() argument
4027 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, in iwl_mvm_int_sta_modify_disable_tx()
4028 iwl_mvm_add_sta_cmd_size(mvm), &cmd); in iwl_mvm_int_sta_modify_disable_tx()
4030 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_int_sta_modify_disable_tx()
4033 void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm, in iwl_mvm_modify_all_sta_disable_tx() argument
4044 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_modify_all_sta_disable_tx()
4045 sta = rcu_dereference(mvm->fw_id_to_mac_id[i]); in iwl_mvm_modify_all_sta_disable_tx()
4054 iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, disable); in iwl_mvm_modify_all_sta_disable_tx()
4059 if (!fw_has_api(&mvm->fw->ucode_capa, IWL_UCODE_TLV_API_STA_TYPE)) in iwl_mvm_modify_all_sta_disable_tx()
4064 iwl_mvm_int_sta_modify_disable_tx(mvm, mvmvif, in iwl_mvm_modify_all_sta_disable_tx()
4072 iwl_mvm_int_sta_modify_disable_tx(mvm, mvmvif, in iwl_mvm_modify_all_sta_disable_tx()
4076 void iwl_mvm_csa_client_absent(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_csa_client_absent() argument
4083 mvmsta = iwl_mvm_sta_from_staid_rcu(mvm, mvmvif->ap_sta_id); in iwl_mvm_csa_client_absent()
4086 iwl_mvm_sta_modify_disable_tx(mvm, mvmsta, true); in iwl_mvm_csa_client_absent()
4091 u16 iwl_mvm_tid_queued(struct iwl_mvm *mvm, struct iwl_mvm_tid_data *tid_data) in iwl_mvm_tid_queued() argument
4099 if (mvm->trans->trans_cfg->gen2) in iwl_mvm_tid_queued()
4105 int iwl_mvm_add_pasn_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_add_pasn_sta() argument
4114 ret = iwl_mvm_allocate_int_sta(mvm, sta, 0, in iwl_mvm_add_pasn_sta()
4120 ret = iwl_mvm_add_int_sta_with_queue(mvm, mvmvif->id, mvmvif->color, in iwl_mvm_add_pasn_sta()
4136 ret = iwl_mvm_send_sta_key(mvm, sta->sta_id, keyconf, false, in iwl_mvm_add_pasn_sta()
4141 iwl_mvm_dealloc_int_sta(mvm, sta); in iwl_mvm_add_pasn_sta()
4145 void iwl_mvm_cancel_channel_switch(struct iwl_mvm *mvm, in iwl_mvm_cancel_channel_switch() argument
4154 ret = iwl_mvm_send_cmd_pdu(mvm, in iwl_mvm_cancel_channel_switch()
4160 IWL_ERR(mvm, "Failed to cancel the channel switch\n"); in iwl_mvm_cancel_channel_switch()