Lines Matching refs:mvm

16 void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm)  in iwl_mvm_teardown_tdls_peers()  argument
22 lockdep_assert_held(&mvm->mutex); in iwl_mvm_teardown_tdls_peers()
24 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_teardown_tdls_peers()
25 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_teardown_tdls_peers()
26 lockdep_is_held(&mvm->mutex)); in iwl_mvm_teardown_tdls_peers()
38 int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tdls_sta_count() argument
45 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_sta_count()
47 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_tdls_sta_count()
48 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tdls_sta_count()
49 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_sta_count()
65 static void iwl_mvm_tdls_config(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tdls_config() argument
80 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config()
91 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) { in iwl_mvm_tdls_config()
92 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tdls_config()
93 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_config()
108 IWL_DEBUG_TDLS(mvm, "send TDLS config to FW for %d peers\n", cnt); in iwl_mvm_tdls_config()
110 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_tdls_config()
123 void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_recalc_tdls_state() argument
126 int tdls_sta_cnt = iwl_mvm_tdls_sta_count(mvm, vif); in iwl_mvm_recalc_tdls_state()
130 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
137 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_recalc_tdls_state()
139 iwl_mvm_tdls_config(mvm, vif); in iwl_mvm_recalc_tdls_state()
143 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
149 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_mgd_protect_tdls_discover() local
153 mutex_lock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
154 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_mac_mgd_protect_tdls_discover()
156 iwl_mvm_schedule_session_protection(mvm, vif, duration, in iwl_mvm_mac_mgd_protect_tdls_discover()
159 iwl_mvm_protect_session(mvm, vif, duration, in iwl_mvm_mac_mgd_protect_tdls_discover()
161 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
183 static void iwl_mvm_tdls_update_cs_state(struct iwl_mvm *mvm, in iwl_mvm_tdls_update_cs_state() argument
186 if (mvm->tdls_cs.state == state) in iwl_mvm_tdls_update_cs_state()
189 IWL_DEBUG_TDLS(mvm, "TDLS channel switch state: %s -> %s\n", in iwl_mvm_tdls_update_cs_state()
190 iwl_mvm_tdls_cs_state_str(mvm->tdls_cs.state), in iwl_mvm_tdls_update_cs_state()
192 mvm->tdls_cs.state = state; in iwl_mvm_tdls_update_cs_state()
196 mvm->tdls_cs.peer.sent_timestamp = iwl_mvm_get_systime(mvm); in iwl_mvm_tdls_update_cs_state()
199 mvm->tdls_cs.cur_sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_tdls_update_cs_state()
202 void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_rx_tdls_notif() argument
212 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_tdls_notif()
216 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_rx_tdls_notif()
220 if (WARN_ON(sta_id >= mvm->fw->ucode_capa.num_stations)) in iwl_mvm_rx_tdls_notif()
223 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_rx_tdls_notif()
224 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_tdls_notif()
237 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_rx_tdls_notif()
240 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_ACTIVE); in iwl_mvm_rx_tdls_notif()
244 iwl_mvm_tdls_check_action(struct iwl_mvm *mvm, in iwl_mvm_tdls_check_action() argument
252 if (mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE && in iwl_mvm_tdls_check_action()
253 mvm->tdls_cs.cur_sta_id != IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_check_action()
255 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_check_action()
256 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_check_action()
261 switch (mvm->tdls_cs.state) { in iwl_mvm_tdls_check_action()
285 else if (timestamp <= mvm->tdls_cs.peer.sent_timestamp) in iwl_mvm_tdls_check_action()
318 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_check_action()
320 type, mvm->tdls_cs.state, peer, same_peer, in iwl_mvm_tdls_check_action()
327 iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, in iwl_mvm_tdls_config_channel_switch() argument
343 iwl_mvm_chan_info_cmd_tail(mvm, &cmd.ci); in iwl_mvm_tdls_config_channel_switch()
344 u16 len = sizeof(cmd) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_tdls_config_channel_switch()
347 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config_channel_switch()
349 ret = iwl_mvm_tdls_check_action(mvm, type, peer, peer_initiator, in iwl_mvm_tdls_config_channel_switch()
375 if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_config_channel_switch()
376 mvm->tdls_cs.peer.chandef.chan) { in iwl_mvm_tdls_config_channel_switch()
378 chandef = &mvm->tdls_cs.peer.chandef; in iwl_mvm_tdls_config_channel_switch()
379 } else if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_ACTIVE && in iwl_mvm_tdls_config_channel_switch()
395 iwl_mvm_set_chan_info_chandef(mvm, &cmd.ci, chandef); in iwl_mvm_tdls_config_channel_switch()
416 iwl_mvm_set_tx_cmd(mvm, skb, &tail->frame.tx_cmd, info, in iwl_mvm_tdls_config_channel_switch()
419 iwl_mvm_set_tx_cmd_rate(mvm, &tail->frame.tx_cmd, info, sta, in iwl_mvm_tdls_config_channel_switch()
425 ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, len, &cmd); in iwl_mvm_tdls_config_channel_switch()
427 IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n", in iwl_mvm_tdls_config_channel_switch()
434 mvm->tdls_cs.cur_sta_id = mvmsta->sta_id; in iwl_mvm_tdls_config_channel_switch()
435 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_config_channel_switch()
440 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_RESP_RCVD); in iwl_mvm_tdls_config_channel_switch()
447 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_config_channel_switch()
454 struct iwl_mvm *mvm; in iwl_mvm_tdls_ch_switch_work() local
461 mvm = container_of(work, struct iwl_mvm, tdls_cs.dwork.work); in iwl_mvm_tdls_ch_switch_work()
462 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
465 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_ch_switch_work()
468 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_INVALID_STA) in iwl_mvm_tdls_ch_switch_work()
472 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_ch_switch_work()
473 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_ch_switch_work()
480 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_ch_switch_work()
483 mvm->tdls_cs.peer.initiator, in iwl_mvm_tdls_ch_switch_work()
484 mvm->tdls_cs.peer.op_class, in iwl_mvm_tdls_ch_switch_work()
485 &mvm->tdls_cs.peer.chandef, in iwl_mvm_tdls_ch_switch_work()
487 mvm->tdls_cs.peer.skb, in iwl_mvm_tdls_ch_switch_work()
488 mvm->tdls_cs.peer.ch_sw_tm_ie); in iwl_mvm_tdls_ch_switch_work()
490 IWL_ERR(mvm, "Not sending TDLS channel switch: %d\n", ret); in iwl_mvm_tdls_ch_switch_work()
494 schedule_delayed_work(&mvm->tdls_cs.dwork, msecs_to_jiffies(delay)); in iwl_mvm_tdls_ch_switch_work()
496 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
506 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_channel_switch() local
511 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
513 IWL_DEBUG_TDLS(mvm, "TDLS channel switch with %pM ch %d width %d\n", in iwl_mvm_tdls_channel_switch()
517 if (mvm->tdls_cs.peer.sta_id != IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_channel_switch()
518 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_channel_switch()
525 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_channel_switch()
537 mvm->tdls_cs.peer.skb = skb_copy(tmpl_skb, GFP_KERNEL); in iwl_mvm_tdls_channel_switch()
538 if (!mvm->tdls_cs.peer.skb) { in iwl_mvm_tdls_channel_switch()
544 mvm->tdls_cs.peer.sta_id = mvmsta->sta_id; in iwl_mvm_tdls_channel_switch()
545 mvm->tdls_cs.peer.chandef = *chandef; in iwl_mvm_tdls_channel_switch()
546 mvm->tdls_cs.peer.initiator = sta->tdls_initiator; in iwl_mvm_tdls_channel_switch()
547 mvm->tdls_cs.peer.op_class = oper_class; in iwl_mvm_tdls_channel_switch()
548 mvm->tdls_cs.peer.ch_sw_tm_ie = ch_sw_tm_ie; in iwl_mvm_tdls_channel_switch()
556 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_channel_switch()
560 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
568 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_cancel_channel_switch() local
572 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
574 IWL_DEBUG_TDLS(mvm, "TDLS cancel channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
577 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_cancel_channel_switch()
578 IWL_DEBUG_TDLS(mvm, "No ch switch peer - %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
583 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_cancel_channel_switch()
584 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_cancel_channel_switch()
594 if (mvm->tdls_cs.cur_sta_id == mvm->tdls_cs.peer.sta_id && in iwl_mvm_tdls_cancel_channel_switch()
595 mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE) in iwl_mvm_tdls_cancel_channel_switch()
598 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_tdls_cancel_channel_switch()
599 dev_kfree_skb(mvm->tdls_cs.peer.skb); in iwl_mvm_tdls_cancel_channel_switch()
600 mvm->tdls_cs.peer.skb = NULL; in iwl_mvm_tdls_cancel_channel_switch()
603 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
611 flush_delayed_work(&mvm->tdls_cs.dwork); in iwl_mvm_tdls_cancel_channel_switch()
613 IWL_DEBUG_TDLS(mvm, "TDLS ending channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
621 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_recv_channel_switch() local
628 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()
630 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_recv_channel_switch()
640 mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_recv_channel_switch()
641 mvm->tdls_cs.cur_sta_id != IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_recv_channel_switch()
646 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_recv_channel_switch()
647 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_recv_channel_switch()
649 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_recv_channel_switch()
658 iwl_mvm_tdls_config_channel_switch(mvm, vif, type, params->sta->addr, in iwl_mvm_tdls_recv_channel_switch()
670 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_recv_channel_switch()
672 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()