Lines Matching refs:sta
59 struct sta_info *sta) in rssi_threshold_check() argument
63 (sta && in rssi_threshold_check()
64 (s8)-ewma_signal_read(&sta->deflink.rx_stats_avg.signal) > in rssi_threshold_check()
75 static inline void mesh_plink_fsm_restart(struct sta_info *sta) in mesh_plink_fsm_restart() argument
77 lockdep_assert_held(&sta->mesh->plink_lock); in mesh_plink_fsm_restart()
78 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in mesh_plink_fsm_restart()
79 sta->mesh->llid = sta->mesh->plid = sta->mesh->reason = 0; in mesh_plink_fsm_restart()
80 sta->mesh->plink_retries = 0; in mesh_plink_fsm_restart()
97 struct sta_info *sta; in mesh_set_short_slot_time() local
123 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_short_slot_time()
124 if (sdata != sta->sdata || in mesh_set_short_slot_time()
125 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_short_slot_time()
129 if (erp_rates & sta->sta.deflink.supp_rates[sband->band]) in mesh_set_short_slot_time()
162 struct sta_info *sta; in mesh_set_ht_prot_mode() local
176 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_ht_prot_mode()
177 if (sdata != sta->sdata || in mesh_set_ht_prot_mode()
178 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
181 if (sta->sta.deflink.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
184 if (!sta->sta.deflink.ht_cap.ht_supported) { in mesh_set_ht_prot_mode()
186 sta->sta.addr); in mesh_set_ht_prot_mode()
191 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); in mesh_set_ht_prot_mode()
214 struct sta_info *sta, in mesh_plink_frame_tx() argument
280 put_unaligned_le16(sta->sta.aid, pos); in mesh_plink_frame_tx()
377 static u64 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
379 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
382 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
384 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
386 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
388 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
389 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
404 u64 mesh_plink_deactivate(struct sta_info *sta) in mesh_plink_deactivate() argument
406 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_deactivate()
409 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
410 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
413 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
414 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, in mesh_plink_deactivate()
415 sta->sta.addr, sta->mesh->llid, in mesh_plink_deactivate()
416 sta->mesh->plid, sta->mesh->reason); in mesh_plink_deactivate()
418 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
420 del_timer_sync(&sta->mesh->plink_timer); in mesh_plink_deactivate()
421 mesh_path_flush_by_nexthop(sta); in mesh_plink_deactivate()
430 struct sta_info *sta, in mesh_sta_info_init() argument
436 enum ieee80211_sta_rx_bandwidth bw = sta->sta.deflink.bandwidth; in mesh_sta_info_init()
445 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
446 sta->deflink.rx_stats.last_rx = jiffies; in mesh_sta_info_init()
449 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
450 sta->mesh->processed_beacon) in mesh_sta_info_init()
452 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
454 if (sta->sta.deflink.supp_rates[sband->band] != rates) in mesh_sta_info_init()
456 sta->sta.deflink.supp_rates[sband->band] = rates; in mesh_sta_info_init()
460 &sta->deflink)) in mesh_sta_info_init()
465 &sta->deflink); in mesh_sta_info_init()
470 &sta->deflink); in mesh_sta_info_init()
475 &sta->deflink); in mesh_sta_info_init()
477 if (bw != sta->sta.deflink.bandwidth) in mesh_sta_info_init()
484 if (sta->sta.deflink.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
486 sta->sta.deflink.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
489 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) in mesh_sta_info_init()
490 rate_control_rate_init(sta); in mesh_sta_info_init()
492 rate_control_rate_update(local, sband, sta, 0, changed); in mesh_sta_info_init()
494 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
499 struct sta_info *sta; in mesh_allocate_aid() local
511 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) in mesh_allocate_aid()
512 __set_bit(sta->sta.aid, aid_map); in mesh_allocate_aid()
527 struct sta_info *sta; in __mesh_sta_info_alloc() local
537 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
538 if (!sta) in __mesh_sta_info_alloc()
541 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
542 sta->sta.wme = true; in __mesh_sta_info_alloc()
543 sta->sta.aid = aid; in __mesh_sta_info_alloc()
545 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
546 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
547 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
549 return sta; in __mesh_sta_info_alloc()
557 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
575 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
577 return sta; in mesh_sta_info_alloc()
596 struct sta_info *sta = NULL; in mesh_sta_info_get() local
599 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
600 if (sta) { in mesh_sta_info_get()
601 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
605 sta = mesh_sta_info_alloc(sdata, addr, elems, rx_status); in mesh_sta_info_get()
606 if (!sta) { in mesh_sta_info_get()
611 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
613 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
617 return sta; in mesh_sta_info_get()
635 struct sta_info *sta; in mesh_neighbour_update() local
638 sta = mesh_sta_info_get(sdata, hw_addr, elems, rx_status); in mesh_neighbour_update()
639 if (!sta) in mesh_neighbour_update()
642 sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form & in mesh_neighbour_update()
646 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
649 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
650 changed = mesh_plink_open(sta); in mesh_neighbour_update()
652 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
661 struct sta_info *sta; in mesh_plink_timer() local
672 sta = mesh->plink_sta; in mesh_plink_timer()
674 if (sta->sdata->local->quiescing) in mesh_plink_timer()
677 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
684 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
685 mpl_dbg(sta->sdata, in mesh_plink_timer()
687 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
688 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
693 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
694 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
695 mpl_dbg(sta->sdata, in mesh_plink_timer()
697 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
698 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
702 mpl_dbg(sta->sdata, in mesh_plink_timer()
704 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
705 sdata = sta->sdata; in mesh_plink_timer()
708 switch (sta->mesh->plink_state) { in mesh_plink_timer()
712 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
714 mpl_dbg(sta->sdata, in mesh_plink_timer()
716 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
717 sta->mesh->plink_timeout); in mesh_plink_timer()
719 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
720 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
721 ++sta->mesh->plink_retries; in mesh_plink_timer()
722 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
732 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
733 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
738 del_timer(&sta->mesh->plink_timer); in mesh_plink_timer()
739 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
744 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
746 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_timer()
747 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
750 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
752 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
753 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout)); in mesh_plink_timer_set()
761 struct sta_info *sta; in llid_in_use() local
764 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
765 if (sdata != sta->sdata) in llid_in_use()
768 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
789 u64 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
791 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
794 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
797 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
798 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
799 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
800 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
801 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
804 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
805 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
806 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
809 sta->sta.addr); in mesh_plink_open()
814 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, in mesh_plink_open()
815 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
819 u64 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
823 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
824 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
825 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
826 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
827 mesh_path_flush_by_nexthop(sta); in mesh_plink_block()
833 struct sta_info *sta, in mesh_plink_close() argument
840 sta->mesh->reason = reason; in mesh_plink_close()
841 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
842 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
846 struct sta_info *sta) in mesh_plink_establish() argument
851 del_timer(&sta->mesh->plink_timer); in mesh_plink_establish()
852 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
856 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
857 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
858 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
872 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
879 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
880 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
882 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
883 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
887 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
890 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
891 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
892 mesh_plink_timer_set(sta, in mesh_plink_fsm()
908 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
913 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
917 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
918 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
929 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
936 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
947 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
951 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
961 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
964 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
978 del_timer(&sta->mesh->plink_timer); in mesh_plink_fsm()
979 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
997 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
999 mesh_path_flush_by_nexthop(sta); in mesh_plink_fsm()
1001 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_fsm()
1002 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
1003 sta->mesh->reason); in mesh_plink_fsm()
1007 mesh_plink_frame_tx(sdata, sta, in mesh_plink_fsm()
1009 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
1010 sta->mesh->plid, 0); in mesh_plink_fsm()
1032 struct sta_info *sta, in mesh_plink_get_event() argument
1045 if (!matches_local && !sta) { in mesh_plink_get_event()
1050 if (!sta) { in mesh_plink_get_event()
1065 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
1069 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
1078 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1087 sta->mesh->llid != llid || in mesh_plink_get_event()
1088 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1094 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1105 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1107 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1128 struct sta_info *sta; in mesh_process_plink_frame() local
1175 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1178 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1185 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1190 sta = mesh_sta_info_get(sdata, mgmt->sa, elems, rx_status); in mesh_process_plink_frame()
1191 if (!sta) { in mesh_process_plink_frame()
1195 sta->mesh->plid = plid; in mesh_process_plink_frame()
1196 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1201 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1208 if (!sta->mesh->plid) in mesh_process_plink_frame()
1209 sta->mesh->plid = plid; in mesh_process_plink_frame()
1211 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1214 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()