Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 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> |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 23 | #include <linux/bitmap.h> |
Eric W. Biederman | 881d966 | 2007-09-17 11:56:21 -0700 | [diff] [blame] | 24 | #include <net/net_namespace.h> |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 25 | #include <net/cfg80211.h> |
| 26 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 27 | #include "ieee80211_i.h" |
| 28 | #include "ieee80211_rate.h" |
| 29 | #include "wep.h" |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 30 | #include "wme.h" |
| 31 | #include "aes_ccm.h" |
| 32 | #include "ieee80211_led.h" |
Michael Wu | e0eb685 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 33 | #include "cfg.h" |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 34 | #include "debugfs.h" |
| 35 | #include "debugfs_netdev.h" |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 36 | |
Ron Rindjunsky | d3c990f | 2007-11-26 16:14:34 +0200 | [diff] [blame] | 37 | #define SUPP_MCS_SET_LEN 16 |
| 38 | |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 39 | /* |
| 40 | * For seeing transmitted packets on monitor interfaces |
| 41 | * we have a radiotap header too. |
| 42 | */ |
| 43 | struct ieee80211_tx_status_rtap_hdr { |
| 44 | struct ieee80211_radiotap_header hdr; |
| 45 | __le16 tx_flags; |
| 46 | u8 data_retries; |
| 47 | } __attribute__ ((packed)); |
| 48 | |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 49 | /* common interface routines */ |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 50 | |
Stephen Hemminger | b95cce3 | 2007-09-26 22:13:38 -0700 | [diff] [blame] | 51 | static int header_parse_80211(const struct sk_buff *skb, unsigned char *haddr) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 52 | { |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 53 | memcpy(haddr, skb_mac_header(skb) + 10, ETH_ALEN); /* addr2 */ |
| 54 | return ETH_ALEN; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 55 | } |
| 56 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 57 | /* must be called under mdev tx lock */ |
| 58 | static void ieee80211_configure_filter(struct ieee80211_local *local) |
| 59 | { |
| 60 | unsigned int changed_flags; |
| 61 | unsigned int new_flags = 0; |
| 62 | |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 63 | if (atomic_read(&local->iff_promiscs)) |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 64 | new_flags |= FIF_PROMISC_IN_BSS; |
| 65 | |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 66 | if (atomic_read(&local->iff_allmultis)) |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 67 | 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 Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 89 | /* master interface */ |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 90 | |
| 91 | static 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 Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 97 | /* we hold the RTNL here so can safely walk the list */ |
| 98 | list_for_each_entry(sdata, &local->interfaces, list) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 99 | if (sdata->dev != dev && netif_running(sdata->dev)) { |
| 100 | res = 0; |
| 101 | break; |
| 102 | } |
| 103 | } |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 104 | return res; |
| 105 | } |
| 106 | |
| 107 | static 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 Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 112 | /* we hold the RTNL here so can safely walk the list */ |
| 113 | list_for_each_entry(sdata, &local->interfaces, list) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 114 | if (sdata->dev != dev && netif_running(sdata->dev)) |
| 115 | dev_close(sdata->dev); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 116 | |
| 117 | return 0; |
| 118 | } |
| 119 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 120 | static 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 Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 127 | /* regular interfaces */ |
| 128 | |
| 129 | static 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 | |
| 146 | static 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 Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 162 | static 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 Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 170 | |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 171 | /* we hold the RTNL here so can safely walk the list */ |
| 172 | list_for_each_entry(nsdata, &local->interfaces, list) { |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 173 | struct net_device *ndev = nsdata->dev; |
| 174 | |
| 175 | if (ndev != dev && ndev != local->mdev && netif_running(ndev) && |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 176 | compare_ether_addr(dev->dev_addr, ndev->dev_addr) == 0) { |
| 177 | /* |
| 178 | * check whether it may have the same address |
| 179 | */ |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 180 | if (!identical_mac_addr_allowed(sdata->vif.type, |
| 181 | nsdata->vif.type)) |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 182 | return -ENOTUNIQ; |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 183 | |
| 184 | /* |
| 185 | * can only add VLANs to enabled APs |
| 186 | */ |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 187 | if (sdata->vif.type == IEEE80211_IF_TYPE_VLAN && |
| 188 | nsdata->vif.type == IEEE80211_IF_TYPE_AP && |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 189 | netif_running(nsdata->dev)) |
| 190 | sdata->u.vlan.ap = nsdata; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 191 | } |
| 192 | } |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 193 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 194 | switch (sdata->vif.type) { |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 195 | 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 Berg | fb1c1cd | 2007-09-26 15:19:43 +0200 | [diff] [blame] | 203 | case IEEE80211_IF_TYPE_AP: |
Johannes Berg | fb1c1cd | 2007-09-26 15:19:43 +0200 | [diff] [blame] | 204 | case IEEE80211_IF_TYPE_STA: |
| 205 | case IEEE80211_IF_TYPE_MNTR: |
| 206 | case IEEE80211_IF_TYPE_IBSS: |
| 207 | /* no special treatment */ |
| 208 | break; |
Johannes Berg | a289755 | 2007-09-28 14:01:25 +0200 | [diff] [blame] | 209 | case IEEE80211_IF_TYPE_INVALID: |
| 210 | /* cannot happen */ |
| 211 | WARN_ON(1); |
| 212 | break; |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 213 | } |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 214 | |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 215 | if (local->open_count == 0) { |
| 216 | res = 0; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 217 | if (local->ops->start) |
| 218 | res = local->ops->start(local_to_hw(local)); |
| 219 | if (res) |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 220 | return res; |
Michael Wu | 8b393f1 | 2007-11-28 01:57:08 -0500 | [diff] [blame] | 221 | ieee80211_hw_config(local); |
Ivo van Doorn | cdcb006 | 2008-01-07 19:45:24 +0100 | [diff] [blame] | 222 | ieee80211_led_radio(local, local->hw.conf.radio_enabled); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 223 | } |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 224 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 225 | switch (sdata->vif.type) { |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 226 | 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 Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 230 | case IEEE80211_IF_TYPE_MNTR: |
| 231 | /* must be before the call to ieee80211_configure_filter */ |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 232 | local->monitors++; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 233 | 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 Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 239 | } |
| 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 Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 246 | conf.vif = &sdata->vif; |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 247 | conf.type = sdata->vif.type; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 248 | 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 Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 255 | ieee80211_if_config(dev); |
Daniel Drake | d9430a3 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 256 | ieee80211_reset_erp_info(dev); |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 257 | ieee80211_enable_keys(sdata); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 258 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 259 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA && |
Johannes Berg | ddd3d2b | 2007-09-26 17:53:20 +0200 | [diff] [blame] | 260 | !(sdata->flags & IEEE80211_SDATA_USERSPACE_MLME)) |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 261 | netif_carrier_off(dev); |
| 262 | else |
| 263 | netif_carrier_on(dev); |
Daniel Drake | d9430a3 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 264 | } |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 265 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 266 | if (local->open_count == 0) { |
| 267 | res = dev_open(local->mdev); |
| 268 | WARN_ON(res); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 269 | tasklet_enable(&local->tx_pending_tasklet); |
| 270 | tasklet_enable(&local->tasklet); |
| 271 | } |
| 272 | |
Johannes Berg | c1428b3 | 2007-11-16 02:54:53 +0100 | [diff] [blame] | 273 | /* |
| 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 Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 284 | local->open_count++; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 285 | |
| 286 | netif_start_queue(dev); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 287 | |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 288 | return 0; |
| 289 | } |
| 290 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 291 | static int ieee80211_stop(struct net_device *dev) |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 292 | { |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 293 | struct ieee80211_sub_if_data *sdata; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 294 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 295 | struct ieee80211_if_init_conf conf; |
Ron Rindjunsky | 07db218 | 2007-12-25 17:00:33 +0200 | [diff] [blame] | 296 | struct sta_info *sta; |
| 297 | int i; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 298 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 299 | sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 300 | |
Ron Rindjunsky | 07db218 | 2007-12-25 17:00:33 +0200 | [diff] [blame] | 301 | list_for_each_entry(sta, &local->sta_list, list) { |
| 302 | for (i = 0; i < STA_TID_NUM; i++) |
| 303 | ieee80211_sta_stop_rx_ba_session(sta->dev, sta->addr, |
| 304 | i, WLAN_BACK_RECIPIENT, |
| 305 | WLAN_REASON_QSTA_LEAVE_QBSS); |
| 306 | } |
| 307 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 308 | netif_stop_queue(dev); |
| 309 | |
Johannes Berg | c1428b3 | 2007-11-16 02:54:53 +0100 | [diff] [blame] | 310 | /* |
| 311 | * Don't count this interface for promisc/allmulti while it |
| 312 | * is down. dev_mc_unsync() will invoke set_multicast_list |
| 313 | * on the master interface which will sync these down to the |
| 314 | * hardware as filter flags. |
| 315 | */ |
| 316 | if (sdata->flags & IEEE80211_SDATA_ALLMULTI) |
| 317 | atomic_dec(&local->iff_allmultis); |
| 318 | |
| 319 | if (sdata->flags & IEEE80211_SDATA_PROMISC) |
| 320 | atomic_dec(&local->iff_promiscs); |
| 321 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 322 | dev_mc_unsync(local->mdev, dev); |
| 323 | |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 324 | /* down all dependent devices, that is VLANs */ |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 325 | if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 326 | struct ieee80211_sub_if_data *vlan, *tmp; |
| 327 | |
| 328 | list_for_each_entry_safe(vlan, tmp, &sdata->u.ap.vlans, |
| 329 | u.vlan.list) |
| 330 | dev_close(vlan->dev); |
| 331 | WARN_ON(!list_empty(&sdata->u.ap.vlans)); |
| 332 | } |
| 333 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 334 | local->open_count--; |
| 335 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 336 | switch (sdata->vif.type) { |
Johannes Berg | 0ec3ca4 | 2007-09-17 01:29:24 -0400 | [diff] [blame] | 337 | case IEEE80211_IF_TYPE_VLAN: |
| 338 | list_del(&sdata->u.vlan.list); |
| 339 | sdata->u.vlan.ap = NULL; |
| 340 | /* no need to tell driver */ |
| 341 | break; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 342 | case IEEE80211_IF_TYPE_MNTR: |
| 343 | local->monitors--; |
| 344 | if (local->monitors == 0) { |
| 345 | netif_tx_lock_bh(local->mdev); |
| 346 | ieee80211_configure_filter(local); |
| 347 | netif_tx_unlock_bh(local->mdev); |
| 348 | |
Michael Wu | 8b393f1 | 2007-11-28 01:57:08 -0500 | [diff] [blame] | 349 | local->hw.conf.flags &= ~IEEE80211_CONF_RADIOTAP; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 350 | } |
| 351 | break; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 352 | case IEEE80211_IF_TYPE_STA: |
| 353 | case IEEE80211_IF_TYPE_IBSS: |
| 354 | sdata->u.sta.state = IEEE80211_DISABLED; |
| 355 | del_timer_sync(&sdata->u.sta.timer); |
Johannes Berg | 2a8a9a8 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 356 | /* |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 357 | * When we get here, the interface is marked down. |
| 358 | * Call synchronize_rcu() to wait for the RX path |
| 359 | * should it be using the interface and enqueuing |
| 360 | * frames at this very time on another CPU. |
Johannes Berg | 2a8a9a8 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 361 | */ |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 362 | synchronize_rcu(); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 363 | skb_queue_purge(&sdata->u.sta.skb_queue); |
Johannes Berg | 2a8a9a8 | 2007-08-28 17:01:52 -0400 | [diff] [blame] | 364 | |
Zhu Yi | ece8edd | 2007-11-22 10:53:21 +0800 | [diff] [blame] | 365 | if (local->scan_dev == sdata->dev) { |
| 366 | if (!local->ops->hw_scan) { |
| 367 | local->sta_sw_scanning = 0; |
| 368 | cancel_delayed_work(&local->scan_work); |
| 369 | } else |
| 370 | local->sta_hw_scanning = 0; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 371 | } |
Zhu Yi | ece8edd | 2007-11-22 10:53:21 +0800 | [diff] [blame] | 372 | |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 373 | flush_workqueue(local->hw.workqueue); |
Zhu Yi | a10605e | 2007-11-22 11:10:22 +0800 | [diff] [blame] | 374 | |
| 375 | sdata->u.sta.flags &= ~IEEE80211_STA_PRIVACY_INVOKED; |
| 376 | kfree(sdata->u.sta.extra_ie); |
| 377 | sdata->u.sta.extra_ie = NULL; |
| 378 | sdata->u.sta.extra_ie_len = 0; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 379 | /* fall through */ |
| 380 | default: |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 381 | conf.vif = &sdata->vif; |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 382 | conf.type = sdata->vif.type; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 383 | conf.mac_addr = dev->dev_addr; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 384 | /* disable all keys for as long as this netdev is down */ |
| 385 | ieee80211_disable_keys(sdata); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 386 | local->ops->remove_interface(local_to_hw(local), &conf); |
| 387 | } |
| 388 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 389 | if (local->open_count == 0) { |
| 390 | if (netif_running(local->mdev)) |
| 391 | dev_close(local->mdev); |
| 392 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 393 | if (local->ops->stop) |
| 394 | local->ops->stop(local_to_hw(local)); |
| 395 | |
Ivo van Doorn | cdcb006 | 2008-01-07 19:45:24 +0100 | [diff] [blame] | 396 | ieee80211_led_radio(local, 0); |
| 397 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 398 | tasklet_disable(&local->tx_pending_tasklet); |
| 399 | tasklet_disable(&local->tasklet); |
| 400 | } |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 401 | |
| 402 | return 0; |
| 403 | } |
| 404 | |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 405 | static void ieee80211_set_multicast_list(struct net_device *dev) |
| 406 | { |
| 407 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 408 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 409 | int allmulti, promisc, sdata_allmulti, sdata_promisc; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 410 | |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 411 | allmulti = !!(dev->flags & IFF_ALLMULTI); |
| 412 | promisc = !!(dev->flags & IFF_PROMISC); |
Johannes Berg | b52f219 | 2007-11-16 01:49:11 +0100 | [diff] [blame] | 413 | sdata_allmulti = !!(sdata->flags & IEEE80211_SDATA_ALLMULTI); |
| 414 | sdata_promisc = !!(sdata->flags & IEEE80211_SDATA_PROMISC); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 415 | |
| 416 | if (allmulti != sdata_allmulti) { |
| 417 | if (dev->flags & IFF_ALLMULTI) |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 418 | atomic_inc(&local->iff_allmultis); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 419 | else |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 420 | atomic_dec(&local->iff_allmultis); |
Jiri Slaby | 13262ff | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 421 | sdata->flags ^= IEEE80211_SDATA_ALLMULTI; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 422 | } |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 423 | |
| 424 | if (promisc != sdata_promisc) { |
| 425 | if (dev->flags & IFF_PROMISC) |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 426 | atomic_inc(&local->iff_promiscs); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 427 | else |
Johannes Berg | 5391899 | 2007-09-26 15:19:47 +0200 | [diff] [blame] | 428 | atomic_dec(&local->iff_promiscs); |
Jiri Slaby | 13262ff | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 429 | sdata->flags ^= IEEE80211_SDATA_PROMISC; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 430 | } |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 431 | |
| 432 | dev_mc_sync(local->mdev, dev); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 433 | } |
| 434 | |
Stephen Hemminger | 3b04ddd | 2007-10-09 01:40:57 -0700 | [diff] [blame] | 435 | static const struct header_ops ieee80211_header_ops = { |
| 436 | .create = eth_header, |
| 437 | .parse = header_parse_80211, |
| 438 | .rebuild = eth_rebuild_header, |
| 439 | .cache = eth_header_cache, |
| 440 | .cache_update = eth_header_cache_update, |
| 441 | }; |
| 442 | |
Johannes Berg | f9d540e | 2007-09-28 14:02:09 +0200 | [diff] [blame] | 443 | /* Must not be called for mdev */ |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 444 | void ieee80211_if_setup(struct net_device *dev) |
| 445 | { |
| 446 | ether_setup(dev); |
| 447 | dev->hard_start_xmit = ieee80211_subif_start_xmit; |
| 448 | dev->wireless_handlers = &ieee80211_iw_handler_def; |
| 449 | dev->set_multicast_list = ieee80211_set_multicast_list; |
| 450 | dev->change_mtu = ieee80211_change_mtu; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 451 | dev->open = ieee80211_open; |
| 452 | dev->stop = ieee80211_stop; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 453 | dev->destructor = ieee80211_if_free; |
| 454 | } |
| 455 | |
| 456 | /* WDS specialties */ |
| 457 | |
| 458 | int ieee80211_if_update_wds(struct net_device *dev, u8 *remote_addr) |
| 459 | { |
| 460 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 461 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 462 | struct sta_info *sta; |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 463 | DECLARE_MAC_BUF(mac); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 464 | |
| 465 | if (compare_ether_addr(remote_addr, sdata->u.wds.remote_addr) == 0) |
| 466 | return 0; |
| 467 | |
| 468 | /* Create STA entry for the new peer */ |
| 469 | sta = sta_info_add(local, dev, remote_addr, GFP_KERNEL); |
| 470 | if (!sta) |
| 471 | return -ENOMEM; |
| 472 | sta_info_put(sta); |
| 473 | |
| 474 | /* Remove STA entry for the old peer */ |
| 475 | sta = sta_info_get(local, sdata->u.wds.remote_addr); |
| 476 | if (sta) { |
Michael Wu | be8755e | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 477 | sta_info_free(sta); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 478 | sta_info_put(sta); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 479 | } else { |
| 480 | printk(KERN_DEBUG "%s: could not find STA entry for WDS link " |
Joe Perches | 0795af5 | 2007-10-03 17:59:30 -0700 | [diff] [blame] | 481 | "peer %s\n", |
| 482 | dev->name, print_mac(mac, sdata->u.wds.remote_addr)); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 483 | } |
| 484 | |
| 485 | /* Update WDS link data */ |
| 486 | memcpy(&sdata->u.wds.remote_addr, remote_addr, ETH_ALEN); |
| 487 | |
| 488 | return 0; |
| 489 | } |
| 490 | |
| 491 | /* everything else */ |
| 492 | |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 493 | static int __ieee80211_if_config(struct net_device *dev, |
| 494 | struct sk_buff *beacon, |
| 495 | struct ieee80211_tx_control *control) |
| 496 | { |
| 497 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 498 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 499 | struct ieee80211_if_conf conf; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 500 | |
| 501 | if (!local->ops->config_interface || !netif_running(dev)) |
| 502 | return 0; |
| 503 | |
| 504 | memset(&conf, 0, sizeof(conf)); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 505 | conf.type = sdata->vif.type; |
| 506 | if (sdata->vif.type == IEEE80211_IF_TYPE_STA || |
| 507 | sdata->vif.type == IEEE80211_IF_TYPE_IBSS) { |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 508 | conf.bssid = sdata->u.sta.bssid; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 509 | conf.ssid = sdata->u.sta.ssid; |
| 510 | conf.ssid_len = sdata->u.sta.ssid_len; |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 511 | } else if (sdata->vif.type == IEEE80211_IF_TYPE_AP) { |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 512 | conf.ssid = sdata->u.ap.ssid; |
| 513 | conf.ssid_len = sdata->u.ap.ssid_len; |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 514 | conf.beacon = beacon; |
| 515 | conf.beacon_control = control; |
| 516 | } |
| 517 | return local->ops->config_interface(local_to_hw(local), |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 518 | &sdata->vif, &conf); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 519 | } |
| 520 | |
| 521 | int ieee80211_if_config(struct net_device *dev) |
| 522 | { |
| 523 | return __ieee80211_if_config(dev, NULL, NULL); |
| 524 | } |
| 525 | |
| 526 | int ieee80211_if_config_beacon(struct net_device *dev) |
| 527 | { |
| 528 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 529 | struct ieee80211_tx_control control; |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 530 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 531 | struct sk_buff *skb; |
| 532 | |
| 533 | if (!(local->hw.flags & IEEE80211_HW_HOST_GEN_BEACON_TEMPLATE)) |
| 534 | return 0; |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 535 | skb = ieee80211_beacon_get(local_to_hw(local), &sdata->vif, |
| 536 | &control); |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 537 | if (!skb) |
| 538 | return -ENOMEM; |
| 539 | return __ieee80211_if_config(dev, skb, &control); |
| 540 | } |
| 541 | |
| 542 | int ieee80211_hw_config(struct ieee80211_local *local) |
| 543 | { |
| 544 | struct ieee80211_hw_mode *mode; |
| 545 | struct ieee80211_channel *chan; |
| 546 | int ret = 0; |
| 547 | |
Zhu Yi | ece8edd | 2007-11-22 10:53:21 +0800 | [diff] [blame] | 548 | if (local->sta_sw_scanning) { |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 549 | chan = local->scan_channel; |
| 550 | mode = local->scan_hw_mode; |
| 551 | } else { |
| 552 | chan = local->oper_channel; |
| 553 | mode = local->oper_hw_mode; |
| 554 | } |
| 555 | |
| 556 | local->hw.conf.channel = chan->chan; |
| 557 | local->hw.conf.channel_val = chan->val; |
Michael Buesch | 61609bc | 2007-09-20 22:06:39 +0200 | [diff] [blame] | 558 | if (!local->hw.conf.power_level) { |
| 559 | local->hw.conf.power_level = chan->power_level; |
| 560 | } else { |
| 561 | local->hw.conf.power_level = min(chan->power_level, |
| 562 | local->hw.conf.power_level); |
| 563 | } |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 564 | local->hw.conf.freq = chan->freq; |
| 565 | local->hw.conf.phymode = mode->mode; |
| 566 | local->hw.conf.antenna_max = chan->antenna_max; |
| 567 | local->hw.conf.chan = chan; |
| 568 | local->hw.conf.mode = mode; |
| 569 | |
| 570 | #ifdef CONFIG_MAC80211_VERBOSE_DEBUG |
| 571 | printk(KERN_DEBUG "HW CONFIG: channel=%d freq=%d " |
| 572 | "phymode=%d\n", local->hw.conf.channel, local->hw.conf.freq, |
| 573 | local->hw.conf.phymode); |
| 574 | #endif /* CONFIG_MAC80211_VERBOSE_DEBUG */ |
| 575 | |
Michael Buesch | f7c4dae | 2007-09-24 18:41:49 +0200 | [diff] [blame] | 576 | if (local->open_count) |
Johannes Berg | b2c258f | 2007-07-27 15:43:23 +0200 | [diff] [blame] | 577 | ret = local->ops->config(local_to_hw(local), &local->hw.conf); |
| 578 | |
| 579 | return ret; |
| 580 | } |
| 581 | |
Ron Rindjunsky | d3c990f | 2007-11-26 16:14:34 +0200 | [diff] [blame] | 582 | /** |
| 583 | * ieee80211_hw_config_ht should be used only after legacy configuration |
| 584 | * has been determined, as ht configuration depends upon the hardware's |
| 585 | * HT abilities for a _specific_ band. |
| 586 | */ |
| 587 | int ieee80211_hw_config_ht(struct ieee80211_local *local, int enable_ht, |
| 588 | struct ieee80211_ht_info *req_ht_cap, |
| 589 | struct ieee80211_ht_bss_info *req_bss_cap) |
| 590 | { |
| 591 | struct ieee80211_conf *conf = &local->hw.conf; |
| 592 | struct ieee80211_hw_mode *mode = conf->mode; |
| 593 | int i; |
| 594 | |
| 595 | /* HT is not supported */ |
| 596 | if (!mode->ht_info.ht_supported) { |
| 597 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; |
| 598 | return -EOPNOTSUPP; |
| 599 | } |
| 600 | |
| 601 | /* disable HT */ |
| 602 | if (!enable_ht) { |
| 603 | conf->flags &= ~IEEE80211_CONF_SUPPORT_HT_MODE; |
| 604 | } else { |
| 605 | conf->flags |= IEEE80211_CONF_SUPPORT_HT_MODE; |
| 606 | conf->ht_conf.cap = req_ht_cap->cap & mode->ht_info.cap; |
| 607 | conf->ht_conf.cap &= ~(IEEE80211_HT_CAP_MIMO_PS); |
| 608 | conf->ht_conf.cap |= |
| 609 | mode->ht_info.cap & IEEE80211_HT_CAP_MIMO_PS; |
| 610 | conf->ht_bss_conf.primary_channel = |
| 611 | req_bss_cap->primary_channel; |
| 612 | conf->ht_bss_conf.bss_cap = req_bss_cap->bss_cap; |
| 613 | conf->ht_bss_conf.bss_op_mode = req_bss_cap->bss_op_mode; |
| 614 | for (i = 0; i < SUPP_MCS_SET_LEN; i++) |
| 615 | conf->ht_conf.supp_mcs_set[i] = |
| 616 | mode->ht_info.supp_mcs_set[i] & |
| 617 | req_ht_cap->supp_mcs_set[i]; |
| 618 | |
| 619 | /* In STA mode, this gives us indication |
| 620 | * to the AP's mode of operation */ |
| 621 | conf->ht_conf.ht_supported = 1; |
| 622 | conf->ht_conf.ampdu_factor = req_ht_cap->ampdu_factor; |
| 623 | conf->ht_conf.ampdu_density = req_ht_cap->ampdu_density; |
| 624 | } |
| 625 | |
| 626 | local->ops->conf_ht(local_to_hw(local), &local->hw.conf); |
| 627 | |
| 628 | return 0; |
| 629 | } |
| 630 | |
Daniel Drake | d9430a3 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 631 | void ieee80211_erp_info_change_notify(struct net_device *dev, u8 changes) |
| 632 | { |
| 633 | struct ieee80211_local *local = wdev_priv(dev->ieee80211_ptr); |
| 634 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 635 | if (local->ops->erp_ie_changed) |
| 636 | local->ops->erp_ie_changed(local_to_hw(local), changes, |
Jiri Slaby | 13262ff | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 637 | !!(sdata->flags & IEEE80211_SDATA_USE_PROTECTION), |
| 638 | !(sdata->flags & IEEE80211_SDATA_SHORT_PREAMBLE)); |
Daniel Drake | d9430a3 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 639 | } |
| 640 | |
| 641 | void ieee80211_reset_erp_info(struct net_device *dev) |
| 642 | { |
| 643 | struct ieee80211_sub_if_data *sdata = IEEE80211_DEV_TO_SUB_IF(dev); |
| 644 | |
Jiri Slaby | 13262ff | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 645 | sdata->flags &= ~(IEEE80211_SDATA_USE_PROTECTION | |
| 646 | IEEE80211_SDATA_SHORT_PREAMBLE); |
Daniel Drake | d9430a3 | 2007-07-27 15:43:24 +0200 | [diff] [blame] | 647 | ieee80211_erp_info_change_notify(dev, |
| 648 | IEEE80211_ERP_CHANGE_PROTECTION | |
| 649 | IEEE80211_ERP_CHANGE_PREAMBLE); |
| 650 | } |
| 651 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 652 | void ieee80211_tx_status_irqsafe(struct ieee80211_hw *hw, |
| 653 | struct sk_buff *skb, |
| 654 | struct ieee80211_tx_status *status) |
| 655 | { |
| 656 | struct ieee80211_local *local = hw_to_local(hw); |
| 657 | struct ieee80211_tx_status *saved; |
| 658 | int tmp; |
| 659 | |
| 660 | skb->dev = local->mdev; |
| 661 | saved = kmalloc(sizeof(struct ieee80211_tx_status), GFP_ATOMIC); |
| 662 | if (unlikely(!saved)) { |
| 663 | if (net_ratelimit()) |
| 664 | printk(KERN_WARNING "%s: Not enough memory, " |
| 665 | "dropping tx status", skb->dev->name); |
| 666 | /* should be dev_kfree_skb_irq, but due to this function being |
| 667 | * named _irqsafe instead of just _irq we can't be sure that |
| 668 | * people won't call it from non-irq contexts */ |
| 669 | dev_kfree_skb_any(skb); |
| 670 | return; |
| 671 | } |
| 672 | memcpy(saved, status, sizeof(struct ieee80211_tx_status)); |
| 673 | /* copy pointer to saved status into skb->cb for use by tasklet */ |
| 674 | memcpy(skb->cb, &saved, sizeof(saved)); |
| 675 | |
| 676 | skb->pkt_type = IEEE80211_TX_STATUS_MSG; |
| 677 | skb_queue_tail(status->control.flags & IEEE80211_TXCTL_REQ_TX_STATUS ? |
| 678 | &local->skb_queue : &local->skb_queue_unreliable, skb); |
| 679 | tmp = skb_queue_len(&local->skb_queue) + |
| 680 | skb_queue_len(&local->skb_queue_unreliable); |
| 681 | while (tmp > IEEE80211_IRQSAFE_QUEUE_LIMIT && |
| 682 | (skb = skb_dequeue(&local->skb_queue_unreliable))) { |
| 683 | memcpy(&saved, skb->cb, sizeof(saved)); |
| 684 | kfree(saved); |
| 685 | dev_kfree_skb_irq(skb); |
| 686 | tmp--; |
| 687 | I802_DEBUG_INC(local->tx_status_drop); |
| 688 | } |
| 689 | tasklet_schedule(&local->tasklet); |
| 690 | } |
| 691 | EXPORT_SYMBOL(ieee80211_tx_status_irqsafe); |
| 692 | |
| 693 | static void ieee80211_tasklet_handler(unsigned long data) |
| 694 | { |
| 695 | struct ieee80211_local *local = (struct ieee80211_local *) data; |
| 696 | struct sk_buff *skb; |
| 697 | struct ieee80211_rx_status rx_status; |
| 698 | struct ieee80211_tx_status *tx_status; |
| 699 | |
| 700 | while ((skb = skb_dequeue(&local->skb_queue)) || |
| 701 | (skb = skb_dequeue(&local->skb_queue_unreliable))) { |
| 702 | switch (skb->pkt_type) { |
| 703 | case IEEE80211_RX_MSG: |
| 704 | /* status is in skb->cb */ |
| 705 | memcpy(&rx_status, skb->cb, sizeof(rx_status)); |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 706 | /* Clear skb->pkt_type in order to not confuse kernel |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 707 | * netstack. */ |
| 708 | skb->pkt_type = 0; |
| 709 | __ieee80211_rx(local_to_hw(local), skb, &rx_status); |
| 710 | break; |
| 711 | case IEEE80211_TX_STATUS_MSG: |
| 712 | /* get pointer to saved status out of skb->cb */ |
| 713 | memcpy(&tx_status, skb->cb, sizeof(tx_status)); |
| 714 | skb->pkt_type = 0; |
| 715 | ieee80211_tx_status(local_to_hw(local), |
| 716 | skb, tx_status); |
| 717 | kfree(tx_status); |
| 718 | break; |
| 719 | default: /* should never get here! */ |
| 720 | printk(KERN_ERR "%s: Unknown message type (%d)\n", |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 721 | wiphy_name(local->hw.wiphy), skb->pkt_type); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 722 | dev_kfree_skb(skb); |
| 723 | break; |
| 724 | } |
| 725 | } |
| 726 | } |
| 727 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 728 | /* Remove added headers (e.g., QoS control), encryption header/MIC, etc. to |
| 729 | * make a prepared TX frame (one that has been given to hw) to look like brand |
| 730 | * new IEEE 802.11 frame that is ready to go through TX processing again. |
| 731 | * Also, tx_packet_data in cb is restored from tx_control. */ |
| 732 | static void ieee80211_remove_tx_extra(struct ieee80211_local *local, |
| 733 | struct ieee80211_key *key, |
| 734 | struct sk_buff *skb, |
| 735 | struct ieee80211_tx_control *control) |
| 736 | { |
| 737 | int hdrlen, iv_len, mic_len; |
| 738 | struct ieee80211_tx_packet_data *pkt_data; |
| 739 | |
| 740 | pkt_data = (struct ieee80211_tx_packet_data *)skb->cb; |
Johannes Berg | 32bfd35 | 2007-12-19 01:31:26 +0100 | [diff] [blame] | 741 | pkt_data->ifindex = vif_to_sdata(control->vif)->dev->ifindex; |
Jiri Slaby | e8bf964 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 742 | pkt_data->flags = 0; |
| 743 | if (control->flags & IEEE80211_TXCTL_REQ_TX_STATUS) |
| 744 | pkt_data->flags |= IEEE80211_TXPD_REQ_TX_STATUS; |
| 745 | if (control->flags & IEEE80211_TXCTL_DO_NOT_ENCRYPT) |
| 746 | pkt_data->flags |= IEEE80211_TXPD_DO_NOT_ENCRYPT; |
| 747 | if (control->flags & IEEE80211_TXCTL_REQUEUE) |
| 748 | pkt_data->flags |= IEEE80211_TXPD_REQUEUE; |
Johannes Berg | 678f5f7 | 2007-12-19 01:31:23 +0100 | [diff] [blame] | 749 | if (control->flags & IEEE80211_TXCTL_EAPOL_FRAME) |
| 750 | pkt_data->flags |= IEEE80211_TXPD_EAPOL_FRAME; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 751 | pkt_data->queue = control->queue; |
| 752 | |
| 753 | hdrlen = ieee80211_get_hdrlen_from_skb(skb); |
| 754 | |
| 755 | if (!key) |
| 756 | goto no_key; |
| 757 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 758 | switch (key->conf.alg) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 759 | case ALG_WEP: |
| 760 | iv_len = WEP_IV_LEN; |
| 761 | mic_len = WEP_ICV_LEN; |
| 762 | break; |
| 763 | case ALG_TKIP: |
| 764 | iv_len = TKIP_IV_LEN; |
| 765 | mic_len = TKIP_ICV_LEN; |
| 766 | break; |
| 767 | case ALG_CCMP: |
| 768 | iv_len = CCMP_HDR_LEN; |
| 769 | mic_len = CCMP_MIC_LEN; |
| 770 | break; |
| 771 | default: |
| 772 | goto no_key; |
| 773 | } |
| 774 | |
Johannes Berg | 8f20fc2 | 2007-08-28 17:01:54 -0400 | [diff] [blame] | 775 | if (skb->len >= mic_len && |
Johannes Berg | 11a843b | 2007-08-28 17:01:55 -0400 | [diff] [blame] | 776 | !(key->flags & KEY_FLAG_UPLOADED_TO_HARDWARE)) |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 777 | skb_trim(skb, skb->len - mic_len); |
| 778 | if (skb->len >= iv_len && skb->len > hdrlen) { |
| 779 | memmove(skb->data + iv_len, skb->data, hdrlen); |
| 780 | skb_pull(skb, iv_len); |
| 781 | } |
| 782 | |
| 783 | no_key: |
| 784 | { |
| 785 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 786 | u16 fc = le16_to_cpu(hdr->frame_control); |
| 787 | if ((fc & 0x8C) == 0x88) /* QoS Control Field */ { |
| 788 | fc &= ~IEEE80211_STYPE_QOS_DATA; |
| 789 | hdr->frame_control = cpu_to_le16(fc); |
| 790 | memmove(skb->data + 2, skb->data, hdrlen - 2); |
| 791 | skb_pull(skb, 2); |
| 792 | } |
| 793 | } |
| 794 | } |
| 795 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 796 | void ieee80211_tx_status(struct ieee80211_hw *hw, struct sk_buff *skb, |
| 797 | struct ieee80211_tx_status *status) |
| 798 | { |
| 799 | struct sk_buff *skb2; |
| 800 | struct ieee80211_hdr *hdr = (struct ieee80211_hdr *) skb->data; |
| 801 | struct ieee80211_local *local = hw_to_local(hw); |
| 802 | u16 frag, type; |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 803 | struct ieee80211_tx_status_rtap_hdr *rthdr; |
| 804 | struct ieee80211_sub_if_data *sdata; |
| 805 | int monitors; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 806 | |
| 807 | if (!status) { |
| 808 | printk(KERN_ERR |
| 809 | "%s: ieee80211_tx_status called with NULL status\n", |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 810 | wiphy_name(local->hw.wiphy)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 811 | dev_kfree_skb(skb); |
| 812 | return; |
| 813 | } |
| 814 | |
| 815 | if (status->excessive_retries) { |
| 816 | struct sta_info *sta; |
| 817 | sta = sta_info_get(local, hdr->addr1); |
| 818 | if (sta) { |
| 819 | if (sta->flags & WLAN_STA_PS) { |
| 820 | /* The STA is in power save mode, so assume |
| 821 | * that this TX packet failed because of that. |
| 822 | */ |
| 823 | status->excessive_retries = 0; |
| 824 | status->flags |= IEEE80211_TX_STATUS_TX_FILTERED; |
| 825 | } |
| 826 | sta_info_put(sta); |
| 827 | } |
| 828 | } |
| 829 | |
| 830 | if (status->flags & IEEE80211_TX_STATUS_TX_FILTERED) { |
| 831 | struct sta_info *sta; |
| 832 | sta = sta_info_get(local, hdr->addr1); |
| 833 | if (sta) { |
| 834 | sta->tx_filtered_count++; |
| 835 | |
| 836 | /* Clear the TX filter mask for this STA when sending |
| 837 | * the next packet. If the STA went to power save mode, |
| 838 | * this will happen when it is waking up for the next |
| 839 | * time. */ |
| 840 | sta->clear_dst_mask = 1; |
| 841 | |
| 842 | /* TODO: Is the WLAN_STA_PS flag always set here or is |
| 843 | * the race between RX and TX status causing some |
| 844 | * packets to be filtered out before 80211.o gets an |
| 845 | * update for PS status? This seems to be the case, so |
| 846 | * no changes are likely to be needed. */ |
| 847 | if (sta->flags & WLAN_STA_PS && |
| 848 | skb_queue_len(&sta->tx_filtered) < |
| 849 | STA_MAX_TX_BUFFER) { |
| 850 | ieee80211_remove_tx_extra(local, sta->key, |
| 851 | skb, |
| 852 | &status->control); |
| 853 | skb_queue_tail(&sta->tx_filtered, skb); |
| 854 | } else if (!(sta->flags & WLAN_STA_PS) && |
| 855 | !(status->control.flags & IEEE80211_TXCTL_REQUEUE)) { |
| 856 | /* Software retry the packet once */ |
| 857 | status->control.flags |= IEEE80211_TXCTL_REQUEUE; |
| 858 | ieee80211_remove_tx_extra(local, sta->key, |
| 859 | skb, |
| 860 | &status->control); |
| 861 | dev_queue_xmit(skb); |
| 862 | } else { |
| 863 | if (net_ratelimit()) { |
| 864 | printk(KERN_DEBUG "%s: dropped TX " |
| 865 | "filtered frame queue_len=%d " |
| 866 | "PS=%d @%lu\n", |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 867 | wiphy_name(local->hw.wiphy), |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 868 | skb_queue_len( |
| 869 | &sta->tx_filtered), |
| 870 | !!(sta->flags & WLAN_STA_PS), |
| 871 | jiffies); |
| 872 | } |
| 873 | dev_kfree_skb(skb); |
| 874 | } |
| 875 | sta_info_put(sta); |
| 876 | return; |
| 877 | } |
Mattias Nissler | 1abbe49 | 2007-12-20 13:50:07 +0100 | [diff] [blame] | 878 | } else |
| 879 | rate_control_tx_status(local->mdev, skb, status); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 880 | |
| 881 | ieee80211_led_tx(local, 0); |
| 882 | |
| 883 | /* SNMP counters |
| 884 | * Fragments are passed to low-level drivers as separate skbs, so these |
| 885 | * are actually fragments, not frames. Update frame counters only for |
| 886 | * the first fragment of the frame. */ |
| 887 | |
| 888 | frag = le16_to_cpu(hdr->seq_ctrl) & IEEE80211_SCTL_FRAG; |
| 889 | type = le16_to_cpu(hdr->frame_control) & IEEE80211_FCTL_FTYPE; |
| 890 | |
| 891 | if (status->flags & IEEE80211_TX_STATUS_ACK) { |
| 892 | if (frag == 0) { |
| 893 | local->dot11TransmittedFrameCount++; |
| 894 | if (is_multicast_ether_addr(hdr->addr1)) |
| 895 | local->dot11MulticastTransmittedFrameCount++; |
| 896 | if (status->retry_count > 0) |
| 897 | local->dot11RetryCount++; |
| 898 | if (status->retry_count > 1) |
| 899 | local->dot11MultipleRetryCount++; |
| 900 | } |
| 901 | |
| 902 | /* This counter shall be incremented for an acknowledged MPDU |
| 903 | * with an individual address in the address 1 field or an MPDU |
| 904 | * with a multicast address in the address 1 field of type Data |
| 905 | * or Management. */ |
| 906 | if (!is_multicast_ether_addr(hdr->addr1) || |
| 907 | type == IEEE80211_FTYPE_DATA || |
| 908 | type == IEEE80211_FTYPE_MGMT) |
| 909 | local->dot11TransmittedFragmentCount++; |
| 910 | } else { |
| 911 | if (frag == 0) |
| 912 | local->dot11FailedCount++; |
| 913 | } |
| 914 | |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 915 | /* this was a transmitted frame, but now we want to reuse it */ |
| 916 | skb_orphan(skb); |
| 917 | |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 918 | if (!local->monitors) { |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 919 | dev_kfree_skb(skb); |
| 920 | return; |
| 921 | } |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 922 | |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 923 | /* send frame to monitor interfaces now */ |
| 924 | |
| 925 | if (skb_headroom(skb) < sizeof(*rthdr)) { |
| 926 | printk(KERN_ERR "ieee80211_tx_status: headroom too small\n"); |
| 927 | dev_kfree_skb(skb); |
| 928 | return; |
| 929 | } |
| 930 | |
| 931 | rthdr = (struct ieee80211_tx_status_rtap_hdr*) |
| 932 | skb_push(skb, sizeof(*rthdr)); |
| 933 | |
| 934 | memset(rthdr, 0, sizeof(*rthdr)); |
| 935 | rthdr->hdr.it_len = cpu_to_le16(sizeof(*rthdr)); |
| 936 | rthdr->hdr.it_present = |
| 937 | cpu_to_le32((1 << IEEE80211_RADIOTAP_TX_FLAGS) | |
| 938 | (1 << IEEE80211_RADIOTAP_DATA_RETRIES)); |
| 939 | |
| 940 | if (!(status->flags & IEEE80211_TX_STATUS_ACK) && |
| 941 | !is_multicast_ether_addr(hdr->addr1)) |
| 942 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_FAIL); |
| 943 | |
| 944 | if ((status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) && |
| 945 | (status->control.flags & IEEE80211_TXCTL_USE_CTS_PROTECT)) |
| 946 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_CTS); |
| 947 | else if (status->control.flags & IEEE80211_TXCTL_USE_RTS_CTS) |
| 948 | rthdr->tx_flags |= cpu_to_le16(IEEE80211_RADIOTAP_F_TX_RTS); |
| 949 | |
| 950 | rthdr->data_retries = status->retry_count; |
| 951 | |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 952 | rcu_read_lock(); |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 953 | monitors = local->monitors; |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 954 | list_for_each_entry_rcu(sdata, &local->interfaces, list) { |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 955 | /* |
| 956 | * Using the monitors counter is possibly racy, but |
| 957 | * if the value is wrong we simply either clone the skb |
| 958 | * once too much or forget sending it to one monitor iface |
| 959 | * The latter case isn't nice but fixing the race is much |
| 960 | * more complicated. |
| 961 | */ |
| 962 | if (!monitors || !skb) |
| 963 | goto out; |
| 964 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 965 | if (sdata->vif.type == IEEE80211_IF_TYPE_MNTR) { |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 966 | if (!netif_running(sdata->dev)) |
| 967 | continue; |
| 968 | monitors--; |
| 969 | if (monitors) |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 970 | skb2 = skb_clone(skb, GFP_ATOMIC); |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 971 | else |
| 972 | skb2 = NULL; |
| 973 | skb->dev = sdata->dev; |
| 974 | /* XXX: is this sufficient for BPF? */ |
| 975 | skb_set_mac_header(skb, 0); |
| 976 | skb->ip_summed = CHECKSUM_UNNECESSARY; |
| 977 | skb->pkt_type = PACKET_OTHERHOST; |
| 978 | skb->protocol = htons(ETH_P_802_2); |
| 979 | memset(skb->cb, 0, sizeof(skb->cb)); |
| 980 | netif_rx(skb); |
| 981 | skb = skb2; |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 982 | } |
| 983 | } |
| 984 | out: |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 985 | rcu_read_unlock(); |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 986 | if (skb) |
| 987 | dev_kfree_skb(skb); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 988 | } |
| 989 | EXPORT_SYMBOL(ieee80211_tx_status); |
| 990 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 991 | struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len, |
| 992 | const struct ieee80211_ops *ops) |
| 993 | { |
| 994 | struct net_device *mdev; |
| 995 | struct ieee80211_local *local; |
| 996 | struct ieee80211_sub_if_data *sdata; |
| 997 | int priv_size; |
| 998 | struct wiphy *wiphy; |
| 999 | |
| 1000 | /* Ensure 32-byte alignment of our private data and hw private data. |
| 1001 | * We use the wiphy priv data for both our ieee80211_local and for |
| 1002 | * the driver's private data |
| 1003 | * |
| 1004 | * In memory it'll be like this: |
| 1005 | * |
| 1006 | * +-------------------------+ |
| 1007 | * | struct wiphy | |
| 1008 | * +-------------------------+ |
| 1009 | * | struct ieee80211_local | |
| 1010 | * +-------------------------+ |
| 1011 | * | driver's private data | |
| 1012 | * +-------------------------+ |
| 1013 | * |
| 1014 | */ |
| 1015 | priv_size = ((sizeof(struct ieee80211_local) + |
| 1016 | NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST) + |
| 1017 | priv_data_len; |
| 1018 | |
| 1019 | wiphy = wiphy_new(&mac80211_config_ops, priv_size); |
| 1020 | |
| 1021 | if (!wiphy) |
| 1022 | return NULL; |
| 1023 | |
| 1024 | wiphy->privid = mac80211_wiphy_privid; |
| 1025 | |
| 1026 | local = wiphy_priv(wiphy); |
| 1027 | local->hw.wiphy = wiphy; |
| 1028 | |
| 1029 | local->hw.priv = (char *)local + |
| 1030 | ((sizeof(struct ieee80211_local) + |
| 1031 | NETDEV_ALIGN_CONST) & ~NETDEV_ALIGN_CONST); |
| 1032 | |
Johannes Berg | 4480f15c | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 1033 | BUG_ON(!ops->tx); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 1034 | BUG_ON(!ops->start); |
| 1035 | BUG_ON(!ops->stop); |
Johannes Berg | 4480f15c | 2007-07-10 19:32:10 +0200 | [diff] [blame] | 1036 | BUG_ON(!ops->config); |
| 1037 | BUG_ON(!ops->add_interface); |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 1038 | BUG_ON(!ops->remove_interface); |
| 1039 | BUG_ON(!ops->configure_filter); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1040 | local->ops = ops; |
| 1041 | |
| 1042 | /* for now, mdev needs sub_if_data :/ */ |
| 1043 | mdev = alloc_netdev(sizeof(struct ieee80211_sub_if_data), |
| 1044 | "wmaster%d", ether_setup); |
| 1045 | if (!mdev) { |
| 1046 | wiphy_free(wiphy); |
| 1047 | return NULL; |
| 1048 | } |
| 1049 | |
| 1050 | sdata = IEEE80211_DEV_TO_SUB_IF(mdev); |
| 1051 | mdev->ieee80211_ptr = &sdata->wdev; |
| 1052 | sdata->wdev.wiphy = wiphy; |
| 1053 | |
| 1054 | local->hw.queues = 1; /* default */ |
| 1055 | |
| 1056 | local->mdev = mdev; |
| 1057 | local->rx_pre_handlers = ieee80211_rx_pre_handlers; |
| 1058 | local->rx_handlers = ieee80211_rx_handlers; |
| 1059 | local->tx_handlers = ieee80211_tx_handlers; |
| 1060 | |
| 1061 | local->bridge_packets = 1; |
| 1062 | |
| 1063 | local->rts_threshold = IEEE80211_MAX_RTS_THRESHOLD; |
| 1064 | local->fragmentation_threshold = IEEE80211_MAX_FRAG_THRESHOLD; |
| 1065 | local->short_retry_limit = 7; |
| 1066 | local->long_retry_limit = 4; |
| 1067 | local->hw.conf.radio_enabled = 1; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1068 | |
Johannes Berg | b708e61 | 2007-09-14 11:10:25 -0400 | [diff] [blame] | 1069 | local->enabled_modes = ~0; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1070 | |
| 1071 | INIT_LIST_HEAD(&local->modes_list); |
| 1072 | |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 1073 | INIT_LIST_HEAD(&local->interfaces); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1074 | |
| 1075 | INIT_DELAYED_WORK(&local->scan_work, ieee80211_sta_scan_work); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1076 | ieee80211_rx_bss_list_init(mdev); |
| 1077 | |
| 1078 | sta_info_init(local); |
| 1079 | |
| 1080 | mdev->hard_start_xmit = ieee80211_master_start_xmit; |
| 1081 | mdev->open = ieee80211_master_open; |
| 1082 | mdev->stop = ieee80211_master_stop; |
| 1083 | mdev->type = ARPHRD_IEEE80211; |
Stephen Hemminger | 3b04ddd | 2007-10-09 01:40:57 -0700 | [diff] [blame] | 1084 | mdev->header_ops = &ieee80211_header_ops; |
Johannes Berg | 4150c57 | 2007-09-17 01:29:23 -0400 | [diff] [blame] | 1085 | mdev->set_multicast_list = ieee80211_master_set_multicast_list; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1086 | |
Johannes Berg | 51fb61e | 2007-12-19 01:31:27 +0100 | [diff] [blame^] | 1087 | sdata->vif.type = IEEE80211_IF_TYPE_AP; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1088 | sdata->dev = mdev; |
| 1089 | sdata->local = local; |
| 1090 | sdata->u.ap.force_unicast_rateidx = -1; |
| 1091 | sdata->u.ap.max_ratectrl_rateidx = -1; |
| 1092 | ieee80211_if_sdata_init(sdata); |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 1093 | /* no RCU needed since we're still during init phase */ |
| 1094 | list_add_tail(&sdata->list, &local->interfaces); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1095 | |
| 1096 | tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending, |
| 1097 | (unsigned long)local); |
| 1098 | tasklet_disable(&local->tx_pending_tasklet); |
| 1099 | |
| 1100 | tasklet_init(&local->tasklet, |
| 1101 | ieee80211_tasklet_handler, |
| 1102 | (unsigned long) local); |
| 1103 | tasklet_disable(&local->tasklet); |
| 1104 | |
| 1105 | skb_queue_head_init(&local->skb_queue); |
| 1106 | skb_queue_head_init(&local->skb_queue_unreliable); |
| 1107 | |
| 1108 | return local_to_hw(local); |
| 1109 | } |
| 1110 | EXPORT_SYMBOL(ieee80211_alloc_hw); |
| 1111 | |
| 1112 | int ieee80211_register_hw(struct ieee80211_hw *hw) |
| 1113 | { |
| 1114 | struct ieee80211_local *local = hw_to_local(hw); |
| 1115 | const char *name; |
| 1116 | int result; |
| 1117 | |
| 1118 | result = wiphy_register(local->hw.wiphy); |
| 1119 | if (result < 0) |
| 1120 | return result; |
| 1121 | |
| 1122 | name = wiphy_dev(local->hw.wiphy)->driver->name; |
| 1123 | local->hw.workqueue = create_singlethread_workqueue(name); |
| 1124 | if (!local->hw.workqueue) { |
| 1125 | result = -ENOMEM; |
| 1126 | goto fail_workqueue; |
| 1127 | } |
| 1128 | |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 1129 | /* |
| 1130 | * The hardware needs headroom for sending the frame, |
| 1131 | * and we need some headroom for passing the frame to monitor |
| 1132 | * interfaces, but never both at the same time. |
| 1133 | */ |
Jiri Benc | 33ccad3 | 2007-07-18 17:10:44 +0200 | [diff] [blame] | 1134 | local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom, |
| 1135 | sizeof(struct ieee80211_tx_status_rtap_hdr)); |
Johannes Berg | b306f45 | 2007-07-10 19:32:08 +0200 | [diff] [blame] | 1136 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1137 | debugfs_hw_add(local); |
| 1138 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1139 | local->hw.conf.beacon_int = 1000; |
| 1140 | |
| 1141 | local->wstats_flags |= local->hw.max_rssi ? |
| 1142 | IW_QUAL_LEVEL_UPDATED : IW_QUAL_LEVEL_INVALID; |
| 1143 | local->wstats_flags |= local->hw.max_signal ? |
| 1144 | IW_QUAL_QUAL_UPDATED : IW_QUAL_QUAL_INVALID; |
| 1145 | local->wstats_flags |= local->hw.max_noise ? |
| 1146 | IW_QUAL_NOISE_UPDATED : IW_QUAL_NOISE_INVALID; |
| 1147 | if (local->hw.max_rssi < 0 || local->hw.max_noise < 0) |
| 1148 | local->wstats_flags |= IW_QUAL_DBM; |
| 1149 | |
| 1150 | result = sta_info_start(local); |
| 1151 | if (result < 0) |
| 1152 | goto fail_sta_info; |
| 1153 | |
| 1154 | rtnl_lock(); |
| 1155 | result = dev_alloc_name(local->mdev, local->mdev->name); |
| 1156 | if (result < 0) |
| 1157 | goto fail_dev; |
| 1158 | |
| 1159 | memcpy(local->mdev->dev_addr, local->hw.wiphy->perm_addr, ETH_ALEN); |
| 1160 | SET_NETDEV_DEV(local->mdev, wiphy_dev(local->hw.wiphy)); |
| 1161 | |
| 1162 | result = register_netdevice(local->mdev); |
| 1163 | if (result < 0) |
| 1164 | goto fail_dev; |
| 1165 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1166 | ieee80211_debugfs_add_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
Johannes Berg | 5b2812e | 2007-09-26 14:27:23 +0200 | [diff] [blame] | 1167 | ieee80211_if_set_type(local->mdev, IEEE80211_IF_TYPE_AP); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1168 | |
Johannes Berg | 830f903 | 2007-10-28 14:51:05 +0100 | [diff] [blame] | 1169 | result = ieee80211_init_rate_ctrl_alg(local, |
| 1170 | hw->rate_control_algorithm); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1171 | if (result < 0) { |
| 1172 | printk(KERN_DEBUG "%s: Failed to initialize rate control " |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 1173 | "algorithm\n", wiphy_name(local->hw.wiphy)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1174 | goto fail_rate; |
| 1175 | } |
| 1176 | |
| 1177 | result = ieee80211_wep_init(local); |
| 1178 | |
| 1179 | if (result < 0) { |
| 1180 | printk(KERN_DEBUG "%s: Failed to initialize wep\n", |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 1181 | wiphy_name(local->hw.wiphy)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1182 | goto fail_wep; |
| 1183 | } |
| 1184 | |
| 1185 | ieee80211_install_qdisc(local->mdev); |
| 1186 | |
| 1187 | /* add one default STA interface */ |
| 1188 | result = ieee80211_if_add(local->mdev, "wlan%d", NULL, |
| 1189 | IEEE80211_IF_TYPE_STA); |
| 1190 | if (result) |
| 1191 | printk(KERN_WARNING "%s: Failed to add default virtual iface\n", |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 1192 | wiphy_name(local->hw.wiphy)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1193 | |
| 1194 | local->reg_state = IEEE80211_DEV_REGISTERED; |
| 1195 | rtnl_unlock(); |
| 1196 | |
| 1197 | ieee80211_led_init(local); |
| 1198 | |
| 1199 | return 0; |
| 1200 | |
| 1201 | fail_wep: |
| 1202 | rate_control_deinitialize(local); |
| 1203 | fail_rate: |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1204 | ieee80211_debugfs_remove_netdev(IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1205 | unregister_netdevice(local->mdev); |
| 1206 | fail_dev: |
| 1207 | rtnl_unlock(); |
| 1208 | sta_info_stop(local); |
| 1209 | fail_sta_info: |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1210 | debugfs_hw_del(local); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1211 | destroy_workqueue(local->hw.workqueue); |
| 1212 | fail_workqueue: |
| 1213 | wiphy_unregister(local->hw.wiphy); |
| 1214 | return result; |
| 1215 | } |
| 1216 | EXPORT_SYMBOL(ieee80211_register_hw); |
| 1217 | |
| 1218 | int ieee80211_register_hwmode(struct ieee80211_hw *hw, |
| 1219 | struct ieee80211_hw_mode *mode) |
| 1220 | { |
| 1221 | struct ieee80211_local *local = hw_to_local(hw); |
| 1222 | struct ieee80211_rate *rate; |
| 1223 | int i; |
| 1224 | |
| 1225 | INIT_LIST_HEAD(&mode->list); |
| 1226 | list_add_tail(&mode->list, &local->modes_list); |
| 1227 | |
| 1228 | local->hw_modes |= (1 << mode->mode); |
| 1229 | for (i = 0; i < mode->num_rates; i++) { |
| 1230 | rate = &(mode->rates[i]); |
| 1231 | rate->rate_inv = CHAN_UTIL_RATE_LCM / rate->rate; |
| 1232 | } |
| 1233 | ieee80211_prepare_rates(local, mode); |
| 1234 | |
| 1235 | if (!local->oper_hw_mode) { |
| 1236 | /* Default to this mode */ |
| 1237 | local->hw.conf.phymode = mode->mode; |
| 1238 | local->oper_hw_mode = local->scan_hw_mode = mode; |
| 1239 | local->oper_channel = local->scan_channel = &mode->channels[0]; |
| 1240 | local->hw.conf.mode = local->oper_hw_mode; |
| 1241 | local->hw.conf.chan = local->oper_channel; |
| 1242 | } |
| 1243 | |
| 1244 | if (!(hw->flags & IEEE80211_HW_DEFAULT_REG_DOMAIN_CONFIGURED)) |
Daniel Drake | fd8bacc | 2007-06-09 19:07:14 +0100 | [diff] [blame] | 1245 | ieee80211_set_default_regdomain(mode); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1246 | |
| 1247 | return 0; |
| 1248 | } |
| 1249 | EXPORT_SYMBOL(ieee80211_register_hwmode); |
| 1250 | |
| 1251 | void ieee80211_unregister_hw(struct ieee80211_hw *hw) |
| 1252 | { |
| 1253 | struct ieee80211_local *local = hw_to_local(hw); |
| 1254 | struct ieee80211_sub_if_data *sdata, *tmp; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1255 | int i; |
| 1256 | |
| 1257 | tasklet_kill(&local->tx_pending_tasklet); |
| 1258 | tasklet_kill(&local->tasklet); |
| 1259 | |
| 1260 | rtnl_lock(); |
| 1261 | |
| 1262 | BUG_ON(local->reg_state != IEEE80211_DEV_REGISTERED); |
| 1263 | |
| 1264 | local->reg_state = IEEE80211_DEV_UNREGISTERED; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1265 | |
Johannes Berg | 7901042 | 2007-09-18 17:29:21 -0400 | [diff] [blame] | 1266 | /* |
| 1267 | * At this point, interface list manipulations are fine |
| 1268 | * because the driver cannot be handing us frames any |
| 1269 | * more and the tasklet is killed. |
| 1270 | */ |
Johannes Berg | 5b2812e | 2007-09-26 14:27:23 +0200 | [diff] [blame] | 1271 | |
| 1272 | /* |
| 1273 | * First, we remove all non-master interfaces. Do this because they |
| 1274 | * may have bss pointer dependency on the master, and when we free |
| 1275 | * the master these would be freed as well, breaking our list |
| 1276 | * iteration completely. |
| 1277 | */ |
| 1278 | list_for_each_entry_safe(sdata, tmp, &local->interfaces, list) { |
| 1279 | if (sdata->dev == local->mdev) |
| 1280 | continue; |
| 1281 | list_del(&sdata->list); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1282 | __ieee80211_if_del(local, sdata); |
Johannes Berg | 5b2812e | 2007-09-26 14:27:23 +0200 | [diff] [blame] | 1283 | } |
| 1284 | |
| 1285 | /* then, finally, remove the master interface */ |
| 1286 | __ieee80211_if_del(local, IEEE80211_DEV_TO_SUB_IF(local->mdev)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1287 | |
| 1288 | rtnl_unlock(); |
| 1289 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1290 | ieee80211_rx_bss_list_deinit(local->mdev); |
| 1291 | ieee80211_clear_tx_pending(local); |
| 1292 | sta_info_stop(local); |
| 1293 | rate_control_deinitialize(local); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1294 | debugfs_hw_del(local); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1295 | |
| 1296 | for (i = 0; i < NUM_IEEE80211_MODES; i++) { |
| 1297 | kfree(local->supp_rates[i]); |
| 1298 | kfree(local->basic_rates[i]); |
| 1299 | } |
| 1300 | |
| 1301 | if (skb_queue_len(&local->skb_queue) |
| 1302 | || skb_queue_len(&local->skb_queue_unreliable)) |
| 1303 | printk(KERN_WARNING "%s: skb_queue not empty\n", |
Johannes Berg | dd1cd4c | 2007-09-18 17:29:20 -0400 | [diff] [blame] | 1304 | wiphy_name(local->hw.wiphy)); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1305 | skb_queue_purge(&local->skb_queue); |
| 1306 | skb_queue_purge(&local->skb_queue_unreliable); |
| 1307 | |
| 1308 | destroy_workqueue(local->hw.workqueue); |
| 1309 | wiphy_unregister(local->hw.wiphy); |
| 1310 | ieee80211_wep_free(local); |
| 1311 | ieee80211_led_exit(local); |
| 1312 | } |
| 1313 | EXPORT_SYMBOL(ieee80211_unregister_hw); |
| 1314 | |
| 1315 | void ieee80211_free_hw(struct ieee80211_hw *hw) |
| 1316 | { |
| 1317 | struct ieee80211_local *local = hw_to_local(hw); |
| 1318 | |
| 1319 | ieee80211_if_free(local->mdev); |
| 1320 | wiphy_free(local->hw.wiphy); |
| 1321 | } |
| 1322 | EXPORT_SYMBOL(ieee80211_free_hw); |
| 1323 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1324 | static int __init ieee80211_init(void) |
| 1325 | { |
| 1326 | struct sk_buff *skb; |
| 1327 | int ret; |
| 1328 | |
| 1329 | BUILD_BUG_ON(sizeof(struct ieee80211_tx_packet_data) > sizeof(skb->cb)); |
| 1330 | |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 1331 | ret = rc80211_simple_init(); |
Johannes Berg | ac71c69 | 2007-10-28 14:17:44 +0100 | [diff] [blame] | 1332 | if (ret) |
Mattias Nissler | ad01837 | 2007-12-19 01:25:57 +0100 | [diff] [blame] | 1333 | goto fail; |
Mattias Nissler | ad01837 | 2007-12-19 01:25:57 +0100 | [diff] [blame] | 1334 | |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 1335 | ret = rc80211_pid_init(); |
Mattias Nissler | ad01837 | 2007-12-19 01:25:57 +0100 | [diff] [blame] | 1336 | if (ret) |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 1337 | goto fail_simple; |
Johannes Berg | ac71c69 | 2007-10-28 14:17:44 +0100 | [diff] [blame] | 1338 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1339 | ret = ieee80211_wme_register(); |
| 1340 | if (ret) { |
| 1341 | printk(KERN_DEBUG "ieee80211_init: failed to " |
| 1342 | "initialize WME (err=%d)\n", ret); |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 1343 | goto fail_pid; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1344 | } |
| 1345 | |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1346 | ieee80211_debugfs_netdev_init(); |
Daniel Drake | fd8bacc | 2007-06-09 19:07:14 +0100 | [diff] [blame] | 1347 | ieee80211_regdomain_init(); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1348 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1349 | return 0; |
Mattias Nissler | ad01837 | 2007-12-19 01:25:57 +0100 | [diff] [blame] | 1350 | |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 1351 | fail_pid: |
| 1352 | rc80211_simple_exit(); |
| 1353 | fail_simple: |
| 1354 | rc80211_pid_exit(); |
| 1355 | fail: |
Mattias Nissler | ad01837 | 2007-12-19 01:25:57 +0100 | [diff] [blame] | 1356 | return ret; |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1357 | } |
| 1358 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1359 | static void __exit ieee80211_exit(void) |
| 1360 | { |
Johannes Berg | 4b47589 | 2008-01-02 15:17:03 +0100 | [diff] [blame] | 1361 | rc80211_simple_exit(); |
| 1362 | rc80211_pid_exit(); |
Johannes Berg | ac71c69 | 2007-10-28 14:17:44 +0100 | [diff] [blame] | 1363 | |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1364 | ieee80211_wme_unregister(); |
Jiri Benc | e9f207f | 2007-05-05 11:46:38 -0700 | [diff] [blame] | 1365 | ieee80211_debugfs_netdev_exit(); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1366 | } |
| 1367 | |
| 1368 | |
Johannes Berg | ca9938fe | 2007-09-11 12:50:32 +0200 | [diff] [blame] | 1369 | subsys_initcall(ieee80211_init); |
Jiri Benc | f0706e82 | 2007-05-05 11:45:53 -0700 | [diff] [blame] | 1370 | module_exit(ieee80211_exit); |
| 1371 | |
| 1372 | MODULE_DESCRIPTION("IEEE 802.11 subsystem"); |
| 1373 | MODULE_LICENSE("GPL"); |