Lines Matching refs:mvm

72 void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm)  in iwl_mvm_teardown_tdls_peers()  argument
78 lockdep_assert_held(&mvm->mutex); in iwl_mvm_teardown_tdls_peers()
80 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) { in iwl_mvm_teardown_tdls_peers()
81 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_teardown_tdls_peers()
82 lockdep_is_held(&mvm->mutex)); in iwl_mvm_teardown_tdls_peers()
94 int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tdls_sta_count() argument
101 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_sta_count()
103 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) { in iwl_mvm_tdls_sta_count()
104 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tdls_sta_count()
105 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_sta_count()
121 static void iwl_mvm_tdls_config(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tdls_config() argument
136 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config()
147 for (i = 0; i < ARRAY_SIZE(mvm->fw_id_to_mac_id); i++) { in iwl_mvm_tdls_config()
148 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tdls_config()
149 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_config()
164 IWL_DEBUG_TDLS(mvm, "send TDLS config to FW for %d peers\n", cnt); in iwl_mvm_tdls_config()
166 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_tdls_config()
179 void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_recalc_tdls_state() argument
182 int tdls_sta_cnt = iwl_mvm_tdls_sta_count(mvm, vif); in iwl_mvm_recalc_tdls_state()
186 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
193 if (fw_has_capa(&mvm->fw->ucode_capa, in iwl_mvm_recalc_tdls_state()
195 iwl_mvm_tdls_config(mvm, vif); in iwl_mvm_recalc_tdls_state()
199 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
205 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_mgd_protect_tdls_discover() local
208 mutex_lock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
210 iwl_mvm_protect_session(mvm, vif, duration, duration, 100, true); in iwl_mvm_mac_mgd_protect_tdls_discover()
211 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
233 static void iwl_mvm_tdls_update_cs_state(struct iwl_mvm *mvm, in iwl_mvm_tdls_update_cs_state() argument
236 if (mvm->tdls_cs.state == state) in iwl_mvm_tdls_update_cs_state()
239 IWL_DEBUG_TDLS(mvm, "TDLS channel switch state: %s -> %s\n", in iwl_mvm_tdls_update_cs_state()
240 iwl_mvm_tdls_cs_state_str(mvm->tdls_cs.state), in iwl_mvm_tdls_update_cs_state()
242 mvm->tdls_cs.state = state; in iwl_mvm_tdls_update_cs_state()
246 mvm->tdls_cs.peer.sent_timestamp = iwl_mvm_get_systime(mvm); in iwl_mvm_tdls_update_cs_state()
249 mvm->tdls_cs.cur_sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_tdls_update_cs_state()
252 void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_rx_tdls_notif() argument
262 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_tdls_notif()
266 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_rx_tdls_notif()
273 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_rx_tdls_notif()
274 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_tdls_notif()
287 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_rx_tdls_notif()
290 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_ACTIVE); in iwl_mvm_rx_tdls_notif()
294 iwl_mvm_tdls_check_action(struct iwl_mvm *mvm, in iwl_mvm_tdls_check_action() argument
302 if (mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE && in iwl_mvm_tdls_check_action()
303 mvm->tdls_cs.cur_sta_id != IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_check_action()
305 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_check_action()
306 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_check_action()
311 switch (mvm->tdls_cs.state) { in iwl_mvm_tdls_check_action()
335 else if (timestamp <= mvm->tdls_cs.peer.sent_timestamp) in iwl_mvm_tdls_check_action()
368 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_check_action()
370 type, mvm->tdls_cs.state, peer, same_peer, in iwl_mvm_tdls_check_action()
377 iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, in iwl_mvm_tdls_config_channel_switch() argument
393 iwl_mvm_chan_info_cmd_tail(mvm, &cmd.ci); in iwl_mvm_tdls_config_channel_switch()
394 u16 len = sizeof(cmd) - iwl_mvm_chan_info_padding(mvm); in iwl_mvm_tdls_config_channel_switch()
397 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config_channel_switch()
399 ret = iwl_mvm_tdls_check_action(mvm, type, peer, peer_initiator, in iwl_mvm_tdls_config_channel_switch()
425 if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_config_channel_switch()
426 mvm->tdls_cs.peer.chandef.chan) { in iwl_mvm_tdls_config_channel_switch()
428 chandef = &mvm->tdls_cs.peer.chandef; in iwl_mvm_tdls_config_channel_switch()
429 } else if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_ACTIVE && in iwl_mvm_tdls_config_channel_switch()
445 iwl_mvm_set_chan_info_chandef(mvm, &cmd.ci, chandef); in iwl_mvm_tdls_config_channel_switch()
466 iwl_mvm_set_tx_cmd(mvm, skb, &tail->frame.tx_cmd, info, in iwl_mvm_tdls_config_channel_switch()
469 iwl_mvm_set_tx_cmd_rate(mvm, &tail->frame.tx_cmd, info, sta, in iwl_mvm_tdls_config_channel_switch()
475 ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, len, &cmd); in iwl_mvm_tdls_config_channel_switch()
477 IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n", in iwl_mvm_tdls_config_channel_switch()
484 mvm->tdls_cs.cur_sta_id = mvmsta->sta_id; in iwl_mvm_tdls_config_channel_switch()
485 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_config_channel_switch()
490 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_RESP_RCVD); in iwl_mvm_tdls_config_channel_switch()
497 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_config_channel_switch()
504 struct iwl_mvm *mvm; in iwl_mvm_tdls_ch_switch_work() local
511 mvm = container_of(work, struct iwl_mvm, tdls_cs.dwork.work); in iwl_mvm_tdls_ch_switch_work()
512 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
515 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_ch_switch_work()
518 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_INVALID_STA) in iwl_mvm_tdls_ch_switch_work()
522 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_ch_switch_work()
523 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_ch_switch_work()
530 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_ch_switch_work()
533 mvm->tdls_cs.peer.initiator, in iwl_mvm_tdls_ch_switch_work()
534 mvm->tdls_cs.peer.op_class, in iwl_mvm_tdls_ch_switch_work()
535 &mvm->tdls_cs.peer.chandef, in iwl_mvm_tdls_ch_switch_work()
537 mvm->tdls_cs.peer.skb, in iwl_mvm_tdls_ch_switch_work()
538 mvm->tdls_cs.peer.ch_sw_tm_ie); in iwl_mvm_tdls_ch_switch_work()
540 IWL_ERR(mvm, "Not sending TDLS channel switch: %d\n", ret); in iwl_mvm_tdls_ch_switch_work()
544 schedule_delayed_work(&mvm->tdls_cs.dwork, msecs_to_jiffies(delay)); in iwl_mvm_tdls_ch_switch_work()
546 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
556 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_channel_switch() local
561 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
563 IWL_DEBUG_TDLS(mvm, "TDLS channel switch with %pM ch %d width %d\n", in iwl_mvm_tdls_channel_switch()
567 if (mvm->tdls_cs.peer.sta_id != IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_channel_switch()
568 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_channel_switch()
575 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_channel_switch()
587 mvm->tdls_cs.peer.skb = skb_copy(tmpl_skb, GFP_KERNEL); in iwl_mvm_tdls_channel_switch()
588 if (!mvm->tdls_cs.peer.skb) { in iwl_mvm_tdls_channel_switch()
594 mvm->tdls_cs.peer.sta_id = mvmsta->sta_id; in iwl_mvm_tdls_channel_switch()
595 mvm->tdls_cs.peer.chandef = *chandef; in iwl_mvm_tdls_channel_switch()
596 mvm->tdls_cs.peer.initiator = sta->tdls_initiator; in iwl_mvm_tdls_channel_switch()
597 mvm->tdls_cs.peer.op_class = oper_class; in iwl_mvm_tdls_channel_switch()
598 mvm->tdls_cs.peer.ch_sw_tm_ie = ch_sw_tm_ie; in iwl_mvm_tdls_channel_switch()
606 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_channel_switch()
610 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
618 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_cancel_channel_switch() local
622 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
624 IWL_DEBUG_TDLS(mvm, "TDLS cancel channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
627 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_cancel_channel_switch()
628 IWL_DEBUG_TDLS(mvm, "No ch switch peer - %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
633 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_cancel_channel_switch()
634 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_cancel_channel_switch()
644 if (mvm->tdls_cs.cur_sta_id == mvm->tdls_cs.peer.sta_id && in iwl_mvm_tdls_cancel_channel_switch()
645 mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE) in iwl_mvm_tdls_cancel_channel_switch()
648 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA; in iwl_mvm_tdls_cancel_channel_switch()
649 dev_kfree_skb(mvm->tdls_cs.peer.skb); in iwl_mvm_tdls_cancel_channel_switch()
650 mvm->tdls_cs.peer.skb = NULL; in iwl_mvm_tdls_cancel_channel_switch()
653 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
661 flush_delayed_work(&mvm->tdls_cs.dwork); in iwl_mvm_tdls_cancel_channel_switch()
663 IWL_DEBUG_TDLS(mvm, "TDLS ending channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
671 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_recv_channel_switch() local
678 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()
680 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_recv_channel_switch()
690 mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_recv_channel_switch()
691 mvm->tdls_cs.cur_sta_id != IWL_MVM_INVALID_STA) { in iwl_mvm_tdls_recv_channel_switch()
696 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_recv_channel_switch()
697 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_recv_channel_switch()
699 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_recv_channel_switch()
708 iwl_mvm_tdls_config_channel_switch(mvm, vif, type, params->sta->addr, in iwl_mvm_tdls_recv_channel_switch()
720 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_recv_channel_switch()
722 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()