Lines Matching refs:sta
63 struct sta_info *sta) in rssi_threshold_check() argument
67 (sta && (s8) -ewma_read(&sta->avg_signal) > rssi_threshold); in rssi_threshold_check()
77 static inline void mesh_plink_fsm_restart(struct sta_info *sta) in mesh_plink_fsm_restart() argument
79 sta->plink_state = NL80211_PLINK_LISTEN; in mesh_plink_fsm_restart()
80 sta->llid = sta->plid = sta->reason = 0; in mesh_plink_fsm_restart()
81 sta->plink_retries = 0; in mesh_plink_fsm_restart()
99 struct sta_info *sta; in mesh_set_short_slot_time() local
121 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_short_slot_time()
122 if (sdata != sta->sdata || in mesh_set_short_slot_time()
123 sta->plink_state != NL80211_PLINK_ESTAB) in mesh_set_short_slot_time()
127 if (erp_rates & sta->sta.supp_rates[band]) in mesh_set_short_slot_time()
157 struct sta_info *sta; in mesh_set_ht_prot_mode() local
171 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_ht_prot_mode()
172 if (sdata != sta->sdata || in mesh_set_ht_prot_mode()
173 sta->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
176 if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
179 if (!sta->sta.ht_cap.ht_supported) { in mesh_set_ht_prot_mode()
181 sta->sta.addr); in mesh_set_ht_prot_mode()
186 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); in mesh_set_ht_prot_mode()
218 static u32 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
220 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
223 if (sta->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
225 sta->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
226 mesh_path_flush_by_nexthop(sta); in __mesh_plink_deactivate()
228 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
229 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
242 u32 mesh_plink_deactivate(struct sta_info *sta) in mesh_plink_deactivate() argument
244 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_deactivate()
247 spin_lock_bh(&sta->lock); in mesh_plink_deactivate()
248 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
249 sta->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
251 sta->sta.addr, sta->llid, sta->plid, in mesh_plink_deactivate()
252 sta->reason); in mesh_plink_deactivate()
253 spin_unlock_bh(&sta->lock); in mesh_plink_deactivate()
378 struct sta_info *sta, in mesh_sta_info_init() argument
385 enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth; in mesh_sta_info_init()
390 spin_lock_bh(&sta->lock); in mesh_sta_info_init()
391 sta->last_rx = jiffies; in mesh_sta_info_init()
394 if (sta->plink_state == NL80211_PLINK_ESTAB) in mesh_sta_info_init()
397 if (sta->sta.supp_rates[band] != rates) in mesh_sta_info_init()
399 sta->sta.supp_rates[band] = rates; in mesh_sta_info_init()
402 elems->ht_cap_elem, sta)) in mesh_sta_info_init()
405 if (bw != sta->sta.bandwidth) in mesh_sta_info_init()
412 if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
414 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
418 rate_control_rate_init(sta); in mesh_sta_info_init()
420 rate_control_rate_update(local, sband, sta, changed); in mesh_sta_info_init()
422 spin_unlock_bh(&sta->lock); in mesh_sta_info_init()
428 struct sta_info *sta; in __mesh_sta_info_alloc() local
433 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
434 if (!sta) in __mesh_sta_info_alloc()
437 sta->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
438 sta->sta.wme = true; in __mesh_sta_info_alloc()
440 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
441 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
442 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
444 return sta; in __mesh_sta_info_alloc()
451 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
461 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
463 return sta; in mesh_sta_info_alloc()
480 struct sta_info *sta = NULL; in mesh_sta_info_get() local
483 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
484 if (sta) { in mesh_sta_info_get()
485 mesh_sta_info_init(sdata, sta, elems, false); in mesh_sta_info_get()
489 sta = mesh_sta_info_alloc(sdata, addr, elems); in mesh_sta_info_get()
490 if (!sta) { in mesh_sta_info_get()
495 mesh_sta_info_init(sdata, sta, elems, true); in mesh_sta_info_get()
497 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
501 return sta; in mesh_sta_info_get()
517 struct sta_info *sta; in mesh_neighbour_update() local
520 sta = mesh_sta_info_get(sdata, hw_addr, elems); in mesh_neighbour_update()
521 if (!sta) in mesh_neighbour_update()
525 sta->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
528 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
529 changed = mesh_plink_open(sta); in mesh_neighbour_update()
531 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
539 struct sta_info *sta; in mesh_plink_timer() local
550 sta = (struct sta_info *) data; in mesh_plink_timer()
552 if (sta->sdata->local->quiescing) in mesh_plink_timer()
555 spin_lock_bh(&sta->lock); in mesh_plink_timer()
562 if (time_before(jiffies, sta->plink_timer.expires)) { in mesh_plink_timer()
563 mpl_dbg(sta->sdata, in mesh_plink_timer()
565 sta->sta.addr, mplstates[sta->plink_state]); in mesh_plink_timer()
566 spin_unlock_bh(&sta->lock); in mesh_plink_timer()
571 if (sta->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
572 sta->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
573 mpl_dbg(sta->sdata, in mesh_plink_timer()
575 sta->sta.addr, mplstates[sta->plink_state]); in mesh_plink_timer()
576 spin_unlock_bh(&sta->lock); in mesh_plink_timer()
580 mpl_dbg(sta->sdata, in mesh_plink_timer()
582 sta->sta.addr, mplstates[sta->plink_state]); in mesh_plink_timer()
583 sdata = sta->sdata; in mesh_plink_timer()
586 switch (sta->plink_state) { in mesh_plink_timer()
590 if (sta->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
592 mpl_dbg(sta->sdata, in mesh_plink_timer()
594 sta->sta.addr, sta->plink_retries, in mesh_plink_timer()
595 sta->plink_timeout); in mesh_plink_timer()
597 sta->plink_timeout = sta->plink_timeout + in mesh_plink_timer()
598 rand % sta->plink_timeout; in mesh_plink_timer()
599 ++sta->plink_retries; in mesh_plink_timer()
600 mod_plink_timer(sta, sta->plink_timeout); in mesh_plink_timer()
610 sta->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
611 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
616 del_timer(&sta->plink_timer); in mesh_plink_timer()
617 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
622 spin_unlock_bh(&sta->lock); in mesh_plink_timer()
624 mesh_plink_frame_tx(sdata, action, sta->sta.addr, in mesh_plink_timer()
625 sta->llid, sta->plid, reason); in mesh_plink_timer()
628 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
630 sta->plink_timer.expires = jiffies + msecs_to_jiffies(timeout); in mesh_plink_timer_set()
631 sta->plink_timer.data = (unsigned long) sta; in mesh_plink_timer_set()
632 sta->plink_timer.function = mesh_plink_timer; in mesh_plink_timer_set()
633 sta->plink_timeout = timeout; in mesh_plink_timer_set()
634 add_timer(&sta->plink_timer); in mesh_plink_timer_set()
642 struct sta_info *sta; in llid_in_use() local
645 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
646 if (!memcmp(&sta->llid, &llid, sizeof(llid))) { in llid_in_use()
669 u32 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
671 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
674 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
677 spin_lock_bh(&sta->lock); in mesh_plink_open()
678 sta->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
679 if (sta->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
680 sta->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
681 spin_unlock_bh(&sta->lock); in mesh_plink_open()
684 sta->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
685 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
686 spin_unlock_bh(&sta->lock); in mesh_plink_open()
689 sta->sta.addr); in mesh_plink_open()
695 sta->sta.addr, sta->llid, 0, 0); in mesh_plink_open()
699 u32 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
703 spin_lock_bh(&sta->lock); in mesh_plink_block()
704 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
705 sta->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
706 spin_unlock_bh(&sta->lock); in mesh_plink_block()
712 struct sta_info *sta, in mesh_plink_close() argument
720 sta->reason = reason; in mesh_plink_close()
721 sta->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
722 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
726 struct sta_info *sta) in mesh_plink_establish() argument
731 del_timer(&sta->plink_timer); in mesh_plink_establish()
732 sta->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
736 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
737 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
738 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
752 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
758 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
759 mplstates[sta->plink_state], mplevents[event]); in mesh_plink_fsm()
761 spin_lock_bh(&sta->lock); in mesh_plink_fsm()
762 switch (sta->plink_state) { in mesh_plink_fsm()
766 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
769 sta->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
770 sta->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
771 mesh_plink_timer_set(sta, in mesh_plink_fsm()
787 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
792 sta->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
796 sta->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
797 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
808 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
815 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
826 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
830 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
840 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
843 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
856 del_timer(&sta->plink_timer); in mesh_plink_fsm()
857 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
875 spin_unlock_bh(&sta->lock); in mesh_plink_fsm()
877 mesh_plink_frame_tx(sdata, action, sta->sta.addr, in mesh_plink_fsm()
878 sta->llid, sta->plid, sta->reason); in mesh_plink_fsm()
884 sta->sta.addr, sta->llid, in mesh_plink_fsm()
885 sta->plid, 0); in mesh_plink_fsm()
907 struct sta_info *sta, in mesh_plink_get_event() argument
920 if (!matches_local && !sta) { in mesh_plink_get_event()
925 if (!sta) { in mesh_plink_get_event()
936 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
940 if (sta->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
945 if (!sta) { in mesh_plink_get_event()
955 (sta->plid && sta->plid != plid)) in mesh_plink_get_event()
964 sta->llid != llid || in mesh_plink_get_event()
965 (sta->plid && sta->plid != plid)) in mesh_plink_get_event()
971 if (sta->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
982 else if (sta->plid != plid) in mesh_plink_get_event()
984 else if (ie_len == 8 && sta->llid != llid) in mesh_plink_get_event()
1004 struct sta_info *sta; in mesh_process_plink_frame() local
1051 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1054 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1061 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1066 sta = mesh_sta_info_get(sdata, mgmt->sa, elems); in mesh_process_plink_frame()
1067 if (!sta) { in mesh_process_plink_frame()
1071 sta->plid = plid; in mesh_process_plink_frame()
1072 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1077 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1083 if (!sta->plid && event == CNF_ACPT) in mesh_process_plink_frame()
1084 sta->plid = plid; in mesh_process_plink_frame()
1086 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()