blob: 8a54bc836c923dfc4287ef72abf963fb56034e9c [file] [log] [blame]
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +01001/*
2 * Copyright (c) 2008 open80211s Ltd.
3 * 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 */
Johannes Berg902acc72008-02-23 15:17:19 +01009#include <linux/kernel.h>
10#include <linux/random.h>
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010011#include "ieee80211_i.h"
Johannes Berg2c8dccc2008-04-08 15:14:40 -040012#include "rate.h"
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010013#include "mesh.h"
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010014
15#ifdef CONFIG_MAC80211_VERBOSE_MPL_DEBUG
16#define mpl_dbg(fmt, args...) printk(KERN_DEBUG fmt, ##args)
17#else
18#define mpl_dbg(fmt, args...) do { (void)(0); } while (0)
19#endif
20
Rui Paulo09383932009-11-09 23:46:43 +000021#define PLINK_GET_LLID(p) (p + 4)
22#define PLINK_GET_PLID(p) (p + 6)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010023
24#define mod_plink_timer(s, t) (mod_timer(&s->plink_timer, \
25 jiffies + HZ * t / 1000))
26
27/* Peer link cancel reasons, all subject to ANA approval */
28#define MESH_LINK_CANCELLED 2
29#define MESH_MAX_NEIGHBORS 3
30#define MESH_CAPABILITY_POLICY_VIOLATION 4
31#define MESH_CLOSE_RCVD 5
32#define MESH_MAX_RETRIES 6
33#define MESH_CONFIRM_TIMEOUT 7
34#define MESH_SECURITY_ROLE_NEGOTIATION_DIFFERS 8
35#define MESH_SECURITY_AUTHENTICATION_IMPOSSIBLE 9
36#define MESH_SECURITY_FAILED_VERIFICATION 10
37
Johannes Berg472dbc42008-09-11 00:01:49 +020038#define dot11MeshMaxRetries(s) (s->u.mesh.mshcfg.dot11MeshMaxRetries)
39#define dot11MeshRetryTimeout(s) (s->u.mesh.mshcfg.dot11MeshRetryTimeout)
40#define dot11MeshConfirmTimeout(s) (s->u.mesh.mshcfg.dot11MeshConfirmTimeout)
41#define dot11MeshHoldingTimeout(s) (s->u.mesh.mshcfg.dot11MeshHoldingTimeout)
42#define dot11MeshMaxPeerLinks(s) (s->u.mesh.mshcfg.dot11MeshMaxPeerLinks)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010043
44enum plink_frame_type {
45 PLINK_OPEN = 0,
46 PLINK_CONFIRM,
47 PLINK_CLOSE
48};
49
50enum plink_event {
51 PLINK_UNDEFINED,
52 OPN_ACPT,
53 OPN_RJCT,
54 OPN_IGNR,
55 CNF_ACPT,
56 CNF_RJCT,
57 CNF_IGNR,
58 CLS_ACPT,
59 CLS_IGNR
60};
61
62static inline
63void mesh_plink_inc_estab_count(struct ieee80211_sub_if_data *sdata)
64{
Johannes Berg472dbc42008-09-11 00:01:49 +020065 atomic_inc(&sdata->u.mesh.mshstats.estab_plinks);
Johannes Bergd0709a62008-02-25 16:27:46 +010066 mesh_accept_plinks_update(sdata);
Rui Paulo8f2fda92009-11-09 23:46:41 +000067 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010068}
69
70static inline
71void mesh_plink_dec_estab_count(struct ieee80211_sub_if_data *sdata)
72{
Johannes Berg472dbc42008-09-11 00:01:49 +020073 atomic_dec(&sdata->u.mesh.mshstats.estab_plinks);
Johannes Bergd0709a62008-02-25 16:27:46 +010074 mesh_accept_plinks_update(sdata);
Rui Paulo8f2fda92009-11-09 23:46:41 +000075 ieee80211_bss_info_change_notify(sdata, BSS_CHANGED_BEACON);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010076}
77
78/**
79 * mesh_plink_fsm_restart - restart a mesh peer link finite state machine
80 *
Rui Paulo23c7a292009-11-09 23:46:42 +000081 * @sta: mesh peer link to restart
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010082 *
Johannes Berg07346f812008-05-03 01:02:02 +020083 * Locking: this function must be called holding sta->lock
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010084 */
85static inline void mesh_plink_fsm_restart(struct sta_info *sta)
86{
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -080087 sta->plink_state = PLINK_LISTEN;
Luis Carlos Cobo37659ff2008-02-29 12:13:38 -080088 sta->llid = sta->plid = sta->reason = 0;
89 sta->plink_retries = 0;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010090}
91
Johannes Berg93e5deb2008-04-01 15:21:00 +020092/*
93 * NOTE: This is just an alias for sta_info_alloc(), see notes
94 * on it in the lifecycle management section!
95 */
Johannes Berg03e44972008-02-27 09:56:40 +010096static struct sta_info *mesh_plink_alloc(struct ieee80211_sub_if_data *sdata,
Johannes Berg881d9482009-01-21 15:13:48 +010097 u8 *hw_addr, u32 rates)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +010098{
Johannes Bergd0709a62008-02-25 16:27:46 +010099 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100100 struct sta_info *sta;
101
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100102 if (local->num_sta >= MESH_MAX_PLINKS)
Johannes Berg73651ee2008-02-25 16:27:47 +0100103 return NULL;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100104
Johannes Berg03e44972008-02-27 09:56:40 +0100105 sta = sta_info_alloc(sdata, hw_addr, GFP_ATOMIC);
Johannes Berg73651ee2008-02-25 16:27:47 +0100106 if (!sta)
107 return NULL;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100108
Johannes Berg07346f812008-05-03 01:02:02 +0200109 sta->flags = WLAN_STA_AUTHORIZED;
Johannes Berg323ce792008-09-11 02:45:11 +0200110 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
Christian Lamparterb973c312008-12-27 22:19:49 +0100111 rate_control_rate_init(sta);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100112
113 return sta;
114}
115
116/**
Johannes Berg42096b62008-02-25 21:36:27 +0100117 * mesh_plink_deactivate - deactivate mesh peer link
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100118 *
119 * @sta: mesh peer link to deactivate
120 *
121 * All mesh paths with this peer as next hop will be flushed
122 *
Johannes Berg07346f812008-05-03 01:02:02 +0200123 * Locking: the caller must hold sta->lock
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100124 */
Johannes Berg902acc72008-02-23 15:17:19 +0100125static void __mesh_plink_deactivate(struct sta_info *sta)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100126{
Johannes Bergd0709a62008-02-25 16:27:46 +0100127 struct ieee80211_sub_if_data *sdata = sta->sdata;
128
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800129 if (sta->plink_state == PLINK_ESTAB)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100130 mesh_plink_dec_estab_count(sdata);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800131 sta->plink_state = PLINK_BLOCKED;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100132 mesh_path_flush_by_nexthop(sta);
133}
134
Johannes Berg902acc72008-02-23 15:17:19 +0100135/**
136 * __mesh_plink_deactivate - deactivate mesh peer link
137 *
138 * @sta: mesh peer link to deactivate
139 *
140 * All mesh paths with this peer as next hop will be flushed
141 */
142void mesh_plink_deactivate(struct sta_info *sta)
143{
Johannes Berg07346f812008-05-03 01:02:02 +0200144 spin_lock_bh(&sta->lock);
Johannes Berg902acc72008-02-23 15:17:19 +0100145 __mesh_plink_deactivate(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200146 spin_unlock_bh(&sta->lock);
Johannes Berg902acc72008-02-23 15:17:19 +0100147}
148
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200149static int mesh_plink_frame_tx(struct ieee80211_sub_if_data *sdata,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100150 enum plink_frame_type action, u8 *da, __le16 llid, __le16 plid,
151 __le16 reason) {
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200152 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100153 struct sk_buff *skb = dev_alloc_skb(local->hw.extra_tx_headroom + 400);
154 struct ieee80211_mgmt *mgmt;
155 bool include_plid = false;
Rui Paulo09383932009-11-09 23:46:43 +0000156 static const u8 meshpeeringproto[] = { 0x00, 0x0F, 0xAC, 0x2A };
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100157 u8 *pos;
158 int ie_len;
159
160 if (!skb)
161 return -1;
162 skb_reserve(skb, local->hw.extra_tx_headroom);
163 /* 25 is the size of the common mgmt part (24) plus the size of the
164 * common action part (1)
165 */
166 mgmt = (struct ieee80211_mgmt *)
167 skb_put(skb, 25 + sizeof(mgmt->u.action.u.plink_action));
168 memset(mgmt, 0, 25 + sizeof(mgmt->u.action.u.plink_action));
Harvey Harrisone7827a72008-07-15 18:44:13 -0700169 mgmt->frame_control = cpu_to_le16(IEEE80211_FTYPE_MGMT |
170 IEEE80211_STYPE_ACTION);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100171 memcpy(mgmt->da, da, ETH_ALEN);
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200172 memcpy(mgmt->sa, sdata->dev->dev_addr, ETH_ALEN);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100173 /* BSSID is left zeroed, wildcard value */
Rui Paulo09383932009-11-09 23:46:43 +0000174 mgmt->u.action.category = MESH_PLINK_CATEGORY;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100175 mgmt->u.action.u.plink_action.action_code = action;
176
177 if (action == PLINK_CLOSE)
178 mgmt->u.action.u.plink_action.aux = reason;
179 else {
180 mgmt->u.action.u.plink_action.aux = cpu_to_le16(0x0);
181 if (action == PLINK_CONFIRM) {
182 pos = skb_put(skb, 4);
183 /* two-byte status code followed by two-byte AID */
184 memset(pos, 0, 4);
185 }
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200186 mesh_mgmt_ies_add(skb, sdata);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100187 }
188
189 /* Add Peer Link Management element */
190 switch (action) {
191 case PLINK_OPEN:
Rui Paulo09383932009-11-09 23:46:43 +0000192 ie_len = 6;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100193 break;
194 case PLINK_CONFIRM:
Rui Paulo09383932009-11-09 23:46:43 +0000195 ie_len = 8;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100196 include_plid = true;
197 break;
198 case PLINK_CLOSE:
199 default:
200 if (!plid)
Rui Paulo09383932009-11-09 23:46:43 +0000201 ie_len = 8;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100202 else {
Rui Paulo09383932009-11-09 23:46:43 +0000203 ie_len = 10;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100204 include_plid = true;
205 }
206 break;
207 }
208
209 pos = skb_put(skb, 2 + ie_len);
210 *pos++ = WLAN_EID_PEER_LINK;
211 *pos++ = ie_len;
Rui Paulo09383932009-11-09 23:46:43 +0000212 memcpy(pos, meshpeeringproto, sizeof(meshpeeringproto));
213 pos += 4;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100214 memcpy(pos, &llid, 2);
215 if (include_plid) {
216 pos += 2;
217 memcpy(pos, &plid, 2);
218 }
219 if (action == PLINK_CLOSE) {
220 pos += 2;
221 memcpy(pos, &reason, 2);
222 }
223
Jouni Malinen1acc97b2009-01-08 13:32:07 +0200224 ieee80211_tx_skb(sdata, skb, 1);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100225 return 0;
226}
227
Johannes Berg881d9482009-01-21 15:13:48 +0100228void mesh_neighbour_update(u8 *hw_addr, u32 rates, struct ieee80211_sub_if_data *sdata,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100229 bool peer_accepting_plinks)
230{
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200231 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100232 struct sta_info *sta;
233
Johannes Bergd0709a62008-02-25 16:27:46 +0100234 rcu_read_lock();
235
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100236 sta = sta_info_get(local, hw_addr);
237 if (!sta) {
Johannes Berg03e44972008-02-27 09:56:40 +0100238 sta = mesh_plink_alloc(sdata, hw_addr, rates);
Johannes Berg73651ee2008-02-25 16:27:47 +0100239 if (!sta) {
240 rcu_read_unlock();
241 return;
242 }
243 if (sta_info_insert(sta)) {
Johannes Bergd0709a62008-02-25 16:27:46 +0100244 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100245 return;
Johannes Bergd0709a62008-02-25 16:27:46 +0100246 }
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100247 }
248
249 sta->last_rx = jiffies;
Johannes Berg323ce792008-09-11 02:45:11 +0200250 sta->sta.supp_rates[local->hw.conf.channel->band] = rates;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800251 if (peer_accepting_plinks && sta->plink_state == PLINK_LISTEN &&
Johannes Berg472dbc42008-09-11 00:01:49 +0200252 sdata->u.mesh.accepting_plinks &&
253 sdata->u.mesh.mshcfg.auto_open_plinks)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100254 mesh_plink_open(sta);
255
Johannes Bergd0709a62008-02-25 16:27:46 +0100256 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100257}
258
259static void mesh_plink_timer(unsigned long data)
260{
261 struct sta_info *sta;
262 __le16 llid, plid, reason;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100263 struct ieee80211_sub_if_data *sdata;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100264
Johannes Bergd0709a62008-02-25 16:27:46 +0100265 /*
266 * This STA is valid because sta_info_destroy() will
267 * del_timer_sync() this timer after having made sure
268 * it cannot be readded (by deleting the plink.)
269 */
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100270 sta = (struct sta_info *) data;
271
Johannes Berg5bb644a2009-05-17 11:40:42 +0200272 if (sta->sdata->local->quiescing) {
273 sta->plink_timer_was_running = true;
274 return;
275 }
276
Johannes Berg07346f812008-05-03 01:02:02 +0200277 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100278 if (sta->ignore_plink_timer) {
279 sta->ignore_plink_timer = false;
Johannes Berg07346f812008-05-03 01:02:02 +0200280 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100281 return;
282 }
Johannes Berg0c68ae262008-10-27 15:56:10 -0700283 mpl_dbg("Mesh plink timer for %pM fired on state %d\n",
284 sta->sta.addr, sta->plink_state);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100285 reason = 0;
286 llid = sta->llid;
287 plid = sta->plid;
Johannes Bergd0709a62008-02-25 16:27:46 +0100288 sdata = sta->sdata;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100289
290 switch (sta->plink_state) {
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800291 case PLINK_OPN_RCVD:
292 case PLINK_OPN_SNT:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100293 /* retry timer */
294 if (sta->plink_retries < dot11MeshMaxRetries(sdata)) {
295 u32 rand;
Johannes Berg0c68ae262008-10-27 15:56:10 -0700296 mpl_dbg("Mesh plink for %pM (retry, timeout): %d %d\n",
297 sta->sta.addr, sta->plink_retries,
298 sta->plink_timeout);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100299 get_random_bytes(&rand, sizeof(u32));
300 sta->plink_timeout = sta->plink_timeout +
301 rand % sta->plink_timeout;
302 ++sta->plink_retries;
Johannes Bergd0709a62008-02-25 16:27:46 +0100303 mod_plink_timer(sta, sta->plink_timeout);
Johannes Berg07346f812008-05-03 01:02:02 +0200304 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200305 mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100306 0, 0);
307 break;
308 }
309 reason = cpu_to_le16(MESH_MAX_RETRIES);
310 /* fall through on else */
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800311 case PLINK_CNF_RCVD:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100312 /* confirm timer */
313 if (!reason)
314 reason = cpu_to_le16(MESH_CONFIRM_TIMEOUT);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800315 sta->plink_state = PLINK_HOLDING;
Johannes Bergd0709a62008-02-25 16:27:46 +0100316 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200317 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200318 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid, plid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100319 reason);
320 break;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800321 case PLINK_HOLDING:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100322 /* holding timer */
Johannes Bergd0709a62008-02-25 16:27:46 +0100323 del_timer(&sta->plink_timer);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100324 mesh_plink_fsm_restart(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200325 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100326 break;
327 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200328 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100329 break;
330 }
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100331}
332
Johannes Berg5bb644a2009-05-17 11:40:42 +0200333#ifdef CONFIG_PM
334void mesh_plink_quiesce(struct sta_info *sta)
335{
336 if (del_timer_sync(&sta->plink_timer))
337 sta->plink_timer_was_running = true;
338}
339
340void mesh_plink_restart(struct sta_info *sta)
341{
342 if (sta->plink_timer_was_running) {
343 add_timer(&sta->plink_timer);
344 sta->plink_timer_was_running = false;
345 }
346}
347#endif
348
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100349static inline void mesh_plink_timer_set(struct sta_info *sta, int timeout)
350{
351 sta->plink_timer.expires = jiffies + (HZ * timeout / 1000);
352 sta->plink_timer.data = (unsigned long) sta;
353 sta->plink_timer.function = mesh_plink_timer;
354 sta->plink_timeout = timeout;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100355 add_timer(&sta->plink_timer);
356}
357
358int mesh_plink_open(struct sta_info *sta)
359{
360 __le16 llid;
Johannes Bergd0709a62008-02-25 16:27:46 +0100361 struct ieee80211_sub_if_data *sdata = sta->sdata;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100362
Johannes Berg07346f812008-05-03 01:02:02 +0200363 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100364 get_random_bytes(&llid, 2);
365 sta->llid = llid;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800366 if (sta->plink_state != PLINK_LISTEN) {
Johannes Berg07346f812008-05-03 01:02:02 +0200367 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100368 return -EBUSY;
369 }
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800370 sta->plink_state = PLINK_OPN_SNT;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100371 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200372 spin_unlock_bh(&sta->lock);
Johannes Berg0c68ae262008-10-27 15:56:10 -0700373 mpl_dbg("Mesh plink: starting establishment with %pM\n",
374 sta->sta.addr);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100375
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200376 return mesh_plink_frame_tx(sdata, PLINK_OPEN,
Johannes Berg17741cd2008-09-11 00:02:02 +0200377 sta->sta.addr, llid, 0, 0);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100378}
379
380void mesh_plink_block(struct sta_info *sta)
381{
Johannes Berg07346f812008-05-03 01:02:02 +0200382 spin_lock_bh(&sta->lock);
Johannes Berg902acc72008-02-23 15:17:19 +0100383 __mesh_plink_deactivate(sta);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800384 sta->plink_state = PLINK_BLOCKED;
Johannes Berg07346f812008-05-03 01:02:02 +0200385 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100386}
387
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100388
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200389void mesh_rx_plink_frame(struct ieee80211_sub_if_data *sdata, struct ieee80211_mgmt *mgmt,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100390 size_t len, struct ieee80211_rx_status *rx_status)
391{
Johannes Bergd0709a62008-02-25 16:27:46 +0100392 struct ieee80211_local *local = sdata->local;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100393 struct ieee802_11_elems elems;
394 struct sta_info *sta;
395 enum plink_event event;
396 enum plink_frame_type ftype;
397 size_t baselen;
398 u8 ie_len;
399 u8 *baseaddr;
400 __le16 plid, llid, reason;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100401
Johannes Berg9c80d3d2008-09-08 15:41:59 +0200402 /* need action_code, aux */
403 if (len < IEEE80211_MIN_ACTION_SIZE + 3)
404 return;
405
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100406 if (is_multicast_ether_addr(mgmt->da)) {
407 mpl_dbg("Mesh plink: ignore frame from multicast address");
408 return;
409 }
410
411 baseaddr = mgmt->u.action.u.plink_action.variable;
412 baselen = (u8 *) mgmt->u.action.u.plink_action.variable - (u8 *) mgmt;
413 if (mgmt->u.action.u.plink_action.action_code == PLINK_CONFIRM) {
414 baseaddr += 4;
David Woo70bdb6b2009-08-12 11:03:44 -0700415 baselen += 4;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100416 }
417 ieee802_11_parse_elems(baseaddr, len - baselen, &elems);
418 if (!elems.peer_link) {
419 mpl_dbg("Mesh plink: missing necessary peer link ie\n");
420 return;
421 }
422
Rui Paulo09383932009-11-09 23:46:43 +0000423 ftype = mgmt->u.action.u.plink_action.action_code;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100424 ie_len = elems.peer_link_len;
Rui Paulo09383932009-11-09 23:46:43 +0000425 if ((ftype == PLINK_OPEN && ie_len != 6) ||
426 (ftype == PLINK_CONFIRM && ie_len != 8) ||
427 (ftype == PLINK_CLOSE && ie_len != 8 && ie_len != 10)) {
428 mpl_dbg("Mesh plink: incorrect plink ie length %d %d\n",
429 ftype, ie_len);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100430 return;
431 }
432
433 if (ftype != PLINK_CLOSE && (!elems.mesh_id || !elems.mesh_config)) {
434 mpl_dbg("Mesh plink: missing necessary ie\n");
435 return;
436 }
437 /* Note the lines below are correct, the llid in the frame is the plid
438 * from the point of view of this host.
439 */
440 memcpy(&plid, PLINK_GET_LLID(elems.peer_link), 2);
Rui Paulo09383932009-11-09 23:46:43 +0000441 if (ftype == PLINK_CONFIRM || (ftype == PLINK_CLOSE && ie_len == 10))
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100442 memcpy(&llid, PLINK_GET_PLID(elems.peer_link), 2);
443
Johannes Bergd0709a62008-02-25 16:27:46 +0100444 rcu_read_lock();
445
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100446 sta = sta_info_get(local, mgmt->sa);
447 if (!sta && ftype != PLINK_OPEN) {
448 mpl_dbg("Mesh plink: cls or cnf from unknown peer\n");
Johannes Bergd0709a62008-02-25 16:27:46 +0100449 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100450 return;
451 }
452
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800453 if (sta && sta->plink_state == PLINK_BLOCKED) {
Johannes Bergd0709a62008-02-25 16:27:46 +0100454 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100455 return;
456 }
457
458 /* Now we will figure out the appropriate event... */
459 event = PLINK_UNDEFINED;
Jasper Bryant-Greenef698d852008-08-03 12:04:37 +1200460 if (ftype != PLINK_CLOSE && (!mesh_matches_local(&elems, sdata))) {
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100461 switch (ftype) {
462 case PLINK_OPEN:
463 event = OPN_RJCT;
464 break;
465 case PLINK_CONFIRM:
466 event = CNF_RJCT;
467 break;
468 case PLINK_CLOSE:
469 /* avoid warning */
470 break;
471 }
Johannes Berg07346f812008-05-03 01:02:02 +0200472 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100473 } else if (!sta) {
474 /* ftype == PLINK_OPEN */
Johannes Berg881d9482009-01-21 15:13:48 +0100475 u32 rates;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100476 if (!mesh_plink_free_count(sdata)) {
477 mpl_dbg("Mesh plink error: no more free plinks\n");
Johannes Bergd0709a62008-02-25 16:27:46 +0100478 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100479 return;
480 }
481
482 rates = ieee80211_sta_get_rates(local, &elems, rx_status->band);
Johannes Berg03e44972008-02-27 09:56:40 +0100483 sta = mesh_plink_alloc(sdata, mgmt->sa, rates);
Johannes Berg73651ee2008-02-25 16:27:47 +0100484 if (!sta) {
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100485 mpl_dbg("Mesh plink error: plink table full\n");
Johannes Bergd0709a62008-02-25 16:27:46 +0100486 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100487 return;
488 }
Johannes Berg73651ee2008-02-25 16:27:47 +0100489 if (sta_info_insert(sta)) {
Johannes Berg73651ee2008-02-25 16:27:47 +0100490 rcu_read_unlock();
491 return;
492 }
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100493 event = OPN_ACPT;
Johannes Berg07346f812008-05-03 01:02:02 +0200494 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100495 } else {
Johannes Berg07346f812008-05-03 01:02:02 +0200496 spin_lock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100497 switch (ftype) {
498 case PLINK_OPEN:
499 if (!mesh_plink_free_count(sdata) ||
Johannes Bergd0709a62008-02-25 16:27:46 +0100500 (sta->plid && sta->plid != plid))
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100501 event = OPN_IGNR;
502 else
503 event = OPN_ACPT;
504 break;
505 case PLINK_CONFIRM:
506 if (!mesh_plink_free_count(sdata) ||
Johannes Bergd0709a62008-02-25 16:27:46 +0100507 (sta->llid != llid || sta->plid != plid))
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100508 event = CNF_IGNR;
509 else
510 event = CNF_ACPT;
511 break;
512 case PLINK_CLOSE:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800513 if (sta->plink_state == PLINK_ESTAB)
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100514 /* Do not check for llid or plid. This does not
515 * follow the standard but since multiple plinks
516 * per sta are not supported, it is necessary in
517 * order to avoid a livelock when MP A sees an
518 * establish peer link to MP B but MP B does not
519 * see it. This can be caused by a timeout in
520 * B's peer link establishment or B beign
521 * restarted.
522 */
523 event = CLS_ACPT;
524 else if (sta->plid != plid)
525 event = CLS_IGNR;
526 else if (ie_len == 7 && sta->llid != llid)
527 event = CLS_IGNR;
528 else
529 event = CLS_ACPT;
530 break;
531 default:
532 mpl_dbg("Mesh plink: unknown frame subtype\n");
Johannes Berg07346f812008-05-03 01:02:02 +0200533 spin_unlock_bh(&sta->lock);
Johannes Bergd0709a62008-02-25 16:27:46 +0100534 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100535 return;
536 }
537 }
538
Johannes Berg0c68ae262008-10-27 15:56:10 -0700539 mpl_dbg("Mesh plink (peer, state, llid, plid, event): %pM %d %d %d %d\n",
540 mgmt->sa, sta->plink_state,
541 le16_to_cpu(sta->llid), le16_to_cpu(sta->plid),
542 event);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100543 reason = 0;
544 switch (sta->plink_state) {
545 /* spin_unlock as soon as state is updated at each case */
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800546 case PLINK_LISTEN:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100547 switch (event) {
548 case CLS_ACPT:
549 mesh_plink_fsm_restart(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200550 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100551 break;
552 case OPN_ACPT:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800553 sta->plink_state = PLINK_OPN_RCVD;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100554 sta->plid = plid;
555 get_random_bytes(&llid, 2);
556 sta->llid = llid;
557 mesh_plink_timer_set(sta, dot11MeshRetryTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200558 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200559 mesh_plink_frame_tx(sdata, PLINK_OPEN, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100560 0, 0);
Johannes Berg17741cd2008-09-11 00:02:02 +0200561 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100562 llid, plid, 0);
563 break;
564 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200565 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100566 break;
567 }
568 break;
569
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800570 case PLINK_OPN_SNT:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100571 switch (event) {
572 case OPN_RJCT:
573 case CNF_RJCT:
574 reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
575 case CLS_ACPT:
576 if (!reason)
577 reason = cpu_to_le16(MESH_CLOSE_RCVD);
578 sta->reason = reason;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800579 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100580 if (!mod_plink_timer(sta,
581 dot11MeshHoldingTimeout(sdata)))
582 sta->ignore_plink_timer = true;
583
584 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200585 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200586 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100587 plid, reason);
588 break;
589 case OPN_ACPT:
590 /* retry timer is left untouched */
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800591 sta->plink_state = PLINK_OPN_RCVD;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100592 sta->plid = plid;
593 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200594 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200595 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100596 plid, 0);
597 break;
598 case CNF_ACPT:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800599 sta->plink_state = PLINK_CNF_RCVD;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100600 if (!mod_plink_timer(sta,
601 dot11MeshConfirmTimeout(sdata)))
602 sta->ignore_plink_timer = true;
603
Johannes Berg07346f812008-05-03 01:02:02 +0200604 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100605 break;
606 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200607 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100608 break;
609 }
610 break;
611
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800612 case PLINK_OPN_RCVD:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100613 switch (event) {
614 case OPN_RJCT:
615 case CNF_RJCT:
616 reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
617 case CLS_ACPT:
618 if (!reason)
619 reason = cpu_to_le16(MESH_CLOSE_RCVD);
620 sta->reason = reason;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800621 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100622 if (!mod_plink_timer(sta,
623 dot11MeshHoldingTimeout(sdata)))
624 sta->ignore_plink_timer = true;
625
626 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200627 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200628 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100629 plid, reason);
630 break;
631 case OPN_ACPT:
632 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200633 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200634 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100635 plid, 0);
636 break;
637 case CNF_ACPT:
Johannes Bergd0709a62008-02-25 16:27:46 +0100638 del_timer(&sta->plink_timer);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800639 sta->plink_state = PLINK_ESTAB;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100640 mesh_plink_inc_estab_count(sdata);
Johannes Berg07346f812008-05-03 01:02:02 +0200641 spin_unlock_bh(&sta->lock);
Johannes Berg0c68ae262008-10-27 15:56:10 -0700642 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
643 sta->sta.addr);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100644 break;
645 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200646 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100647 break;
648 }
649 break;
650
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800651 case PLINK_CNF_RCVD:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100652 switch (event) {
653 case OPN_RJCT:
654 case CNF_RJCT:
655 reason = cpu_to_le16(MESH_CAPABILITY_POLICY_VIOLATION);
656 case CLS_ACPT:
657 if (!reason)
658 reason = cpu_to_le16(MESH_CLOSE_RCVD);
659 sta->reason = reason;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800660 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100661 if (!mod_plink_timer(sta,
662 dot11MeshHoldingTimeout(sdata)))
663 sta->ignore_plink_timer = true;
664
665 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200666 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200667 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100668 plid, reason);
Johannes Bergff59dc72008-02-25 10:11:50 +0100669 break;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100670 case OPN_ACPT:
Johannes Bergd0709a62008-02-25 16:27:46 +0100671 del_timer(&sta->plink_timer);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800672 sta->plink_state = PLINK_ESTAB;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100673 mesh_plink_inc_estab_count(sdata);
Johannes Berg07346f812008-05-03 01:02:02 +0200674 spin_unlock_bh(&sta->lock);
Johannes Berg0c68ae262008-10-27 15:56:10 -0700675 mpl_dbg("Mesh plink with %pM ESTABLISHED\n",
676 sta->sta.addr);
Johannes Berg17741cd2008-09-11 00:02:02 +0200677 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100678 plid, 0);
679 break;
680 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200681 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100682 break;
683 }
684 break;
685
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800686 case PLINK_ESTAB:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100687 switch (event) {
688 case CLS_ACPT:
689 reason = cpu_to_le16(MESH_CLOSE_RCVD);
690 sta->reason = reason;
Johannes Berg902acc72008-02-23 15:17:19 +0100691 __mesh_plink_deactivate(sta);
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800692 sta->plink_state = PLINK_HOLDING;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100693 llid = sta->llid;
Johannes Bergd0709a62008-02-25 16:27:46 +0100694 mod_plink_timer(sta, dot11MeshHoldingTimeout(sdata));
Johannes Berg07346f812008-05-03 01:02:02 +0200695 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200696 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100697 plid, reason);
698 break;
699 case OPN_ACPT:
700 llid = sta->llid;
Johannes Berg07346f812008-05-03 01:02:02 +0200701 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200702 mesh_plink_frame_tx(sdata, PLINK_CONFIRM, sta->sta.addr, llid,
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100703 plid, 0);
704 break;
705 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200706 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100707 break;
708 }
709 break;
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800710 case PLINK_HOLDING:
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100711 switch (event) {
712 case CLS_ACPT:
Johannes Bergd0709a62008-02-25 16:27:46 +0100713 if (del_timer(&sta->plink_timer))
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100714 sta->ignore_plink_timer = 1;
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100715 mesh_plink_fsm_restart(sta);
Johannes Berg07346f812008-05-03 01:02:02 +0200716 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100717 break;
718 case OPN_ACPT:
719 case CNF_ACPT:
720 case OPN_RJCT:
721 case CNF_RJCT:
722 llid = sta->llid;
723 reason = sta->reason;
Johannes Berg07346f812008-05-03 01:02:02 +0200724 spin_unlock_bh(&sta->lock);
Johannes Berg17741cd2008-09-11 00:02:02 +0200725 mesh_plink_frame_tx(sdata, PLINK_CLOSE, sta->sta.addr,
726 llid, plid, reason);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100727 break;
728 default:
Johannes Berg07346f812008-05-03 01:02:02 +0200729 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100730 }
731 break;
732 default:
Luis Carlos Cobob4e08ea2008-02-29 15:46:08 -0800733 /* should not get here, PLINK_BLOCKED is dealt with at the
734 * beggining of the function
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100735 */
Johannes Berg07346f812008-05-03 01:02:02 +0200736 spin_unlock_bh(&sta->lock);
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100737 break;
738 }
Johannes Bergd0709a62008-02-25 16:27:46 +0100739
740 rcu_read_unlock();
Luis Carlos Coboc3896d2c2008-02-23 15:17:13 +0100741}