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->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
122 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_short_slot_time()
123 if (sdata != sta->sdata || in mesh_set_short_slot_time()
124 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_short_slot_time()
128 if (erp_rates & sta->sta.supp_rates[sband->band]) in mesh_set_short_slot_time()
159 struct sta_info *sta; in mesh_set_ht_prot_mode() local
173 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_ht_prot_mode()
174 if (sdata != sta->sdata || in mesh_set_ht_prot_mode()
175 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
178 if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
181 if (!sta->sta.ht_cap.ht_supported) { in mesh_set_ht_prot_mode()
183 sta->sta.addr); in mesh_set_ht_prot_mode()
188 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); in mesh_set_ht_prot_mode()
211 struct sta_info *sta, in mesh_plink_frame_tx() argument
275 put_unaligned_le16(sta->sta.aid, pos); in mesh_plink_frame_tx()
361 static u32 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
363 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
366 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
368 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
370 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
372 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
373 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
386 u32 mesh_plink_deactivate(struct sta_info *sta) in mesh_plink_deactivate() argument
388 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_deactivate()
391 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
392 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
395 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
396 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, in mesh_plink_deactivate()
397 sta->sta.addr, sta->mesh->llid, in mesh_plink_deactivate()
398 sta->mesh->plid, sta->mesh->reason); in mesh_plink_deactivate()
400 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
402 del_timer_sync(&sta->mesh->plink_timer); in mesh_plink_deactivate()
403 mesh_path_flush_by_nexthop(sta); in mesh_plink_deactivate()
412 struct sta_info *sta, in mesh_sta_info_init() argument
418 enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth; in mesh_sta_info_init()
427 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
428 sta->rx_stats.last_rx = jiffies; in mesh_sta_info_init()
431 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
432 sta->mesh->processed_beacon) in mesh_sta_info_init()
434 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
436 if (sta->sta.supp_rates[sband->band] != rates) in mesh_sta_info_init()
438 sta->sta.supp_rates[sband->band] = rates; in mesh_sta_info_init()
441 elems->ht_cap_elem, sta)) in mesh_sta_info_init()
445 elems->vht_cap_elem, sta); in mesh_sta_info_init()
450 sta); in mesh_sta_info_init()
452 if (bw != sta->sta.bandwidth) in mesh_sta_info_init()
459 if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
461 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
464 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) in mesh_sta_info_init()
465 rate_control_rate_init(sta); in mesh_sta_info_init()
467 rate_control_rate_update(local, sband, sta, changed); in mesh_sta_info_init()
469 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
474 struct sta_info *sta; in mesh_allocate_aid() local
487 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) in mesh_allocate_aid()
488 __set_bit(sta->sta.aid, aid_map); in mesh_allocate_aid()
503 struct sta_info *sta; in __mesh_sta_info_alloc() local
513 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
514 if (!sta) in __mesh_sta_info_alloc()
517 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
518 sta->sta.wme = true; in __mesh_sta_info_alloc()
519 sta->sta.aid = aid; in __mesh_sta_info_alloc()
521 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
522 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
523 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
525 return sta; in __mesh_sta_info_alloc()
533 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
551 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
553 return sta; in mesh_sta_info_alloc()
572 struct sta_info *sta = NULL; in mesh_sta_info_get() local
575 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
576 if (sta) { in mesh_sta_info_get()
577 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
581 sta = mesh_sta_info_alloc(sdata, addr, elems, rx_status); in mesh_sta_info_get()
582 if (!sta) { in mesh_sta_info_get()
587 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
589 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
593 return sta; in mesh_sta_info_get()
611 struct sta_info *sta; in mesh_neighbour_update() local
614 sta = mesh_sta_info_get(sdata, hw_addr, elems, rx_status); in mesh_neighbour_update()
615 if (!sta) in mesh_neighbour_update()
618 sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form & in mesh_neighbour_update()
622 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
625 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
626 changed = mesh_plink_open(sta); in mesh_neighbour_update()
628 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
637 struct sta_info *sta; in mesh_plink_timer() local
648 sta = mesh->plink_sta; in mesh_plink_timer()
650 if (sta->sdata->local->quiescing) in mesh_plink_timer()
653 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
660 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
661 mpl_dbg(sta->sdata, in mesh_plink_timer()
663 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
664 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
669 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
670 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
671 mpl_dbg(sta->sdata, in mesh_plink_timer()
673 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
674 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
678 mpl_dbg(sta->sdata, in mesh_plink_timer()
680 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
681 sdata = sta->sdata; in mesh_plink_timer()
684 switch (sta->mesh->plink_state) { in mesh_plink_timer()
688 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
690 mpl_dbg(sta->sdata, in mesh_plink_timer()
692 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
693 sta->mesh->plink_timeout); in mesh_plink_timer()
695 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
696 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
697 ++sta->mesh->plink_retries; in mesh_plink_timer()
698 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
708 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
709 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
714 del_timer(&sta->mesh->plink_timer); in mesh_plink_timer()
715 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
720 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
722 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_timer()
723 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
726 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
728 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
729 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout)); in mesh_plink_timer_set()
737 struct sta_info *sta; in llid_in_use() local
740 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
741 if (sdata != sta->sdata) in llid_in_use()
744 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
765 u32 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
767 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
770 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
773 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
774 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
775 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
776 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
777 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
780 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
781 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
782 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
785 sta->sta.addr); in mesh_plink_open()
790 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, in mesh_plink_open()
791 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
795 u32 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
799 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
800 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
801 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
802 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
803 mesh_path_flush_by_nexthop(sta); in mesh_plink_block()
809 struct sta_info *sta, in mesh_plink_close() argument
816 sta->mesh->reason = reason; in mesh_plink_close()
817 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
818 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
822 struct sta_info *sta) in mesh_plink_establish() argument
827 del_timer(&sta->mesh->plink_timer); in mesh_plink_establish()
828 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
832 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
833 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
834 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
848 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
855 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
856 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
858 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
859 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
863 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
866 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
867 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
868 mesh_plink_timer_set(sta, in mesh_plink_fsm()
884 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
889 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
893 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
894 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
905 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
912 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
923 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
927 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
937 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
940 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
954 del_timer(&sta->mesh->plink_timer); in mesh_plink_fsm()
955 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
973 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
975 mesh_path_flush_by_nexthop(sta); in mesh_plink_fsm()
977 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_fsm()
978 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
979 sta->mesh->reason); in mesh_plink_fsm()
983 mesh_plink_frame_tx(sdata, sta, in mesh_plink_fsm()
985 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
986 sta->mesh->plid, 0); in mesh_plink_fsm()
1008 struct sta_info *sta, in mesh_plink_get_event() argument
1021 if (!matches_local && !sta) { in mesh_plink_get_event()
1026 if (!sta) { in mesh_plink_get_event()
1041 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
1045 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
1054 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1063 sta->mesh->llid != llid || in mesh_plink_get_event()
1064 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1070 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1081 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1083 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1104 struct sta_info *sta; in mesh_process_plink_frame() local
1151 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1154 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1161 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1166 sta = mesh_sta_info_get(sdata, mgmt->sa, elems, rx_status); in mesh_process_plink_frame()
1167 if (!sta) { in mesh_process_plink_frame()
1171 sta->mesh->plid = plid; in mesh_process_plink_frame()
1172 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1177 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1184 if (!sta->mesh->plid) in mesh_process_plink_frame()
1185 sta->mesh->plid = plid; in mesh_process_plink_frame()
1187 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1190 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()