blob: 7b7080e2b49f47a1dcac316432341b89b3a9a5cb [file] [log] [blame]
Luis Carlos Coboc3896d22008-02-23 15:17:13 +01001/*
Rui Paulo264d9b72009-11-09 23:46:58 +00002 * Copyright (c) 2008, 2009 open80211s Ltd.
Luis Carlos Coboc3896d22008-02-23 15:17:13 +01003 * Author: Luis Carlos Cobo <luisca@cozybit.com>
4 *
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.
8 */
Tejun Heo5a0e3ad2010-03-24 17:04:11 +09009#include <linux/gfp.h>
Johannes Berg902acc72008-02-23 15:17:19 +010010#include <linux/kernel.h>
11#include <linux/random.h>
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010012#include "ieee80211_i.h"
Johannes Berg2c8dccc2008-04-08 15:14:40 -040013#include "rate.h"
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010014#include "mesh.h"
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010015
16#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
17#define mpl_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args)
18#else
19#define mpl_dbg(fmt, args...) do { (void)(0); } while (0)
20#endif
21
Rui Paulo09383932009-11-09 23:46:43 +000022#define PLINK_GET_LLID(p) (p + 4)
23#define PLINK_GET_PLID(p) (p + 6)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010024
25#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \
26 jiffies + HZ * t / 1000))
27
28/* Peer link cancel reasons, all subject to ANA approval */
29#define MESH_LINK_CANCELLED 2
30#define MESH_MAX_NEIGHBORS 3
31#define MESH_CAPABILITY_POLICY_VIOLATION 4
32#define MESH_CLOSE_RCVD 5
33#define MESH_MAX_RETRIES 6
34#define MESH_CONFIRM_TIMEOUT 7
35#define MESH_SECURITY_ROLE_NEGOTIATION_DIFFERS 8
36#define MESH_SECURITY_AUTHENTICATION_IMPOSSIBLE 9
37#define MESH_SECURITY_FAILED_VERIFICATION 10
38
Johannes Berg472dbc42008-09-11 00:01:49 +020039#define dot11MeshMaxRetries(s) (s->u.mesh.mshcfg.dot11MeshMaxRetries)
40#define dot11MeshRetryTimeout(s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout)
41#define dot11MeshConfirmTimeout(s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout)
42#define dot11MeshHoldingTimeout(s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout)
43#define dot11MeshMaxPeerLinks(s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010044
45enum plink_frame_type {
46 PLINK_OPEN = 0,
47 PLINK_CONFIRM,
48 PLINK_CLOSE
49};
50
51enum plink_event {
52 PLINK_UNDEFINED,
53 OPN_ACPT,
54 OPN_RJCT,
55 OPN_IGNR,
56 CNF_ACPT,
57 CNF_RJCT,
58 CNF_IGNR,
59 CLS_ACPT,
60 CLS_IGNR
61};
62
63static inline
64void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
65{
Johannes Berg472dbc42008-09-11 00:01:49 +020066 atomic_inc(&sdata->u.mesh.mshstats.estab_plinks);
Johannes Bergd0709a62008-02-25 16:27:46 +010067 mesh_accept_plinks_update(sdata);
Rui Paulo8f2fda92009-11-09 23:46:41 +000068 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010069}
70
71static inline
72void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
73{
Johannes Berg472dbc42008-09-11 00:01:49 +020074 atomic_dec(&sdata->u.mesh.mshstats.estab_plinks);
Johannes Bergd0709a62008-02-25 16:27:46 +010075 mesh_accept_plinks_update(sdata);
Rui Paulo8f2fda92009-11-09 23:46:41 +000076 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010077}
78
79/**
80 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
81 *
Rui Paulo23c7a292009-11-09 23:46:42 +000082 * @sta: mesh peer link to restart
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010083 *
Johannes Berg07346f812008-05-03 01:02:02 +020084 * Locking: this function must be called holding sta->lock
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010085 */
86static inline void mesh_plink_fsm_restart(struct sta_info *sta)
87{
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -080088 sta->plink_state = PLINK_LISTEN;
Luis Carlos Cobo37659ff2008-02-29 12:13:38 -080089 sta->llid = sta->plid = sta->reason = 0;
90 sta->plink_retries = 0;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010091}
92
Johannes Berg93e5deb2008-04-01 15:21:00 +020093/*
94 * NOTE: This is just an alias for sta_info_alloc(), see notes
95 * on it in the lifecycle management section!
96 */
Johannes Berg03e44972008-02-27 09:56:40 +010097static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
Johannes Berg881d9482009-01-21 15:13:48 +010098 u8 *hw_addr, u32 rates)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +010099{
Johannes Bergd0709a62008-02-25 16:27:46 +0100100 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100101 struct sta_info *sta;
102
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100103 if (local->num_sta >= MESH_MAX_PLINKS)
Johannes Berg73651ee2008-02-25 16:27:47 +0100104 return NULL;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100105
Johannes Berg34e89502010-02-03 13:59:58 +0100106 sta = sta_info_alloc(sdata, hw_addr, GFP_KERNEL);
Johannes Berg73651ee2008-02-25 16:27:47 +0100107 if (!sta)
108 return NULL;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100109
Johannes Berg07346f812008-05-03 01:02:02 +0200110 sta->flags = WLAN_STA_AUTHORIZED;
Johannes Berg323ce792008-09-11 02:45:11 +0200111 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
Christian Lamparterb973c312008-12-27 22:19:49 +0100112 rate_control_rate_init(sta);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100113
114 return sta;
115}
116
117/**
Johannes Berg42096b62008-02-25 21:36:27 +0100118 * mesh_plink_deactivate - deactivate mesh peer link
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100119 *
120 * @sta: mesh peer link to deactivate
121 *
122 * All mesh paths with this peer as next hop will be flushed
123 *
Johannes Berg07346f812008-05-03 01:02:02 +0200124 * Locking: the caller must hold sta->lock
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100125 */
Johannes Berg902acc72008-02-23 15:17:19 +0100126static void __mesh_plink_deactivate(struct sta_info *sta)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100127{
Johannes Bergd0709a62008-02-25 16:27:46 +0100128 struct ieee80211_sub_if_data *sdata = sta->sdata;
129
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800130 if (sta->plink_state == PLINK_ESTAB)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100131 mesh_plink_dec_estab_count(sdata);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800132 sta->plink_state = PLINK_BLOCKED;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100133 mesh_path_flush_by_nexthop(sta);
134}
135
Johannes Berg902acc72008-02-23 15:17:19 +0100136/**
137 * __mesh_plink_deactivate - deactivate mesh peer link
138 *
139 * @sta: mesh peer link to deactivate
140 *
141 * All mesh paths with this peer as next hop will be flushed
142 */
143void mesh_plink_deactivate(struct sta_info *sta)
144{
Johannes Berg07346f812008-05-03 01:02:02 +0200145 spin_lock_bh(&sta->lock);
Johannes Berg902acc72008-02-23 15:17:19 +0100146 __mesh_plink_deactivate(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200147 spin_unlock_bh(&sta->lock);
Johannes Berg902acc72008-02-23 15:17:19 +0100148}
149
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200150static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100151 enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid,
152 __le16 reason) {
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200153 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100154 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
155 struct ieee80211_mgmt *mgmt;
156 bool include_plid = false;
Rui Paulo09383932009-11-09 23:46:43 +0000157 static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A };
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100158 u8 *pos;
159 int ie_len;
160
161 if (!skb)
162 return -1;
163 skb_reserve(skb, local->hw.extra_tx_headroom);
164 /* 25 is the size of the common mgmt part (24) plus the size of the
165 * common action part (1)
166 */
167 mgmt = (struct ieee80211_mgmt *)
168 skb_put(skb, 25 + sizeof(mgmt->u.action.u.plink_action));
169 memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.plink_action));
Harvey Harrisone7827a72008-07-15 18:44:13 -0700170 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
171 IEEE80211_STYPE_ACTION);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100172 memcpy(mgmt->da, da, ETH_ALEN);
Johannes Berg47846c92009-11-25 17:46:19 +0100173 memcpy(mgmt->sa, sdata->vif.addr, ETH_ALEN);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100174 /* BSSID is left zeroed, wildcard value */
Rui Paulo09383932009-11-09 23:46:43 +0000175 mgmt->u.action.category = MESH_PLINK_CATEGORY;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100176 mgmt->u.action.u.plink_action.action_code = action;
177
178 if (action == PLINK_CLOSE)
179 mgmt->u.action.u.plink_action.aux = reason;
180 else {
181 mgmt->u.action.u.plink_action.aux = cpu_to_le16(0x0);
182 if (action == PLINK_CONFIRM) {
183 pos = skb_put(skb, 4);
184 /* two-byte status code followed by two-byte AID */
Rui Paulo77fa76b2009-11-09 23:46:52 +0000185 memset(pos, 0, 2);
186 memcpy(pos + 2, &plid, 2);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100187 }
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200188 mesh_mgmt_ies_add(skb, sdata);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100189 }
190
191 /* Add Peer Link Management element */
192 switch (action) {
193 case PLINK_OPEN:
Rui Paulo09383932009-11-09 23:46:43 +0000194 ie_len = 6;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100195 break;
196 case PLINK_CONFIRM:
Rui Paulo09383932009-11-09 23:46:43 +0000197 ie_len = 8;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100198 include_plid = true;
199 break;
200 case PLINK_CLOSE:
201 default:
202 if (!plid)
Rui Paulo09383932009-11-09 23:46:43 +0000203 ie_len = 8;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100204 else {
Rui Paulo09383932009-11-09 23:46:43 +0000205 ie_len = 10;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100206 include_plid = true;
207 }
208 break;
209 }
210
211 pos = skb_put(skb, 2 + ie_len);
212 *pos++ = WLAN_EID_PEER_LINK;
213 *pos++ = ie_len;
Rui Paulo09383932009-11-09 23:46:43 +0000214 memcpy(pos, meshpeeringproto, sizeof(meshpeeringproto));
215 pos += 4;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100216 memcpy(pos, &llid, 2);
217 if (include_plid) {
218 pos += 2;
219 memcpy(pos, &plid, 2);
220 }
221 if (action == PLINK_CLOSE) {
222 pos += 2;
223 memcpy(pos, &reason, 2);
224 }
225
Johannes Berg62ae67b2009-11-18 18:42:05 +0100226 ieee80211_tx_skb(sdata, skb);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100227 return 0;
228}
229
Johannes Berg881d9482009-01-21 15:13:48 +0100230void mesh_neighbour_update(u8 *hw_addr, u32 rates, struct ieee80211_sub_if_data *sdata,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100231 bool peer_accepting_plinks)
232{
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200233 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100234 struct sta_info *sta;
235
Johannes Bergd0709a62008-02-25 16:27:46 +0100236 rcu_read_lock();
237
Johannes Bergabe60632009-11-25 17:46:18 +0100238 sta = sta_info_get(sdata, hw_addr);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100239 if (!sta) {
Johannes Berg34e89502010-02-03 13:59:58 +0100240 rcu_read_unlock();
241
Johannes Berg03e44972008-02-27 09:56:40 +0100242 sta = mesh_plink_alloc(sdata, hw_addr, rates);
Johannes Berg34e89502010-02-03 13:59:58 +0100243 if (!sta)
Johannes Berg73651ee2008-02-25 16:27:47 +0100244 return;
Johannes Berg34e89502010-02-03 13:59:58 +0100245 if (sta_info_insert_rcu(sta)) {
Johannes Bergd0709a62008-02-25 16:27:46 +0100246 rcu_read_unlock();
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100247 return;
Johannes Bergd0709a62008-02-25 16:27:46 +0100248 }
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100249 }
250
251 sta->last_rx = jiffies;
Johannes Berg323ce792008-09-11 02:45:11 +0200252 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800253 if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN &&
Johannes Berg472dbc42008-09-11 00:01:49 +0200254 sdata->u.mesh.accepting_plinks &&
255 sdata->u.mesh.mshcfg.auto_open_plinks)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100256 mesh_plink_open(sta);
257
Johannes Bergd0709a62008-02-25 16:27:46 +0100258 rcu_read_unlock();
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100259}
260
261static void mesh_plink_timer(unsigned long data)
262{
263 struct sta_info *sta;
264 __le16 llid, plid, reason;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100265 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100266
Johannes Bergd0709a62008-02-25 16:27:46 +0100267 /*
268 * This STA is valid because sta_info_destroy() will
269 * del_timer_sync() this timer after having made sure
270 * it cannot be readded (by deleting the plink.)
271 */
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100272 sta = (struct sta_info *) data;
273
Johannes Berg5bb644a2009-05-17 11:40:42 +0200274 if (sta->sdata->local->quiescing) {
275 sta->plink_timer_was_running = true;
276 return;
277 }
278
Johannes Berg07346f812008-05-03 01:02:02 +0200279 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100280 if (sta->ignore_plink_timer) {
281 sta->ignore_plink_timer = false;
Johannes Berg07346f812008-05-03 01:02:02 +0200282 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100283 return;
284 }
Johannes Berg0c68ae262008-10-27 15:56:10 -0700285 mpl_dbg("Mesh plink timer for %pM fired on state %d\n",
286 sta->sta.addr, sta->plink_state);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100287 reason = 0;
288 llid = sta->llid;
289 plid = sta->plid;
Johannes Bergd0709a62008-02-25 16:27:46 +0100290 sdata = sta->sdata;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100291
292 switch (sta->plink_state) {
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800293 case PLINK_OPN_RCVD:
294 case PLINK_OPN_SNT:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100295 /* retry timer */
296 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
297 u32 rand;
Johannes Berg0c68ae262008-10-27 15:56:10 -0700298 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n",
299 sta->sta.addr, sta->plink_retries,
300 sta->plink_timeout);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100301 get_random_bytes(&rand, sizeof(u32));
302 sta->plink_timeout = sta->plink_timeout +
303 rand % sta->plink_timeout;
304 ++sta->plink_retries;
Johannes Bergd0709a62008-02-25 16:27:46 +0100305 mod_plink_timer(sta, sta->plink_timeout);
Johannes Berg07346f812008-05-03 01:02:02 +0200306 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200307 mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100308 0, 0);
309 break;
310 }
311 reason = cpu_to_le16(MESH_MAX_RETRIES);
312 /* fall through on else */
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800313 case PLINK_CNF_RCVD:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100314 /* confirm timer */
315 if (!reason)
316 reason = cpu_to_le16(MESH_CONFIRM_TIMEOUT);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800317 sta->plink_state = PLINK_HOLDING;
Johannes Bergd0709a62008-02-25 16:27:46 +0100318 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200319 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200320 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, plid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100321 reason);
322 break;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800323 case PLINK_HOLDING:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100324 /* holding timer */
Johannes Bergd0709a62008-02-25 16:27:46 +0100325 del_timer(&sta->plink_timer);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100326 mesh_plink_fsm_restart(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200327 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100328 break;
329 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200330 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100331 break;
332 }
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100333}
334
Johannes Berg5bb644a2009-05-17 11:40:42 +0200335#ifdef CONFIG_PM
336void mesh_plink_quiesce(struct sta_info *sta)
337{
338 if (del_timer_sync(&sta->plink_timer))
339 sta->plink_timer_was_running = true;
340}
341
342void mesh_plink_restart(struct sta_info *sta)
343{
344 if (sta->plink_timer_was_running) {
345 add_timer(&sta->plink_timer);
346 sta->plink_timer_was_running = false;
347 }
348}
349#endif
350
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100351static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
352{
353 sta->plink_timer.expires = jiffies + (HZ * timeout / 1000);
354 sta->plink_timer.data = (unsigned long) sta;
355 sta->plink_timer.function = mesh_plink_timer;
356 sta->plink_timeout = timeout;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100357 add_timer(&sta->plink_timer);
358}
359
360int mesh_plink_open(struct sta_info *sta)
361{
362 __le16 llid;
Johannes Bergd0709a62008-02-25 16:27:46 +0100363 struct ieee80211_sub_if_data *sdata = sta->sdata;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100364
Johannes Berg07346f812008-05-03 01:02:02 +0200365 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100366 get_random_bytes(&llid, 2);
367 sta->llid = llid;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800368 if (sta->plink_state != PLINK_LISTEN) {
Johannes Berg07346f812008-05-03 01:02:02 +0200369 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100370 return -EBUSY;
371 }
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800372 sta->plink_state = PLINK_OPN_SNT;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100373 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200374 spin_unlock_bh(&sta->lock);
Johannes Berg0c68ae262008-10-27 15:56:10 -0700375 mpl_dbg("Mesh plink: starting establishment with %pM\n",
376 sta->sta.addr);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100377
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200378 return mesh_plink_frame_tx(sdata, PLINK_OPEN,
Johannes Berg17741cd2008-09-11 00:02:02 +0200379 sta->sta.addr, llid, 0, 0);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100380}
381
382void mesh_plink_block(struct sta_info *sta)
383{
Johannes Berg07346f812008-05-03 01:02:02 +0200384 spin_lock_bh(&sta->lock);
Johannes Berg902acc72008-02-23 15:17:19 +0100385 __mesh_plink_deactivate(sta);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800386 sta->plink_state = PLINK_BLOCKED;
Johannes Berg07346f812008-05-03 01:02:02 +0200387 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100388}
389
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100390
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200391void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100392 size_t len, struct ieee80211_rx_status *rx_status)
393{
Johannes Bergd0709a62008-02-25 16:27:46 +0100394 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100395 struct ieee802_11_elems elems;
396 struct sta_info *sta;
397 enum plink_event event;
398 enum plink_frame_type ftype;
399 size_t baselen;
400 u8 ie_len;
401 u8 *baseaddr;
402 __le16 plid, llid, reason;
Rui Paulo1460dd12009-11-09 23:46:48 +0000403#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
404 static const char *mplstates[] = {
405 [PLINK_LISTEN] = "LISTEN",
406 [PLINK_OPN_SNT] = "OPN-SNT",
407 [PLINK_OPN_RCVD] = "OPN-RCVD",
408 [PLINK_CNF_RCVD] = "CNF_RCVD",
409 [PLINK_ESTAB] = "ESTAB",
410 [PLINK_HOLDING] = "HOLDING",
411 [PLINK_BLOCKED] = "BLOCKED"
412 };
413#endif
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100414
Johannes Berg9c80d3d2008-09-08 15:41:59 +0200415 /* need action_code, aux */
416 if (len < IEEE80211_MIN_ACTION_SIZE + 3)
417 return;
418
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100419 if (is_multicast_ether_addr(mgmt->da)) {
420 mpl_dbg("Mesh plink: ignore frame from multicast address");
421 return;
422 }
423
424 baseaddr = mgmt->u.action.u.plink_action.variable;
425 baselen = (u8 *) mgmt->u.action.u.plink_action.variable - (u8 *) mgmt;
426 if (mgmt->u.action.u.plink_action.action_code == PLINK_CONFIRM) {
427 baseaddr += 4;
David Woo70bdb6b2009-08-12 11:03:44 -0700428 baselen += 4;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100429 }
430 ieee802_11_parse_elems(baseaddr, len - baselen, &elems);
431 if (!elems.peer_link) {
432 mpl_dbg("Mesh plink: missing necessary peer link ie\n");
433 return;
434 }
435
Rui Paulo09383932009-11-09 23:46:43 +0000436 ftype = mgmt->u.action.u.plink_action.action_code;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100437 ie_len = elems.peer_link_len;
Rui Paulo09383932009-11-09 23:46:43 +0000438 if ((ftype == PLINK_OPEN && ie_len != 6) ||
439 (ftype == PLINK_CONFIRM && ie_len != 8) ||
440 (ftype == PLINK_CLOSE && ie_len != 8 && ie_len != 10)) {
441 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n",
442 ftype, ie_len);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100443 return;
444 }
445
446 if (ftype != PLINK_CLOSE && (!elems.mesh_id || !elems.mesh_config)) {
447 mpl_dbg("Mesh plink: missing necessary ie\n");
448 return;
449 }
450 /* Note the lines below are correct, the llid in the frame is the plid
451 * from the point of view of this host.
452 */
453 memcpy(&plid, PLINK_GET_LLID(elems.peer_link), 2);
Rui Paulo09383932009-11-09 23:46:43 +0000454 if (ftype == PLINK_CONFIRM || (ftype == PLINK_CLOSE && ie_len == 10))
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100455 memcpy(&llid, PLINK_GET_PLID(elems.peer_link), 2);
456
Johannes Bergd0709a62008-02-25 16:27:46 +0100457 rcu_read_lock();
458
Johannes Bergabe60632009-11-25 17:46:18 +0100459 sta = sta_info_get(sdata, mgmt->sa);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100460 if (!sta && ftype != PLINK_OPEN) {
461 mpl_dbg("Mesh plink: cls or cnf from unknown peer\n");
Johannes Bergd0709a62008-02-25 16:27:46 +0100462 rcu_read_unlock();
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100463 return;
464 }
465
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800466 if (sta && sta->plink_state == PLINK_BLOCKED) {
Johannes Bergd0709a62008-02-25 16:27:46 +0100467 rcu_read_unlock();
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100468 return;
469 }
470
471 /* Now we will figure out the appropriate event... */
472 event = PLINK_UNDEFINED;
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200473 if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, sdata))) {
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100474 switch (ftype) {
475 case PLINK_OPEN:
476 event = OPN_RJCT;
477 break;
478 case PLINK_CONFIRM:
479 event = CNF_RJCT;
480 break;
481 case PLINK_CLOSE:
482 /* avoid warning */
483 break;
484 }
Johannes Berg07346f812008-05-03 01:02:02 +0200485 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100486 } else if (!sta) {
487 /* ftype == PLINK_OPEN */
Johannes Berg881d9482009-01-21 15:13:48 +0100488 u32 rates;
Johannes Berg34e89502010-02-03 13:59:58 +0100489
490 rcu_read_unlock();
491
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100492 if (!mesh_plink_free_count(sdata)) {
493 mpl_dbg("Mesh plink error: no more free plinks\n");
494 return;
495 }
496
497 rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);
Johannes Berg03e44972008-02-27 09:56:40 +0100498 sta = mesh_plink_alloc(sdata, mgmt->sa, rates);
Johannes Berg73651ee2008-02-25 16:27:47 +0100499 if (!sta) {
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100500 mpl_dbg("Mesh plink error: plink table full\n");
501 return;
502 }
Johannes Berg34e89502010-02-03 13:59:58 +0100503 if (sta_info_insert_rcu(sta)) {
Johannes Berg73651ee2008-02-25 16:27:47 +0100504 rcu_read_unlock();
505 return;
506 }
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100507 event = OPN_ACPT;
Johannes Berg07346f812008-05-03 01:02:02 +0200508 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100509 } else {
Johannes Berg07346f812008-05-03 01:02:02 +0200510 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100511 switch (ftype) {
512 case PLINK_OPEN:
513 if (!mesh_plink_free_count(sdata) ||
Johannes Bergd0709a62008-02-25 16:27:46 +0100514 (sta->plid && sta->plid != plid))
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100515 event = OPN_IGNR;
516 else
517 event = OPN_ACPT;
518 break;
519 case PLINK_CONFIRM:
520 if (!mesh_plink_free_count(sdata) ||
Johannes Bergd0709a62008-02-25 16:27:46 +0100521 (sta->llid != llid || sta->plid != plid))
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100522 event = CNF_IGNR;
523 else
524 event = CNF_ACPT;
525 break;
526 case PLINK_CLOSE:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800527 if (sta->plink_state == PLINK_ESTAB)
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100528 /* Do not check for llid or plid. This does not
529 * follow the standard but since multiple plinks
530 * per sta are not supported, it is necessary in
531 * order to avoid a livelock when MP A sees an
532 * establish peer link to MP B but MP B does not
533 * see it. This can be caused by a timeout in
534 * B's peer link establishment or B beign
535 * restarted.
536 */
537 event = CLS_ACPT;
538 else if (sta->plid != plid)
539 event = CLS_IGNR;
540 else if (ie_len == 7 && sta->llid != llid)
541 event = CLS_IGNR;
542 else
543 event = CLS_ACPT;
544 break;
545 default:
546 mpl_dbg("Mesh plink: unknown frame subtype\n");
Johannes Berg07346f812008-05-03 01:02:02 +0200547 spin_unlock_bh(&sta->lock);
Johannes Bergd0709a62008-02-25 16:27:46 +0100548 rcu_read_unlock();
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100549 return;
550 }
551 }
552
Rui Paulo1460dd12009-11-09 23:46:48 +0000553 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %s %d %d %d\n",
554 mgmt->sa, mplstates[sta->plink_state],
Johannes Berg0c68ae262008-10-27 15:56:10 -0700555 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
556 event);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100557 reason = 0;
558 switch (sta->plink_state) {
559 /* spin_unlock as soon as state is updated at each case */
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800560 case PLINK_LISTEN:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100561 switch (event) {
562 case CLS_ACPT:
563 mesh_plink_fsm_restart(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200564 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100565 break;
566 case OPN_ACPT:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800567 sta->plink_state = PLINK_OPN_RCVD;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100568 sta->plid = plid;
569 get_random_bytes(&llid, 2);
570 sta->llid = llid;
571 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200572 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200573 mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100574 0, 0);
Johannes Berg17741cd2008-09-11 00:02:02 +0200575 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100576 llid, plid, 0);
577 break;
578 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200579 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100580 break;
581 }
582 break;
583
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800584 case PLINK_OPN_SNT:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100585 switch (event) {
586 case OPN_RJCT:
587 case CNF_RJCT:
588 reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
589 case CLS_ACPT:
590 if (!reason)
591 reason = cpu_to_le16(MESH_CLOSE_RCVD);
592 sta->reason = reason;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800593 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100594 if (!mod_plink_timer(sta,
595 dot11MeshHoldingTimeout(sdata)))
596 sta->ignore_plink_timer = true;
597
598 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200599 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200600 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100601 plid, reason);
602 break;
603 case OPN_ACPT:
604 /* retry timer is left untouched */
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800605 sta->plink_state = PLINK_OPN_RCVD;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100606 sta->plid = plid;
607 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200608 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200609 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100610 plid, 0);
611 break;
612 case CNF_ACPT:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800613 sta->plink_state = PLINK_CNF_RCVD;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100614 if (!mod_plink_timer(sta,
615 dot11MeshConfirmTimeout(sdata)))
616 sta->ignore_plink_timer = true;
617
Johannes Berg07346f812008-05-03 01:02:02 +0200618 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100619 break;
620 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200621 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100622 break;
623 }
624 break;
625
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800626 case PLINK_OPN_RCVD:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100627 switch (event) {
628 case OPN_RJCT:
629 case CNF_RJCT:
630 reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
631 case CLS_ACPT:
632 if (!reason)
633 reason = cpu_to_le16(MESH_CLOSE_RCVD);
634 sta->reason = reason;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800635 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100636 if (!mod_plink_timer(sta,
637 dot11MeshHoldingTimeout(sdata)))
638 sta->ignore_plink_timer = true;
639
640 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200641 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200642 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100643 plid, reason);
644 break;
645 case OPN_ACPT:
646 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200647 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200648 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100649 plid, 0);
650 break;
651 case CNF_ACPT:
Johannes Bergd0709a62008-02-25 16:27:46 +0100652 del_timer(&sta->plink_timer);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800653 sta->plink_state = PLINK_ESTAB;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100654 mesh_plink_inc_estab_count(sdata);
Johannes Berg07346f812008-05-03 01:02:02 +0200655 spin_unlock_bh(&sta->lock);
Johannes Berg0c68ae262008-10-27 15:56:10 -0700656 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
657 sta->sta.addr);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100658 break;
659 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200660 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100661 break;
662 }
663 break;
664
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800665 case PLINK_CNF_RCVD:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100666 switch (event) {
667 case OPN_RJCT:
668 case CNF_RJCT:
669 reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
670 case CLS_ACPT:
671 if (!reason)
672 reason = cpu_to_le16(MESH_CLOSE_RCVD);
673 sta->reason = reason;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800674 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100675 if (!mod_plink_timer(sta,
676 dot11MeshHoldingTimeout(sdata)))
677 sta->ignore_plink_timer = true;
678
679 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200680 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200681 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100682 plid, reason);
Johannes Bergff59dc72008-02-25 10:11:50 +0100683 break;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100684 case OPN_ACPT:
Johannes Bergd0709a62008-02-25 16:27:46 +0100685 del_timer(&sta->plink_timer);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800686 sta->plink_state = PLINK_ESTAB;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100687 mesh_plink_inc_estab_count(sdata);
Johannes Berg07346f812008-05-03 01:02:02 +0200688 spin_unlock_bh(&sta->lock);
Johannes Berg0c68ae262008-10-27 15:56:10 -0700689 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
690 sta->sta.addr);
Johannes Berg17741cd2008-09-11 00:02:02 +0200691 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100692 plid, 0);
693 break;
694 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200695 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100696 break;
697 }
698 break;
699
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800700 case PLINK_ESTAB:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100701 switch (event) {
702 case CLS_ACPT:
703 reason = cpu_to_le16(MESH_CLOSE_RCVD);
704 sta->reason = reason;
Johannes Berg902acc72008-02-23 15:17:19 +0100705 __mesh_plink_deactivate(sta);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800706 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100707 llid = sta->llid;
Johannes Bergd0709a62008-02-25 16:27:46 +0100708 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200709 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200710 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100711 plid, reason);
712 break;
713 case OPN_ACPT:
714 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200715 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200716 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100717 plid, 0);
718 break;
719 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200720 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100721 break;
722 }
723 break;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800724 case PLINK_HOLDING:
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100725 switch (event) {
726 case CLS_ACPT:
Johannes Bergd0709a62008-02-25 16:27:46 +0100727 if (del_timer(&sta->plink_timer))
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100728 sta->ignore_plink_timer = 1;
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100729 mesh_plink_fsm_restart(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200730 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100731 break;
732 case OPN_ACPT:
733 case CNF_ACPT:
734 case OPN_RJCT:
735 case CNF_RJCT:
736 llid = sta->llid;
737 reason = sta->reason;
Johannes Berg07346f812008-05-03 01:02:02 +0200738 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200739 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr,
740 llid, plid, reason);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100741 break;
742 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200743 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100744 }
745 break;
746 default:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800747 /* should not get here, PLINK_BLOCKED is dealt with at the
Daniel Mack3ad2f3f2010-02-03 08:01:28 +0800748 * beginning of the function
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100749 */
Johannes Berg07346f812008-05-03 01:02:02 +0200750 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100751 break;
752 }
Johannes Bergd0709a62008-02-25 16:27:46 +0100753
754 rcu_read_unlock();
Luis Carlos Coboc3896d22008-02-23 15:17:13 +0100755}