main.c 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161
  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->user_power_level = IEEE80211_UNSET_POWER_LEVEL;
  495. wiphy->ht_capa_mod_mask = &mac80211_ht_capa_mod_mask;
  496. wiphy->vht_capa_mod_mask = &mac80211_vht_capa_mod_mask;
  497. INIT_LIST_HEAD(&local->interfaces);
  498. __hw_addr_init(&local->mc_list);
  499. mutex_init(&local->iflist_mtx);
  500. mutex_init(&local->mtx);
  501. mutex_init(&local->key_mtx);
  502. spin_lock_init(&local->filter_lock);
  503. spin_lock_init(&local->rx_path_lock);
  504. spin_lock_init(&local->queue_stop_reason_lock);
  505. INIT_LIST_HEAD(&local->chanctx_list);
  506. mutex_init(&local->chanctx_mtx);
  507. INIT_DELAYED_WORK(&local->scan_work, ieee80211_scan_work);
  508. INIT_WORK(&local->restart_work, ieee80211_restart_work);
  509. INIT_WORK(&local->radar_detected_work,
  510. ieee80211_dfs_radar_detected_work);
  511. INIT_WORK(&local->reconfig_filter, ieee80211_reconfig_filter);
  512. local->smps_mode = IEEE80211_SMPS_OFF;
  513. INIT_WORK(&local->dynamic_ps_enable_work,
  514. ieee80211_dynamic_ps_enable_work);
  515. INIT_WORK(&local->dynamic_ps_disable_work,
  516. ieee80211_dynamic_ps_disable_work);
  517. setup_timer(&local->dynamic_ps_timer,
  518. ieee80211_dynamic_ps_timer, (unsigned long) local);
  519. INIT_WORK(&local->sched_scan_stopped_work,
  520. ieee80211_sched_scan_stopped_work);
  521. spin_lock_init(&local->ack_status_lock);
  522. idr_init(&local->ack_status_frames);
  523. sta_info_init(local);
  524. for (i = 0; i < IEEE80211_MAX_QUEUES; i++) {
  525. skb_queue_head_init(&local->pending[i]);
  526. atomic_set(&local->agg_queue_stop[i], 0);
  527. }
  528. tasklet_init(&local->tx_pending_tasklet, ieee80211_tx_pending,
  529. (unsigned long)local);
  530. tasklet_init(&local->tasklet,
  531. ieee80211_tasklet_handler,
  532. (unsigned long) local);
  533. skb_queue_head_init(&local->skb_queue);
  534. skb_queue_head_init(&local->skb_queue_unreliable);
  535. ieee80211_led_names(local);
  536. ieee80211_roc_setup(local);
  537. return &local->hw;
  538. }
  539. EXPORT_SYMBOL(ieee80211_alloc_hw);
  540. int ieee80211_register_hw(struct ieee80211_hw *hw)
  541. {
  542. struct ieee80211_local *local = hw_to_local(hw);
  543. int result, i;
  544. enum ieee80211_band band;
  545. int channels, max_bitrates;
  546. bool supp_ht, supp_vht;
  547. netdev_features_t feature_whitelist;
  548. static const u32 cipher_suites[] = {
  549. /* keep WEP first, it may be removed below */
  550. WLAN_CIPHER_SUITE_WEP40,
  551. WLAN_CIPHER_SUITE_WEP104,
  552. WLAN_CIPHER_SUITE_TKIP,
  553. WLAN_CIPHER_SUITE_CCMP,
  554. /* keep last -- depends on hw flags! */
  555. WLAN_CIPHER_SUITE_AES_CMAC
  556. };
  557. if (hw->flags & IEEE80211_HW_QUEUE_CONTROL &&
  558. (local->hw.offchannel_tx_hw_queue == IEEE80211_INVAL_HW_QUEUE ||
  559. local->hw.offchannel_tx_hw_queue >= local->hw.queues))
  560. return -EINVAL;
  561. #ifdef CONFIG_PM
  562. if ((hw->wiphy->wowlan.flags || hw->wiphy->wowlan.n_patterns) &&
  563. (!local->ops->suspend || !local->ops->resume))
  564. return -EINVAL;
  565. #endif
  566. if (!local->use_chanctx) {
  567. for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
  568. const struct ieee80211_iface_combination *comb;
  569. comb = &local->hw.wiphy->iface_combinations[i];
  570. if (comb->num_different_channels > 1)
  571. return -EINVAL;
  572. }
  573. } else {
  574. /*
  575. * WDS is currently prohibited when channel contexts are used
  576. * because there's no clear definition of which channel WDS
  577. * type interfaces use
  578. */
  579. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_WDS))
  580. return -EINVAL;
  581. /* DFS currently not supported with channel context drivers */
  582. for (i = 0; i < local->hw.wiphy->n_iface_combinations; i++) {
  583. const struct ieee80211_iface_combination *comb;
  584. comb = &local->hw.wiphy->iface_combinations[i];
  585. if (comb->radar_detect_widths)
  586. return -EINVAL;
  587. }
  588. }
  589. /* Only HW csum features are currently compatible with mac80211 */
  590. feature_whitelist = NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM |
  591. NETIF_F_HW_CSUM;
  592. if (WARN_ON(hw->netdev_features & ~feature_whitelist))
  593. return -EINVAL;
  594. if (hw->max_report_rates == 0)
  595. hw->max_report_rates = hw->max_rates;
  596. local->rx_chains = 1;
  597. /*
  598. * generic code guarantees at least one band,
  599. * set this very early because much code assumes
  600. * that hw.conf.channel is assigned
  601. */
  602. channels = 0;
  603. max_bitrates = 0;
  604. supp_ht = false;
  605. supp_vht = false;
  606. for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  607. struct ieee80211_supported_band *sband;
  608. sband = local->hw.wiphy->bands[band];
  609. if (!sband)
  610. continue;
  611. if (!local->use_chanctx && !local->_oper_channel) {
  612. /* init channel we're on */
  613. local->hw.conf.channel =
  614. local->_oper_channel = &sband->channels[0];
  615. local->hw.conf.channel_type = NL80211_CHAN_NO_HT;
  616. }
  617. cfg80211_chandef_create(&local->monitor_chandef,
  618. &sband->channels[0],
  619. NL80211_CHAN_NO_HT);
  620. channels += sband->n_channels;
  621. if (max_bitrates < sband->n_bitrates)
  622. max_bitrates = sband->n_bitrates;
  623. supp_ht = supp_ht || sband->ht_cap.ht_supported;
  624. supp_vht = supp_vht || sband->vht_cap.vht_supported;
  625. if (sband->ht_cap.ht_supported)
  626. local->rx_chains =
  627. max(ieee80211_mcs_to_chains(&sband->ht_cap.mcs),
  628. local->rx_chains);
  629. /* TODO: consider VHT for RX chains, hopefully it's the same */
  630. }
  631. local->int_scan_req = kzalloc(sizeof(*local->int_scan_req) +
  632. sizeof(void *) * channels, GFP_KERNEL);
  633. if (!local->int_scan_req)
  634. return -ENOMEM;
  635. for (band = 0; band < IEEE80211_NUM_BANDS; band++) {
  636. if (!local->hw.wiphy->bands[band])
  637. continue;
  638. local->int_scan_req->rates[band] = (u32) -1;
  639. }
  640. /* if low-level driver supports AP, we also support VLAN */
  641. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_AP)) {
  642. hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_AP_VLAN);
  643. hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_AP_VLAN);
  644. }
  645. /* mac80211 always supports monitor */
  646. hw->wiphy->interface_modes |= BIT(NL80211_IFTYPE_MONITOR);
  647. hw->wiphy->software_iftypes |= BIT(NL80211_IFTYPE_MONITOR);
  648. /* mac80211 doesn't support more than one IBSS interface right now */
  649. for (i = 0; i < hw->wiphy->n_iface_combinations; i++) {
  650. const struct ieee80211_iface_combination *c;
  651. int j;
  652. c = &hw->wiphy->iface_combinations[i];
  653. for (j = 0; j < c->n_limits; j++)
  654. if ((c->limits[j].types & BIT(NL80211_IFTYPE_ADHOC)) &&
  655. c->limits[j].max > 1)
  656. return -EINVAL;
  657. }
  658. #ifndef CONFIG_MAC80211_MESH
  659. /* mesh depends on Kconfig, but drivers should set it if they want */
  660. local->hw.wiphy->interface_modes &= ~BIT(NL80211_IFTYPE_MESH_POINT);
  661. #endif
  662. /* if the underlying driver supports mesh, mac80211 will (at least)
  663. * provide routing of mesh authentication frames to userspace */
  664. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_MESH_POINT))
  665. local->hw.wiphy->flags |= WIPHY_FLAG_MESH_AUTH;
  666. /* mac80211 supports control port protocol changing */
  667. local->hw.wiphy->flags |= WIPHY_FLAG_CONTROL_PORT_PROTOCOL;
  668. if (local->hw.flags & IEEE80211_HW_SIGNAL_DBM)
  669. local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_MBM;
  670. else if (local->hw.flags & IEEE80211_HW_SIGNAL_UNSPEC)
  671. local->hw.wiphy->signal_type = CFG80211_SIGNAL_TYPE_UNSPEC;
  672. WARN((local->hw.flags & IEEE80211_HW_SUPPORTS_UAPSD)
  673. && (local->hw.flags & IEEE80211_HW_PS_NULLFUNC_STACK),
  674. "U-APSD not supported with HW_PS_NULLFUNC_STACK\n");
  675. /*
  676. * Calculate scan IE length -- we need this to alloc
  677. * memory and to subtract from the driver limit. It
  678. * includes the DS Params, (extended) supported rates, and HT
  679. * information -- SSID is the driver's responsibility.
  680. */
  681. local->scan_ies_len = 4 + max_bitrates /* (ext) supp rates */ +
  682. 3 /* DS Params */;
  683. if (supp_ht)
  684. local->scan_ies_len += 2 + sizeof(struct ieee80211_ht_cap);
  685. if (supp_vht) {
  686. local->scan_ies_len +=
  687. 2 + sizeof(struct ieee80211_vht_cap);
  688. /*
  689. * (for now at least), drivers wanting to use VHT must
  690. * support channel contexts, as they contain all the
  691. * necessary VHT information and the global hw config
  692. * doesn't (yet)
  693. */
  694. if (WARN_ON(!local->use_chanctx)) {
  695. result = -EINVAL;
  696. goto fail_wiphy_register;
  697. }
  698. }
  699. if (!local->ops->hw_scan) {
  700. /* For hw_scan, driver needs to set these up. */
  701. local->hw.wiphy->max_scan_ssids = 4;
  702. local->hw.wiphy->max_scan_ie_len = IEEE80211_MAX_DATA_LEN;
  703. }
  704. /*
  705. * If the driver supports any scan IEs, then assume the
  706. * limit includes the IEs mac80211 will add, otherwise
  707. * leave it at zero and let the driver sort it out; we
  708. * still pass our IEs to the driver but userspace will
  709. * not be allowed to in that case.
  710. */
  711. if (local->hw.wiphy->max_scan_ie_len)
  712. local->hw.wiphy->max_scan_ie_len -= local->scan_ies_len;
  713. /* Set up cipher suites unless driver already did */
  714. if (!local->hw.wiphy->cipher_suites) {
  715. local->hw.wiphy->cipher_suites = cipher_suites;
  716. local->hw.wiphy->n_cipher_suites = ARRAY_SIZE(cipher_suites);
  717. if (!(local->hw.flags & IEEE80211_HW_MFP_CAPABLE))
  718. local->hw.wiphy->n_cipher_suites--;
  719. }
  720. if (IS_ERR(local->wep_tx_tfm) || IS_ERR(local->wep_rx_tfm)) {
  721. if (local->hw.wiphy->cipher_suites == cipher_suites) {
  722. local->hw.wiphy->cipher_suites += 2;
  723. local->hw.wiphy->n_cipher_suites -= 2;
  724. } else {
  725. u32 *suites;
  726. int r, w = 0;
  727. /* Filter out WEP */
  728. suites = kmemdup(
  729. local->hw.wiphy->cipher_suites,
  730. sizeof(u32) * local->hw.wiphy->n_cipher_suites,
  731. GFP_KERNEL);
  732. if (!suites) {
  733. result = -ENOMEM;
  734. goto fail_wiphy_register;
  735. }
  736. for (r = 0; r < local->hw.wiphy->n_cipher_suites; r++) {
  737. u32 suite = local->hw.wiphy->cipher_suites[r];
  738. if (suite == WLAN_CIPHER_SUITE_WEP40 ||
  739. suite == WLAN_CIPHER_SUITE_WEP104)
  740. continue;
  741. suites[w++] = suite;
  742. }
  743. local->hw.wiphy->cipher_suites = suites;
  744. local->hw.wiphy->n_cipher_suites = w;
  745. local->wiphy_ciphers_allocated = true;
  746. }
  747. }
  748. if (!local->ops->remain_on_channel)
  749. local->hw.wiphy->max_remain_on_channel_duration = 5000;
  750. if (local->ops->sched_scan_start)
  751. local->hw.wiphy->flags |= WIPHY_FLAG_SUPPORTS_SCHED_SCAN;
  752. /* mac80211 based drivers don't support internal TDLS setup */
  753. if (local->hw.wiphy->flags & WIPHY_FLAG_SUPPORTS_TDLS)
  754. local->hw.wiphy->flags |= WIPHY_FLAG_TDLS_EXTERNAL_SETUP;
  755. result = wiphy_register(local->hw.wiphy);
  756. if (result < 0)
  757. goto fail_wiphy_register;
  758. /*
  759. * We use the number of queues for feature tests (QoS, HT) internally
  760. * so restrict them appropriately.
  761. */
  762. if (hw->queues > IEEE80211_MAX_QUEUES)
  763. hw->queues = IEEE80211_MAX_QUEUES;
  764. local->workqueue =
  765. alloc_ordered_workqueue(wiphy_name(local->hw.wiphy), 0);
  766. if (!local->workqueue) {
  767. result = -ENOMEM;
  768. goto fail_workqueue;
  769. }
  770. /*
  771. * The hardware needs headroom for sending the frame,
  772. * and we need some headroom for passing the frame to monitor
  773. * interfaces, but never both at the same time.
  774. */
  775. local->tx_headroom = max_t(unsigned int , local->hw.extra_tx_headroom,
  776. IEEE80211_TX_STATUS_HEADROOM);
  777. debugfs_hw_add(local);
  778. /*
  779. * if the driver doesn't specify a max listen interval we
  780. * use 5 which should be a safe default
  781. */
  782. if (local->hw.max_listen_interval == 0)
  783. local->hw.max_listen_interval = 5;
  784. local->hw.conf.listen_interval = local->hw.max_listen_interval;
  785. local->dynamic_ps_forced_timeout = -1;
  786. result = ieee80211_wep_init(local);
  787. if (result < 0)
  788. wiphy_debug(local->hw.wiphy, "Failed to initialize wep: %d\n",
  789. result);
  790. ieee80211_led_init(local);
  791. rtnl_lock();
  792. result = ieee80211_init_rate_ctrl_alg(local,
  793. hw->rate_control_algorithm);
  794. if (result < 0) {
  795. wiphy_debug(local->hw.wiphy,
  796. "Failed to initialize rate control algorithm\n");
  797. goto fail_rate;
  798. }
  799. /* add one default STA interface if supported */
  800. if (local->hw.wiphy->interface_modes & BIT(NL80211_IFTYPE_STATION)) {
  801. result = ieee80211_if_add(local, "wlan%d", NULL,
  802. NL80211_IFTYPE_STATION, NULL);
  803. if (result)
  804. wiphy_warn(local->hw.wiphy,
  805. "Failed to add default virtual iface\n");
  806. }
  807. rtnl_unlock();
  808. local->network_latency_notifier.notifier_call =
  809. ieee80211_max_network_latency;
  810. result = pm_qos_add_notifier(PM_QOS_NETWORK_LATENCY,
  811. &local->network_latency_notifier);
  812. if (result) {
  813. rtnl_lock();
  814. goto fail_pm_qos;
  815. }
  816. #ifdef CONFIG_INET
  817. local->ifa_notifier.notifier_call = ieee80211_ifa_changed;
  818. result = register_inetaddr_notifier(&local->ifa_notifier);
  819. if (result)
  820. goto fail_ifa;
  821. #endif
  822. #if IS_ENABLED(CONFIG_IPV6)
  823. local->ifa6_notifier.notifier_call = ieee80211_ifa6_changed;
  824. result = register_inet6addr_notifier(&local->ifa6_notifier);
  825. if (result)
  826. goto fail_ifa6;
  827. #endif
  828. return 0;
  829. #if IS_ENABLED(CONFIG_IPV6)
  830. fail_ifa6:
  831. #ifdef CONFIG_INET
  832. unregister_inetaddr_notifier(&local->ifa_notifier);
  833. #endif
  834. #endif
  835. #if defined(CONFIG_INET) || defined(CONFIG_IPV6)
  836. fail_ifa:
  837. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  838. &local->network_latency_notifier);
  839. rtnl_lock();
  840. #endif
  841. fail_pm_qos:
  842. ieee80211_led_exit(local);
  843. ieee80211_remove_interfaces(local);
  844. fail_rate:
  845. rtnl_unlock();
  846. ieee80211_wep_free(local);
  847. sta_info_stop(local);
  848. destroy_workqueue(local->workqueue);
  849. fail_workqueue:
  850. wiphy_unregister(local->hw.wiphy);
  851. fail_wiphy_register:
  852. if (local->wiphy_ciphers_allocated)
  853. kfree(local->hw.wiphy->cipher_suites);
  854. kfree(local->int_scan_req);
  855. return result;
  856. }
  857. EXPORT_SYMBOL(ieee80211_register_hw);
  858. void ieee80211_unregister_hw(struct ieee80211_hw *hw)
  859. {
  860. struct ieee80211_local *local = hw_to_local(hw);
  861. tasklet_kill(&local->tx_pending_tasklet);
  862. tasklet_kill(&local->tasklet);
  863. pm_qos_remove_notifier(PM_QOS_NETWORK_LATENCY,
  864. &local->network_latency_notifier);
  865. #ifdef CONFIG_INET
  866. unregister_inetaddr_notifier(&local->ifa_notifier);
  867. #endif
  868. #if IS_ENABLED(CONFIG_IPV6)
  869. unregister_inet6addr_notifier(&local->ifa6_notifier);
  870. #endif
  871. rtnl_lock();
  872. /*
  873. * At this point, interface list manipulations are fine
  874. * because the driver cannot be handing us frames any
  875. * more and the tasklet is killed.
  876. */
  877. ieee80211_remove_interfaces(local);
  878. rtnl_unlock();
  879. cancel_work_sync(&local->restart_work);
  880. cancel_work_sync(&local->reconfig_filter);
  881. ieee80211_clear_tx_pending(local);
  882. rate_control_deinitialize(local);
  883. if (skb_queue_len(&local->skb_queue) ||
  884. skb_queue_len(&local->skb_queue_unreliable))
  885. wiphy_warn(local->hw.wiphy, "skb_queue not empty\n");
  886. skb_queue_purge(&local->skb_queue);
  887. skb_queue_purge(&local->skb_queue_unreliable);
  888. destroy_workqueue(local->workqueue);
  889. wiphy_unregister(local->hw.wiphy);
  890. sta_info_stop(local);
  891. ieee80211_wep_free(local);
  892. ieee80211_led_exit(local);
  893. kfree(local->int_scan_req);
  894. }
  895. EXPORT_SYMBOL(ieee80211_unregister_hw);
  896. static int ieee80211_free_ack_frame(int id, void *p, void *data)
  897. {
  898. WARN_ONCE(1, "Have pending ack frames!\n");
  899. kfree_skb(p);
  900. return 0;
  901. }
  902. void ieee80211_free_hw(struct ieee80211_hw *hw)
  903. {
  904. struct ieee80211_local *local = hw_to_local(hw);
  905. mutex_destroy(&local->iflist_mtx);
  906. mutex_destroy(&local->mtx);
  907. if (local->wiphy_ciphers_allocated)
  908. kfree(local->hw.wiphy->cipher_suites);
  909. idr_for_each(&local->ack_status_frames,
  910. ieee80211_free_ack_frame, NULL);
  911. idr_destroy(&local->ack_status_frames);
  912. wiphy_free(local->hw.wiphy);
  913. }
  914. EXPORT_SYMBOL(ieee80211_free_hw);
  915. static int __init ieee80211_init(void)
  916. {
  917. struct sk_buff *skb;
  918. int ret;
  919. BUILD_BUG_ON(sizeof(struct ieee80211_tx_info) > sizeof(skb->cb));
  920. BUILD_BUG_ON(offsetof(struct ieee80211_tx_info, driver_data) +
  921. IEEE80211_TX_INFO_DRIVER_DATA_SIZE > sizeof(skb->cb));
  922. ret = rc80211_minstrel_init();
  923. if (ret)
  924. return ret;
  925. ret = rc80211_minstrel_ht_init();
  926. if (ret)
  927. goto err_minstrel;
  928. ret = rc80211_pid_init();
  929. if (ret)
  930. goto err_pid;
  931. ret = ieee80211_iface_init();
  932. if (ret)
  933. goto err_netdev;
  934. return 0;
  935. err_netdev:
  936. rc80211_pid_exit();
  937. err_pid:
  938. rc80211_minstrel_ht_exit();
  939. err_minstrel:
  940. rc80211_minstrel_exit();
  941. return ret;
  942. }
  943. static void __exit ieee80211_exit(void)
  944. {
  945. rc80211_pid_exit();
  946. rc80211_minstrel_ht_exit();
  947. rc80211_minstrel_exit();
  948. ieee80211s_stop();
  949. ieee80211_iface_exit();
  950. rcu_barrier();
  951. }
  952. subsys_initcall(ieee80211_init);
  953. module_exit(ieee80211_exit);
  954. MODULE_DESCRIPTION("IEEE 802.11 subsystem");
  955. MODULE_LICENSE("GPL");