]>
Commit | Line | Data |
---|---|---|
f0706e82 JB |
1 | /* |
2 | * Copyright 2002-2005, Instant802 Networks, Inc. | |
3 | * Copyright 2005-2006, Devicescape Software, Inc. | |
4 | * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz> | |
5 | * | |
6 | * This program is free software; you can redistribute it and/or modify | |
7 | * it under the terms of the GNU General Public License version 2 as | |
8 | * published by the Free Software Foundation. | |
9 | */ | |
10 | ||
11 | #include <net/mac80211.h> | |
12 | #include <net/ieee80211_radiotap.h> | |
13 | #include <linux/module.h> | |
14 | #include <linux/init.h> | |
15 | #include <linux/netdevice.h> | |
16 | #include <linux/types.h> | |
17 | #include <linux/slab.h> | |
18 | #include <linux/skbuff.h> | |
19 | #include <linux/etherdevice.h> | |
20 | #include <linux/if_arp.h> | |
21 | #include <linux/wireless.h> | |
22 | #include <linux/rtnetlink.h> | |
f0706e82 | 23 | #include <linux/bitmap.h> |
881d966b | 24 | #include <net/net_namespace.h> |
f0706e82 JB |
25 | #include <net/cfg80211.h> |
26 | ||
f0706e82 JB |
27 | #include "ieee80211_i.h" |
28 | #include "ieee80211_rate.h" | |
f7a92144 | 29 | #include "mesh.h" |
f0706e82 | 30 | #include "wep.h" |
f0706e82 JB |
31 | #include "wme.h" |
32 | #include "aes_ccm.h" | |
33 | #include "ieee80211_led.h" | |
e0eb6859 | 34 | #include "cfg.h" |
e9f207f0 JB |
35 | #include "debugfs.h" |
36 | #include "debugfs_netdev.h" | |
f0706e82 | 37 | |
d3c990fb RR |
38 | #define SUPP_MCS_SET_LEN 16 |
39 | ||
b306f453 JB |
40 | /* |
41 | * For seeing transmitted packets on monitor interfaces | |
42 | * we have a radiotap header too. | |
43 | */ | |
44 | struct ieee80211_tx_status_rtap_hdr { | |
45 | struct ieee80211_radiotap_header hdr; | |
46 | __le16 tx_flags; | |
47 | u8 data_retries; | |
48 | } __attribute__ ((packed)); | |
49 | ||
b2c258fb | 50 | /* common interface routines */ |
b306f453 | 51 | |
b95cce35 | 52 | static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr) |
b2c258fb JB |
53 | { |
54 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ | |
55 | return ETH_ALEN; | |
56 | } | |
f0706e82 | 57 | |
4150c572 JB |
58 | /* must be called under mdev tx lock */ |
59 | static void ieee80211_configure_filter(struct ieee80211_local *local) | |
60 | { | |
61 | unsigned int changed_flags; | |
62 | unsigned int new_flags = 0; | |
63 | ||
53918994 | 64 | if (atomic_read(&local->iff_promiscs)) |
4150c572 JB |
65 | new_flags |= FIF_PROMISC_IN_BSS; |
66 | ||
53918994 | 67 | if (atomic_read(&local->iff_allmultis)) |
4150c572 JB |
68 | new_flags |= FIF_ALLMULTI; |
69 | ||
70 | if (local->monitors) | |
8cc9a739 MW |
71 | new_flags |= FIF_BCN_PRBRESP_PROMISC; |
72 | ||
73 | if (local->fif_fcsfail) | |
74 | new_flags |= FIF_FCSFAIL; | |
75 | ||
76 | if (local->fif_plcpfail) | |
77 | new_flags |= FIF_PLCPFAIL; | |
78 | ||
79 | if (local->fif_control) | |
80 | new_flags |= FIF_CONTROL; | |
81 | ||
82 | if (local->fif_other_bss) | |
83 | new_flags |= FIF_OTHER_BSS; | |
4150c572 JB |
84 | |
85 | changed_flags = local->filter_flags ^ new_flags; | |
86 | ||
87 | /* be a bit nasty */ | |
88 | new_flags |= (1<<31); | |
89 | ||
90 | local->ops->configure_filter(local_to_hw(local), | |
91 | changed_flags, &new_flags, | |
92 | local->mdev->mc_count, | |
93 | local->mdev->mc_list); | |
94 | ||
95 | WARN_ON(new_flags & (1<<31)); | |
96 | ||
97 | local->filter_flags = new_flags & ~(1<<31); | |
98 | } | |
99 | ||
b2c258fb | 100 | /* master interface */ |
f0706e82 | 101 | |
b2c258fb JB |
102 | static int ieee80211_master_open(struct net_device *dev) |
103 | { | |
104 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
105 | struct ieee80211_sub_if_data *sdata; | |
106 | int res = -EOPNOTSUPP; | |
f0706e82 | 107 | |
79010420 JB |
108 | /* we hold the RTNL here so can safely walk the list */ |
109 | list_for_each_entry(sdata, &local->interfaces, list) { | |
b2c258fb JB |
110 | if (sdata->dev != dev && netif_running(sdata->dev)) { |
111 | res = 0; | |
112 | break; | |
113 | } | |
114 | } | |
b2c258fb JB |
115 | return res; |
116 | } | |
f0706e82 | 117 | |
b2c258fb | 118 | static int ieee80211_master_stop(struct net_device *dev) |
f0706e82 | 119 | { |
b2c258fb JB |
120 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
121 | struct ieee80211_sub_if_data *sdata; | |
f0706e82 | 122 | |
79010420 JB |
123 | /* we hold the RTNL here so can safely walk the list */ |
124 | list_for_each_entry(sdata, &local->interfaces, list) | |
b2c258fb JB |
125 | if (sdata->dev != dev && netif_running(sdata->dev)) |
126 | dev_close(sdata->dev); | |
f0706e82 | 127 | |
b2c258fb JB |
128 | return 0; |
129 | } | |
f0706e82 | 130 | |
4150c572 JB |
131 | static void ieee80211_master_set_multicast_list(struct net_device *dev) |
132 | { | |
133 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
134 | ||
135 | ieee80211_configure_filter(local); | |
136 | } | |
137 | ||
b2c258fb | 138 | /* regular interfaces */ |
f0706e82 | 139 | |
b2c258fb | 140 | static int ieee80211_change_mtu(struct net_device *dev, int new_mtu) |
f0706e82 | 141 | { |
f7a92144 LCC |
142 | int meshhdrlen; |
143 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
144 | ||
145 | meshhdrlen = (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT) ? 5 : 0; | |
146 | ||
b2c258fb JB |
147 | /* FIX: what would be proper limits for MTU? |
148 | * This interface uses 802.3 frames. */ | |
f7a92144 LCC |
149 | if (new_mtu < 256 || |
150 | new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6 - meshhdrlen) { | |
b2c258fb JB |
151 | printk(KERN_WARNING "%s: invalid MTU %d\n", |
152 | dev->name, new_mtu); | |
153 | return -EINVAL; | |
154 | } | |
f0706e82 | 155 | |
b2c258fb JB |
156 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
157 | printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu); | |
158 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ | |
159 | dev->mtu = new_mtu; | |
f0706e82 JB |
160 | return 0; |
161 | } | |
162 | ||
b2c258fb JB |
163 | static inline int identical_mac_addr_allowed(int type1, int type2) |
164 | { | |
165 | return (type1 == IEEE80211_IF_TYPE_MNTR || | |
166 | type2 == IEEE80211_IF_TYPE_MNTR || | |
167 | (type1 == IEEE80211_IF_TYPE_AP && | |
168 | type2 == IEEE80211_IF_TYPE_WDS) || | |
169 | (type1 == IEEE80211_IF_TYPE_WDS && | |
170 | (type2 == IEEE80211_IF_TYPE_WDS || | |
171 | type2 == IEEE80211_IF_TYPE_AP)) || | |
172 | (type1 == IEEE80211_IF_TYPE_AP && | |
173 | type2 == IEEE80211_IF_TYPE_VLAN) || | |
174 | (type1 == IEEE80211_IF_TYPE_VLAN && | |
175 | (type2 == IEEE80211_IF_TYPE_AP || | |
176 | type2 == IEEE80211_IF_TYPE_VLAN))); | |
177 | } | |
f0706e82 | 178 | |
b2c258fb | 179 | static int ieee80211_open(struct net_device *dev) |
e2ebc74d | 180 | { |
b2c258fb JB |
181 | struct ieee80211_sub_if_data *sdata, *nsdata; |
182 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
183 | struct ieee80211_if_init_conf conf; | |
184 | int res; | |
ceffefd1 | 185 | bool need_hw_reconfig = 0; |
f0706e82 | 186 | |
b2c258fb | 187 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
0ec3ca44 | 188 | |
79010420 JB |
189 | /* we hold the RTNL here so can safely walk the list */ |
190 | list_for_each_entry(nsdata, &local->interfaces, list) { | |
b2c258fb | 191 | struct net_device *ndev = nsdata->dev; |
e2ebc74d | 192 | |
665e8aaf JB |
193 | if (ndev != dev && ndev != local->mdev && netif_running(ndev)) { |
194 | /* | |
195 | * Allow only a single IBSS interface to be up at any | |
196 | * time. This is restricted because beacon distribution | |
197 | * cannot work properly if both are in the same IBSS. | |
198 | * | |
199 | * To remove this restriction we'd have to disallow them | |
200 | * from setting the same SSID on different IBSS interfaces | |
201 | * belonging to the same hardware. Then, however, we're | |
202 | * faced with having to adopt two different TSF timers... | |
203 | */ | |
204 | if (sdata->vif.type == IEEE80211_IF_TYPE_IBSS && | |
205 | nsdata->vif.type == IEEE80211_IF_TYPE_IBSS) | |
206 | return -EBUSY; | |
207 | ||
208 | /* | |
209 | * Disallow multiple IBSS/STA mode interfaces. | |
210 | * | |
211 | * This is a technical restriction, it is possible although | |
212 | * most likely not IEEE 802.11 compliant to have multiple | |
213 | * STAs with just a single hardware (the TSF timer will not | |
214 | * be adjusted properly.) | |
215 | * | |
216 | * However, because mac80211 uses the master device's BSS | |
217 | * information for each STA/IBSS interface, doing this will | |
218 | * currently corrupt that BSS information completely, unless, | |
219 | * a not very useful case, both STAs are associated to the | |
220 | * same BSS. | |
221 | * | |
222 | * To remove this restriction, the BSS information needs to | |
223 | * be embedded in the STA/IBSS mode sdata instead of using | |
224 | * the master device's BSS structure. | |
225 | */ | |
226 | if ((sdata->vif.type == IEEE80211_IF_TYPE_STA || | |
227 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) && | |
228 | (nsdata->vif.type == IEEE80211_IF_TYPE_STA || | |
229 | nsdata->vif.type == IEEE80211_IF_TYPE_IBSS)) | |
230 | return -EBUSY; | |
231 | ||
232 | /* | |
233 | * The remaining checks are only performed for interfaces | |
234 | * with the same MAC address. | |
235 | */ | |
236 | if (compare_ether_addr(dev->dev_addr, ndev->dev_addr)) | |
237 | continue; | |
238 | ||
0ec3ca44 JB |
239 | /* |
240 | * check whether it may have the same address | |
241 | */ | |
51fb61e7 JB |
242 | if (!identical_mac_addr_allowed(sdata->vif.type, |
243 | nsdata->vif.type)) | |
0ec3ca44 | 244 | return -ENOTUNIQ; |
0ec3ca44 JB |
245 | |
246 | /* | |
247 | * can only add VLANs to enabled APs | |
248 | */ | |
51fb61e7 | 249 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN && |
665e8aaf | 250 | nsdata->vif.type == IEEE80211_IF_TYPE_AP) |
0ec3ca44 | 251 | sdata->u.vlan.ap = nsdata; |
b2c258fb JB |
252 | } |
253 | } | |
f0706e82 | 254 | |
51fb61e7 | 255 | switch (sdata->vif.type) { |
0ec3ca44 JB |
256 | case IEEE80211_IF_TYPE_WDS: |
257 | if (is_zero_ether_addr(sdata->u.wds.remote_addr)) | |
258 | return -ENOLINK; | |
259 | break; | |
260 | case IEEE80211_IF_TYPE_VLAN: | |
261 | if (!sdata->u.vlan.ap) | |
262 | return -ENOLINK; | |
263 | break; | |
fb1c1cd6 | 264 | case IEEE80211_IF_TYPE_AP: |
fb1c1cd6 JB |
265 | case IEEE80211_IF_TYPE_STA: |
266 | case IEEE80211_IF_TYPE_MNTR: | |
267 | case IEEE80211_IF_TYPE_IBSS: | |
6032f934 | 268 | case IEEE80211_IF_TYPE_MESH_POINT: |
fb1c1cd6 JB |
269 | /* no special treatment */ |
270 | break; | |
a2897552 JB |
271 | case IEEE80211_IF_TYPE_INVALID: |
272 | /* cannot happen */ | |
273 | WARN_ON(1); | |
274 | break; | |
0ec3ca44 | 275 | } |
f0706e82 | 276 | |
b2c258fb JB |
277 | if (local->open_count == 0) { |
278 | res = 0; | |
4150c572 JB |
279 | if (local->ops->start) |
280 | res = local->ops->start(local_to_hw(local)); | |
281 | if (res) | |
b2c258fb | 282 | return res; |
ceffefd1 | 283 | need_hw_reconfig = 1; |
cdcb006f | 284 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); |
b2c258fb | 285 | } |
f0706e82 | 286 | |
51fb61e7 | 287 | switch (sdata->vif.type) { |
0ec3ca44 JB |
288 | case IEEE80211_IF_TYPE_VLAN: |
289 | list_add(&sdata->u.vlan.list, &sdata->u.vlan.ap->u.ap.vlans); | |
290 | /* no need to tell driver */ | |
291 | break; | |
4150c572 | 292 | case IEEE80211_IF_TYPE_MNTR: |
3d30d949 MW |
293 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { |
294 | local->cooked_mntrs++; | |
295 | break; | |
296 | } | |
297 | ||
4150c572 | 298 | /* must be before the call to ieee80211_configure_filter */ |
b2c258fb | 299 | local->monitors++; |
8cc9a739 | 300 | if (local->monitors == 1) |
4150c572 | 301 | local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP; |
8cc9a739 MW |
302 | |
303 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | |
304 | local->fif_fcsfail++; | |
305 | if (sdata->u.mntr_flags & MONITOR_FLAG_PLCPFAIL) | |
306 | local->fif_plcpfail++; | |
307 | if (sdata->u.mntr_flags & MONITOR_FLAG_CONTROL) | |
308 | local->fif_control++; | |
309 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | |
310 | local->fif_other_bss++; | |
311 | ||
312 | netif_tx_lock_bh(local->mdev); | |
313 | ieee80211_configure_filter(local); | |
314 | netif_tx_unlock_bh(local->mdev); | |
4150c572 JB |
315 | break; |
316 | case IEEE80211_IF_TYPE_STA: | |
317 | case IEEE80211_IF_TYPE_IBSS: | |
318 | sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET; | |
319 | /* fall through */ | |
320 | default: | |
32bfd35d | 321 | conf.vif = &sdata->vif; |
51fb61e7 | 322 | conf.type = sdata->vif.type; |
4150c572 JB |
323 | conf.mac_addr = dev->dev_addr; |
324 | res = local->ops->add_interface(local_to_hw(local), &conf); | |
325 | if (res && !local->open_count && local->ops->stop) | |
326 | local->ops->stop(local_to_hw(local)); | |
327 | if (res) | |
328 | return res; | |
329 | ||
b2c258fb | 330 | ieee80211_if_config(dev); |
d9430a32 | 331 | ieee80211_reset_erp_info(dev); |
11a843b7 | 332 | ieee80211_enable_keys(sdata); |
4150c572 | 333 | |
51fb61e7 | 334 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA && |
ddd3d2be | 335 | !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) |
4150c572 JB |
336 | netif_carrier_off(dev); |
337 | else | |
338 | netif_carrier_on(dev); | |
d9430a32 | 339 | } |
f0706e82 | 340 | |
4150c572 JB |
341 | if (local->open_count == 0) { |
342 | res = dev_open(local->mdev); | |
343 | WARN_ON(res); | |
4150c572 JB |
344 | tasklet_enable(&local->tx_pending_tasklet); |
345 | tasklet_enable(&local->tasklet); | |
346 | } | |
347 | ||
c1428b3f JB |
348 | /* |
349 | * set_multicast_list will be invoked by the networking core | |
350 | * which will check whether any increments here were done in | |
351 | * error and sync them down to the hardware as filter flags. | |
352 | */ | |
353 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) | |
354 | atomic_inc(&local->iff_allmultis); | |
355 | ||
356 | if (sdata->flags & IEEE80211_SDATA_PROMISC) | |
357 | atomic_inc(&local->iff_promiscs); | |
358 | ||
4150c572 | 359 | local->open_count++; |
ceffefd1 MB |
360 | if (need_hw_reconfig) |
361 | ieee80211_hw_config(local); | |
f0706e82 | 362 | |
b2c258fb | 363 | netif_start_queue(dev); |
4150c572 | 364 | |
b2c258fb | 365 | return 0; |
f0706e82 | 366 | } |
f0706e82 | 367 | |
4150c572 | 368 | static int ieee80211_stop(struct net_device *dev) |
f0706e82 | 369 | { |
4150c572 | 370 | struct ieee80211_sub_if_data *sdata; |
f0706e82 | 371 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
4150c572 | 372 | struct ieee80211_if_init_conf conf; |
07db2183 RR |
373 | struct sta_info *sta; |
374 | int i; | |
4150c572 JB |
375 | |
376 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
377 | ||
d0709a65 JB |
378 | rcu_read_lock(); |
379 | ||
380 | list_for_each_entry_rcu(sta, &local->sta_list, list) { | |
381 | if (sta->sdata == sdata) | |
5b3d71d9 | 382 | for (i = 0; i < STA_TID_NUM; i++) |
d0709a65 | 383 | ieee80211_sta_stop_rx_ba_session(sdata->dev, |
5b3d71d9 RR |
384 | sta->addr, i, |
385 | WLAN_BACK_RECIPIENT, | |
07db2183 RR |
386 | WLAN_REASON_QSTA_LEAVE_QBSS); |
387 | } | |
388 | ||
d0709a65 JB |
389 | rcu_read_unlock(); |
390 | ||
4150c572 JB |
391 | netif_stop_queue(dev); |
392 | ||
c1428b3f JB |
393 | /* |
394 | * Don't count this interface for promisc/allmulti while it | |
395 | * is down. dev_mc_unsync() will invoke set_multicast_list | |
396 | * on the master interface which will sync these down to the | |
397 | * hardware as filter flags. | |
398 | */ | |
399 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) | |
400 | atomic_dec(&local->iff_allmultis); | |
401 | ||
402 | if (sdata->flags & IEEE80211_SDATA_PROMISC) | |
403 | atomic_dec(&local->iff_promiscs); | |
404 | ||
4150c572 JB |
405 | dev_mc_unsync(local->mdev, dev); |
406 | ||
5dfdaf58 | 407 | /* APs need special treatment */ |
51fb61e7 | 408 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
0ec3ca44 | 409 | struct ieee80211_sub_if_data *vlan, *tmp; |
5dfdaf58 | 410 | struct beacon_data *old_beacon = sdata->u.ap.beacon; |
0ec3ca44 | 411 | |
5dfdaf58 JB |
412 | /* remove beacon */ |
413 | rcu_assign_pointer(sdata->u.ap.beacon, NULL); | |
414 | synchronize_rcu(); | |
415 | kfree(old_beacon); | |
416 | ||
417 | /* down all dependent devices, that is VLANs */ | |
0ec3ca44 JB |
418 | list_for_each_entry_safe(vlan, tmp, &sdata->u.ap.vlans, |
419 | u.vlan.list) | |
420 | dev_close(vlan->dev); | |
421 | WARN_ON(!list_empty(&sdata->u.ap.vlans)); | |
422 | } | |
423 | ||
4150c572 | 424 | local->open_count--; |
f0706e82 | 425 | |
51fb61e7 | 426 | switch (sdata->vif.type) { |
0ec3ca44 JB |
427 | case IEEE80211_IF_TYPE_VLAN: |
428 | list_del(&sdata->u.vlan.list); | |
429 | sdata->u.vlan.ap = NULL; | |
430 | /* no need to tell driver */ | |
431 | break; | |
4150c572 | 432 | case IEEE80211_IF_TYPE_MNTR: |
3d30d949 MW |
433 | if (sdata->u.mntr_flags & MONITOR_FLAG_COOK_FRAMES) { |
434 | local->cooked_mntrs--; | |
435 | break; | |
436 | } | |
437 | ||
4150c572 | 438 | local->monitors--; |
8cc9a739 | 439 | if (local->monitors == 0) |
8b393f1d | 440 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; |
8cc9a739 MW |
441 | |
442 | if (sdata->u.mntr_flags & MONITOR_FLAG_FCSFAIL) | |
443 | local->fif_fcsfail--; | |
444 | if (sdata->u.mntr_flags & MONITOR_FLAG_PLCPFAIL) | |
445 | local->fif_plcpfail--; | |
446 | if (sdata->u.mntr_flags & MONITOR_FLAG_CONTROL) | |
447 | local->fif_control--; | |
448 | if (sdata->u.mntr_flags & MONITOR_FLAG_OTHER_BSS) | |
449 | local->fif_other_bss--; | |
450 | ||
451 | netif_tx_lock_bh(local->mdev); | |
452 | ieee80211_configure_filter(local); | |
453 | netif_tx_unlock_bh(local->mdev); | |
4150c572 | 454 | break; |
f7a92144 | 455 | case IEEE80211_IF_TYPE_MESH_POINT: |
d0709a65 | 456 | sta_info_flush(local, sdata); |
f7a92144 | 457 | /* fall through */ |
b2c258fb JB |
458 | case IEEE80211_IF_TYPE_STA: |
459 | case IEEE80211_IF_TYPE_IBSS: | |
460 | sdata->u.sta.state = IEEE80211_DISABLED; | |
461 | del_timer_sync(&sdata->u.sta.timer); | |
2a8a9a88 | 462 | /* |
79010420 JB |
463 | * When we get here, the interface is marked down. |
464 | * Call synchronize_rcu() to wait for the RX path | |
465 | * should it be using the interface and enqueuing | |
466 | * frames at this very time on another CPU. | |
2a8a9a88 | 467 | */ |
79010420 | 468 | synchronize_rcu(); |
b2c258fb | 469 | skb_queue_purge(&sdata->u.sta.skb_queue); |
2a8a9a88 | 470 | |
ece8eddd ZY |
471 | if (local->scan_dev == sdata->dev) { |
472 | if (!local->ops->hw_scan) { | |
473 | local->sta_sw_scanning = 0; | |
474 | cancel_delayed_work(&local->scan_work); | |
475 | } else | |
476 | local->sta_hw_scanning = 0; | |
b2c258fb | 477 | } |
ece8eddd | 478 | |
b2c258fb | 479 | flush_workqueue(local->hw.workqueue); |
a10605e5 ZY |
480 | |
481 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; | |
482 | kfree(sdata->u.sta.extra_ie); | |
483 | sdata->u.sta.extra_ie = NULL; | |
484 | sdata->u.sta.extra_ie_len = 0; | |
4150c572 JB |
485 | /* fall through */ |
486 | default: | |
32bfd35d | 487 | conf.vif = &sdata->vif; |
51fb61e7 | 488 | conf.type = sdata->vif.type; |
4150c572 | 489 | conf.mac_addr = dev->dev_addr; |
11a843b7 JB |
490 | /* disable all keys for as long as this netdev is down */ |
491 | ieee80211_disable_keys(sdata); | |
4150c572 | 492 | local->ops->remove_interface(local_to_hw(local), &conf); |
f0706e82 JB |
493 | } |
494 | ||
b2c258fb JB |
495 | if (local->open_count == 0) { |
496 | if (netif_running(local->mdev)) | |
497 | dev_close(local->mdev); | |
4150c572 | 498 | |
b2c258fb JB |
499 | if (local->ops->stop) |
500 | local->ops->stop(local_to_hw(local)); | |
4150c572 | 501 | |
cdcb006f ID |
502 | ieee80211_led_radio(local, 0); |
503 | ||
b2c258fb JB |
504 | tasklet_disable(&local->tx_pending_tasklet); |
505 | tasklet_disable(&local->tasklet); | |
506 | } | |
b2c258fb | 507 | |
f0706e82 JB |
508 | return 0; |
509 | } | |
510 | ||
eadc8d9e RR |
511 | int ieee80211_start_tx_ba_session(struct ieee80211_hw *hw, u8 *ra, u16 tid) |
512 | { | |
513 | struct ieee80211_local *local = hw_to_local(hw); | |
514 | struct sta_info *sta; | |
515 | struct ieee80211_sub_if_data *sdata; | |
516 | u16 start_seq_num = 0; | |
517 | u8 *state; | |
518 | int ret; | |
519 | DECLARE_MAC_BUF(mac); | |
520 | ||
521 | if (tid >= STA_TID_NUM) | |
522 | return -EINVAL; | |
523 | ||
524 | #ifdef CONFIG_MAC80211_HT_DEBUG | |
525 | printk(KERN_DEBUG "Open BA session requested for %s tid %u\n", | |
526 | print_mac(mac, ra), tid); | |
527 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | |
528 | ||
d0709a65 JB |
529 | rcu_read_lock(); |
530 | ||
eadc8d9e RR |
531 | sta = sta_info_get(local, ra); |
532 | if (!sta) { | |
533 | printk(KERN_DEBUG "Could not find the station\n"); | |
d0709a65 | 534 | rcu_read_unlock(); |
eadc8d9e RR |
535 | return -ENOENT; |
536 | } | |
537 | ||
538 | spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); | |
539 | ||
540 | /* we have tried too many times, receiver does not want A-MPDU */ | |
541 | if (sta->ampdu_mlme.tid_tx[tid].addba_req_num > HT_AGG_MAX_RETRIES) { | |
542 | ret = -EBUSY; | |
543 | goto start_ba_exit; | |
544 | } | |
545 | ||
546 | state = &sta->ampdu_mlme.tid_tx[tid].state; | |
547 | /* check if the TID is not in aggregation flow already */ | |
548 | if (*state != HT_AGG_STATE_IDLE) { | |
549 | #ifdef CONFIG_MAC80211_HT_DEBUG | |
550 | printk(KERN_DEBUG "BA request denied - session is not " | |
551 | "idle on tid %u\n", tid); | |
552 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | |
553 | ret = -EAGAIN; | |
554 | goto start_ba_exit; | |
555 | } | |
556 | ||
557 | /* ensure that TX flow won't interrupt us | |
558 | * until the end of the call to requeue function */ | |
559 | spin_lock_bh(&local->mdev->queue_lock); | |
560 | ||
561 | /* create a new queue for this aggregation */ | |
9e723492 | 562 | ret = ieee80211_ht_agg_queue_add(local, sta, tid); |
eadc8d9e RR |
563 | |
564 | /* case no queue is available to aggregation | |
565 | * don't switch to aggregation */ | |
566 | if (ret) { | |
567 | #ifdef CONFIG_MAC80211_HT_DEBUG | |
568 | printk(KERN_DEBUG "BA request denied - no queue available for" | |
569 | " tid %d\n", tid); | |
570 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | |
571 | spin_unlock_bh(&local->mdev->queue_lock); | |
572 | goto start_ba_exit; | |
573 | } | |
d0709a65 | 574 | sdata = sta->sdata; |
eadc8d9e RR |
575 | |
576 | /* Ok, the Addba frame hasn't been sent yet, but if the driver calls the | |
577 | * call back right away, it must see that the flow has begun */ | |
578 | *state |= HT_ADDBA_REQUESTED_MSK; | |
579 | ||
580 | if (local->ops->ampdu_action) | |
581 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_START, | |
582 | ra, tid, &start_seq_num); | |
583 | ||
584 | if (ret) { | |
585 | /* No need to requeue the packets in the agg queue, since we | |
586 | * held the tx lock: no packet could be enqueued to the newly | |
587 | * allocated queue */ | |
9e723492 | 588 | ieee80211_ht_agg_queue_remove(local, sta, tid, 0); |
eadc8d9e RR |
589 | #ifdef CONFIG_MAC80211_HT_DEBUG |
590 | printk(KERN_DEBUG "BA request denied - HW or queue unavailable" | |
591 | " for tid %d\n", tid); | |
592 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | |
593 | spin_unlock_bh(&local->mdev->queue_lock); | |
594 | *state = HT_AGG_STATE_IDLE; | |
595 | goto start_ba_exit; | |
596 | } | |
597 | ||
598 | /* Will put all the packets in the new SW queue */ | |
9e723492 | 599 | ieee80211_requeue(local, ieee802_1d_to_ac[tid]); |
eadc8d9e RR |
600 | spin_unlock_bh(&local->mdev->queue_lock); |
601 | ||
602 | /* We have most probably almost emptied the legacy queue */ | |
603 | /* ieee80211_wake_queue(local_to_hw(local), ieee802_1d_to_ac[tid]); */ | |
604 | ||
605 | /* send an addBA request */ | |
606 | sta->ampdu_mlme.dialog_token_allocator++; | |
607 | sta->ampdu_mlme.tid_tx[tid].dialog_token = | |
608 | sta->ampdu_mlme.dialog_token_allocator; | |
609 | sta->ampdu_mlme.tid_tx[tid].ssn = start_seq_num; | |
610 | ||
d0709a65 | 611 | ieee80211_send_addba_request(sta->sdata->dev, ra, tid, |
eadc8d9e RR |
612 | sta->ampdu_mlme.tid_tx[tid].dialog_token, |
613 | sta->ampdu_mlme.tid_tx[tid].ssn, | |
614 | 0x40, 5000); | |
615 | ||
616 | /* activate the timer for the recipient's addBA response */ | |
617 | sta->ampdu_mlme.tid_tx[tid].addba_resp_timer.expires = | |
618 | jiffies + ADDBA_RESP_INTERVAL; | |
619 | add_timer(&sta->ampdu_mlme.tid_tx[tid].addba_resp_timer); | |
620 | printk(KERN_DEBUG "activated addBA response timer on tid %d\n", tid); | |
621 | ||
622 | start_ba_exit: | |
623 | spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); | |
d0709a65 | 624 | rcu_read_unlock(); |
eadc8d9e RR |
625 | return ret; |
626 | } | |
627 | EXPORT_SYMBOL(ieee80211_start_tx_ba_session); | |
628 | ||
629 | int ieee80211_stop_tx_ba_session(struct ieee80211_hw *hw, | |
630 | u8 *ra, u16 tid, | |
631 | enum ieee80211_back_parties initiator) | |
632 | { | |
633 | struct ieee80211_local *local = hw_to_local(hw); | |
634 | struct sta_info *sta; | |
635 | u8 *state; | |
636 | int ret = 0; | |
637 | DECLARE_MAC_BUF(mac); | |
638 | ||
639 | if (tid >= STA_TID_NUM) | |
640 | return -EINVAL; | |
641 | ||
642 | #ifdef CONFIG_MAC80211_HT_DEBUG | |
643 | printk(KERN_DEBUG "Stop a BA session requested for %s tid %u\n", | |
644 | print_mac(mac, ra), tid); | |
645 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | |
646 | ||
d0709a65 | 647 | rcu_read_lock(); |
eadc8d9e | 648 | sta = sta_info_get(local, ra); |
d0709a65 JB |
649 | if (!sta) { |
650 | rcu_read_unlock(); | |
eadc8d9e | 651 | return -ENOENT; |
d0709a65 | 652 | } |
eadc8d9e RR |
653 | |
654 | /* check if the TID is in aggregation */ | |
655 | state = &sta->ampdu_mlme.tid_tx[tid].state; | |
656 | spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); | |
657 | ||
658 | if (*state != HT_AGG_STATE_OPERATIONAL) { | |
659 | #ifdef CONFIG_MAC80211_HT_DEBUG | |
660 | printk(KERN_DEBUG "Try to stop Tx aggregation on" | |
661 | " non active TID\n"); | |
662 | #endif /* CONFIG_MAC80211_HT_DEBUG */ | |
663 | ret = -ENOENT; | |
664 | goto stop_BA_exit; | |
665 | } | |
666 | ||
667 | ieee80211_stop_queue(hw, sta->tid_to_tx_q[tid]); | |
668 | ||
669 | *state = HT_AGG_STATE_REQ_STOP_BA_MSK | | |
670 | (initiator << HT_AGG_STATE_INITIATOR_SHIFT); | |
671 | ||
672 | if (local->ops->ampdu_action) | |
673 | ret = local->ops->ampdu_action(hw, IEEE80211_AMPDU_TX_STOP, | |
674 | ra, tid, NULL); | |
675 | ||
676 | /* case HW denied going back to legacy */ | |
677 | if (ret) { | |
678 | WARN_ON(ret != -EBUSY); | |
679 | *state = HT_AGG_STATE_OPERATIONAL; | |
680 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | |
681 | goto stop_BA_exit; | |
682 | } | |
683 | ||
684 | stop_BA_exit: | |
685 | spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); | |
d0709a65 | 686 | rcu_read_unlock(); |
eadc8d9e RR |
687 | return ret; |
688 | } | |
689 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_session); | |
690 | ||
691 | void ieee80211_start_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u16 tid) | |
692 | { | |
693 | struct ieee80211_local *local = hw_to_local(hw); | |
694 | struct sta_info *sta; | |
695 | u8 *state; | |
696 | DECLARE_MAC_BUF(mac); | |
697 | ||
698 | if (tid >= STA_TID_NUM) { | |
699 | printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", | |
700 | tid, STA_TID_NUM); | |
701 | return; | |
702 | } | |
703 | ||
d0709a65 | 704 | rcu_read_lock(); |
eadc8d9e RR |
705 | sta = sta_info_get(local, ra); |
706 | if (!sta) { | |
d0709a65 | 707 | rcu_read_unlock(); |
eadc8d9e RR |
708 | printk(KERN_DEBUG "Could not find station: %s\n", |
709 | print_mac(mac, ra)); | |
710 | return; | |
711 | } | |
712 | ||
713 | state = &sta->ampdu_mlme.tid_tx[tid].state; | |
714 | spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); | |
715 | ||
716 | if (!(*state & HT_ADDBA_REQUESTED_MSK)) { | |
717 | printk(KERN_DEBUG "addBA was not requested yet, state is %d\n", | |
718 | *state); | |
719 | spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); | |
d0709a65 | 720 | rcu_read_unlock(); |
eadc8d9e RR |
721 | return; |
722 | } | |
723 | ||
724 | WARN_ON_ONCE(*state & HT_ADDBA_DRV_READY_MSK); | |
725 | ||
726 | *state |= HT_ADDBA_DRV_READY_MSK; | |
727 | ||
728 | if (*state == HT_AGG_STATE_OPERATIONAL) { | |
729 | printk(KERN_DEBUG "Aggregation is on for tid %d \n", tid); | |
730 | ieee80211_wake_queue(hw, sta->tid_to_tx_q[tid]); | |
731 | } | |
732 | spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); | |
d0709a65 | 733 | rcu_read_unlock(); |
eadc8d9e RR |
734 | } |
735 | EXPORT_SYMBOL(ieee80211_start_tx_ba_cb); | |
736 | ||
737 | void ieee80211_stop_tx_ba_cb(struct ieee80211_hw *hw, u8 *ra, u8 tid) | |
738 | { | |
739 | struct ieee80211_local *local = hw_to_local(hw); | |
740 | struct sta_info *sta; | |
741 | u8 *state; | |
742 | int agg_queue; | |
743 | DECLARE_MAC_BUF(mac); | |
744 | ||
745 | if (tid >= STA_TID_NUM) { | |
746 | printk(KERN_DEBUG "Bad TID value: tid = %d (>= %d)\n", | |
747 | tid, STA_TID_NUM); | |
748 | return; | |
749 | } | |
750 | ||
751 | printk(KERN_DEBUG "Stop a BA session requested on DA %s tid %d\n", | |
752 | print_mac(mac, ra), tid); | |
753 | ||
d0709a65 | 754 | rcu_read_lock(); |
eadc8d9e RR |
755 | sta = sta_info_get(local, ra); |
756 | if (!sta) { | |
757 | printk(KERN_DEBUG "Could not find station: %s\n", | |
758 | print_mac(mac, ra)); | |
d0709a65 | 759 | rcu_read_unlock(); |
eadc8d9e RR |
760 | return; |
761 | } | |
762 | state = &sta->ampdu_mlme.tid_tx[tid].state; | |
763 | ||
764 | spin_lock_bh(&sta->ampdu_mlme.ampdu_tx); | |
765 | if ((*state & HT_AGG_STATE_REQ_STOP_BA_MSK) == 0) { | |
766 | printk(KERN_DEBUG "unexpected callback to A-MPDU stop\n"); | |
eadc8d9e | 767 | spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); |
d0709a65 | 768 | rcu_read_unlock(); |
eadc8d9e RR |
769 | return; |
770 | } | |
771 | ||
772 | if (*state & HT_AGG_STATE_INITIATOR_MSK) | |
d0709a65 | 773 | ieee80211_send_delba(sta->sdata->dev, ra, tid, |
eadc8d9e RR |
774 | WLAN_BACK_INITIATOR, WLAN_REASON_QSTA_NOT_USE); |
775 | ||
776 | agg_queue = sta->tid_to_tx_q[tid]; | |
777 | ||
778 | /* avoid ordering issues: we are the only one that can modify | |
779 | * the content of the qdiscs */ | |
780 | spin_lock_bh(&local->mdev->queue_lock); | |
781 | /* remove the queue for this aggregation */ | |
9e723492 | 782 | ieee80211_ht_agg_queue_remove(local, sta, tid, 1); |
eadc8d9e RR |
783 | spin_unlock_bh(&local->mdev->queue_lock); |
784 | ||
785 | /* we just requeued the all the frames that were in the removed | |
786 | * queue, and since we might miss a softirq we do netif_schedule. | |
787 | * ieee80211_wake_queue is not used here as this queue is not | |
788 | * necessarily stopped */ | |
789 | netif_schedule(local->mdev); | |
790 | *state = HT_AGG_STATE_IDLE; | |
791 | sta->ampdu_mlme.tid_tx[tid].addba_req_num = 0; | |
792 | spin_unlock_bh(&sta->ampdu_mlme.ampdu_tx); | |
793 | ||
d0709a65 | 794 | rcu_read_unlock(); |
eadc8d9e RR |
795 | } |
796 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb); | |
797 | ||
798 | void ieee80211_start_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, | |
799 | const u8 *ra, u16 tid) | |
800 | { | |
801 | struct ieee80211_local *local = hw_to_local(hw); | |
802 | struct ieee80211_ra_tid *ra_tid; | |
803 | struct sk_buff *skb = dev_alloc_skb(0); | |
804 | ||
805 | if (unlikely(!skb)) { | |
806 | if (net_ratelimit()) | |
807 | printk(KERN_WARNING "%s: Not enough memory, " | |
808 | "dropping start BA session", skb->dev->name); | |
809 | return; | |
810 | } | |
811 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | |
812 | memcpy(&ra_tid->ra, ra, ETH_ALEN); | |
813 | ra_tid->tid = tid; | |
814 | ||
815 | skb->pkt_type = IEEE80211_ADDBA_MSG; | |
816 | skb_queue_tail(&local->skb_queue, skb); | |
817 | tasklet_schedule(&local->tasklet); | |
818 | } | |
819 | EXPORT_SYMBOL(ieee80211_start_tx_ba_cb_irqsafe); | |
820 | ||
821 | void ieee80211_stop_tx_ba_cb_irqsafe(struct ieee80211_hw *hw, | |
822 | const u8 *ra, u16 tid) | |
823 | { | |
824 | struct ieee80211_local *local = hw_to_local(hw); | |
825 | struct ieee80211_ra_tid *ra_tid; | |
826 | struct sk_buff *skb = dev_alloc_skb(0); | |
827 | ||
828 | if (unlikely(!skb)) { | |
829 | if (net_ratelimit()) | |
830 | printk(KERN_WARNING "%s: Not enough memory, " | |
831 | "dropping stop BA session", skb->dev->name); | |
832 | return; | |
833 | } | |
834 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | |
835 | memcpy(&ra_tid->ra, ra, ETH_ALEN); | |
836 | ra_tid->tid = tid; | |
837 | ||
838 | skb->pkt_type = IEEE80211_DELBA_MSG; | |
839 | skb_queue_tail(&local->skb_queue, skb); | |
840 | tasklet_schedule(&local->tasklet); | |
841 | } | |
842 | EXPORT_SYMBOL(ieee80211_stop_tx_ba_cb_irqsafe); | |
843 | ||
f0706e82 JB |
844 | static void ieee80211_set_multicast_list(struct net_device *dev) |
845 | { | |
846 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
847 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
4150c572 | 848 | int allmulti, promisc, sdata_allmulti, sdata_promisc; |
f0706e82 | 849 | |
4150c572 JB |
850 | allmulti = !!(dev->flags & IFF_ALLMULTI); |
851 | promisc = !!(dev->flags & IFF_PROMISC); | |
b52f2198 JB |
852 | sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI); |
853 | sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC); | |
4150c572 JB |
854 | |
855 | if (allmulti != sdata_allmulti) { | |
856 | if (dev->flags & IFF_ALLMULTI) | |
53918994 | 857 | atomic_inc(&local->iff_allmultis); |
4150c572 | 858 | else |
53918994 | 859 | atomic_dec(&local->iff_allmultis); |
13262ffd | 860 | sdata->flags ^= IEEE80211_SDATA_ALLMULTI; |
f0706e82 | 861 | } |
4150c572 JB |
862 | |
863 | if (promisc != sdata_promisc) { | |
864 | if (dev->flags & IFF_PROMISC) | |
53918994 | 865 | atomic_inc(&local->iff_promiscs); |
4150c572 | 866 | else |
53918994 | 867 | atomic_dec(&local->iff_promiscs); |
13262ffd | 868 | sdata->flags ^= IEEE80211_SDATA_PROMISC; |
f0706e82 | 869 | } |
4150c572 JB |
870 | |
871 | dev_mc_sync(local->mdev, dev); | |
f0706e82 JB |
872 | } |
873 | ||
3b04ddde SH |
874 | static const struct header_ops ieee80211_header_ops = { |
875 | .create = eth_header, | |
876 | .parse = header_parse_80211, | |
877 | .rebuild = eth_rebuild_header, | |
878 | .cache = eth_header_cache, | |
879 | .cache_update = eth_header_cache_update, | |
880 | }; | |
881 | ||
f9d540ee | 882 | /* Must not be called for mdev */ |
b2c258fb | 883 | void ieee80211_if_setup(struct net_device *dev) |
f0706e82 | 884 | { |
b2c258fb JB |
885 | ether_setup(dev); |
886 | dev->hard_start_xmit = ieee80211_subif_start_xmit; | |
887 | dev->wireless_handlers = &ieee80211_iw_handler_def; | |
888 | dev->set_multicast_list = ieee80211_set_multicast_list; | |
889 | dev->change_mtu = ieee80211_change_mtu; | |
b2c258fb JB |
890 | dev->open = ieee80211_open; |
891 | dev->stop = ieee80211_stop; | |
b2c258fb JB |
892 | dev->destructor = ieee80211_if_free; |
893 | } | |
f0706e82 | 894 | |
b2c258fb JB |
895 | /* WDS specialties */ |
896 | ||
897 | int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr) | |
898 | { | |
899 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
900 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
901 | struct sta_info *sta; | |
0795af57 | 902 | DECLARE_MAC_BUF(mac); |
b2c258fb | 903 | |
d0709a65 JB |
904 | might_sleep(); |
905 | ||
b2c258fb JB |
906 | if (compare_ether_addr(remote_addr, sdata->u.wds.remote_addr) == 0) |
907 | return 0; | |
908 | ||
d0709a65 JB |
909 | rcu_read_lock(); |
910 | ||
b2c258fb | 911 | /* Create STA entry for the new peer */ |
d0709a65 JB |
912 | sta = sta_info_add(sdata, remote_addr); |
913 | if (IS_ERR(sta)) { | |
914 | rcu_read_unlock(); | |
43ba7e95 | 915 | return PTR_ERR(sta); |
d0709a65 | 916 | } |
238814fd JB |
917 | |
918 | sta->flags |= WLAN_STA_AUTHORIZED; | |
919 | ||
b2c258fb JB |
920 | /* Remove STA entry for the old peer */ |
921 | sta = sta_info_get(local, sdata->u.wds.remote_addr); | |
d0709a65 JB |
922 | if (sta) |
923 | sta_info_unlink(&sta); | |
924 | else | |
b2c258fb | 925 | printk(KERN_DEBUG "%s: could not find STA entry for WDS link " |
0795af57 JP |
926 | "peer %s\n", |
927 | dev->name, print_mac(mac, sdata->u.wds.remote_addr)); | |
b2c258fb JB |
928 | |
929 | /* Update WDS link data */ | |
930 | memcpy(&sdata->u.wds.remote_addr, remote_addr, ETH_ALEN); | |
931 | ||
d0709a65 JB |
932 | rcu_read_unlock(); |
933 | ||
934 | if (sta) { | |
935 | synchronize_rcu(); | |
936 | sta_info_destroy(sta); | |
937 | } | |
938 | ||
b2c258fb | 939 | return 0; |
f0706e82 | 940 | } |
f0706e82 | 941 | |
b2c258fb JB |
942 | /* everything else */ |
943 | ||
b2c258fb JB |
944 | static int __ieee80211_if_config(struct net_device *dev, |
945 | struct sk_buff *beacon, | |
946 | struct ieee80211_tx_control *control) | |
947 | { | |
948 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
949 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
950 | struct ieee80211_if_conf conf; | |
b2c258fb JB |
951 | |
952 | if (!local->ops->config_interface || !netif_running(dev)) | |
f0706e82 | 953 | return 0; |
f0706e82 | 954 | |
b2c258fb | 955 | memset(&conf, 0, sizeof(conf)); |
51fb61e7 JB |
956 | conf.type = sdata->vif.type; |
957 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || | |
958 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { | |
4150c572 | 959 | conf.bssid = sdata->u.sta.bssid; |
b2c258fb JB |
960 | conf.ssid = sdata->u.sta.ssid; |
961 | conf.ssid_len = sdata->u.sta.ssid_len; | |
902acc78 | 962 | } else if (ieee80211_vif_is_mesh(&sdata->vif)) { |
f7a92144 LCC |
963 | conf.beacon = beacon; |
964 | ieee80211_start_mesh(dev); | |
51fb61e7 | 965 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
b2c258fb JB |
966 | conf.ssid = sdata->u.ap.ssid; |
967 | conf.ssid_len = sdata->u.ap.ssid_len; | |
b2c258fb JB |
968 | conf.beacon = beacon; |
969 | conf.beacon_control = control; | |
f0706e82 | 970 | } |
b2c258fb | 971 | return local->ops->config_interface(local_to_hw(local), |
32bfd35d | 972 | &sdata->vif, &conf); |
f0706e82 JB |
973 | } |
974 | ||
b2c258fb JB |
975 | int ieee80211_if_config(struct net_device *dev) |
976 | { | |
f7a92144 LCC |
977 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
978 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); | |
979 | if (sdata->vif.type == IEEE80211_IF_TYPE_MESH_POINT && | |
980 | (local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) | |
981 | return ieee80211_if_config_beacon(dev); | |
b2c258fb JB |
982 | return __ieee80211_if_config(dev, NULL, NULL); |
983 | } | |
f0706e82 | 984 | |
b2c258fb | 985 | int ieee80211_if_config_beacon(struct net_device *dev) |
f0706e82 | 986 | { |
f0706e82 | 987 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
b2c258fb | 988 | struct ieee80211_tx_control control; |
32bfd35d | 989 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
b2c258fb | 990 | struct sk_buff *skb; |
f0706e82 | 991 | |
b2c258fb | 992 | if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) |
f0706e82 | 993 | return 0; |
32bfd35d JB |
994 | skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, |
995 | &control); | |
b2c258fb JB |
996 | if (!skb) |
997 | return -ENOMEM; | |
998 | return __ieee80211_if_config(dev, skb, &control); | |
999 | } | |
f0706e82 | 1000 | |
b2c258fb JB |
1001 | int ieee80211_hw_config(struct ieee80211_local *local) |
1002 | { | |
b2c258fb JB |
1003 | struct ieee80211_channel *chan; |
1004 | int ret = 0; | |
f0706e82 | 1005 | |
8318d78a | 1006 | if (local->sta_sw_scanning) |
b2c258fb | 1007 | chan = local->scan_channel; |
8318d78a | 1008 | else |
b2c258fb | 1009 | chan = local->oper_channel; |
f0706e82 | 1010 | |
8318d78a JB |
1011 | local->hw.conf.channel = chan; |
1012 | ||
1013 | if (!local->hw.conf.power_level) | |
1014 | local->hw.conf.power_level = chan->max_power; | |
1015 | else | |
1016 | local->hw.conf.power_level = min(chan->max_power, | |
1017 | local->hw.conf.power_level); | |
1018 | ||
1019 | local->hw.conf.max_antenna_gain = chan->max_antenna_gain; | |
f0706e82 | 1020 | |
b2c258fb | 1021 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
8318d78a JB |
1022 | printk(KERN_DEBUG "%s: HW CONFIG: freq=%d\n", |
1023 | wiphy_name(local->hw.wiphy), chan->center_freq); | |
1024 | #endif | |
b2c258fb | 1025 | |
f7c4daed | 1026 | if (local->open_count) |
b2c258fb | 1027 | ret = local->ops->config(local_to_hw(local), &local->hw.conf); |
f0706e82 | 1028 | |
b2c258fb JB |
1029 | return ret; |
1030 | } | |
f0706e82 | 1031 | |
d3c990fb RR |
1032 | /** |
1033 | * ieee80211_hw_config_ht should be used only after legacy configuration | |
1034 | * has been determined, as ht configuration depends upon the hardware's | |
1035 | * HT abilities for a _specific_ band. | |
1036 | */ | |
1037 | int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht, | |
1038 | struct ieee80211_ht_info *req_ht_cap, | |
1039 | struct ieee80211_ht_bss_info *req_bss_cap) | |
1040 | { | |
1041 | struct ieee80211_conf *conf = &local->hw.conf; | |
8318d78a | 1042 | struct ieee80211_supported_band *sband; |
d3c990fb RR |
1043 | int i; |
1044 | ||
8318d78a JB |
1045 | sband = local->hw.wiphy->bands[conf->channel->band]; |
1046 | ||
d3c990fb | 1047 | /* HT is not supported */ |
8318d78a | 1048 | if (!sband->ht_info.ht_supported) { |
d3c990fb RR |
1049 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; |
1050 | return -EOPNOTSUPP; | |
1051 | } | |
1052 | ||
1053 | /* disable HT */ | |
1054 | if (!enable_ht) { | |
1055 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; | |
1056 | } else { | |
1057 | conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE; | |
8318d78a | 1058 | conf->ht_conf.cap = req_ht_cap->cap & sband->ht_info.cap; |
d3c990fb RR |
1059 | conf->ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS); |
1060 | conf->ht_conf.cap |= | |
8318d78a | 1061 | sband->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS; |
d3c990fb RR |
1062 | conf->ht_bss_conf.primary_channel = |
1063 | req_bss_cap->primary_channel; | |
1064 | conf->ht_bss_conf.bss_cap = req_bss_cap->bss_cap; | |
1065 | conf->ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode; | |
1066 | for (i = 0; i < SUPP_MCS_SET_LEN; i++) | |
1067 | conf->ht_conf.supp_mcs_set[i] = | |
8318d78a | 1068 | sband->ht_info.supp_mcs_set[i] & |
d3c990fb RR |
1069 | req_ht_cap->supp_mcs_set[i]; |
1070 | ||
1071 | /* In STA mode, this gives us indication | |
1072 | * to the AP's mode of operation */ | |
1073 | conf->ht_conf.ht_supported = 1; | |
1074 | conf->ht_conf.ampdu_factor = req_ht_cap->ampdu_factor; | |
1075 | conf->ht_conf.ampdu_density = req_ht_cap->ampdu_density; | |
1076 | } | |
1077 | ||
1078 | local->ops->conf_ht(local_to_hw(local), &local->hw.conf); | |
1079 | ||
1080 | return 0; | |
1081 | } | |
1082 | ||
471b3efd JB |
1083 | void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata, |
1084 | u32 changed) | |
d9430a32 | 1085 | { |
471b3efd JB |
1086 | struct ieee80211_local *local = sdata->local; |
1087 | ||
1088 | if (!changed) | |
1089 | return; | |
1090 | ||
1091 | if (local->ops->bss_info_changed) | |
1092 | local->ops->bss_info_changed(local_to_hw(local), | |
1093 | &sdata->vif, | |
1094 | &sdata->bss_conf, | |
1095 | changed); | |
d9430a32 DD |
1096 | } |
1097 | ||
1098 | void ieee80211_reset_erp_info(struct net_device *dev) | |
1099 | { | |
1100 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); | |
1101 | ||
471b3efd JB |
1102 | sdata->bss_conf.use_cts_prot = 0; |
1103 | sdata->bss_conf.use_short_preamble = 0; | |
1104 | ieee80211_bss_info_change_notify(sdata, | |
1105 | BSS_CHANGED_ERP_CTS_PROT | | |
1106 | BSS_CHANGED_ERP_PREAMBLE); | |
d9430a32 DD |
1107 | } |
1108 | ||
f0706e82 JB |
1109 | void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, |
1110 | struct sk_buff *skb, | |
1111 | struct ieee80211_tx_status *status) | |
1112 | { | |
1113 | struct ieee80211_local *local = hw_to_local(hw); | |
1114 | struct ieee80211_tx_status *saved; | |
1115 | int tmp; | |
1116 | ||
1117 | skb->dev = local->mdev; | |
1118 | saved = kmalloc(sizeof(struct ieee80211_tx_status), GFP_ATOMIC); | |
1119 | if (unlikely(!saved)) { | |
1120 | if (net_ratelimit()) | |
1121 | printk(KERN_WARNING "%s: Not enough memory, " | |
1122 | "dropping tx status", skb->dev->name); | |
1123 | /* should be dev_kfree_skb_irq, but due to this function being | |
1124 | * named _irqsafe instead of just _irq we can't be sure that | |
1125 | * people won't call it from non-irq contexts */ | |
1126 | dev_kfree_skb_any(skb); | |
1127 | return; | |
1128 | } | |
1129 | memcpy(saved, status, sizeof(struct ieee80211_tx_status)); | |
1130 | /* copy pointer to saved status into skb->cb for use by tasklet */ | |
1131 | memcpy(skb->cb, &saved, sizeof(saved)); | |
1132 | ||
1133 | skb->pkt_type = IEEE80211_TX_STATUS_MSG; | |
1134 | skb_queue_tail(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS ? | |
1135 | &local->skb_queue : &local->skb_queue_unreliable, skb); | |
1136 | tmp = skb_queue_len(&local->skb_queue) + | |
1137 | skb_queue_len(&local->skb_queue_unreliable); | |
1138 | while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && | |
1139 | (skb = skb_dequeue(&local->skb_queue_unreliable))) { | |
1140 | memcpy(&saved, skb->cb, sizeof(saved)); | |
1141 | kfree(saved); | |
1142 | dev_kfree_skb_irq(skb); | |
1143 | tmp--; | |
1144 | I802_DEBUG_INC(local->tx_status_drop); | |
1145 | } | |
1146 | tasklet_schedule(&local->tasklet); | |
1147 | } | |
1148 | EXPORT_SYMBOL(ieee80211_tx_status_irqsafe); | |
1149 | ||
1150 | static void ieee80211_tasklet_handler(unsigned long data) | |
1151 | { | |
1152 | struct ieee80211_local *local = (struct ieee80211_local *) data; | |
1153 | struct sk_buff *skb; | |
1154 | struct ieee80211_rx_status rx_status; | |
1155 | struct ieee80211_tx_status *tx_status; | |
eadc8d9e | 1156 | struct ieee80211_ra_tid *ra_tid; |
f0706e82 JB |
1157 | |
1158 | while ((skb = skb_dequeue(&local->skb_queue)) || | |
1159 | (skb = skb_dequeue(&local->skb_queue_unreliable))) { | |
1160 | switch (skb->pkt_type) { | |
1161 | case IEEE80211_RX_MSG: | |
1162 | /* status is in skb->cb */ | |
1163 | memcpy(&rx_status, skb->cb, sizeof(rx_status)); | |
51fb61e7 | 1164 | /* Clear skb->pkt_type in order to not confuse kernel |
f0706e82 JB |
1165 | * netstack. */ |
1166 | skb->pkt_type = 0; | |
1167 | __ieee80211_rx(local_to_hw(local), skb, &rx_status); | |
1168 | break; | |
1169 | case IEEE80211_TX_STATUS_MSG: | |
1170 | /* get pointer to saved status out of skb->cb */ | |
1171 | memcpy(&tx_status, skb->cb, sizeof(tx_status)); | |
1172 | skb->pkt_type = 0; | |
1173 | ieee80211_tx_status(local_to_hw(local), | |
1174 | skb, tx_status); | |
1175 | kfree(tx_status); | |
1176 | break; | |
eadc8d9e RR |
1177 | case IEEE80211_DELBA_MSG: |
1178 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | |
1179 | ieee80211_stop_tx_ba_cb(local_to_hw(local), | |
1180 | ra_tid->ra, ra_tid->tid); | |
1181 | dev_kfree_skb(skb); | |
1182 | break; | |
1183 | case IEEE80211_ADDBA_MSG: | |
1184 | ra_tid = (struct ieee80211_ra_tid *) &skb->cb; | |
1185 | ieee80211_start_tx_ba_cb(local_to_hw(local), | |
1186 | ra_tid->ra, ra_tid->tid); | |
1187 | dev_kfree_skb(skb); | |
1188 | break ; | |
f0706e82 JB |
1189 | default: /* should never get here! */ |
1190 | printk(KERN_ERR "%s: Unknown message type (%d)\n", | |
dd1cd4c6 | 1191 | wiphy_name(local->hw.wiphy), skb->pkt_type); |
f0706e82 JB |
1192 | dev_kfree_skb(skb); |
1193 | break; | |
1194 | } | |
1195 | } | |
1196 | } | |
1197 | ||
f0706e82 JB |
1198 | /* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to |
1199 | * make a prepared TX frame (one that has been given to hw) to look like brand | |
1200 | * new IEEE 802.11 frame that is ready to go through TX processing again. | |
1201 | * Also, tx_packet_data in cb is restored from tx_control. */ | |
1202 | static void ieee80211_remove_tx_extra(struct ieee80211_local *local, | |
1203 | struct ieee80211_key *key, | |
1204 | struct sk_buff *skb, | |
1205 | struct ieee80211_tx_control *control) | |
1206 | { | |
1207 | int hdrlen, iv_len, mic_len; | |
1208 | struct ieee80211_tx_packet_data *pkt_data; | |
1209 | ||
1210 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; | |
32bfd35d | 1211 | pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; |
e8bf9649 JS |
1212 | pkt_data->flags = 0; |
1213 | if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) | |
1214 | pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; | |
1215 | if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT) | |
1216 | pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; | |
1217 | if (control->flags & IEEE80211_TXCTL_REQUEUE) | |
1218 | pkt_data->flags |= IEEE80211_TXPD_REQUEUE; | |
678f5f71 JB |
1219 | if (control->flags & IEEE80211_TXCTL_EAPOL_FRAME) |
1220 | pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME; | |
f0706e82 JB |
1221 | pkt_data->queue = control->queue; |
1222 | ||
1223 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); | |
1224 | ||
1225 | if (!key) | |
1226 | goto no_key; | |
1227 | ||
8f20fc24 | 1228 | switch (key->conf.alg) { |
f0706e82 JB |
1229 | case ALG_WEP: |
1230 | iv_len = WEP_IV_LEN; | |
1231 | mic_len = WEP_ICV_LEN; | |
1232 | break; | |
1233 | case ALG_TKIP: | |
1234 | iv_len = TKIP_IV_LEN; | |
1235 | mic_len = TKIP_ICV_LEN; | |
1236 | break; | |
1237 | case ALG_CCMP: | |
1238 | iv_len = CCMP_HDR_LEN; | |
1239 | mic_len = CCMP_MIC_LEN; | |
1240 | break; | |
1241 | default: | |
1242 | goto no_key; | |
1243 | } | |
1244 | ||
8f20fc24 | 1245 | if (skb->len >= mic_len && |
11a843b7 | 1246 | !(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) |
f0706e82 JB |
1247 | skb_trim(skb, skb->len - mic_len); |
1248 | if (skb->len >= iv_len && skb->len > hdrlen) { | |
1249 | memmove(skb->data + iv_len, skb->data, hdrlen); | |
1250 | skb_pull(skb, iv_len); | |
1251 | } | |
1252 | ||
1253 | no_key: | |
1254 | { | |
1255 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | |
1256 | u16 fc = le16_to_cpu(hdr->frame_control); | |
1257 | if ((fc & 0x8C) == 0x88) /* QoS Control Field */ { | |
1258 | fc &= ~IEEE80211_STYPE_QOS_DATA; | |
1259 | hdr->frame_control = cpu_to_le16(fc); | |
1260 | memmove(skb->data + 2, skb->data, hdrlen - 2); | |
1261 | skb_pull(skb, 2); | |
1262 | } | |
1263 | } | |
1264 | } | |
1265 | ||
d46e144b JB |
1266 | static void ieee80211_handle_filtered_frame(struct ieee80211_local *local, |
1267 | struct sta_info *sta, | |
1268 | struct sk_buff *skb, | |
1269 | struct ieee80211_tx_status *status) | |
1270 | { | |
1271 | sta->tx_filtered_count++; | |
1272 | ||
1273 | /* | |
1274 | * Clear the TX filter mask for this STA when sending the next | |
1275 | * packet. If the STA went to power save mode, this will happen | |
1276 | * happen when it wakes up for the next time. | |
1277 | */ | |
1278 | sta->flags |= WLAN_STA_CLEAR_PS_FILT; | |
1279 | ||
1280 | /* | |
1281 | * This code races in the following way: | |
1282 | * | |
1283 | * (1) STA sends frame indicating it will go to sleep and does so | |
1284 | * (2) hardware/firmware adds STA to filter list, passes frame up | |
1285 | * (3) hardware/firmware processes TX fifo and suppresses a frame | |
1286 | * (4) we get TX status before having processed the frame and | |
1287 | * knowing that the STA has gone to sleep. | |
1288 | * | |
1289 | * This is actually quite unlikely even when both those events are | |
1290 | * processed from interrupts coming in quickly after one another or | |
1291 | * even at the same time because we queue both TX status events and | |
1292 | * RX frames to be processed by a tasklet and process them in the | |
1293 | * same order that they were received or TX status last. Hence, there | |
1294 | * is no race as long as the frame RX is processed before the next TX | |
1295 | * status, which drivers can ensure, see below. | |
1296 | * | |
1297 | * Note that this can only happen if the hardware or firmware can | |
1298 | * actually add STAs to the filter list, if this is done by the | |
1299 | * driver in response to set_tim() (which will only reduce the race | |
1300 | * this whole filtering tries to solve, not completely solve it) | |
1301 | * this situation cannot happen. | |
1302 | * | |
1303 | * To completely solve this race drivers need to make sure that they | |
1304 | * (a) don't mix the irq-safe/not irq-safe TX status/RX processing | |
1305 | * functions and | |
1306 | * (b) always process RX events before TX status events if ordering | |
1307 | * can be unknown, for example with different interrupt status | |
1308 | * bits. | |
1309 | */ | |
1310 | if (sta->flags & WLAN_STA_PS && | |
1311 | skb_queue_len(&sta->tx_filtered) < STA_MAX_TX_BUFFER) { | |
1312 | ieee80211_remove_tx_extra(local, sta->key, skb, | |
1313 | &status->control); | |
1314 | skb_queue_tail(&sta->tx_filtered, skb); | |
1315 | return; | |
1316 | } | |
1317 | ||
1318 | if (!(sta->flags & WLAN_STA_PS) && | |
1319 | !(status->control.flags & IEEE80211_TXCTL_REQUEUE)) { | |
1320 | /* Software retry the packet once */ | |
1321 | status->control.flags |= IEEE80211_TXCTL_REQUEUE; | |
1322 | ieee80211_remove_tx_extra(local, sta->key, skb, | |
1323 | &status->control); | |
1324 | dev_queue_xmit(skb); | |
1325 | return; | |
1326 | } | |
1327 | ||
1328 | if (net_ratelimit()) | |
1329 | printk(KERN_DEBUG "%s: dropped TX filtered frame, " | |
1330 | "queue_len=%d PS=%d @%lu\n", | |
1331 | wiphy_name(local->hw.wiphy), | |
1332 | skb_queue_len(&sta->tx_filtered), | |
1333 | !!(sta->flags & WLAN_STA_PS), jiffies); | |
1334 | dev_kfree_skb(skb); | |
1335 | } | |
1336 | ||
f0706e82 JB |
1337 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, |
1338 | struct ieee80211_tx_status *status) | |
1339 | { | |
1340 | struct sk_buff *skb2; | |
1341 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; | |
1342 | struct ieee80211_local *local = hw_to_local(hw); | |
1343 | u16 frag, type; | |
b306f453 JB |
1344 | struct ieee80211_tx_status_rtap_hdr *rthdr; |
1345 | struct ieee80211_sub_if_data *sdata; | |
3d30d949 | 1346 | struct net_device *prev_dev = NULL; |
f0706e82 JB |
1347 | |
1348 | if (!status) { | |
1349 | printk(KERN_ERR | |
1350 | "%s: ieee80211_tx_status called with NULL status\n", | |
dd1cd4c6 | 1351 | wiphy_name(local->hw.wiphy)); |
f0706e82 JB |
1352 | dev_kfree_skb(skb); |
1353 | return; | |
1354 | } | |
1355 | ||
d0709a65 JB |
1356 | rcu_read_lock(); |
1357 | ||
f0706e82 JB |
1358 | if (status->excessive_retries) { |
1359 | struct sta_info *sta; | |
1360 | sta = sta_info_get(local, hdr->addr1); | |
1361 | if (sta) { | |
1362 | if (sta->flags & WLAN_STA_PS) { | |
d46e144b JB |
1363 | /* |
1364 | * The STA is in power save mode, so assume | |
f0706e82 JB |
1365 | * that this TX packet failed because of that. |
1366 | */ | |
1367 | status->excessive_retries = 0; | |
1368 | status->flags |= IEEE80211_TX_STATUS_TX_FILTERED; | |
d46e144b JB |
1369 | ieee80211_handle_filtered_frame(local, sta, |
1370 | skb, status); | |
d0709a65 | 1371 | rcu_read_unlock(); |
d46e144b | 1372 | return; |
f0706e82 | 1373 | } |
f0706e82 JB |
1374 | } |
1375 | } | |
1376 | ||
1377 | if (status->flags & IEEE80211_TX_STATUS_TX_FILTERED) { | |
1378 | struct sta_info *sta; | |
1379 | sta = sta_info_get(local, hdr->addr1); | |
1380 | if (sta) { | |
d46e144b JB |
1381 | ieee80211_handle_filtered_frame(local, sta, skb, |
1382 | status); | |
d0709a65 | 1383 | rcu_read_unlock(); |
f0706e82 JB |
1384 | return; |
1385 | } | |
1abbe498 MN |
1386 | } else |
1387 | rate_control_tx_status(local->mdev, skb, status); | |
f0706e82 | 1388 | |
d0709a65 JB |
1389 | rcu_read_unlock(); |
1390 | ||
f0706e82 JB |
1391 | ieee80211_led_tx(local, 0); |
1392 | ||
1393 | /* SNMP counters | |
1394 | * Fragments are passed to low-level drivers as separate skbs, so these | |
1395 | * are actually fragments, not frames. Update frame counters only for | |
1396 | * the first fragment of the frame. */ | |
1397 | ||
1398 | frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; | |
1399 | type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE; | |
1400 | ||
1401 | if (status->flags & IEEE80211_TX_STATUS_ACK) { | |
1402 | if (frag == 0) { | |
1403 | local->dot11TransmittedFrameCount++; | |
1404 | if (is_multicast_ether_addr(hdr->addr1)) | |
1405 | local->dot11MulticastTransmittedFrameCount++; | |
1406 | if (status->retry_count > 0) | |
1407 | local->dot11RetryCount++; | |
1408 | if (status->retry_count > 1) | |
1409 | local->dot11MultipleRetryCount++; | |
1410 | } | |
1411 | ||
1412 | /* This counter shall be incremented for an acknowledged MPDU | |
1413 | * with an individual address in the address 1 field or an MPDU | |
1414 | * with a multicast address in the address 1 field of type Data | |
1415 | * or Management. */ | |
1416 | if (!is_multicast_ether_addr(hdr->addr1) || | |
1417 | type == IEEE80211_FTYPE_DATA || | |
1418 | type == IEEE80211_FTYPE_MGMT) | |
1419 | local->dot11TransmittedFragmentCount++; | |
1420 | } else { | |
1421 | if (frag == 0) | |
1422 | local->dot11FailedCount++; | |
1423 | } | |
1424 | ||
b306f453 JB |
1425 | /* this was a transmitted frame, but now we want to reuse it */ |
1426 | skb_orphan(skb); | |
1427 | ||
3d30d949 MW |
1428 | /* |
1429 | * This is a bit racy but we can avoid a lot of work | |
1430 | * with this test... | |
1431 | */ | |
1432 | if (!local->monitors && !local->cooked_mntrs) { | |
f0706e82 JB |
1433 | dev_kfree_skb(skb); |
1434 | return; | |
1435 | } | |
1436 | ||
b306f453 | 1437 | /* send frame to monitor interfaces now */ |
f0706e82 | 1438 | |
b306f453 JB |
1439 | if (skb_headroom(skb) < sizeof(*rthdr)) { |
1440 | printk(KERN_ERR "ieee80211_tx_status: headroom too small\n"); | |
f0706e82 JB |
1441 | dev_kfree_skb(skb); |
1442 | return; | |
1443 | } | |
f0706e82 | 1444 | |
b306f453 JB |
1445 | rthdr = (struct ieee80211_tx_status_rtap_hdr*) |
1446 | skb_push(skb, sizeof(*rthdr)); | |
1447 | ||
1448 | memset(rthdr, 0, sizeof(*rthdr)); | |
1449 | rthdr->hdr.it_len = cpu_to_le16(sizeof(*rthdr)); | |
1450 | rthdr->hdr.it_present = | |
1451 | cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | | |
1452 | (1 << IEEE80211_RADIOTAP_DATA_RETRIES)); | |
1453 | ||
1454 | if (!(status->flags & IEEE80211_TX_STATUS_ACK) && | |
1455 | !is_multicast_ether_addr(hdr->addr1)) | |
1456 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); | |
1457 | ||
1458 | if ((status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) && | |
1459 | (status->control.flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) | |
1460 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); | |
1461 | else if (status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) | |
1462 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); | |
1463 | ||
1464 | rthdr->data_retries = status->retry_count; | |
1465 | ||
3d30d949 MW |
1466 | /* XXX: is this sufficient for BPF? */ |
1467 | skb_set_mac_header(skb, 0); | |
1468 | skb->ip_summed = CHECKSUM_UNNECESSARY; | |
1469 | skb->pkt_type = PACKET_OTHERHOST; | |
1470 | skb->protocol = htons(ETH_P_802_2); | |
1471 | memset(skb->cb, 0, sizeof(skb->cb)); | |
1472 | ||
79010420 | 1473 | rcu_read_lock(); |
79010420 | 1474 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
51fb61e7 | 1475 | if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) { |
b306f453 JB |
1476 | if (!netif_running(sdata->dev)) |
1477 | continue; | |
3d30d949 MW |
1478 | |
1479 | if (prev_dev) { | |
79010420 | 1480 | skb2 = skb_clone(skb, GFP_ATOMIC); |
3d30d949 MW |
1481 | if (skb2) { |
1482 | skb2->dev = prev_dev; | |
1483 | netif_rx(skb2); | |
1484 | } | |
1485 | } | |
1486 | ||
1487 | prev_dev = sdata->dev; | |
b306f453 JB |
1488 | } |
1489 | } | |
3d30d949 MW |
1490 | if (prev_dev) { |
1491 | skb->dev = prev_dev; | |
1492 | netif_rx(skb); | |
1493 | skb = NULL; | |
1494 | } | |
79010420 | 1495 | rcu_read_unlock(); |
3d30d949 | 1496 | dev_kfree_skb(skb); |
f0706e82 JB |
1497 | } |
1498 | EXPORT_SYMBOL(ieee80211_tx_status); | |
1499 | ||
f0706e82 JB |
1500 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
1501 | const struct ieee80211_ops *ops) | |
1502 | { | |
f0706e82 | 1503 | struct ieee80211_local *local; |
f0706e82 JB |
1504 | int priv_size; |
1505 | struct wiphy *wiphy; | |
1506 | ||
1507 | /* Ensure 32-byte alignment of our private data and hw private data. | |
1508 | * We use the wiphy priv data for both our ieee80211_local and for | |
1509 | * the driver's private data | |
1510 | * | |
1511 | * In memory it'll be like this: | |
1512 | * | |
1513 | * +-------------------------+ | |
1514 | * | struct wiphy | | |
1515 | * +-------------------------+ | |
1516 | * | struct ieee80211_local | | |
1517 | * +-------------------------+ | |
1518 | * | driver's private data | | |
1519 | * +-------------------------+ | |
1520 | * | |
1521 | */ | |
1522 | priv_size = ((sizeof(struct ieee80211_local) + | |
1523 | NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) + | |
1524 | priv_data_len; | |
1525 | ||
1526 | wiphy = wiphy_new(&mac80211_config_ops, priv_size); | |
1527 | ||
1528 | if (!wiphy) | |
1529 | return NULL; | |
1530 | ||
1531 | wiphy->privid = mac80211_wiphy_privid; | |
1532 | ||
1533 | local = wiphy_priv(wiphy); | |
1534 | local->hw.wiphy = wiphy; | |
1535 | ||
1536 | local->hw.priv = (char *)local + | |
1537 | ((sizeof(struct ieee80211_local) + | |
1538 | NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); | |
1539 | ||
4480f15c | 1540 | BUG_ON(!ops->tx); |
4150c572 JB |
1541 | BUG_ON(!ops->start); |
1542 | BUG_ON(!ops->stop); | |
4480f15c JB |
1543 | BUG_ON(!ops->config); |
1544 | BUG_ON(!ops->add_interface); | |
4150c572 JB |
1545 | BUG_ON(!ops->remove_interface); |
1546 | BUG_ON(!ops->configure_filter); | |
f0706e82 JB |
1547 | local->ops = ops; |
1548 | ||
f0706e82 JB |
1549 | local->hw.queues = 1; /* default */ |
1550 | ||
f0706e82 JB |
1551 | local->bridge_packets = 1; |
1552 | ||
1553 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; | |
1554 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; | |
1555 | local->short_retry_limit = 7; | |
1556 | local->long_retry_limit = 4; | |
1557 | local->hw.conf.radio_enabled = 1; | |
f0706e82 | 1558 | |
79010420 | 1559 | INIT_LIST_HEAD(&local->interfaces); |
f0706e82 JB |
1560 | |
1561 | INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work); | |
f0706e82 JB |
1562 | |
1563 | sta_info_init(local); | |
1564 | ||
f0706e82 JB |
1565 | tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending, |
1566 | (unsigned long)local); | |
1567 | tasklet_disable(&local->tx_pending_tasklet); | |
1568 | ||
1569 | tasklet_init(&local->tasklet, | |
1570 | ieee80211_tasklet_handler, | |
1571 | (unsigned long) local); | |
1572 | tasklet_disable(&local->tasklet); | |
1573 | ||
1574 | skb_queue_head_init(&local->skb_queue); | |
1575 | skb_queue_head_init(&local->skb_queue_unreliable); | |
1576 | ||
1577 | return local_to_hw(local); | |
1578 | } | |
1579 | EXPORT_SYMBOL(ieee80211_alloc_hw); | |
1580 | ||
1581 | int ieee80211_register_hw(struct ieee80211_hw *hw) | |
1582 | { | |
1583 | struct ieee80211_local *local = hw_to_local(hw); | |
1584 | const char *name; | |
1585 | int result; | |
8318d78a | 1586 | enum ieee80211_band band; |
96d51056 JB |
1587 | struct net_device *mdev; |
1588 | struct ieee80211_sub_if_data *sdata; | |
8318d78a JB |
1589 | |
1590 | /* | |
1591 | * generic code guarantees at least one band, | |
1592 | * set this very early because much code assumes | |
1593 | * that hw.conf.channel is assigned | |
1594 | */ | |
1595 | for (band = 0; band < IEEE80211_NUM_BANDS; band++) { | |
1596 | struct ieee80211_supported_band *sband; | |
1597 | ||
1598 | sband = local->hw.wiphy->bands[band]; | |
1599 | if (sband) { | |
1600 | /* init channel we're on */ | |
1601 | local->hw.conf.channel = | |
1602 | local->oper_channel = | |
1603 | local->scan_channel = &sband->channels[0]; | |
1604 | break; | |
1605 | } | |
1606 | } | |
f0706e82 JB |
1607 | |
1608 | result = wiphy_register(local->hw.wiphy); | |
1609 | if (result < 0) | |
1610 | return result; | |
1611 | ||
96d51056 JB |
1612 | /* for now, mdev needs sub_if_data :/ */ |
1613 | mdev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), | |
1614 | "wmaster%d", ether_setup); | |
1615 | if (!mdev) | |
1616 | goto fail_mdev_alloc; | |
1617 | ||
1618 | sdata = IEEE80211_DEV_TO_SUB_IF(mdev); | |
1619 | mdev->ieee80211_ptr = &sdata->wdev; | |
1620 | sdata->wdev.wiphy = local->hw.wiphy; | |
1621 | ||
1622 | local->mdev = mdev; | |
1623 | ||
1624 | ieee80211_rx_bss_list_init(mdev); | |
1625 | ||
1626 | mdev->hard_start_xmit = ieee80211_master_start_xmit; | |
1627 | mdev->open = ieee80211_master_open; | |
1628 | mdev->stop = ieee80211_master_stop; | |
1629 | mdev->type = ARPHRD_IEEE80211; | |
1630 | mdev->header_ops = &ieee80211_header_ops; | |
1631 | mdev->set_multicast_list = ieee80211_master_set_multicast_list; | |
1632 | ||
1633 | sdata->vif.type = IEEE80211_IF_TYPE_AP; | |
1634 | sdata->dev = mdev; | |
1635 | sdata->local = local; | |
1636 | sdata->u.ap.force_unicast_rateidx = -1; | |
1637 | sdata->u.ap.max_ratectrl_rateidx = -1; | |
1638 | ieee80211_if_sdata_init(sdata); | |
1639 | ||
1640 | /* no RCU needed since we're still during init phase */ | |
1641 | list_add_tail(&sdata->list, &local->interfaces); | |
1642 | ||
f0706e82 JB |
1643 | name = wiphy_dev(local->hw.wiphy)->driver->name; |
1644 | local->hw.workqueue = create_singlethread_workqueue(name); | |
1645 | if (!local->hw.workqueue) { | |
1646 | result = -ENOMEM; | |
1647 | goto fail_workqueue; | |
1648 | } | |
1649 | ||
b306f453 JB |
1650 | /* |
1651 | * The hardware needs headroom for sending the frame, | |
1652 | * and we need some headroom for passing the frame to monitor | |
1653 | * interfaces, but never both at the same time. | |
1654 | */ | |
33ccad35 JB |
1655 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, |
1656 | sizeof(struct ieee80211_tx_status_rtap_hdr)); | |
b306f453 | 1657 | |
e9f207f0 JB |
1658 | debugfs_hw_add(local); |
1659 | ||
f0706e82 JB |
1660 | local->hw.conf.beacon_int = 1000; |
1661 | ||
1662 | local->wstats_flags |= local->hw.max_rssi ? | |
1663 | IW_QUAL_LEVEL_UPDATED : IW_QUAL_LEVEL_INVALID; | |
1664 | local->wstats_flags |= local->hw.max_signal ? | |
1665 | IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID; | |
1666 | local->wstats_flags |= local->hw.max_noise ? | |
1667 | IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID; | |
1668 | if (local->hw.max_rssi < 0 || local->hw.max_noise < 0) | |
1669 | local->wstats_flags |= IW_QUAL_DBM; | |
1670 | ||
1671 | result = sta_info_start(local); | |
1672 | if (result < 0) | |
1673 | goto fail_sta_info; | |
1674 | ||
1675 | rtnl_lock(); | |
1676 | result = dev_alloc_name(local->mdev, local->mdev->name); | |
1677 | if (result < 0) | |
1678 | goto fail_dev; | |
1679 | ||
1680 | memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); | |
1681 | SET_NETDEV_DEV(local->mdev, wiphy_dev(local->hw.wiphy)); | |
1682 | ||
1683 | result = register_netdevice(local->mdev); | |
1684 | if (result < 0) | |
1685 | goto fail_dev; | |
1686 | ||
e9f207f0 | 1687 | ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
5b2812e9 | 1688 | ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP); |
e9f207f0 | 1689 | |
830f9038 JB |
1690 | result = ieee80211_init_rate_ctrl_alg(local, |
1691 | hw->rate_control_algorithm); | |
f0706e82 JB |
1692 | if (result < 0) { |
1693 | printk(KERN_DEBUG "%s: Failed to initialize rate control " | |
dd1cd4c6 | 1694 | "algorithm\n", wiphy_name(local->hw.wiphy)); |
f0706e82 JB |
1695 | goto fail_rate; |
1696 | } | |
1697 | ||
1698 | result = ieee80211_wep_init(local); | |
1699 | ||
1700 | if (result < 0) { | |
1701 | printk(KERN_DEBUG "%s: Failed to initialize wep\n", | |
dd1cd4c6 | 1702 | wiphy_name(local->hw.wiphy)); |
f0706e82 JB |
1703 | goto fail_wep; |
1704 | } | |
1705 | ||
1706 | ieee80211_install_qdisc(local->mdev); | |
1707 | ||
1708 | /* add one default STA interface */ | |
1709 | result = ieee80211_if_add(local->mdev, "wlan%d", NULL, | |
ee385855 | 1710 | IEEE80211_IF_TYPE_STA, NULL); |
f0706e82 JB |
1711 | if (result) |
1712 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", | |
dd1cd4c6 | 1713 | wiphy_name(local->hw.wiphy)); |
f0706e82 JB |
1714 | |
1715 | local->reg_state = IEEE80211_DEV_REGISTERED; | |
1716 | rtnl_unlock(); | |
1717 | ||
1718 | ieee80211_led_init(local); | |
1719 | ||
1720 | return 0; | |
1721 | ||
1722 | fail_wep: | |
1723 | rate_control_deinitialize(local); | |
1724 | fail_rate: | |
e9f207f0 | 1725 | ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
f0706e82 JB |
1726 | unregister_netdevice(local->mdev); |
1727 | fail_dev: | |
1728 | rtnl_unlock(); | |
1729 | sta_info_stop(local); | |
1730 | fail_sta_info: | |
e9f207f0 | 1731 | debugfs_hw_del(local); |
f0706e82 JB |
1732 | destroy_workqueue(local->hw.workqueue); |
1733 | fail_workqueue: | |
96d51056 JB |
1734 | ieee80211_if_free(local->mdev); |
1735 | local->mdev = NULL; | |
1736 | fail_mdev_alloc: | |
f0706e82 JB |
1737 | wiphy_unregister(local->hw.wiphy); |
1738 | return result; | |
1739 | } | |
1740 | EXPORT_SYMBOL(ieee80211_register_hw); | |
1741 | ||
f0706e82 JB |
1742 | void ieee80211_unregister_hw(struct ieee80211_hw *hw) |
1743 | { | |
1744 | struct ieee80211_local *local = hw_to_local(hw); | |
1745 | struct ieee80211_sub_if_data *sdata, *tmp; | |
f0706e82 JB |
1746 | |
1747 | tasklet_kill(&local->tx_pending_tasklet); | |
1748 | tasklet_kill(&local->tasklet); | |
1749 | ||
1750 | rtnl_lock(); | |
1751 | ||
1752 | BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED); | |
1753 | ||
1754 | local->reg_state = IEEE80211_DEV_UNREGISTERED; | |
f0706e82 | 1755 | |
79010420 JB |
1756 | /* |
1757 | * At this point, interface list manipulations are fine | |
1758 | * because the driver cannot be handing us frames any | |
1759 | * more and the tasklet is killed. | |
1760 | */ | |
5b2812e9 JB |
1761 | |
1762 | /* | |
1763 | * First, we remove all non-master interfaces. Do this because they | |
1764 | * may have bss pointer dependency on the master, and when we free | |
1765 | * the master these would be freed as well, breaking our list | |
1766 | * iteration completely. | |
1767 | */ | |
1768 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { | |
1769 | if (sdata->dev == local->mdev) | |
1770 | continue; | |
1771 | list_del(&sdata->list); | |
f0706e82 | 1772 | __ieee80211_if_del(local, sdata); |
5b2812e9 JB |
1773 | } |
1774 | ||
1775 | /* then, finally, remove the master interface */ | |
1776 | __ieee80211_if_del(local, IEEE80211_DEV_TO_SUB_IF(local->mdev)); | |
f0706e82 JB |
1777 | |
1778 | rtnl_unlock(); | |
1779 | ||
f0706e82 JB |
1780 | ieee80211_rx_bss_list_deinit(local->mdev); |
1781 | ieee80211_clear_tx_pending(local); | |
1782 | sta_info_stop(local); | |
1783 | rate_control_deinitialize(local); | |
e9f207f0 | 1784 | debugfs_hw_del(local); |
f0706e82 | 1785 | |
f0706e82 JB |
1786 | if (skb_queue_len(&local->skb_queue) |
1787 | || skb_queue_len(&local->skb_queue_unreliable)) | |
1788 | printk(KERN_WARNING "%s: skb_queue not empty\n", | |
dd1cd4c6 | 1789 | wiphy_name(local->hw.wiphy)); |
f0706e82 JB |
1790 | skb_queue_purge(&local->skb_queue); |
1791 | skb_queue_purge(&local->skb_queue_unreliable); | |
1792 | ||
1793 | destroy_workqueue(local->hw.workqueue); | |
1794 | wiphy_unregister(local->hw.wiphy); | |
1795 | ieee80211_wep_free(local); | |
1796 | ieee80211_led_exit(local); | |
96d51056 JB |
1797 | ieee80211_if_free(local->mdev); |
1798 | local->mdev = NULL; | |
f0706e82 JB |
1799 | } |
1800 | EXPORT_SYMBOL(ieee80211_unregister_hw); | |
1801 | ||
1802 | void ieee80211_free_hw(struct ieee80211_hw *hw) | |
1803 | { | |
1804 | struct ieee80211_local *local = hw_to_local(hw); | |
1805 | ||
f0706e82 JB |
1806 | wiphy_free(local->hw.wiphy); |
1807 | } | |
1808 | EXPORT_SYMBOL(ieee80211_free_hw); | |
1809 | ||
f0706e82 JB |
1810 | static int __init ieee80211_init(void) |
1811 | { | |
1812 | struct sk_buff *skb; | |
1813 | int ret; | |
1814 | ||
1815 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); | |
1816 | ||
4b475898 | 1817 | ret = rc80211_simple_init(); |
ac71c691 | 1818 | if (ret) |
3eadf5f4 | 1819 | goto out; |
ad018375 | 1820 | |
4b475898 | 1821 | ret = rc80211_pid_init(); |
ad018375 | 1822 | if (ret) |
3eadf5f4 | 1823 | goto out_cleanup_simple; |
ac71c691 | 1824 | |
f0706e82 JB |
1825 | ret = ieee80211_wme_register(); |
1826 | if (ret) { | |
1827 | printk(KERN_DEBUG "ieee80211_init: failed to " | |
1828 | "initialize WME (err=%d)\n", ret); | |
3eadf5f4 | 1829 | goto out_cleanup_pid; |
f0706e82 JB |
1830 | } |
1831 | ||
e9f207f0 JB |
1832 | ieee80211_debugfs_netdev_init(); |
1833 | ||
f0706e82 | 1834 | return 0; |
ad018375 | 1835 | |
3eadf5f4 | 1836 | out_cleanup_pid: |
4b475898 | 1837 | rc80211_pid_exit(); |
3eadf5f4 JB |
1838 | out_cleanup_simple: |
1839 | rc80211_simple_exit(); | |
1840 | out: | |
ad018375 | 1841 | return ret; |
f0706e82 JB |
1842 | } |
1843 | ||
f0706e82 JB |
1844 | static void __exit ieee80211_exit(void) |
1845 | { | |
4b475898 JB |
1846 | rc80211_simple_exit(); |
1847 | rc80211_pid_exit(); | |
ac71c691 | 1848 | |
f7a92144 LCC |
1849 | if (mesh_allocated) |
1850 | ieee80211s_stop(); | |
902acc78 | 1851 | |
f0706e82 | 1852 | ieee80211_wme_unregister(); |
e9f207f0 | 1853 | ieee80211_debugfs_netdev_exit(); |
f0706e82 JB |
1854 | } |
1855 | ||
1856 | ||
ca9938fe | 1857 | subsys_initcall(ieee80211_init); |
f0706e82 JB |
1858 | module_exit(ieee80211_exit); |
1859 | ||
1860 | MODULE_DESCRIPTION("IEEE 802.11 subsystem"); | |
1861 | MODULE_LICENSE("GPL"); |