ieee80211.c 46 KB

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