Lines Matching refs:sta

57 /* We only need a valid sta if user configured a minimum rssi_threshold. */
59 struct sta_info *sta)
63 (sta &&
64 (s8)-ewma_signal_read(&sta->deflink.rx_stats_avg.signal) >
71 * @sta: mesh peer link to restart
73 * Locking: this function must be called holding sta->mesh->plink_lock
75 static inline void mesh_plink_fsm_restart(struct sta_info *sta)
77 lockdep_assert_held(&sta->mesh->plink_lock);
78 sta->mesh->plink_state = NL80211_PLINK_LISTEN;
79 sta->mesh->llid = sta->mesh->plid = sta->mesh->reason = 0;
80 sta->mesh->plink_retries = 0;
97 struct sta_info *sta;
123 list_for_each_entry_rcu(sta, &local->sta_list, list) {
124 if (sdata != sta->sdata ||
125 sta->mesh->plink_state != NL80211_PLINK_ESTAB)
129 if (erp_rates & sta->sta.deflink.supp_rates[sband->band])
160 struct sta_info *sta;
174 list_for_each_entry_rcu(sta, &local->sta_list, list) {
175 if (sdata != sta->sdata ||
176 sta->mesh->plink_state != NL80211_PLINK_ESTAB)
179 if (sta->sta.deflink.bandwidth > IEEE80211_STA_RX_BW_20)
182 if (!sta->sta.deflink.ht_cap.ht_supported) {
183 mpl_dbg(sdata, "nonHT sta (%pM) is present\n",
184 sta->sta.addr);
189 mpl_dbg(sdata, "HT20 sta (%pM) is present\n", sta->sta.addr);
212 struct sta_info *sta,
281 put_unaligned_le16(sta->sta.aid, pos);
360 * @sta: mesh peer link to deactivate
367 * Locking: the caller must hold sta->mesh->plink_lock
369 static u64 __mesh_plink_deactivate(struct sta_info *sta)
371 struct ieee80211_sub_if_data *sdata = sta->sdata;
374 lockdep_assert_held(&sta->mesh->plink_lock);
376 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
378 sta->mesh->plink_state = NL80211_PLINK_BLOCKED;
380 ieee80211_mps_sta_status_update(sta);
381 changed |= ieee80211_mps_set_sta_local_pm(sta,
390 * @sta: mesh peer link to deactivate
394 u64 mesh_plink_deactivate(struct sta_info *sta)
396 struct ieee80211_sub_if_data *sdata = sta->sdata;
399 spin_lock_bh(&sta->mesh->plink_lock);
400 changed = __mesh_plink_deactivate(sta);
403 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED;
404 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_CLOSE,
405 sta->sta.addr, sta->mesh->llid,
406 sta->mesh->plid, sta->mesh->reason);
408 spin_unlock_bh(&sta->mesh->plink_lock);
410 del_timer_sync(&sta->mesh->plink_timer);
411 mesh_path_flush_by_nexthop(sta);
413 /* make sure no readers can access nexthop sta from here on */
420 struct sta_info *sta,
426 enum ieee80211_sta_rx_bandwidth bw = sta->sta.deflink.bandwidth;
435 spin_lock_bh(&sta->mesh->plink_lock);
436 sta->deflink.rx_stats.last_rx = jiffies;
439 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB &&
440 sta->mesh->processed_beacon)
442 sta->mesh->processed_beacon = true;
444 if (sta->sta.deflink.supp_rates[sband->band] != rates)
446 sta->sta.deflink.supp_rates[sband->band] = rates;
450 &sta->deflink))
455 &sta->deflink);
460 &sta->deflink);
465 &sta->deflink);
467 if (bw != sta->sta.deflink.bandwidth)
474 if (sta->sta.deflink.bandwidth != IEEE80211_STA_RX_BW_20)
476 sta->sta.deflink.bandwidth = IEEE80211_STA_RX_BW_20;
479 if (!test_sta_flag(sta, WLAN_STA_RATE_CONTROL))
480 rate_control_rate_init(sta);
482 rate_control_rate_update(local, sband, sta, 0, changed);
484 spin_unlock_bh(&sta->mesh->plink_lock);
489 struct sta_info *sta;
501 list_for_each_entry_rcu(sta, &sdata->local->sta_list, list)
502 __set_bit(sta->sta.aid, aid_map);
517 struct sta_info *sta;
527 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL);
528 if (!sta)
531 sta->mesh->plink_state = NL80211_PLINK_LISTEN;
532 sta->sta.wme = true;
533 sta->sta.aid = aid;
535 sta_info_pre_move_state(sta, IEEE80211_STA_AUTH);
536 sta_info_pre_move_state(sta, IEEE80211_STA_ASSOC);
537 sta_info_pre_move_state(sta, IEEE80211_STA_AUTHORIZED);
539 return sta;
547 struct sta_info *sta = NULL;
565 sta = __mesh_sta_info_alloc(sdata, addr);
567 return sta;
571 * mesh_sta_info_get - return mesh sta info entry for @addr.
586 struct sta_info *sta = NULL;
589 sta = sta_info_get(sdata, addr);
590 if (sta) {
591 mesh_sta_info_init(sdata, sta, elems);
595 sta = mesh_sta_info_alloc(sdata, addr, elems, rx_status);
596 if (!sta) {
601 mesh_sta_info_init(sdata, sta, elems);
603 if (sta_info_insert_rcu(sta))
607 return sta;
625 struct sta_info *sta;
628 sta = mesh_sta_info_get(sdata, hw_addr, elems, rx_status);
629 if (!sta)
632 sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form &
636 sta->mesh->plink_state == NL80211_PLINK_LISTEN &&
639 rssi_threshold_check(sdata, sta))
640 changed = mesh_plink_open(sta);
642 ieee80211_mps_frame_release(sta, elems);
651 struct sta_info *sta;
662 sta = mesh->plink_sta;
664 if (sta->sdata->local->quiescing)
667 spin_lock_bh(&sta->mesh->plink_lock);
674 if (time_before(jiffies, sta->mesh->plink_timer.expires)) {
675 mpl_dbg(sta->sdata,
677 sta->sta.addr, mplstates[sta->mesh->plink_state]);
678 spin_unlock_bh(&sta->mesh->plink_lock);
683 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN ||
684 sta->mesh->plink_state == NL80211_PLINK_ESTAB) {
685 mpl_dbg(sta->sdata,
687 sta->sta.addr, mplstates[sta->mesh->plink_state]);
688 spin_unlock_bh(&sta->mesh->plink_lock);
692 mpl_dbg(sta->sdata,
694 sta->sta.addr, mplstates[sta->mesh->plink_state]);
695 sdata = sta->sdata;
698 switch (sta->mesh->plink_state) {
702 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) {
704 mpl_dbg(sta->sdata,
706 sta->sta.addr, sta->mesh->plink_retries,
707 sta->mesh->plink_timeout);
709 sta->mesh->plink_timeout = sta->mesh->plink_timeout +
710 rand % sta->mesh->plink_timeout;
711 ++sta->mesh->plink_retries;
712 mod_plink_timer(sta, sta->mesh->plink_timeout);
722 sta->mesh->plink_state = NL80211_PLINK_HOLDING;
723 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
728 del_timer(&sta->mesh->plink_timer);
729 mesh_plink_fsm_restart(sta);
734 spin_unlock_bh(&sta->mesh->plink_lock);
736 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr,
737 sta->mesh->llid, sta->mesh->plid, reason);
740 static inline void mesh_plink_timer_set(struct sta_info *sta, u32 timeout)
742 sta->mesh->plink_timeout = timeout;
743 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout));
751 struct sta_info *sta;
754 list_for_each_entry_rcu(sta, &local->sta_list, list) {
755 if (sdata != sta->sdata)
758 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) {
779 u64 mesh_plink_open(struct sta_info *sta)
781 struct ieee80211_sub_if_data *sdata = sta->sdata;
784 if (!test_sta_flag(sta, WLAN_STA_AUTH))
787 spin_lock_bh(&sta->mesh->plink_lock);
788 sta->mesh->llid = mesh_get_new_llid(sdata);
789 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN &&
790 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) {
791 spin_unlock_bh(&sta->mesh->plink_lock);
794 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT;
795 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout);
796 spin_unlock_bh(&sta->mesh->plink_lock);
799 sta->sta.addr);
804 mesh_plink_frame_tx(sdata, sta, WLAN_SP_MESH_PEERING_OPEN,
805 sta->sta.addr, sta->mesh->llid, 0, 0);
809 u64 mesh_plink_block(struct sta_info *sta)
813 spin_lock_bh(&sta->mesh->plink_lock);
814 changed = __mesh_plink_deactivate(sta);
815 sta->mesh->plink_state = NL80211_PLINK_BLOCKED;
816 spin_unlock_bh(&sta->mesh->plink_lock);
817 mesh_path_flush_by_nexthop(sta);
823 struct sta_info *sta,
830 sta->mesh->reason = reason;
831 sta->mesh->plink_state = NL80211_PLINK_HOLDING;
832 mod_plink_timer(sta, mshcfg->dot11MeshHoldingTimeout);
836 struct sta_info *sta)
841 del_timer(&sta->mesh->plink_timer);
842 sta->mesh->plink_state = NL80211_PLINK_ESTAB;
846 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr);
847 ieee80211_mps_sta_status_update(sta);
848 changed |= ieee80211_mps_set_sta_local_pm(sta, mshcfg->power_mode);
853 * mesh_plink_fsm - step @sta MPM based on @event
856 * @sta: mesh neighbor
862 struct sta_info *sta, enum plink_event event)
869 mpl_dbg(sdata, "peer %pM in state %s got event %s\n", sta->sta.addr,
870 mplstates[sta->mesh->plink_state], mplevents[event]);
872 spin_lock_bh(&sta->mesh->plink_lock);
873 switch (sta->mesh->plink_state) {
877 mesh_plink_fsm_restart(sta);
880 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD;
881 sta->mesh->llid = mesh_get_new_llid(sdata);
882 mesh_plink_timer_set(sta,
898 mesh_plink_close(sdata, sta, event);
903 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD;
907 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD;
908 mod_plink_timer(sta, mshcfg->dot11MeshConfirmTimeout);
919 mesh_plink_close(sdata, sta, event);
926 changed |= mesh_plink_establish(sdata, sta);
937 mesh_plink_close(sdata, sta, event);
941 changed |= mesh_plink_establish(sdata, sta);
951 changed |= __mesh_plink_deactivate(sta);
954 mesh_plink_close(sdata, sta, event);
968 del_timer(&sta->mesh->plink_timer);
969 mesh_plink_fsm_restart(sta);
987 spin_unlock_bh(&sta->mesh->plink_lock);
989 mesh_path_flush_by_nexthop(sta);
991 mesh_plink_frame_tx(sdata, sta, action, sta->sta.addr,
992 sta->mesh->llid, sta->mesh->plid,
993 sta->mesh->reason);
997 mesh_plink_frame_tx(sdata, sta,
999 sta->sta.addr, sta->mesh->llid,
1000 sta->mesh->plid, 0);
1011 * @sta: peer, leave NULL if processing a frame from a new suitable peer
1017 * Return: new peering event for @sta, but PLINK_UNDEFINED should be treated as
1022 struct sta_info *sta,
1035 if (!matches_local && !sta) {
1040 if (!sta) {
1055 if (!test_sta_flag(sta, WLAN_STA_AUTH)) {
1059 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED)
1068 (sta->mesh->plid && sta->mesh->plid != plid))
1077 sta->mesh->llid != llid ||
1078 (sta->mesh->plid && sta->mesh->plid != plid))
1084 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB)
1087 * per sta are not supported, it is necessary in
1095 else if (sta->mesh->plid != plid)
1097 else if (ie_len == 8 && sta->mesh->llid != llid)
1118 struct sta_info *sta;
1162 /* WARNING: Only for sta pointer, is dropped & re-acquired */
1165 sta = sta_info_get(sdata, mgmt->sa);
1168 !rssi_threshold_check(sdata, sta)) {
1175 event = mesh_plink_get_event(sdata, sta, elems, ftype, llid, plid);
1179 /* allocate sta entry if necessary and update info */
1180 sta = mesh_sta_info_get(sdata, mgmt->sa, elems, rx_status);
1181 if (!sta) {
1185 sta->mesh->plid = plid;
1186 } else if (!sta && event == OPN_RJCT) {
1191 } else if (!sta || event == PLINK_UNDEFINED) {
1198 if (!sta->mesh->plid)
1199 sta->mesh->plid = plid;
1201 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt));
1204 changed |= mesh_plink_fsm(sdata, sta, event);