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()
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.deflink.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
182 if (!sta->sta.deflink.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
281 put_unaligned_le16(sta->sta.aid, pos); in mesh_plink_frame_tx()
369 static u64 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
371 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
374 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
376 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
378 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
380 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
381 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
394 u64 mesh_plink_deactivate(struct sta_info *sta) in mesh_plink_deactivate() argument
396 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_deactivate()
399 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
400 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
403 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
404 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, in mesh_plink_deactivate()
405 sta->sta.addr, sta->mesh->llid, in mesh_plink_deactivate()
406 sta->mesh->plid, sta->mesh->reason); in mesh_plink_deactivate()
408 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
410 del_timer_sync(&sta->mesh->plink_timer); in mesh_plink_deactivate()
411 mesh_path_flush_by_nexthop(sta); in mesh_plink_deactivate()
420 struct sta_info *sta, in mesh_sta_info_init() argument
426 enum ieee80211_sta_rx_bandwidth bw = sta->sta.deflink.bandwidth; in mesh_sta_info_init()
435 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
436 sta->deflink.rx_stats.last_rx = jiffies; in mesh_sta_info_init()
439 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
440 sta->mesh->processed_beacon) in mesh_sta_info_init()
442 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
444 if (sta->sta.deflink.supp_rates[sband->band] != rates) in mesh_sta_info_init()
446 sta->sta.deflink.supp_rates[sband->band] = rates; in mesh_sta_info_init()
450 &sta->deflink)) in mesh_sta_info_init()
455 &sta->deflink); in mesh_sta_info_init()
460 &sta->deflink); in mesh_sta_info_init()
465 &sta->deflink); in mesh_sta_info_init()
467 if (bw != sta->sta.deflink.bandwidth) in mesh_sta_info_init()
474 if (sta->sta.deflink.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
476 sta->sta.deflink.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
479 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) in mesh_sta_info_init()
480 rate_control_rate_init(sta); in mesh_sta_info_init()
482 rate_control_rate_update(local, sband, sta, 0, changed); in mesh_sta_info_init()
484 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
489 struct sta_info *sta; in mesh_allocate_aid() local
501 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) in mesh_allocate_aid()
502 __set_bit(sta->sta.aid, aid_map); in mesh_allocate_aid()
517 struct sta_info *sta; in __mesh_sta_info_alloc() local
527 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
528 if (!sta) in __mesh_sta_info_alloc()
531 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
532 sta->sta.wme = true; in __mesh_sta_info_alloc()
533 sta->sta.aid = aid; in __mesh_sta_info_alloc()
535 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
536 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
537 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
539 return sta; in __mesh_sta_info_alloc()
547 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
565 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
567 return sta; in mesh_sta_info_alloc()
586 struct sta_info *sta = NULL; in mesh_sta_info_get() local
589 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
590 if (sta) { in mesh_sta_info_get()
591 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
595 sta = mesh_sta_info_alloc(sdata, addr, elems, rx_status); in mesh_sta_info_get()
596 if (!sta) { in mesh_sta_info_get()
601 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
603 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
607 return sta; in mesh_sta_info_get()
625 struct sta_info *sta; in mesh_neighbour_update() local
628 sta = mesh_sta_info_get(sdata, hw_addr, elems, rx_status); in mesh_neighbour_update()
629 if (!sta) in mesh_neighbour_update()
632 sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form & in mesh_neighbour_update()
636 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
639 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
640 changed = mesh_plink_open(sta); in mesh_neighbour_update()
642 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
651 struct sta_info *sta; in mesh_plink_timer() local
662 sta = mesh->plink_sta; in mesh_plink_timer()
664 if (sta->sdata->local->quiescing) in mesh_plink_timer()
667 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
674 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
675 mpl_dbg(sta->sdata, in mesh_plink_timer()
677 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
678 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
683 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
684 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { 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()
692 mpl_dbg(sta->sdata, in mesh_plink_timer()
694 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
695 sdata = sta->sdata; in mesh_plink_timer()
698 switch (sta->mesh->plink_state) { in mesh_plink_timer()
702 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
704 mpl_dbg(sta->sdata, in mesh_plink_timer()
706 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
707 sta->mesh->plink_timeout); in mesh_plink_timer()
709 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
710 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
711 ++sta->mesh->plink_retries; in mesh_plink_timer()
712 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
722 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
723 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
728 del_timer(&sta->mesh->plink_timer); in mesh_plink_timer()
729 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
734 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
736 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_timer()
737 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
740 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
742 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
743 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout)); in mesh_plink_timer_set()
751 struct sta_info *sta; in llid_in_use() local
754 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
755 if (sdata != sta->sdata) in llid_in_use()
758 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
779 u64 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
781 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
784 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
787 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
788 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
789 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
790 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
791 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
794 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
795 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
796 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
799 sta->sta.addr); in mesh_plink_open()
804 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, in mesh_plink_open()
805 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
809 u64 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
813 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
814 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
815 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
816 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
817 mesh_path_flush_by_nexthop(sta); in mesh_plink_block()
823 struct sta_info *sta, in mesh_plink_close() argument
830 sta->mesh->reason = reason; in mesh_plink_close()
831 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
832 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
836 struct sta_info *sta) in mesh_plink_establish() argument
841 del_timer(&sta->mesh->plink_timer); in mesh_plink_establish()
842 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
846 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
847 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
848 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
862 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
869 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
870 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
872 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
873 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
877 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
880 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
881 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
882 mesh_plink_timer_set(sta, in mesh_plink_fsm()
898 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
903 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
907 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
908 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
919 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
926 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
937 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
941 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
951 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
954 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
968 del_timer(&sta->mesh->plink_timer); in mesh_plink_fsm()
969 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
987 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
989 mesh_path_flush_by_nexthop(sta); in mesh_plink_fsm()
991 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_fsm()
992 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
993 sta->mesh->reason); in mesh_plink_fsm()
997 mesh_plink_frame_tx(sdata, sta, in mesh_plink_fsm()
999 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
1000 sta->mesh->plid, 0); in mesh_plink_fsm()
1022 struct sta_info *sta, in mesh_plink_get_event() argument
1035 if (!matches_local && !sta) { in mesh_plink_get_event()
1040 if (!sta) { in mesh_plink_get_event()
1055 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
1059 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
1068 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1077 sta->mesh->llid != llid || in mesh_plink_get_event()
1078 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1084 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1095 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1097 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1118 struct sta_info *sta; in mesh_process_plink_frame() local
1165 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1168 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1175 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1180 sta = mesh_sta_info_get(sdata, mgmt->sa, elems, rx_status); in mesh_process_plink_frame()
1181 if (!sta) { in mesh_process_plink_frame()
1185 sta->mesh->plid = plid; in mesh_process_plink_frame()
1186 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1191 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1198 if (!sta->mesh->plid) in mesh_process_plink_frame()
1199 sta->mesh->plid = plid; in mesh_process_plink_frame()
1201 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1204 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()