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()
158 struct sta_info *sta; in mesh_set_ht_prot_mode() local
172 list_for_each_entry_rcu(sta, &local->sta_list, list) { in mesh_set_ht_prot_mode()
173 if (sdata != sta->sdata || in mesh_set_ht_prot_mode()
174 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
177 if (sta->sta.bandwidth > IEEE80211_STA_RX_BW_20) in mesh_set_ht_prot_mode()
180 if (!sta->sta.ht_cap.ht_supported) { in mesh_set_ht_prot_mode()
182 sta->sta.addr); in mesh_set_ht_prot_mode()
187 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr); in mesh_set_ht_prot_mode()
210 struct sta_info *sta, in mesh_plink_frame_tx() argument
272 put_unaligned_le16(sta->sta.aid, pos); in mesh_plink_frame_tx()
357 static u32 __mesh_plink_deactivate(struct sta_info *sta) in __mesh_plink_deactivate() argument
359 struct ieee80211_sub_if_data *sdata = sta->sdata; in __mesh_plink_deactivate()
362 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
364 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
366 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
368 ieee80211_mps_sta_status_update(sta); in __mesh_plink_deactivate()
369 changed |= ieee80211_mps_set_sta_local_pm(sta, in __mesh_plink_deactivate()
382 u32 mesh_plink_deactivate(struct sta_info *sta) in mesh_plink_deactivate() argument
384 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_deactivate()
387 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
388 changed = __mesh_plink_deactivate(sta); in mesh_plink_deactivate()
391 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
392 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE, in mesh_plink_deactivate()
393 sta->sta.addr, sta->mesh->llid, in mesh_plink_deactivate()
394 sta->mesh->plid, sta->mesh->reason); in mesh_plink_deactivate()
396 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
398 del_timer_sync(&sta->mesh->plink_timer); in mesh_plink_deactivate()
399 mesh_path_flush_by_nexthop(sta); in mesh_plink_deactivate()
408 struct sta_info *sta, in mesh_sta_info_init() argument
414 enum ieee80211_sta_rx_bandwidth bw = sta->sta.bandwidth; in mesh_sta_info_init()
423 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
424 sta->rx_stats.last_rx = jiffies; in mesh_sta_info_init()
427 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
428 sta->mesh->processed_beacon) in mesh_sta_info_init()
430 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
432 if (sta->sta.supp_rates[sband->band] != rates) in mesh_sta_info_init()
434 sta->sta.supp_rates[sband->band] = rates; in mesh_sta_info_init()
437 elems->ht_cap_elem, sta)) in mesh_sta_info_init()
441 elems->vht_cap_elem, sta); in mesh_sta_info_init()
444 elems->he_cap_len, sta); in mesh_sta_info_init()
446 if (bw != sta->sta.bandwidth) in mesh_sta_info_init()
453 if (sta->sta.bandwidth != IEEE80211_STA_RX_BW_20) in mesh_sta_info_init()
455 sta->sta.bandwidth = IEEE80211_STA_RX_BW_20; in mesh_sta_info_init()
458 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL)) in mesh_sta_info_init()
459 rate_control_rate_init(sta); in mesh_sta_info_init()
461 rate_control_rate_update(local, sband, sta, changed); in mesh_sta_info_init()
463 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
468 struct sta_info *sta; in mesh_allocate_aid() local
481 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list) in mesh_allocate_aid()
482 __set_bit(sta->sta.aid, aid_map); in mesh_allocate_aid()
497 struct sta_info *sta; in __mesh_sta_info_alloc() local
507 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL); in __mesh_sta_info_alloc()
508 if (!sta) in __mesh_sta_info_alloc()
511 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
512 sta->sta.wme = true; in __mesh_sta_info_alloc()
513 sta->sta.aid = aid; in __mesh_sta_info_alloc()
515 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH); in __mesh_sta_info_alloc()
516 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC); in __mesh_sta_info_alloc()
517 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED); in __mesh_sta_info_alloc()
519 return sta; in __mesh_sta_info_alloc()
527 struct sta_info *sta = NULL; in mesh_sta_info_alloc() local
545 sta = __mesh_sta_info_alloc(sdata, addr); in mesh_sta_info_alloc()
547 return sta; in mesh_sta_info_alloc()
566 struct sta_info *sta = NULL; in mesh_sta_info_get() local
569 sta = sta_info_get(sdata, addr); in mesh_sta_info_get()
570 if (sta) { in mesh_sta_info_get()
571 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
575 sta = mesh_sta_info_alloc(sdata, addr, elems, rx_status); in mesh_sta_info_get()
576 if (!sta) { in mesh_sta_info_get()
581 mesh_sta_info_init(sdata, sta, elems); in mesh_sta_info_get()
583 if (sta_info_insert_rcu(sta)) in mesh_sta_info_get()
587 return sta; in mesh_sta_info_get()
605 struct sta_info *sta; in mesh_neighbour_update() local
608 sta = mesh_sta_info_get(sdata, hw_addr, elems, rx_status); in mesh_neighbour_update()
609 if (!sta) in mesh_neighbour_update()
612 sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form & in mesh_neighbour_update()
616 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
619 rssi_threshold_check(sdata, sta)) in mesh_neighbour_update()
620 changed = mesh_plink_open(sta); in mesh_neighbour_update()
622 ieee80211_mps_frame_release(sta, elems); in mesh_neighbour_update()
631 struct sta_info *sta; in mesh_plink_timer() local
642 sta = mesh->plink_sta; in mesh_plink_timer()
644 if (sta->sdata->local->quiescing) in mesh_plink_timer()
647 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
654 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
655 mpl_dbg(sta->sdata, in mesh_plink_timer()
657 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
658 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
663 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
664 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
665 mpl_dbg(sta->sdata, in mesh_plink_timer()
667 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
668 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
672 mpl_dbg(sta->sdata, in mesh_plink_timer()
674 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
675 sdata = sta->sdata; in mesh_plink_timer()
678 switch (sta->mesh->plink_state) { in mesh_plink_timer()
682 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
684 mpl_dbg(sta->sdata, in mesh_plink_timer()
686 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
687 sta->mesh->plink_timeout); in mesh_plink_timer()
689 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
690 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
691 ++sta->mesh->plink_retries; in mesh_plink_timer()
692 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
702 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
703 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_timer()
708 del_timer(&sta->mesh->plink_timer); in mesh_plink_timer()
709 mesh_plink_fsm_restart(sta); in mesh_plink_timer()
714 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
716 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_timer()
717 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
720 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout) in mesh_plink_timer_set() argument
722 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
723 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout)); in mesh_plink_timer_set()
731 struct sta_info *sta; in llid_in_use() local
734 list_for_each_entry_rcu(sta, &local->sta_list, list) { in llid_in_use()
735 if (sdata != sta->sdata) in llid_in_use()
738 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
759 u32 mesh_plink_open(struct sta_info *sta) in mesh_plink_open() argument
761 struct ieee80211_sub_if_data *sdata = sta->sdata; in mesh_plink_open()
764 if (!test_sta_flag(sta, WLAN_STA_AUTH)) in mesh_plink_open()
767 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
768 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
769 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
770 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
771 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
774 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
775 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
776 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
779 sta->sta.addr); in mesh_plink_open()
784 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN, in mesh_plink_open()
785 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
789 u32 mesh_plink_block(struct sta_info *sta) in mesh_plink_block() argument
793 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
794 changed = __mesh_plink_deactivate(sta); in mesh_plink_block()
795 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
796 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
797 mesh_path_flush_by_nexthop(sta); in mesh_plink_block()
803 struct sta_info *sta, in mesh_plink_close() argument
810 sta->mesh->reason = reason; in mesh_plink_close()
811 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
812 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout); in mesh_plink_close()
816 struct sta_info *sta) in mesh_plink_establish() argument
821 del_timer(&sta->mesh->plink_timer); in mesh_plink_establish()
822 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
826 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
827 ieee80211_mps_sta_status_update(sta); in mesh_plink_establish()
828 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode); in mesh_plink_establish()
842 struct sta_info *sta, enum plink_event event) in mesh_plink_fsm() argument
849 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr, in mesh_plink_fsm()
850 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
852 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
853 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
857 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
860 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
861 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
862 mesh_plink_timer_set(sta, in mesh_plink_fsm()
878 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
883 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
887 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
888 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout); in mesh_plink_fsm()
899 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
906 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
917 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
921 changed |= mesh_plink_establish(sdata, sta); in mesh_plink_fsm()
931 changed |= __mesh_plink_deactivate(sta); in mesh_plink_fsm()
934 mesh_plink_close(sdata, sta, event); in mesh_plink_fsm()
948 del_timer(&sta->mesh->plink_timer); in mesh_plink_fsm()
949 mesh_plink_fsm_restart(sta); in mesh_plink_fsm()
967 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
969 mesh_path_flush_by_nexthop(sta); in mesh_plink_fsm()
971 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr, in mesh_plink_fsm()
972 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
973 sta->mesh->reason); in mesh_plink_fsm()
977 mesh_plink_frame_tx(sdata, sta, in mesh_plink_fsm()
979 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
980 sta->mesh->plid, 0); in mesh_plink_fsm()
1002 struct sta_info *sta, in mesh_plink_get_event() argument
1015 if (!matches_local && !sta) { in mesh_plink_get_event()
1020 if (!sta) { in mesh_plink_get_event()
1035 if (!test_sta_flag(sta, WLAN_STA_AUTH)) { in mesh_plink_get_event()
1039 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
1048 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1057 sta->mesh->llid != llid || in mesh_plink_get_event()
1058 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1064 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1075 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1077 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1098 struct sta_info *sta; in mesh_process_plink_frame() local
1145 sta = sta_info_get(sdata, mgmt->sa); in mesh_process_plink_frame()
1148 !rssi_threshold_check(sdata, sta)) { in mesh_process_plink_frame()
1155 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid); in mesh_process_plink_frame()
1160 sta = mesh_sta_info_get(sdata, mgmt->sa, elems, rx_status); in mesh_process_plink_frame()
1161 if (!sta) { in mesh_process_plink_frame()
1165 sta->mesh->plid = plid; in mesh_process_plink_frame()
1166 } else if (!sta && event == OPN_RJCT) { in mesh_process_plink_frame()
1171 } else if (!sta || event == PLINK_UNDEFINED) { in mesh_process_plink_frame()
1178 if (!sta->mesh->plid) in mesh_process_plink_frame()
1179 sta->mesh->plid = plid; in mesh_process_plink_frame()
1181 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1184 changed |= mesh_plink_fsm(sdata, sta, event); in mesh_process_plink_frame()