blob: 5dcc2d61551fe2260f5a39e6fe323669b705323b [file] [log] [blame]
Jiri Bencf0706e822007-05-05 11:45:53 -07001/*
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>
Jiri Bencf0706e822007-05-05 11:45:53 -070023#include <linux/bitmap.h>
Eric W. Biederman881d9662007-09-17 11:56:21 -070024#include <net/net_namespace.h>
Jiri Bencf0706e822007-05-05 11:45:53 -070025#include <net/cfg80211.h>
26
Jiri Bencf0706e822007-05-05 11:45:53 -070027#include "ieee80211_i.h"
28#include "ieee80211_rate.h"
29#include "wep.h"
Jiri Bencf0706e822007-05-05 11:45:53 -070030#include "wme.h"
31#include "aes_ccm.h"
32#include "ieee80211_led.h"
Michael Wue0eb6852007-09-18 17:29:21 -040033#include "cfg.h"
Jiri Bence9f207f2007-05-05 11:46:38 -070034#include "debugfs.h"
35#include "debugfs_netdev.h"
Jiri Bencf0706e822007-05-05 11:45:53 -070036
Ron Rindjunskyd3c990f2007-11-26 16:14:34 +020037#define SUPP_MCS_SET_LEN 16
38
Johannes Bergb306f452007-07-10 19:32:08 +020039/*
40 * For seeing transmitted packets on monitor interfaces
41 * we have a radiotap header too.
42 */
43struct ieee80211_tx_status_rtap_hdr {
44 struct ieee80211_radiotap_header hdr;
45 __le16 tx_flags;
46 u8 data_retries;
47} __attribute__ ((packed));
48
Johannes Bergb2c258f2007-07-27 15:43:23 +020049/* common interface routines */
Jiri Bencf0706e822007-05-05 11:45:53 -070050
Stephen Hemmingerb95cce32007-09-26 22:13:38 -070051static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr)
Jiri Bencf0706e822007-05-05 11:45:53 -070052{
Johannes Bergb2c258f2007-07-27 15:43:23 +020053 memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */
54 return ETH_ALEN;
Jiri Bencf0706e822007-05-05 11:45:53 -070055}
56
Johannes Berg4150c572007-09-17 01:29:23 -040057/* must be called under mdev tx lock */
58static void ieee80211_configure_filter(struct ieee80211_local *local)
59{
60 unsigned int changed_flags;
61 unsigned int new_flags = 0;
62
Johannes Berg53918992007-09-26 15:19:47 +020063 if (atomic_read(&local->iff_promiscs))
Johannes Berg4150c572007-09-17 01:29:23 -040064 new_flags |= FIF_PROMISC_IN_BSS;
65
Johannes Berg53918992007-09-26 15:19:47 +020066 if (atomic_read(&local->iff_allmultis))
Johannes Berg4150c572007-09-17 01:29:23 -040067 new_flags |= FIF_ALLMULTI;
68
69 if (local->monitors)
70 new_flags |= FIF_CONTROL |
71 FIF_OTHER_BSS |
72 FIF_BCN_PRBRESP_PROMISC;
73
74 changed_flags = local->filter_flags ^ new_flags;
75
76 /* be a bit nasty */
77 new_flags |= (1<<31);
78
79 local->ops->configure_filter(local_to_hw(local),
80 changed_flags, &new_flags,
81 local->mdev->mc_count,
82 local->mdev->mc_list);
83
84 WARN_ON(new_flags & (1<<31));
85
86 local->filter_flags = new_flags & ~(1<<31);
87}
88
Johannes Bergb2c258f2007-07-27 15:43:23 +020089/* master interface */
Jiri Bencf0706e822007-05-05 11:45:53 -070090
91static int ieee80211_master_open(struct net_device *dev)
92{
93 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
94 struct ieee80211_sub_if_data *sdata;
95 int res = -EOPNOTSUPP;
96
Johannes Berg79010422007-09-18 17:29:21 -040097 /* we hold the RTNL here so can safely walk the list */
98 list_for_each_entry(sdata, &local->interfaces, list) {
Jiri Bencf0706e822007-05-05 11:45:53 -070099 if (sdata->dev != dev && netif_running(sdata->dev)) {
100 res = 0;
101 break;
102 }
103 }
Jiri Bencf0706e822007-05-05 11:45:53 -0700104 return res;
105}
106
107static int ieee80211_master_stop(struct net_device *dev)
108{
109 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
110 struct ieee80211_sub_if_data *sdata;
111
Johannes Berg79010422007-09-18 17:29:21 -0400112 /* we hold the RTNL here so can safely walk the list */
113 list_for_each_entry(sdata, &local->interfaces, list)
Jiri Bencf0706e822007-05-05 11:45:53 -0700114 if (sdata->dev != dev && netif_running(sdata->dev))
115 dev_close(sdata->dev);
Jiri Bencf0706e822007-05-05 11:45:53 -0700116
117 return 0;
118}
119
Johannes Berg4150c572007-09-17 01:29:23 -0400120static void ieee80211_master_set_multicast_list(struct net_device *dev)
121{
122 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
123
124 ieee80211_configure_filter(local);
125}
126
Johannes Bergb2c258f2007-07-27 15:43:23 +0200127/* regular interfaces */
128
129static int ieee80211_change_mtu(struct net_device *dev, int new_mtu)
130{
131 /* FIX: what would be proper limits for MTU?
132 * This interface uses 802.3 frames. */
133 if (new_mtu < 256 || new_mtu > IEEE80211_MAX_DATA_LEN - 24 - 6) {
134 printk(KERN_WARNING "%s: invalid MTU %d\n",
135 dev->name, new_mtu);
136 return -EINVAL;
137 }
138
139#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
140 printk(KERN_DEBUG "%s: setting MTU %d\n", dev->name, new_mtu);
141#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
142 dev->mtu = new_mtu;
143 return 0;
144}
145
146static inline int identical_mac_addr_allowed(int type1, int type2)
147{
148 return (type1 == IEEE80211_IF_TYPE_MNTR ||
149 type2 == IEEE80211_IF_TYPE_MNTR ||
150 (type1 == IEEE80211_IF_TYPE_AP &&
151 type2 == IEEE80211_IF_TYPE_WDS) ||
152 (type1 == IEEE80211_IF_TYPE_WDS &&
153 (type2 == IEEE80211_IF_TYPE_WDS ||
154 type2 == IEEE80211_IF_TYPE_AP)) ||
155 (type1 == IEEE80211_IF_TYPE_AP &&
156 type2 == IEEE80211_IF_TYPE_VLAN) ||
157 (type1 == IEEE80211_IF_TYPE_VLAN &&
158 (type2 == IEEE80211_IF_TYPE_AP ||
159 type2 == IEEE80211_IF_TYPE_VLAN)));
160}
161
Johannes Bergb2c258f2007-07-27 15:43:23 +0200162static int ieee80211_open(struct net_device *dev)
163{
164 struct ieee80211_sub_if_data *sdata, *nsdata;
165 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
166 struct ieee80211_if_init_conf conf;
167 int res;
168
169 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400170
Johannes Berg79010422007-09-18 17:29:21 -0400171 /* we hold the RTNL here so can safely walk the list */
172 list_for_each_entry(nsdata, &local->interfaces, list) {
Johannes Bergb2c258f2007-07-27 15:43:23 +0200173 struct net_device *ndev = nsdata->dev;
174
175 if (ndev != dev && ndev != local->mdev && netif_running(ndev) &&
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400176 compare_ether_addr(dev->dev_addr, ndev->dev_addr) == 0) {
177 /*
178 * check whether it may have the same address
179 */
Johannes Berg51fb61e2007-12-19 01:31:27 +0100180 if (!identical_mac_addr_allowed(sdata->vif.type,
181 nsdata->vif.type))
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400182 return -ENOTUNIQ;
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400183
184 /*
185 * can only add VLANs to enabled APs
186 */
Johannes Berg51fb61e2007-12-19 01:31:27 +0100187 if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN &&
188 nsdata->vif.type == IEEE80211_IF_TYPE_AP &&
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400189 netif_running(nsdata->dev))
190 sdata->u.vlan.ap = nsdata;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200191 }
192 }
Johannes Bergb2c258f2007-07-27 15:43:23 +0200193
Johannes Berg51fb61e2007-12-19 01:31:27 +0100194 switch (sdata->vif.type) {
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400195 case IEEE80211_IF_TYPE_WDS:
196 if (is_zero_ether_addr(sdata->u.wds.remote_addr))
197 return -ENOLINK;
198 break;
199 case IEEE80211_IF_TYPE_VLAN:
200 if (!sdata->u.vlan.ap)
201 return -ENOLINK;
202 break;
Johannes Bergfb1c1cd2007-09-26 15:19:43 +0200203 case IEEE80211_IF_TYPE_AP:
Johannes Bergfb1c1cd2007-09-26 15:19:43 +0200204 case IEEE80211_IF_TYPE_STA:
205 case IEEE80211_IF_TYPE_MNTR:
206 case IEEE80211_IF_TYPE_IBSS:
207 /* no special treatment */
208 break;
Johannes Berga2897552007-09-28 14:01:25 +0200209 case IEEE80211_IF_TYPE_INVALID:
210 /* cannot happen */
211 WARN_ON(1);
212 break;
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400213 }
Johannes Bergb2c258f2007-07-27 15:43:23 +0200214
Johannes Bergb2c258f2007-07-27 15:43:23 +0200215 if (local->open_count == 0) {
216 res = 0;
Johannes Berg4150c572007-09-17 01:29:23 -0400217 if (local->ops->start)
218 res = local->ops->start(local_to_hw(local));
219 if (res)
Johannes Bergb2c258f2007-07-27 15:43:23 +0200220 return res;
Michael Wu8b393f12007-11-28 01:57:08 -0500221 ieee80211_hw_config(local);
Ivo van Doorncdcb0062008-01-07 19:45:24 +0100222 ieee80211_led_radio(local, local->hw.conf.radio_enabled);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200223 }
Johannes Bergb2c258f2007-07-27 15:43:23 +0200224
Johannes Berg51fb61e2007-12-19 01:31:27 +0100225 switch (sdata->vif.type) {
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400226 case IEEE80211_IF_TYPE_VLAN:
227 list_add(&sdata->u.vlan.list, &sdata->u.vlan.ap->u.ap.vlans);
228 /* no need to tell driver */
229 break;
Johannes Berg4150c572007-09-17 01:29:23 -0400230 case IEEE80211_IF_TYPE_MNTR:
231 /* must be before the call to ieee80211_configure_filter */
Johannes Bergb2c258f2007-07-27 15:43:23 +0200232 local->monitors++;
Johannes Berg4150c572007-09-17 01:29:23 -0400233 if (local->monitors == 1) {
234 netif_tx_lock_bh(local->mdev);
235 ieee80211_configure_filter(local);
236 netif_tx_unlock_bh(local->mdev);
237
238 local->hw.conf.flags |= IEEE80211_CONF_RADIOTAP;
Johannes Berg4150c572007-09-17 01:29:23 -0400239 }
240 break;
241 case IEEE80211_IF_TYPE_STA:
242 case IEEE80211_IF_TYPE_IBSS:
243 sdata->u.sta.flags &= ~IEEE80211_STA_PREV_BSSID_SET;
244 /* fall through */
245 default:
Johannes Berg32bfd352007-12-19 01:31:26 +0100246 conf.vif = &sdata->vif;
Johannes Berg51fb61e2007-12-19 01:31:27 +0100247 conf.type = sdata->vif.type;
Johannes Berg4150c572007-09-17 01:29:23 -0400248 conf.mac_addr = dev->dev_addr;
249 res = local->ops->add_interface(local_to_hw(local), &conf);
250 if (res && !local->open_count && local->ops->stop)
251 local->ops->stop(local_to_hw(local));
252 if (res)
253 return res;
254
Johannes Bergb2c258f2007-07-27 15:43:23 +0200255 ieee80211_if_config(dev);
Daniel Draked9430a32007-07-27 15:43:24 +0200256 ieee80211_reset_erp_info(dev);
Johannes Berg11a843b2007-08-28 17:01:55 -0400257 ieee80211_enable_keys(sdata);
Johannes Berg4150c572007-09-17 01:29:23 -0400258
Johannes Berg51fb61e2007-12-19 01:31:27 +0100259 if (sdata->vif.type == IEEE80211_IF_TYPE_STA &&
Johannes Bergddd3d2b2007-09-26 17:53:20 +0200260 !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME))
Johannes Berg4150c572007-09-17 01:29:23 -0400261 netif_carrier_off(dev);
262 else
263 netif_carrier_on(dev);
Daniel Draked9430a32007-07-27 15:43:24 +0200264 }
Johannes Bergb2c258f2007-07-27 15:43:23 +0200265
Johannes Berg4150c572007-09-17 01:29:23 -0400266 if (local->open_count == 0) {
267 res = dev_open(local->mdev);
268 WARN_ON(res);
Johannes Berg4150c572007-09-17 01:29:23 -0400269 tasklet_enable(&local->tx_pending_tasklet);
270 tasklet_enable(&local->tasklet);
271 }
272
Johannes Bergc1428b32007-11-16 02:54:53 +0100273 /*
274 * set_multicast_list will be invoked by the networking core
275 * which will check whether any increments here were done in
276 * error and sync them down to the hardware as filter flags.
277 */
278 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
279 atomic_inc(&local->iff_allmultis);
280
281 if (sdata->flags & IEEE80211_SDATA_PROMISC)
282 atomic_inc(&local->iff_promiscs);
283
Johannes Berg4150c572007-09-17 01:29:23 -0400284 local->open_count++;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200285
286 netif_start_queue(dev);
Johannes Berg4150c572007-09-17 01:29:23 -0400287
Johannes Bergb2c258f2007-07-27 15:43:23 +0200288 return 0;
289}
290
Johannes Berg4150c572007-09-17 01:29:23 -0400291static int ieee80211_stop(struct net_device *dev)
Johannes Bergb2c258f2007-07-27 15:43:23 +0200292{
Johannes Berg4150c572007-09-17 01:29:23 -0400293 struct ieee80211_sub_if_data *sdata;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200294 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
Johannes Berg4150c572007-09-17 01:29:23 -0400295 struct ieee80211_if_init_conf conf;
Ron Rindjunsky07db2182007-12-25 17:00:33 +0200296 struct sta_info *sta;
297 int i;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200298
Johannes Berg4150c572007-09-17 01:29:23 -0400299 sdata = IEEE80211_DEV_TO_SUB_IF(dev);
300
Ron Rindjunsky07db2182007-12-25 17:00:33 +0200301 list_for_each_entry(sta, &local->sta_list, list) {
Ron Rindjunsky5b3d71d2008-01-13 18:21:58 +0200302 if (sta->dev == dev)
303 for (i = 0; i < STA_TID_NUM; i++)
304 ieee80211_sta_stop_rx_ba_session(sta->dev,
305 sta->addr, i,
306 WLAN_BACK_RECIPIENT,
Ron Rindjunsky07db2182007-12-25 17:00:33 +0200307 WLAN_REASON_QSTA_LEAVE_QBSS);
308 }
309
Johannes Berg4150c572007-09-17 01:29:23 -0400310 netif_stop_queue(dev);
311
Johannes Bergc1428b32007-11-16 02:54:53 +0100312 /*
313 * Don't count this interface for promisc/allmulti while it
314 * is down. dev_mc_unsync() will invoke set_multicast_list
315 * on the master interface which will sync these down to the
316 * hardware as filter flags.
317 */
318 if (sdata->flags & IEEE80211_SDATA_ALLMULTI)
319 atomic_dec(&local->iff_allmultis);
320
321 if (sdata->flags & IEEE80211_SDATA_PROMISC)
322 atomic_dec(&local->iff_promiscs);
323
Johannes Berg4150c572007-09-17 01:29:23 -0400324 dev_mc_unsync(local->mdev, dev);
325
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100326 /* APs need special treatment */
Johannes Berg51fb61e2007-12-19 01:31:27 +0100327 if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400328 struct ieee80211_sub_if_data *vlan, *tmp;
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100329 struct beacon_data *old_beacon = sdata->u.ap.beacon;
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400330
Johannes Berg5dfdaf52007-12-19 02:03:33 +0100331 /* remove beacon */
332 rcu_assign_pointer(sdata->u.ap.beacon, NULL);
333 synchronize_rcu();
334 kfree(old_beacon);
335
336 /* down all dependent devices, that is VLANs */
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400337 list_for_each_entry_safe(vlan, tmp, &sdata->u.ap.vlans,
338 u.vlan.list)
339 dev_close(vlan->dev);
340 WARN_ON(!list_empty(&sdata->u.ap.vlans));
341 }
342
Johannes Berg4150c572007-09-17 01:29:23 -0400343 local->open_count--;
344
Johannes Berg51fb61e2007-12-19 01:31:27 +0100345 switch (sdata->vif.type) {
Johannes Berg0ec3ca42007-09-17 01:29:24 -0400346 case IEEE80211_IF_TYPE_VLAN:
347 list_del(&sdata->u.vlan.list);
348 sdata->u.vlan.ap = NULL;
349 /* no need to tell driver */
350 break;
Johannes Berg4150c572007-09-17 01:29:23 -0400351 case IEEE80211_IF_TYPE_MNTR:
352 local->monitors--;
353 if (local->monitors == 0) {
354 netif_tx_lock_bh(local->mdev);
355 ieee80211_configure_filter(local);
356 netif_tx_unlock_bh(local->mdev);
357
Michael Wu8b393f12007-11-28 01:57:08 -0500358 local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP;
Johannes Berg4150c572007-09-17 01:29:23 -0400359 }
360 break;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200361 case IEEE80211_IF_TYPE_STA:
362 case IEEE80211_IF_TYPE_IBSS:
363 sdata->u.sta.state = IEEE80211_DISABLED;
364 del_timer_sync(&sdata->u.sta.timer);
Johannes Berg2a8a9a82007-08-28 17:01:52 -0400365 /*
Johannes Berg79010422007-09-18 17:29:21 -0400366 * When we get here, the interface is marked down.
367 * Call synchronize_rcu() to wait for the RX path
368 * should it be using the interface and enqueuing
369 * frames at this very time on another CPU.
Johannes Berg2a8a9a82007-08-28 17:01:52 -0400370 */
Johannes Berg79010422007-09-18 17:29:21 -0400371 synchronize_rcu();
Johannes Bergb2c258f2007-07-27 15:43:23 +0200372 skb_queue_purge(&sdata->u.sta.skb_queue);
Johannes Berg2a8a9a82007-08-28 17:01:52 -0400373
Zhu Yiece8edd2007-11-22 10:53:21 +0800374 if (local->scan_dev == sdata->dev) {
375 if (!local->ops->hw_scan) {
376 local->sta_sw_scanning = 0;
377 cancel_delayed_work(&local->scan_work);
378 } else
379 local->sta_hw_scanning = 0;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200380 }
Zhu Yiece8edd2007-11-22 10:53:21 +0800381
Johannes Bergb2c258f2007-07-27 15:43:23 +0200382 flush_workqueue(local->hw.workqueue);
Zhu Yia10605e2007-11-22 11:10:22 +0800383
384 sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED;
385 kfree(sdata->u.sta.extra_ie);
386 sdata->u.sta.extra_ie = NULL;
387 sdata->u.sta.extra_ie_len = 0;
Johannes Berg4150c572007-09-17 01:29:23 -0400388 /* fall through */
389 default:
Johannes Berg32bfd352007-12-19 01:31:26 +0100390 conf.vif = &sdata->vif;
Johannes Berg51fb61e2007-12-19 01:31:27 +0100391 conf.type = sdata->vif.type;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200392 conf.mac_addr = dev->dev_addr;
Johannes Berg4150c572007-09-17 01:29:23 -0400393 /* disable all keys for as long as this netdev is down */
394 ieee80211_disable_keys(sdata);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200395 local->ops->remove_interface(local_to_hw(local), &conf);
396 }
397
Johannes Berg4150c572007-09-17 01:29:23 -0400398 if (local->open_count == 0) {
399 if (netif_running(local->mdev))
400 dev_close(local->mdev);
401
Johannes Berg4150c572007-09-17 01:29:23 -0400402 if (local->ops->stop)
403 local->ops->stop(local_to_hw(local));
404
Ivo van Doorncdcb0062008-01-07 19:45:24 +0100405 ieee80211_led_radio(local, 0);
406
Johannes Berg4150c572007-09-17 01:29:23 -0400407 tasklet_disable(&local->tx_pending_tasklet);
408 tasklet_disable(&local->tasklet);
409 }
Johannes Bergb2c258f2007-07-27 15:43:23 +0200410
411 return 0;
412}
413
Johannes Bergb2c258f2007-07-27 15:43:23 +0200414static void ieee80211_set_multicast_list(struct net_device *dev)
415{
416 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
417 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Johannes Berg4150c572007-09-17 01:29:23 -0400418 int allmulti, promisc, sdata_allmulti, sdata_promisc;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200419
Johannes Berg4150c572007-09-17 01:29:23 -0400420 allmulti = !!(dev->flags & IFF_ALLMULTI);
421 promisc = !!(dev->flags & IFF_PROMISC);
Johannes Bergb52f2192007-11-16 01:49:11 +0100422 sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI);
423 sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC);
Johannes Berg4150c572007-09-17 01:29:23 -0400424
425 if (allmulti != sdata_allmulti) {
426 if (dev->flags & IFF_ALLMULTI)
Johannes Berg53918992007-09-26 15:19:47 +0200427 atomic_inc(&local->iff_allmultis);
Johannes Berg4150c572007-09-17 01:29:23 -0400428 else
Johannes Berg53918992007-09-26 15:19:47 +0200429 atomic_dec(&local->iff_allmultis);
Jiri Slaby13262ff2007-08-28 17:01:54 -0400430 sdata->flags ^= IEEE80211_SDATA_ALLMULTI;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200431 }
Johannes Berg4150c572007-09-17 01:29:23 -0400432
433 if (promisc != sdata_promisc) {
434 if (dev->flags & IFF_PROMISC)
Johannes Berg53918992007-09-26 15:19:47 +0200435 atomic_inc(&local->iff_promiscs);
Johannes Berg4150c572007-09-17 01:29:23 -0400436 else
Johannes Berg53918992007-09-26 15:19:47 +0200437 atomic_dec(&local->iff_promiscs);
Jiri Slaby13262ff2007-08-28 17:01:54 -0400438 sdata->flags ^= IEEE80211_SDATA_PROMISC;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200439 }
Johannes Berg4150c572007-09-17 01:29:23 -0400440
441 dev_mc_sync(local->mdev, dev);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200442}
443
Stephen Hemminger3b04ddd2007-10-09 01:40:57 -0700444static const struct header_ops ieee80211_header_ops = {
445 .create = eth_header,
446 .parse = header_parse_80211,
447 .rebuild = eth_rebuild_header,
448 .cache = eth_header_cache,
449 .cache_update = eth_header_cache_update,
450};
451
Johannes Bergf9d540e2007-09-28 14:02:09 +0200452/* Must not be called for mdev */
Johannes Bergb2c258f2007-07-27 15:43:23 +0200453void ieee80211_if_setup(struct net_device *dev)
454{
455 ether_setup(dev);
456 dev->hard_start_xmit = ieee80211_subif_start_xmit;
457 dev->wireless_handlers = &ieee80211_iw_handler_def;
458 dev->set_multicast_list = ieee80211_set_multicast_list;
459 dev->change_mtu = ieee80211_change_mtu;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200460 dev->open = ieee80211_open;
461 dev->stop = ieee80211_stop;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200462 dev->destructor = ieee80211_if_free;
463}
464
465/* WDS specialties */
466
467int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr)
468{
469 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
470 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
471 struct sta_info *sta;
Joe Perches0795af52007-10-03 17:59:30 -0700472 DECLARE_MAC_BUF(mac);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200473
474 if (compare_ether_addr(remote_addr, sdata->u.wds.remote_addr) == 0)
475 return 0;
476
477 /* Create STA entry for the new peer */
478 sta = sta_info_add(local, dev, remote_addr, GFP_KERNEL);
479 if (!sta)
480 return -ENOMEM;
481 sta_info_put(sta);
482
483 /* Remove STA entry for the old peer */
484 sta = sta_info_get(local, sdata->u.wds.remote_addr);
485 if (sta) {
Michael Wube8755e2007-07-27 15:43:23 +0200486 sta_info_free(sta);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200487 sta_info_put(sta);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200488 } else {
489 printk(KERN_DEBUG "%s: could not find STA entry for WDS link "
Joe Perches0795af52007-10-03 17:59:30 -0700490 "peer %s\n",
491 dev->name, print_mac(mac, sdata->u.wds.remote_addr));
Johannes Bergb2c258f2007-07-27 15:43:23 +0200492 }
493
494 /* Update WDS link data */
495 memcpy(&sdata->u.wds.remote_addr, remote_addr, ETH_ALEN);
496
497 return 0;
498}
499
500/* everything else */
501
Johannes Bergb2c258f2007-07-27 15:43:23 +0200502static int __ieee80211_if_config(struct net_device *dev,
503 struct sk_buff *beacon,
504 struct ieee80211_tx_control *control)
505{
506 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
507 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
508 struct ieee80211_if_conf conf;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200509
510 if (!local->ops->config_interface || !netif_running(dev))
511 return 0;
512
513 memset(&conf, 0, sizeof(conf));
Johannes Berg51fb61e2007-12-19 01:31:27 +0100514 conf.type = sdata->vif.type;
515 if (sdata->vif.type == IEEE80211_IF_TYPE_STA ||
516 sdata->vif.type == IEEE80211_IF_TYPE_IBSS) {
Johannes Berg4150c572007-09-17 01:29:23 -0400517 conf.bssid = sdata->u.sta.bssid;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200518 conf.ssid = sdata->u.sta.ssid;
519 conf.ssid_len = sdata->u.sta.ssid_len;
Johannes Berg51fb61e2007-12-19 01:31:27 +0100520 } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) {
Johannes Bergb2c258f2007-07-27 15:43:23 +0200521 conf.ssid = sdata->u.ap.ssid;
522 conf.ssid_len = sdata->u.ap.ssid_len;
Johannes Bergb2c258f2007-07-27 15:43:23 +0200523 conf.beacon = beacon;
524 conf.beacon_control = control;
525 }
526 return local->ops->config_interface(local_to_hw(local),
Johannes Berg32bfd352007-12-19 01:31:26 +0100527 &sdata->vif, &conf);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200528}
529
530int ieee80211_if_config(struct net_device *dev)
531{
532 return __ieee80211_if_config(dev, NULL, NULL);
533}
534
535int ieee80211_if_config_beacon(struct net_device *dev)
536{
537 struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr);
538 struct ieee80211_tx_control control;
Johannes Berg32bfd352007-12-19 01:31:26 +0100539 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200540 struct sk_buff *skb;
541
542 if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE))
543 return 0;
Johannes Berg32bfd352007-12-19 01:31:26 +0100544 skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif,
545 &control);
Johannes Bergb2c258f2007-07-27 15:43:23 +0200546 if (!skb)
547 return -ENOMEM;
548 return __ieee80211_if_config(dev, skb, &control);
549}
550
551int ieee80211_hw_config(struct ieee80211_local *local)
552{
553 struct ieee80211_hw_mode *mode;
554 struct ieee80211_channel *chan;
555 int ret = 0;
556
Zhu Yiece8edd2007-11-22 10:53:21 +0800557 if (local->sta_sw_scanning) {
Johannes Bergb2c258f2007-07-27 15:43:23 +0200558 chan = local->scan_channel;
559 mode = local->scan_hw_mode;
560 } else {
561 chan = local->oper_channel;
562 mode = local->oper_hw_mode;
563 }
564
565 local->hw.conf.channel = chan->chan;
566 local->hw.conf.channel_val = chan->val;
Michael Buesch61609bc2007-09-20 22:06:39 +0200567 if (!local->hw.conf.power_level) {
568 local->hw.conf.power_level = chan->power_level;
569 } else {
570 local->hw.conf.power_level = min(chan->power_level,
571 local->hw.conf.power_level);
572 }
Johannes Bergb2c258f2007-07-27 15:43:23 +0200573 local->hw.conf.freq = chan->freq;
574 local->hw.conf.phymode = mode->mode;
575 local->hw.conf.antenna_max = chan->antenna_max;
576 local->hw.conf.chan = chan;
577 local->hw.conf.mode = mode;
578
579#ifdef CONFIG_MAC80211_VERBOSE_DEBUG
580 printk(KERN_DEBUG "HW CONFIG: channel=%d freq=%d "
581 "phymode=%d\n", local->hw.conf.channel, local->hw.conf.freq,
582 local->hw.conf.phymode);
583#endif /* CONFIG_MAC80211_VERBOSE_DEBUG */
584
Michael Bueschf7c4dae2007-09-24 18:41:49 +0200585 if (local->open_count)
Johannes Bergb2c258f2007-07-27 15:43:23 +0200586 ret = local->ops->config(local_to_hw(local), &local->hw.conf);
587
588 return ret;
589}
590
Ron Rindjunskyd3c990f2007-11-26 16:14:34 +0200591/**
592 * ieee80211_hw_config_ht should be used only after legacy configuration
593 * has been determined, as ht configuration depends upon the hardware's
594 * HT abilities for a _specific_ band.
595 */
596int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht,
597 struct ieee80211_ht_info *req_ht_cap,
598 struct ieee80211_ht_bss_info *req_bss_cap)
599{
600 struct ieee80211_conf *conf = &local->hw.conf;
601 struct ieee80211_hw_mode *mode = conf->mode;
602 int i;
603
604 /* HT is not supported */
605 if (!mode->ht_info.ht_supported) {
606 conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
607 return -EOPNOTSUPP;
608 }
609
610 /* disable HT */
611 if (!enable_ht) {
612 conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE;
613 } else {
614 conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE;
615 conf->ht_conf.cap = req_ht_cap->cap & mode->ht_info.cap;
616 conf->ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS);
617 conf->ht_conf.cap |=
618 mode->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS;
619 conf->ht_bss_conf.primary_channel =
620 req_bss_cap->primary_channel;
621 conf->ht_bss_conf.bss_cap = req_bss_cap->bss_cap;
622 conf->ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode;
623 for (i = 0; i < SUPP_MCS_SET_LEN; i++)
624 conf->ht_conf.supp_mcs_set[i] =
625 mode->ht_info.supp_mcs_set[i] &
626 req_ht_cap->supp_mcs_set[i];
627
628 /* In STA mode, this gives us indication
629 * to the AP's mode of operation */
630 conf->ht_conf.ht_supported = 1;
631 conf->ht_conf.ampdu_factor = req_ht_cap->ampdu_factor;
632 conf->ht_conf.ampdu_density = req_ht_cap->ampdu_density;
633 }
634
635 local->ops->conf_ht(local_to_hw(local), &local->hw.conf);
636
637 return 0;
638}
639
Johannes Berg471b3ef2007-12-28 14:32:58 +0100640void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
641 u32 changed)
Daniel Draked9430a32007-07-27 15:43:24 +0200642{
Johannes Berg471b3ef2007-12-28 14:32:58 +0100643 struct ieee80211_local *local = sdata->local;
644
645 if (!changed)
646 return;
647
648 if (local->ops->bss_info_changed)
649 local->ops->bss_info_changed(local_to_hw(local),
650 &sdata->vif,
651 &sdata->bss_conf,
652 changed);
Daniel Draked9430a32007-07-27 15:43:24 +0200653}
654
655void ieee80211_reset_erp_info(struct net_device *dev)
656{
657 struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev);
658
Johannes Berg471b3ef2007-12-28 14:32:58 +0100659 sdata->bss_conf.use_cts_prot = 0;
660 sdata->bss_conf.use_short_preamble = 0;
661 ieee80211_bss_info_change_notify(sdata,
662 BSS_CHANGED_ERP_CTS_PROT |
663 BSS_CHANGED_ERP_PREAMBLE);
Daniel Draked9430a32007-07-27 15:43:24 +0200664}
665
Jiri Bencf0706e822007-05-05 11:45:53 -0700666void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw,
667 struct sk_buff *skb,
668 struct ieee80211_tx_status *status)
669{
670 struct ieee80211_local *local = hw_to_local(hw);
671 struct ieee80211_tx_status *saved;
672 int tmp;
673
674 skb->dev = local->mdev;
675 saved = kmalloc(sizeof(struct ieee80211_tx_status), GFP_ATOMIC);
676 if (unlikely(!saved)) {
677 if (net_ratelimit())
678 printk(KERN_WARNING "%s: Not enough memory, "
679 "dropping tx status", skb->dev->name);
680 /* should be dev_kfree_skb_irq, but due to this function being
681 * named _irqsafe instead of just _irq we can't be sure that
682 * people won't call it from non-irq contexts */
683 dev_kfree_skb_any(skb);
684 return;
685 }
686 memcpy(saved, status, sizeof(struct ieee80211_tx_status));
687 /* copy pointer to saved status into skb->cb for use by tasklet */
688 memcpy(skb->cb, &saved, sizeof(saved));
689
690 skb->pkt_type = IEEE80211_TX_STATUS_MSG;
691 skb_queue_tail(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS ?
692 &local->skb_queue : &local->skb_queue_unreliable, skb);
693 tmp = skb_queue_len(&local->skb_queue) +
694 skb_queue_len(&local->skb_queue_unreliable);
695 while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT &&
696 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
697 memcpy(&saved, skb->cb, sizeof(saved));
698 kfree(saved);
699 dev_kfree_skb_irq(skb);
700 tmp--;
701 I802_DEBUG_INC(local->tx_status_drop);
702 }
703 tasklet_schedule(&local->tasklet);
704}
705EXPORT_SYMBOL(ieee80211_tx_status_irqsafe);
706
707static void ieee80211_tasklet_handler(unsigned long data)
708{
709 struct ieee80211_local *local = (struct ieee80211_local *) data;
710 struct sk_buff *skb;
711 struct ieee80211_rx_status rx_status;
712 struct ieee80211_tx_status *tx_status;
713
714 while ((skb = skb_dequeue(&local->skb_queue)) ||
715 (skb = skb_dequeue(&local->skb_queue_unreliable))) {
716 switch (skb->pkt_type) {
717 case IEEE80211_RX_MSG:
718 /* status is in skb->cb */
719 memcpy(&rx_status, skb->cb, sizeof(rx_status));
Johannes Berg51fb61e2007-12-19 01:31:27 +0100720 /* Clear skb->pkt_type in order to not confuse kernel
Jiri Bencf0706e822007-05-05 11:45:53 -0700721 * netstack. */
722 skb->pkt_type = 0;
723 __ieee80211_rx(local_to_hw(local), skb, &rx_status);
724 break;
725 case IEEE80211_TX_STATUS_MSG:
726 /* get pointer to saved status out of skb->cb */
727 memcpy(&tx_status, skb->cb, sizeof(tx_status));
728 skb->pkt_type = 0;
729 ieee80211_tx_status(local_to_hw(local),
730 skb, tx_status);
731 kfree(tx_status);
732 break;
733 default: /* should never get here! */
734 printk(KERN_ERR "%s: Unknown message type (%d)\n",
Johannes Bergdd1cd4c2007-09-18 17:29:20 -0400735 wiphy_name(local->hw.wiphy), skb->pkt_type);
Jiri Bencf0706e822007-05-05 11:45:53 -0700736 dev_kfree_skb(skb);
737 break;
738 }
739 }
740}
741
Jiri Bencf0706e822007-05-05 11:45:53 -0700742/* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to
743 * make a prepared TX frame (one that has been given to hw) to look like brand
744 * new IEEE 802.11 frame that is ready to go through TX processing again.
745 * Also, tx_packet_data in cb is restored from tx_control. */
746static void ieee80211_remove_tx_extra(struct ieee80211_local *local,
747 struct ieee80211_key *key,
748 struct sk_buff *skb,
749 struct ieee80211_tx_control *control)
750{
751 int hdrlen, iv_len, mic_len;
752 struct ieee80211_tx_packet_data *pkt_data;
753
754 pkt_data = (struct ieee80211_tx_packet_data *)skb->cb;
Johannes Berg32bfd352007-12-19 01:31:26 +0100755 pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex;
Jiri Slabye8bf9642007-08-28 17:01:54 -0400756 pkt_data->flags = 0;
757 if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS)
758 pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS;
759 if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT)
760 pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT;
761 if (control->flags & IEEE80211_TXCTL_REQUEUE)
762 pkt_data->flags |= IEEE80211_TXPD_REQUEUE;
Johannes Berg678f5f72007-12-19 01:31:23 +0100763 if (control->flags & IEEE80211_TXCTL_EAPOL_FRAME)
764 pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME;
Jiri Bencf0706e822007-05-05 11:45:53 -0700765 pkt_data->queue = control->queue;
766
767 hdrlen = ieee80211_get_hdrlen_from_skb(skb);
768
769 if (!key)
770 goto no_key;
771
Johannes Berg8f20fc22007-08-28 17:01:54 -0400772 switch (key->conf.alg) {
Jiri Bencf0706e822007-05-05 11:45:53 -0700773 case ALG_WEP:
774 iv_len = WEP_IV_LEN;
775 mic_len = WEP_ICV_LEN;
776 break;
777 case ALG_TKIP:
778 iv_len = TKIP_IV_LEN;
779 mic_len = TKIP_ICV_LEN;
780 break;
781 case ALG_CCMP:
782 iv_len = CCMP_HDR_LEN;
783 mic_len = CCMP_MIC_LEN;
784 break;
785 default:
786 goto no_key;
787 }
788
Johannes Berg8f20fc22007-08-28 17:01:54 -0400789 if (skb->len >= mic_len &&
Johannes Berg11a843b2007-08-28 17:01:55 -0400790 !(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE))
Jiri Bencf0706e822007-05-05 11:45:53 -0700791 skb_trim(skb, skb->len - mic_len);
792 if (skb->len >= iv_len && skb->len > hdrlen) {
793 memmove(skb->data + iv_len, skb->data, hdrlen);
794 skb_pull(skb, iv_len);
795 }
796
797no_key:
798 {
799 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
800 u16 fc = le16_to_cpu(hdr->frame_control);
801 if ((fc & 0x8C) == 0x88) /* QoS Control Field */ {
802 fc &= ~IEEE80211_STYPE_QOS_DATA;
803 hdr->frame_control = cpu_to_le16(fc);
804 memmove(skb->data + 2, skb->data, hdrlen - 2);
805 skb_pull(skb, 2);
806 }
807 }
808}
809
Jiri Bencf0706e822007-05-05 11:45:53 -0700810void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb,
811 struct ieee80211_tx_status *status)
812{
813 struct sk_buff *skb2;
814 struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data;
815 struct ieee80211_local *local = hw_to_local(hw);
816 u16 frag, type;
Johannes Bergb306f452007-07-10 19:32:08 +0200817 struct ieee80211_tx_status_rtap_hdr *rthdr;
818 struct ieee80211_sub_if_data *sdata;
819 int monitors;
Jiri Bencf0706e822007-05-05 11:45:53 -0700820
821 if (!status) {
822 printk(KERN_ERR
823 "%s: ieee80211_tx_status called with NULL status\n",
Johannes Bergdd1cd4c2007-09-18 17:29:20 -0400824 wiphy_name(local->hw.wiphy));
Jiri Bencf0706e822007-05-05 11:45:53 -0700825 dev_kfree_skb(skb);
826 return;
827 }
828
829 if (status->excessive_retries) {
830 struct sta_info *sta;
831 sta = sta_info_get(local, hdr->addr1);
832 if (sta) {
833 if (sta->flags & WLAN_STA_PS) {
834 /* The STA is in power save mode, so assume
835 * that this TX packet failed because of that.
836 */
837 status->excessive_retries = 0;
838 status->flags |= IEEE80211_TX_STATUS_TX_FILTERED;
839 }
840 sta_info_put(sta);
841 }
842 }
843
844 if (status->flags & IEEE80211_TX_STATUS_TX_FILTERED) {
845 struct sta_info *sta;
846 sta = sta_info_get(local, hdr->addr1);
847 if (sta) {
848 sta->tx_filtered_count++;
849
850 /* Clear the TX filter mask for this STA when sending
851 * the next packet. If the STA went to power save mode,
852 * this will happen when it is waking up for the next
853 * time. */
854 sta->clear_dst_mask = 1;
855
856 /* TODO: Is the WLAN_STA_PS flag always set here or is
857 * the race between RX and TX status causing some
858 * packets to be filtered out before 80211.o gets an
859 * update for PS status? This seems to be the case, so
860 * no changes are likely to be needed. */
861 if (sta->flags & WLAN_STA_PS &&
862 skb_queue_len(&sta->tx_filtered) <
863 STA_MAX_TX_BUFFER) {
864 ieee80211_remove_tx_extra(local, sta->key,
865 skb,
866 &status->control);
867 skb_queue_tail(&sta->tx_filtered, skb);
868 } else if (!(sta->flags & WLAN_STA_PS) &&
869 !(status->control.flags & IEEE80211_TXCTL_REQUEUE)) {
870 /* Software retry the packet once */
871 status->control.flags |= IEEE80211_TXCTL_REQUEUE;
872 ieee80211_remove_tx_extra(local, sta->key,
873 skb,
874 &status->control);
875 dev_queue_xmit(skb);
876 } else {
877 if (net_ratelimit()) {
878 printk(KERN_DEBUG "%s: dropped TX "
879 "filtered frame queue_len=%d "
880 "PS=%d @%lu\n",
Johannes Bergdd1cd4c2007-09-18 17:29:20 -0400881 wiphy_name(local->hw.wiphy),
Jiri Bencf0706e822007-05-05 11:45:53 -0700882 skb_queue_len(
883 &sta->tx_filtered),
884 !!(sta->flags & WLAN_STA_PS),
885 jiffies);
886 }
887 dev_kfree_skb(skb);
888 }
889 sta_info_put(sta);
890 return;
891 }
Mattias Nissler1abbe492007-12-20 13:50:07 +0100892 } else
893 rate_control_tx_status(local->mdev, skb, status);
Jiri Bencf0706e822007-05-05 11:45:53 -0700894
895 ieee80211_led_tx(local, 0);
896
897 /* SNMP counters
898 * Fragments are passed to low-level drivers as separate skbs, so these
899 * are actually fragments, not frames. Update frame counters only for
900 * the first fragment of the frame. */
901
902 frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG;
903 type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE;
904
905 if (status->flags & IEEE80211_TX_STATUS_ACK) {
906 if (frag == 0) {
907 local->dot11TransmittedFrameCount++;
908 if (is_multicast_ether_addr(hdr->addr1))
909 local->dot11MulticastTransmittedFrameCount++;
910 if (status->retry_count > 0)
911 local->dot11RetryCount++;
912 if (status->retry_count > 1)
913 local->dot11MultipleRetryCount++;
914 }
915
916 /* This counter shall be incremented for an acknowledged MPDU
917 * with an individual address in the address 1 field or an MPDU
918 * with a multicast address in the address 1 field of type Data
919 * or Management. */
920 if (!is_multicast_ether_addr(hdr->addr1) ||
921 type == IEEE80211_FTYPE_DATA ||
922 type == IEEE80211_FTYPE_MGMT)
923 local->dot11TransmittedFragmentCount++;
924 } else {
925 if (frag == 0)
926 local->dot11FailedCount++;
927 }
928
Johannes Bergb306f452007-07-10 19:32:08 +0200929 /* this was a transmitted frame, but now we want to reuse it */
930 skb_orphan(skb);
931
Johannes Bergb306f452007-07-10 19:32:08 +0200932 if (!local->monitors) {
Jiri Bencf0706e822007-05-05 11:45:53 -0700933 dev_kfree_skb(skb);
934 return;
935 }
Jiri Bencf0706e822007-05-05 11:45:53 -0700936
Johannes Bergb306f452007-07-10 19:32:08 +0200937 /* send frame to monitor interfaces now */
938
939 if (skb_headroom(skb) < sizeof(*rthdr)) {
940 printk(KERN_ERR "ieee80211_tx_status: headroom too small\n");
941 dev_kfree_skb(skb);
942 return;
943 }
944
945 rthdr = (struct ieee80211_tx_status_rtap_hdr*)
946 skb_push(skb, sizeof(*rthdr));
947
948 memset(rthdr, 0, sizeof(*rthdr));
949 rthdr->hdr.it_len = cpu_to_le16(sizeof(*rthdr));
950 rthdr->hdr.it_present =
951 cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) |
952 (1 << IEEE80211_RADIOTAP_DATA_RETRIES));
953
954 if (!(status->flags & IEEE80211_TX_STATUS_ACK) &&
955 !is_multicast_ether_addr(hdr->addr1))
956 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL);
957
958 if ((status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) &&
959 (status->control.flags & IEEE80211_TXCTL_USE_CTS_PROTECT))
960 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS);
961 else if (status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS)
962 rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS);
963
964 rthdr->data_retries = status->retry_count;
965
Johannes Berg79010422007-09-18 17:29:21 -0400966 rcu_read_lock();
Johannes Bergb306f452007-07-10 19:32:08 +0200967 monitors = local->monitors;
Johannes Berg79010422007-09-18 17:29:21 -0400968 list_for_each_entry_rcu(sdata, &local->interfaces, list) {
Johannes Bergb306f452007-07-10 19:32:08 +0200969 /*
970 * Using the monitors counter is possibly racy, but
971 * if the value is wrong we simply either clone the skb
972 * once too much or forget sending it to one monitor iface
973 * The latter case isn't nice but fixing the race is much
974 * more complicated.
975 */
976 if (!monitors || !skb)
977 goto out;
978
Johannes Berg51fb61e2007-12-19 01:31:27 +0100979 if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) {
Johannes Bergb306f452007-07-10 19:32:08 +0200980 if (!netif_running(sdata->dev))
981 continue;
982 monitors--;
983 if (monitors)
Johannes Berg79010422007-09-18 17:29:21 -0400984 skb2 = skb_clone(skb, GFP_ATOMIC);
Johannes Bergb306f452007-07-10 19:32:08 +0200985 else
986 skb2 = NULL;
987 skb->dev = sdata->dev;
988 /* XXX: is this sufficient for BPF? */
989 skb_set_mac_header(skb, 0);
990 skb->ip_summed = CHECKSUM_UNNECESSARY;
991 skb->pkt_type = PACKET_OTHERHOST;
992 skb->protocol = htons(ETH_P_802_2);
993 memset(skb->cb, 0, sizeof(skb->cb));
994 netif_rx(skb);
995 skb = skb2;
Johannes Bergb306f452007-07-10 19:32:08 +0200996 }
997 }
998 out:
Johannes Berg79010422007-09-18 17:29:21 -0400999 rcu_read_unlock();
Johannes Bergb306f452007-07-10 19:32:08 +02001000 if (skb)
1001 dev_kfree_skb(skb);
Jiri Bencf0706e822007-05-05 11:45:53 -07001002}
1003EXPORT_SYMBOL(ieee80211_tx_status);
1004
Jiri Bencf0706e822007-05-05 11:45:53 -07001005struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
1006 const struct ieee80211_ops *ops)
1007{
1008 struct net_device *mdev;
1009 struct ieee80211_local *local;
1010 struct ieee80211_sub_if_data *sdata;
1011 int priv_size;
1012 struct wiphy *wiphy;
1013
1014 /* Ensure 32-byte alignment of our private data and hw private data.
1015 * We use the wiphy priv data for both our ieee80211_local and for
1016 * the driver's private data
1017 *
1018 * In memory it'll be like this:
1019 *
1020 * +-------------------------+
1021 * | struct wiphy |
1022 * +-------------------------+
1023 * | struct ieee80211_local |
1024 * +-------------------------+
1025 * | driver's private data |
1026 * +-------------------------+
1027 *
1028 */
1029 priv_size = ((sizeof(struct ieee80211_local) +
1030 NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) +
1031 priv_data_len;
1032
1033 wiphy = wiphy_new(&mac80211_config_ops, priv_size);
1034
1035 if (!wiphy)
1036 return NULL;
1037
1038 wiphy->privid = mac80211_wiphy_privid;
1039
1040 local = wiphy_priv(wiphy);
1041 local->hw.wiphy = wiphy;
1042
1043 local->hw.priv = (char *)local +
1044 ((sizeof(struct ieee80211_local) +
1045 NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST);
1046
Johannes Berg4480f15c2007-07-10 19:32:10 +02001047 BUG_ON(!ops->tx);
Johannes Berg4150c572007-09-17 01:29:23 -04001048 BUG_ON(!ops->start);
1049 BUG_ON(!ops->stop);
Johannes Berg4480f15c2007-07-10 19:32:10 +02001050 BUG_ON(!ops->config);
1051 BUG_ON(!ops->add_interface);
Johannes Berg4150c572007-09-17 01:29:23 -04001052 BUG_ON(!ops->remove_interface);
1053 BUG_ON(!ops->configure_filter);
Jiri Bencf0706e822007-05-05 11:45:53 -07001054 local->ops = ops;
1055
1056 /* for now, mdev needs sub_if_data :/ */
1057 mdev = alloc_netdev(sizeof(struct ieee80211_sub_if_data),
1058 "wmaster%d", ether_setup);
1059 if (!mdev) {
1060 wiphy_free(wiphy);
1061 return NULL;
1062 }
1063
1064 sdata = IEEE80211_DEV_TO_SUB_IF(mdev);
1065 mdev->ieee80211_ptr = &sdata->wdev;
1066 sdata->wdev.wiphy = wiphy;
1067
1068 local->hw.queues = 1; /* default */
1069
1070 local->mdev = mdev;
1071 local->rx_pre_handlers = ieee80211_rx_pre_handlers;
1072 local->rx_handlers = ieee80211_rx_handlers;
1073 local->tx_handlers = ieee80211_tx_handlers;
1074
1075 local->bridge_packets = 1;
1076
1077 local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD;
1078 local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD;
1079 local->short_retry_limit = 7;
1080 local->long_retry_limit = 4;
1081 local->hw.conf.radio_enabled = 1;
Jiri Bencf0706e822007-05-05 11:45:53 -07001082
Johannes Bergb708e612007-09-14 11:10:25 -04001083 local->enabled_modes = ~0;
Jiri Bencf0706e822007-05-05 11:45:53 -07001084
1085 INIT_LIST_HEAD(&local->modes_list);
1086
Johannes Berg79010422007-09-18 17:29:21 -04001087 INIT_LIST_HEAD(&local->interfaces);
Jiri Bencf0706e822007-05-05 11:45:53 -07001088
1089 INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work);
Jiri Bencf0706e822007-05-05 11:45:53 -07001090 ieee80211_rx_bss_list_init(mdev);
1091
1092 sta_info_init(local);
1093
1094 mdev->hard_start_xmit = ieee80211_master_start_xmit;
1095 mdev->open = ieee80211_master_open;
1096 mdev->stop = ieee80211_master_stop;
1097 mdev->type = ARPHRD_IEEE80211;
Stephen Hemminger3b04ddd2007-10-09 01:40:57 -07001098 mdev->header_ops = &ieee80211_header_ops;
Johannes Berg4150c572007-09-17 01:29:23 -04001099 mdev->set_multicast_list = ieee80211_master_set_multicast_list;
Jiri Bencf0706e822007-05-05 11:45:53 -07001100
Johannes Berg51fb61e2007-12-19 01:31:27 +01001101 sdata->vif.type = IEEE80211_IF_TYPE_AP;
Jiri Bencf0706e822007-05-05 11:45:53 -07001102 sdata->dev = mdev;
1103 sdata->local = local;
1104 sdata->u.ap.force_unicast_rateidx = -1;
1105 sdata->u.ap.max_ratectrl_rateidx = -1;
1106 ieee80211_if_sdata_init(sdata);
Johannes Berg79010422007-09-18 17:29:21 -04001107 /* no RCU needed since we're still during init phase */
1108 list_add_tail(&sdata->list, &local->interfaces);
Jiri Bencf0706e822007-05-05 11:45:53 -07001109
1110 tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
1111 (unsigned long)local);
1112 tasklet_disable(&local->tx_pending_tasklet);
1113
1114 tasklet_init(&local->tasklet,
1115 ieee80211_tasklet_handler,
1116 (unsigned long) local);
1117 tasklet_disable(&local->tasklet);
1118
1119 skb_queue_head_init(&local->skb_queue);
1120 skb_queue_head_init(&local->skb_queue_unreliable);
1121
1122 return local_to_hw(local);
1123}
1124EXPORT_SYMBOL(ieee80211_alloc_hw);
1125
1126int ieee80211_register_hw(struct ieee80211_hw *hw)
1127{
1128 struct ieee80211_local *local = hw_to_local(hw);
1129 const char *name;
1130 int result;
1131
1132 result = wiphy_register(local->hw.wiphy);
1133 if (result < 0)
1134 return result;
1135
1136 name = wiphy_dev(local->hw.wiphy)->driver->name;
1137 local->hw.workqueue = create_singlethread_workqueue(name);
1138 if (!local->hw.workqueue) {
1139 result = -ENOMEM;
1140 goto fail_workqueue;
1141 }
1142
Johannes Bergb306f452007-07-10 19:32:08 +02001143 /*
1144 * The hardware needs headroom for sending the frame,
1145 * and we need some headroom for passing the frame to monitor
1146 * interfaces, but never both at the same time.
1147 */
Jiri Benc33ccad32007-07-18 17:10:44 +02001148 local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
1149 sizeof(struct ieee80211_tx_status_rtap_hdr));
Johannes Bergb306f452007-07-10 19:32:08 +02001150
Jiri Bence9f207f2007-05-05 11:46:38 -07001151 debugfs_hw_add(local);
1152
Jiri Bencf0706e822007-05-05 11:45:53 -07001153 local->hw.conf.beacon_int = 1000;
1154
1155 local->wstats_flags |= local->hw.max_rssi ?
1156 IW_QUAL_LEVEL_UPDATED : IW_QUAL_LEVEL_INVALID;
1157 local->wstats_flags |= local->hw.max_signal ?
1158 IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID;
1159 local->wstats_flags |= local->hw.max_noise ?
1160 IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID;
1161 if (local->hw.max_rssi < 0 || local->hw.max_noise < 0)
1162 local->wstats_flags |= IW_QUAL_DBM;
1163
1164 result = sta_info_start(local);
1165 if (result < 0)
1166 goto fail_sta_info;
1167
1168 rtnl_lock();
1169 result = dev_alloc_name(local->mdev, local->mdev->name);
1170 if (result < 0)
1171 goto fail_dev;
1172
1173 memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN);
1174 SET_NETDEV_DEV(local->mdev, wiphy_dev(local->hw.wiphy));
1175
1176 result = register_netdevice(local->mdev);
1177 if (result < 0)
1178 goto fail_dev;
1179
Jiri Bence9f207f2007-05-05 11:46:38 -07001180 ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
Johannes Berg5b2812e2007-09-26 14:27:23 +02001181 ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP);
Jiri Bence9f207f2007-05-05 11:46:38 -07001182
Johannes Berg830f9032007-10-28 14:51:05 +01001183 result = ieee80211_init_rate_ctrl_alg(local,
1184 hw->rate_control_algorithm);
Jiri Bencf0706e822007-05-05 11:45:53 -07001185 if (result < 0) {
1186 printk(KERN_DEBUG "%s: Failed to initialize rate control "
Johannes Bergdd1cd4c2007-09-18 17:29:20 -04001187 "algorithm\n", wiphy_name(local->hw.wiphy));
Jiri Bencf0706e822007-05-05 11:45:53 -07001188 goto fail_rate;
1189 }
1190
1191 result = ieee80211_wep_init(local);
1192
1193 if (result < 0) {
1194 printk(KERN_DEBUG "%s: Failed to initialize wep\n",
Johannes Bergdd1cd4c2007-09-18 17:29:20 -04001195 wiphy_name(local->hw.wiphy));
Jiri Bencf0706e822007-05-05 11:45:53 -07001196 goto fail_wep;
1197 }
1198
1199 ieee80211_install_qdisc(local->mdev);
1200
1201 /* add one default STA interface */
1202 result = ieee80211_if_add(local->mdev, "wlan%d", NULL,
1203 IEEE80211_IF_TYPE_STA);
1204 if (result)
1205 printk(KERN_WARNING "%s: Failed to add default virtual iface\n",
Johannes Bergdd1cd4c2007-09-18 17:29:20 -04001206 wiphy_name(local->hw.wiphy));
Jiri Bencf0706e822007-05-05 11:45:53 -07001207
1208 local->reg_state = IEEE80211_DEV_REGISTERED;
1209 rtnl_unlock();
1210
1211 ieee80211_led_init(local);
1212
1213 return 0;
1214
1215fail_wep:
1216 rate_control_deinitialize(local);
1217fail_rate:
Jiri Bence9f207f2007-05-05 11:46:38 -07001218 ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev));
Jiri Bencf0706e822007-05-05 11:45:53 -07001219 unregister_netdevice(local->mdev);
1220fail_dev:
1221 rtnl_unlock();
1222 sta_info_stop(local);
1223fail_sta_info:
Jiri Bence9f207f2007-05-05 11:46:38 -07001224 debugfs_hw_del(local);
Jiri Bencf0706e822007-05-05 11:45:53 -07001225 destroy_workqueue(local->hw.workqueue);
1226fail_workqueue:
1227 wiphy_unregister(local->hw.wiphy);
1228 return result;
1229}
1230EXPORT_SYMBOL(ieee80211_register_hw);
1231
1232int ieee80211_register_hwmode(struct ieee80211_hw *hw,
1233 struct ieee80211_hw_mode *mode)
1234{
1235 struct ieee80211_local *local = hw_to_local(hw);
1236 struct ieee80211_rate *rate;
1237 int i;
1238
1239 INIT_LIST_HEAD(&mode->list);
1240 list_add_tail(&mode->list, &local->modes_list);
1241
1242 local->hw_modes |= (1 << mode->mode);
1243 for (i = 0; i < mode->num_rates; i++) {
1244 rate = &(mode->rates[i]);
1245 rate->rate_inv = CHAN_UTIL_RATE_LCM / rate->rate;
1246 }
1247 ieee80211_prepare_rates(local, mode);
1248
1249 if (!local->oper_hw_mode) {
1250 /* Default to this mode */
1251 local->hw.conf.phymode = mode->mode;
1252 local->oper_hw_mode = local->scan_hw_mode = mode;
1253 local->oper_channel = local->scan_channel = &mode->channels[0];
1254 local->hw.conf.mode = local->oper_hw_mode;
1255 local->hw.conf.chan = local->oper_channel;
1256 }
1257
1258 if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED))
Daniel Drakefd8bacc2007-06-09 19:07:14 +01001259 ieee80211_set_default_regdomain(mode);
Jiri Bencf0706e822007-05-05 11:45:53 -07001260
1261 return 0;
1262}
1263EXPORT_SYMBOL(ieee80211_register_hwmode);
1264
1265void ieee80211_unregister_hw(struct ieee80211_hw *hw)
1266{
1267 struct ieee80211_local *local = hw_to_local(hw);
1268 struct ieee80211_sub_if_data *sdata, *tmp;
Jiri Bencf0706e822007-05-05 11:45:53 -07001269 int i;
1270
1271 tasklet_kill(&local->tx_pending_tasklet);
1272 tasklet_kill(&local->tasklet);
1273
1274 rtnl_lock();
1275
1276 BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED);
1277
1278 local->reg_state = IEEE80211_DEV_UNREGISTERED;
Jiri Bencf0706e822007-05-05 11:45:53 -07001279
Johannes Berg79010422007-09-18 17:29:21 -04001280 /*
1281 * At this point, interface list manipulations are fine
1282 * because the driver cannot be handing us frames any
1283 * more and the tasklet is killed.
1284 */
Johannes Berg5b2812e2007-09-26 14:27:23 +02001285
1286 /*
1287 * First, we remove all non-master interfaces. Do this because they
1288 * may have bss pointer dependency on the master, and when we free
1289 * the master these would be freed as well, breaking our list
1290 * iteration completely.
1291 */
1292 list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) {
1293 if (sdata->dev == local->mdev)
1294 continue;
1295 list_del(&sdata->list);
Jiri Bencf0706e822007-05-05 11:45:53 -07001296 __ieee80211_if_del(local, sdata);
Johannes Berg5b2812e2007-09-26 14:27:23 +02001297 }
1298
1299 /* then, finally, remove the master interface */
1300 __ieee80211_if_del(local, IEEE80211_DEV_TO_SUB_IF(local->mdev));
Jiri Bencf0706e822007-05-05 11:45:53 -07001301
1302 rtnl_unlock();
1303
Jiri Bencf0706e822007-05-05 11:45:53 -07001304 ieee80211_rx_bss_list_deinit(local->mdev);
1305 ieee80211_clear_tx_pending(local);
1306 sta_info_stop(local);
1307 rate_control_deinitialize(local);
Jiri Bence9f207f2007-05-05 11:46:38 -07001308 debugfs_hw_del(local);
Jiri Bencf0706e822007-05-05 11:45:53 -07001309
1310 for (i = 0; i < NUM_IEEE80211_MODES; i++) {
1311 kfree(local->supp_rates[i]);
1312 kfree(local->basic_rates[i]);
1313 }
1314
1315 if (skb_queue_len(&local->skb_queue)
1316 || skb_queue_len(&local->skb_queue_unreliable))
1317 printk(KERN_WARNING "%s: skb_queue not empty\n",
Johannes Bergdd1cd4c2007-09-18 17:29:20 -04001318 wiphy_name(local->hw.wiphy));
Jiri Bencf0706e822007-05-05 11:45:53 -07001319 skb_queue_purge(&local->skb_queue);
1320 skb_queue_purge(&local->skb_queue_unreliable);
1321
1322 destroy_workqueue(local->hw.workqueue);
1323 wiphy_unregister(local->hw.wiphy);
1324 ieee80211_wep_free(local);
1325 ieee80211_led_exit(local);
1326}
1327EXPORT_SYMBOL(ieee80211_unregister_hw);
1328
1329void ieee80211_free_hw(struct ieee80211_hw *hw)
1330{
1331 struct ieee80211_local *local = hw_to_local(hw);
1332
1333 ieee80211_if_free(local->mdev);
1334 wiphy_free(local->hw.wiphy);
1335}
1336EXPORT_SYMBOL(ieee80211_free_hw);
1337
Jiri Bencf0706e822007-05-05 11:45:53 -07001338static int __init ieee80211_init(void)
1339{
1340 struct sk_buff *skb;
1341 int ret;
1342
1343 BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb));
1344
Johannes Berg4b475892008-01-02 15:17:03 +01001345 ret = rc80211_simple_init();
Johannes Bergac71c692007-10-28 14:17:44 +01001346 if (ret)
Mattias Nisslerad018372007-12-19 01:25:57 +01001347 goto fail;
Mattias Nisslerad018372007-12-19 01:25:57 +01001348
Johannes Berg4b475892008-01-02 15:17:03 +01001349 ret = rc80211_pid_init();
Mattias Nisslerad018372007-12-19 01:25:57 +01001350 if (ret)
Johannes Berg4b475892008-01-02 15:17:03 +01001351 goto fail_simple;
Johannes Bergac71c692007-10-28 14:17:44 +01001352
Jiri Bencf0706e822007-05-05 11:45:53 -07001353 ret = ieee80211_wme_register();
1354 if (ret) {
1355 printk(KERN_DEBUG "ieee80211_init: failed to "
1356 "initialize WME (err=%d)\n", ret);
Johannes Berg4b475892008-01-02 15:17:03 +01001357 goto fail_pid;
Jiri Bencf0706e822007-05-05 11:45:53 -07001358 }
1359
Jiri Bence9f207f2007-05-05 11:46:38 -07001360 ieee80211_debugfs_netdev_init();
Daniel Drakefd8bacc2007-06-09 19:07:14 +01001361 ieee80211_regdomain_init();
Jiri Bence9f207f2007-05-05 11:46:38 -07001362
Jiri Bencf0706e822007-05-05 11:45:53 -07001363 return 0;
Mattias Nisslerad018372007-12-19 01:25:57 +01001364
Johannes Berg4b475892008-01-02 15:17:03 +01001365 fail_pid:
1366 rc80211_simple_exit();
1367 fail_simple:
1368 rc80211_pid_exit();
1369 fail:
Mattias Nisslerad018372007-12-19 01:25:57 +01001370 return ret;
Jiri Bencf0706e822007-05-05 11:45:53 -07001371}
1372
Jiri Bencf0706e822007-05-05 11:45:53 -07001373static void __exit ieee80211_exit(void)
1374{
Johannes Berg4b475892008-01-02 15:17:03 +01001375 rc80211_simple_exit();
1376 rc80211_pid_exit();
Johannes Bergac71c692007-10-28 14:17:44 +01001377
Jiri Bencf0706e822007-05-05 11:45:53 -07001378 ieee80211_wme_unregister();
Jiri Bence9f207f2007-05-05 11:46:38 -07001379 ieee80211_debugfs_netdev_exit();
Jiri Bencf0706e822007-05-05 11:45:53 -07001380}
1381
1382
Johannes Bergca9938fe2007-09-11 12:50:32 +02001383subsys_initcall(ieee80211_init);
Jiri Bencf0706e822007-05-05 11:45:53 -07001384module_exit(ieee80211_exit);
1385
1386MODULE_DESCRIPTION("IEEE 802.11 subsystem");
1387MODULE_LICENSE("GPL");