Lines Matching full:mesh

14 #include "mesh.h"
20 #define mod_plink_timer(s, t) (mod_timer(&s->mesh->plink_timer, \
61 s32 rssi_threshold = sdata->u.mesh.mshcfg.rssi_threshold; in rssi_threshold_check()
69 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
71 * @sta: mesh peer link to restart
73 * Locking: this function must be called holding sta->mesh->plink_lock
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()
86 * The standard indirectly mandates mesh STAs to turn off short slot time by
88 * can't be sneaky about it. Enable short slot time if all mesh STAs in the
125 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_short_slot_time()
148 * @sdata: the (mesh) interface to handle
151 * mesh STA in a MBSS. Three HT protection modes are supported for now, non-HT
178 sta->mesh->plink_state != NL80211_PLINK_ESTAB) in mesh_set_ht_prot_mode()
208 sdata->u.mesh.mshcfg.ht_opmode = ht_opmode; in mesh_set_ht_prot_mode()
237 2 + sdata->u.mesh.mesh_id_len + in mesh_plink_frame_tx()
251 sdata->u.mesh.ie_len); in mesh_plink_frame_tx()
299 /* Add Mesh Peering Management element */ in mesh_plink_frame_tx()
362 * __mesh_plink_deactivate - deactivate mesh peer link
364 * @sta: mesh peer link to deactivate
366 * Mesh paths with this peer as next hop should be flushed
371 * Locking: the caller must hold sta->mesh->plink_lock
378 lockdep_assert_held(&sta->mesh->plink_lock); in __mesh_plink_deactivate()
380 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in __mesh_plink_deactivate()
382 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in __mesh_plink_deactivate()
392 * mesh_plink_deactivate - deactivate mesh peer link
394 * @sta: mesh peer link to deactivate
396 * All mesh paths with this peer as next hop will be flushed
405 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
408 if (!sdata->u.mesh.user_mpm) { in mesh_plink_deactivate()
409 sta->mesh->reason = WLAN_REASON_MESH_PEER_CANCELED; in mesh_plink_deactivate()
411 sta->sta.addr, sta->mesh->llid, in mesh_plink_deactivate()
412 sta->mesh->plid, sta->mesh->reason); in mesh_plink_deactivate()
414 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_deactivate()
415 if (!sdata->u.mesh.user_mpm) in mesh_plink_deactivate()
416 timer_delete_sync(&sta->mesh->plink_timer); in mesh_plink_deactivate()
440 spin_lock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
444 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB && in mesh_sta_info_init()
445 sta->mesh->processed_beacon) in mesh_sta_info_init()
447 sta->mesh->processed_beacon = true; in mesh_sta_info_init()
490 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_sta_info_init()
537 sta->mesh->plink_state = NL80211_PLINK_LISTEN; in __mesh_sta_info_alloc()
556 if (sdata->u.mesh.user_mpm || in mesh_sta_info_alloc()
557 sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED) { in mesh_sta_info_alloc()
577 * mesh_sta_info_get - return mesh sta info entry for @addr.
581 * @elems: IEs from beacon or mesh peering frame.
617 * mesh_neighbour_update - update or initialize new mesh neighbor.
621 * @elems: IEs from beacon or mesh peering frame
638 sta->mesh->connected_to_gate = elems->mesh_config->meshconf_form & in mesh_neighbour_update()
642 sta->mesh->plink_state == NL80211_PLINK_LISTEN && in mesh_neighbour_update()
643 sdata->u.mesh.accepting_plinks && in mesh_neighbour_update()
644 sdata->u.mesh.mshcfg.auto_open_plinks && in mesh_neighbour_update()
656 struct mesh_sta *mesh = timer_container_of(mesh, t, plink_timer); in mesh_plink_timer() local
668 sta = mesh->plink_sta; in mesh_plink_timer()
673 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
680 if (time_before(jiffies, sta->mesh->plink_timer.expires)) { in mesh_plink_timer()
683 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
684 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
689 if (sta->mesh->plink_state == NL80211_PLINK_LISTEN || in mesh_plink_timer()
690 sta->mesh->plink_state == NL80211_PLINK_ESTAB) { in mesh_plink_timer()
693 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
694 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
699 "Mesh plink timer for %pM fired on state %s\n", in mesh_plink_timer()
700 sta->sta.addr, mplstates[sta->mesh->plink_state]); in mesh_plink_timer()
702 mshcfg = &sdata->u.mesh.mshcfg; in mesh_plink_timer()
704 switch (sta->mesh->plink_state) { in mesh_plink_timer()
708 if (sta->mesh->plink_retries < mshcfg->dot11MeshMaxRetries) { in mesh_plink_timer()
711 "Mesh plink for %pM (retry, timeout): %d %d\n", in mesh_plink_timer()
712 sta->sta.addr, sta->mesh->plink_retries, in mesh_plink_timer()
713 sta->mesh->plink_timeout); in mesh_plink_timer()
715 sta->mesh->plink_timeout = sta->mesh->plink_timeout + in mesh_plink_timer()
716 rand % sta->mesh->plink_timeout; in mesh_plink_timer()
717 ++sta->mesh->plink_retries; in mesh_plink_timer()
718 mod_plink_timer(sta, sta->mesh->plink_timeout); in mesh_plink_timer()
728 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_timer()
734 timer_delete(&sta->mesh->plink_timer); in mesh_plink_timer()
740 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_timer()
743 sta->mesh->llid, sta->mesh->plid, reason); in mesh_plink_timer()
748 sta->mesh->plink_timeout = timeout; in mesh_plink_timer_set()
749 mod_timer(&sta->mesh->plink_timer, jiffies + msecs_to_jiffies(timeout)); in mesh_plink_timer_set()
764 if (!memcmp(&sta->mesh->llid, &llid, sizeof(llid))) { in llid_in_use()
793 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
794 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_open()
795 if (sta->mesh->plink_state != NL80211_PLINK_LISTEN && in mesh_plink_open()
796 sta->mesh->plink_state != NL80211_PLINK_BLOCKED) { in mesh_plink_open()
797 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
800 sta->mesh->plink_state = NL80211_PLINK_OPN_SNT; in mesh_plink_open()
801 mesh_plink_timer_set(sta, sdata->u.mesh.mshcfg.dot11MeshRetryTimeout); in mesh_plink_open()
802 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_open()
804 "Mesh plink: starting establishment with %pM\n", in mesh_plink_open()
811 sta->sta.addr, sta->mesh->llid, 0, 0); in mesh_plink_open()
819 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
821 sta->mesh->plink_state = NL80211_PLINK_BLOCKED; in mesh_plink_block()
822 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_block()
832 struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg; in mesh_plink_close()
836 sta->mesh->reason = reason; in mesh_plink_close()
837 sta->mesh->plink_state = NL80211_PLINK_HOLDING; in mesh_plink_close()
844 struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg; in mesh_plink_establish()
847 timer_delete(&sta->mesh->plink_timer); in mesh_plink_establish()
848 sta->mesh->plink_state = NL80211_PLINK_ESTAB; in mesh_plink_establish()
852 mpl_dbg(sdata, "Mesh plink with %pM ESTABLISHED\n", sta->sta.addr); in mesh_plink_establish()
862 * @sta: mesh neighbor
870 struct mesh_config *mshcfg = &sdata->u.mesh.mshcfg; in mesh_plink_fsm()
876 mplstates[sta->mesh->plink_state], mplevents[event]); in mesh_plink_fsm()
878 spin_lock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
879 switch (sta->mesh->plink_state) { in mesh_plink_fsm()
886 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
887 sta->mesh->llid = mesh_get_new_llid(sdata); in mesh_plink_fsm()
909 sta->mesh->plink_state = NL80211_PLINK_OPN_RCVD; in mesh_plink_fsm()
913 sta->mesh->plink_state = NL80211_PLINK_CNF_RCVD; in mesh_plink_fsm()
974 timer_delete(&sta->mesh->plink_timer); in mesh_plink_fsm()
993 spin_unlock_bh(&sta->mesh->plink_lock); in mesh_plink_fsm()
998 sta->mesh->llid, sta->mesh->plid, in mesh_plink_fsm()
999 sta->mesh->reason); in mesh_plink_fsm()
1005 sta->sta.addr, sta->mesh->llid, in mesh_plink_fsm()
1006 sta->mesh->plid, 0); in mesh_plink_fsm()
1048 mpl_dbg(sdata, "Mesh plink: cls or cnf from unknown peer\n"); in mesh_plink_get_event()
1053 mpl_dbg(sdata, "Mesh plink error: no more free plinks\n"); in mesh_plink_get_event()
1062 mpl_dbg(sdata, "Mesh plink: Action frame from non-authed peer\n"); in mesh_plink_get_event()
1065 if (sta->mesh->plink_state == NL80211_PLINK_BLOCKED) in mesh_plink_get_event()
1074 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1083 sta->mesh->llid != llid || in mesh_plink_get_event()
1084 (sta->mesh->plid && sta->mesh->plid != plid)) in mesh_plink_get_event()
1090 if (sta->mesh->plink_state == NL80211_PLINK_ESTAB) in mesh_plink_get_event()
1101 else if (sta->mesh->plid != plid) in mesh_plink_get_event()
1103 else if (ie_len == 8 && sta->mesh->llid != llid) in mesh_plink_get_event()
1109 mpl_dbg(sdata, "Mesh plink: unknown frame subtype\n"); in mesh_plink_get_event()
1133 "Mesh plink: missing necessary peer link ie\n"); in mesh_process_plink_frame()
1138 sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) { in mesh_process_plink_frame()
1140 "Mesh plink: can't establish link with secure peer\n"); in mesh_process_plink_frame()
1150 "Mesh plink: incorrect plink ie length %d %d\n", in mesh_process_plink_frame()
1157 mpl_dbg(sdata, "Mesh plink: missing necessary ie\n"); in mesh_process_plink_frame()
1175 mpl_dbg(sdata, "Mesh plink: %pM does not meet rssi threshold\n", in mesh_process_plink_frame()
1188 mpl_dbg(sdata, "Mesh plink: failed to init peer!\n"); in mesh_process_plink_frame()
1191 sta->mesh->plid = plid; in mesh_process_plink_frame()
1204 if (!sta->mesh->plid) in mesh_process_plink_frame()
1205 sta->mesh->plid = plid; in mesh_process_plink_frame()
1207 sta->mesh->aid = get_unaligned_le16(PLINK_CNF_AID(mgmt)); in mesh_process_plink_frame()
1231 if (sdata->u.mesh.user_mpm) in mesh_rx_plink_frame()
1237 "Mesh plink: ignore frame from multicast address\n"); in mesh_rx_plink_frame()