Lines Matching refs:mvm

71 static int iwl_mvm_find_free_sta_id(struct iwl_mvm *mvm,  in iwl_mvm_find_free_sta_id()  argument
78 WARN_ON_ONCE(test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)); in iwl_mvm_find_free_sta_id()
80 lockdep_assert_held(&mvm->mutex); in iwl_mvm_find_free_sta_id()
91 if (!rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_find_free_sta_id()
92 lockdep_is_held(&mvm->mutex))) in iwl_mvm_find_free_sta_id()
99 int iwl_mvm_sta_send_to_fw(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_sta_send_to_fw() argument
189 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(add_sta_cmd), in iwl_mvm_sta_send_to_fw()
196 IWL_DEBUG_ASSOC(mvm, "ADD_STA PASSED\n"); in iwl_mvm_sta_send_to_fw()
200 IWL_ERR(mvm, "ADD_STA failed\n"); in iwl_mvm_sta_send_to_fw()
207 static int iwl_mvm_tdls_sta_init(struct iwl_mvm *mvm, in iwl_mvm_tdls_sta_init() argument
213 iwl_mvm_get_wd_timeout(mvm, NULL, true, false); in iwl_mvm_tdls_sta_init()
216 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_sta_init()
218 used_hw_queues = iwl_mvm_get_used_hw_queues(mvm, NULL); in iwl_mvm_tdls_sta_init()
223 mvm->first_agg_queue); in iwl_mvm_tdls_sta_init()
225 if (queue >= mvm->first_agg_queue) { in iwl_mvm_tdls_sta_init()
226 IWL_ERR(mvm, "Failed to allocate STA queue\n"); in iwl_mvm_tdls_sta_init()
236 iwl_mvm_enable_ac_txq(mvm, mvmsta->hw_queue[ac], in iwl_mvm_tdls_sta_init()
246 static void iwl_mvm_tdls_sta_deinit(struct iwl_mvm *mvm, in iwl_mvm_tdls_sta_deinit() argument
253 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_sta_deinit()
258 iwl_mvm_disable_txq(mvm, i, i, IWL_MAX_TID_COUNT, 0); in iwl_mvm_tdls_sta_deinit()
261 int iwl_mvm_add_sta(struct iwl_mvm *mvm, in iwl_mvm_add_sta() argument
269 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_sta()
271 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) in iwl_mvm_add_sta()
272 sta_id = iwl_mvm_find_free_sta_id(mvm, in iwl_mvm_add_sta()
282 iwl_mvm_mac_ctxt_changed(mvm, vif, false, NULL); in iwl_mvm_add_sta()
296 atomic_set(&mvm->pending_frames[sta_id], 0); in iwl_mvm_add_sta()
302 ret = iwl_mvm_tdls_sta_init(mvm, sta); in iwl_mvm_add_sta()
319 ret = iwl_mvm_sta_send_to_fw(mvm, sta, false); in iwl_mvm_add_sta()
332 rcu_assign_pointer(mvm->fw_id_to_mac_id[sta_id], sta); in iwl_mvm_add_sta()
337 iwl_mvm_tdls_sta_deinit(mvm, sta); in iwl_mvm_add_sta()
341 int iwl_mvm_update_sta(struct iwl_mvm *mvm, in iwl_mvm_update_sta() argument
345 return iwl_mvm_sta_send_to_fw(mvm, sta, true); in iwl_mvm_update_sta()
348 int iwl_mvm_drain_sta(struct iwl_mvm *mvm, struct iwl_mvm_sta *mvmsta, in iwl_mvm_drain_sta() argument
355 lockdep_assert_held(&mvm->mutex); in iwl_mvm_drain_sta()
364 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), in iwl_mvm_drain_sta()
371 IWL_DEBUG_INFO(mvm, "Frames for staid %d will drained in fw\n", in iwl_mvm_drain_sta()
376 IWL_ERR(mvm, "Couldn't drain frames for staid %d\n", in iwl_mvm_drain_sta()
389 static int iwl_mvm_rm_sta_common(struct iwl_mvm *mvm, u8 sta_id) in iwl_mvm_rm_sta_common() argument
397 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_rm_sta_common()
398 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rm_sta_common()
402 IWL_ERR(mvm, "Invalid station id\n"); in iwl_mvm_rm_sta_common()
406 ret = iwl_mvm_send_cmd_pdu(mvm, REMOVE_STA, 0, in iwl_mvm_rm_sta_common()
409 IWL_ERR(mvm, "Failed to remove station. Id=%d\n", sta_id); in iwl_mvm_rm_sta_common()
418 struct iwl_mvm *mvm = container_of(wk, struct iwl_mvm, sta_drained_wk); in iwl_mvm_sta_drained_wk() local
428 mutex_lock(&mvm->mutex); in iwl_mvm_sta_drained_wk()
430 for_each_set_bit(sta_id, mvm->sta_drained, IWL_MVM_STATION_COUNT) { in iwl_mvm_sta_drained_wk()
433 rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_sta_drained_wk()
434 lockdep_is_held(&mvm->mutex)); in iwl_mvm_sta_drained_wk()
448 IWL_ERR(mvm, "Drained sta %d, but it is internal?\n", in iwl_mvm_sta_drained_wk()
454 IWL_ERR(mvm, "Drained sta %d, but it was NULL?\n", in iwl_mvm_sta_drained_wk()
463 ret = iwl_mvm_rm_sta_common(mvm, sta_id); in iwl_mvm_sta_drained_wk()
465 IWL_ERR(mvm, in iwl_mvm_sta_drained_wk()
470 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); in iwl_mvm_sta_drained_wk()
471 clear_bit(sta_id, mvm->sta_drained); in iwl_mvm_sta_drained_wk()
473 if (mvm->tfd_drained[sta_id]) { in iwl_mvm_sta_drained_wk()
474 unsigned long i, msk = mvm->tfd_drained[sta_id]; in iwl_mvm_sta_drained_wk()
477 iwl_mvm_disable_txq(mvm, i, i, in iwl_mvm_sta_drained_wk()
480 mvm->tfd_drained[sta_id] = 0; in iwl_mvm_sta_drained_wk()
481 IWL_DEBUG_TDLS(mvm, "Drained sta %d, with queues %ld\n", in iwl_mvm_sta_drained_wk()
486 mutex_unlock(&mvm->mutex); in iwl_mvm_sta_drained_wk()
489 int iwl_mvm_rm_sta(struct iwl_mvm *mvm, in iwl_mvm_rm_sta() argument
497 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_sta()
501 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); in iwl_mvm_rm_sta()
505 ret = iwl_mvm_flush_tx_path(mvm, mvm_sta->tfd_queue_msk, 0); in iwl_mvm_rm_sta()
508 ret = iwl_trans_wait_tx_queue_empty(mvm->trans, in iwl_mvm_rm_sta()
512 ret = iwl_mvm_drain_sta(mvm, mvm_sta, false); in iwl_mvm_rm_sta()
522 if (mvm->d0i3_ap_sta_id == mvm_sta->sta_id) in iwl_mvm_rm_sta()
523 mvm->d0i3_ap_sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_rm_sta()
530 if (WARN_ON_ONCE(mvm->tdls_cs.peer.sta_id == mvm_sta->sta_id)) { in iwl_mvm_rm_sta()
531 mvm->tdls_cs.peer.sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_rm_sta()
532 cancel_delayed_work(&mvm->tdls_cs.dwork); in iwl_mvm_rm_sta()
544 if (atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) { in iwl_mvm_rm_sta()
545 rcu_assign_pointer(mvm->fw_id_to_mac_id[mvm_sta->sta_id], in iwl_mvm_rm_sta()
551 mvm->tfd_drained[mvm_sta->sta_id] = in iwl_mvm_rm_sta()
553 IWL_DEBUG_TDLS(mvm, "Draining TDLS sta %d\n", in iwl_mvm_rm_sta()
557 ret = iwl_mvm_drain_sta(mvm, mvm_sta, true); in iwl_mvm_rm_sta()
562 iwl_mvm_tdls_sta_deinit(mvm, sta); in iwl_mvm_rm_sta()
564 ret = iwl_mvm_rm_sta_common(mvm, mvm_sta->sta_id); in iwl_mvm_rm_sta()
565 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[mvm_sta->sta_id], NULL); in iwl_mvm_rm_sta()
571 int iwl_mvm_rm_sta_id(struct iwl_mvm *mvm, in iwl_mvm_rm_sta_id() argument
575 int ret = iwl_mvm_rm_sta_common(mvm, sta_id); in iwl_mvm_rm_sta_id()
577 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_sta_id()
579 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta_id], NULL); in iwl_mvm_rm_sta_id()
583 static int iwl_mvm_allocate_int_sta(struct iwl_mvm *mvm, in iwl_mvm_allocate_int_sta() argument
587 if (!test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_allocate_int_sta()
588 sta->sta_id = iwl_mvm_find_free_sta_id(mvm, iftype); in iwl_mvm_allocate_int_sta()
596 rcu_assign_pointer(mvm->fw_id_to_mac_id[sta->sta_id], ERR_PTR(-EINVAL)); in iwl_mvm_allocate_int_sta()
600 static void iwl_mvm_dealloc_int_sta(struct iwl_mvm *mvm, in iwl_mvm_dealloc_int_sta() argument
603 RCU_INIT_POINTER(mvm->fw_id_to_mac_id[sta->sta_id], NULL); in iwl_mvm_dealloc_int_sta()
608 static int iwl_mvm_add_int_sta_common(struct iwl_mvm *mvm, in iwl_mvm_add_int_sta_common() argument
617 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_int_sta_common()
629 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), in iwl_mvm_add_int_sta_common()
636 IWL_DEBUG_INFO(mvm, "Internal station added.\n"); in iwl_mvm_add_int_sta_common()
640 IWL_ERR(mvm, "Add internal station failed, status=0x%x\n", in iwl_mvm_add_int_sta_common()
647 int iwl_mvm_add_aux_sta(struct iwl_mvm *mvm) in iwl_mvm_add_aux_sta() argument
650 mvm->cfg->base_params->wd_timeout : in iwl_mvm_add_aux_sta()
654 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_aux_sta()
657 iwl_mvm_enable_ac_txq(mvm, mvm->aux_queue, mvm->aux_queue, in iwl_mvm_add_aux_sta()
661 ret = iwl_mvm_allocate_int_sta(mvm, &mvm->aux_sta, BIT(mvm->aux_queue), in iwl_mvm_add_aux_sta()
666 ret = iwl_mvm_add_int_sta_common(mvm, &mvm->aux_sta, NULL, in iwl_mvm_add_aux_sta()
670 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); in iwl_mvm_add_aux_sta()
674 void iwl_mvm_del_aux_sta(struct iwl_mvm *mvm) in iwl_mvm_del_aux_sta() argument
676 lockdep_assert_held(&mvm->mutex); in iwl_mvm_del_aux_sta()
678 iwl_mvm_dealloc_int_sta(mvm, &mvm->aux_sta); in iwl_mvm_del_aux_sta()
689 int iwl_mvm_send_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_send_add_bcast_sta() argument
696 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_add_bcast_sta()
704 return iwl_mvm_add_int_sta_common(mvm, bsta, baddr, in iwl_mvm_send_add_bcast_sta()
710 int iwl_mvm_send_rm_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_send_rm_bcast_sta() argument
715 lockdep_assert_held(&mvm->mutex); in iwl_mvm_send_rm_bcast_sta()
717 ret = iwl_mvm_rm_sta_common(mvm, mvmvif->bcast_sta.sta_id); in iwl_mvm_send_rm_bcast_sta()
719 IWL_WARN(mvm, "Failed sending remove station\n"); in iwl_mvm_send_rm_bcast_sta()
723 int iwl_mvm_alloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_alloc_bcast_sta() argument
728 lockdep_assert_held(&mvm->mutex); in iwl_mvm_alloc_bcast_sta()
740 return iwl_mvm_allocate_int_sta(mvm, &mvmvif->bcast_sta, qmask, in iwl_mvm_alloc_bcast_sta()
751 int iwl_mvm_add_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_add_bcast_sta() argument
757 lockdep_assert_held(&mvm->mutex); in iwl_mvm_add_bcast_sta()
759 ret = iwl_mvm_alloc_bcast_sta(mvm, vif); in iwl_mvm_add_bcast_sta()
763 ret = iwl_mvm_send_add_bcast_sta(mvm, vif); in iwl_mvm_add_bcast_sta()
766 iwl_mvm_dealloc_int_sta(mvm, bsta); in iwl_mvm_add_bcast_sta()
771 void iwl_mvm_dealloc_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_dealloc_bcast_sta() argument
775 iwl_mvm_dealloc_int_sta(mvm, &mvmvif->bcast_sta); in iwl_mvm_dealloc_bcast_sta()
782 int iwl_mvm_rm_bcast_sta(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_rm_bcast_sta() argument
786 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rm_bcast_sta()
788 ret = iwl_mvm_send_rm_bcast_sta(mvm, vif); in iwl_mvm_rm_bcast_sta()
790 iwl_mvm_dealloc_bcast_sta(mvm, vif); in iwl_mvm_rm_bcast_sta()
797 int iwl_mvm_sta_rx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_sta_rx_agg() argument
805 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_rx_agg()
807 if (start && mvm->rx_ba_sessions >= IWL_MAX_RX_BA_SESSIONS) { in iwl_mvm_sta_rx_agg()
808 IWL_WARN(mvm, "Not enough RX BA SESSIONS\n"); in iwl_mvm_sta_rx_agg()
825 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), in iwl_mvm_sta_rx_agg()
832 IWL_DEBUG_INFO(mvm, "RX BA Session %sed in fw\n", in iwl_mvm_sta_rx_agg()
836 IWL_WARN(mvm, "RX BA Session refused by fw\n"); in iwl_mvm_sta_rx_agg()
841 IWL_ERR(mvm, "RX BA Session failed %sing, status 0x%x\n", in iwl_mvm_sta_rx_agg()
848 mvm->rx_ba_sessions++; in iwl_mvm_sta_rx_agg()
849 else if (mvm->rx_ba_sessions > 0) in iwl_mvm_sta_rx_agg()
851 mvm->rx_ba_sessions--; in iwl_mvm_sta_rx_agg()
857 static int iwl_mvm_sta_tx_agg(struct iwl_mvm *mvm, struct ieee80211_sta *sta, in iwl_mvm_sta_tx_agg() argument
865 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_tx_agg()
883 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA, sizeof(cmd), in iwl_mvm_sta_tx_agg()
893 IWL_ERR(mvm, "TX BA Session failed %sing, status 0x%x\n", in iwl_mvm_sta_tx_agg()
923 int iwl_mvm_sta_tx_agg_start(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_start() argument
935 IWL_ERR(mvm, "Start AGG when state is not IWL_AGG_OFF %d!\n", in iwl_mvm_sta_tx_agg_start()
940 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_tx_agg_start()
945 if (test_bit(IWL_MVM_STATUS_IN_D0I3, &mvm->status)) { in iwl_mvm_sta_tx_agg_start()
947 IWL_ERR(mvm, "Entered D0i3 while starting Tx agg\n"); in iwl_mvm_sta_tx_agg_start()
951 spin_lock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_start()
953 txq_id = iwl_mvm_find_free_queue(mvm, mvm->first_agg_queue, in iwl_mvm_sta_tx_agg_start()
954 mvm->last_agg_queue); in iwl_mvm_sta_tx_agg_start()
957 spin_unlock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_start()
958 IWL_ERR(mvm, "Failed to allocate agg queue\n"); in iwl_mvm_sta_tx_agg_start()
961 mvm->queue_info[txq_id].setup_reserved = true; in iwl_mvm_sta_tx_agg_start()
962 spin_unlock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_start()
969 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_tx_agg_start()
989 int iwl_mvm_sta_tx_agg_oper(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_oper() argument
995 iwl_mvm_get_wd_timeout(mvm, vif, sta->tdls, false); in iwl_mvm_sta_tx_agg_oper()
1014 iwl_mvm_enable_agg_txq(mvm, queue, in iwl_mvm_sta_tx_agg_oper()
1018 ret = iwl_mvm_sta_tx_agg(mvm, sta, tid, queue, true); in iwl_mvm_sta_tx_agg_oper()
1023 spin_lock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_oper()
1024 mvm->queue_info[queue].setup_reserved = false; in iwl_mvm_sta_tx_agg_oper()
1025 spin_unlock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_oper()
1038 IWL_DEBUG_HT(mvm, "Tx aggregation enabled on ra = %pM tid = %d\n", in iwl_mvm_sta_tx_agg_oper()
1041 return iwl_mvm_send_lq_cmd(mvm, &mvmsta->lq_sta.lq, false); in iwl_mvm_sta_tx_agg_oper()
1044 int iwl_mvm_sta_tx_agg_stop(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_stop() argument
1057 if (test_bit(IWL_MVM_STATUS_IN_HW_RESTART, &mvm->status)) { in iwl_mvm_sta_tx_agg_stop()
1066 IWL_DEBUG_TX_QUEUES(mvm, "Stop AGG: sta %d tid %d q %d state %d\n", in iwl_mvm_sta_tx_agg_stop()
1072 spin_lock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_stop()
1073 mvm->queue_info[txq_id].setup_reserved = false; in iwl_mvm_sta_tx_agg_stop()
1074 spin_unlock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_stop()
1080 IWL_DEBUG_TX_QUEUES(mvm, in iwl_mvm_sta_tx_agg_stop()
1097 iwl_mvm_sta_tx_agg(mvm, sta, tid, txq_id, false); in iwl_mvm_sta_tx_agg_stop()
1099 iwl_mvm_disable_txq(mvm, txq_id, in iwl_mvm_sta_tx_agg_stop()
1111 lockdep_assert_held(&mvm->mutex); in iwl_mvm_sta_tx_agg_stop()
1118 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_stop()
1121 IWL_ERR(mvm, in iwl_mvm_sta_tx_agg_stop()
1131 int iwl_mvm_sta_tx_agg_flush(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_sta_tx_agg_flush() argument
1145 IWL_DEBUG_TX_QUEUES(mvm, "Flush AGG: sta %d tid %d q %d state %d\n", in iwl_mvm_sta_tx_agg_flush()
1153 spin_lock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_flush()
1154 mvm->queue_info[txq_id].setup_reserved = false; in iwl_mvm_sta_tx_agg_flush()
1155 spin_unlock_bh(&mvm->queue_info_lock); in iwl_mvm_sta_tx_agg_flush()
1158 iwl_mvm_drain_sta(mvm, mvmsta, true); in iwl_mvm_sta_tx_agg_flush()
1159 if (iwl_mvm_flush_tx_path(mvm, BIT(txq_id), 0)) in iwl_mvm_sta_tx_agg_flush()
1160 IWL_ERR(mvm, "Couldn't flush the AGG queue\n"); in iwl_mvm_sta_tx_agg_flush()
1161 iwl_trans_wait_tx_queue_empty(mvm->trans, in iwl_mvm_sta_tx_agg_flush()
1163 iwl_mvm_drain_sta(mvm, mvmsta, false); in iwl_mvm_sta_tx_agg_flush()
1165 iwl_mvm_sta_tx_agg(mvm, sta, tid, txq_id, false); in iwl_mvm_sta_tx_agg_flush()
1167 iwl_mvm_disable_txq(mvm, tid_data->txq_id, in iwl_mvm_sta_tx_agg_flush()
1175 static int iwl_mvm_set_fw_key_idx(struct iwl_mvm *mvm) in iwl_mvm_set_fw_key_idx() argument
1179 lockdep_assert_held(&mvm->mutex); in iwl_mvm_set_fw_key_idx()
1188 if (test_bit(i, mvm->fw_key_table)) in iwl_mvm_set_fw_key_idx()
1190 if (mvm->fw_key_deleted[i] > max) { in iwl_mvm_set_fw_key_idx()
1191 max = mvm->fw_key_deleted[i]; in iwl_mvm_set_fw_key_idx()
1199 __set_bit(max_offs, mvm->fw_key_table); in iwl_mvm_set_fw_key_idx()
1204 static u8 iwl_mvm_get_key_sta_id(struct iwl_mvm *mvm, in iwl_mvm_get_key_sta_id() argument
1225 sta = rcu_dereference_check(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_get_key_sta_id()
1226 lockdep_is_held(&mvm->mutex)); in iwl_mvm_get_key_sta_id()
1241 static int iwl_mvm_send_sta_key(struct iwl_mvm *mvm, in iwl_mvm_send_sta_key() argument
1293 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA_KEY, CMD_ASYNC, in iwl_mvm_send_sta_key()
1296 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd), in iwl_mvm_send_sta_key()
1301 IWL_DEBUG_WEP(mvm, "MODIFY_STA: set dynamic key passed\n"); in iwl_mvm_send_sta_key()
1305 IWL_ERR(mvm, "MODIFY_STA: set dynamic key failed\n"); in iwl_mvm_send_sta_key()
1312 static int iwl_mvm_send_sta_igtk(struct iwl_mvm *mvm, in iwl_mvm_send_sta_igtk() argument
1344 IWL_DEBUG_INFO(mvm, "%s igtk for sta %u\n", in iwl_mvm_send_sta_igtk()
1348 return iwl_mvm_send_cmd_pdu(mvm, MGMT_MCAST_KEY, 0, in iwl_mvm_send_sta_igtk()
1353 static inline u8 *iwl_mvm_get_mac_addr(struct iwl_mvm *mvm, in iwl_mvm_get_mac_addr() argument
1365 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_get_mac_addr()
1366 lockdep_is_held(&mvm->mutex)); in iwl_mvm_get_mac_addr()
1374 static int __iwl_mvm_set_sta_key(struct iwl_mvm *mvm, in __iwl_mvm_set_sta_key() argument
1389 addr = iwl_mvm_get_mac_addr(mvm, vif, sta); in __iwl_mvm_set_sta_key()
1393 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, in __iwl_mvm_set_sta_key()
1399 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, in __iwl_mvm_set_sta_key()
1403 ret = iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, in __iwl_mvm_set_sta_key()
1410 static int __iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, u8 sta_id, in __iwl_mvm_remove_sta_key() argument
1432 ret = iwl_mvm_send_cmd_pdu_status(mvm, ADD_STA_KEY, sizeof(cmd), in __iwl_mvm_remove_sta_key()
1437 IWL_DEBUG_WEP(mvm, "MODIFY_STA: remove sta key passed\n"); in __iwl_mvm_remove_sta_key()
1441 IWL_ERR(mvm, "MODIFY_STA: remove sta key failed\n"); in __iwl_mvm_remove_sta_key()
1448 int iwl_mvm_set_sta_key(struct iwl_mvm *mvm, in iwl_mvm_set_sta_key() argument
1459 lockdep_assert_held(&mvm->mutex); in iwl_mvm_set_sta_key()
1462 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); in iwl_mvm_set_sta_key()
1464 IWL_ERR(mvm, "Failed to find station id\n"); in iwl_mvm_set_sta_key()
1469 ret = iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, false); in iwl_mvm_set_sta_key()
1478 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_set_sta_key()
1479 lockdep_is_held(&mvm->mutex)); in iwl_mvm_set_sta_key()
1481 IWL_ERR(mvm, "Invalid station id\n"); in iwl_mvm_set_sta_key()
1501 key_offset = iwl_mvm_set_fw_key_idx(mvm); in iwl_mvm_set_sta_key()
1507 ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, key_offset, mcast); in iwl_mvm_set_sta_key()
1509 __clear_bit(keyconf->hw_key_idx, mvm->fw_key_table); in iwl_mvm_set_sta_key()
1521 ret = __iwl_mvm_set_sta_key(mvm, vif, sta, keyconf, in iwl_mvm_set_sta_key()
1524 __clear_bit(keyconf->hw_key_idx, mvm->fw_key_table); in iwl_mvm_set_sta_key()
1525 __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast); in iwl_mvm_set_sta_key()
1530 IWL_DEBUG_WEP(mvm, "key: cipher=%x len=%d idx=%d sta=%pM ret=%d\n", in iwl_mvm_set_sta_key()
1536 int iwl_mvm_remove_sta_key(struct iwl_mvm *mvm, in iwl_mvm_remove_sta_key() argument
1545 lockdep_assert_held(&mvm->mutex); in iwl_mvm_remove_sta_key()
1548 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); in iwl_mvm_remove_sta_key()
1550 IWL_DEBUG_WEP(mvm, "mvm remove dynamic key: idx=%d sta=%d\n", in iwl_mvm_remove_sta_key()
1554 return iwl_mvm_send_sta_igtk(mvm, keyconf, sta_id, true); in iwl_mvm_remove_sta_key()
1556 if (!__test_and_clear_bit(keyconf->hw_key_idx, mvm->fw_key_table)) { in iwl_mvm_remove_sta_key()
1557 IWL_ERR(mvm, "offset %d not used in fw key table.\n", in iwl_mvm_remove_sta_key()
1564 if (mvm->fw_key_deleted[i] < U8_MAX) in iwl_mvm_remove_sta_key()
1565 mvm->fw_key_deleted[i]++; in iwl_mvm_remove_sta_key()
1567 mvm->fw_key_deleted[keyconf->hw_key_idx] = 0; in iwl_mvm_remove_sta_key()
1570 IWL_DEBUG_WEP(mvm, "station non-existent, early return.\n"); in iwl_mvm_remove_sta_key()
1574 ret = __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, mcast); in iwl_mvm_remove_sta_key()
1581 ret = __iwl_mvm_remove_sta_key(mvm, sta_id, keyconf, !mcast); in iwl_mvm_remove_sta_key()
1586 void iwl_mvm_update_tkip_key(struct iwl_mvm *mvm, in iwl_mvm_update_tkip_key() argument
1598 sta_id = iwl_mvm_get_key_sta_id(mvm, vif, sta); in iwl_mvm_update_tkip_key()
1603 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_update_tkip_key()
1611 iwl_mvm_send_sta_key(mvm, mvm_sta, keyconf, mcast, in iwl_mvm_update_tkip_key()
1618 void iwl_mvm_sta_modify_ps_wake(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_ps_wake() argument
1630 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); in iwl_mvm_sta_modify_ps_wake()
1632 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_sta_modify_ps_wake()
1635 void iwl_mvm_sta_modify_sleep_tx_count(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_sleep_tx_count() argument
1712 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); in iwl_mvm_sta_modify_sleep_tx_count()
1714 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_sta_modify_sleep_tx_count()
1717 void iwl_mvm_rx_eosp_notif(struct iwl_mvm *mvm, in iwl_mvm_rx_eosp_notif() argument
1729 sta = rcu_dereference(mvm->fw_id_to_mac_id[sta_id]); in iwl_mvm_rx_eosp_notif()
1735 void iwl_mvm_sta_modify_disable_tx(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_disable_tx() argument
1747 ret = iwl_mvm_send_cmd_pdu(mvm, ADD_STA, CMD_ASYNC, sizeof(cmd), &cmd); in iwl_mvm_sta_modify_disable_tx()
1749 IWL_ERR(mvm, "Failed to send ADD_STA command (%d)\n", ret); in iwl_mvm_sta_modify_disable_tx()
1752 void iwl_mvm_sta_modify_disable_tx_ap(struct iwl_mvm *mvm, in iwl_mvm_sta_modify_disable_tx_ap() argument
1772 if (disable || !atomic_read(&mvm->pending_frames[mvm_sta->sta_id])) in iwl_mvm_sta_modify_disable_tx_ap()
1773 ieee80211_sta_block_awake(mvm->hw, sta, disable); in iwl_mvm_sta_modify_disable_tx_ap()
1775 iwl_mvm_sta_modify_disable_tx(mvm, mvm_sta, disable); in iwl_mvm_sta_modify_disable_tx_ap()
1780 void iwl_mvm_modify_all_sta_disable_tx(struct iwl_mvm *mvm, in iwl_mvm_modify_all_sta_disable_tx() argument
1788 lockdep_assert_held(&mvm->mutex); in iwl_mvm_modify_all_sta_disable_tx()
1792 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_modify_all_sta_disable_tx()
1793 lockdep_is_held(&mvm->mutex)); in iwl_mvm_modify_all_sta_disable_tx()
1802 iwl_mvm_sta_modify_disable_tx_ap(mvm, sta, disable); in iwl_mvm_modify_all_sta_disable_tx()
1806 void iwl_mvm_csa_client_absent(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_csa_client_absent() argument
1813 mvmsta = iwl_mvm_sta_from_staid_rcu(mvm, mvmvif->ap_sta_id); in iwl_mvm_csa_client_absent()
1816 iwl_mvm_sta_modify_disable_tx(mvm, mvmsta, true); in iwl_mvm_csa_client_absent()