main.c 31 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148
  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 <linux/module.h>
  12. #include <linux/init.h>
  13. #include <linux/netdevice.h>
  14. #include <linux/types.h>
  15. #include <linux/slab.h>
  16. #include <linux/skbuff.h>
  17. #include <linux/etherdevice.h>
  18. #include <linux/if_arp.h>
  19. #include <linux/rtnetlink.h>
  20. #include <linux/bitmap.h>
  21. #include <linux/pm_qos.h>
  22. #include <linux/inetdevice.h>
  23. #include <net/net_namespace.h>
  24. #include <net/cfg80211.h>
  25. #include <net/addrconf.h>
  26. #include "ieee80211_i.h"
  27. #include "driver-ops.h"
  28. #include "rate.h"
  29. #include "mesh.h"
  30. #include "wep.h"
  31. #include "led.h"
  32. #include "cfg.h"
  33. #include "debugfs.h"
  34. void ieee80211_configure_filter(struct ieee80211_local *local)
  35. {
  36. u64 mc;
  37. unsigned int changed_flags;
  38. unsigned int new_flags = 0;
  39. if (atomic_read(&local->iff_promiscs))
  40. new_flags |= FIF_PROMISC_IN_BSS;
  41. if (atomic_read(&local->iff_allmultis))
  42. new_flags |= FIF_ALLMULTI;
  43. if (local->monitors || test_bit(SCAN_SW_SCANNING, &local->scanning) ||
  44. test_bit(SCAN_ONCHANNEL_SCANNING, &local->scanning))
  45. new_flags |= FIF_BCN_PRBRESP_PROMISC;
  46. if (local->fif_probe_req || local->probe_req_reg)
  47. new_flags |= FIF_PROBE_REQ;
  48. if (local->fif_fcsfail)
  49. new_flags |= FIF_FCSFAIL;
  50. if (local->fif_plcpfail)
  51. new_flags |= FIF_PLCPFAIL;
  52. if (local->fif_control)
  53. new_flags |= FIF_CONTROL;
  54. if (local->fif_other_bss)
  55. new_flags |= FIF_OTHER_BSS;
  56. if (local->fif_pspoll)
  57. new_flags |= FIF_PSPOLL;
  58. spin_lock_bh(&local->filter_lock);
  59. changed_flags = local->filter_flags ^ new_flags;
  60. mc = drv_prepare_multicast(local, &local->mc_list);
  61. spin_unlock_bh(&local->filter_lock);
  62. /* be a bit nasty */
  63. new_flags |= (1<<31);
  64. drv_configure_filter(local, changed_flags, &new_flags, mc);
  65. WARN_ON(new_flags & (1<<31));
  66. local->filter_flags = new_flags & ~(1<<31);
  67. }
  68. static void ieee80211_reconfig_filter(struct work_struct *work)
  69. {
  70. struct ieee80211_local *local =
  71. container_of(work, struct ieee80211_local, reconfig_filter);
  72. ieee80211_configure_filter(local);
  73. }
  74. static u32 ieee80211_hw_conf_chan(struct ieee80211_local *local)
  75. {
  76. struct ieee80211_sub_if_data *sdata;
  77. struct cfg80211_chan_def chandef = {};
  78. u32 changed = 0;
  79. int power;
  80. u32 offchannel_flag;
  81. offchannel_flag = local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  82. if (local->scan_chandef.chan) {
  83. chandef = local->scan_chandef;
  84. } else if (local->tmp_channel) {
  85. chandef.chan = local->tmp_channel;
  86. chandef.width = NL80211_CHAN_WIDTH_20_NOHT;
  87. chandef.center_freq1 = chandef.chan->center_freq;
  88. } else
  89. chandef = local->_oper_chandef;
  90. WARN(!cfg80211_chandef_valid(&chandef),
  91. "control:%d MHz width:%d center: %d/%d MHz",
  92. chandef.chan->center_freq, chandef.width,
  93. chandef.center_freq1, chandef.center_freq2);
  94. if (!cfg80211_chandef_identical(&chandef, &local->_oper_chandef))
  95. local->hw.conf.flags |= IEEE80211_CONF_OFFCHANNEL;
  96. else
  97. local->hw.conf.flags &= ~IEEE80211_CONF_OFFCHANNEL;
  98. offchannel_flag ^= local->hw.conf.flags & IEEE80211_CONF_OFFCHANNEL;
  99. if (offchannel_flag ||
  100. !cfg80211_chandef_identical(&local->hw.conf.chandef,
  101. &local->_oper_chandef)) {
  102. local->hw.conf.chandef = chandef;
  103. changed |= IEEE80211_CONF_CHANGE_CHANNEL;
  104. }
  105. if (!conf_is_ht(&local->hw.conf)) {
  106. /*
  107. * mac80211.h documents that this is only valid
  108. * when the channel is set to an HT type, and
  109. * that otherwise STATIC is used.
  110. */
  111. local->hw.conf.smps_mode = IEEE80211_SMPS_STATIC;
  112. } else if (local->hw.conf.smps_mode != local->smps_mode) {
  113. local->hw.conf.smps_mode = local->smps_mode;
  114. changed |= IEEE80211_CONF_CHANGE_SMPS;
  115. }
  116. power = ieee80211_chandef_max_power(&chandef);
  117. rcu_read_lock();
  118. list_for_each_entry_rcu(sdata, &local->interfaces, list) {
  119. if (!rcu_access_pointer(sdata->vif.chanctx_conf))
  120. continue;
  121. power = min(power, sdata->vif.bss_conf.txpower);
  122. }
  123. rcu_read_unlock();
  124. if (local->hw.conf.power_level != power) {
  125. changed |= IEEE80211_CONF_CHANGE_POWER;
  126. local->hw.conf.power_level = power;
  127. }
  128. return changed;
  129. }
  130. int ieee80211_hw_config(struct ieee80211_local *local, u32 changed)
  131. {
  132. int ret = 0;
  133. might_sleep();
  134. if (!local->use_chanctx)
  135. changed |= ieee80211_hw_conf_chan(local);
  136. else
  137. changed &= ~(IEEE80211_CONF_CHANGE_CHANNEL |
  138. IEEE80211_CONF_CHANGE_POWER);
  139. if (changed && local->open_count) {
  140. ret = drv_config(local, changed);
  141. /*
  142. * Goal:
  143. * HW reconfiguration should never fail, the driver has told
  144. * us what it can support so it should live up to that promise.
  145. *
  146. * Current status:
  147. * rfkill is not integrated with mac80211 and a
  148. * configuration command can thus fail if hardware rfkill
  149. * is enabled
  150. *
  151. * FIXME: integrate rfkill with mac80211 and then add this
  152. * WARN_ON() back
  153. *
  154. */
  155. /* WARN_ON(ret); */
  156. }
  157. return ret;
  158. }
  159. void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
  160. u32 changed)
  161. {
  162. struct ieee80211_local *local = sdata->local;
  163. if (!changed)
  164. return;
  165. drv_bss_info_changed(local, sdata, &sdata->vif.bss_conf, changed);
  166. }
  167. u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata)
  168. {
  169. sdata->vif.bss_conf.use_cts_prot = false;
  170. sdata->vif.bss_conf.use_short_preamble = false;
  171. sdata->vif.bss_conf.use_short_slot = false;
  172. return BSS_CHANGED_ERP_CTS_PROT |
  173. BSS_CHANGED_ERP_PREAMBLE |
  174. BSS_CHANGED_ERP_SLOT;
  175. }
  176. static void ieee80211_tasklet_handler(unsigned long data)
  177. {
  178. struct ieee80211_local *local = (struct ieee80211_local *) data;
  179. struct sk_buff *skb;
  180. while ((skb = skb_dequeue(&local->skb_queue)) ||
  181. (skb = skb_dequeue(&local->skb_queue_unreliable))) {
  182. switch (skb->pkt_type) {
  183. case IEEE80211_RX_MSG:
  184. /* Clear skb->pkt_type in order to not confuse kernel
  185. * netstack. */
  186. skb->pkt_type = 0;
  187. ieee80211_rx(&local->hw, skb);
  188. break;
  189. case IEEE80211_TX_STATUS_MSG:
  190. skb->pkt_type = 0;
  191. ieee80211_tx_status(&local->hw, skb);
  192. break;
  193. default:
  194. WARN(1, "mac80211: Packet is of unknown type %d\n",
  195. skb->pkt_type);
  196. dev_kfree_skb(skb);
  197. break;
  198. }
  199. }
  200. }
  201. static void ieee80211_restart_work(struct work_struct *work)
  202. {
  203. struct ieee80211_local *local =
  204. container_of(work, struct ieee80211_local, restart_work);
  205. /* wait for scan work complete */
  206. flush_workqueue(local->workqueue);
  207. mutex_lock(&local->mtx);
  208. WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) ||
  209. rcu_dereference_protected(local->sched_scan_sdata,
  210. lockdep_is_held(&local->mtx)),
  211. "%s called with hardware scan in progress\n", __func__);
  212. mutex_unlock(&local->mtx);
  213. rtnl_lock();
  214. ieee80211_scan_cancel(local);
  215. ieee80211_reconfig(local);
  216. rtnl_unlock();
  217. }
  218. void ieee80211_restart_hw(struct ieee80211_hw *hw)
  219. {
  220. struct ieee80211_local *local = hw_to_local(hw);
  221. trace_api_restart_hw(local);
  222. wiphy_info(hw->wiphy,
  223. "Hardware restart was requested\n");
  224. /* use this reason, ieee80211_reconfig will unblock it */
  225. ieee80211_stop_queues_by_reason(hw, IEEE80211_MAX_QUEUE_MAP,
  226. IEEE80211_QUEUE_STOP_REASON_SUSPEND);
  227. /*
  228. * Stop all Rx during the reconfig. We don't want state changes
  229. * or driver callbacks while this is in progress.
  230. */
  231. local->in_reconfig = true;
  232. barrier();
  233. schedule_work(&local->restart_work);
  234. }
  235. EXPORT_SYMBOL(ieee80211_restart_hw);
  236. #ifdef CONFIG_INET
  237. static int ieee80211_ifa_changed(struct notifier_block *nb,
  238. unsigned long data, void *arg)
  239. {
  240. struct in_ifaddr *ifa = arg;
  241. struct ieee80211_local *local =
  242. container_of(nb, struct ieee80211_local,
  243. ifa_notifier);
  244. struct net_device *ndev = ifa->ifa_dev->dev;
  245. struct wireless_dev *wdev = ndev->ieee80211_ptr;
  246. struct in_device *idev;
  247. struct ieee80211_sub_if_data *sdata;
  248. struct ieee80211_bss_conf *bss_conf;
  249. struct ieee80211_if_managed *ifmgd;
  250. int c = 0;
  251. /* Make sure it's our interface that got changed */
  252. if (!wdev)
  253. return NOTIFY_DONE;
  254. if (wdev->wiphy != local->hw.wiphy)
  255. return NOTIFY_DONE;
  256. sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
  257. bss_conf = &sdata->vif.bss_conf;
  258. /* ARP filtering is only supported in managed mode */
  259. if (sdata->vif.type != NL80211_IFTYPE_STATION)
  260. return NOTIFY_DONE;
  261. idev = __in_dev_get_rtnl(sdata->dev);
  262. if (!idev)
  263. return NOTIFY_DONE;
  264. ifmgd = &sdata->u.mgd;
  265. sdata_lock(sdata);
  266. /* Copy the addresses to the bss_conf list */
  267. ifa = idev->ifa_list;
  268. while (ifa) {
  269. if (c < IEEE80211_BSS_ARP_ADDR_LIST_LEN)
  270. bss_conf->arp_addr_list[c] = ifa->ifa_address;
  271. ifa = ifa->ifa_next;
  272. c++;
  273. }
  274. bss_conf->arp_addr_cnt = c;
  275. /* Configure driver only if associated (which also implies it is up) */
  276. if (ifmgd->associated)
  277. ieee80211_bss_info_change_notify(sdata,
  278. BSS_CHANGED_ARP_FILTER);
  279. sdata_unlock(sdata);
  280. return NOTIFY_DONE;
  281. }
  282. #endif
  283. #if IS_ENABLED(CONFIG_IPV6)
  284. static int ieee80211_ifa6_changed(struct notifier_block *nb,
  285. unsigned long data, void *arg)
  286. {
  287. struct inet6_ifaddr *ifa = (struct inet6_ifaddr *)arg;
  288. struct inet6_dev *idev = ifa->idev;
  289. struct net_device *ndev = ifa->idev->dev;
  290. struct ieee80211_local *local =
  291. container_of(nb, struct ieee80211_local, ifa6_notifier);
  292. struct wireless_dev *wdev = ndev->ieee80211_ptr;
  293. struct ieee80211_sub_if_data *sdata;
  294. /* Make sure it's our interface that got changed */
  295. if (!wdev || wdev->wiphy != local->hw.wiphy)
  296. return NOTIFY_DONE;
  297. sdata = IEEE80211_DEV_TO_SUB_IF(ndev);
  298. /*
  299. * For now only support station mode. This is mostly because
  300. * doing AP would have to handle AP_VLAN in some way ...
  301. */
  302. if (sdata->vif.type != NL80211_IFTYPE_STATION)
  303. return NOTIFY_DONE;
  304. drv_ipv6_addr_change(local, sdata, idev);
  305. return NOTIFY_DONE;
  306. }
  307. #endif
  308. /* There isn't a lot of sense in it, but you can transmit anything you like */
  309. static const struct ieee80211_txrx_stypes
  310. ieee80211_default_mgmt_stypes[NUM_NL80211_IFTYPES] = {
  311. [NL80211_IFTYPE_ADHOC] = {
  312. .tx = 0xffff,
  313. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  314. BIT(IEEE80211_STYPE_AUTH >> 4) |
  315. BIT(IEEE80211_STYPE_DEAUTH >> 4) |
  316. BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
  317. },
  318. [NL80211_IFTYPE_STATION] = {
  319. .tx = 0xffff,
  320. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  321. BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
  322. },
  323. [NL80211_IFTYPE_AP] = {
  324. .tx = 0xffff,
  325. .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
  326. BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
  327. BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
  328. BIT(IEEE80211_STYPE_DISASSOC >> 4) |
  329. BIT(IEEE80211_STYPE_AUTH >> 4) |
  330. BIT(IEEE80211_STYPE_DEAUTH >> 4) |
  331. BIT(IEEE80211_STYPE_ACTION >> 4),
  332. },
  333. [NL80211_IFTYPE_AP_VLAN] = {
  334. /* copy AP */
  335. .tx = 0xffff,
  336. .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
  337. BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
  338. BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
  339. BIT(IEEE80211_STYPE_DISASSOC >> 4) |
  340. BIT(IEEE80211_STYPE_AUTH >> 4) |
  341. BIT(IEEE80211_STYPE_DEAUTH >> 4) |
  342. BIT(IEEE80211_STYPE_ACTION >> 4),
  343. },
  344. [NL80211_IFTYPE_P2P_CLIENT] = {
  345. .tx = 0xffff,
  346. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  347. BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
  348. },
  349. [NL80211_IFTYPE_P2P_GO] = {
  350. .tx = 0xffff,
  351. .rx = BIT(IEEE80211_STYPE_ASSOC_REQ >> 4) |
  352. BIT(IEEE80211_STYPE_REASSOC_REQ >> 4) |
  353. BIT(IEEE80211_STYPE_PROBE_REQ >> 4) |
  354. BIT(IEEE80211_STYPE_DISASSOC >> 4) |
  355. BIT(IEEE80211_STYPE_AUTH >> 4) |
  356. BIT(IEEE80211_STYPE_DEAUTH >> 4) |
  357. BIT(IEEE80211_STYPE_ACTION >> 4),
  358. },
  359. [NL80211_IFTYPE_MESH_POINT] = {
  360. .tx = 0xffff,
  361. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  362. BIT(IEEE80211_STYPE_AUTH >> 4) |
  363. BIT(IEEE80211_STYPE_DEAUTH >> 4),
  364. },
  365. [NL80211_IFTYPE_P2P_DEVICE] = {
  366. .tx = 0xffff,
  367. .rx = BIT(IEEE80211_STYPE_ACTION >> 4) |
  368. BIT(IEEE80211_STYPE_PROBE_REQ >> 4),
  369. },
  370. };
  371. static const struct ieee80211_ht_cap mac80211_ht_capa_mod_mask = {
  372. .ampdu_params_info = IEEE80211_HT_AMPDU_PARM_FACTOR |
  373. IEEE80211_HT_AMPDU_PARM_DENSITY,
  374. .cap_info = cpu_to_le16(IEEE80211_HT_CAP_SUP_WIDTH_20_40 |
  375. IEEE80211_HT_CAP_MAX_AMSDU |
  376. IEEE80211_HT_CAP_SGI_20 |
  377. IEEE80211_HT_CAP_SGI_40),
  378. .mcs = {
  379. .rx_mask = { 0xff, 0xff, 0xff, 0xff, 0xff,
  380. 0xff, 0xff, 0xff, 0xff, 0xff, },
  381. },
  382. };
  383. static const struct ieee80211_vht_cap mac80211_vht_capa_mod_mask = {
  384. .vht_cap_info =
  385. cpu_to_le32(IEEE80211_VHT_CAP_RXLDPC |
  386. IEEE80211_VHT_CAP_SHORT_GI_80 |
  387. IEEE80211_VHT_CAP_SHORT_GI_160 |
  388. IEEE80211_VHT_CAP_RXSTBC_1 |
  389. IEEE80211_VHT_CAP_RXSTBC_2 |
  390. IEEE80211_VHT_CAP_RXSTBC_3 |
  391. IEEE80211_VHT_CAP_RXSTBC_4 |
  392. IEEE80211_VHT_CAP_TXSTBC |
  393. IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE |
  394. IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE |
  395. IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN |
  396. IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN |
  397. IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK),
  398. .supp_mcs = {
  399. .rx_mcs_map = cpu_to_le16(~0),
  400. .tx_mcs_map = cpu_to_le16(~0),
  401. },
  402. };
  403. static const u8 extended_capabilities[] = {
  404. 0, 0, 0, 0, 0, 0, 0,
  405. WLAN_EXT_CAPA8_OPMODE_NOTIF,
  406. };
  407. struct ieee80211_hw *ieee80211_alloc_hw(size_t priv_data_len,
  408. const struct ieee80211_ops *ops)
  409. {
  410. struct ieee80211_local *local;
  411. int priv_size, i;
  412. struct wiphy *wiphy;
  413. bool use_chanctx;
  414. if (WARN_ON(!ops->tx || !ops->start || !ops->stop || !ops->config ||
  415. !ops->add_interface || !ops->remove_interface ||
  416. !ops->configure_filter))
  417. return NULL;
  418. if (WARN_ON(ops->sta_state && (ops->sta_add || ops->sta_remove)))
  419. return NULL;
  420. /* check all or no channel context operations exist */
  421. i = !!ops->add_chanctx + !!ops->remove_chanctx +
  422. !!ops->change_chanctx + !!ops->assign_vif_chanctx +
  423. !!ops->unassign_vif_chanctx;
  424. if (WARN_ON(i != 0 && i != 5))
  425. return NULL;
  426. use_chanctx = i == 5;
  427. /* Ensure 32-byte alignment of our private data and hw private data.
  428. * We use the wiphy priv data for both our ieee80211_local and for
  429. * the driver's private data
  430. *
  431. * In memory it'll be like this:
  432. *
  433. * +-------------------------+
  434. * | struct wiphy |
  435. * +-------------------------+
  436. * | struct ieee80211_local |
  437. * +-------------------------+
  438. * | driver's private data |
  439. * +-------------------------+
  440. *
  441. */
  442. priv_size = ALIGN(sizeof(*local), NETDEV_ALIGN) + priv_data_len;
  443. wiphy = wiphy_new(&mac80211_config_ops, priv_size);
  444. if (!wiphy)
  445. return NULL;
  446. wiphy->mgmt_stypes = ieee80211_default_mgmt_stypes;
  447. wiphy->privid = mac80211_wiphy_privid;
  448. wiphy->flags |= WIPHY_FLAG_NETNS_OK |
  449. WIPHY_FLAG_4ADDR_AP |
  450. WIPHY_FLAG_4ADDR_STATION |
  451. WIPHY_FLAG_REPORTS_OBSS |
  452. WIPHY_FLAG_OFFCHAN_TX;
  453. wiphy->extended_capabilities = extended_capabilities;
  454. wiphy->extended_capabilities_mask = extended_capabilities;
  455. wiphy->extended_capabilities_len = ARRAY_SIZE(extended_capabilities);
  456. if (ops->remain_on_channel)
  457. wiphy->flags |= WIPHY_FLAG_HAS_REMAIN_ON_CHANNEL;
  458. wiphy->features |= NL80211_FEATURE_SK_TX_STATUS |
  459. NL80211_FEATURE_SAE |
  460. NL80211_FEATURE_HT_IBSS |
  461. NL80211_FEATURE_VIF_TXPOWER |
  462. NL80211_FEATURE_USERSPACE_MPM;
  463. if (!ops->hw_scan)
  464. wiphy->features |= NL80211_FEATURE_LOW_PRIORITY_SCAN |
  465. NL80211_FEATURE_AP_SCAN;
  466. if (!ops->set_key)
  467. wiphy->flags |= WIPHY_FLAG_IBSS_RSN;
  468. wiphy->bss_priv_size = sizeof(struct ieee80211_bss);
  469. local = wiphy_priv(wiphy);
  470. local->hw.wiphy = wiphy;
  471. local->hw.priv = (char *)local + ALIGN(sizeof(*local), NETDEV_ALIGN);
  472. local->ops = ops;
  473. local->use_chanctx = use_chanctx;
  474. /* set up some defaults */
  475. local->hw.queues = 1;
  476. local->hw.max_rates = 1;
  477. local->hw.max_report_rates = 0;
  478. local->hw.max_rx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
  479. local->hw.max_tx_aggregation_subframes = IEEE80211_MAX_AMPDU_BUF;
  480. local->hw.offchannel_tx_hw_queue = IEEE80211_INVAL_HW_QUEUE;
  481. local->hw.conf.long_frame_max_tx_count = wiphy->retry_long;
  482. local->hw.conf.short_frame_max_tx_count = wiphy->retry_short;
  483. local->hw.radiotap_mcs_details = IEEE80211_RADIOTAP_MCS_HAVE_MCS |
  484. IEEE80211_RADIOTAP_MCS_HAVE_GI |
  485. IEEE80211_RADIOTAP_MCS_HAVE_BW;
  486. local->hw.radiotap_vht_details = IEEE80211_RADIOTAP_VHT_KNOWN_GI |
  487. IEEE80211_RADIOTAP_VHT_KNOWN_BANDWIDTH;
  488. local->hw.uapsd_queues = IEEE80211_DEFAULT_UAPSD_QUEUES;
  489. local->hw.uapsd_max_sp_len = IEEE80211_DEFAULT_MAX_SP_LEN;
  490. local->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  491. wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
  492. wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
  493. INIT_LIST_HEAD(&local->interfaces);
  494. __hw_addr_init(&local->mc_list);
  495. mutex_init(&local->iflist_mtx);
  496. mutex_init(&local->mtx);
  497. mutex_init(&local->key_mtx);
  498. spin_lock_init(&local->filter_lock);
  499. spin_lock_init(&local->rx_path_lock);
  500. spin_lock_init(&local->queue_stop_reason_lock);
  501. INIT_LIST_HEAD(&local->chanctx_list);
  502. mutex_init(&local->chanctx_mtx);
  503. INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
  504. INIT_WORK(&local->restart_work, ieee80211_restart_work);
  505. INIT_WORK(&local->radar_detected_work,
  506. ieee80211_dfs_radar_detected_work);
  507. INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
  508. local->smps_mode = IEEE80211_SMPS_OFF;
  509. INIT_WORK(&local->dynamic_ps_enable_work,
  510. ieee80211_dynamic_ps_enable_work);
  511. INIT_WORK(&local->dynamic_ps_disable_work,
  512. ieee80211_dynamic_ps_disable_work);
  513. setup_timer(&local->dynamic_ps_timer,
  514. ieee80211_dynamic_ps_timer, (unsigned long) local);
  515. INIT_WORK(&local->sched_scan_stopped_work,
  516. ieee80211_sched_scan_stopped_work);
  517. spin_lock_init(&local->ack_status_lock);
  518. idr_init(&local->ack_status_frames);
  519. sta_info_init(local);
  520. for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
  521. skb_queue_head_init(&local->pending[i]);
  522. atomic_set(&local->agg_queue_stop[i], 0);
  523. }
  524. tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
  525. (unsigned long)local);
  526. tasklet_init(&local->tasklet,
  527. ieee80211_tasklet_handler,
  528. (unsigned long) local);
  529. skb_queue_head_init(&local->skb_queue);
  530. skb_queue_head_init(&local->skb_queue_unreliable);
  531. ieee80211_led_names(local);
  532. ieee80211_roc_setup(local);
  533. return &local->hw;
  534. }
  535. EXPORT_SYMBOL(ieee80211_alloc_hw);
  536. int ieee80211_register_hw(struct ieee80211_hw *hw)
  537. {
  538. struct ieee80211_local *local = hw_to_local(hw);
  539. int result, i;
  540. enum ieee80211_band band;
  541. int channels, max_bitrates;
  542. bool supp_ht, supp_vht;
  543. netdev_features_t feature_whitelist;
  544. struct cfg80211_chan_def dflt_chandef = {};
  545. static const u32 cipher_suites[] = {
  546. /* keep WEP first, it may be removed below */
  547. WLAN_CIPHER_SUITE_WEP40,
  548. WLAN_CIPHER_SUITE_WEP104,
  549. WLAN_CIPHER_SUITE_TKIP,
  550. WLAN_CIPHER_SUITE_CCMP,
  551. /* keep last -- depends on hw flags! */
  552. WLAN_CIPHER_SUITE_AES_CMAC
  553. };
  554. if (hw->flags & IEEE80211_HW_QUEUE_CONTROL &&
  555. (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
  556. local->hw.offchannel_tx_hw_queue >= local->hw.queues))
  557. return -EINVAL;
  558. #ifdef CONFIG_PM
  559. if (hw->wiphy->wowlan && (!local->ops->suspend || !local->ops->resume))
  560. return -EINVAL;
  561. #endif
  562. if (!local->use_chanctx) {
  563. for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
  564. const struct ieee80211_iface_combination *comb;
  565. comb = &local->hw.wiphy->iface_combinations[i];
  566. if (comb->num_different_channels > 1)
  567. return -EINVAL;
  568. }
  569. } else {
  570. /*
  571. * WDS is currently prohibited when channel contexts are used
  572. * because there's no clear definition of which channel WDS
  573. * type interfaces use
  574. */
  575. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
  576. return -EINVAL;
  577. /* DFS currently not supported with channel context drivers */
  578. for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
  579. const struct ieee80211_iface_combination *comb;
  580. comb = &local->hw.wiphy->iface_combinations[i];
  581. if (comb->radar_detect_widths)
  582. return -EINVAL;
  583. }
  584. }
  585. /* Only HW csum features are currently compatible with mac80211 */
  586. feature_whitelist = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
  587. NETIF_F_HW_CSUM;
  588. if (WARN_ON(hw->netdev_features & ~feature_whitelist))
  589. return -EINVAL;
  590. if (hw->max_report_rates == 0)
  591. hw->max_report_rates = hw->max_rates;
  592. local->rx_chains = 1;
  593. /*
  594. * generic code guarantees at least one band,
  595. * set this very early because much code assumes
  596. * that hw.conf.channel is assigned
  597. */
  598. channels = 0;
  599. max_bitrates = 0;
  600. supp_ht = false;
  601. supp_vht = false;
  602. for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  603. struct ieee80211_supported_band *sband;
  604. sband = local->hw.wiphy->bands[band];
  605. if (!sband)
  606. continue;
  607. if (!dflt_chandef.chan) {
  608. cfg80211_chandef_create(&dflt_chandef,
  609. &sband->channels[0],
  610. NL80211_CHAN_NO_HT);
  611. /* init channel we're on */
  612. if (!local->use_chanctx && !local->_oper_chandef.chan) {
  613. local->hw.conf.chandef = dflt_chandef;
  614. local->_oper_chandef = dflt_chandef;
  615. }
  616. local->monitor_chandef = dflt_chandef;
  617. }
  618. channels += sband->n_channels;
  619. if (max_bitrates < sband->n_bitrates)
  620. max_bitrates = sband->n_bitrates;
  621. supp_ht = supp_ht || sband->ht_cap.ht_supported;
  622. supp_vht = supp_vht || sband->vht_cap.vht_supported;
  623. if (sband->ht_cap.ht_supported)
  624. local->rx_chains =
  625. max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs),
  626. local->rx_chains);
  627. /* TODO: consider VHT for RX chains, hopefully it's the same */
  628. }
  629. local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
  630. sizeof(void *) * channels, GFP_KERNEL);
  631. if (!local->int_scan_req)
  632. return -ENOMEM;
  633. for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  634. if (!local->hw.wiphy->bands[band])
  635. continue;
  636. local->int_scan_req->rates[band] = (u32) -1;
  637. }
  638. /* if low-level driver supports AP, we also support VLAN */
  639. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
  640. hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
  641. hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
  642. }
  643. /* mac80211 always supports monitor */
  644. hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
  645. hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
  646. /* mac80211 doesn't support more than one IBSS interface right now */
  647. for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {
  648. const struct ieee80211_iface_combination *c;
  649. int j;
  650. c = &hw->wiphy->iface_combinations[i];
  651. for (j = 0; j < c->n_limits; j++)
  652. if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
  653. c->limits[j].max > 1)
  654. return -EINVAL;
  655. }
  656. #ifndef CONFIG_MAC80211_MESH
  657. /* mesh depends on Kconfig, but drivers should set it if they want */
  658. local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
  659. #endif
  660. /* if the underlying driver supports mesh, mac80211 will (at least)
  661. * provide routing of mesh authentication frames to userspace */
  662. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
  663. local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
  664. /* mac80211 supports control port protocol changing */
  665. local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
  666. if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
  667. local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  668. else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
  669. local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
  670. WARN((local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)
  671. && (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK),
  672. "U-APSD not supported with HW_PS_NULLFUNC_STACK\n");
  673. /*
  674. * Calculate scan IE length -- we need this to alloc
  675. * memory and to subtract from the driver limit. It
  676. * includes the DS Params, (extended) supported rates, and HT
  677. * information -- SSID is the driver's responsibility.
  678. */
  679. local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
  680. 3 /* DS Params */;
  681. if (supp_ht)
  682. local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
  683. if (supp_vht)
  684. local->scan_ies_len +=
  685. 2 + sizeof(struct ieee80211_vht_cap);
  686. if (!local->ops->hw_scan) {
  687. /* For hw_scan, driver needs to set these up. */
  688. local->hw.wiphy->max_scan_ssids = 4;
  689. local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
  690. }
  691. /*
  692. * If the driver supports any scan IEs, then assume the
  693. * limit includes the IEs mac80211 will add, otherwise
  694. * leave it at zero and let the driver sort it out; we
  695. * still pass our IEs to the driver but userspace will
  696. * not be allowed to in that case.
  697. */
  698. if (local->hw.wiphy->max_scan_ie_len)
  699. local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
  700. /* Set up cipher suites unless driver already did */
  701. if (!local->hw.wiphy->cipher_suites) {
  702. local->hw.wiphy->cipher_suites = cipher_suites;
  703. local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  704. if (!(local->hw.flags & IEEE80211_HW_MFP_CAPABLE))
  705. local->hw.wiphy->n_cipher_suites--;
  706. }
  707. if (IS_ERR(local->wep_tx_tfm) || IS_ERR(local->wep_rx_tfm)) {
  708. if (local->hw.wiphy->cipher_suites == cipher_suites) {
  709. local->hw.wiphy->cipher_suites += 2;
  710. local->hw.wiphy->n_cipher_suites -= 2;
  711. } else {
  712. u32 *suites;
  713. int r, w = 0;
  714. /* Filter out WEP */
  715. suites = kmemdup(
  716. local->hw.wiphy->cipher_suites,
  717. sizeof(u32) * local->hw.wiphy->n_cipher_suites,
  718. GFP_KERNEL);
  719. if (!suites) {
  720. result = -ENOMEM;
  721. goto fail_wiphy_register;
  722. }
  723. for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
  724. u32 suite = local->hw.wiphy->cipher_suites[r];
  725. if (suite == WLAN_CIPHER_SUITE_WEP40 ||
  726. suite == WLAN_CIPHER_SUITE_WEP104)
  727. continue;
  728. suites[w++] = suite;
  729. }
  730. local->hw.wiphy->cipher_suites = suites;
  731. local->hw.wiphy->n_cipher_suites = w;
  732. local->wiphy_ciphers_allocated = true;
  733. }
  734. }
  735. if (!local->ops->remain_on_channel)
  736. local->hw.wiphy->max_remain_on_channel_duration = 5000;
  737. /* mac80211 based drivers don't support internal TDLS setup */
  738. if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
  739. local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
  740. result = wiphy_register(local->hw.wiphy);
  741. if (result < 0)
  742. goto fail_wiphy_register;
  743. /*
  744. * We use the number of queues for feature tests (QoS, HT) internally
  745. * so restrict them appropriately.
  746. */
  747. if (hw->queues > IEEE80211_MAX_QUEUES)
  748. hw->queues = IEEE80211_MAX_QUEUES;
  749. local->workqueue =
  750. alloc_ordered_workqueue("%s", 0, wiphy_name(local->hw.wiphy));
  751. if (!local->workqueue) {
  752. result = -ENOMEM;
  753. goto fail_workqueue;
  754. }
  755. /*
  756. * The hardware needs headroom for sending the frame,
  757. * and we need some headroom for passing the frame to monitor
  758. * interfaces, but never both at the same time.
  759. */
  760. local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
  761. IEEE80211_TX_STATUS_HEADROOM);
  762. debugfs_hw_add(local);
  763. /*
  764. * if the driver doesn't specify a max listen interval we
  765. * use 5 which should be a safe default
  766. */
  767. if (local->hw.max_listen_interval == 0)
  768. local->hw.max_listen_interval = 5;
  769. local->hw.conf.listen_interval = local->hw.max_listen_interval;
  770. local->dynamic_ps_forced_timeout = -1;
  771. result = ieee80211_wep_init(local);
  772. if (result < 0)
  773. wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  774. result);
  775. ieee80211_led_init(local);
  776. rtnl_lock();
  777. result = ieee80211_init_rate_ctrl_alg(local,
  778. hw->rate_control_algorithm);
  779. if (result < 0) {
  780. wiphy_debug(local->hw.wiphy,
  781. "Failed to initialize rate control algorithm\n");
  782. goto fail_rate;
  783. }
  784. /* add one default STA interface if supported */
  785. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
  786. result = ieee80211_if_add(local, "wlan%d", NULL,
  787. NL80211_IFTYPE_STATION, NULL);
  788. if (result)
  789. wiphy_warn(local->hw.wiphy,
  790. "Failed to add default virtual iface\n");
  791. }
  792. rtnl_unlock();
  793. local->network_latency_notifier.notifier_call =
  794. ieee80211_max_network_latency;
  795. result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY,
  796. &local->network_latency_notifier);
  797. if (result) {
  798. rtnl_lock();
  799. goto fail_pm_qos;
  800. }
  801. #ifdef CONFIG_INET
  802. local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
  803. result = register_inetaddr_notifier(&local->ifa_notifier);
  804. if (result)
  805. goto fail_ifa;
  806. #endif
  807. #if IS_ENABLED(CONFIG_IPV6)
  808. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  809. result = register_inet6addr_notifier(&local->ifa6_notifier);
  810. if (result)
  811. goto fail_ifa6;
  812. #endif
  813. return 0;
  814. #if IS_ENABLED(CONFIG_IPV6)
  815. fail_ifa6:
  816. #ifdef CONFIG_INET
  817. unregister_inetaddr_notifier(&local->ifa_notifier);
  818. #endif
  819. #endif
  820. #if defined(CONFIG_INET) || defined(CONFIG_IPV6)
  821. fail_ifa:
  822. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  823. &local->network_latency_notifier);
  824. rtnl_lock();
  825. #endif
  826. fail_pm_qos:
  827. ieee80211_led_exit(local);
  828. ieee80211_remove_interfaces(local);
  829. fail_rate:
  830. rtnl_unlock();
  831. ieee80211_wep_free(local);
  832. sta_info_stop(local);
  833. destroy_workqueue(local->workqueue);
  834. fail_workqueue:
  835. wiphy_unregister(local->hw.wiphy);
  836. fail_wiphy_register:
  837. if (local->wiphy_ciphers_allocated)
  838. kfree(local->hw.wiphy->cipher_suites);
  839. kfree(local->int_scan_req);
  840. return result;
  841. }
  842. EXPORT_SYMBOL(ieee80211_register_hw);
  843. void ieee80211_unregister_hw(struct ieee80211_hw *hw)
  844. {
  845. struct ieee80211_local *local = hw_to_local(hw);
  846. tasklet_kill(&local->tx_pending_tasklet);
  847. tasklet_kill(&local->tasklet);
  848. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  849. &local->network_latency_notifier);
  850. #ifdef CONFIG_INET
  851. unregister_inetaddr_notifier(&local->ifa_notifier);
  852. #endif
  853. #if IS_ENABLED(CONFIG_IPV6)
  854. unregister_inet6addr_notifier(&local->ifa6_notifier);
  855. #endif
  856. rtnl_lock();
  857. /*
  858. * At this point, interface list manipulations are fine
  859. * because the driver cannot be handing us frames any
  860. * more and the tasklet is killed.
  861. */
  862. ieee80211_remove_interfaces(local);
  863. rtnl_unlock();
  864. cancel_work_sync(&local->restart_work);
  865. cancel_work_sync(&local->reconfig_filter);
  866. ieee80211_clear_tx_pending(local);
  867. rate_control_deinitialize(local);
  868. if (skb_queue_len(&local->skb_queue) ||
  869. skb_queue_len(&local->skb_queue_unreliable))
  870. wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
  871. skb_queue_purge(&local->skb_queue);
  872. skb_queue_purge(&local->skb_queue_unreliable);
  873. destroy_workqueue(local->workqueue);
  874. wiphy_unregister(local->hw.wiphy);
  875. sta_info_stop(local);
  876. ieee80211_wep_free(local);
  877. ieee80211_led_exit(local);
  878. kfree(local->int_scan_req);
  879. }
  880. EXPORT_SYMBOL(ieee80211_unregister_hw);
  881. static int ieee80211_free_ack_frame(int id, void *p, void *data)
  882. {
  883. WARN_ONCE(1, "Have pending ack frames!\n");
  884. kfree_skb(p);
  885. return 0;
  886. }
  887. void ieee80211_free_hw(struct ieee80211_hw *hw)
  888. {
  889. struct ieee80211_local *local = hw_to_local(hw);
  890. mutex_destroy(&local->iflist_mtx);
  891. mutex_destroy(&local->mtx);
  892. if (local->wiphy_ciphers_allocated)
  893. kfree(local->hw.wiphy->cipher_suites);
  894. idr_for_each(&local->ack_status_frames,
  895. ieee80211_free_ack_frame, NULL);
  896. idr_destroy(&local->ack_status_frames);
  897. wiphy_free(local->hw.wiphy);
  898. }
  899. EXPORT_SYMBOL(ieee80211_free_hw);
  900. static int __init ieee80211_init(void)
  901. {
  902. struct sk_buff *skb;
  903. int ret;
  904. BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
  905. BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
  906. IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
  907. ret = rc80211_minstrel_init();
  908. if (ret)
  909. return ret;
  910. ret = rc80211_minstrel_ht_init();
  911. if (ret)
  912. goto err_minstrel;
  913. ret = rc80211_pid_init();
  914. if (ret)
  915. goto err_pid;
  916. ret = ieee80211_iface_init();
  917. if (ret)
  918. goto err_netdev;
  919. return 0;
  920. err_netdev:
  921. rc80211_pid_exit();
  922. err_pid:
  923. rc80211_minstrel_ht_exit();
  924. err_minstrel:
  925. rc80211_minstrel_exit();
  926. return ret;
  927. }
  928. static void __exit ieee80211_exit(void)
  929. {
  930. rc80211_pid_exit();
  931. rc80211_minstrel_ht_exit();
  932. rc80211_minstrel_exit();
  933. ieee80211s_stop();
  934. ieee80211_iface_exit();
  935. rcu_barrier();
  936. }
  937. subsys_initcall(ieee80211_init);
  938. module_exit(ieee80211_exit);
  939. MODULE_DESCRIPTION("IEEE 802.11 subsystem");
  940. MODULE_LICENSE("GPL");