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()
98 struct sta_info *sta; in mesh_set_short_slot_time() local
118 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_short_slot_time()
119 if (sdata != sta->sdata || in mesh_set_short_slot_time()
120 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_short_slot_time()
124 if (erp_rates & sta->sta.supp_rates[band]) in mesh_set_short_slot_time()
154 struct sta_info *sta; in mesh_set_ht_prot_mode() local
168 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_ht_prot_mode()
169 if (sdata != sta->sdata || in mesh_set_ht_prot_mode()
170 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
173 if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
176 if (!sta->sta.ht_cap.ht_supported) { in mesh_set_ht_prot_mode()
178 sta->sta.addr); in mesh_set_ht_prot_mode()
183 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); in mesh_set_ht_prot_mode()
206 struct sta_info *sta, in mesh_plink_frame_tx() argument
258 put_unaligned_le16(sta->sta.aid, pos); in mesh_plink_frame_tx()
339 static u32 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
341 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
344 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
346 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
348 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
349 mesh_path_flush_by_nexthop(sta); in __mesh_plink_deactivate()
351 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
352 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
365 u32 mesh_plink_deactivate(struct sta_info *sta) in mesh_plink_deactivate() argument
367 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_deactivate()
370 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
371 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
372 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
373 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, in mesh_plink_deactivate()
374 sta->sta.addr, sta->mesh->llid, sta->mesh->plid, in mesh_plink_deactivate()
375 sta->mesh->reason); in mesh_plink_deactivate()
376 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
382 struct sta_info *sta, in mesh_sta_info_init() argument
389 enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth; in mesh_sta_info_init()
394 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
395 sta->rx_stats.last_rx = jiffies; in mesh_sta_info_init()
398 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
399 sta->mesh->processed_beacon) in mesh_sta_info_init()
401 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
403 if (sta->sta.supp_rates[band] != rates) in mesh_sta_info_init()
405 sta->sta.supp_rates[band] = rates; in mesh_sta_info_init()
408 elems->ht_cap_elem, sta)) in mesh_sta_info_init()
412 elems->vht_cap_elem, sta); in mesh_sta_info_init()
414 if (bw != sta->sta.bandwidth) in mesh_sta_info_init()
421 if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
423 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
427 rate_control_rate_init(sta); in mesh_sta_info_init()
429 rate_control_rate_update(local, sband, sta, changed); in mesh_sta_info_init()
431 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
436 struct sta_info *sta; in mesh_allocate_aid() local
449 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) in mesh_allocate_aid()
450 __set_bit(sta->sta.aid, aid_map); in mesh_allocate_aid()
465 struct sta_info *sta; in __mesh_sta_info_alloc() local
475 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
476 if (!sta) in __mesh_sta_info_alloc()
479 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
480 sta->sta.wme = true; in __mesh_sta_info_alloc()
481 sta->sta.aid = aid; in __mesh_sta_info_alloc()
483 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
484 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
485 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
487 return sta; in __mesh_sta_info_alloc()
494 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
504 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
506 return sta; in mesh_sta_info_alloc()
523 struct sta_info *sta = NULL; in mesh_sta_info_get() local
526 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
527 if (sta) { in mesh_sta_info_get()
528 mesh_sta_info_init(sdata, sta, elems, false); in mesh_sta_info_get()
532 sta = mesh_sta_info_alloc(sdata, addr, elems); in mesh_sta_info_get()
533 if (!sta) { in mesh_sta_info_get()
538 mesh_sta_info_init(sdata, sta, elems, true); in mesh_sta_info_get()
540 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
544 return sta; in mesh_sta_info_get()
560 struct sta_info *sta; in mesh_neighbour_update() local
563 sta = mesh_sta_info_get(sdata, hw_addr, elems); in mesh_neighbour_update()
564 if (!sta) in mesh_neighbour_update()
568 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
571 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
572 changed = mesh_plink_open(sta); in mesh_neighbour_update()
574 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
582 struct sta_info *sta; in mesh_plink_timer() local
593 sta = (struct sta_info *) data; in mesh_plink_timer()
595 if (sta->sdata->local->quiescing) in mesh_plink_timer()
598 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
605 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
606 mpl_dbg(sta->sdata, in mesh_plink_timer()
608 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
609 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
614 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
615 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
616 mpl_dbg(sta->sdata, in mesh_plink_timer()
618 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
619 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
623 mpl_dbg(sta->sdata, in mesh_plink_timer()
625 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
626 sdata = sta->sdata; in mesh_plink_timer()
629 switch (sta->mesh->plink_state) { in mesh_plink_timer()
633 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
635 mpl_dbg(sta->sdata, in mesh_plink_timer()
637 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
638 sta->mesh->plink_timeout); in mesh_plink_timer()
640 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
641 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
642 ++sta->mesh->plink_retries; in mesh_plink_timer()
643 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
653 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
654 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
659 del_timer(&sta->mesh->plink_timer); in mesh_plink_timer()
660 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
665 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
667 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_timer()
668 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
671 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
673 sta->mesh->plink_timer.expires = jiffies + msecs_to_jiffies(timeout); in mesh_plink_timer_set()
674 sta->mesh->plink_timer.data = (unsigned long) sta; in mesh_plink_timer_set()
675 sta->mesh->plink_timer.function = mesh_plink_timer; in mesh_plink_timer_set()
676 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
677 add_timer(&sta->mesh->plink_timer); in mesh_plink_timer_set()
685 struct sta_info *sta; in llid_in_use() local
688 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
689 if (sdata != sta->sdata) in llid_in_use()
692 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
713 u32 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
715 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
718 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
721 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
722 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
723 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
724 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
725 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
728 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
729 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
730 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
733 sta->sta.addr); in mesh_plink_open()
738 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, in mesh_plink_open()
739 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
743 u32 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
747 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
748 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
749 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
750 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
756 struct sta_info *sta, in mesh_plink_close() argument
763 sta->mesh->reason = reason; in mesh_plink_close()
764 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
765 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
769 struct sta_info *sta) in mesh_plink_establish() argument
774 del_timer(&sta->mesh->plink_timer); in mesh_plink_establish()
775 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
779 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
780 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
781 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
795 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
801 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
802 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
804 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
805 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
809 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
812 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
813 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
814 mesh_plink_timer_set(sta, in mesh_plink_fsm()
830 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
835 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
839 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
840 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
851 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
858 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
869 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
873 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
883 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
886 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
899 del_timer(&sta->mesh->plink_timer); in mesh_plink_fsm()
900 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
918 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
920 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_fsm()
921 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
922 sta->mesh->reason); in mesh_plink_fsm()
926 mesh_plink_frame_tx(sdata, sta, in mesh_plink_fsm()
928 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
929 sta->mesh->plid, 0); in mesh_plink_fsm()
951 struct sta_info *sta, in mesh_plink_get_event() argument
964 if (!matches_local && !sta) { in mesh_plink_get_event()
969 if (!sta) { in mesh_plink_get_event()
980 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
984 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
989 if (!sta) { in mesh_plink_get_event()
999 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1008 sta->mesh->llid != llid || in mesh_plink_get_event()
1009 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1015 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1026 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1028 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1048 struct sta_info *sta; in mesh_process_plink_frame() local
1095 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1098 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1105 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1110 sta = mesh_sta_info_get(sdata, mgmt->sa, elems); in mesh_process_plink_frame()
1111 if (!sta) { in mesh_process_plink_frame()
1115 sta->mesh->plid = plid; in mesh_process_plink_frame()
1116 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1121 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1128 if (!sta->mesh->plid) in mesh_process_plink_frame()
1129 sta->mesh->plid = plid; in mesh_process_plink_frame()
1131 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1134 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()