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)
47 void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data
*sdata
)
49 atomic_inc(&sdata
->u
.mesh
.mshstats
.estab_plinks
);
50 mesh_accept_plinks_update(sdata
);
54 void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data
*sdata
)
56 atomic_dec(&sdata
->u
.mesh
.mshstats
.estab_plinks
);
57 mesh_accept_plinks_update(sdata
);
61 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
63 * @sta: mesh peer link to restart
65 * Locking: this function must be called holding sta->lock
67 static inline void mesh_plink_fsm_restart(struct sta_info
*sta
)
69 sta
->plink_state
= NL80211_PLINK_LISTEN
;
70 sta
->llid
= sta
->plid
= sta
->reason
= 0;
71 sta
->plink_retries
= 0;
75 * NOTE: This is just an alias for sta_info_alloc(), see notes
76 * on it in the lifecycle management section!
78 static struct sta_info
*mesh_plink_alloc(struct ieee80211_sub_if_data
*sdata
,
79 u8
*hw_addr
, u32 rates
)
81 struct ieee80211_local
*local
= sdata
->local
;
84 if (local
->num_sta
>= MESH_MAX_PLINKS
)
87 sta
= sta_info_alloc(sdata
, hw_addr
, GFP_KERNEL
);
91 sta
->flags
= WLAN_STA_AUTHORIZED
| WLAN_STA_AUTH
;
92 sta
->sta
.supp_rates
[local
->hw
.conf
.channel
->band
] = rates
;
93 rate_control_rate_init(sta
);
99 * __mesh_plink_deactivate - deactivate mesh peer link
101 * @sta: mesh peer link to deactivate
103 * All mesh paths with this peer as next hop will be flushed
105 * Locking: the caller must hold sta->lock
107 static bool __mesh_plink_deactivate(struct sta_info
*sta
)
109 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
110 bool deactivated
= false;
112 if (sta
->plink_state
== NL80211_PLINK_ESTAB
) {
113 mesh_plink_dec_estab_count(sdata
);
116 sta
->plink_state
= NL80211_PLINK_BLOCKED
;
117 mesh_path_flush_by_nexthop(sta
);
123 * mesh_plink_deactivate - deactivate mesh peer link
125 * @sta: mesh peer link to deactivate
127 * All mesh paths with this peer as next hop will be flushed
129 void mesh_plink_deactivate(struct sta_info
*sta
)
131 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
134 spin_lock_bh(&sta
->lock
);
135 deactivated
= __mesh_plink_deactivate(sta
);
136 spin_unlock_bh(&sta
->lock
);
139 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
142 static int mesh_plink_frame_tx(struct ieee80211_sub_if_data
*sdata
,
143 enum ieee80211_self_protected_actioncode action
,
144 u8
*da
, __le16 llid
, __le16 plid
, __le16 reason
) {
145 struct ieee80211_local
*local
= sdata
->local
;
146 struct sk_buff
*skb
= dev_alloc_skb(local
->hw
.extra_tx_headroom
+ 400 +
147 sdata
->u
.mesh
.ie_len
);
148 struct ieee80211_mgmt
*mgmt
;
149 bool include_plid
= false;
151 u16 peering_proto
= 0;
156 skb_reserve(skb
, local
->hw
.extra_tx_headroom
);
157 /* 25 is the size of the common mgmt part (24) plus the size of the
158 * common action part (1)
160 mgmt
= (struct ieee80211_mgmt
*)
161 skb_put(skb
, 25 + sizeof(mgmt
->u
.action
.u
.self_prot
));
162 memset(mgmt
, 0, 25 + sizeof(mgmt
->u
.action
.u
.self_prot
));
163 mgmt
->frame_control
= cpu_to_le16(IEEE80211_FTYPE_MGMT
|
164 IEEE80211_STYPE_ACTION
);
165 memcpy(mgmt
->da
, da
, ETH_ALEN
);
166 memcpy(mgmt
->sa
, sdata
->vif
.addr
, ETH_ALEN
);
167 memcpy(mgmt
->bssid
, sdata
->vif
.addr
, ETH_ALEN
);
168 mgmt
->u
.action
.category
= WLAN_CATEGORY_SELF_PROTECTED
;
169 mgmt
->u
.action
.u
.self_prot
.action_code
= action
;
171 if (action
!= WLAN_SP_MESH_PEERING_CLOSE
) {
172 /* capability info */
173 pos
= skb_put(skb
, 2);
175 if (action
== WLAN_SP_MESH_PEERING_CONFIRM
) {
177 pos
= skb_put(skb
, 2);
178 memcpy(pos
+ 2, &plid
, 2);
180 if (mesh_add_srates_ie(skb
, sdata
) ||
181 mesh_add_ext_srates_ie(skb
, sdata
) ||
182 mesh_add_rsn_ie(skb
, sdata
) ||
183 mesh_add_meshid_ie(skb
, sdata
) ||
184 mesh_add_meshconf_ie(skb
, sdata
))
186 } else { /* WLAN_SP_MESH_PEERING_CLOSE */
187 if (mesh_add_meshid_ie(skb
, sdata
))
191 /* Add Mesh Peering Management element */
193 case WLAN_SP_MESH_PEERING_OPEN
:
195 case WLAN_SP_MESH_PEERING_CONFIRM
:
199 case WLAN_SP_MESH_PEERING_CLOSE
:
204 ie_len
+= 2; /* reason code */
210 if (WARN_ON(skb_tailroom(skb
) < 2 + ie_len
))
213 pos
= skb_put(skb
, 2 + ie_len
);
214 *pos
++ = WLAN_EID_PEER_MGMT
;
216 memcpy(pos
, &peering_proto
, 2);
218 memcpy(pos
, &llid
, 2);
221 memcpy(pos
, &plid
, 2);
224 if (action
== WLAN_SP_MESH_PEERING_CLOSE
) {
225 memcpy(pos
, &reason
, 2);
228 if (mesh_add_vendor_ies(skb
, sdata
))
231 ieee80211_tx_skb(sdata
, skb
);
235 void mesh_neighbour_update(u8
*hw_addr
, u32 rates
,
236 struct ieee80211_sub_if_data
*sdata
,
237 struct ieee802_11_elems
*elems
)
239 struct ieee80211_local
*local
= sdata
->local
;
240 struct sta_info
*sta
;
244 sta
= sta_info_get(sdata
, hw_addr
);
247 /* Userspace handles peer allocation when security is enabled
249 if (sdata
->u
.mesh
.security
& IEEE80211_MESH_SEC_AUTHED
)
250 cfg80211_notify_new_peer_candidate(sdata
->dev
, hw_addr
,
251 elems
->ie_start
, elems
->total_len
,
254 sta
= mesh_plink_alloc(sdata
, hw_addr
, rates
);
257 if (sta_info_insert_rcu(sta
)) {
263 sta
->last_rx
= jiffies
;
264 sta
->sta
.supp_rates
[local
->hw
.conf
.channel
->band
] = rates
;
265 if (mesh_peer_accepts_plinks(elems
) &&
266 sta
->plink_state
== NL80211_PLINK_LISTEN
&&
267 sdata
->u
.mesh
.accepting_plinks
&&
268 sdata
->u
.mesh
.mshcfg
.auto_open_plinks
)
269 mesh_plink_open(sta
);
274 static void mesh_plink_timer(unsigned long data
)
276 struct sta_info
*sta
;
277 __le16 llid
, plid
, reason
;
278 struct ieee80211_sub_if_data
*sdata
;
281 * This STA is valid because sta_info_destroy() will
282 * del_timer_sync() this timer after having made sure
283 * it cannot be readded (by deleting the plink.)
285 sta
= (struct sta_info
*) data
;
287 if (sta
->sdata
->local
->quiescing
) {
288 sta
->plink_timer_was_running
= true;
292 spin_lock_bh(&sta
->lock
);
293 if (sta
->ignore_plink_timer
) {
294 sta
->ignore_plink_timer
= false;
295 spin_unlock_bh(&sta
->lock
);
298 mpl_dbg("Mesh plink timer for %pM fired on state %d\n",
299 sta
->sta
.addr
, sta
->plink_state
);
305 switch (sta
->plink_state
) {
306 case NL80211_PLINK_OPN_RCVD
:
307 case NL80211_PLINK_OPN_SNT
:
309 if (sta
->plink_retries
< dot11MeshMaxRetries(sdata
)) {
311 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n",
312 sta
->sta
.addr
, sta
->plink_retries
,
314 get_random_bytes(&rand
, sizeof(u32
));
315 sta
->plink_timeout
= sta
->plink_timeout
+
316 rand
% sta
->plink_timeout
;
317 ++sta
->plink_retries
;
318 mod_plink_timer(sta
, sta
->plink_timeout
);
319 spin_unlock_bh(&sta
->lock
);
320 mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_OPEN
,
321 sta
->sta
.addr
, llid
, 0, 0);
324 reason
= cpu_to_le16(WLAN_REASON_MESH_MAX_RETRIES
);
325 /* fall through on else */
326 case NL80211_PLINK_CNF_RCVD
:
329 reason
= cpu_to_le16(WLAN_REASON_MESH_CONFIRM_TIMEOUT
);
330 sta
->plink_state
= NL80211_PLINK_HOLDING
;
331 mod_plink_timer(sta
, dot11MeshHoldingTimeout(sdata
));
332 spin_unlock_bh(&sta
->lock
);
333 mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_CLOSE
,
334 sta
->sta
.addr
, llid
, plid
, reason
);
336 case NL80211_PLINK_HOLDING
:
338 del_timer(&sta
->plink_timer
);
339 mesh_plink_fsm_restart(sta
);
340 spin_unlock_bh(&sta
->lock
);
343 spin_unlock_bh(&sta
->lock
);
349 void mesh_plink_quiesce(struct sta_info
*sta
)
351 if (del_timer_sync(&sta
->plink_timer
))
352 sta
->plink_timer_was_running
= true;
355 void mesh_plink_restart(struct sta_info
*sta
)
357 if (sta
->plink_timer_was_running
) {
358 add_timer(&sta
->plink_timer
);
359 sta
->plink_timer_was_running
= false;
364 static inline void mesh_plink_timer_set(struct sta_info
*sta
, int timeout
)
366 sta
->plink_timer
.expires
= jiffies
+ (HZ
* timeout
/ 1000);
367 sta
->plink_timer
.data
= (unsigned long) sta
;
368 sta
->plink_timer
.function
= mesh_plink_timer
;
369 sta
->plink_timeout
= timeout
;
370 add_timer(&sta
->plink_timer
);
373 int mesh_plink_open(struct sta_info
*sta
)
376 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
378 if (!test_sta_flags(sta
, WLAN_STA_AUTH
))
381 spin_lock_bh(&sta
->lock
);
382 get_random_bytes(&llid
, 2);
384 if (sta
->plink_state
!= NL80211_PLINK_LISTEN
) {
385 spin_unlock_bh(&sta
->lock
);
388 sta
->plink_state
= NL80211_PLINK_OPN_SNT
;
389 mesh_plink_timer_set(sta
, dot11MeshRetryTimeout(sdata
));
390 spin_unlock_bh(&sta
->lock
);
391 mpl_dbg("Mesh plink: starting establishment with %pM\n",
394 return mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_OPEN
,
395 sta
->sta
.addr
, llid
, 0, 0);
398 void mesh_plink_block(struct sta_info
*sta
)
400 struct ieee80211_sub_if_data
*sdata
= sta
->sdata
;
403 spin_lock_bh(&sta
->lock
);
404 deactivated
= __mesh_plink_deactivate(sta
);
405 sta
->plink_state
= NL80211_PLINK_BLOCKED
;
406 spin_unlock_bh(&sta
->lock
);
409 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
413 void mesh_rx_plink_frame(struct ieee80211_sub_if_data
*sdata
, struct ieee80211_mgmt
*mgmt
,
414 size_t len
, struct ieee80211_rx_status
*rx_status
)
416 struct ieee80211_local
*local
= sdata
->local
;
417 struct ieee802_11_elems elems
;
418 struct sta_info
*sta
;
419 enum plink_event event
;
420 enum ieee80211_self_protected_actioncode ftype
;
422 bool deactivated
, matches_local
= true;
425 __le16 plid
, llid
, reason
;
426 #ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
427 static const char *mplstates
[] = {
428 [NL80211_PLINK_LISTEN
] = "LISTEN",
429 [NL80211_PLINK_OPN_SNT
] = "OPN-SNT",
430 [NL80211_PLINK_OPN_RCVD
] = "OPN-RCVD",
431 [NL80211_PLINK_CNF_RCVD
] = "CNF_RCVD",
432 [NL80211_PLINK_ESTAB
] = "ESTAB",
433 [NL80211_PLINK_HOLDING
] = "HOLDING",
434 [NL80211_PLINK_BLOCKED
] = "BLOCKED"
438 /* need action_code, aux */
439 if (len
< IEEE80211_MIN_ACTION_SIZE
+ 3)
442 if (is_multicast_ether_addr(mgmt
->da
)) {
443 mpl_dbg("Mesh plink: ignore frame from multicast address");
447 baseaddr
= mgmt
->u
.action
.u
.self_prot
.variable
;
448 baselen
= (u8
*) mgmt
->u
.action
.u
.self_prot
.variable
- (u8
*) mgmt
;
449 if (mgmt
->u
.action
.u
.self_prot
.action_code
==
450 WLAN_SP_MESH_PEERING_CONFIRM
) {
454 ieee802_11_parse_elems(baseaddr
, len
- baselen
, &elems
);
455 if (!elems
.peering
) {
456 mpl_dbg("Mesh plink: missing necessary peer link ie\n");
460 sdata
->u
.mesh
.security
== IEEE80211_MESH_SEC_NONE
) {
461 mpl_dbg("Mesh plink: can't establish link with secure peer\n");
465 ftype
= mgmt
->u
.action
.u
.self_prot
.action_code
;
466 ie_len
= elems
.peering_len
;
467 if ((ftype
== WLAN_SP_MESH_PEERING_OPEN
&& ie_len
!= 4) ||
468 (ftype
== WLAN_SP_MESH_PEERING_CONFIRM
&& ie_len
!= 6) ||
469 (ftype
== WLAN_SP_MESH_PEERING_CLOSE
&& ie_len
!= 6
471 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n",
476 if (ftype
!= WLAN_SP_MESH_PEERING_CLOSE
&&
477 (!elems
.mesh_id
|| !elems
.mesh_config
)) {
478 mpl_dbg("Mesh plink: missing necessary ie\n");
481 /* Note the lines below are correct, the llid in the frame is the plid
482 * from the point of view of this host.
484 memcpy(&plid
, PLINK_GET_LLID(elems
.peering
), 2);
485 if (ftype
== WLAN_SP_MESH_PEERING_CONFIRM
||
486 (ftype
== WLAN_SP_MESH_PEERING_CLOSE
&& ie_len
== 8))
487 memcpy(&llid
, PLINK_GET_PLID(elems
.peering
), 2);
491 sta
= sta_info_get(sdata
, mgmt
->sa
);
492 if (!sta
&& ftype
!= WLAN_SP_MESH_PEERING_OPEN
) {
493 mpl_dbg("Mesh plink: cls or cnf from unknown peer\n");
498 if (sta
&& !test_sta_flags(sta
, WLAN_STA_AUTH
)) {
499 mpl_dbg("Mesh plink: Action frame from non-authed peer\n");
504 if (sta
&& sta
->plink_state
== NL80211_PLINK_BLOCKED
) {
509 /* Now we will figure out the appropriate event... */
510 event
= PLINK_UNDEFINED
;
511 if (ftype
!= WLAN_SP_MESH_PEERING_CLOSE
&&
512 (!mesh_matches_local(&elems
, sdata
))) {
513 matches_local
= false;
515 case WLAN_SP_MESH_PEERING_OPEN
:
518 case WLAN_SP_MESH_PEERING_CONFIRM
:
526 if (!sta
&& !matches_local
) {
528 reason
= cpu_to_le16(WLAN_REASON_MESH_CONFIG
);
530 mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_CLOSE
,
531 mgmt
->sa
, llid
, plid
, reason
);
534 /* ftype == WLAN_SP_MESH_PEERING_OPEN */
539 if (!mesh_plink_free_count(sdata
)) {
540 mpl_dbg("Mesh plink error: no more free plinks\n");
544 rates
= ieee80211_sta_get_rates(local
, &elems
, rx_status
->band
);
545 sta
= mesh_plink_alloc(sdata
, mgmt
->sa
, rates
);
547 mpl_dbg("Mesh plink error: plink table full\n");
550 if (sta_info_insert_rcu(sta
)) {
555 spin_lock_bh(&sta
->lock
);
556 } else if (matches_local
) {
557 spin_lock_bh(&sta
->lock
);
559 case WLAN_SP_MESH_PEERING_OPEN
:
560 if (!mesh_plink_free_count(sdata
) ||
561 (sta
->plid
&& sta
->plid
!= plid
))
566 case WLAN_SP_MESH_PEERING_CONFIRM
:
567 if (!mesh_plink_free_count(sdata
) ||
568 (sta
->llid
!= llid
|| sta
->plid
!= plid
))
573 case WLAN_SP_MESH_PEERING_CLOSE
:
574 if (sta
->plink_state
== NL80211_PLINK_ESTAB
)
575 /* Do not check for llid or plid. This does not
576 * follow the standard but since multiple plinks
577 * per sta are not supported, it is necessary in
578 * order to avoid a livelock when MP A sees an
579 * establish peer link to MP B but MP B does not
580 * see it. This can be caused by a timeout in
581 * B's peer link establishment or B beign
585 else if (sta
->plid
!= plid
)
587 else if (ie_len
== 7 && sta
->llid
!= llid
)
593 mpl_dbg("Mesh plink: unknown frame subtype\n");
594 spin_unlock_bh(&sta
->lock
);
599 spin_lock_bh(&sta
->lock
);
602 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n",
603 mgmt
->sa
, mplstates
[sta
->plink_state
],
604 le16_to_cpu(sta
->llid
), le16_to_cpu(sta
->plid
),
607 switch (sta
->plink_state
) {
608 /* spin_unlock as soon as state is updated at each case */
609 case NL80211_PLINK_LISTEN
:
612 mesh_plink_fsm_restart(sta
);
613 spin_unlock_bh(&sta
->lock
);
616 sta
->plink_state
= NL80211_PLINK_OPN_RCVD
;
618 get_random_bytes(&llid
, 2);
620 mesh_plink_timer_set(sta
, dot11MeshRetryTimeout(sdata
));
621 spin_unlock_bh(&sta
->lock
);
622 mesh_plink_frame_tx(sdata
,
623 WLAN_SP_MESH_PEERING_OPEN
,
624 sta
->sta
.addr
, llid
, 0, 0);
625 mesh_plink_frame_tx(sdata
,
626 WLAN_SP_MESH_PEERING_CONFIRM
,
627 sta
->sta
.addr
, llid
, plid
, 0);
630 spin_unlock_bh(&sta
->lock
);
635 case NL80211_PLINK_OPN_SNT
:
639 reason
= cpu_to_le16(WLAN_REASON_MESH_CONFIG
);
642 reason
= cpu_to_le16(WLAN_REASON_MESH_CLOSE
);
643 sta
->reason
= reason
;
644 sta
->plink_state
= NL80211_PLINK_HOLDING
;
645 if (!mod_plink_timer(sta
,
646 dot11MeshHoldingTimeout(sdata
)))
647 sta
->ignore_plink_timer
= true;
650 spin_unlock_bh(&sta
->lock
);
651 mesh_plink_frame_tx(sdata
,
652 WLAN_SP_MESH_PEERING_CLOSE
,
653 sta
->sta
.addr
, llid
, plid
, reason
);
656 /* retry timer is left untouched */
657 sta
->plink_state
= NL80211_PLINK_OPN_RCVD
;
660 spin_unlock_bh(&sta
->lock
);
661 mesh_plink_frame_tx(sdata
,
662 WLAN_SP_MESH_PEERING_CONFIRM
,
663 sta
->sta
.addr
, llid
, plid
, 0);
666 sta
->plink_state
= NL80211_PLINK_CNF_RCVD
;
667 if (!mod_plink_timer(sta
,
668 dot11MeshConfirmTimeout(sdata
)))
669 sta
->ignore_plink_timer
= true;
671 spin_unlock_bh(&sta
->lock
);
674 spin_unlock_bh(&sta
->lock
);
679 case NL80211_PLINK_OPN_RCVD
:
683 reason
= cpu_to_le16(WLAN_REASON_MESH_CONFIG
);
686 reason
= cpu_to_le16(WLAN_REASON_MESH_CLOSE
);
687 sta
->reason
= reason
;
688 sta
->plink_state
= NL80211_PLINK_HOLDING
;
689 if (!mod_plink_timer(sta
,
690 dot11MeshHoldingTimeout(sdata
)))
691 sta
->ignore_plink_timer
= true;
694 spin_unlock_bh(&sta
->lock
);
695 mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_CLOSE
,
696 sta
->sta
.addr
, llid
, plid
, reason
);
700 spin_unlock_bh(&sta
->lock
);
701 mesh_plink_frame_tx(sdata
,
702 WLAN_SP_MESH_PEERING_CONFIRM
,
703 sta
->sta
.addr
, llid
, plid
, 0);
706 del_timer(&sta
->plink_timer
);
707 sta
->plink_state
= NL80211_PLINK_ESTAB
;
708 spin_unlock_bh(&sta
->lock
);
709 mesh_plink_inc_estab_count(sdata
);
710 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
711 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
715 spin_unlock_bh(&sta
->lock
);
720 case NL80211_PLINK_CNF_RCVD
:
724 reason
= cpu_to_le16(WLAN_REASON_MESH_CONFIG
);
727 reason
= cpu_to_le16(WLAN_REASON_MESH_CLOSE
);
728 sta
->reason
= reason
;
729 sta
->plink_state
= NL80211_PLINK_HOLDING
;
730 if (!mod_plink_timer(sta
,
731 dot11MeshHoldingTimeout(sdata
)))
732 sta
->ignore_plink_timer
= true;
735 spin_unlock_bh(&sta
->lock
);
736 mesh_plink_frame_tx(sdata
,
737 WLAN_SP_MESH_PEERING_CLOSE
,
738 sta
->sta
.addr
, llid
, plid
, reason
);
741 del_timer(&sta
->plink_timer
);
742 sta
->plink_state
= NL80211_PLINK_ESTAB
;
743 spin_unlock_bh(&sta
->lock
);
744 mesh_plink_inc_estab_count(sdata
);
745 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
746 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
748 mesh_plink_frame_tx(sdata
,
749 WLAN_SP_MESH_PEERING_CONFIRM
,
750 sta
->sta
.addr
, llid
, plid
, 0);
753 spin_unlock_bh(&sta
->lock
);
758 case NL80211_PLINK_ESTAB
:
761 reason
= cpu_to_le16(WLAN_REASON_MESH_CLOSE
);
762 sta
->reason
= reason
;
763 deactivated
= __mesh_plink_deactivate(sta
);
764 sta
->plink_state
= NL80211_PLINK_HOLDING
;
766 mod_plink_timer(sta
, dot11MeshHoldingTimeout(sdata
));
767 spin_unlock_bh(&sta
->lock
);
769 ieee80211_bss_info_change_notify(sdata
, BSS_CHANGED_BEACON
);
770 mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_CLOSE
,
771 sta
->sta
.addr
, llid
, plid
, reason
);
775 spin_unlock_bh(&sta
->lock
);
776 mesh_plink_frame_tx(sdata
,
777 WLAN_SP_MESH_PEERING_CONFIRM
,
778 sta
->sta
.addr
, llid
, plid
, 0);
781 spin_unlock_bh(&sta
->lock
);
785 case NL80211_PLINK_HOLDING
:
788 if (del_timer(&sta
->plink_timer
))
789 sta
->ignore_plink_timer
= 1;
790 mesh_plink_fsm_restart(sta
);
791 spin_unlock_bh(&sta
->lock
);
798 reason
= sta
->reason
;
799 spin_unlock_bh(&sta
->lock
);
800 mesh_plink_frame_tx(sdata
, WLAN_SP_MESH_PEERING_CLOSE
,
801 sta
->sta
.addr
, llid
, plid
, reason
);
804 spin_unlock_bh(&sta
->lock
);
808 /* should not get here, PLINK_BLOCKED is dealt with at the
809 * beginning of the function
811 spin_unlock_bh(&sta
->lock
);