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