main.c 31 KB

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