ieee80211_i.h 68 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160
  1. /*
  2. * Copyright 2002-2005, Instant802 Networks, Inc.
  3. * Copyright 2005, Devicescape Software, Inc.
  4. * Copyright 2006-2007 Jiri Benc <jbenc@suse.cz>
  5. * Copyright 2007-2010 Johannes Berg <johannes@sipsolutions.net>
  6. * Copyright 2013-2015 Intel Mobile Communications GmbH
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License version 2 as
  10. * published by the Free Software Foundation.
  11. */
  12. #ifndef IEEE80211_I_H
  13. #define IEEE80211_I_H
  14. #include <linux/kernel.h>
  15. #include <linux/device.h>
  16. #include <linux/if_ether.h>
  17. #include <linux/interrupt.h>
  18. #include <linux/list.h>
  19. #include <linux/netdevice.h>
  20. #include <linux/skbuff.h>
  21. #include <linux/workqueue.h>
  22. #include <linux/types.h>
  23. #include <linux/spinlock.h>
  24. #include <linux/etherdevice.h>
  25. #include <linux/leds.h>
  26. #include <linux/idr.h>
  27. #include <linux/rhashtable.h>
  28. #include <net/ieee80211_radiotap.h>
  29. #include <net/cfg80211.h>
  30. #include <net/mac80211.h>
  31. #include <net/fq.h>
  32. #include "key.h"
  33. #include "sta_info.h"
  34. #include "debug.h"
  35. extern const struct cfg80211_ops mac80211_config_ops;
  36. struct ieee80211_local;
  37. /* Maximum number of broadcast/multicast frames to buffer when some of the
  38. * associated stations are using power saving. */
  39. #define AP_MAX_BC_BUFFER 128
  40. /* Maximum number of frames buffered to all STAs, including multicast frames.
  41. * Note: increasing this limit increases the potential memory requirement. Each
  42. * frame can be up to about 2 kB long. */
  43. #define TOTAL_MAX_TX_BUFFER 512
  44. /* Required encryption head and tailroom */
  45. #define IEEE80211_ENCRYPT_HEADROOM 8
  46. #define IEEE80211_ENCRYPT_TAILROOM 18
  47. /* IEEE 802.11 (Ch. 9.5 Defragmentation) requires support for concurrent
  48. * reception of at least three fragmented frames. This limit can be increased
  49. * by changing this define, at the cost of slower frame reassembly and
  50. * increased memory use (about 2 kB of RAM per entry). */
  51. #define IEEE80211_FRAGMENT_MAX 4
  52. /* power level hasn't been configured (or set to automatic) */
  53. #define IEEE80211_UNSET_POWER_LEVEL INT_MIN
  54. /*
  55. * Some APs experience problems when working with U-APSD. Decreasing the
  56. * probability of that happening by using legacy mode for all ACs but VO isn't
  57. * enough.
  58. *
  59. * Cisco 4410N originally forced us to enable VO by default only because it
  60. * treated non-VO ACs as legacy.
  61. *
  62. * However some APs (notably Netgear R7000) silently reclassify packets to
  63. * different ACs. Since u-APSD ACs require trigger frames for frame retrieval
  64. * clients would never see some frames (e.g. ARP responses) or would fetch them
  65. * accidentally after a long time.
  66. *
  67. * It makes little sense to enable u-APSD queues by default because it needs
  68. * userspace applications to be aware of it to actually take advantage of the
  69. * possible additional powersavings. Implicitly depending on driver autotrigger
  70. * frame support doesn't make much sense.
  71. */
  72. #define IEEE80211_DEFAULT_UAPSD_QUEUES 0
  73. #define IEEE80211_DEFAULT_MAX_SP_LEN \
  74. IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL
  75. extern const u8 ieee80211_ac_to_qos_mask[IEEE80211_NUM_ACS];
  76. #define IEEE80211_DEAUTH_FRAME_LEN (24 /* hdr */ + 2 /* reason */)
  77. #define IEEE80211_MAX_NAN_INSTANCE_ID 255
  78. struct ieee80211_fragment_entry {
  79. struct sk_buff_head skb_list;
  80. unsigned long first_frag_time;
  81. u16 seq;
  82. u16 extra_len;
  83. u16 last_frag;
  84. u8 rx_queue;
  85. bool check_sequential_pn; /* needed for CCMP/GCMP */
  86. u8 last_pn[6]; /* PN of the last fragment if CCMP was used */
  87. };
  88. struct ieee80211_bss {
  89. u32 device_ts_beacon, device_ts_presp;
  90. bool wmm_used;
  91. bool uapsd_supported;
  92. #define IEEE80211_MAX_SUPP_RATES 32
  93. u8 supp_rates[IEEE80211_MAX_SUPP_RATES];
  94. size_t supp_rates_len;
  95. struct ieee80211_rate *beacon_rate;
  96. /*
  97. * During association, we save an ERP value from a probe response so
  98. * that we can feed ERP info to the driver when handling the
  99. * association completes. these fields probably won't be up-to-date
  100. * otherwise, you probably don't want to use them.
  101. */
  102. bool has_erp_value;
  103. u8 erp_value;
  104. /* Keep track of the corruption of the last beacon/probe response. */
  105. u8 corrupt_data;
  106. /* Keep track of what bits of information we have valid info for. */
  107. u8 valid_data;
  108. };
  109. /**
  110. * enum ieee80211_corrupt_data_flags - BSS data corruption flags
  111. * @IEEE80211_BSS_CORRUPT_BEACON: last beacon frame received was corrupted
  112. * @IEEE80211_BSS_CORRUPT_PROBE_RESP: last probe response received was corrupted
  113. *
  114. * These are bss flags that are attached to a bss in the
  115. * @corrupt_data field of &struct ieee80211_bss.
  116. */
  117. enum ieee80211_bss_corrupt_data_flags {
  118. IEEE80211_BSS_CORRUPT_BEACON = BIT(0),
  119. IEEE80211_BSS_CORRUPT_PROBE_RESP = BIT(1)
  120. };
  121. /**
  122. * enum ieee80211_valid_data_flags - BSS valid data flags
  123. * @IEEE80211_BSS_VALID_WMM: WMM/UAPSD data was gathered from non-corrupt IE
  124. * @IEEE80211_BSS_VALID_RATES: Supported rates were gathered from non-corrupt IE
  125. * @IEEE80211_BSS_VALID_ERP: ERP flag was gathered from non-corrupt IE
  126. *
  127. * These are bss flags that are attached to a bss in the
  128. * @valid_data field of &struct ieee80211_bss. They show which parts
  129. * of the data structure were received as a result of an un-corrupted
  130. * beacon/probe response.
  131. */
  132. enum ieee80211_bss_valid_data_flags {
  133. IEEE80211_BSS_VALID_WMM = BIT(1),
  134. IEEE80211_BSS_VALID_RATES = BIT(2),
  135. IEEE80211_BSS_VALID_ERP = BIT(3)
  136. };
  137. typedef unsigned __bitwise ieee80211_tx_result;
  138. #define TX_CONTINUE ((__force ieee80211_tx_result) 0u)
  139. #define TX_DROP ((__force ieee80211_tx_result) 1u)
  140. #define TX_QUEUED ((__force ieee80211_tx_result) 2u)
  141. #define IEEE80211_TX_UNICAST BIT(1)
  142. #define IEEE80211_TX_PS_BUFFERED BIT(2)
  143. struct ieee80211_tx_data {
  144. struct sk_buff *skb;
  145. struct sk_buff_head skbs;
  146. struct ieee80211_local *local;
  147. struct ieee80211_sub_if_data *sdata;
  148. struct sta_info *sta;
  149. struct ieee80211_key *key;
  150. struct ieee80211_tx_rate rate;
  151. unsigned int flags;
  152. };
  153. typedef unsigned __bitwise ieee80211_rx_result;
  154. #define RX_CONTINUE ((__force ieee80211_rx_result) 0u)
  155. #define RX_DROP_UNUSABLE ((__force ieee80211_rx_result) 1u)
  156. #define RX_DROP_MONITOR ((__force ieee80211_rx_result) 2u)
  157. #define RX_QUEUED ((__force ieee80211_rx_result) 3u)
  158. /**
  159. * enum ieee80211_packet_rx_flags - packet RX flags
  160. * @IEEE80211_RX_AMSDU: a-MSDU packet
  161. * @IEEE80211_RX_MALFORMED_ACTION_FRM: action frame is malformed
  162. * @IEEE80211_RX_DEFERRED_RELEASE: frame was subjected to receive reordering
  163. *
  164. * These are per-frame flags that are attached to a frame in the
  165. * @rx_flags field of &struct ieee80211_rx_status.
  166. */
  167. enum ieee80211_packet_rx_flags {
  168. IEEE80211_RX_AMSDU = BIT(3),
  169. IEEE80211_RX_MALFORMED_ACTION_FRM = BIT(4),
  170. IEEE80211_RX_DEFERRED_RELEASE = BIT(5),
  171. };
  172. /**
  173. * enum ieee80211_rx_flags - RX data flags
  174. *
  175. * @IEEE80211_RX_CMNTR: received on cooked monitor already
  176. * @IEEE80211_RX_BEACON_REPORTED: This frame was already reported
  177. * to cfg80211_report_obss_beacon().
  178. *
  179. * These flags are used across handling multiple interfaces
  180. * for a single frame.
  181. */
  182. enum ieee80211_rx_flags {
  183. IEEE80211_RX_CMNTR = BIT(0),
  184. IEEE80211_RX_BEACON_REPORTED = BIT(1),
  185. };
  186. struct ieee80211_rx_data {
  187. struct napi_struct *napi;
  188. struct sk_buff *skb;
  189. struct ieee80211_local *local;
  190. struct ieee80211_sub_if_data *sdata;
  191. struct sta_info *sta;
  192. struct ieee80211_key *key;
  193. unsigned int flags;
  194. /*
  195. * Index into sequence numbers array, 0..16
  196. * since the last (16) is used for non-QoS,
  197. * will be 16 on non-QoS frames.
  198. */
  199. int seqno_idx;
  200. /*
  201. * Index into the security IV/PN arrays, 0..16
  202. * since the last (16) is used for CCMP-encrypted
  203. * management frames, will be set to 16 on mgmt
  204. * frames and 0 on non-QoS frames.
  205. */
  206. int security_idx;
  207. u32 tkip_iv32;
  208. u16 tkip_iv16;
  209. };
  210. struct ieee80211_csa_settings {
  211. const u16 *counter_offsets_beacon;
  212. const u16 *counter_offsets_presp;
  213. int n_counter_offsets_beacon;
  214. int n_counter_offsets_presp;
  215. u8 count;
  216. };
  217. struct beacon_data {
  218. u8 *head, *tail;
  219. int head_len, tail_len;
  220. struct ieee80211_meshconf_ie *meshconf;
  221. u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
  222. u8 csa_current_counter;
  223. struct rcu_head rcu_head;
  224. };
  225. struct probe_resp {
  226. struct rcu_head rcu_head;
  227. int len;
  228. u16 csa_counter_offsets[IEEE80211_MAX_CSA_COUNTERS_NUM];
  229. u8 data[0];
  230. };
  231. struct ps_data {
  232. /* yes, this looks ugly, but guarantees that we can later use
  233. * bitmap_empty :)
  234. * NB: don't touch this bitmap, use sta_info_{set,clear}_tim_bit */
  235. u8 tim[sizeof(unsigned long) * BITS_TO_LONGS(IEEE80211_MAX_AID + 1)]
  236. __aligned(__alignof__(unsigned long));
  237. struct sk_buff_head bc_buf;
  238. atomic_t num_sta_ps; /* number of stations in PS mode */
  239. int dtim_count;
  240. bool dtim_bc_mc;
  241. };
  242. struct ieee80211_if_ap {
  243. struct beacon_data __rcu *beacon;
  244. struct probe_resp __rcu *probe_resp;
  245. /* to be used after channel switch. */
  246. struct cfg80211_beacon_data *next_beacon;
  247. struct list_head vlans; /* write-protected with RTNL and local->mtx */
  248. struct ps_data ps;
  249. atomic_t num_mcast_sta; /* number of stations receiving multicast */
  250. enum ieee80211_smps_mode req_smps, /* requested smps mode */
  251. driver_smps_mode; /* smps mode request */
  252. struct work_struct request_smps_work;
  253. };
  254. struct ieee80211_if_wds {
  255. struct sta_info *sta;
  256. u8 remote_addr[ETH_ALEN];
  257. };
  258. struct ieee80211_if_vlan {
  259. struct list_head list; /* write-protected with RTNL and local->mtx */
  260. /* used for all tx if the VLAN is configured to 4-addr mode */
  261. struct sta_info __rcu *sta;
  262. atomic_t num_mcast_sta; /* number of stations receiving multicast */
  263. };
  264. struct mesh_stats {
  265. __u32 fwded_mcast; /* Mesh forwarded multicast frames */
  266. __u32 fwded_unicast; /* Mesh forwarded unicast frames */
  267. __u32 fwded_frames; /* Mesh total forwarded frames */
  268. __u32 dropped_frames_ttl; /* Not transmitted since mesh_ttl == 0*/
  269. __u32 dropped_frames_no_route; /* Not transmitted, no route found */
  270. __u32 dropped_frames_congestion;/* Not forwarded due to congestion */
  271. };
  272. #define PREQ_Q_F_START 0x1
  273. #define PREQ_Q_F_REFRESH 0x2
  274. struct mesh_preq_queue {
  275. struct list_head list;
  276. u8 dst[ETH_ALEN];
  277. u8 flags;
  278. };
  279. struct ieee80211_roc_work {
  280. struct list_head list;
  281. struct ieee80211_sub_if_data *sdata;
  282. struct ieee80211_channel *chan;
  283. bool started, abort, hw_begun, notified;
  284. bool on_channel;
  285. unsigned long start_time;
  286. u32 duration, req_duration;
  287. struct sk_buff *frame;
  288. u64 cookie, mgmt_tx_cookie;
  289. enum ieee80211_roc_type type;
  290. };
  291. /* flags used in struct ieee80211_if_managed.flags */
  292. enum ieee80211_sta_flags {
  293. IEEE80211_STA_CONNECTION_POLL = BIT(1),
  294. IEEE80211_STA_CONTROL_PORT = BIT(2),
  295. IEEE80211_STA_DISABLE_HT = BIT(4),
  296. IEEE80211_STA_MFP_ENABLED = BIT(6),
  297. IEEE80211_STA_UAPSD_ENABLED = BIT(7),
  298. IEEE80211_STA_NULLFUNC_ACKED = BIT(8),
  299. IEEE80211_STA_RESET_SIGNAL_AVE = BIT(9),
  300. IEEE80211_STA_DISABLE_40MHZ = BIT(10),
  301. IEEE80211_STA_DISABLE_VHT = BIT(11),
  302. IEEE80211_STA_DISABLE_80P80MHZ = BIT(12),
  303. IEEE80211_STA_DISABLE_160MHZ = BIT(13),
  304. IEEE80211_STA_DISABLE_WMM = BIT(14),
  305. IEEE80211_STA_ENABLE_RRM = BIT(15),
  306. };
  307. struct ieee80211_mgd_auth_data {
  308. struct cfg80211_bss *bss;
  309. unsigned long timeout;
  310. int tries;
  311. u16 algorithm, expected_transaction;
  312. u8 key[WLAN_KEY_LEN_WEP104];
  313. u8 key_len, key_idx;
  314. bool done;
  315. bool timeout_started;
  316. u16 sae_trans, sae_status;
  317. size_t data_len;
  318. u8 data[];
  319. };
  320. struct ieee80211_mgd_assoc_data {
  321. struct cfg80211_bss *bss;
  322. const u8 *supp_rates;
  323. unsigned long timeout;
  324. int tries;
  325. u16 capability;
  326. u8 prev_bssid[ETH_ALEN];
  327. u8 ssid[IEEE80211_MAX_SSID_LEN];
  328. u8 ssid_len;
  329. u8 supp_rates_len;
  330. bool wmm, uapsd;
  331. bool need_beacon;
  332. bool synced;
  333. bool timeout_started;
  334. u8 ap_ht_param;
  335. struct ieee80211_vht_cap ap_vht_cap;
  336. u8 fils_nonces[2 * FILS_NONCE_LEN];
  337. u8 fils_kek[FILS_MAX_KEK_LEN];
  338. size_t fils_kek_len;
  339. size_t ie_len;
  340. u8 ie[];
  341. };
  342. struct ieee80211_sta_tx_tspec {
  343. /* timestamp of the first packet in the time slice */
  344. unsigned long time_slice_start;
  345. u32 admitted_time; /* in usecs, unlike over the air */
  346. u8 tsid;
  347. s8 up; /* signed to be able to invalidate with -1 during teardown */
  348. /* consumed TX time in microseconds in the time slice */
  349. u32 consumed_tx_time;
  350. enum {
  351. TX_TSPEC_ACTION_NONE = 0,
  352. TX_TSPEC_ACTION_DOWNGRADE,
  353. TX_TSPEC_ACTION_STOP_DOWNGRADE,
  354. } action;
  355. bool downgraded;
  356. };
  357. DECLARE_EWMA(beacon_signal, 16, 4)
  358. struct ieee80211_if_managed {
  359. struct timer_list timer;
  360. struct timer_list conn_mon_timer;
  361. struct timer_list bcn_mon_timer;
  362. struct timer_list chswitch_timer;
  363. struct work_struct monitor_work;
  364. struct work_struct chswitch_work;
  365. struct work_struct beacon_connection_loss_work;
  366. struct work_struct csa_connection_drop_work;
  367. unsigned long beacon_timeout;
  368. unsigned long probe_timeout;
  369. int probe_send_count;
  370. bool nullfunc_failed;
  371. bool connection_loss;
  372. struct cfg80211_bss *associated;
  373. struct ieee80211_mgd_auth_data *auth_data;
  374. struct ieee80211_mgd_assoc_data *assoc_data;
  375. u8 bssid[ETH_ALEN] __aligned(2);
  376. u16 aid;
  377. bool powersave; /* powersave requested for this iface */
  378. bool broken_ap; /* AP is broken -- turn off powersave */
  379. bool have_beacon;
  380. u8 dtim_period;
  381. enum ieee80211_smps_mode req_smps, /* requested smps mode */
  382. driver_smps_mode; /* smps mode request */
  383. struct work_struct request_smps_work;
  384. unsigned int flags;
  385. bool csa_waiting_bcn;
  386. bool csa_ignored_same_chan;
  387. bool beacon_crc_valid;
  388. u32 beacon_crc;
  389. bool status_acked;
  390. bool status_received;
  391. __le16 status_fc;
  392. enum {
  393. IEEE80211_MFP_DISABLED,
  394. IEEE80211_MFP_OPTIONAL,
  395. IEEE80211_MFP_REQUIRED
  396. } mfp; /* management frame protection */
  397. /*
  398. * Bitmask of enabled u-apsd queues,
  399. * IEEE80211_WMM_IE_STA_QOSINFO_AC_BE & co. Needs a new association
  400. * to take effect.
  401. */
  402. unsigned int uapsd_queues;
  403. /*
  404. * Maximum number of buffered frames AP can deliver during a
  405. * service period, IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL or similar.
  406. * Needs a new association to take effect.
  407. */
  408. unsigned int uapsd_max_sp_len;
  409. int wmm_last_param_set;
  410. u8 use_4addr;
  411. s16 p2p_noa_index;
  412. struct ewma_beacon_signal ave_beacon_signal;
  413. /*
  414. * Number of Beacon frames used in ave_beacon_signal. This can be used
  415. * to avoid generating less reliable cqm events that would be based
  416. * only on couple of received frames.
  417. */
  418. unsigned int count_beacon_signal;
  419. /* Number of times beacon loss was invoked. */
  420. unsigned int beacon_loss_count;
  421. /*
  422. * Last Beacon frame signal strength average (ave_beacon_signal / 16)
  423. * that triggered a cqm event. 0 indicates that no event has been
  424. * generated for the current association.
  425. */
  426. int last_cqm_event_signal;
  427. /*
  428. * State variables for keeping track of RSSI of the AP currently
  429. * connected to and informing driver when RSSI has gone
  430. * below/above a certain threshold.
  431. */
  432. int rssi_min_thold, rssi_max_thold;
  433. int last_ave_beacon_signal;
  434. struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
  435. struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
  436. struct ieee80211_vht_cap vht_capa; /* configured VHT overrides */
  437. struct ieee80211_vht_cap vht_capa_mask; /* Valid parts of vht_capa */
  438. /* TDLS support */
  439. u8 tdls_peer[ETH_ALEN] __aligned(2);
  440. struct delayed_work tdls_peer_del_work;
  441. struct sk_buff *orig_teardown_skb; /* The original teardown skb */
  442. struct sk_buff *teardown_skb; /* A copy to send through the AP */
  443. spinlock_t teardown_lock; /* To lock changing teardown_skb */
  444. bool tdls_chan_switch_prohibited;
  445. bool tdls_wider_bw_prohibited;
  446. /* WMM-AC TSPEC support */
  447. struct ieee80211_sta_tx_tspec tx_tspec[IEEE80211_NUM_ACS];
  448. /* Use a separate work struct so that we can do something here
  449. * while the sdata->work is flushing the queues, for example.
  450. * otherwise, in scenarios where we hardly get any traffic out
  451. * on the BE queue, but there's a lot of VO traffic, we might
  452. * get stuck in a downgraded situation and flush takes forever.
  453. */
  454. struct delayed_work tx_tspec_wk;
  455. };
  456. struct ieee80211_if_ibss {
  457. struct timer_list timer;
  458. struct work_struct csa_connection_drop_work;
  459. unsigned long last_scan_completed;
  460. u32 basic_rates;
  461. bool fixed_bssid;
  462. bool fixed_channel;
  463. bool privacy;
  464. bool control_port;
  465. bool userspace_handles_dfs;
  466. u8 bssid[ETH_ALEN] __aligned(2);
  467. u8 ssid[IEEE80211_MAX_SSID_LEN];
  468. u8 ssid_len, ie_len;
  469. u8 *ie;
  470. struct cfg80211_chan_def chandef;
  471. unsigned long ibss_join_req;
  472. /* probe response/beacon for IBSS */
  473. struct beacon_data __rcu *presp;
  474. struct ieee80211_ht_cap ht_capa; /* configured ht-cap over-rides */
  475. struct ieee80211_ht_cap ht_capa_mask; /* Valid parts of ht_capa */
  476. spinlock_t incomplete_lock;
  477. struct list_head incomplete_stations;
  478. enum {
  479. IEEE80211_IBSS_MLME_SEARCH,
  480. IEEE80211_IBSS_MLME_JOINED,
  481. } state;
  482. };
  483. /**
  484. * struct ieee80211_if_ocb - OCB mode state
  485. *
  486. * @housekeeping_timer: timer for periodic invocation of a housekeeping task
  487. * @wrkq_flags: OCB deferred task action
  488. * @incomplete_lock: delayed STA insertion lock
  489. * @incomplete_stations: list of STAs waiting for delayed insertion
  490. * @joined: indication if the interface is connected to an OCB network
  491. */
  492. struct ieee80211_if_ocb {
  493. struct timer_list housekeeping_timer;
  494. unsigned long wrkq_flags;
  495. spinlock_t incomplete_lock;
  496. struct list_head incomplete_stations;
  497. bool joined;
  498. };
  499. /**
  500. * struct ieee80211_mesh_sync_ops - Extensible synchronization framework interface
  501. *
  502. * these declarations define the interface, which enables
  503. * vendor-specific mesh synchronization
  504. *
  505. */
  506. struct ieee802_11_elems;
  507. struct ieee80211_mesh_sync_ops {
  508. void (*rx_bcn_presp)(struct ieee80211_sub_if_data *sdata,
  509. u16 stype,
  510. struct ieee80211_mgmt *mgmt,
  511. struct ieee802_11_elems *elems,
  512. struct ieee80211_rx_status *rx_status);
  513. /* should be called with beacon_data under RCU read lock */
  514. void (*adjust_tbtt)(struct ieee80211_sub_if_data *sdata,
  515. struct beacon_data *beacon);
  516. /* add other framework functions here */
  517. };
  518. struct mesh_csa_settings {
  519. struct rcu_head rcu_head;
  520. struct cfg80211_csa_settings settings;
  521. };
  522. struct ieee80211_if_mesh {
  523. struct timer_list housekeeping_timer;
  524. struct timer_list mesh_path_timer;
  525. struct timer_list mesh_path_root_timer;
  526. unsigned long wrkq_flags;
  527. unsigned long mbss_changed;
  528. u8 mesh_id[IEEE80211_MAX_MESH_ID_LEN];
  529. size_t mesh_id_len;
  530. /* Active Path Selection Protocol Identifier */
  531. u8 mesh_pp_id;
  532. /* Active Path Selection Metric Identifier */
  533. u8 mesh_pm_id;
  534. /* Congestion Control Mode Identifier */
  535. u8 mesh_cc_id;
  536. /* Synchronization Protocol Identifier */
  537. u8 mesh_sp_id;
  538. /* Authentication Protocol Identifier */
  539. u8 mesh_auth_id;
  540. /* Local mesh Sequence Number */
  541. u32 sn;
  542. /* Last used PREQ ID */
  543. u32 preq_id;
  544. atomic_t mpaths;
  545. /* Timestamp of last SN update */
  546. unsigned long last_sn_update;
  547. /* Time when it's ok to send next PERR */
  548. unsigned long next_perr;
  549. /* Timestamp of last PREQ sent */
  550. unsigned long last_preq;
  551. struct mesh_rmc *rmc;
  552. spinlock_t mesh_preq_queue_lock;
  553. struct mesh_preq_queue preq_queue;
  554. int preq_queue_len;
  555. struct mesh_stats mshstats;
  556. struct mesh_config mshcfg;
  557. atomic_t estab_plinks;
  558. u32 mesh_seqnum;
  559. bool accepting_plinks;
  560. int num_gates;
  561. struct beacon_data __rcu *beacon;
  562. const u8 *ie;
  563. u8 ie_len;
  564. enum {
  565. IEEE80211_MESH_SEC_NONE = 0x0,
  566. IEEE80211_MESH_SEC_AUTHED = 0x1,
  567. IEEE80211_MESH_SEC_SECURED = 0x2,
  568. } security;
  569. bool user_mpm;
  570. /* Extensible Synchronization Framework */
  571. const struct ieee80211_mesh_sync_ops *sync_ops;
  572. s64 sync_offset_clockdrift_max;
  573. spinlock_t sync_offset_lock;
  574. bool adjusting_tbtt;
  575. /* mesh power save */
  576. enum nl80211_mesh_power_mode nonpeer_pm;
  577. int ps_peers_light_sleep;
  578. int ps_peers_deep_sleep;
  579. struct ps_data ps;
  580. /* Channel Switching Support */
  581. struct mesh_csa_settings __rcu *csa;
  582. enum {
  583. IEEE80211_MESH_CSA_ROLE_NONE,
  584. IEEE80211_MESH_CSA_ROLE_INIT,
  585. IEEE80211_MESH_CSA_ROLE_REPEATER,
  586. } csa_role;
  587. u8 chsw_ttl;
  588. u16 pre_value;
  589. /* offset from skb->data while building IE */
  590. int meshconf_offset;
  591. struct mesh_table *mesh_paths;
  592. struct mesh_table *mpp_paths; /* Store paths for MPP&MAP */
  593. int mesh_paths_generation;
  594. int mpp_paths_generation;
  595. };
  596. #ifdef CONFIG_MAC80211_MESH
  597. #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
  598. do { (msh)->mshstats.name++; } while (0)
  599. #else
  600. #define IEEE80211_IFSTA_MESH_CTR_INC(msh, name) \
  601. do { } while (0)
  602. #endif
  603. /**
  604. * enum ieee80211_sub_if_data_flags - virtual interface flags
  605. *
  606. * @IEEE80211_SDATA_ALLMULTI: interface wants all multicast packets
  607. * @IEEE80211_SDATA_OPERATING_GMODE: operating in G-only mode
  608. * @IEEE80211_SDATA_DONT_BRIDGE_PACKETS: bridge packets between
  609. * associated stations and deliver multicast frames both
  610. * back to wireless media and to the local net stack.
  611. * @IEEE80211_SDATA_DISCONNECT_RESUME: Disconnect after resume.
  612. * @IEEE80211_SDATA_IN_DRIVER: indicates interface was added to driver
  613. */
  614. enum ieee80211_sub_if_data_flags {
  615. IEEE80211_SDATA_ALLMULTI = BIT(0),
  616. IEEE80211_SDATA_OPERATING_GMODE = BIT(2),
  617. IEEE80211_SDATA_DONT_BRIDGE_PACKETS = BIT(3),
  618. IEEE80211_SDATA_DISCONNECT_RESUME = BIT(4),
  619. IEEE80211_SDATA_IN_DRIVER = BIT(5),
  620. };
  621. /**
  622. * enum ieee80211_sdata_state_bits - virtual interface state bits
  623. * @SDATA_STATE_RUNNING: virtual interface is up & running; this
  624. * mirrors netif_running() but is separate for interface type
  625. * change handling while the interface is up
  626. * @SDATA_STATE_OFFCHANNEL: This interface is currently in offchannel
  627. * mode, so queues are stopped
  628. * @SDATA_STATE_OFFCHANNEL_BEACON_STOPPED: Beaconing was stopped due
  629. * to offchannel, reset when offchannel returns
  630. */
  631. enum ieee80211_sdata_state_bits {
  632. SDATA_STATE_RUNNING,
  633. SDATA_STATE_OFFCHANNEL,
  634. SDATA_STATE_OFFCHANNEL_BEACON_STOPPED,
  635. };
  636. /**
  637. * enum ieee80211_chanctx_mode - channel context configuration mode
  638. *
  639. * @IEEE80211_CHANCTX_SHARED: channel context may be used by
  640. * multiple interfaces
  641. * @IEEE80211_CHANCTX_EXCLUSIVE: channel context can be used
  642. * only by a single interface. This can be used for example for
  643. * non-fixed channel IBSS.
  644. */
  645. enum ieee80211_chanctx_mode {
  646. IEEE80211_CHANCTX_SHARED,
  647. IEEE80211_CHANCTX_EXCLUSIVE
  648. };
  649. /**
  650. * enum ieee80211_chanctx_replace_state - channel context replacement state
  651. *
  652. * This is used for channel context in-place reservations that require channel
  653. * context switch/swap.
  654. *
  655. * @IEEE80211_CHANCTX_REPLACE_NONE: no replacement is taking place
  656. * @IEEE80211_CHANCTX_WILL_BE_REPLACED: this channel context will be replaced
  657. * by a (not yet registered) channel context pointed by %replace_ctx.
  658. * @IEEE80211_CHANCTX_REPLACES_OTHER: this (not yet registered) channel context
  659. * replaces an existing channel context pointed to by %replace_ctx.
  660. */
  661. enum ieee80211_chanctx_replace_state {
  662. IEEE80211_CHANCTX_REPLACE_NONE,
  663. IEEE80211_CHANCTX_WILL_BE_REPLACED,
  664. IEEE80211_CHANCTX_REPLACES_OTHER,
  665. };
  666. struct ieee80211_chanctx {
  667. struct list_head list;
  668. struct rcu_head rcu_head;
  669. struct list_head assigned_vifs;
  670. struct list_head reserved_vifs;
  671. enum ieee80211_chanctx_replace_state replace_state;
  672. struct ieee80211_chanctx *replace_ctx;
  673. enum ieee80211_chanctx_mode mode;
  674. bool driver_present;
  675. struct ieee80211_chanctx_conf conf;
  676. };
  677. struct mac80211_qos_map {
  678. struct cfg80211_qos_map qos_map;
  679. struct rcu_head rcu_head;
  680. };
  681. enum txq_info_flags {
  682. IEEE80211_TXQ_STOP,
  683. IEEE80211_TXQ_AMPDU,
  684. IEEE80211_TXQ_NO_AMSDU,
  685. };
  686. /**
  687. * struct txq_info - per tid queue
  688. *
  689. * @tin: contains packets split into multiple flows
  690. * @def_flow: used as a fallback flow when a packet destined to @tin hashes to
  691. * a fq_flow which is already owned by a different tin
  692. * @def_cvars: codel vars for @def_flow
  693. * @frags: used to keep fragments created after dequeue
  694. */
  695. struct txq_info {
  696. struct fq_tin tin;
  697. struct fq_flow def_flow;
  698. struct codel_vars def_cvars;
  699. struct codel_stats cstats;
  700. struct sk_buff_head frags;
  701. unsigned long flags;
  702. /* keep last! */
  703. struct ieee80211_txq txq;
  704. };
  705. struct ieee80211_if_mntr {
  706. u32 flags;
  707. u8 mu_follow_addr[ETH_ALEN] __aligned(2);
  708. };
  709. /**
  710. * struct ieee80211_if_nan - NAN state
  711. *
  712. * @conf: current NAN configuration
  713. * @func_ids: a bitmap of available instance_id's
  714. */
  715. struct ieee80211_if_nan {
  716. struct cfg80211_nan_conf conf;
  717. /* protects function_inst_ids */
  718. spinlock_t func_lock;
  719. struct idr function_inst_ids;
  720. };
  721. struct ieee80211_sub_if_data {
  722. struct list_head list;
  723. struct wireless_dev wdev;
  724. /* keys */
  725. struct list_head key_list;
  726. /* count for keys needing tailroom space allocation */
  727. int crypto_tx_tailroom_needed_cnt;
  728. int crypto_tx_tailroom_pending_dec;
  729. struct delayed_work dec_tailroom_needed_wk;
  730. struct net_device *dev;
  731. struct ieee80211_local *local;
  732. unsigned int flags;
  733. unsigned long state;
  734. char name[IFNAMSIZ];
  735. /* Fragment table for host-based reassembly */
  736. struct ieee80211_fragment_entry fragments[IEEE80211_FRAGMENT_MAX];
  737. unsigned int fragment_next;
  738. /* TID bitmap for NoAck policy */
  739. u16 noack_map;
  740. /* bit field of ACM bits (BIT(802.1D tag)) */
  741. u8 wmm_acm;
  742. struct ieee80211_key __rcu *keys[NUM_DEFAULT_KEYS + NUM_DEFAULT_MGMT_KEYS];
  743. struct ieee80211_key __rcu *default_unicast_key;
  744. struct ieee80211_key __rcu *default_multicast_key;
  745. struct ieee80211_key __rcu *default_mgmt_key;
  746. u16 sequence_number;
  747. __be16 control_port_protocol;
  748. bool control_port_no_encrypt;
  749. int encrypt_headroom;
  750. atomic_t num_tx_queued;
  751. struct ieee80211_tx_queue_params tx_conf[IEEE80211_NUM_ACS];
  752. struct mac80211_qos_map __rcu *qos_map;
  753. struct work_struct csa_finalize_work;
  754. bool csa_block_tx; /* write-protected by sdata_lock and local->mtx */
  755. struct cfg80211_chan_def csa_chandef;
  756. struct list_head assigned_chanctx_list; /* protected by chanctx_mtx */
  757. struct list_head reserved_chanctx_list; /* protected by chanctx_mtx */
  758. /* context reservation -- protected with chanctx_mtx */
  759. struct ieee80211_chanctx *reserved_chanctx;
  760. struct cfg80211_chan_def reserved_chandef;
  761. bool reserved_radar_required;
  762. bool reserved_ready;
  763. /* used to reconfigure hardware SM PS */
  764. struct work_struct recalc_smps;
  765. struct work_struct work;
  766. struct sk_buff_head skb_queue;
  767. u8 needed_rx_chains;
  768. enum ieee80211_smps_mode smps_mode;
  769. int user_power_level; /* in dBm */
  770. int ap_power_level; /* in dBm */
  771. bool radar_required;
  772. struct delayed_work dfs_cac_timer_work;
  773. /*
  774. * AP this belongs to: self in AP mode and
  775. * corresponding AP in VLAN mode, NULL for
  776. * all others (might be needed later in IBSS)
  777. */
  778. struct ieee80211_if_ap *bss;
  779. /* bitmap of allowed (non-MCS) rate indexes for rate control */
  780. u32 rc_rateidx_mask[NUM_NL80211_BANDS];
  781. bool rc_has_mcs_mask[NUM_NL80211_BANDS];
  782. u8 rc_rateidx_mcs_mask[NUM_NL80211_BANDS][IEEE80211_HT_MCS_MASK_LEN];
  783. bool rc_has_vht_mcs_mask[NUM_NL80211_BANDS];
  784. u16 rc_rateidx_vht_mcs_mask[NUM_NL80211_BANDS][NL80211_VHT_NSS_MAX];
  785. union {
  786. struct ieee80211_if_ap ap;
  787. struct ieee80211_if_wds wds;
  788. struct ieee80211_if_vlan vlan;
  789. struct ieee80211_if_managed mgd;
  790. struct ieee80211_if_ibss ibss;
  791. struct ieee80211_if_mesh mesh;
  792. struct ieee80211_if_ocb ocb;
  793. struct ieee80211_if_mntr mntr;
  794. struct ieee80211_if_nan nan;
  795. } u;
  796. #ifdef CONFIG_MAC80211_DEBUGFS
  797. struct {
  798. struct dentry *subdir_stations;
  799. struct dentry *default_unicast_key;
  800. struct dentry *default_multicast_key;
  801. struct dentry *default_mgmt_key;
  802. } debugfs;
  803. #endif
  804. /* must be last, dynamically sized area in this! */
  805. struct ieee80211_vif vif;
  806. };
  807. static inline
  808. struct ieee80211_sub_if_data *vif_to_sdata(struct ieee80211_vif *p)
  809. {
  810. return container_of(p, struct ieee80211_sub_if_data, vif);
  811. }
  812. static inline void sdata_lock(struct ieee80211_sub_if_data *sdata)
  813. __acquires(&sdata->wdev.mtx)
  814. {
  815. mutex_lock(&sdata->wdev.mtx);
  816. __acquire(&sdata->wdev.mtx);
  817. }
  818. static inline void sdata_unlock(struct ieee80211_sub_if_data *sdata)
  819. __releases(&sdata->wdev.mtx)
  820. {
  821. mutex_unlock(&sdata->wdev.mtx);
  822. __release(&sdata->wdev.mtx);
  823. }
  824. #define sdata_dereference(p, sdata) \
  825. rcu_dereference_protected(p, lockdep_is_held(&sdata->wdev.mtx))
  826. static inline void
  827. sdata_assert_lock(struct ieee80211_sub_if_data *sdata)
  828. {
  829. lockdep_assert_held(&sdata->wdev.mtx);
  830. }
  831. static inline enum nl80211_band
  832. ieee80211_get_sdata_band(struct ieee80211_sub_if_data *sdata)
  833. {
  834. enum nl80211_band band = NL80211_BAND_2GHZ;
  835. struct ieee80211_chanctx_conf *chanctx_conf;
  836. rcu_read_lock();
  837. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  838. if (!WARN_ON(!chanctx_conf))
  839. band = chanctx_conf->def.chan->band;
  840. rcu_read_unlock();
  841. return band;
  842. }
  843. static inline int
  844. ieee80211_chandef_get_shift(struct cfg80211_chan_def *chandef)
  845. {
  846. switch (chandef->width) {
  847. case NL80211_CHAN_WIDTH_5:
  848. return 2;
  849. case NL80211_CHAN_WIDTH_10:
  850. return 1;
  851. default:
  852. return 0;
  853. }
  854. }
  855. static inline int
  856. ieee80211_vif_get_shift(struct ieee80211_vif *vif)
  857. {
  858. struct ieee80211_chanctx_conf *chanctx_conf;
  859. int shift = 0;
  860. rcu_read_lock();
  861. chanctx_conf = rcu_dereference(vif->chanctx_conf);
  862. if (chanctx_conf)
  863. shift = ieee80211_chandef_get_shift(&chanctx_conf->def);
  864. rcu_read_unlock();
  865. return shift;
  866. }
  867. struct ieee80211_rx_agg {
  868. u8 addr[ETH_ALEN];
  869. u16 tid;
  870. };
  871. enum sdata_queue_type {
  872. IEEE80211_SDATA_QUEUE_TYPE_FRAME = 0,
  873. IEEE80211_SDATA_QUEUE_AGG_START = 1,
  874. IEEE80211_SDATA_QUEUE_AGG_STOP = 2,
  875. IEEE80211_SDATA_QUEUE_RX_AGG_START = 3,
  876. IEEE80211_SDATA_QUEUE_RX_AGG_STOP = 4,
  877. };
  878. enum {
  879. IEEE80211_RX_MSG = 1,
  880. IEEE80211_TX_STATUS_MSG = 2,
  881. };
  882. enum queue_stop_reason {
  883. IEEE80211_QUEUE_STOP_REASON_DRIVER,
  884. IEEE80211_QUEUE_STOP_REASON_PS,
  885. IEEE80211_QUEUE_STOP_REASON_CSA,
  886. IEEE80211_QUEUE_STOP_REASON_AGGREGATION,
  887. IEEE80211_QUEUE_STOP_REASON_SUSPEND,
  888. IEEE80211_QUEUE_STOP_REASON_SKB_ADD,
  889. IEEE80211_QUEUE_STOP_REASON_OFFCHANNEL,
  890. IEEE80211_QUEUE_STOP_REASON_FLUSH,
  891. IEEE80211_QUEUE_STOP_REASON_TDLS_TEARDOWN,
  892. IEEE80211_QUEUE_STOP_REASON_RESERVE_TID,
  893. IEEE80211_QUEUE_STOP_REASONS,
  894. };
  895. #ifdef CONFIG_MAC80211_LEDS
  896. struct tpt_led_trigger {
  897. char name[32];
  898. const struct ieee80211_tpt_blink *blink_table;
  899. unsigned int blink_table_len;
  900. struct timer_list timer;
  901. unsigned long prev_traffic;
  902. unsigned long tx_bytes, rx_bytes;
  903. unsigned int active, want;
  904. bool running;
  905. };
  906. #endif
  907. /**
  908. * mac80211 scan flags - currently active scan mode
  909. *
  910. * @SCAN_SW_SCANNING: We're currently in the process of scanning but may as
  911. * well be on the operating channel
  912. * @SCAN_HW_SCANNING: The hardware is scanning for us, we have no way to
  913. * determine if we are on the operating channel or not
  914. * @SCAN_ONCHANNEL_SCANNING: Do a software scan on only the current operating
  915. * channel. This should not interrupt normal traffic.
  916. * @SCAN_COMPLETED: Set for our scan work function when the driver reported
  917. * that the scan completed.
  918. * @SCAN_ABORTED: Set for our scan work function when the driver reported
  919. * a scan complete for an aborted scan.
  920. * @SCAN_HW_CANCELLED: Set for our scan work function when the scan is being
  921. * cancelled.
  922. */
  923. enum {
  924. SCAN_SW_SCANNING,
  925. SCAN_HW_SCANNING,
  926. SCAN_ONCHANNEL_SCANNING,
  927. SCAN_COMPLETED,
  928. SCAN_ABORTED,
  929. SCAN_HW_CANCELLED,
  930. };
  931. /**
  932. * enum mac80211_scan_state - scan state machine states
  933. *
  934. * @SCAN_DECISION: Main entry point to the scan state machine, this state
  935. * determines if we should keep on scanning or switch back to the
  936. * operating channel
  937. * @SCAN_SET_CHANNEL: Set the next channel to be scanned
  938. * @SCAN_SEND_PROBE: Send probe requests and wait for probe responses
  939. * @SCAN_SUSPEND: Suspend the scan and go back to operating channel to
  940. * send out data
  941. * @SCAN_RESUME: Resume the scan and scan the next channel
  942. * @SCAN_ABORT: Abort the scan and go back to operating channel
  943. */
  944. enum mac80211_scan_state {
  945. SCAN_DECISION,
  946. SCAN_SET_CHANNEL,
  947. SCAN_SEND_PROBE,
  948. SCAN_SUSPEND,
  949. SCAN_RESUME,
  950. SCAN_ABORT,
  951. };
  952. struct ieee80211_local {
  953. /* embed the driver visible part.
  954. * don't cast (use the static inlines below), but we keep
  955. * it first anyway so they become a no-op */
  956. struct ieee80211_hw hw;
  957. struct fq fq;
  958. struct codel_vars *cvars;
  959. struct codel_params cparams;
  960. const struct ieee80211_ops *ops;
  961. /*
  962. * private workqueue to mac80211. mac80211 makes this accessible
  963. * via ieee80211_queue_work()
  964. */
  965. struct workqueue_struct *workqueue;
  966. unsigned long queue_stop_reasons[IEEE80211_MAX_QUEUES];
  967. int q_stop_reasons[IEEE80211_MAX_QUEUES][IEEE80211_QUEUE_STOP_REASONS];
  968. /* also used to protect ampdu_ac_queue and amdpu_ac_stop_refcnt */
  969. spinlock_t queue_stop_reason_lock;
  970. int open_count;
  971. int monitors, cooked_mntrs;
  972. /* number of interfaces with corresponding FIF_ flags */
  973. int fif_fcsfail, fif_plcpfail, fif_control, fif_other_bss, fif_pspoll,
  974. fif_probe_req;
  975. int probe_req_reg;
  976. unsigned int filter_flags; /* FIF_* */
  977. bool wiphy_ciphers_allocated;
  978. bool use_chanctx;
  979. /* protects the aggregated multicast list and filter calls */
  980. spinlock_t filter_lock;
  981. /* used for uploading changed mc list */
  982. struct work_struct reconfig_filter;
  983. /* aggregated multicast list */
  984. struct netdev_hw_addr_list mc_list;
  985. bool tim_in_locked_section; /* see ieee80211_beacon_get() */
  986. /*
  987. * suspended is true if we finished all the suspend _and_ we have
  988. * not yet come up from resume. This is to be used by mac80211
  989. * to ensure driver sanity during suspend and mac80211's own
  990. * sanity. It can eventually be used for WoW as well.
  991. */
  992. bool suspended;
  993. /*
  994. * Resuming is true while suspended, but when we're reprogramming the
  995. * hardware -- at that time it's allowed to use ieee80211_queue_work()
  996. * again even though some other parts of the stack are still suspended
  997. * and we still drop received frames to avoid waking the stack.
  998. */
  999. bool resuming;
  1000. /*
  1001. * quiescing is true during the suspend process _only_ to
  1002. * ease timer cancelling etc.
  1003. */
  1004. bool quiescing;
  1005. /* device is started */
  1006. bool started;
  1007. /* device is during a HW reconfig */
  1008. bool in_reconfig;
  1009. /* wowlan is enabled -- don't reconfig on resume */
  1010. bool wowlan;
  1011. struct work_struct radar_detected_work;
  1012. /* number of RX chains the hardware has */
  1013. u8 rx_chains;
  1014. int tx_headroom; /* required headroom for hardware/radiotap */
  1015. /* Tasklet and skb queue to process calls from IRQ mode. All frames
  1016. * added to skb_queue will be processed, but frames in
  1017. * skb_queue_unreliable may be dropped if the total length of these
  1018. * queues increases over the limit. */
  1019. #define IEEE80211_IRQSAFE_QUEUE_LIMIT 128
  1020. struct tasklet_struct tasklet;
  1021. struct sk_buff_head skb_queue;
  1022. struct sk_buff_head skb_queue_unreliable;
  1023. spinlock_t rx_path_lock;
  1024. /* Station data */
  1025. /*
  1026. * The mutex only protects the list, hash table and
  1027. * counter, reads are done with RCU.
  1028. */
  1029. struct mutex sta_mtx;
  1030. spinlock_t tim_lock;
  1031. unsigned long num_sta;
  1032. struct list_head sta_list;
  1033. struct rhltable sta_hash;
  1034. struct timer_list sta_cleanup;
  1035. int sta_generation;
  1036. struct sk_buff_head pending[IEEE80211_MAX_QUEUES];
  1037. struct tasklet_struct tx_pending_tasklet;
  1038. atomic_t agg_queue_stop[IEEE80211_MAX_QUEUES];
  1039. /* number of interfaces with allmulti RX */
  1040. atomic_t iff_allmultis;
  1041. struct rate_control_ref *rate_ctrl;
  1042. struct crypto_cipher *wep_tx_tfm;
  1043. struct crypto_cipher *wep_rx_tfm;
  1044. u32 wep_iv;
  1045. /* see iface.c */
  1046. struct list_head interfaces;
  1047. struct mutex iflist_mtx;
  1048. /*
  1049. * Key mutex, protects sdata's key_list and sta_info's
  1050. * key pointers (write access, they're RCU.)
  1051. */
  1052. struct mutex key_mtx;
  1053. /* mutex for scan and work locking */
  1054. struct mutex mtx;
  1055. /* Scanning and BSS list */
  1056. unsigned long scanning;
  1057. struct cfg80211_ssid scan_ssid;
  1058. struct cfg80211_scan_request *int_scan_req;
  1059. struct cfg80211_scan_request __rcu *scan_req;
  1060. struct ieee80211_scan_request *hw_scan_req;
  1061. struct cfg80211_chan_def scan_chandef;
  1062. enum nl80211_band hw_scan_band;
  1063. int scan_channel_idx;
  1064. int scan_ies_len;
  1065. int hw_scan_ies_bufsize;
  1066. struct cfg80211_scan_info scan_info;
  1067. struct work_struct sched_scan_stopped_work;
  1068. struct ieee80211_sub_if_data __rcu *sched_scan_sdata;
  1069. struct cfg80211_sched_scan_request __rcu *sched_scan_req;
  1070. u8 scan_addr[ETH_ALEN];
  1071. unsigned long leave_oper_channel_time;
  1072. enum mac80211_scan_state next_scan_state;
  1073. struct delayed_work scan_work;
  1074. struct ieee80211_sub_if_data __rcu *scan_sdata;
  1075. /* For backward compatibility only -- do not use */
  1076. struct cfg80211_chan_def _oper_chandef;
  1077. /* Temporary remain-on-channel for off-channel operations */
  1078. struct ieee80211_channel *tmp_channel;
  1079. /* channel contexts */
  1080. struct list_head chanctx_list;
  1081. struct mutex chanctx_mtx;
  1082. #ifdef CONFIG_MAC80211_LEDS
  1083. struct led_trigger tx_led, rx_led, assoc_led, radio_led;
  1084. struct led_trigger tpt_led;
  1085. atomic_t tx_led_active, rx_led_active, assoc_led_active;
  1086. atomic_t radio_led_active, tpt_led_active;
  1087. struct tpt_led_trigger *tpt_led_trigger;
  1088. #endif
  1089. #ifdef CONFIG_MAC80211_DEBUG_COUNTERS
  1090. /* SNMP counters */
  1091. /* dot11CountersTable */
  1092. u32 dot11TransmittedFragmentCount;
  1093. u32 dot11MulticastTransmittedFrameCount;
  1094. u32 dot11FailedCount;
  1095. u32 dot11RetryCount;
  1096. u32 dot11MultipleRetryCount;
  1097. u32 dot11FrameDuplicateCount;
  1098. u32 dot11ReceivedFragmentCount;
  1099. u32 dot11MulticastReceivedFrameCount;
  1100. u32 dot11TransmittedFrameCount;
  1101. /* TX/RX handler statistics */
  1102. unsigned int tx_handlers_drop;
  1103. unsigned int tx_handlers_queued;
  1104. unsigned int tx_handlers_drop_wep;
  1105. unsigned int tx_handlers_drop_not_assoc;
  1106. unsigned int tx_handlers_drop_unauth_port;
  1107. unsigned int rx_handlers_drop;
  1108. unsigned int rx_handlers_queued;
  1109. unsigned int rx_handlers_drop_nullfunc;
  1110. unsigned int rx_handlers_drop_defrag;
  1111. unsigned int tx_expand_skb_head;
  1112. unsigned int tx_expand_skb_head_cloned;
  1113. unsigned int rx_expand_skb_head_defrag;
  1114. unsigned int rx_handlers_fragments;
  1115. unsigned int tx_status_drop;
  1116. #define I802_DEBUG_INC(c) (c)++
  1117. #else /* CONFIG_MAC80211_DEBUG_COUNTERS */
  1118. #define I802_DEBUG_INC(c) do { } while (0)
  1119. #endif /* CONFIG_MAC80211_DEBUG_COUNTERS */
  1120. int total_ps_buffered; /* total number of all buffered unicast and
  1121. * multicast packets for power saving stations
  1122. */
  1123. bool pspolling;
  1124. bool offchannel_ps_enabled;
  1125. /*
  1126. * PS can only be enabled when we have exactly one managed
  1127. * interface (and monitors) in PS, this then points there.
  1128. */
  1129. struct ieee80211_sub_if_data *ps_sdata;
  1130. struct work_struct dynamic_ps_enable_work;
  1131. struct work_struct dynamic_ps_disable_work;
  1132. struct timer_list dynamic_ps_timer;
  1133. struct notifier_block ifa_notifier;
  1134. struct notifier_block ifa6_notifier;
  1135. /*
  1136. * The dynamic ps timeout configured from user space via WEXT -
  1137. * this will override whatever chosen by mac80211 internally.
  1138. */
  1139. int dynamic_ps_forced_timeout;
  1140. int user_power_level; /* in dBm, for all interfaces */
  1141. enum ieee80211_smps_mode smps_mode;
  1142. struct work_struct restart_work;
  1143. #ifdef CONFIG_MAC80211_DEBUGFS
  1144. struct local_debugfsdentries {
  1145. struct dentry *rcdir;
  1146. struct dentry *keys;
  1147. } debugfs;
  1148. #endif
  1149. /*
  1150. * Remain-on-channel support
  1151. */
  1152. struct delayed_work roc_work;
  1153. struct list_head roc_list;
  1154. struct work_struct hw_roc_start, hw_roc_done;
  1155. unsigned long hw_roc_start_time;
  1156. u64 roc_cookie_counter;
  1157. struct idr ack_status_frames;
  1158. spinlock_t ack_status_lock;
  1159. struct ieee80211_sub_if_data __rcu *p2p_sdata;
  1160. /* virtual monitor interface */
  1161. struct ieee80211_sub_if_data __rcu *monitor_sdata;
  1162. struct cfg80211_chan_def monitor_chandef;
  1163. /* extended capabilities provided by mac80211 */
  1164. u8 ext_capa[8];
  1165. /* TDLS channel switch */
  1166. struct work_struct tdls_chsw_work;
  1167. struct sk_buff_head skb_queue_tdls_chsw;
  1168. };
  1169. static inline struct ieee80211_sub_if_data *
  1170. IEEE80211_DEV_TO_SUB_IF(struct net_device *dev)
  1171. {
  1172. return netdev_priv(dev);
  1173. }
  1174. static inline struct ieee80211_sub_if_data *
  1175. IEEE80211_WDEV_TO_SUB_IF(struct wireless_dev *wdev)
  1176. {
  1177. return container_of(wdev, struct ieee80211_sub_if_data, wdev);
  1178. }
  1179. /* this struct represents 802.11n's RA/TID combination */
  1180. struct ieee80211_ra_tid {
  1181. u8 ra[ETH_ALEN];
  1182. u16 tid;
  1183. };
  1184. /* this struct holds the value parsing from channel switch IE */
  1185. struct ieee80211_csa_ie {
  1186. struct cfg80211_chan_def chandef;
  1187. u8 mode;
  1188. u8 count;
  1189. u8 ttl;
  1190. u16 pre_value;
  1191. };
  1192. /* Parsed Information Elements */
  1193. struct ieee802_11_elems {
  1194. const u8 *ie_start;
  1195. size_t total_len;
  1196. /* pointers to IEs */
  1197. const struct ieee80211_tdls_lnkie *lnk_id;
  1198. const struct ieee80211_ch_switch_timing *ch_sw_timing;
  1199. const u8 *ext_capab;
  1200. const u8 *ssid;
  1201. const u8 *supp_rates;
  1202. const u8 *ds_params;
  1203. const struct ieee80211_tim_ie *tim;
  1204. const u8 *challenge;
  1205. const u8 *rsn;
  1206. const u8 *erp_info;
  1207. const u8 *ext_supp_rates;
  1208. const u8 *wmm_info;
  1209. const u8 *wmm_param;
  1210. const struct ieee80211_ht_cap *ht_cap_elem;
  1211. const struct ieee80211_ht_operation *ht_operation;
  1212. const struct ieee80211_vht_cap *vht_cap_elem;
  1213. const struct ieee80211_vht_operation *vht_operation;
  1214. const struct ieee80211_meshconf_ie *mesh_config;
  1215. const u8 *mesh_id;
  1216. const u8 *peering;
  1217. const __le16 *awake_window;
  1218. const u8 *preq;
  1219. const u8 *prep;
  1220. const u8 *perr;
  1221. const struct ieee80211_rann_ie *rann;
  1222. const struct ieee80211_channel_sw_ie *ch_switch_ie;
  1223. const struct ieee80211_ext_chansw_ie *ext_chansw_ie;
  1224. const struct ieee80211_wide_bw_chansw_ie *wide_bw_chansw_ie;
  1225. const u8 *country_elem;
  1226. const u8 *pwr_constr_elem;
  1227. const u8 *cisco_dtpc_elem;
  1228. const struct ieee80211_timeout_interval_ie *timeout_int;
  1229. const u8 *opmode_notif;
  1230. const struct ieee80211_sec_chan_offs_ie *sec_chan_offs;
  1231. const struct ieee80211_mesh_chansw_params_ie *mesh_chansw_params_ie;
  1232. /* length of them, respectively */
  1233. u8 ext_capab_len;
  1234. u8 ssid_len;
  1235. u8 supp_rates_len;
  1236. u8 tim_len;
  1237. u8 challenge_len;
  1238. u8 rsn_len;
  1239. u8 ext_supp_rates_len;
  1240. u8 wmm_info_len;
  1241. u8 wmm_param_len;
  1242. u8 mesh_id_len;
  1243. u8 peering_len;
  1244. u8 preq_len;
  1245. u8 prep_len;
  1246. u8 perr_len;
  1247. u8 country_elem_len;
  1248. /* whether a parse error occurred while retrieving these elements */
  1249. bool parse_error;
  1250. };
  1251. static inline struct ieee80211_local *hw_to_local(
  1252. struct ieee80211_hw *hw)
  1253. {
  1254. return container_of(hw, struct ieee80211_local, hw);
  1255. }
  1256. static inline struct txq_info *to_txq_info(struct ieee80211_txq *txq)
  1257. {
  1258. return container_of(txq, struct txq_info, txq);
  1259. }
  1260. static inline bool txq_has_queue(struct ieee80211_txq *txq)
  1261. {
  1262. struct txq_info *txqi = to_txq_info(txq);
  1263. return !(skb_queue_empty(&txqi->frags) && !txqi->tin.backlog_packets);
  1264. }
  1265. static inline int ieee80211_bssid_match(const u8 *raddr, const u8 *addr)
  1266. {
  1267. return ether_addr_equal(raddr, addr) ||
  1268. is_broadcast_ether_addr(raddr);
  1269. }
  1270. static inline bool
  1271. ieee80211_have_rx_timestamp(struct ieee80211_rx_status *status)
  1272. {
  1273. WARN_ON_ONCE(status->flag & RX_FLAG_MACTIME_START &&
  1274. status->flag & RX_FLAG_MACTIME_END);
  1275. if (status->flag & (RX_FLAG_MACTIME_START | RX_FLAG_MACTIME_END))
  1276. return true;
  1277. /* can't handle HT/VHT preamble yet */
  1278. if (status->flag & RX_FLAG_MACTIME_PLCP_START &&
  1279. !(status->flag & (RX_FLAG_HT | RX_FLAG_VHT)))
  1280. return true;
  1281. return false;
  1282. }
  1283. void ieee80211_vif_inc_num_mcast(struct ieee80211_sub_if_data *sdata);
  1284. void ieee80211_vif_dec_num_mcast(struct ieee80211_sub_if_data *sdata);
  1285. /* This function returns the number of multicast stations connected to this
  1286. * interface. It returns -1 if that number is not tracked, that is for netdevs
  1287. * not in AP or AP_VLAN mode or when using 4addr.
  1288. */
  1289. static inline int
  1290. ieee80211_vif_get_num_mcast_if(struct ieee80211_sub_if_data *sdata)
  1291. {
  1292. if (sdata->vif.type == NL80211_IFTYPE_AP)
  1293. return atomic_read(&sdata->u.ap.num_mcast_sta);
  1294. if (sdata->vif.type == NL80211_IFTYPE_AP_VLAN && !sdata->u.vlan.sta)
  1295. return atomic_read(&sdata->u.vlan.num_mcast_sta);
  1296. return -1;
  1297. }
  1298. u64 ieee80211_calculate_rx_timestamp(struct ieee80211_local *local,
  1299. struct ieee80211_rx_status *status,
  1300. unsigned int mpdu_len,
  1301. unsigned int mpdu_offset);
  1302. int ieee80211_hw_config(struct ieee80211_local *local, u32 changed);
  1303. void ieee80211_tx_set_protected(struct ieee80211_tx_data *tx);
  1304. void ieee80211_bss_info_change_notify(struct ieee80211_sub_if_data *sdata,
  1305. u32 changed);
  1306. void ieee80211_configure_filter(struct ieee80211_local *local);
  1307. u32 ieee80211_reset_erp_info(struct ieee80211_sub_if_data *sdata);
  1308. u64 ieee80211_mgmt_tx_cookie(struct ieee80211_local *local);
  1309. int ieee80211_attach_ack_skb(struct ieee80211_local *local, struct sk_buff *skb,
  1310. u64 *cookie, gfp_t gfp);
  1311. void ieee80211_check_fast_rx(struct sta_info *sta);
  1312. void __ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
  1313. void ieee80211_check_fast_rx_iface(struct ieee80211_sub_if_data *sdata);
  1314. void ieee80211_clear_fast_rx(struct sta_info *sta);
  1315. /* STA code */
  1316. void ieee80211_sta_setup_sdata(struct ieee80211_sub_if_data *sdata);
  1317. int ieee80211_mgd_auth(struct ieee80211_sub_if_data *sdata,
  1318. struct cfg80211_auth_request *req);
  1319. int ieee80211_mgd_assoc(struct ieee80211_sub_if_data *sdata,
  1320. struct cfg80211_assoc_request *req);
  1321. int ieee80211_mgd_deauth(struct ieee80211_sub_if_data *sdata,
  1322. struct cfg80211_deauth_request *req);
  1323. int ieee80211_mgd_disassoc(struct ieee80211_sub_if_data *sdata,
  1324. struct cfg80211_disassoc_request *req);
  1325. void ieee80211_send_pspoll(struct ieee80211_local *local,
  1326. struct ieee80211_sub_if_data *sdata);
  1327. void ieee80211_recalc_ps(struct ieee80211_local *local);
  1328. void ieee80211_recalc_ps_vif(struct ieee80211_sub_if_data *sdata);
  1329. int ieee80211_set_arp_filter(struct ieee80211_sub_if_data *sdata);
  1330. void ieee80211_sta_work(struct ieee80211_sub_if_data *sdata);
  1331. void ieee80211_sta_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  1332. struct sk_buff *skb);
  1333. void ieee80211_sta_reset_beacon_monitor(struct ieee80211_sub_if_data *sdata);
  1334. void ieee80211_sta_reset_conn_monitor(struct ieee80211_sub_if_data *sdata);
  1335. void ieee80211_mgd_stop(struct ieee80211_sub_if_data *sdata);
  1336. void ieee80211_mgd_conn_tx_status(struct ieee80211_sub_if_data *sdata,
  1337. __le16 fc, bool acked);
  1338. void ieee80211_mgd_quiesce(struct ieee80211_sub_if_data *sdata);
  1339. void ieee80211_sta_restart(struct ieee80211_sub_if_data *sdata);
  1340. void ieee80211_sta_handle_tspec_ac_params(struct ieee80211_sub_if_data *sdata);
  1341. /* IBSS code */
  1342. void ieee80211_ibss_notify_scan_completed(struct ieee80211_local *local);
  1343. void ieee80211_ibss_setup_sdata(struct ieee80211_sub_if_data *sdata);
  1344. void ieee80211_ibss_rx_no_sta(struct ieee80211_sub_if_data *sdata,
  1345. const u8 *bssid, const u8 *addr, u32 supp_rates);
  1346. int ieee80211_ibss_join(struct ieee80211_sub_if_data *sdata,
  1347. struct cfg80211_ibss_params *params);
  1348. int ieee80211_ibss_leave(struct ieee80211_sub_if_data *sdata);
  1349. void ieee80211_ibss_work(struct ieee80211_sub_if_data *sdata);
  1350. void ieee80211_ibss_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  1351. struct sk_buff *skb);
  1352. int ieee80211_ibss_csa_beacon(struct ieee80211_sub_if_data *sdata,
  1353. struct cfg80211_csa_settings *csa_settings);
  1354. int ieee80211_ibss_finish_csa(struct ieee80211_sub_if_data *sdata);
  1355. void ieee80211_ibss_stop(struct ieee80211_sub_if_data *sdata);
  1356. /* OCB code */
  1357. void ieee80211_ocb_work(struct ieee80211_sub_if_data *sdata);
  1358. void ieee80211_ocb_rx_no_sta(struct ieee80211_sub_if_data *sdata,
  1359. const u8 *bssid, const u8 *addr, u32 supp_rates);
  1360. void ieee80211_ocb_setup_sdata(struct ieee80211_sub_if_data *sdata);
  1361. int ieee80211_ocb_join(struct ieee80211_sub_if_data *sdata,
  1362. struct ocb_setup *setup);
  1363. int ieee80211_ocb_leave(struct ieee80211_sub_if_data *sdata);
  1364. /* mesh code */
  1365. void ieee80211_mesh_work(struct ieee80211_sub_if_data *sdata);
  1366. void ieee80211_mesh_rx_queued_mgmt(struct ieee80211_sub_if_data *sdata,
  1367. struct sk_buff *skb);
  1368. int ieee80211_mesh_csa_beacon(struct ieee80211_sub_if_data *sdata,
  1369. struct cfg80211_csa_settings *csa_settings);
  1370. int ieee80211_mesh_finish_csa(struct ieee80211_sub_if_data *sdata);
  1371. /* scan/BSS handling */
  1372. void ieee80211_scan_work(struct work_struct *work);
  1373. int ieee80211_request_ibss_scan(struct ieee80211_sub_if_data *sdata,
  1374. const u8 *ssid, u8 ssid_len,
  1375. struct ieee80211_channel **channels,
  1376. unsigned int n_channels,
  1377. enum nl80211_bss_scan_width scan_width);
  1378. int ieee80211_request_scan(struct ieee80211_sub_if_data *sdata,
  1379. struct cfg80211_scan_request *req);
  1380. void ieee80211_scan_cancel(struct ieee80211_local *local);
  1381. void ieee80211_run_deferred_scan(struct ieee80211_local *local);
  1382. void ieee80211_scan_rx(struct ieee80211_local *local, struct sk_buff *skb);
  1383. void ieee80211_mlme_notify_scan_completed(struct ieee80211_local *local);
  1384. struct ieee80211_bss *
  1385. ieee80211_bss_info_update(struct ieee80211_local *local,
  1386. struct ieee80211_rx_status *rx_status,
  1387. struct ieee80211_mgmt *mgmt,
  1388. size_t len,
  1389. struct ieee802_11_elems *elems,
  1390. struct ieee80211_channel *channel);
  1391. void ieee80211_rx_bss_put(struct ieee80211_local *local,
  1392. struct ieee80211_bss *bss);
  1393. /* scheduled scan handling */
  1394. int
  1395. __ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
  1396. struct cfg80211_sched_scan_request *req);
  1397. int ieee80211_request_sched_scan_start(struct ieee80211_sub_if_data *sdata,
  1398. struct cfg80211_sched_scan_request *req);
  1399. int ieee80211_request_sched_scan_stop(struct ieee80211_local *local);
  1400. void ieee80211_sched_scan_end(struct ieee80211_local *local);
  1401. void ieee80211_sched_scan_stopped_work(struct work_struct *work);
  1402. /* off-channel/mgmt-tx */
  1403. void ieee80211_offchannel_stop_vifs(struct ieee80211_local *local);
  1404. void ieee80211_offchannel_return(struct ieee80211_local *local);
  1405. void ieee80211_roc_setup(struct ieee80211_local *local);
  1406. void ieee80211_start_next_roc(struct ieee80211_local *local);
  1407. void ieee80211_roc_purge(struct ieee80211_local *local,
  1408. struct ieee80211_sub_if_data *sdata);
  1409. int ieee80211_remain_on_channel(struct wiphy *wiphy, struct wireless_dev *wdev,
  1410. struct ieee80211_channel *chan,
  1411. unsigned int duration, u64 *cookie);
  1412. int ieee80211_cancel_remain_on_channel(struct wiphy *wiphy,
  1413. struct wireless_dev *wdev, u64 cookie);
  1414. int ieee80211_mgmt_tx(struct wiphy *wiphy, struct wireless_dev *wdev,
  1415. struct cfg80211_mgmt_tx_params *params, u64 *cookie);
  1416. int ieee80211_mgmt_tx_cancel_wait(struct wiphy *wiphy,
  1417. struct wireless_dev *wdev, u64 cookie);
  1418. /* channel switch handling */
  1419. void ieee80211_csa_finalize_work(struct work_struct *work);
  1420. int ieee80211_channel_switch(struct wiphy *wiphy, struct net_device *dev,
  1421. struct cfg80211_csa_settings *params);
  1422. /* interface handling */
  1423. int ieee80211_iface_init(void);
  1424. void ieee80211_iface_exit(void);
  1425. int ieee80211_if_add(struct ieee80211_local *local, const char *name,
  1426. unsigned char name_assign_type,
  1427. struct wireless_dev **new_wdev, enum nl80211_iftype type,
  1428. struct vif_params *params);
  1429. int ieee80211_if_change_type(struct ieee80211_sub_if_data *sdata,
  1430. enum nl80211_iftype type);
  1431. void ieee80211_if_remove(struct ieee80211_sub_if_data *sdata);
  1432. void ieee80211_remove_interfaces(struct ieee80211_local *local);
  1433. u32 ieee80211_idle_off(struct ieee80211_local *local);
  1434. void ieee80211_recalc_idle(struct ieee80211_local *local);
  1435. void ieee80211_adjust_monitor_flags(struct ieee80211_sub_if_data *sdata,
  1436. const int offset);
  1437. int ieee80211_do_open(struct wireless_dev *wdev, bool coming_up);
  1438. void ieee80211_sdata_stop(struct ieee80211_sub_if_data *sdata);
  1439. int ieee80211_add_virtual_monitor(struct ieee80211_local *local);
  1440. void ieee80211_del_virtual_monitor(struct ieee80211_local *local);
  1441. bool __ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata);
  1442. void ieee80211_recalc_txpower(struct ieee80211_sub_if_data *sdata,
  1443. bool update_bss);
  1444. static inline bool ieee80211_sdata_running(struct ieee80211_sub_if_data *sdata)
  1445. {
  1446. return test_bit(SDATA_STATE_RUNNING, &sdata->state);
  1447. }
  1448. /* tx handling */
  1449. void ieee80211_clear_tx_pending(struct ieee80211_local *local);
  1450. void ieee80211_tx_pending(unsigned long data);
  1451. netdev_tx_t ieee80211_monitor_start_xmit(struct sk_buff *skb,
  1452. struct net_device *dev);
  1453. netdev_tx_t ieee80211_subif_start_xmit(struct sk_buff *skb,
  1454. struct net_device *dev);
  1455. void __ieee80211_subif_start_xmit(struct sk_buff *skb,
  1456. struct net_device *dev,
  1457. u32 info_flags);
  1458. void ieee80211_purge_tx_queue(struct ieee80211_hw *hw,
  1459. struct sk_buff_head *skbs);
  1460. struct sk_buff *
  1461. ieee80211_build_data_template(struct ieee80211_sub_if_data *sdata,
  1462. struct sk_buff *skb, u32 info_flags);
  1463. void ieee80211_tx_monitor(struct ieee80211_local *local, struct sk_buff *skb,
  1464. struct ieee80211_supported_band *sband,
  1465. int retry_count, int shift, bool send_to_cooked);
  1466. void ieee80211_check_fast_xmit(struct sta_info *sta);
  1467. void ieee80211_check_fast_xmit_all(struct ieee80211_local *local);
  1468. void ieee80211_check_fast_xmit_iface(struct ieee80211_sub_if_data *sdata);
  1469. void ieee80211_clear_fast_xmit(struct sta_info *sta);
  1470. /* HT */
  1471. void ieee80211_apply_htcap_overrides(struct ieee80211_sub_if_data *sdata,
  1472. struct ieee80211_sta_ht_cap *ht_cap);
  1473. bool ieee80211_ht_cap_ie_to_sta_ht_cap(struct ieee80211_sub_if_data *sdata,
  1474. struct ieee80211_supported_band *sband,
  1475. const struct ieee80211_ht_cap *ht_cap_ie,
  1476. struct sta_info *sta);
  1477. void ieee80211_send_delba(struct ieee80211_sub_if_data *sdata,
  1478. const u8 *da, u16 tid,
  1479. u16 initiator, u16 reason_code);
  1480. int ieee80211_send_smps_action(struct ieee80211_sub_if_data *sdata,
  1481. enum ieee80211_smps_mode smps, const u8 *da,
  1482. const u8 *bssid);
  1483. void ieee80211_request_smps_ap_work(struct work_struct *work);
  1484. void ieee80211_request_smps_mgd_work(struct work_struct *work);
  1485. bool ieee80211_smps_is_restrictive(enum ieee80211_smps_mode smps_mode_old,
  1486. enum ieee80211_smps_mode smps_mode_new);
  1487. void ___ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
  1488. u16 initiator, u16 reason, bool stop);
  1489. void __ieee80211_stop_rx_ba_session(struct sta_info *sta, u16 tid,
  1490. u16 initiator, u16 reason, bool stop);
  1491. void __ieee80211_start_rx_ba_session(struct sta_info *sta,
  1492. u8 dialog_token, u16 timeout,
  1493. u16 start_seq_num, u16 ba_policy, u16 tid,
  1494. u16 buf_size, bool tx, bool auto_seq);
  1495. void ieee80211_sta_tear_down_BA_sessions(struct sta_info *sta,
  1496. enum ieee80211_agg_stop_reason reason);
  1497. void ieee80211_process_delba(struct ieee80211_sub_if_data *sdata,
  1498. struct sta_info *sta,
  1499. struct ieee80211_mgmt *mgmt, size_t len);
  1500. void ieee80211_process_addba_resp(struct ieee80211_local *local,
  1501. struct sta_info *sta,
  1502. struct ieee80211_mgmt *mgmt,
  1503. size_t len);
  1504. void ieee80211_process_addba_request(struct ieee80211_local *local,
  1505. struct sta_info *sta,
  1506. struct ieee80211_mgmt *mgmt,
  1507. size_t len);
  1508. int __ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
  1509. enum ieee80211_agg_stop_reason reason);
  1510. int ___ieee80211_stop_tx_ba_session(struct sta_info *sta, u16 tid,
  1511. enum ieee80211_agg_stop_reason reason);
  1512. void ieee80211_start_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u16 tid);
  1513. void ieee80211_stop_tx_ba_cb(struct ieee80211_vif *vif, u8 *ra, u8 tid);
  1514. void ieee80211_ba_session_work(struct work_struct *work);
  1515. void ieee80211_tx_ba_session_handle_start(struct sta_info *sta, int tid);
  1516. void ieee80211_release_reorder_timeout(struct sta_info *sta, int tid);
  1517. u8 ieee80211_mcs_to_chains(const struct ieee80211_mcs_info *mcs);
  1518. /* VHT */
  1519. void
  1520. ieee80211_vht_cap_ie_to_sta_vht_cap(struct ieee80211_sub_if_data *sdata,
  1521. struct ieee80211_supported_band *sband,
  1522. const struct ieee80211_vht_cap *vht_cap_ie,
  1523. struct sta_info *sta);
  1524. enum ieee80211_sta_rx_bandwidth ieee80211_sta_cap_rx_bw(struct sta_info *sta);
  1525. enum ieee80211_sta_rx_bandwidth ieee80211_sta_cur_vht_bw(struct sta_info *sta);
  1526. void ieee80211_sta_set_rx_nss(struct sta_info *sta);
  1527. enum ieee80211_sta_rx_bandwidth
  1528. ieee80211_chan_width_to_rx_bw(enum nl80211_chan_width width);
  1529. enum nl80211_chan_width ieee80211_sta_cap_chan_bw(struct sta_info *sta);
  1530. void ieee80211_sta_set_rx_nss(struct sta_info *sta);
  1531. void ieee80211_process_mu_groups(struct ieee80211_sub_if_data *sdata,
  1532. struct ieee80211_mgmt *mgmt);
  1533. u32 __ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
  1534. struct sta_info *sta, u8 opmode,
  1535. enum nl80211_band band);
  1536. void ieee80211_vht_handle_opmode(struct ieee80211_sub_if_data *sdata,
  1537. struct sta_info *sta, u8 opmode,
  1538. enum nl80211_band band);
  1539. void ieee80211_apply_vhtcap_overrides(struct ieee80211_sub_if_data *sdata,
  1540. struct ieee80211_sta_vht_cap *vht_cap);
  1541. void ieee80211_get_vht_mask_from_cap(__le16 vht_cap,
  1542. u16 vht_mask[NL80211_VHT_NSS_MAX]);
  1543. /* Spectrum management */
  1544. void ieee80211_process_measurement_req(struct ieee80211_sub_if_data *sdata,
  1545. struct ieee80211_mgmt *mgmt,
  1546. size_t len);
  1547. /**
  1548. * ieee80211_parse_ch_switch_ie - parses channel switch IEs
  1549. * @sdata: the sdata of the interface which has received the frame
  1550. * @elems: parsed 802.11 elements received with the frame
  1551. * @current_band: indicates the current band
  1552. * @sta_flags: contains information about own capabilities and restrictions
  1553. * to decide which channel switch announcements can be accepted. Only the
  1554. * following subset of &enum ieee80211_sta_flags are evaluated:
  1555. * %IEEE80211_STA_DISABLE_HT, %IEEE80211_STA_DISABLE_VHT,
  1556. * %IEEE80211_STA_DISABLE_40MHZ, %IEEE80211_STA_DISABLE_80P80MHZ,
  1557. * %IEEE80211_STA_DISABLE_160MHZ.
  1558. * @bssid: the currently connected bssid (for reporting)
  1559. * @csa_ie: parsed 802.11 csa elements on count, mode, chandef and mesh ttl.
  1560. All of them will be filled with if success only.
  1561. * Return: 0 on success, <0 on error and >0 if there is nothing to parse.
  1562. */
  1563. int ieee80211_parse_ch_switch_ie(struct ieee80211_sub_if_data *sdata,
  1564. struct ieee802_11_elems *elems,
  1565. enum nl80211_band current_band,
  1566. u32 sta_flags, u8 *bssid,
  1567. struct ieee80211_csa_ie *csa_ie);
  1568. /* Suspend/resume and hw reconfiguration */
  1569. int ieee80211_reconfig(struct ieee80211_local *local);
  1570. void ieee80211_stop_device(struct ieee80211_local *local);
  1571. int __ieee80211_suspend(struct ieee80211_hw *hw,
  1572. struct cfg80211_wowlan *wowlan);
  1573. static inline int __ieee80211_resume(struct ieee80211_hw *hw)
  1574. {
  1575. struct ieee80211_local *local = hw_to_local(hw);
  1576. WARN(test_bit(SCAN_HW_SCANNING, &local->scanning) &&
  1577. !test_bit(SCAN_COMPLETED, &local->scanning),
  1578. "%s: resume with hardware scan still in progress\n",
  1579. wiphy_name(hw->wiphy));
  1580. return ieee80211_reconfig(hw_to_local(hw));
  1581. }
  1582. /* utility functions/constants */
  1583. extern const void *const mac80211_wiphy_privid; /* for wiphy privid */
  1584. int ieee80211_frame_duration(enum nl80211_band band, size_t len,
  1585. int rate, int erp, int short_preamble,
  1586. int shift);
  1587. void ieee80211_set_wmm_default(struct ieee80211_sub_if_data *sdata,
  1588. bool bss_notify, bool enable_qos);
  1589. void ieee80211_xmit(struct ieee80211_sub_if_data *sdata,
  1590. struct sta_info *sta, struct sk_buff *skb);
  1591. void __ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  1592. struct sk_buff *skb, int tid,
  1593. enum nl80211_band band);
  1594. static inline void
  1595. ieee80211_tx_skb_tid_band(struct ieee80211_sub_if_data *sdata,
  1596. struct sk_buff *skb, int tid,
  1597. enum nl80211_band band)
  1598. {
  1599. rcu_read_lock();
  1600. __ieee80211_tx_skb_tid_band(sdata, skb, tid, band);
  1601. rcu_read_unlock();
  1602. }
  1603. static inline void ieee80211_tx_skb_tid(struct ieee80211_sub_if_data *sdata,
  1604. struct sk_buff *skb, int tid)
  1605. {
  1606. struct ieee80211_chanctx_conf *chanctx_conf;
  1607. rcu_read_lock();
  1608. chanctx_conf = rcu_dereference(sdata->vif.chanctx_conf);
  1609. if (WARN_ON(!chanctx_conf)) {
  1610. rcu_read_unlock();
  1611. kfree_skb(skb);
  1612. return;
  1613. }
  1614. __ieee80211_tx_skb_tid_band(sdata, skb, tid,
  1615. chanctx_conf->def.chan->band);
  1616. rcu_read_unlock();
  1617. }
  1618. static inline void ieee80211_tx_skb(struct ieee80211_sub_if_data *sdata,
  1619. struct sk_buff *skb)
  1620. {
  1621. /* Send all internal mgmt frames on VO. Accordingly set TID to 7. */
  1622. ieee80211_tx_skb_tid(sdata, skb, 7);
  1623. }
  1624. u32 ieee802_11_parse_elems_crc(const u8 *start, size_t len, bool action,
  1625. struct ieee802_11_elems *elems,
  1626. u64 filter, u32 crc);
  1627. static inline void ieee802_11_parse_elems(const u8 *start, size_t len,
  1628. bool action,
  1629. struct ieee802_11_elems *elems)
  1630. {
  1631. ieee802_11_parse_elems_crc(start, len, action, elems, 0, 0);
  1632. }
  1633. extern const int ieee802_1d_to_ac[8];
  1634. static inline int ieee80211_ac_from_tid(int tid)
  1635. {
  1636. return ieee802_1d_to_ac[tid & 7];
  1637. }
  1638. void ieee80211_dynamic_ps_enable_work(struct work_struct *work);
  1639. void ieee80211_dynamic_ps_disable_work(struct work_struct *work);
  1640. void ieee80211_dynamic_ps_timer(unsigned long data);
  1641. void ieee80211_send_nullfunc(struct ieee80211_local *local,
  1642. struct ieee80211_sub_if_data *sdata,
  1643. bool powersave);
  1644. void ieee80211_sta_rx_notify(struct ieee80211_sub_if_data *sdata,
  1645. struct ieee80211_hdr *hdr);
  1646. void ieee80211_sta_tx_notify(struct ieee80211_sub_if_data *sdata,
  1647. struct ieee80211_hdr *hdr, bool ack, u16 tx_time);
  1648. void ieee80211_wake_queues_by_reason(struct ieee80211_hw *hw,
  1649. unsigned long queues,
  1650. enum queue_stop_reason reason,
  1651. bool refcounted);
  1652. void ieee80211_stop_vif_queues(struct ieee80211_local *local,
  1653. struct ieee80211_sub_if_data *sdata,
  1654. enum queue_stop_reason reason);
  1655. void ieee80211_wake_vif_queues(struct ieee80211_local *local,
  1656. struct ieee80211_sub_if_data *sdata,
  1657. enum queue_stop_reason reason);
  1658. void ieee80211_stop_queues_by_reason(struct ieee80211_hw *hw,
  1659. unsigned long queues,
  1660. enum queue_stop_reason reason,
  1661. bool refcounted);
  1662. void ieee80211_wake_queue_by_reason(struct ieee80211_hw *hw, int queue,
  1663. enum queue_stop_reason reason,
  1664. bool refcounted);
  1665. void ieee80211_stop_queue_by_reason(struct ieee80211_hw *hw, int queue,
  1666. enum queue_stop_reason reason,
  1667. bool refcounted);
  1668. void ieee80211_propagate_queue_wake(struct ieee80211_local *local, int queue);
  1669. void ieee80211_add_pending_skb(struct ieee80211_local *local,
  1670. struct sk_buff *skb);
  1671. void ieee80211_add_pending_skbs(struct ieee80211_local *local,
  1672. struct sk_buff_head *skbs);
  1673. void ieee80211_flush_queues(struct ieee80211_local *local,
  1674. struct ieee80211_sub_if_data *sdata, bool drop);
  1675. void __ieee80211_flush_queues(struct ieee80211_local *local,
  1676. struct ieee80211_sub_if_data *sdata,
  1677. unsigned int queues, bool drop);
  1678. static inline bool ieee80211_can_run_worker(struct ieee80211_local *local)
  1679. {
  1680. /*
  1681. * If quiescing is set, we are racing with __ieee80211_suspend.
  1682. * __ieee80211_suspend flushes the workers after setting quiescing,
  1683. * and we check quiescing / suspended before enqueing new workers.
  1684. * We should abort the worker to avoid the races below.
  1685. */
  1686. if (local->quiescing)
  1687. return false;
  1688. /*
  1689. * We might already be suspended if the following scenario occurs:
  1690. * __ieee80211_suspend Control path
  1691. *
  1692. * if (local->quiescing)
  1693. * return;
  1694. * local->quiescing = true;
  1695. * flush_workqueue();
  1696. * queue_work(...);
  1697. * local->suspended = true;
  1698. * local->quiescing = false;
  1699. * worker starts running...
  1700. */
  1701. if (local->suspended)
  1702. return false;
  1703. return true;
  1704. }
  1705. int ieee80211_txq_setup_flows(struct ieee80211_local *local);
  1706. void ieee80211_txq_teardown_flows(struct ieee80211_local *local);
  1707. void ieee80211_txq_init(struct ieee80211_sub_if_data *sdata,
  1708. struct sta_info *sta,
  1709. struct txq_info *txq, int tid);
  1710. void ieee80211_txq_purge(struct ieee80211_local *local,
  1711. struct txq_info *txqi);
  1712. void ieee80211_send_auth(struct ieee80211_sub_if_data *sdata,
  1713. u16 transaction, u16 auth_alg, u16 status,
  1714. const u8 *extra, size_t extra_len, const u8 *bssid,
  1715. const u8 *da, const u8 *key, u8 key_len, u8 key_idx,
  1716. u32 tx_flags);
  1717. void ieee80211_send_deauth_disassoc(struct ieee80211_sub_if_data *sdata,
  1718. const u8 *bssid, u16 stype, u16 reason,
  1719. bool send_frame, u8 *frame_buf);
  1720. int ieee80211_build_preq_ies(struct ieee80211_local *local, u8 *buffer,
  1721. size_t buffer_len,
  1722. struct ieee80211_scan_ies *ie_desc,
  1723. const u8 *ie, size_t ie_len,
  1724. u8 bands_used, u32 *rate_masks,
  1725. struct cfg80211_chan_def *chandef);
  1726. struct sk_buff *ieee80211_build_probe_req(struct ieee80211_sub_if_data *sdata,
  1727. const u8 *src, const u8 *dst,
  1728. u32 ratemask,
  1729. struct ieee80211_channel *chan,
  1730. const u8 *ssid, size_t ssid_len,
  1731. const u8 *ie, size_t ie_len,
  1732. bool directed);
  1733. void ieee80211_send_probe_req(struct ieee80211_sub_if_data *sdata,
  1734. const u8 *src, const u8 *dst,
  1735. const u8 *ssid, size_t ssid_len,
  1736. const u8 *ie, size_t ie_len,
  1737. u32 ratemask, bool directed, u32 tx_flags,
  1738. struct ieee80211_channel *channel, bool scan);
  1739. u32 ieee80211_sta_get_rates(struct ieee80211_sub_if_data *sdata,
  1740. struct ieee802_11_elems *elems,
  1741. enum nl80211_band band, u32 *basic_rates);
  1742. int __ieee80211_request_smps_mgd(struct ieee80211_sub_if_data *sdata,
  1743. enum ieee80211_smps_mode smps_mode);
  1744. int __ieee80211_request_smps_ap(struct ieee80211_sub_if_data *sdata,
  1745. enum ieee80211_smps_mode smps_mode);
  1746. void ieee80211_recalc_smps(struct ieee80211_sub_if_data *sdata);
  1747. void ieee80211_recalc_min_chandef(struct ieee80211_sub_if_data *sdata);
  1748. size_t ieee80211_ie_split_vendor(const u8 *ies, size_t ielen, size_t offset);
  1749. u8 *ieee80211_ie_build_ht_cap(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
  1750. u16 cap);
  1751. u8 *ieee80211_ie_build_ht_oper(u8 *pos, struct ieee80211_sta_ht_cap *ht_cap,
  1752. const struct cfg80211_chan_def *chandef,
  1753. u16 prot_mode, bool rifs_mode);
  1754. u8 *ieee80211_ie_build_vht_cap(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
  1755. u32 cap);
  1756. u8 *ieee80211_ie_build_vht_oper(u8 *pos, struct ieee80211_sta_vht_cap *vht_cap,
  1757. const struct cfg80211_chan_def *chandef);
  1758. int ieee80211_parse_bitrates(struct cfg80211_chan_def *chandef,
  1759. const struct ieee80211_supported_band *sband,
  1760. const u8 *srates, int srates_len, u32 *rates);
  1761. int ieee80211_add_srates_ie(struct ieee80211_sub_if_data *sdata,
  1762. struct sk_buff *skb, bool need_basic,
  1763. enum nl80211_band band);
  1764. int ieee80211_add_ext_srates_ie(struct ieee80211_sub_if_data *sdata,
  1765. struct sk_buff *skb, bool need_basic,
  1766. enum nl80211_band band);
  1767. u8 *ieee80211_add_wmm_info_ie(u8 *buf, u8 qosinfo);
  1768. /* channel management */
  1769. bool ieee80211_chandef_ht_oper(const struct ieee80211_ht_operation *ht_oper,
  1770. struct cfg80211_chan_def *chandef);
  1771. bool ieee80211_chandef_vht_oper(const struct ieee80211_vht_operation *oper,
  1772. struct cfg80211_chan_def *chandef);
  1773. u32 ieee80211_chandef_downgrade(struct cfg80211_chan_def *c);
  1774. int __must_check
  1775. ieee80211_vif_use_channel(struct ieee80211_sub_if_data *sdata,
  1776. const struct cfg80211_chan_def *chandef,
  1777. enum ieee80211_chanctx_mode mode);
  1778. int __must_check
  1779. ieee80211_vif_reserve_chanctx(struct ieee80211_sub_if_data *sdata,
  1780. const struct cfg80211_chan_def *chandef,
  1781. enum ieee80211_chanctx_mode mode,
  1782. bool radar_required);
  1783. int __must_check
  1784. ieee80211_vif_use_reserved_context(struct ieee80211_sub_if_data *sdata);
  1785. int ieee80211_vif_unreserve_chanctx(struct ieee80211_sub_if_data *sdata);
  1786. int __must_check
  1787. ieee80211_vif_change_bandwidth(struct ieee80211_sub_if_data *sdata,
  1788. const struct cfg80211_chan_def *chandef,
  1789. u32 *changed);
  1790. void ieee80211_vif_release_channel(struct ieee80211_sub_if_data *sdata);
  1791. void ieee80211_vif_vlan_copy_chanctx(struct ieee80211_sub_if_data *sdata);
  1792. void ieee80211_vif_copy_chanctx_to_vlans(struct ieee80211_sub_if_data *sdata,
  1793. bool clear);
  1794. int ieee80211_chanctx_refcount(struct ieee80211_local *local,
  1795. struct ieee80211_chanctx *ctx);
  1796. void ieee80211_recalc_smps_chanctx(struct ieee80211_local *local,
  1797. struct ieee80211_chanctx *chanctx);
  1798. void ieee80211_recalc_chanctx_min_def(struct ieee80211_local *local,
  1799. struct ieee80211_chanctx *ctx);
  1800. bool ieee80211_is_radar_required(struct ieee80211_local *local);
  1801. void ieee80211_dfs_cac_timer(unsigned long data);
  1802. void ieee80211_dfs_cac_timer_work(struct work_struct *work);
  1803. void ieee80211_dfs_cac_cancel(struct ieee80211_local *local);
  1804. void ieee80211_dfs_radar_detected_work(struct work_struct *work);
  1805. int ieee80211_send_action_csa(struct ieee80211_sub_if_data *sdata,
  1806. struct cfg80211_csa_settings *csa_settings);
  1807. bool ieee80211_cs_valid(const struct ieee80211_cipher_scheme *cs);
  1808. bool ieee80211_cs_list_valid(const struct ieee80211_cipher_scheme *cs, int n);
  1809. const struct ieee80211_cipher_scheme *
  1810. ieee80211_cs_get(struct ieee80211_local *local, u32 cipher,
  1811. enum nl80211_iftype iftype);
  1812. int ieee80211_cs_headroom(struct ieee80211_local *local,
  1813. struct cfg80211_crypto_settings *crypto,
  1814. enum nl80211_iftype iftype);
  1815. void ieee80211_recalc_dtim(struct ieee80211_local *local,
  1816. struct ieee80211_sub_if_data *sdata);
  1817. int ieee80211_check_combinations(struct ieee80211_sub_if_data *sdata,
  1818. const struct cfg80211_chan_def *chandef,
  1819. enum ieee80211_chanctx_mode chanmode,
  1820. u8 radar_detect);
  1821. int ieee80211_max_num_channels(struct ieee80211_local *local);
  1822. enum nl80211_chan_width ieee80211_get_sta_bw(struct ieee80211_sta *sta);
  1823. void ieee80211_recalc_chanctx_chantype(struct ieee80211_local *local,
  1824. struct ieee80211_chanctx *ctx);
  1825. /* TDLS */
  1826. int ieee80211_tdls_mgmt(struct wiphy *wiphy, struct net_device *dev,
  1827. const u8 *peer, u8 action_code, u8 dialog_token,
  1828. u16 status_code, u32 peer_capability,
  1829. bool initiator, const u8 *extra_ies,
  1830. size_t extra_ies_len);
  1831. int ieee80211_tdls_oper(struct wiphy *wiphy, struct net_device *dev,
  1832. const u8 *peer, enum nl80211_tdls_operation oper);
  1833. void ieee80211_tdls_peer_del_work(struct work_struct *wk);
  1834. int ieee80211_tdls_channel_switch(struct wiphy *wiphy, struct net_device *dev,
  1835. const u8 *addr, u8 oper_class,
  1836. struct cfg80211_chan_def *chandef);
  1837. void ieee80211_tdls_cancel_channel_switch(struct wiphy *wiphy,
  1838. struct net_device *dev,
  1839. const u8 *addr);
  1840. void ieee80211_teardown_tdls_peers(struct ieee80211_sub_if_data *sdata);
  1841. void ieee80211_tdls_chsw_work(struct work_struct *wk);
  1842. extern const struct ethtool_ops ieee80211_ethtool_ops;
  1843. #ifdef CONFIG_MAC80211_NOINLINE
  1844. #define debug_noinline noinline
  1845. #else
  1846. #define debug_noinline
  1847. #endif
  1848. #endif /* IEEE80211_I_H */