Lines Matching refs:mvm

73 void iwl_mvm_teardown_tdls_peers(struct iwl_mvm *mvm)  in iwl_mvm_teardown_tdls_peers()  argument
79 lockdep_assert_held(&mvm->mutex); in iwl_mvm_teardown_tdls_peers()
82 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_teardown_tdls_peers()
83 lockdep_is_held(&mvm->mutex)); in iwl_mvm_teardown_tdls_peers()
95 int iwl_mvm_tdls_sta_count(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tdls_sta_count() argument
102 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_sta_count()
105 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tdls_sta_count()
106 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_sta_count()
122 static void iwl_mvm_tdls_config(struct iwl_mvm *mvm, struct ieee80211_vif *vif) in iwl_mvm_tdls_config() argument
137 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config()
149 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[i], in iwl_mvm_tdls_config()
150 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_config()
165 IWL_DEBUG_TDLS(mvm, "send TDLS config to FW for %d peers\n", cnt); in iwl_mvm_tdls_config()
167 ret = iwl_mvm_send_cmd(mvm, &cmd); in iwl_mvm_tdls_config()
173 IWL_ERR(mvm, "Bad return from TDLS_CONFIG_COMMAND (0x%08X)\n", in iwl_mvm_tdls_config()
187 void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_recalc_tdls_state() argument
190 int tdls_sta_cnt = iwl_mvm_tdls_sta_count(mvm, vif); in iwl_mvm_recalc_tdls_state()
194 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
197 iwl_mvm_tdls_config(mvm, vif); in iwl_mvm_recalc_tdls_state()
201 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
207 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_mgd_protect_tdls_discover() local
214 if (iwl_mvm_ref_sync(mvm, IWL_MVM_REF_PROTECT_TDLS)) in iwl_mvm_mac_mgd_protect_tdls_discover()
217 mutex_lock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
219 iwl_mvm_protect_session(mvm, vif, duration, duration, 100, true); in iwl_mvm_mac_mgd_protect_tdls_discover()
220 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
222 iwl_mvm_unref(mvm, IWL_MVM_REF_PROTECT_TDLS); in iwl_mvm_mac_mgd_protect_tdls_discover()
244 static void iwl_mvm_tdls_update_cs_state(struct iwl_mvm *mvm, in iwl_mvm_tdls_update_cs_state() argument
247 if (mvm->tdls_cs.state == state) in iwl_mvm_tdls_update_cs_state()
250 IWL_DEBUG_TDLS(mvm, "TDLS channel switch state: %s -> %s\n", in iwl_mvm_tdls_update_cs_state()
251 iwl_mvm_tdls_cs_state_str(mvm->tdls_cs.state), in iwl_mvm_tdls_update_cs_state()
253 mvm->tdls_cs.state = state; in iwl_mvm_tdls_update_cs_state()
257 mvm->tdls_cs.peer.sent_timestamp = in iwl_mvm_tdls_update_cs_state()
258 iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG); in iwl_mvm_tdls_update_cs_state()
261 mvm->tdls_cs.cur_sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_tdls_update_cs_state()
264 int iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb, in iwl_mvm_rx_tdls_notif() argument
275 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_tdls_notif()
279 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_rx_tdls_notif()
286 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_rx_tdls_notif()
287 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_tdls_notif()
300 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_rx_tdls_notif()
303 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_ACTIVE); in iwl_mvm_rx_tdls_notif()
310 iwl_mvm_tdls_check_action(struct iwl_mvm *mvm, in iwl_mvm_tdls_check_action() argument
318 if (mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE && in iwl_mvm_tdls_check_action()
319 mvm->tdls_cs.cur_sta_id != IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_check_action()
321 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_check_action()
322 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_check_action()
327 switch (mvm->tdls_cs.state) { in iwl_mvm_tdls_check_action()
351 else if (timestamp <= mvm->tdls_cs.peer.sent_timestamp) in iwl_mvm_tdls_check_action()
384 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_check_action()
386 type, mvm->tdls_cs.state, peer, same_peer, in iwl_mvm_tdls_check_action()
393 iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, in iwl_mvm_tdls_config_channel_switch() argument
410 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config_channel_switch()
412 ret = iwl_mvm_tdls_check_action(mvm, type, peer, peer_initiator, in iwl_mvm_tdls_config_channel_switch()
438 if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_config_channel_switch()
439 mvm->tdls_cs.peer.chandef.chan) { in iwl_mvm_tdls_config_channel_switch()
441 chandef = &mvm->tdls_cs.peer.chandef; in iwl_mvm_tdls_config_channel_switch()
442 } else if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_ACTIVE && in iwl_mvm_tdls_config_channel_switch()
475 iwl_mvm_set_tx_cmd_crypto(mvm, info, &cmd.frame.tx_cmd, skb); in iwl_mvm_tdls_config_channel_switch()
477 iwl_mvm_set_tx_cmd(mvm, skb, &cmd.frame.tx_cmd, info, in iwl_mvm_tdls_config_channel_switch()
481 iwl_mvm_set_tx_cmd_rate(mvm, &cmd.frame.tx_cmd, info, sta, in iwl_mvm_tdls_config_channel_switch()
487 ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, in iwl_mvm_tdls_config_channel_switch()
490 IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n", in iwl_mvm_tdls_config_channel_switch()
497 mvm->tdls_cs.cur_sta_id = mvmsta->sta_id; in iwl_mvm_tdls_config_channel_switch()
498 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_config_channel_switch()
503 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_RESP_RCVD); in iwl_mvm_tdls_config_channel_switch()
510 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_config_channel_switch()
517 struct iwl_mvm *mvm; in iwl_mvm_tdls_ch_switch_work() local
524 mvm = container_of(work, struct iwl_mvm, tdls_cs.dwork.work); in iwl_mvm_tdls_ch_switch_work()
525 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
528 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_ch_switch_work()
531 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_STATION_COUNT) in iwl_mvm_tdls_ch_switch_work()
535 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_ch_switch_work()
536 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_ch_switch_work()
543 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_ch_switch_work()
546 mvm->tdls_cs.peer.initiator, in iwl_mvm_tdls_ch_switch_work()
547 mvm->tdls_cs.peer.op_class, in iwl_mvm_tdls_ch_switch_work()
548 &mvm->tdls_cs.peer.chandef, in iwl_mvm_tdls_ch_switch_work()
550 mvm->tdls_cs.peer.skb, in iwl_mvm_tdls_ch_switch_work()
551 mvm->tdls_cs.peer.ch_sw_tm_ie); in iwl_mvm_tdls_ch_switch_work()
553 IWL_ERR(mvm, "Not sending TDLS channel switch: %d\n", ret); in iwl_mvm_tdls_ch_switch_work()
557 queue_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_ch_switch_work()
560 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
570 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_channel_switch() local
575 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
577 IWL_DEBUG_TDLS(mvm, "TDLS channel switch with %pM ch %d width %d\n", in iwl_mvm_tdls_channel_switch()
581 if (mvm->tdls_cs.peer.sta_id != IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_channel_switch()
582 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_channel_switch()
589 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_channel_switch()
601 mvm->tdls_cs.peer.skb = skb_copy(tmpl_skb, GFP_KERNEL); in iwl_mvm_tdls_channel_switch()
602 if (!mvm->tdls_cs.peer.skb) { in iwl_mvm_tdls_channel_switch()
608 mvm->tdls_cs.peer.sta_id = mvmsta->sta_id; in iwl_mvm_tdls_channel_switch()
609 mvm->tdls_cs.peer.chandef = *chandef; in iwl_mvm_tdls_channel_switch()
610 mvm->tdls_cs.peer.initiator = sta->tdls_initiator; in iwl_mvm_tdls_channel_switch()
611 mvm->tdls_cs.peer.op_class = oper_class; in iwl_mvm_tdls_channel_switch()
612 mvm->tdls_cs.peer.ch_sw_tm_ie = ch_sw_tm_ie; in iwl_mvm_tdls_channel_switch()
620 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_channel_switch()
624 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
632 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_cancel_channel_switch() local
636 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
638 IWL_DEBUG_TDLS(mvm, "TDLS cancel channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
641 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_cancel_channel_switch()
642 IWL_DEBUG_TDLS(mvm, "No ch switch peer - %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
647 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_cancel_channel_switch()
648 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_cancel_channel_switch()
658 if (mvm->tdls_cs.cur_sta_id == mvm->tdls_cs.peer.sta_id && in iwl_mvm_tdls_cancel_channel_switch()
659 mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE) in iwl_mvm_tdls_cancel_channel_switch()
662 mvm->tdls_cs.peer.sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_tdls_cancel_channel_switch()
663 dev_kfree_skb(mvm->tdls_cs.peer.skb); in iwl_mvm_tdls_cancel_channel_switch()
664 mvm->tdls_cs.peer.skb = NULL; in iwl_mvm_tdls_cancel_channel_switch()
667 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
675 flush_delayed_work(&mvm->tdls_cs.dwork); in iwl_mvm_tdls_cancel_channel_switch()
677 IWL_DEBUG_TDLS(mvm, "TDLS ending channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
685 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_recv_channel_switch() local
692 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()
694 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_recv_channel_switch()
704 mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_recv_channel_switch()
705 mvm->tdls_cs.cur_sta_id != IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_recv_channel_switch()
710 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_recv_channel_switch()
711 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_recv_channel_switch()
713 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_recv_channel_switch()
722 iwl_mvm_tdls_config_channel_switch(mvm, vif, type, params->sta->addr, in iwl_mvm_tdls_recv_channel_switch()
734 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_recv_channel_switch()
736 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()