2 * Copyright (c) 2008, 2009 open80211s Ltd.
3 * Author: Luis Carlos Cobo <luisca@cozybit.com>
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License version 2 as
7 * published by the Free Software Foundation.
10 #include <linux/kernel.h>
11 #include <linux/random.h>
12 #include "ieee80211_i.h"
16 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
17 #define mpl_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args)
19 #define mpl_dbg(fmt, args...) do { (void)(0); } while (0)
22 #define PLINK_GET_LLID(p) (p + 2)
23 #define PLINK_GET_PLID(p) (p + 4)
25 #define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \
26 jiffies + HZ * t / 1000))
28 #define dot11MeshMaxRetries(s) (s->u.mesh.mshcfg.dot11MeshMaxRetries)
29 #define dot11MeshRetryTimeout(s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout)
30 #define dot11MeshConfirmTimeout(s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout)
31 #define dot11MeshHoldingTimeout(s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout)
32 #define dot11MeshMaxPeerLinks(s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks)
46 static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
47 enum ieee80211_self_protected_actioncode action,
48 u8 *da, __le16 llid, __le16 plid, __le16 reason);
51 void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
53 atomic_inc(&sdata->u.mesh.mshstats.estab_plinks);
54 mesh_accept_plinks_update(sdata);
58 void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
60 atomic_dec(&sdata->u.mesh.mshstats.estab_plinks);
61 mesh_accept_plinks_update(sdata);
65 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
67 * @sta: mesh peer link to restart
69 * Locking: this function must be called holding sta->lock
71 static inline void mesh_plink_fsm_restart(struct sta_info *sta)
73 sta->plink_state = NL80211_PLINK_LISTEN;
74 sta->llid = sta->plid = sta->reason = 0;
75 sta->plink_retries = 0;
79 * NOTE: This is just an alias for sta_info_alloc(), see notes
80 * on it in the lifecycle management section!
82 static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
83 u8 *hw_addr, u32 rates)
85 struct ieee80211_local *local = sdata->local;
88 if (local->num_sta >= MESH_MAX_PLINKS)
91 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL);
95 set_sta_flag(sta, WLAN_STA_AUTH);
96 set_sta_flag(sta, WLAN_STA_AUTHORIZED);
97 set_sta_flag(sta, WLAN_STA_WME);
98 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
99 rate_control_rate_init(sta);
105 * __mesh_plink_deactivate - deactivate mesh peer link
107 * @sta: mesh peer link to deactivate
109 * All mesh paths with this peer as next hop will be flushed
111 * Locking: the caller must hold sta->lock
113 static bool __mesh_plink_deactivate(struct sta_info *sta)
115 struct ieee80211_sub_if_data *sdata = sta->sdata;
116 bool deactivated = false;
118 if (sta->plink_state == NL80211_PLINK_ESTAB) {
119 mesh_plink_dec_estab_count(sdata);
122 sta->plink_state = NL80211_PLINK_BLOCKED;
123 mesh_path_flush_by_nexthop(sta);
129 * mesh_plink_deactivate - deactivate mesh peer link
131 * @sta: mesh peer link to deactivate
133 * All mesh paths with this peer as next hop will be flushed
135 void mesh_plink_deactivate(struct sta_info *sta)
137 struct ieee80211_sub_if_data *sdata = sta->sdata;
140 spin_lock_bh(&sta->lock);
141 deactivated = __mesh_plink_deactivate(sta);
142 sta->reason = cpu_to_le16(WLAN_REASON_MESH_PEER_CANCELED);
143 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
144 sta->sta.addr, sta->llid, sta->plid,
146 spin_unlock_bh(&sta->lock);
149 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
152 static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
153 enum ieee80211_self_protected_actioncode action,
154 u8 *da, __le16 llid, __le16 plid, __le16 reason) {
155 struct ieee80211_local *local = sdata->local;
156 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400 +
157 sdata->u.mesh.ie_len);
158 struct ieee80211_mgmt *mgmt;
159 bool include_plid = false;
161 u16 peering_proto = 0;
166 skb_reserve(skb, local->hw.extra_tx_headroom);
167 /* 25 is the size of the common mgmt part (24) plus the size of the
168 * common action part (1)
170 mgmt = (struct ieee80211_mgmt *)
171 skb_put(skb, 25 + sizeof(mgmt->u.action.u.self_prot));
172 memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.self_prot));
173 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
174 IEEE80211_STYPE_ACTION);
175 memcpy(mgmt->da, da, ETH_ALEN);
176 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
177 memcpy(mgmt->bssid, sdata->vif.addr, ETH_ALEN);
178 mgmt->u.action.category = WLAN_CATEGORY_SELF_PROTECTED;
179 mgmt->u.action.u.self_prot.action_code = action;
181 if (action != WLAN_SP_MESH_PEERING_CLOSE) {
182 /* capability info */
183 pos = skb_put(skb, 2);
185 if (action == WLAN_SP_MESH_PEERING_CONFIRM) {
187 pos = skb_put(skb, 2);
188 memcpy(pos + 2, &plid, 2);
190 if (ieee80211_add_srates_ie(&sdata->vif, skb) ||
191 ieee80211_add_ext_srates_ie(&sdata->vif, skb) ||
192 mesh_add_rsn_ie(skb, sdata) ||
193 mesh_add_meshid_ie(skb, sdata) ||
194 mesh_add_meshconf_ie(skb, sdata))
196 } else { /* WLAN_SP_MESH_PEERING_CLOSE */
197 if (mesh_add_meshid_ie(skb, sdata))
201 /* Add Mesh Peering Management element */
203 case WLAN_SP_MESH_PEERING_OPEN:
205 case WLAN_SP_MESH_PEERING_CONFIRM:
209 case WLAN_SP_MESH_PEERING_CLOSE:
214 ie_len += 2; /* reason code */
220 if (WARN_ON(skb_tailroom(skb) < 2 + ie_len))
223 pos = skb_put(skb, 2 + ie_len);
224 *pos++ = WLAN_EID_PEER_MGMT;
226 memcpy(pos, &peering_proto, 2);
228 memcpy(pos, &llid, 2);
231 memcpy(pos, &plid, 2);
234 if (action == WLAN_SP_MESH_PEERING_CLOSE) {
235 memcpy(pos, &reason, 2);
238 if (mesh_add_vendor_ies(skb, sdata))
241 ieee80211_tx_skb(sdata, skb);
245 void mesh_neighbour_update(u8 *hw_addr, u32 rates,
246 struct ieee80211_sub_if_data *sdata,
247 struct ieee802_11_elems *elems)
249 struct ieee80211_local *local = sdata->local;
250 struct sta_info *sta;
254 sta = sta_info_get(sdata, hw_addr);
257 /* Userspace handles peer allocation when security is enabled
259 if (sdata->u.mesh.security & IEEE80211_MESH_SEC_AUTHED)
260 cfg80211_notify_new_peer_candidate(sdata->dev, hw_addr,
261 elems->ie_start, elems->total_len,
264 sta = mesh_plink_alloc(sdata, hw_addr, rates);
267 if (sta_info_insert_rcu(sta)) {
273 sta->last_rx = jiffies;
274 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
275 if (mesh_peer_accepts_plinks(elems) &&
276 sta->plink_state == NL80211_PLINK_LISTEN &&
277 sdata->u.mesh.accepting_plinks &&
278 sdata->u.mesh.mshcfg.auto_open_plinks)
279 mesh_plink_open(sta);
284 static void mesh_plink_timer(unsigned long data)
286 struct sta_info *sta;
287 __le16 llid, plid, reason;
288 struct ieee80211_sub_if_data *sdata;
291 * This STA is valid because sta_info_destroy() will
292 * del_timer_sync() this timer after having made sure
293 * it cannot be readded (by deleting the plink.)
295 sta = (struct sta_info *) data;
297 if (sta->sdata->local->quiescing) {
298 sta->plink_timer_was_running = true;
302 spin_lock_bh(&sta->lock);
303 if (sta->ignore_plink_timer) {
304 sta->ignore_plink_timer = false;
305 spin_unlock_bh(&sta->lock);
308 mpl_dbg("Mesh plink timer for %pM fired on state %d\n",
309 sta->sta.addr, sta->plink_state);
315 switch (sta->plink_state) {
316 case NL80211_PLINK_OPN_RCVD:
317 case NL80211_PLINK_OPN_SNT:
319 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
321 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n",
322 sta->sta.addr, sta->plink_retries,
324 get_random_bytes(&rand, sizeof(u32));
325 sta->plink_timeout = sta->plink_timeout +
326 rand % sta->plink_timeout;
327 ++sta->plink_retries;
328 mod_plink_timer(sta, sta->plink_timeout);
329 spin_unlock_bh(&sta->lock);
330 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN,
331 sta->sta.addr, llid, 0, 0);
334 reason = cpu_to_le16(WLAN_REASON_MESH_MAX_RETRIES);
335 /* fall through on else */
336 case NL80211_PLINK_CNF_RCVD:
339 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT);
340 sta->plink_state = NL80211_PLINK_HOLDING;
341 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
342 spin_unlock_bh(&sta->lock);
343 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
344 sta->sta.addr, llid, plid, reason);
346 case NL80211_PLINK_HOLDING:
348 del_timer(&sta->plink_timer);
349 mesh_plink_fsm_restart(sta);
350 spin_unlock_bh(&sta->lock);
353 spin_unlock_bh(&sta->lock);
359 void mesh_plink_quiesce(struct sta_info *sta)
361 if (del_timer_sync(&sta->plink_timer))
362 sta->plink_timer_was_running = true;
365 void mesh_plink_restart(struct sta_info *sta)
367 if (sta->plink_timer_was_running) {
368 add_timer(&sta->plink_timer);
369 sta->plink_timer_was_running = false;
374 static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
376 sta->plink_timer.expires = jiffies + (HZ * timeout / 1000);
377 sta->plink_timer.data = (unsigned long) sta;
378 sta->plink_timer.function = mesh_plink_timer;
379 sta->plink_timeout = timeout;
380 add_timer(&sta->plink_timer);
383 int mesh_plink_open(struct sta_info *sta)
386 struct ieee80211_sub_if_data *sdata = sta->sdata;
388 if (!test_sta_flag(sta, WLAN_STA_AUTH))
391 spin_lock_bh(&sta->lock);
392 get_random_bytes(&llid, 2);
394 if (sta->plink_state != NL80211_PLINK_LISTEN) {
395 spin_unlock_bh(&sta->lock);
398 sta->plink_state = NL80211_PLINK_OPN_SNT;
399 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
400 spin_unlock_bh(&sta->lock);
401 mpl_dbg("Mesh plink: starting establishment with %pM\n",
404 return mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_OPEN,
405 sta->sta.addr, llid, 0, 0);
408 void mesh_plink_block(struct sta_info *sta)
410 struct ieee80211_sub_if_data *sdata = sta->sdata;
413 spin_lock_bh(&sta->lock);
414 deactivated = __mesh_plink_deactivate(sta);
415 sta->plink_state = NL80211_PLINK_BLOCKED;
416 spin_unlock_bh(&sta->lock);
419 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
423 void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt,
424 size_t len, struct ieee80211_rx_status *rx_status)
426 struct ieee80211_local *local = sdata->local;
427 struct ieee802_11_elems elems;
428 struct sta_info *sta;
429 enum plink_event event;
430 enum ieee80211_self_protected_actioncode ftype;
432 bool deactivated, matches_local = true;
435 __le16 plid, llid, reason;
436 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
437 static const char *mplstates[] = {
438 [NL80211_PLINK_LISTEN] = "LISTEN",
439 [NL80211_PLINK_OPN_SNT] = "OPN-SNT",
440 [NL80211_PLINK_OPN_RCVD] = "OPN-RCVD",
441 [NL80211_PLINK_CNF_RCVD] = "CNF_RCVD",
442 [NL80211_PLINK_ESTAB] = "ESTAB",
443 [NL80211_PLINK_HOLDING] = "HOLDING",
444 [NL80211_PLINK_BLOCKED] = "BLOCKED"
448 /* need action_code, aux */
449 if (len < IEEE80211_MIN_ACTION_SIZE + 3)
452 if (is_multicast_ether_addr(mgmt->da)) {
453 mpl_dbg("Mesh plink: ignore frame from multicast address");
457 baseaddr = mgmt->u.action.u.self_prot.variable;
458 baselen = (u8 *) mgmt->u.action.u.self_prot.variable - (u8 *) mgmt;
459 if (mgmt->u.action.u.self_prot.action_code ==
460 WLAN_SP_MESH_PEERING_CONFIRM) {
464 ieee802_11_parse_elems(baseaddr, len - baselen, &elems);
465 if (!elems.peering) {
466 mpl_dbg("Mesh plink: missing necessary peer link ie\n");
470 sdata->u.mesh.security == IEEE80211_MESH_SEC_NONE) {
471 mpl_dbg("Mesh plink: can't establish link with secure peer\n");
475 ftype = mgmt->u.action.u.self_prot.action_code;
476 ie_len = elems.peering_len;
477 if ((ftype == WLAN_SP_MESH_PEERING_OPEN && ie_len != 4) ||
478 (ftype == WLAN_SP_MESH_PEERING_CONFIRM && ie_len != 6) ||
479 (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len != 6
481 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n",
486 if (ftype != WLAN_SP_MESH_PEERING_CLOSE &&
487 (!elems.mesh_id || !elems.mesh_config)) {
488 mpl_dbg("Mesh plink: missing necessary ie\n");
491 /* Note the lines below are correct, the llid in the frame is the plid
492 * from the point of view of this host.
494 memcpy(&plid, PLINK_GET_LLID(elems.peering), 2);
495 if (ftype == WLAN_SP_MESH_PEERING_CONFIRM ||
496 (ftype == WLAN_SP_MESH_PEERING_CLOSE && ie_len == 8))
497 memcpy(&llid, PLINK_GET_PLID(elems.peering), 2);
501 sta = sta_info_get(sdata, mgmt->sa);
502 if (!sta && ftype != WLAN_SP_MESH_PEERING_OPEN) {
503 mpl_dbg("Mesh plink: cls or cnf from unknown peer\n");
508 if (sta && !test_sta_flag(sta, WLAN_STA_AUTH)) {
509 mpl_dbg("Mesh plink: Action frame from non-authed peer\n");
514 if (sta && sta->plink_state == NL80211_PLINK_BLOCKED) {
519 /* Now we will figure out the appropriate event... */
520 event = PLINK_UNDEFINED;
521 if (ftype != WLAN_SP_MESH_PEERING_CLOSE &&
522 (!mesh_matches_local(&elems, sdata))) {
523 matches_local = false;
525 case WLAN_SP_MESH_PEERING_OPEN:
528 case WLAN_SP_MESH_PEERING_CONFIRM:
536 if (!sta && !matches_local) {
538 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG);
540 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
541 mgmt->sa, llid, plid, reason);
544 /* ftype == WLAN_SP_MESH_PEERING_OPEN */
549 if (!mesh_plink_free_count(sdata)) {
550 mpl_dbg("Mesh plink error: no more free plinks\n");
554 rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);
555 sta = mesh_plink_alloc(sdata, mgmt->sa, rates);
557 mpl_dbg("Mesh plink error: plink table full\n");
560 if (sta_info_insert_rcu(sta)) {
565 spin_lock_bh(&sta->lock);
566 } else if (matches_local) {
567 spin_lock_bh(&sta->lock);
569 case WLAN_SP_MESH_PEERING_OPEN:
570 if (!mesh_plink_free_count(sdata) ||
571 (sta->plid && sta->plid != plid))
576 case WLAN_SP_MESH_PEERING_CONFIRM:
577 if (!mesh_plink_free_count(sdata) ||
578 (sta->llid != llid || sta->plid != plid))
583 case WLAN_SP_MESH_PEERING_CLOSE:
584 if (sta->plink_state == NL80211_PLINK_ESTAB)
585 /* Do not check for llid or plid. This does not
586 * follow the standard but since multiple plinks
587 * per sta are not supported, it is necessary in
588 * order to avoid a livelock when MP A sees an
589 * establish peer link to MP B but MP B does not
590 * see it. This can be caused by a timeout in
591 * B's peer link establishment or B beign
595 else if (sta->plid != plid)
597 else if (ie_len == 7 && sta->llid != llid)
603 mpl_dbg("Mesh plink: unknown frame subtype\n");
604 spin_unlock_bh(&sta->lock);
609 spin_lock_bh(&sta->lock);
612 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n",
613 mgmt->sa, mplstates[sta->plink_state],
614 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
617 switch (sta->plink_state) {
618 /* spin_unlock as soon as state is updated at each case */
619 case NL80211_PLINK_LISTEN:
622 mesh_plink_fsm_restart(sta);
623 spin_unlock_bh(&sta->lock);
626 sta->plink_state = NL80211_PLINK_OPN_RCVD;
628 get_random_bytes(&llid, 2);
630 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
631 spin_unlock_bh(&sta->lock);
632 mesh_plink_frame_tx(sdata,
633 WLAN_SP_MESH_PEERING_OPEN,
634 sta->sta.addr, llid, 0, 0);
635 mesh_plink_frame_tx(sdata,
636 WLAN_SP_MESH_PEERING_CONFIRM,
637 sta->sta.addr, llid, plid, 0);
640 spin_unlock_bh(&sta->lock);
645 case NL80211_PLINK_OPN_SNT:
649 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG);
652 reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE);
653 sta->reason = reason;
654 sta->plink_state = NL80211_PLINK_HOLDING;
655 if (!mod_plink_timer(sta,
656 dot11MeshHoldingTimeout(sdata)))
657 sta->ignore_plink_timer = true;
660 spin_unlock_bh(&sta->lock);
661 mesh_plink_frame_tx(sdata,
662 WLAN_SP_MESH_PEERING_CLOSE,
663 sta->sta.addr, llid, plid, reason);
666 /* retry timer is left untouched */
667 sta->plink_state = NL80211_PLINK_OPN_RCVD;
670 spin_unlock_bh(&sta->lock);
671 mesh_plink_frame_tx(sdata,
672 WLAN_SP_MESH_PEERING_CONFIRM,
673 sta->sta.addr, llid, plid, 0);
676 sta->plink_state = NL80211_PLINK_CNF_RCVD;
677 if (!mod_plink_timer(sta,
678 dot11MeshConfirmTimeout(sdata)))
679 sta->ignore_plink_timer = true;
681 spin_unlock_bh(&sta->lock);
684 spin_unlock_bh(&sta->lock);
689 case NL80211_PLINK_OPN_RCVD:
693 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG);
696 reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE);
697 sta->reason = reason;
698 sta->plink_state = NL80211_PLINK_HOLDING;
699 if (!mod_plink_timer(sta,
700 dot11MeshHoldingTimeout(sdata)))
701 sta->ignore_plink_timer = true;
704 spin_unlock_bh(&sta->lock);
705 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
706 sta->sta.addr, llid, plid, reason);
710 spin_unlock_bh(&sta->lock);
711 mesh_plink_frame_tx(sdata,
712 WLAN_SP_MESH_PEERING_CONFIRM,
713 sta->sta.addr, llid, plid, 0);
716 del_timer(&sta->plink_timer);
717 sta->plink_state = NL80211_PLINK_ESTAB;
718 spin_unlock_bh(&sta->lock);
719 mesh_plink_inc_estab_count(sdata);
720 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
721 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
725 spin_unlock_bh(&sta->lock);
730 case NL80211_PLINK_CNF_RCVD:
734 reason = cpu_to_le16(WLAN_REASON_MESH_CONFIG);
737 reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE);
738 sta->reason = reason;
739 sta->plink_state = NL80211_PLINK_HOLDING;
740 if (!mod_plink_timer(sta,
741 dot11MeshHoldingTimeout(sdata)))
742 sta->ignore_plink_timer = true;
745 spin_unlock_bh(&sta->lock);
746 mesh_plink_frame_tx(sdata,
747 WLAN_SP_MESH_PEERING_CLOSE,
748 sta->sta.addr, llid, plid, reason);
751 del_timer(&sta->plink_timer);
752 sta->plink_state = NL80211_PLINK_ESTAB;
753 spin_unlock_bh(&sta->lock);
754 mesh_plink_inc_estab_count(sdata);
755 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
756 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
758 mesh_plink_frame_tx(sdata,
759 WLAN_SP_MESH_PEERING_CONFIRM,
760 sta->sta.addr, llid, plid, 0);
763 spin_unlock_bh(&sta->lock);
768 case NL80211_PLINK_ESTAB:
771 reason = cpu_to_le16(WLAN_REASON_MESH_CLOSE);
772 sta->reason = reason;
773 deactivated = __mesh_plink_deactivate(sta);
774 sta->plink_state = NL80211_PLINK_HOLDING;
776 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
777 spin_unlock_bh(&sta->lock);
779 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
780 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
781 sta->sta.addr, llid, plid, reason);
785 spin_unlock_bh(&sta->lock);
786 mesh_plink_frame_tx(sdata,
787 WLAN_SP_MESH_PEERING_CONFIRM,
788 sta->sta.addr, llid, plid, 0);
791 spin_unlock_bh(&sta->lock);
795 case NL80211_PLINK_HOLDING:
798 if (del_timer(&sta->plink_timer))
799 sta->ignore_plink_timer = 1;
800 mesh_plink_fsm_restart(sta);
801 spin_unlock_bh(&sta->lock);
808 reason = sta->reason;
809 spin_unlock_bh(&sta->lock);
810 mesh_plink_frame_tx(sdata, WLAN_SP_MESH_PEERING_CLOSE,
811 sta->sta.addr, llid, plid, reason);
814 spin_unlock_bh(&sta->lock);
818 /* should not get here, PLINK_BLOCKED is dealt with at the
819 * beginning of the function
821 spin_unlock_bh(&sta->lock);