Lines Matching refs:sta

61 				 struct sta_info *sta)  in rssi_threshold_check()  argument
65 (sta && in rssi_threshold_check()
66 (s8)-ewma_signal_read(&sta->rx_stats_avg.signal) > in rssi_threshold_check()
77 static inline void mesh_plink_fsm_restart(struct sta_info *sta) in mesh_plink_fsm_restart() argument
79 lockdep_assert_held(&sta->mesh->plink_lock); in mesh_plink_fsm_restart()
80 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in mesh_plink_fsm_restart()
81 sta->mesh->llid = sta->mesh->plid = sta->mesh->reason = 0; in mesh_plink_fsm_restart()
82 sta->mesh->plink_retries = 0; in mesh_plink_fsm_restart()
99 struct sta_info *sta; in mesh_set_short_slot_time() local
124 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_short_slot_time()
125 if (sdata != sta->sdata || in mesh_set_short_slot_time()
126 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_short_slot_time()
130 if (erp_rates & sta->sta.supp_rates[sband->band]) in mesh_set_short_slot_time()
160 struct sta_info *sta; in mesh_set_ht_prot_mode() local
174 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_ht_prot_mode()
175 if (sdata != sta->sdata || in mesh_set_ht_prot_mode()
176 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
179 if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
182 if (!sta->sta.ht_cap.ht_supported) { in mesh_set_ht_prot_mode()
184 sta->sta.addr); in mesh_set_ht_prot_mode()
189 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); in mesh_set_ht_prot_mode()
212 struct sta_info *sta, in mesh_plink_frame_tx() argument
269 put_unaligned_le16(sta->sta.aid, pos); in mesh_plink_frame_tx()
352 static u32 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
354 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
357 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
359 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
361 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
363 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
364 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
377 u32 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 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
383 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
386 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
387 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, in mesh_plink_deactivate()
388 sta->sta.addr, sta->mesh->llid, in mesh_plink_deactivate()
389 sta->mesh->plid, sta->mesh->reason); in mesh_plink_deactivate()
391 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
393 del_timer_sync(&sta->mesh->plink_timer); in mesh_plink_deactivate()
394 mesh_path_flush_by_nexthop(sta); in mesh_plink_deactivate()
403 struct sta_info *sta, in mesh_sta_info_init() argument
409 enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth; in mesh_sta_info_init()
418 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
419 sta->rx_stats.last_rx = jiffies; in mesh_sta_info_init()
422 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
423 sta->mesh->processed_beacon) in mesh_sta_info_init()
425 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
427 if (sta->sta.supp_rates[sband->band] != rates) in mesh_sta_info_init()
429 sta->sta.supp_rates[sband->band] = rates; in mesh_sta_info_init()
432 elems->ht_cap_elem, sta)) in mesh_sta_info_init()
436 elems->vht_cap_elem, sta); in mesh_sta_info_init()
438 if (bw != sta->sta.bandwidth) in mesh_sta_info_init()
445 if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
447 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
450 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) in mesh_sta_info_init()
451 rate_control_rate_init(sta); in mesh_sta_info_init()
453 rate_control_rate_update(local, sband, sta, changed); in mesh_sta_info_init()
455 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
460 struct sta_info *sta; in mesh_allocate_aid() local
473 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) in mesh_allocate_aid()
474 __set_bit(sta->sta.aid, aid_map); in mesh_allocate_aid()
489 struct sta_info *sta; in __mesh_sta_info_alloc() local
499 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
500 if (!sta) in __mesh_sta_info_alloc()
503 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
504 sta->sta.wme = true; in __mesh_sta_info_alloc()
505 sta->sta.aid = aid; in __mesh_sta_info_alloc()
507 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
508 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
509 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
511 return sta; in __mesh_sta_info_alloc()
518 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
530 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
532 return sta; in mesh_sta_info_alloc()
549 struct sta_info *sta = NULL; in mesh_sta_info_get() local
552 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
553 if (sta) { in mesh_sta_info_get()
554 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
558 sta = mesh_sta_info_alloc(sdata, addr, elems); in mesh_sta_info_get()
559 if (!sta) { in mesh_sta_info_get()
564 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
566 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
570 return sta; in mesh_sta_info_get()
586 struct sta_info *sta; in mesh_neighbour_update() local
589 sta = mesh_sta_info_get(sdata, hw_addr, elems); in mesh_neighbour_update()
590 if (!sta) in mesh_neighbour_update()
594 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
597 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
598 changed = mesh_plink_open(sta); in mesh_neighbour_update()
600 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
609 struct sta_info *sta; in mesh_plink_timer() local
620 sta = mesh->plink_sta; in mesh_plink_timer()
622 if (sta->sdata->local->quiescing) in mesh_plink_timer()
625 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
632 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
633 mpl_dbg(sta->sdata, in mesh_plink_timer()
635 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
636 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
641 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
642 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
643 mpl_dbg(sta->sdata, in mesh_plink_timer()
645 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
646 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
650 mpl_dbg(sta->sdata, in mesh_plink_timer()
652 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
653 sdata = sta->sdata; in mesh_plink_timer()
656 switch (sta->mesh->plink_state) { in mesh_plink_timer()
660 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
662 mpl_dbg(sta->sdata, in mesh_plink_timer()
664 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
665 sta->mesh->plink_timeout); in mesh_plink_timer()
667 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
668 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
669 ++sta->mesh->plink_retries; in mesh_plink_timer()
670 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
680 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
681 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
686 del_timer(&sta->mesh->plink_timer); in mesh_plink_timer()
687 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
692 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
694 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_timer()
695 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
698 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
700 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
701 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout)); in mesh_plink_timer_set()
709 struct sta_info *sta; in llid_in_use() local
712 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
713 if (sdata != sta->sdata) in llid_in_use()
716 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
737 u32 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
739 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
742 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
745 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
746 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
747 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
748 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
749 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
752 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
753 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
754 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
757 sta->sta.addr); in mesh_plink_open()
762 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, in mesh_plink_open()
763 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
767 u32 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
771 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
772 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
773 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
774 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
775 mesh_path_flush_by_nexthop(sta); in mesh_plink_block()
781 struct sta_info *sta, in mesh_plink_close() argument
788 sta->mesh->reason = reason; in mesh_plink_close()
789 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
790 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
794 struct sta_info *sta) in mesh_plink_establish() argument
799 del_timer(&sta->mesh->plink_timer); in mesh_plink_establish()
800 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
804 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
805 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
806 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
820 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
827 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
828 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
830 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
831 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
835 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
838 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
839 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
840 mesh_plink_timer_set(sta, in mesh_plink_fsm()
856 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
861 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
865 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
866 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
877 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
884 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
895 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
899 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
909 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
912 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
926 del_timer(&sta->mesh->plink_timer); in mesh_plink_fsm()
927 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
945 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
947 mesh_path_flush_by_nexthop(sta); in mesh_plink_fsm()
949 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_fsm()
950 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
951 sta->mesh->reason); in mesh_plink_fsm()
955 mesh_plink_frame_tx(sdata, sta, in mesh_plink_fsm()
957 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
958 sta->mesh->plid, 0); in mesh_plink_fsm()
980 struct sta_info *sta, in mesh_plink_get_event() argument
993 if (!matches_local && !sta) { in mesh_plink_get_event()
998 if (!sta) { in mesh_plink_get_event()
1013 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
1017 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
1026 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1035 sta->mesh->llid != llid || in mesh_plink_get_event()
1036 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1042 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1053 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1055 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1075 struct sta_info *sta; in mesh_process_plink_frame() local
1122 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1125 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1132 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1137 sta = mesh_sta_info_get(sdata, mgmt->sa, elems); in mesh_process_plink_frame()
1138 if (!sta) { in mesh_process_plink_frame()
1142 sta->mesh->plid = plid; in mesh_process_plink_frame()
1143 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1148 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1155 if (!sta->mesh->plid) in mesh_process_plink_frame()
1156 sta->mesh->plid = plid; in mesh_process_plink_frame()
1158 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1161 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()