Lines Matching refs:mvm

11 #include "mvm.h"
19 void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm)
25 lockdep_assert_held(&mvm->mutex);
27 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
28 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
29 lockdep_is_held(&mvm->mutex));
41 int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
48 lockdep_assert_held(&mvm->mutex);
50 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
51 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
52 lockdep_is_held(&mvm->mutex));
68 static void iwl_mvm_tdls_config(struct iwl_mvm *mvm, struct ieee80211_vif *vif)
83 lockdep_assert_held(&mvm->mutex);
94 for (i = 0; i < mvm->fw->ucode_capa.num_stations; i++) {
95 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i],
96 lockdep_is_held(&mvm->mutex));
111 IWL_DEBUG_TDLS(mvm, "send TDLS config to FW for %d peers\n", cnt);
113 ret = iwl_mvm_send_cmd(mvm, &cmd);
126 void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif,
129 int tdls_sta_cnt = iwl_mvm_tdls_sta_count(mvm, vif);
133 iwl_mvm_power_update_mac(mvm);
140 if (fw_has_capa(&mvm->fw->ucode_capa,
142 iwl_mvm_tdls_config(mvm, vif);
146 iwl_mvm_power_update_mac(mvm);
153 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
157 guard(mvm)(mvm);
158 if (fw_has_capa(&mvm->fw->ucode_capa,
160 iwl_mvm_schedule_session_protection(mvm, vif, duration,
163 iwl_mvm_protect_session(mvm, vif, duration,
186 static void iwl_mvm_tdls_update_cs_state(struct iwl_mvm *mvm,
189 if (mvm->tdls_cs.state == state)
192 IWL_DEBUG_TDLS(mvm, "TDLS channel switch state: %s -> %s\n",
193 iwl_mvm_tdls_cs_state_str(mvm->tdls_cs.state),
195 mvm->tdls_cs.state = state;
199 mvm->tdls_cs.peer.sent_timestamp = iwl_mvm_get_systime(mvm);
202 mvm->tdls_cs.cur_sta_id = IWL_MVM_INVALID_STA;
205 void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb)
215 lockdep_assert_held(&mvm->mutex);
219 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE);
223 if (WARN_ON(sta_id >= mvm->fw->ucode_capa.num_stations))
226 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id],
227 lockdep_is_held(&mvm->mutex));
240 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork,
243 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_ACTIVE);
247 iwl_mvm_tdls_check_action(struct iwl_mvm *mvm,
255 if (mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE &&
256 mvm->tdls_cs.cur_sta_id != IWL_MVM_INVALID_STA) {
258 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id],
259 lockdep_is_held(&mvm->mutex));
264 switch (mvm->tdls_cs.state) {
288 else if (timestamp <= mvm->tdls_cs.peer.sent_timestamp)
321 IWL_DEBUG_TDLS(mvm,
323 type, mvm->tdls_cs.state, peer, same_peer,
330 iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm,
346 iwl_mvm_chan_info_cmd_tail(mvm, &cmd.ci);
347 u16 len = sizeof(cmd) - iwl_mvm_chan_info_padding(mvm);
350 lockdep_assert_held(&mvm->mutex);
352 ret = iwl_mvm_tdls_check_action(mvm, type, peer, peer_initiator,
378 if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT &&
379 mvm->tdls_cs.peer.chandef.chan) {
381 chandef = &mvm->tdls_cs.peer.chandef;
382 } else if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_ACTIVE &&
398 iwl_mvm_set_chan_info_chandef(mvm, &cmd.ci, chandef);
419 iwl_mvm_set_tx_cmd(mvm, skb, &tail->frame.tx_cmd, info,
422 iwl_mvm_set_tx_cmd_rate(mvm, &tail->frame.tx_cmd, info, sta,
428 ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, len, &cmd);
430 IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n",
437 mvm->tdls_cs.cur_sta_id = mvmsta->deflink.sta_id;
438 iwl_mvm_tdls_update_cs_state(mvm,
443 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_RESP_RCVD);
450 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE);
457 struct iwl_mvm *mvm;
464 mvm = container_of(work, struct iwl_mvm, tdls_cs.dwork.work);
465 guard(mvm)(mvm);
468 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE);
471 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_INVALID_STA)
475 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id],
476 lockdep_is_held(&mvm->mutex));
483 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif,
486 mvm->tdls_cs.peer.initiator,
487 mvm->tdls_cs.peer.op_class,
488 &mvm->tdls_cs.peer.chandef,
490 mvm->tdls_cs.peer.skb,
491 mvm->tdls_cs.peer.ch_sw_tm_ie);
493 IWL_ERR(mvm, "Not sending TDLS channel switch: %d\n", ret);
497 schedule_delayed_work(&mvm->tdls_cs.dwork, msecs_to_jiffies(delay));
507 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
512 guard(mvm)(mvm);
514 IWL_DEBUG_TDLS(mvm, "TDLS channel switch with %pM ch %d width %d\n",
518 if (mvm->tdls_cs.peer.sta_id != IWL_MVM_INVALID_STA) {
519 IWL_DEBUG_TDLS(mvm,
525 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif,
537 mvm->tdls_cs.peer.skb = skb_copy(tmpl_skb, GFP_KERNEL);
538 if (!mvm->tdls_cs.peer.skb)
542 mvm->tdls_cs.peer.sta_id = mvmsta->deflink.sta_id;
543 mvm->tdls_cs.peer.chandef = *chandef;
544 mvm->tdls_cs.peer.initiator = sta->tdls_initiator;
545 mvm->tdls_cs.peer.op_class = oper_class;
546 mvm->tdls_cs.peer.ch_sw_tm_ie = ch_sw_tm_ie;
554 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork,
563 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
567 mutex_lock(&mvm->mutex);
569 IWL_DEBUG_TDLS(mvm, "TDLS cancel channel switch with %pM\n", sta->addr);
572 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_INVALID_STA) {
573 IWL_DEBUG_TDLS(mvm, "No ch switch peer - %pM\n", sta->addr);
578 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id],
579 lockdep_is_held(&mvm->mutex));
589 if (mvm->tdls_cs.cur_sta_id == mvm->tdls_cs.peer.sta_id &&
590 mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE)
593 mvm->tdls_cs.peer.sta_id = IWL_MVM_INVALID_STA;
594 dev_kfree_skb(mvm->tdls_cs.peer.skb);
595 mvm->tdls_cs.peer.skb = NULL;
598 mutex_unlock(&mvm->mutex);
610 flush_delayed_work(&mvm->tdls_cs.dwork);
612 IWL_DEBUG_TDLS(mvm, "TDLS ending channel switch with %pM\n", sta->addr);
620 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw);
627 guard(mvm)(mvm);
629 IWL_DEBUG_TDLS(mvm,
639 mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT &&
640 mvm->tdls_cs.cur_sta_id != IWL_MVM_INVALID_STA) {
645 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id],
646 lockdep_is_held(&mvm->mutex));
648 iwl_mvm_tdls_update_cs_state(mvm,
657 iwl_mvm_tdls_config_channel_switch(mvm, vif, type, params->sta->addr,
669 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork,