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()
180 void iwl_mvm_recalc_tdls_state(struct iwl_mvm *mvm, struct ieee80211_vif *vif, in iwl_mvm_recalc_tdls_state() argument
183 int tdls_sta_cnt = iwl_mvm_tdls_sta_count(mvm, vif); in iwl_mvm_recalc_tdls_state()
187 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
190 iwl_mvm_tdls_config(mvm, vif); in iwl_mvm_recalc_tdls_state()
194 iwl_mvm_power_update_mac(mvm); in iwl_mvm_recalc_tdls_state()
200 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_mac_mgd_protect_tdls_discover() local
207 if (iwl_mvm_ref_sync(mvm, IWL_MVM_REF_PROTECT_TDLS)) in iwl_mvm_mac_mgd_protect_tdls_discover()
210 mutex_lock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
212 iwl_mvm_protect_session(mvm, vif, duration, duration, 100, true); in iwl_mvm_mac_mgd_protect_tdls_discover()
213 mutex_unlock(&mvm->mutex); in iwl_mvm_mac_mgd_protect_tdls_discover()
215 iwl_mvm_unref(mvm, IWL_MVM_REF_PROTECT_TDLS); in iwl_mvm_mac_mgd_protect_tdls_discover()
237 static void iwl_mvm_tdls_update_cs_state(struct iwl_mvm *mvm, in iwl_mvm_tdls_update_cs_state() argument
240 if (mvm->tdls_cs.state == state) in iwl_mvm_tdls_update_cs_state()
243 IWL_DEBUG_TDLS(mvm, "TDLS channel switch state: %s -> %s\n", in iwl_mvm_tdls_update_cs_state()
244 iwl_mvm_tdls_cs_state_str(mvm->tdls_cs.state), in iwl_mvm_tdls_update_cs_state()
246 mvm->tdls_cs.state = state; in iwl_mvm_tdls_update_cs_state()
250 mvm->tdls_cs.peer.sent_timestamp = in iwl_mvm_tdls_update_cs_state()
251 iwl_read_prph(mvm->trans, DEVICE_SYSTEM_TIME_REG); in iwl_mvm_tdls_update_cs_state()
254 mvm->tdls_cs.cur_sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_tdls_update_cs_state()
257 void iwl_mvm_rx_tdls_notif(struct iwl_mvm *mvm, struct iwl_rx_cmd_buffer *rxb) in iwl_mvm_rx_tdls_notif() argument
267 lockdep_assert_held(&mvm->mutex); in iwl_mvm_rx_tdls_notif()
271 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_rx_tdls_notif()
278 sta = rcu_dereference_protected(mvm->fw_id_to_mac_id[sta_id], in iwl_mvm_rx_tdls_notif()
279 lockdep_is_held(&mvm->mutex)); in iwl_mvm_rx_tdls_notif()
292 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_rx_tdls_notif()
295 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_ACTIVE); in iwl_mvm_rx_tdls_notif()
299 iwl_mvm_tdls_check_action(struct iwl_mvm *mvm, in iwl_mvm_tdls_check_action() argument
307 if (mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE && in iwl_mvm_tdls_check_action()
308 mvm->tdls_cs.cur_sta_id != IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_check_action()
310 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_check_action()
311 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_check_action()
316 switch (mvm->tdls_cs.state) { in iwl_mvm_tdls_check_action()
340 else if (timestamp <= mvm->tdls_cs.peer.sent_timestamp) in iwl_mvm_tdls_check_action()
373 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_check_action()
375 type, mvm->tdls_cs.state, peer, same_peer, in iwl_mvm_tdls_check_action()
382 iwl_mvm_tdls_config_channel_switch(struct iwl_mvm *mvm, in iwl_mvm_tdls_config_channel_switch() argument
399 lockdep_assert_held(&mvm->mutex); in iwl_mvm_tdls_config_channel_switch()
401 ret = iwl_mvm_tdls_check_action(mvm, type, peer, peer_initiator, in iwl_mvm_tdls_config_channel_switch()
427 if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_config_channel_switch()
428 mvm->tdls_cs.peer.chandef.chan) { in iwl_mvm_tdls_config_channel_switch()
430 chandef = &mvm->tdls_cs.peer.chandef; in iwl_mvm_tdls_config_channel_switch()
431 } else if (mvm->tdls_cs.state == IWL_MVM_TDLS_SW_ACTIVE && in iwl_mvm_tdls_config_channel_switch()
473 iwl_mvm_set_tx_cmd(mvm, skb, &cmd.frame.tx_cmd, info, in iwl_mvm_tdls_config_channel_switch()
476 iwl_mvm_set_tx_cmd_rate(mvm, &cmd.frame.tx_cmd, info, sta, in iwl_mvm_tdls_config_channel_switch()
482 ret = iwl_mvm_send_cmd_pdu(mvm, TDLS_CHANNEL_SWITCH_CMD, 0, in iwl_mvm_tdls_config_channel_switch()
485 IWL_ERR(mvm, "Failed to send TDLS_CHANNEL_SWITCH cmd: %d\n", in iwl_mvm_tdls_config_channel_switch()
492 mvm->tdls_cs.cur_sta_id = mvmsta->sta_id; in iwl_mvm_tdls_config_channel_switch()
493 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_config_channel_switch()
498 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_RESP_RCVD); in iwl_mvm_tdls_config_channel_switch()
505 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_config_channel_switch()
512 struct iwl_mvm *mvm; in iwl_mvm_tdls_ch_switch_work() local
519 mvm = container_of(work, struct iwl_mvm, tdls_cs.dwork.work); in iwl_mvm_tdls_ch_switch_work()
520 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
523 iwl_mvm_tdls_update_cs_state(mvm, IWL_MVM_TDLS_SW_IDLE); in iwl_mvm_tdls_ch_switch_work()
526 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_STATION_COUNT) in iwl_mvm_tdls_ch_switch_work()
530 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_ch_switch_work()
531 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_ch_switch_work()
538 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_ch_switch_work()
541 mvm->tdls_cs.peer.initiator, in iwl_mvm_tdls_ch_switch_work()
542 mvm->tdls_cs.peer.op_class, in iwl_mvm_tdls_ch_switch_work()
543 &mvm->tdls_cs.peer.chandef, in iwl_mvm_tdls_ch_switch_work()
545 mvm->tdls_cs.peer.skb, in iwl_mvm_tdls_ch_switch_work()
546 mvm->tdls_cs.peer.ch_sw_tm_ie); in iwl_mvm_tdls_ch_switch_work()
548 IWL_ERR(mvm, "Not sending TDLS channel switch: %d\n", ret); in iwl_mvm_tdls_ch_switch_work()
552 queue_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_ch_switch_work()
555 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_ch_switch_work()
565 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_channel_switch() local
570 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
572 IWL_DEBUG_TDLS(mvm, "TDLS channel switch with %pM ch %d width %d\n", in iwl_mvm_tdls_channel_switch()
576 if (mvm->tdls_cs.peer.sta_id != IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_channel_switch()
577 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_channel_switch()
584 ret = iwl_mvm_tdls_config_channel_switch(mvm, vif, in iwl_mvm_tdls_channel_switch()
596 mvm->tdls_cs.peer.skb = skb_copy(tmpl_skb, GFP_KERNEL); in iwl_mvm_tdls_channel_switch()
597 if (!mvm->tdls_cs.peer.skb) { in iwl_mvm_tdls_channel_switch()
603 mvm->tdls_cs.peer.sta_id = mvmsta->sta_id; in iwl_mvm_tdls_channel_switch()
604 mvm->tdls_cs.peer.chandef = *chandef; in iwl_mvm_tdls_channel_switch()
605 mvm->tdls_cs.peer.initiator = sta->tdls_initiator; in iwl_mvm_tdls_channel_switch()
606 mvm->tdls_cs.peer.op_class = oper_class; in iwl_mvm_tdls_channel_switch()
607 mvm->tdls_cs.peer.ch_sw_tm_ie = ch_sw_tm_ie; in iwl_mvm_tdls_channel_switch()
615 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_channel_switch()
619 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_channel_switch()
627 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_cancel_channel_switch() local
631 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
633 IWL_DEBUG_TDLS(mvm, "TDLS cancel channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
636 if (mvm->tdls_cs.peer.sta_id == IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_cancel_channel_switch()
637 IWL_DEBUG_TDLS(mvm, "No ch switch peer - %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
642 mvm->fw_id_to_mac_id[mvm->tdls_cs.peer.sta_id], in iwl_mvm_tdls_cancel_channel_switch()
643 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_cancel_channel_switch()
653 if (mvm->tdls_cs.cur_sta_id == mvm->tdls_cs.peer.sta_id && in iwl_mvm_tdls_cancel_channel_switch()
654 mvm->tdls_cs.state != IWL_MVM_TDLS_SW_IDLE) in iwl_mvm_tdls_cancel_channel_switch()
657 mvm->tdls_cs.peer.sta_id = IWL_MVM_STATION_COUNT; in iwl_mvm_tdls_cancel_channel_switch()
658 dev_kfree_skb(mvm->tdls_cs.peer.skb); in iwl_mvm_tdls_cancel_channel_switch()
659 mvm->tdls_cs.peer.skb = NULL; in iwl_mvm_tdls_cancel_channel_switch()
662 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_cancel_channel_switch()
670 flush_delayed_work(&mvm->tdls_cs.dwork); in iwl_mvm_tdls_cancel_channel_switch()
672 IWL_DEBUG_TDLS(mvm, "TDLS ending channel switch with %pM\n", sta->addr); in iwl_mvm_tdls_cancel_channel_switch()
680 struct iwl_mvm *mvm = IWL_MAC80211_GET_MVM(hw); in iwl_mvm_tdls_recv_channel_switch() local
687 mutex_lock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()
689 IWL_DEBUG_TDLS(mvm, in iwl_mvm_tdls_recv_channel_switch()
699 mvm->tdls_cs.state == IWL_MVM_TDLS_SW_REQ_SENT && in iwl_mvm_tdls_recv_channel_switch()
700 mvm->tdls_cs.cur_sta_id != IWL_MVM_STATION_COUNT) { in iwl_mvm_tdls_recv_channel_switch()
705 mvm->fw_id_to_mac_id[mvm->tdls_cs.cur_sta_id], in iwl_mvm_tdls_recv_channel_switch()
706 lockdep_is_held(&mvm->mutex)); in iwl_mvm_tdls_recv_channel_switch()
708 iwl_mvm_tdls_update_cs_state(mvm, in iwl_mvm_tdls_recv_channel_switch()
717 iwl_mvm_tdls_config_channel_switch(mvm, vif, type, params->sta->addr, in iwl_mvm_tdls_recv_channel_switch()
729 mod_delayed_work(system_wq, &mvm->tdls_cs.dwork, in iwl_mvm_tdls_recv_channel_switch()
731 mutex_unlock(&mvm->mutex); in iwl_mvm_tdls_recv_channel_switch()