ieee80211.h 77 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634
  1. /*
  2. * IEEE 802.11 defines
  3. *
  4. * Copyright (c) 2001-2002, SSH Communications Security Corp and Jouni Malinen
  5. * <jkmaline@cc.hut.fi>
  6. * Copyright (c) 2002-2003, Jouni Malinen <jkmaline@cc.hut.fi>
  7. * Copyright (c) 2005, Devicescape Software, Inc.
  8. * Copyright (c) 2006, Michael Wu <flamingice@sourmilk.net>
  9. * Copyright (c) 2013 - 2014 Intel Mobile Communications GmbH
  10. * Copyright (c) 2016 Intel Deutschland GmbH
  11. *
  12. * This program is free software; you can redistribute it and/or modify
  13. * it under the terms of the GNU General Public License version 2 as
  14. * published by the Free Software Foundation.
  15. */
  16. #ifndef LINUX_IEEE80211_H
  17. #define LINUX_IEEE80211_H
  18. #include <linux/types.h>
  19. #include <linux/if_ether.h>
  20. #include <linux/etherdevice.h>
  21. #include <asm/byteorder.h>
  22. #include <asm/unaligned.h>
  23. /*
  24. * DS bit usage
  25. *
  26. * TA = transmitter address
  27. * RA = receiver address
  28. * DA = destination address
  29. * SA = source address
  30. *
  31. * ToDS FromDS A1(RA) A2(TA) A3 A4 Use
  32. * -----------------------------------------------------------------
  33. * 0 0 DA SA BSSID - IBSS/DLS
  34. * 0 1 DA BSSID SA - AP -> STA
  35. * 1 0 BSSID SA DA - AP <- STA
  36. * 1 1 RA TA DA SA unspecified (WDS)
  37. */
  38. #define FCS_LEN 4
  39. #define IEEE80211_FCTL_VERS 0x0003
  40. #define IEEE80211_FCTL_FTYPE 0x000c
  41. #define IEEE80211_FCTL_STYPE 0x00f0
  42. #define IEEE80211_FCTL_TODS 0x0100
  43. #define IEEE80211_FCTL_FROMDS 0x0200
  44. #define IEEE80211_FCTL_MOREFRAGS 0x0400
  45. #define IEEE80211_FCTL_RETRY 0x0800
  46. #define IEEE80211_FCTL_PM 0x1000
  47. #define IEEE80211_FCTL_MOREDATA 0x2000
  48. #define IEEE80211_FCTL_PROTECTED 0x4000
  49. #define IEEE80211_FCTL_ORDER 0x8000
  50. #define IEEE80211_FCTL_CTL_EXT 0x0f00
  51. #define IEEE80211_SCTL_FRAG 0x000F
  52. #define IEEE80211_SCTL_SEQ 0xFFF0
  53. #define IEEE80211_FTYPE_MGMT 0x0000
  54. #define IEEE80211_FTYPE_CTL 0x0004
  55. #define IEEE80211_FTYPE_DATA 0x0008
  56. #define IEEE80211_FTYPE_EXT 0x000c
  57. /* management */
  58. #define IEEE80211_STYPE_ASSOC_REQ 0x0000
  59. #define IEEE80211_STYPE_ASSOC_RESP 0x0010
  60. #define IEEE80211_STYPE_REASSOC_REQ 0x0020
  61. #define IEEE80211_STYPE_REASSOC_RESP 0x0030
  62. #define IEEE80211_STYPE_PROBE_REQ 0x0040
  63. #define IEEE80211_STYPE_PROBE_RESP 0x0050
  64. #define IEEE80211_STYPE_BEACON 0x0080
  65. #define IEEE80211_STYPE_ATIM 0x0090
  66. #define IEEE80211_STYPE_DISASSOC 0x00A0
  67. #define IEEE80211_STYPE_AUTH 0x00B0
  68. #define IEEE80211_STYPE_DEAUTH 0x00C0
  69. #define IEEE80211_STYPE_ACTION 0x00D0
  70. /* control */
  71. #define IEEE80211_STYPE_CTL_EXT 0x0060
  72. #define IEEE80211_STYPE_BACK_REQ 0x0080
  73. #define IEEE80211_STYPE_BACK 0x0090
  74. #define IEEE80211_STYPE_PSPOLL 0x00A0
  75. #define IEEE80211_STYPE_RTS 0x00B0
  76. #define IEEE80211_STYPE_CTS 0x00C0
  77. #define IEEE80211_STYPE_ACK 0x00D0
  78. #define IEEE80211_STYPE_CFEND 0x00E0
  79. #define IEEE80211_STYPE_CFENDACK 0x00F0
  80. /* data */
  81. #define IEEE80211_STYPE_DATA 0x0000
  82. #define IEEE80211_STYPE_DATA_CFACK 0x0010
  83. #define IEEE80211_STYPE_DATA_CFPOLL 0x0020
  84. #define IEEE80211_STYPE_DATA_CFACKPOLL 0x0030
  85. #define IEEE80211_STYPE_NULLFUNC 0x0040
  86. #define IEEE80211_STYPE_CFACK 0x0050
  87. #define IEEE80211_STYPE_CFPOLL 0x0060
  88. #define IEEE80211_STYPE_CFACKPOLL 0x0070
  89. #define IEEE80211_STYPE_QOS_DATA 0x0080
  90. #define IEEE80211_STYPE_QOS_DATA_CFACK 0x0090
  91. #define IEEE80211_STYPE_QOS_DATA_CFPOLL 0x00A0
  92. #define IEEE80211_STYPE_QOS_DATA_CFACKPOLL 0x00B0
  93. #define IEEE80211_STYPE_QOS_NULLFUNC 0x00C0
  94. #define IEEE80211_STYPE_QOS_CFACK 0x00D0
  95. #define IEEE80211_STYPE_QOS_CFPOLL 0x00E0
  96. #define IEEE80211_STYPE_QOS_CFACKPOLL 0x00F0
  97. /* extension, added by 802.11ad */
  98. #define IEEE80211_STYPE_DMG_BEACON 0x0000
  99. /* control extension - for IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTL_EXT */
  100. #define IEEE80211_CTL_EXT_POLL 0x2000
  101. #define IEEE80211_CTL_EXT_SPR 0x3000
  102. #define IEEE80211_CTL_EXT_GRANT 0x4000
  103. #define IEEE80211_CTL_EXT_DMG_CTS 0x5000
  104. #define IEEE80211_CTL_EXT_DMG_DTS 0x6000
  105. #define IEEE80211_CTL_EXT_SSW 0x8000
  106. #define IEEE80211_CTL_EXT_SSW_FBACK 0x9000
  107. #define IEEE80211_CTL_EXT_SSW_ACK 0xa000
  108. #define IEEE80211_SN_MASK ((IEEE80211_SCTL_SEQ) >> 4)
  109. #define IEEE80211_MAX_SN IEEE80211_SN_MASK
  110. #define IEEE80211_SN_MODULO (IEEE80211_MAX_SN + 1)
  111. static inline bool ieee80211_sn_less(u16 sn1, u16 sn2)
  112. {
  113. return ((sn1 - sn2) & IEEE80211_SN_MASK) > (IEEE80211_SN_MODULO >> 1);
  114. }
  115. static inline u16 ieee80211_sn_add(u16 sn1, u16 sn2)
  116. {
  117. return (sn1 + sn2) & IEEE80211_SN_MASK;
  118. }
  119. static inline u16 ieee80211_sn_inc(u16 sn)
  120. {
  121. return ieee80211_sn_add(sn, 1);
  122. }
  123. static inline u16 ieee80211_sn_sub(u16 sn1, u16 sn2)
  124. {
  125. return (sn1 - sn2) & IEEE80211_SN_MASK;
  126. }
  127. #define IEEE80211_SEQ_TO_SN(seq) (((seq) & IEEE80211_SCTL_SEQ) >> 4)
  128. #define IEEE80211_SN_TO_SEQ(ssn) (((ssn) << 4) & IEEE80211_SCTL_SEQ)
  129. /* miscellaneous IEEE 802.11 constants */
  130. #define IEEE80211_MAX_FRAG_THRESHOLD 2352
  131. #define IEEE80211_MAX_RTS_THRESHOLD 2353
  132. #define IEEE80211_MAX_AID 2007
  133. #define IEEE80211_MAX_TIM_LEN 251
  134. #define IEEE80211_MAX_MESH_PEERINGS 63
  135. /* Maximum size for the MA-UNITDATA primitive, 802.11 standard section
  136. 6.2.1.1.2.
  137. 802.11e clarifies the figure in section 7.1.2. The frame body is
  138. up to 2304 octets long (maximum MSDU size) plus any crypt overhead. */
  139. #define IEEE80211_MAX_DATA_LEN 2304
  140. /* 802.11ad extends maximum MSDU size for DMG (freq > 40Ghz) networks
  141. * to 7920 bytes, see 8.2.3 General frame format
  142. */
  143. #define IEEE80211_MAX_DATA_LEN_DMG 7920
  144. /* 30 byte 4 addr hdr, 2 byte QoS, 2304 byte MSDU, 12 byte crypt, 4 byte FCS */
  145. #define IEEE80211_MAX_FRAME_LEN 2352
  146. /* Maximal size of an A-MSDU that can be transported in a HT BA session */
  147. #define IEEE80211_MAX_MPDU_LEN_HT_BA 4095
  148. /* Maximal size of an A-MSDU */
  149. #define IEEE80211_MAX_MPDU_LEN_HT_3839 3839
  150. #define IEEE80211_MAX_MPDU_LEN_HT_7935 7935
  151. #define IEEE80211_MAX_MPDU_LEN_VHT_3895 3895
  152. #define IEEE80211_MAX_MPDU_LEN_VHT_7991 7991
  153. #define IEEE80211_MAX_MPDU_LEN_VHT_11454 11454
  154. #define IEEE80211_MAX_SSID_LEN 32
  155. #define IEEE80211_MAX_MESH_ID_LEN 32
  156. #define IEEE80211_FIRST_TSPEC_TSID 8
  157. #define IEEE80211_NUM_TIDS 16
  158. /* number of user priorities 802.11 uses */
  159. #define IEEE80211_NUM_UPS 8
  160. #define IEEE80211_QOS_CTL_LEN 2
  161. /* 1d tag mask */
  162. #define IEEE80211_QOS_CTL_TAG1D_MASK 0x0007
  163. /* TID mask */
  164. #define IEEE80211_QOS_CTL_TID_MASK 0x000f
  165. /* EOSP */
  166. #define IEEE80211_QOS_CTL_EOSP 0x0010
  167. /* ACK policy */
  168. #define IEEE80211_QOS_CTL_ACK_POLICY_NORMAL 0x0000
  169. #define IEEE80211_QOS_CTL_ACK_POLICY_NOACK 0x0020
  170. #define IEEE80211_QOS_CTL_ACK_POLICY_NO_EXPL 0x0040
  171. #define IEEE80211_QOS_CTL_ACK_POLICY_BLOCKACK 0x0060
  172. #define IEEE80211_QOS_CTL_ACK_POLICY_MASK 0x0060
  173. /* A-MSDU 802.11n */
  174. #define IEEE80211_QOS_CTL_A_MSDU_PRESENT 0x0080
  175. /* Mesh Control 802.11s */
  176. #define IEEE80211_QOS_CTL_MESH_CONTROL_PRESENT 0x0100
  177. /* Mesh Power Save Level */
  178. #define IEEE80211_QOS_CTL_MESH_PS_LEVEL 0x0200
  179. /* Mesh Receiver Service Period Initiated */
  180. #define IEEE80211_QOS_CTL_RSPI 0x0400
  181. /* U-APSD queue for WMM IEs sent by AP */
  182. #define IEEE80211_WMM_IE_AP_QOSINFO_UAPSD (1<<7)
  183. #define IEEE80211_WMM_IE_AP_QOSINFO_PARAM_SET_CNT_MASK 0x0f
  184. /* U-APSD queues for WMM IEs sent by STA */
  185. #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VO (1<<0)
  186. #define IEEE80211_WMM_IE_STA_QOSINFO_AC_VI (1<<1)
  187. #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BK (1<<2)
  188. #define IEEE80211_WMM_IE_STA_QOSINFO_AC_BE (1<<3)
  189. #define IEEE80211_WMM_IE_STA_QOSINFO_AC_MASK 0x0f
  190. /* U-APSD max SP length for WMM IEs sent by STA */
  191. #define IEEE80211_WMM_IE_STA_QOSINFO_SP_ALL 0x00
  192. #define IEEE80211_WMM_IE_STA_QOSINFO_SP_2 0x01
  193. #define IEEE80211_WMM_IE_STA_QOSINFO_SP_4 0x02
  194. #define IEEE80211_WMM_IE_STA_QOSINFO_SP_6 0x03
  195. #define IEEE80211_WMM_IE_STA_QOSINFO_SP_MASK 0x03
  196. #define IEEE80211_WMM_IE_STA_QOSINFO_SP_SHIFT 5
  197. #define IEEE80211_HT_CTL_LEN 4
  198. struct ieee80211_hdr {
  199. __le16 frame_control;
  200. __le16 duration_id;
  201. u8 addr1[ETH_ALEN];
  202. u8 addr2[ETH_ALEN];
  203. u8 addr3[ETH_ALEN];
  204. __le16 seq_ctrl;
  205. u8 addr4[ETH_ALEN];
  206. } __packed __aligned(2);
  207. struct ieee80211_hdr_3addr {
  208. __le16 frame_control;
  209. __le16 duration_id;
  210. u8 addr1[ETH_ALEN];
  211. u8 addr2[ETH_ALEN];
  212. u8 addr3[ETH_ALEN];
  213. __le16 seq_ctrl;
  214. } __packed __aligned(2);
  215. struct ieee80211_qos_hdr {
  216. __le16 frame_control;
  217. __le16 duration_id;
  218. u8 addr1[ETH_ALEN];
  219. u8 addr2[ETH_ALEN];
  220. u8 addr3[ETH_ALEN];
  221. __le16 seq_ctrl;
  222. __le16 qos_ctrl;
  223. } __packed __aligned(2);
  224. /**
  225. * ieee80211_has_tods - check if IEEE80211_FCTL_TODS is set
  226. * @fc: frame control bytes in little-endian byteorder
  227. */
  228. static inline bool ieee80211_has_tods(__le16 fc)
  229. {
  230. return (fc & cpu_to_le16(IEEE80211_FCTL_TODS)) != 0;
  231. }
  232. /**
  233. * ieee80211_has_fromds - check if IEEE80211_FCTL_FROMDS is set
  234. * @fc: frame control bytes in little-endian byteorder
  235. */
  236. static inline bool ieee80211_has_fromds(__le16 fc)
  237. {
  238. return (fc & cpu_to_le16(IEEE80211_FCTL_FROMDS)) != 0;
  239. }
  240. /**
  241. * ieee80211_has_a4 - check if IEEE80211_FCTL_TODS and IEEE80211_FCTL_FROMDS are set
  242. * @fc: frame control bytes in little-endian byteorder
  243. */
  244. static inline bool ieee80211_has_a4(__le16 fc)
  245. {
  246. __le16 tmp = cpu_to_le16(IEEE80211_FCTL_TODS | IEEE80211_FCTL_FROMDS);
  247. return (fc & tmp) == tmp;
  248. }
  249. /**
  250. * ieee80211_has_morefrags - check if IEEE80211_FCTL_MOREFRAGS is set
  251. * @fc: frame control bytes in little-endian byteorder
  252. */
  253. static inline bool ieee80211_has_morefrags(__le16 fc)
  254. {
  255. return (fc & cpu_to_le16(IEEE80211_FCTL_MOREFRAGS)) != 0;
  256. }
  257. /**
  258. * ieee80211_has_retry - check if IEEE80211_FCTL_RETRY is set
  259. * @fc: frame control bytes in little-endian byteorder
  260. */
  261. static inline bool ieee80211_has_retry(__le16 fc)
  262. {
  263. return (fc & cpu_to_le16(IEEE80211_FCTL_RETRY)) != 0;
  264. }
  265. /**
  266. * ieee80211_has_pm - check if IEEE80211_FCTL_PM is set
  267. * @fc: frame control bytes in little-endian byteorder
  268. */
  269. static inline bool ieee80211_has_pm(__le16 fc)
  270. {
  271. return (fc & cpu_to_le16(IEEE80211_FCTL_PM)) != 0;
  272. }
  273. /**
  274. * ieee80211_has_moredata - check if IEEE80211_FCTL_MOREDATA is set
  275. * @fc: frame control bytes in little-endian byteorder
  276. */
  277. static inline bool ieee80211_has_moredata(__le16 fc)
  278. {
  279. return (fc & cpu_to_le16(IEEE80211_FCTL_MOREDATA)) != 0;
  280. }
  281. /**
  282. * ieee80211_has_protected - check if IEEE80211_FCTL_PROTECTED is set
  283. * @fc: frame control bytes in little-endian byteorder
  284. */
  285. static inline bool ieee80211_has_protected(__le16 fc)
  286. {
  287. return (fc & cpu_to_le16(IEEE80211_FCTL_PROTECTED)) != 0;
  288. }
  289. /**
  290. * ieee80211_has_order - check if IEEE80211_FCTL_ORDER is set
  291. * @fc: frame control bytes in little-endian byteorder
  292. */
  293. static inline bool ieee80211_has_order(__le16 fc)
  294. {
  295. return (fc & cpu_to_le16(IEEE80211_FCTL_ORDER)) != 0;
  296. }
  297. /**
  298. * ieee80211_is_mgmt - check if type is IEEE80211_FTYPE_MGMT
  299. * @fc: frame control bytes in little-endian byteorder
  300. */
  301. static inline bool ieee80211_is_mgmt(__le16 fc)
  302. {
  303. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
  304. cpu_to_le16(IEEE80211_FTYPE_MGMT);
  305. }
  306. /**
  307. * ieee80211_is_ctl - check if type is IEEE80211_FTYPE_CTL
  308. * @fc: frame control bytes in little-endian byteorder
  309. */
  310. static inline bool ieee80211_is_ctl(__le16 fc)
  311. {
  312. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
  313. cpu_to_le16(IEEE80211_FTYPE_CTL);
  314. }
  315. /**
  316. * ieee80211_is_data - check if type is IEEE80211_FTYPE_DATA
  317. * @fc: frame control bytes in little-endian byteorder
  318. */
  319. static inline bool ieee80211_is_data(__le16 fc)
  320. {
  321. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE)) ==
  322. cpu_to_le16(IEEE80211_FTYPE_DATA);
  323. }
  324. /**
  325. * ieee80211_is_data_qos - check if type is IEEE80211_FTYPE_DATA and IEEE80211_STYPE_QOS_DATA is set
  326. * @fc: frame control bytes in little-endian byteorder
  327. */
  328. static inline bool ieee80211_is_data_qos(__le16 fc)
  329. {
  330. /*
  331. * mask with QOS_DATA rather than IEEE80211_FCTL_STYPE as we just need
  332. * to check the one bit
  333. */
  334. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_STYPE_QOS_DATA)) ==
  335. cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_DATA);
  336. }
  337. /**
  338. * ieee80211_is_data_present - check if type is IEEE80211_FTYPE_DATA and has data
  339. * @fc: frame control bytes in little-endian byteorder
  340. */
  341. static inline bool ieee80211_is_data_present(__le16 fc)
  342. {
  343. /*
  344. * mask with 0x40 and test that that bit is clear to only return true
  345. * for the data-containing substypes.
  346. */
  347. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | 0x40)) ==
  348. cpu_to_le16(IEEE80211_FTYPE_DATA);
  349. }
  350. /**
  351. * ieee80211_is_assoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_REQ
  352. * @fc: frame control bytes in little-endian byteorder
  353. */
  354. static inline bool ieee80211_is_assoc_req(__le16 fc)
  355. {
  356. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  357. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_REQ);
  358. }
  359. /**
  360. * ieee80211_is_assoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ASSOC_RESP
  361. * @fc: frame control bytes in little-endian byteorder
  362. */
  363. static inline bool ieee80211_is_assoc_resp(__le16 fc)
  364. {
  365. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  366. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ASSOC_RESP);
  367. }
  368. /**
  369. * ieee80211_is_reassoc_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_REQ
  370. * @fc: frame control bytes in little-endian byteorder
  371. */
  372. static inline bool ieee80211_is_reassoc_req(__le16 fc)
  373. {
  374. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  375. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_REQ);
  376. }
  377. /**
  378. * ieee80211_is_reassoc_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_REASSOC_RESP
  379. * @fc: frame control bytes in little-endian byteorder
  380. */
  381. static inline bool ieee80211_is_reassoc_resp(__le16 fc)
  382. {
  383. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  384. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_REASSOC_RESP);
  385. }
  386. /**
  387. * ieee80211_is_probe_req - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_REQ
  388. * @fc: frame control bytes in little-endian byteorder
  389. */
  390. static inline bool ieee80211_is_probe_req(__le16 fc)
  391. {
  392. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  393. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_REQ);
  394. }
  395. /**
  396. * ieee80211_is_probe_resp - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_PROBE_RESP
  397. * @fc: frame control bytes in little-endian byteorder
  398. */
  399. static inline bool ieee80211_is_probe_resp(__le16 fc)
  400. {
  401. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  402. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_PROBE_RESP);
  403. }
  404. /**
  405. * ieee80211_is_beacon - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_BEACON
  406. * @fc: frame control bytes in little-endian byteorder
  407. */
  408. static inline bool ieee80211_is_beacon(__le16 fc)
  409. {
  410. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  411. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_BEACON);
  412. }
  413. /**
  414. * ieee80211_is_atim - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ATIM
  415. * @fc: frame control bytes in little-endian byteorder
  416. */
  417. static inline bool ieee80211_is_atim(__le16 fc)
  418. {
  419. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  420. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ATIM);
  421. }
  422. /**
  423. * ieee80211_is_disassoc - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DISASSOC
  424. * @fc: frame control bytes in little-endian byteorder
  425. */
  426. static inline bool ieee80211_is_disassoc(__le16 fc)
  427. {
  428. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  429. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DISASSOC);
  430. }
  431. /**
  432. * ieee80211_is_auth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_AUTH
  433. * @fc: frame control bytes in little-endian byteorder
  434. */
  435. static inline bool ieee80211_is_auth(__le16 fc)
  436. {
  437. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  438. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_AUTH);
  439. }
  440. /**
  441. * ieee80211_is_deauth - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_DEAUTH
  442. * @fc: frame control bytes in little-endian byteorder
  443. */
  444. static inline bool ieee80211_is_deauth(__le16 fc)
  445. {
  446. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  447. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_DEAUTH);
  448. }
  449. /**
  450. * ieee80211_is_action - check if IEEE80211_FTYPE_MGMT && IEEE80211_STYPE_ACTION
  451. * @fc: frame control bytes in little-endian byteorder
  452. */
  453. static inline bool ieee80211_is_action(__le16 fc)
  454. {
  455. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  456. cpu_to_le16(IEEE80211_FTYPE_MGMT | IEEE80211_STYPE_ACTION);
  457. }
  458. /**
  459. * ieee80211_is_back_req - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK_REQ
  460. * @fc: frame control bytes in little-endian byteorder
  461. */
  462. static inline bool ieee80211_is_back_req(__le16 fc)
  463. {
  464. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  465. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK_REQ);
  466. }
  467. /**
  468. * ieee80211_is_back - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_BACK
  469. * @fc: frame control bytes in little-endian byteorder
  470. */
  471. static inline bool ieee80211_is_back(__le16 fc)
  472. {
  473. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  474. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_BACK);
  475. }
  476. /**
  477. * ieee80211_is_pspoll - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_PSPOLL
  478. * @fc: frame control bytes in little-endian byteorder
  479. */
  480. static inline bool ieee80211_is_pspoll(__le16 fc)
  481. {
  482. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  483. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_PSPOLL);
  484. }
  485. /**
  486. * ieee80211_is_rts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_RTS
  487. * @fc: frame control bytes in little-endian byteorder
  488. */
  489. static inline bool ieee80211_is_rts(__le16 fc)
  490. {
  491. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  492. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_RTS);
  493. }
  494. /**
  495. * ieee80211_is_cts - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CTS
  496. * @fc: frame control bytes in little-endian byteorder
  497. */
  498. static inline bool ieee80211_is_cts(__le16 fc)
  499. {
  500. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  501. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CTS);
  502. }
  503. /**
  504. * ieee80211_is_ack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_ACK
  505. * @fc: frame control bytes in little-endian byteorder
  506. */
  507. static inline bool ieee80211_is_ack(__le16 fc)
  508. {
  509. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  510. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_ACK);
  511. }
  512. /**
  513. * ieee80211_is_cfend - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFEND
  514. * @fc: frame control bytes in little-endian byteorder
  515. */
  516. static inline bool ieee80211_is_cfend(__le16 fc)
  517. {
  518. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  519. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFEND);
  520. }
  521. /**
  522. * ieee80211_is_cfendack - check if IEEE80211_FTYPE_CTL && IEEE80211_STYPE_CFENDACK
  523. * @fc: frame control bytes in little-endian byteorder
  524. */
  525. static inline bool ieee80211_is_cfendack(__le16 fc)
  526. {
  527. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  528. cpu_to_le16(IEEE80211_FTYPE_CTL | IEEE80211_STYPE_CFENDACK);
  529. }
  530. /**
  531. * ieee80211_is_nullfunc - check if frame is a regular (non-QoS) nullfunc frame
  532. * @fc: frame control bytes in little-endian byteorder
  533. */
  534. static inline bool ieee80211_is_nullfunc(__le16 fc)
  535. {
  536. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  537. cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_NULLFUNC);
  538. }
  539. /**
  540. * ieee80211_is_qos_nullfunc - check if frame is a QoS nullfunc frame
  541. * @fc: frame control bytes in little-endian byteorder
  542. */
  543. static inline bool ieee80211_is_qos_nullfunc(__le16 fc)
  544. {
  545. return (fc & cpu_to_le16(IEEE80211_FCTL_FTYPE | IEEE80211_FCTL_STYPE)) ==
  546. cpu_to_le16(IEEE80211_FTYPE_DATA | IEEE80211_STYPE_QOS_NULLFUNC);
  547. }
  548. /**
  549. * ieee80211_is_bufferable_mmpdu - check if frame is bufferable MMPDU
  550. * @fc: frame control field in little-endian byteorder
  551. */
  552. static inline bool ieee80211_is_bufferable_mmpdu(__le16 fc)
  553. {
  554. /* IEEE 802.11-2012, definition of "bufferable management frame";
  555. * note that this ignores the IBSS special case. */
  556. return ieee80211_is_mgmt(fc) &&
  557. (ieee80211_is_action(fc) ||
  558. ieee80211_is_disassoc(fc) ||
  559. ieee80211_is_deauth(fc));
  560. }
  561. /**
  562. * ieee80211_is_first_frag - check if IEEE80211_SCTL_FRAG is not set
  563. * @seq_ctrl: frame sequence control bytes in little-endian byteorder
  564. */
  565. static inline bool ieee80211_is_first_frag(__le16 seq_ctrl)
  566. {
  567. return (seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG)) == 0;
  568. }
  569. /**
  570. * ieee80211_is_frag - check if a frame is a fragment
  571. * @hdr: 802.11 header of the frame
  572. */
  573. static inline bool ieee80211_is_frag(struct ieee80211_hdr *hdr)
  574. {
  575. return ieee80211_has_morefrags(hdr->frame_control) ||
  576. hdr->seq_ctrl & cpu_to_le16(IEEE80211_SCTL_FRAG);
  577. }
  578. struct ieee80211s_hdr {
  579. u8 flags;
  580. u8 ttl;
  581. __le32 seqnum;
  582. u8 eaddr1[ETH_ALEN];
  583. u8 eaddr2[ETH_ALEN];
  584. } __packed __aligned(2);
  585. /* Mesh flags */
  586. #define MESH_FLAGS_AE_A4 0x1
  587. #define MESH_FLAGS_AE_A5_A6 0x2
  588. #define MESH_FLAGS_AE 0x3
  589. #define MESH_FLAGS_PS_DEEP 0x4
  590. /**
  591. * enum ieee80211_preq_flags - mesh PREQ element flags
  592. *
  593. * @IEEE80211_PREQ_PROACTIVE_PREP_FLAG: proactive PREP subfield
  594. */
  595. enum ieee80211_preq_flags {
  596. IEEE80211_PREQ_PROACTIVE_PREP_FLAG = 1<<2,
  597. };
  598. /**
  599. * enum ieee80211_preq_target_flags - mesh PREQ element per target flags
  600. *
  601. * @IEEE80211_PREQ_TO_FLAG: target only subfield
  602. * @IEEE80211_PREQ_USN_FLAG: unknown target HWMP sequence number subfield
  603. */
  604. enum ieee80211_preq_target_flags {
  605. IEEE80211_PREQ_TO_FLAG = 1<<0,
  606. IEEE80211_PREQ_USN_FLAG = 1<<2,
  607. };
  608. /**
  609. * struct ieee80211_quiet_ie
  610. *
  611. * This structure refers to "Quiet information element"
  612. */
  613. struct ieee80211_quiet_ie {
  614. u8 count;
  615. u8 period;
  616. __le16 duration;
  617. __le16 offset;
  618. } __packed;
  619. /**
  620. * struct ieee80211_msrment_ie
  621. *
  622. * This structure refers to "Measurement Request/Report information element"
  623. */
  624. struct ieee80211_msrment_ie {
  625. u8 token;
  626. u8 mode;
  627. u8 type;
  628. u8 request[0];
  629. } __packed;
  630. /**
  631. * struct ieee80211_channel_sw_ie
  632. *
  633. * This structure refers to "Channel Switch Announcement information element"
  634. */
  635. struct ieee80211_channel_sw_ie {
  636. u8 mode;
  637. u8 new_ch_num;
  638. u8 count;
  639. } __packed;
  640. /**
  641. * struct ieee80211_ext_chansw_ie
  642. *
  643. * This structure represents the "Extended Channel Switch Announcement element"
  644. */
  645. struct ieee80211_ext_chansw_ie {
  646. u8 mode;
  647. u8 new_operating_class;
  648. u8 new_ch_num;
  649. u8 count;
  650. } __packed;
  651. /**
  652. * struct ieee80211_sec_chan_offs_ie - secondary channel offset IE
  653. * @sec_chan_offs: secondary channel offset, uses IEEE80211_HT_PARAM_CHA_SEC_*
  654. * values here
  655. * This structure represents the "Secondary Channel Offset element"
  656. */
  657. struct ieee80211_sec_chan_offs_ie {
  658. u8 sec_chan_offs;
  659. } __packed;
  660. /**
  661. * struct ieee80211_mesh_chansw_params_ie - mesh channel switch parameters IE
  662. *
  663. * This structure represents the "Mesh Channel Switch Paramters element"
  664. */
  665. struct ieee80211_mesh_chansw_params_ie {
  666. u8 mesh_ttl;
  667. u8 mesh_flags;
  668. __le16 mesh_reason;
  669. __le16 mesh_pre_value;
  670. } __packed;
  671. /**
  672. * struct ieee80211_wide_bw_chansw_ie - wide bandwidth channel switch IE
  673. */
  674. struct ieee80211_wide_bw_chansw_ie {
  675. u8 new_channel_width;
  676. u8 new_center_freq_seg0, new_center_freq_seg1;
  677. } __packed;
  678. /**
  679. * struct ieee80211_tim
  680. *
  681. * This structure refers to "Traffic Indication Map information element"
  682. */
  683. struct ieee80211_tim_ie {
  684. u8 dtim_count;
  685. u8 dtim_period;
  686. u8 bitmap_ctrl;
  687. /* variable size: 1 - 251 bytes */
  688. u8 virtual_map[1];
  689. } __packed;
  690. /**
  691. * struct ieee80211_meshconf_ie
  692. *
  693. * This structure refers to "Mesh Configuration information element"
  694. */
  695. struct ieee80211_meshconf_ie {
  696. u8 meshconf_psel;
  697. u8 meshconf_pmetric;
  698. u8 meshconf_congest;
  699. u8 meshconf_synch;
  700. u8 meshconf_auth;
  701. u8 meshconf_form;
  702. u8 meshconf_cap;
  703. } __packed;
  704. /**
  705. * enum mesh_config_capab_flags - Mesh Configuration IE capability field flags
  706. *
  707. * @IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS: STA is willing to establish
  708. * additional mesh peerings with other mesh STAs
  709. * @IEEE80211_MESHCONF_CAPAB_FORWARDING: the STA forwards MSDUs
  710. * @IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING: TBTT adjustment procedure
  711. * is ongoing
  712. * @IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL: STA is in deep sleep mode or has
  713. * neighbors in deep sleep mode
  714. */
  715. enum mesh_config_capab_flags {
  716. IEEE80211_MESHCONF_CAPAB_ACCEPT_PLINKS = 0x01,
  717. IEEE80211_MESHCONF_CAPAB_FORWARDING = 0x08,
  718. IEEE80211_MESHCONF_CAPAB_TBTT_ADJUSTING = 0x20,
  719. IEEE80211_MESHCONF_CAPAB_POWER_SAVE_LEVEL = 0x40,
  720. };
  721. /**
  722. * mesh channel switch parameters element's flag indicator
  723. *
  724. */
  725. #define WLAN_EID_CHAN_SWITCH_PARAM_TX_RESTRICT BIT(0)
  726. #define WLAN_EID_CHAN_SWITCH_PARAM_INITIATOR BIT(1)
  727. #define WLAN_EID_CHAN_SWITCH_PARAM_REASON BIT(2)
  728. /**
  729. * struct ieee80211_rann_ie
  730. *
  731. * This structure refers to "Root Announcement information element"
  732. */
  733. struct ieee80211_rann_ie {
  734. u8 rann_flags;
  735. u8 rann_hopcount;
  736. u8 rann_ttl;
  737. u8 rann_addr[ETH_ALEN];
  738. __le32 rann_seq;
  739. __le32 rann_interval;
  740. __le32 rann_metric;
  741. } __packed;
  742. enum ieee80211_rann_flags {
  743. RANN_FLAG_IS_GATE = 1 << 0,
  744. };
  745. enum ieee80211_ht_chanwidth_values {
  746. IEEE80211_HT_CHANWIDTH_20MHZ = 0,
  747. IEEE80211_HT_CHANWIDTH_ANY = 1,
  748. };
  749. /**
  750. * enum ieee80211_opmode_bits - VHT operating mode field bits
  751. * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK: channel width mask
  752. * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ: 20 MHz channel width
  753. * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ: 40 MHz channel width
  754. * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ: 80 MHz channel width
  755. * @IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ: 160 MHz or 80+80 MHz channel width
  756. * @IEEE80211_OPMODE_NOTIF_RX_NSS_MASK: number of spatial streams mask
  757. * (the NSS value is the value of this field + 1)
  758. * @IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT: number of spatial streams shift
  759. * @IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF: indicates streams in SU-MIMO PPDU
  760. * using a beamforming steering matrix
  761. */
  762. enum ieee80211_vht_opmode_bits {
  763. IEEE80211_OPMODE_NOTIF_CHANWIDTH_MASK = 3,
  764. IEEE80211_OPMODE_NOTIF_CHANWIDTH_20MHZ = 0,
  765. IEEE80211_OPMODE_NOTIF_CHANWIDTH_40MHZ = 1,
  766. IEEE80211_OPMODE_NOTIF_CHANWIDTH_80MHZ = 2,
  767. IEEE80211_OPMODE_NOTIF_CHANWIDTH_160MHZ = 3,
  768. IEEE80211_OPMODE_NOTIF_RX_NSS_MASK = 0x70,
  769. IEEE80211_OPMODE_NOTIF_RX_NSS_SHIFT = 4,
  770. IEEE80211_OPMODE_NOTIF_RX_NSS_TYPE_BF = 0x80,
  771. };
  772. #define WLAN_SA_QUERY_TR_ID_LEN 2
  773. #define WLAN_MEMBERSHIP_LEN 8
  774. #define WLAN_USER_POSITION_LEN 16
  775. /**
  776. * struct ieee80211_tpc_report_ie
  777. *
  778. * This structure refers to "TPC Report element"
  779. */
  780. struct ieee80211_tpc_report_ie {
  781. u8 tx_power;
  782. u8 link_margin;
  783. } __packed;
  784. struct ieee80211_mgmt {
  785. __le16 frame_control;
  786. __le16 duration;
  787. u8 da[ETH_ALEN];
  788. u8 sa[ETH_ALEN];
  789. u8 bssid[ETH_ALEN];
  790. __le16 seq_ctrl;
  791. union {
  792. struct {
  793. __le16 auth_alg;
  794. __le16 auth_transaction;
  795. __le16 status_code;
  796. /* possibly followed by Challenge text */
  797. u8 variable[0];
  798. } __packed auth;
  799. struct {
  800. __le16 reason_code;
  801. } __packed deauth;
  802. struct {
  803. __le16 capab_info;
  804. __le16 listen_interval;
  805. /* followed by SSID and Supported rates */
  806. u8 variable[0];
  807. } __packed assoc_req;
  808. struct {
  809. __le16 capab_info;
  810. __le16 status_code;
  811. __le16 aid;
  812. /* followed by Supported rates */
  813. u8 variable[0];
  814. } __packed assoc_resp, reassoc_resp;
  815. struct {
  816. __le16 capab_info;
  817. __le16 listen_interval;
  818. u8 current_ap[ETH_ALEN];
  819. /* followed by SSID and Supported rates */
  820. u8 variable[0];
  821. } __packed reassoc_req;
  822. struct {
  823. __le16 reason_code;
  824. } __packed disassoc;
  825. struct {
  826. __le64 timestamp;
  827. __le16 beacon_int;
  828. __le16 capab_info;
  829. /* followed by some of SSID, Supported rates,
  830. * FH Params, DS Params, CF Params, IBSS Params, TIM */
  831. u8 variable[0];
  832. } __packed beacon;
  833. struct {
  834. /* only variable items: SSID, Supported rates */
  835. u8 variable[0];
  836. } __packed probe_req;
  837. struct {
  838. __le64 timestamp;
  839. __le16 beacon_int;
  840. __le16 capab_info;
  841. /* followed by some of SSID, Supported rates,
  842. * FH Params, DS Params, CF Params, IBSS Params */
  843. u8 variable[0];
  844. } __packed probe_resp;
  845. struct {
  846. u8 category;
  847. union {
  848. struct {
  849. u8 action_code;
  850. u8 dialog_token;
  851. u8 status_code;
  852. u8 variable[0];
  853. } __packed wme_action;
  854. struct{
  855. u8 action_code;
  856. u8 variable[0];
  857. } __packed chan_switch;
  858. struct{
  859. u8 action_code;
  860. struct ieee80211_ext_chansw_ie data;
  861. u8 variable[0];
  862. } __packed ext_chan_switch;
  863. struct{
  864. u8 action_code;
  865. u8 dialog_token;
  866. u8 element_id;
  867. u8 length;
  868. struct ieee80211_msrment_ie msr_elem;
  869. } __packed measurement;
  870. struct{
  871. u8 action_code;
  872. u8 dialog_token;
  873. __le16 capab;
  874. __le16 timeout;
  875. __le16 start_seq_num;
  876. } __packed addba_req;
  877. struct{
  878. u8 action_code;
  879. u8 dialog_token;
  880. __le16 status;
  881. __le16 capab;
  882. __le16 timeout;
  883. } __packed addba_resp;
  884. struct{
  885. u8 action_code;
  886. __le16 params;
  887. __le16 reason_code;
  888. } __packed delba;
  889. struct {
  890. u8 action_code;
  891. u8 variable[0];
  892. } __packed self_prot;
  893. struct{
  894. u8 action_code;
  895. u8 variable[0];
  896. } __packed mesh_action;
  897. struct {
  898. u8 action;
  899. u8 trans_id[WLAN_SA_QUERY_TR_ID_LEN];
  900. } __packed sa_query;
  901. struct {
  902. u8 action;
  903. u8 smps_control;
  904. } __packed ht_smps;
  905. struct {
  906. u8 action_code;
  907. u8 chanwidth;
  908. } __packed ht_notify_cw;
  909. struct {
  910. u8 action_code;
  911. u8 dialog_token;
  912. __le16 capability;
  913. u8 variable[0];
  914. } __packed tdls_discover_resp;
  915. struct {
  916. u8 action_code;
  917. u8 operating_mode;
  918. } __packed vht_opmode_notif;
  919. struct {
  920. u8 action_code;
  921. u8 membership[WLAN_MEMBERSHIP_LEN];
  922. u8 position[WLAN_USER_POSITION_LEN];
  923. } __packed vht_group_notif;
  924. struct {
  925. u8 action_code;
  926. u8 dialog_token;
  927. u8 tpc_elem_id;
  928. u8 tpc_elem_length;
  929. struct ieee80211_tpc_report_ie tpc;
  930. } __packed tpc_report;
  931. struct {
  932. u8 action_code;
  933. u8 dialog_token;
  934. u8 follow_up;
  935. u8 tod[6];
  936. u8 toa[6];
  937. __le16 tod_error;
  938. __le16 toa_error;
  939. u8 variable[0];
  940. } __packed ftm;
  941. } u;
  942. } __packed action;
  943. } u;
  944. } __packed __aligned(2);
  945. /* Supported Rates value encodings in 802.11n-2009 7.3.2.2 */
  946. #define BSS_MEMBERSHIP_SELECTOR_HT_PHY 127
  947. /* mgmt header + 1 byte category code */
  948. #define IEEE80211_MIN_ACTION_SIZE offsetof(struct ieee80211_mgmt, u.action.u)
  949. /* Management MIC information element (IEEE 802.11w) */
  950. struct ieee80211_mmie {
  951. u8 element_id;
  952. u8 length;
  953. __le16 key_id;
  954. u8 sequence_number[6];
  955. u8 mic[8];
  956. } __packed;
  957. /* Management MIC information element (IEEE 802.11w) for GMAC and CMAC-256 */
  958. struct ieee80211_mmie_16 {
  959. u8 element_id;
  960. u8 length;
  961. __le16 key_id;
  962. u8 sequence_number[6];
  963. u8 mic[16];
  964. } __packed;
  965. struct ieee80211_vendor_ie {
  966. u8 element_id;
  967. u8 len;
  968. u8 oui[3];
  969. u8 oui_type;
  970. } __packed;
  971. struct ieee80211_wmm_ac_param {
  972. u8 aci_aifsn; /* AIFSN, ACM, ACI */
  973. u8 cw; /* ECWmin, ECWmax (CW = 2^ECW - 1) */
  974. __le16 txop_limit;
  975. } __packed;
  976. struct ieee80211_wmm_param_ie {
  977. u8 element_id; /* Element ID: 221 (0xdd); */
  978. u8 len; /* Length: 24 */
  979. /* required fields for WMM version 1 */
  980. u8 oui[3]; /* 00:50:f2 */
  981. u8 oui_type; /* 2 */
  982. u8 oui_subtype; /* 1 */
  983. u8 version; /* 1 for WMM version 1.0 */
  984. u8 qos_info; /* AP/STA specific QoS info */
  985. u8 reserved; /* 0 */
  986. /* AC_BE, AC_BK, AC_VI, AC_VO */
  987. struct ieee80211_wmm_ac_param ac[4];
  988. } __packed;
  989. /* Control frames */
  990. struct ieee80211_rts {
  991. __le16 frame_control;
  992. __le16 duration;
  993. u8 ra[ETH_ALEN];
  994. u8 ta[ETH_ALEN];
  995. } __packed __aligned(2);
  996. struct ieee80211_cts {
  997. __le16 frame_control;
  998. __le16 duration;
  999. u8 ra[ETH_ALEN];
  1000. } __packed __aligned(2);
  1001. struct ieee80211_pspoll {
  1002. __le16 frame_control;
  1003. __le16 aid;
  1004. u8 bssid[ETH_ALEN];
  1005. u8 ta[ETH_ALEN];
  1006. } __packed __aligned(2);
  1007. /* TDLS */
  1008. /* Channel switch timing */
  1009. struct ieee80211_ch_switch_timing {
  1010. __le16 switch_time;
  1011. __le16 switch_timeout;
  1012. } __packed;
  1013. /* Link-id information element */
  1014. struct ieee80211_tdls_lnkie {
  1015. u8 ie_type; /* Link Identifier IE */
  1016. u8 ie_len;
  1017. u8 bssid[ETH_ALEN];
  1018. u8 init_sta[ETH_ALEN];
  1019. u8 resp_sta[ETH_ALEN];
  1020. } __packed;
  1021. struct ieee80211_tdls_data {
  1022. u8 da[ETH_ALEN];
  1023. u8 sa[ETH_ALEN];
  1024. __be16 ether_type;
  1025. u8 payload_type;
  1026. u8 category;
  1027. u8 action_code;
  1028. union {
  1029. struct {
  1030. u8 dialog_token;
  1031. __le16 capability;
  1032. u8 variable[0];
  1033. } __packed setup_req;
  1034. struct {
  1035. __le16 status_code;
  1036. u8 dialog_token;
  1037. __le16 capability;
  1038. u8 variable[0];
  1039. } __packed setup_resp;
  1040. struct {
  1041. __le16 status_code;
  1042. u8 dialog_token;
  1043. u8 variable[0];
  1044. } __packed setup_cfm;
  1045. struct {
  1046. __le16 reason_code;
  1047. u8 variable[0];
  1048. } __packed teardown;
  1049. struct {
  1050. u8 dialog_token;
  1051. u8 variable[0];
  1052. } __packed discover_req;
  1053. struct {
  1054. u8 target_channel;
  1055. u8 oper_class;
  1056. u8 variable[0];
  1057. } __packed chan_switch_req;
  1058. struct {
  1059. __le16 status_code;
  1060. u8 variable[0];
  1061. } __packed chan_switch_resp;
  1062. } u;
  1063. } __packed;
  1064. /*
  1065. * Peer-to-Peer IE attribute related definitions.
  1066. */
  1067. /**
  1068. * enum ieee80211_p2p_attr_id - identifies type of peer-to-peer attribute.
  1069. */
  1070. enum ieee80211_p2p_attr_id {
  1071. IEEE80211_P2P_ATTR_STATUS = 0,
  1072. IEEE80211_P2P_ATTR_MINOR_REASON,
  1073. IEEE80211_P2P_ATTR_CAPABILITY,
  1074. IEEE80211_P2P_ATTR_DEVICE_ID,
  1075. IEEE80211_P2P_ATTR_GO_INTENT,
  1076. IEEE80211_P2P_ATTR_GO_CONFIG_TIMEOUT,
  1077. IEEE80211_P2P_ATTR_LISTEN_CHANNEL,
  1078. IEEE80211_P2P_ATTR_GROUP_BSSID,
  1079. IEEE80211_P2P_ATTR_EXT_LISTEN_TIMING,
  1080. IEEE80211_P2P_ATTR_INTENDED_IFACE_ADDR,
  1081. IEEE80211_P2P_ATTR_MANAGABILITY,
  1082. IEEE80211_P2P_ATTR_CHANNEL_LIST,
  1083. IEEE80211_P2P_ATTR_ABSENCE_NOTICE,
  1084. IEEE80211_P2P_ATTR_DEVICE_INFO,
  1085. IEEE80211_P2P_ATTR_GROUP_INFO,
  1086. IEEE80211_P2P_ATTR_GROUP_ID,
  1087. IEEE80211_P2P_ATTR_INTERFACE,
  1088. IEEE80211_P2P_ATTR_OPER_CHANNEL,
  1089. IEEE80211_P2P_ATTR_INVITE_FLAGS,
  1090. /* 19 - 220: Reserved */
  1091. IEEE80211_P2P_ATTR_VENDOR_SPECIFIC = 221,
  1092. IEEE80211_P2P_ATTR_MAX
  1093. };
  1094. /* Notice of Absence attribute - described in P2P spec 4.1.14 */
  1095. /* Typical max value used here */
  1096. #define IEEE80211_P2P_NOA_DESC_MAX 4
  1097. struct ieee80211_p2p_noa_desc {
  1098. u8 count;
  1099. __le32 duration;
  1100. __le32 interval;
  1101. __le32 start_time;
  1102. } __packed;
  1103. struct ieee80211_p2p_noa_attr {
  1104. u8 index;
  1105. u8 oppps_ctwindow;
  1106. struct ieee80211_p2p_noa_desc desc[IEEE80211_P2P_NOA_DESC_MAX];
  1107. } __packed;
  1108. #define IEEE80211_P2P_OPPPS_ENABLE_BIT BIT(7)
  1109. #define IEEE80211_P2P_OPPPS_CTWINDOW_MASK 0x7F
  1110. /**
  1111. * struct ieee80211_bar - HT Block Ack Request
  1112. *
  1113. * This structure refers to "HT BlockAckReq" as
  1114. * described in 802.11n draft section 7.2.1.7.1
  1115. */
  1116. struct ieee80211_bar {
  1117. __le16 frame_control;
  1118. __le16 duration;
  1119. __u8 ra[ETH_ALEN];
  1120. __u8 ta[ETH_ALEN];
  1121. __le16 control;
  1122. __le16 start_seq_num;
  1123. } __packed;
  1124. /* 802.11 BAR control masks */
  1125. #define IEEE80211_BAR_CTRL_ACK_POLICY_NORMAL 0x0000
  1126. #define IEEE80211_BAR_CTRL_MULTI_TID 0x0002
  1127. #define IEEE80211_BAR_CTRL_CBMTID_COMPRESSED_BA 0x0004
  1128. #define IEEE80211_BAR_CTRL_TID_INFO_MASK 0xf000
  1129. #define IEEE80211_BAR_CTRL_TID_INFO_SHIFT 12
  1130. #define IEEE80211_HT_MCS_MASK_LEN 10
  1131. /**
  1132. * struct ieee80211_mcs_info - MCS information
  1133. * @rx_mask: RX mask
  1134. * @rx_highest: highest supported RX rate. If set represents
  1135. * the highest supported RX data rate in units of 1 Mbps.
  1136. * If this field is 0 this value should not be used to
  1137. * consider the highest RX data rate supported.
  1138. * @tx_params: TX parameters
  1139. */
  1140. struct ieee80211_mcs_info {
  1141. u8 rx_mask[IEEE80211_HT_MCS_MASK_LEN];
  1142. __le16 rx_highest;
  1143. u8 tx_params;
  1144. u8 reserved[3];
  1145. } __packed;
  1146. /* 802.11n HT capability MSC set */
  1147. #define IEEE80211_HT_MCS_RX_HIGHEST_MASK 0x3ff
  1148. #define IEEE80211_HT_MCS_TX_DEFINED 0x01
  1149. #define IEEE80211_HT_MCS_TX_RX_DIFF 0x02
  1150. /* value 0 == 1 stream etc */
  1151. #define IEEE80211_HT_MCS_TX_MAX_STREAMS_MASK 0x0C
  1152. #define IEEE80211_HT_MCS_TX_MAX_STREAMS_SHIFT 2
  1153. #define IEEE80211_HT_MCS_TX_MAX_STREAMS 4
  1154. #define IEEE80211_HT_MCS_TX_UNEQUAL_MODULATION 0x10
  1155. /*
  1156. * 802.11n D5.0 20.3.5 / 20.6 says:
  1157. * - indices 0 to 7 and 32 are single spatial stream
  1158. * - 8 to 31 are multiple spatial streams using equal modulation
  1159. * [8..15 for two streams, 16..23 for three and 24..31 for four]
  1160. * - remainder are multiple spatial streams using unequal modulation
  1161. */
  1162. #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START 33
  1163. #define IEEE80211_HT_MCS_UNEQUAL_MODULATION_START_BYTE \
  1164. (IEEE80211_HT_MCS_UNEQUAL_MODULATION_START / 8)
  1165. /**
  1166. * struct ieee80211_ht_cap - HT capabilities
  1167. *
  1168. * This structure is the "HT capabilities element" as
  1169. * described in 802.11n D5.0 7.3.2.57
  1170. */
  1171. struct ieee80211_ht_cap {
  1172. __le16 cap_info;
  1173. u8 ampdu_params_info;
  1174. /* 16 bytes MCS information */
  1175. struct ieee80211_mcs_info mcs;
  1176. __le16 extended_ht_cap_info;
  1177. __le32 tx_BF_cap_info;
  1178. u8 antenna_selection_info;
  1179. } __packed;
  1180. /* 802.11n HT capabilities masks (for cap_info) */
  1181. #define IEEE80211_HT_CAP_LDPC_CODING 0x0001
  1182. #define IEEE80211_HT_CAP_SUP_WIDTH_20_40 0x0002
  1183. #define IEEE80211_HT_CAP_SM_PS 0x000C
  1184. #define IEEE80211_HT_CAP_SM_PS_SHIFT 2
  1185. #define IEEE80211_HT_CAP_GRN_FLD 0x0010
  1186. #define IEEE80211_HT_CAP_SGI_20 0x0020
  1187. #define IEEE80211_HT_CAP_SGI_40 0x0040
  1188. #define IEEE80211_HT_CAP_TX_STBC 0x0080
  1189. #define IEEE80211_HT_CAP_RX_STBC 0x0300
  1190. #define IEEE80211_HT_CAP_RX_STBC_SHIFT 8
  1191. #define IEEE80211_HT_CAP_DELAY_BA 0x0400
  1192. #define IEEE80211_HT_CAP_MAX_AMSDU 0x0800
  1193. #define IEEE80211_HT_CAP_DSSSCCK40 0x1000
  1194. #define IEEE80211_HT_CAP_RESERVED 0x2000
  1195. #define IEEE80211_HT_CAP_40MHZ_INTOLERANT 0x4000
  1196. #define IEEE80211_HT_CAP_LSIG_TXOP_PROT 0x8000
  1197. /* 802.11n HT extended capabilities masks (for extended_ht_cap_info) */
  1198. #define IEEE80211_HT_EXT_CAP_PCO 0x0001
  1199. #define IEEE80211_HT_EXT_CAP_PCO_TIME 0x0006
  1200. #define IEEE80211_HT_EXT_CAP_PCO_TIME_SHIFT 1
  1201. #define IEEE80211_HT_EXT_CAP_MCS_FB 0x0300
  1202. #define IEEE80211_HT_EXT_CAP_MCS_FB_SHIFT 8
  1203. #define IEEE80211_HT_EXT_CAP_HTC_SUP 0x0400
  1204. #define IEEE80211_HT_EXT_CAP_RD_RESPONDER 0x0800
  1205. /* 802.11n HT capability AMPDU settings (for ampdu_params_info) */
  1206. #define IEEE80211_HT_AMPDU_PARM_FACTOR 0x03
  1207. #define IEEE80211_HT_AMPDU_PARM_DENSITY 0x1C
  1208. #define IEEE80211_HT_AMPDU_PARM_DENSITY_SHIFT 2
  1209. /*
  1210. * Maximum length of AMPDU that the STA can receive in high-throughput (HT).
  1211. * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
  1212. */
  1213. enum ieee80211_max_ampdu_length_exp {
  1214. IEEE80211_HT_MAX_AMPDU_8K = 0,
  1215. IEEE80211_HT_MAX_AMPDU_16K = 1,
  1216. IEEE80211_HT_MAX_AMPDU_32K = 2,
  1217. IEEE80211_HT_MAX_AMPDU_64K = 3
  1218. };
  1219. /*
  1220. * Maximum length of AMPDU that the STA can receive in VHT.
  1221. * Length = 2 ^ (13 + max_ampdu_length_exp) - 1 (octets)
  1222. */
  1223. enum ieee80211_vht_max_ampdu_length_exp {
  1224. IEEE80211_VHT_MAX_AMPDU_8K = 0,
  1225. IEEE80211_VHT_MAX_AMPDU_16K = 1,
  1226. IEEE80211_VHT_MAX_AMPDU_32K = 2,
  1227. IEEE80211_VHT_MAX_AMPDU_64K = 3,
  1228. IEEE80211_VHT_MAX_AMPDU_128K = 4,
  1229. IEEE80211_VHT_MAX_AMPDU_256K = 5,
  1230. IEEE80211_VHT_MAX_AMPDU_512K = 6,
  1231. IEEE80211_VHT_MAX_AMPDU_1024K = 7
  1232. };
  1233. #define IEEE80211_HT_MAX_AMPDU_FACTOR 13
  1234. /* Minimum MPDU start spacing */
  1235. enum ieee80211_min_mpdu_spacing {
  1236. IEEE80211_HT_MPDU_DENSITY_NONE = 0, /* No restriction */
  1237. IEEE80211_HT_MPDU_DENSITY_0_25 = 1, /* 1/4 usec */
  1238. IEEE80211_HT_MPDU_DENSITY_0_5 = 2, /* 1/2 usec */
  1239. IEEE80211_HT_MPDU_DENSITY_1 = 3, /* 1 usec */
  1240. IEEE80211_HT_MPDU_DENSITY_2 = 4, /* 2 usec */
  1241. IEEE80211_HT_MPDU_DENSITY_4 = 5, /* 4 usec */
  1242. IEEE80211_HT_MPDU_DENSITY_8 = 6, /* 8 usec */
  1243. IEEE80211_HT_MPDU_DENSITY_16 = 7 /* 16 usec */
  1244. };
  1245. /**
  1246. * struct ieee80211_ht_operation - HT operation IE
  1247. *
  1248. * This structure is the "HT operation element" as
  1249. * described in 802.11n-2009 7.3.2.57
  1250. */
  1251. struct ieee80211_ht_operation {
  1252. u8 primary_chan;
  1253. u8 ht_param;
  1254. __le16 operation_mode;
  1255. __le16 stbc_param;
  1256. u8 basic_set[16];
  1257. } __packed;
  1258. /* for ht_param */
  1259. #define IEEE80211_HT_PARAM_CHA_SEC_OFFSET 0x03
  1260. #define IEEE80211_HT_PARAM_CHA_SEC_NONE 0x00
  1261. #define IEEE80211_HT_PARAM_CHA_SEC_ABOVE 0x01
  1262. #define IEEE80211_HT_PARAM_CHA_SEC_BELOW 0x03
  1263. #define IEEE80211_HT_PARAM_CHAN_WIDTH_ANY 0x04
  1264. #define IEEE80211_HT_PARAM_RIFS_MODE 0x08
  1265. /* for operation_mode */
  1266. #define IEEE80211_HT_OP_MODE_PROTECTION 0x0003
  1267. #define IEEE80211_HT_OP_MODE_PROTECTION_NONE 0
  1268. #define IEEE80211_HT_OP_MODE_PROTECTION_NONMEMBER 1
  1269. #define IEEE80211_HT_OP_MODE_PROTECTION_20MHZ 2
  1270. #define IEEE80211_HT_OP_MODE_PROTECTION_NONHT_MIXED 3
  1271. #define IEEE80211_HT_OP_MODE_NON_GF_STA_PRSNT 0x0004
  1272. #define IEEE80211_HT_OP_MODE_NON_HT_STA_PRSNT 0x0010
  1273. /* for stbc_param */
  1274. #define IEEE80211_HT_STBC_PARAM_DUAL_BEACON 0x0040
  1275. #define IEEE80211_HT_STBC_PARAM_DUAL_CTS_PROT 0x0080
  1276. #define IEEE80211_HT_STBC_PARAM_STBC_BEACON 0x0100
  1277. #define IEEE80211_HT_STBC_PARAM_LSIG_TXOP_FULLPROT 0x0200
  1278. #define IEEE80211_HT_STBC_PARAM_PCO_ACTIVE 0x0400
  1279. #define IEEE80211_HT_STBC_PARAM_PCO_PHASE 0x0800
  1280. /* block-ack parameters */
  1281. #define IEEE80211_ADDBA_PARAM_AMSDU_MASK 0x0001
  1282. #define IEEE80211_ADDBA_PARAM_POLICY_MASK 0x0002
  1283. #define IEEE80211_ADDBA_PARAM_TID_MASK 0x003C
  1284. #define IEEE80211_ADDBA_PARAM_BUF_SIZE_MASK 0xFFC0
  1285. #define IEEE80211_DELBA_PARAM_TID_MASK 0xF000
  1286. #define IEEE80211_DELBA_PARAM_INITIATOR_MASK 0x0800
  1287. /*
  1288. * A-PMDU buffer sizes
  1289. * According to IEEE802.11n spec size varies from 8K to 64K (in powers of 2)
  1290. */
  1291. #define IEEE80211_MIN_AMPDU_BUF 0x8
  1292. #define IEEE80211_MAX_AMPDU_BUF 0x40
  1293. /* Spatial Multiplexing Power Save Modes (for capability) */
  1294. #define WLAN_HT_CAP_SM_PS_STATIC 0
  1295. #define WLAN_HT_CAP_SM_PS_DYNAMIC 1
  1296. #define WLAN_HT_CAP_SM_PS_INVALID 2
  1297. #define WLAN_HT_CAP_SM_PS_DISABLED 3
  1298. /* for SM power control field lower two bits */
  1299. #define WLAN_HT_SMPS_CONTROL_DISABLED 0
  1300. #define WLAN_HT_SMPS_CONTROL_STATIC 1
  1301. #define WLAN_HT_SMPS_CONTROL_DYNAMIC 3
  1302. /**
  1303. * struct ieee80211_vht_mcs_info - VHT MCS information
  1304. * @rx_mcs_map: RX MCS map 2 bits for each stream, total 8 streams
  1305. * @rx_highest: Indicates highest long GI VHT PPDU data rate
  1306. * STA can receive. Rate expressed in units of 1 Mbps.
  1307. * If this field is 0 this value should not be used to
  1308. * consider the highest RX data rate supported.
  1309. * The top 3 bits of this field are reserved.
  1310. * @tx_mcs_map: TX MCS map 2 bits for each stream, total 8 streams
  1311. * @tx_highest: Indicates highest long GI VHT PPDU data rate
  1312. * STA can transmit. Rate expressed in units of 1 Mbps.
  1313. * If this field is 0 this value should not be used to
  1314. * consider the highest TX data rate supported.
  1315. * The top 3 bits of this field are reserved.
  1316. */
  1317. struct ieee80211_vht_mcs_info {
  1318. __le16 rx_mcs_map;
  1319. __le16 rx_highest;
  1320. __le16 tx_mcs_map;
  1321. __le16 tx_highest;
  1322. } __packed;
  1323. /**
  1324. * enum ieee80211_vht_mcs_support - VHT MCS support definitions
  1325. * @IEEE80211_VHT_MCS_SUPPORT_0_7: MCSes 0-7 are supported for the
  1326. * number of streams
  1327. * @IEEE80211_VHT_MCS_SUPPORT_0_8: MCSes 0-8 are supported
  1328. * @IEEE80211_VHT_MCS_SUPPORT_0_9: MCSes 0-9 are supported
  1329. * @IEEE80211_VHT_MCS_NOT_SUPPORTED: This number of streams isn't supported
  1330. *
  1331. * These definitions are used in each 2-bit subfield of the @rx_mcs_map
  1332. * and @tx_mcs_map fields of &struct ieee80211_vht_mcs_info, which are
  1333. * both split into 8 subfields by number of streams. These values indicate
  1334. * which MCSes are supported for the number of streams the value appears
  1335. * for.
  1336. */
  1337. enum ieee80211_vht_mcs_support {
  1338. IEEE80211_VHT_MCS_SUPPORT_0_7 = 0,
  1339. IEEE80211_VHT_MCS_SUPPORT_0_8 = 1,
  1340. IEEE80211_VHT_MCS_SUPPORT_0_9 = 2,
  1341. IEEE80211_VHT_MCS_NOT_SUPPORTED = 3,
  1342. };
  1343. /**
  1344. * struct ieee80211_vht_cap - VHT capabilities
  1345. *
  1346. * This structure is the "VHT capabilities element" as
  1347. * described in 802.11ac D3.0 8.4.2.160
  1348. * @vht_cap_info: VHT capability info
  1349. * @supp_mcs: VHT MCS supported rates
  1350. */
  1351. struct ieee80211_vht_cap {
  1352. __le32 vht_cap_info;
  1353. struct ieee80211_vht_mcs_info supp_mcs;
  1354. } __packed;
  1355. /**
  1356. * enum ieee80211_vht_chanwidth - VHT channel width
  1357. * @IEEE80211_VHT_CHANWIDTH_USE_HT: use the HT operation IE to
  1358. * determine the channel width (20 or 40 MHz)
  1359. * @IEEE80211_VHT_CHANWIDTH_80MHZ: 80 MHz bandwidth
  1360. * @IEEE80211_VHT_CHANWIDTH_160MHZ: 160 MHz bandwidth
  1361. * @IEEE80211_VHT_CHANWIDTH_80P80MHZ: 80+80 MHz bandwidth
  1362. */
  1363. enum ieee80211_vht_chanwidth {
  1364. IEEE80211_VHT_CHANWIDTH_USE_HT = 0,
  1365. IEEE80211_VHT_CHANWIDTH_80MHZ = 1,
  1366. IEEE80211_VHT_CHANWIDTH_160MHZ = 2,
  1367. IEEE80211_VHT_CHANWIDTH_80P80MHZ = 3,
  1368. };
  1369. /**
  1370. * struct ieee80211_vht_operation - VHT operation IE
  1371. *
  1372. * This structure is the "VHT operation element" as
  1373. * described in 802.11ac D3.0 8.4.2.161
  1374. * @chan_width: Operating channel width
  1375. * @center_freq_seg1_idx: center freq segment 1 index
  1376. * @center_freq_seg2_idx: center freq segment 2 index
  1377. * @basic_mcs_set: VHT Basic MCS rate set
  1378. */
  1379. struct ieee80211_vht_operation {
  1380. u8 chan_width;
  1381. u8 center_freq_seg1_idx;
  1382. u8 center_freq_seg2_idx;
  1383. __le16 basic_mcs_set;
  1384. } __packed;
  1385. /* 802.11ac VHT Capabilities */
  1386. #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_3895 0x00000000
  1387. #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_7991 0x00000001
  1388. #define IEEE80211_VHT_CAP_MAX_MPDU_LENGTH_11454 0x00000002
  1389. #define IEEE80211_VHT_CAP_MAX_MPDU_MASK 0x00000003
  1390. #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160MHZ 0x00000004
  1391. #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_160_80PLUS80MHZ 0x00000008
  1392. #define IEEE80211_VHT_CAP_SUPP_CHAN_WIDTH_MASK 0x0000000C
  1393. #define IEEE80211_VHT_CAP_RXLDPC 0x00000010
  1394. #define IEEE80211_VHT_CAP_SHORT_GI_80 0x00000020
  1395. #define IEEE80211_VHT_CAP_SHORT_GI_160 0x00000040
  1396. #define IEEE80211_VHT_CAP_TXSTBC 0x00000080
  1397. #define IEEE80211_VHT_CAP_RXSTBC_1 0x00000100
  1398. #define IEEE80211_VHT_CAP_RXSTBC_2 0x00000200
  1399. #define IEEE80211_VHT_CAP_RXSTBC_3 0x00000300
  1400. #define IEEE80211_VHT_CAP_RXSTBC_4 0x00000400
  1401. #define IEEE80211_VHT_CAP_RXSTBC_MASK 0x00000700
  1402. #define IEEE80211_VHT_CAP_SU_BEAMFORMER_CAPABLE 0x00000800
  1403. #define IEEE80211_VHT_CAP_SU_BEAMFORMEE_CAPABLE 0x00001000
  1404. #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT 13
  1405. #define IEEE80211_VHT_CAP_BEAMFORMEE_STS_MASK \
  1406. (7 << IEEE80211_VHT_CAP_BEAMFORMEE_STS_SHIFT)
  1407. #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT 16
  1408. #define IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_MASK \
  1409. (7 << IEEE80211_VHT_CAP_SOUNDING_DIMENSIONS_SHIFT)
  1410. #define IEEE80211_VHT_CAP_MU_BEAMFORMER_CAPABLE 0x00080000
  1411. #define IEEE80211_VHT_CAP_MU_BEAMFORMEE_CAPABLE 0x00100000
  1412. #define IEEE80211_VHT_CAP_VHT_TXOP_PS 0x00200000
  1413. #define IEEE80211_VHT_CAP_HTC_VHT 0x00400000
  1414. #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT 23
  1415. #define IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_MASK \
  1416. (7 << IEEE80211_VHT_CAP_MAX_A_MPDU_LENGTH_EXPONENT_SHIFT)
  1417. #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_UNSOL_MFB 0x08000000
  1418. #define IEEE80211_VHT_CAP_VHT_LINK_ADAPTATION_VHT_MRQ_MFB 0x0c000000
  1419. #define IEEE80211_VHT_CAP_RX_ANTENNA_PATTERN 0x10000000
  1420. #define IEEE80211_VHT_CAP_TX_ANTENNA_PATTERN 0x20000000
  1421. /* Authentication algorithms */
  1422. #define WLAN_AUTH_OPEN 0
  1423. #define WLAN_AUTH_SHARED_KEY 1
  1424. #define WLAN_AUTH_FT 2
  1425. #define WLAN_AUTH_SAE 3
  1426. #define WLAN_AUTH_LEAP 128
  1427. #define WLAN_AUTH_CHALLENGE_LEN 128
  1428. #define WLAN_CAPABILITY_ESS (1<<0)
  1429. #define WLAN_CAPABILITY_IBSS (1<<1)
  1430. /*
  1431. * A mesh STA sets the ESS and IBSS capability bits to zero.
  1432. * however, this holds true for p2p probe responses (in the p2p_find
  1433. * phase) as well.
  1434. */
  1435. #define WLAN_CAPABILITY_IS_STA_BSS(cap) \
  1436. (!((cap) & (WLAN_CAPABILITY_ESS | WLAN_CAPABILITY_IBSS)))
  1437. #define WLAN_CAPABILITY_CF_POLLABLE (1<<2)
  1438. #define WLAN_CAPABILITY_CF_POLL_REQUEST (1<<3)
  1439. #define WLAN_CAPABILITY_PRIVACY (1<<4)
  1440. #define WLAN_CAPABILITY_SHORT_PREAMBLE (1<<5)
  1441. #define WLAN_CAPABILITY_PBCC (1<<6)
  1442. #define WLAN_CAPABILITY_CHANNEL_AGILITY (1<<7)
  1443. /* 802.11h */
  1444. #define WLAN_CAPABILITY_SPECTRUM_MGMT (1<<8)
  1445. #define WLAN_CAPABILITY_QOS (1<<9)
  1446. #define WLAN_CAPABILITY_SHORT_SLOT_TIME (1<<10)
  1447. #define WLAN_CAPABILITY_APSD (1<<11)
  1448. #define WLAN_CAPABILITY_RADIO_MEASURE (1<<12)
  1449. #define WLAN_CAPABILITY_DSSS_OFDM (1<<13)
  1450. #define WLAN_CAPABILITY_DEL_BACK (1<<14)
  1451. #define WLAN_CAPABILITY_IMM_BACK (1<<15)
  1452. /* DMG (60gHz) 802.11ad */
  1453. /* type - bits 0..1 */
  1454. #define WLAN_CAPABILITY_DMG_TYPE_MASK (3<<0)
  1455. #define WLAN_CAPABILITY_DMG_TYPE_IBSS (1<<0) /* Tx by: STA */
  1456. #define WLAN_CAPABILITY_DMG_TYPE_PBSS (2<<0) /* Tx by: PCP */
  1457. #define WLAN_CAPABILITY_DMG_TYPE_AP (3<<0) /* Tx by: AP */
  1458. #define WLAN_CAPABILITY_DMG_CBAP_ONLY (1<<2)
  1459. #define WLAN_CAPABILITY_DMG_CBAP_SOURCE (1<<3)
  1460. #define WLAN_CAPABILITY_DMG_PRIVACY (1<<4)
  1461. #define WLAN_CAPABILITY_DMG_ECPAC (1<<5)
  1462. #define WLAN_CAPABILITY_DMG_SPECTRUM_MGMT (1<<8)
  1463. #define WLAN_CAPABILITY_DMG_RADIO_MEASURE (1<<12)
  1464. /* measurement */
  1465. #define IEEE80211_SPCT_MSR_RPRT_MODE_LATE (1<<0)
  1466. #define IEEE80211_SPCT_MSR_RPRT_MODE_INCAPABLE (1<<1)
  1467. #define IEEE80211_SPCT_MSR_RPRT_MODE_REFUSED (1<<2)
  1468. #define IEEE80211_SPCT_MSR_RPRT_TYPE_BASIC 0
  1469. #define IEEE80211_SPCT_MSR_RPRT_TYPE_CCA 1
  1470. #define IEEE80211_SPCT_MSR_RPRT_TYPE_RPI 2
  1471. /* 802.11g ERP information element */
  1472. #define WLAN_ERP_NON_ERP_PRESENT (1<<0)
  1473. #define WLAN_ERP_USE_PROTECTION (1<<1)
  1474. #define WLAN_ERP_BARKER_PREAMBLE (1<<2)
  1475. /* WLAN_ERP_BARKER_PREAMBLE values */
  1476. enum {
  1477. WLAN_ERP_PREAMBLE_SHORT = 0,
  1478. WLAN_ERP_PREAMBLE_LONG = 1,
  1479. };
  1480. /* Band ID, 802.11ad #8.4.1.45 */
  1481. enum {
  1482. IEEE80211_BANDID_TV_WS = 0, /* TV white spaces */
  1483. IEEE80211_BANDID_SUB1 = 1, /* Sub-1 GHz (excluding TV white spaces) */
  1484. IEEE80211_BANDID_2G = 2, /* 2.4 GHz */
  1485. IEEE80211_BANDID_3G = 3, /* 3.6 GHz */
  1486. IEEE80211_BANDID_5G = 4, /* 4.9 and 5 GHz */
  1487. IEEE80211_BANDID_60G = 5, /* 60 GHz */
  1488. };
  1489. /* Status codes */
  1490. enum ieee80211_statuscode {
  1491. WLAN_STATUS_SUCCESS = 0,
  1492. WLAN_STATUS_UNSPECIFIED_FAILURE = 1,
  1493. WLAN_STATUS_CAPS_UNSUPPORTED = 10,
  1494. WLAN_STATUS_REASSOC_NO_ASSOC = 11,
  1495. WLAN_STATUS_ASSOC_DENIED_UNSPEC = 12,
  1496. WLAN_STATUS_NOT_SUPPORTED_AUTH_ALG = 13,
  1497. WLAN_STATUS_UNKNOWN_AUTH_TRANSACTION = 14,
  1498. WLAN_STATUS_CHALLENGE_FAIL = 15,
  1499. WLAN_STATUS_AUTH_TIMEOUT = 16,
  1500. WLAN_STATUS_AP_UNABLE_TO_HANDLE_NEW_STA = 17,
  1501. WLAN_STATUS_ASSOC_DENIED_RATES = 18,
  1502. /* 802.11b */
  1503. WLAN_STATUS_ASSOC_DENIED_NOSHORTPREAMBLE = 19,
  1504. WLAN_STATUS_ASSOC_DENIED_NOPBCC = 20,
  1505. WLAN_STATUS_ASSOC_DENIED_NOAGILITY = 21,
  1506. /* 802.11h */
  1507. WLAN_STATUS_ASSOC_DENIED_NOSPECTRUM = 22,
  1508. WLAN_STATUS_ASSOC_REJECTED_BAD_POWER = 23,
  1509. WLAN_STATUS_ASSOC_REJECTED_BAD_SUPP_CHAN = 24,
  1510. /* 802.11g */
  1511. WLAN_STATUS_ASSOC_DENIED_NOSHORTTIME = 25,
  1512. WLAN_STATUS_ASSOC_DENIED_NODSSSOFDM = 26,
  1513. /* 802.11w */
  1514. WLAN_STATUS_ASSOC_REJECTED_TEMPORARILY = 30,
  1515. WLAN_STATUS_ROBUST_MGMT_FRAME_POLICY_VIOLATION = 31,
  1516. /* 802.11i */
  1517. WLAN_STATUS_INVALID_IE = 40,
  1518. WLAN_STATUS_INVALID_GROUP_CIPHER = 41,
  1519. WLAN_STATUS_INVALID_PAIRWISE_CIPHER = 42,
  1520. WLAN_STATUS_INVALID_AKMP = 43,
  1521. WLAN_STATUS_UNSUPP_RSN_VERSION = 44,
  1522. WLAN_STATUS_INVALID_RSN_IE_CAP = 45,
  1523. WLAN_STATUS_CIPHER_SUITE_REJECTED = 46,
  1524. /* 802.11e */
  1525. WLAN_STATUS_UNSPECIFIED_QOS = 32,
  1526. WLAN_STATUS_ASSOC_DENIED_NOBANDWIDTH = 33,
  1527. WLAN_STATUS_ASSOC_DENIED_LOWACK = 34,
  1528. WLAN_STATUS_ASSOC_DENIED_UNSUPP_QOS = 35,
  1529. WLAN_STATUS_REQUEST_DECLINED = 37,
  1530. WLAN_STATUS_INVALID_QOS_PARAM = 38,
  1531. WLAN_STATUS_CHANGE_TSPEC = 39,
  1532. WLAN_STATUS_WAIT_TS_DELAY = 47,
  1533. WLAN_STATUS_NO_DIRECT_LINK = 48,
  1534. WLAN_STATUS_STA_NOT_PRESENT = 49,
  1535. WLAN_STATUS_STA_NOT_QSTA = 50,
  1536. /* 802.11s */
  1537. WLAN_STATUS_ANTI_CLOG_REQUIRED = 76,
  1538. WLAN_STATUS_FCG_NOT_SUPP = 78,
  1539. WLAN_STATUS_STA_NO_TBTT = 78,
  1540. /* 802.11ad */
  1541. WLAN_STATUS_REJECTED_WITH_SUGGESTED_CHANGES = 39,
  1542. WLAN_STATUS_REJECTED_FOR_DELAY_PERIOD = 47,
  1543. WLAN_STATUS_REJECT_WITH_SCHEDULE = 83,
  1544. WLAN_STATUS_PENDING_ADMITTING_FST_SESSION = 86,
  1545. WLAN_STATUS_PERFORMING_FST_NOW = 87,
  1546. WLAN_STATUS_PENDING_GAP_IN_BA_WINDOW = 88,
  1547. WLAN_STATUS_REJECT_U_PID_SETTING = 89,
  1548. WLAN_STATUS_REJECT_DSE_BAND = 96,
  1549. WLAN_STATUS_DENIED_WITH_SUGGESTED_BAND_AND_CHANNEL = 99,
  1550. WLAN_STATUS_DENIED_DUE_TO_SPECTRUM_MANAGEMENT = 103,
  1551. };
  1552. /* Reason codes */
  1553. enum ieee80211_reasoncode {
  1554. WLAN_REASON_UNSPECIFIED = 1,
  1555. WLAN_REASON_PREV_AUTH_NOT_VALID = 2,
  1556. WLAN_REASON_DEAUTH_LEAVING = 3,
  1557. WLAN_REASON_DISASSOC_DUE_TO_INACTIVITY = 4,
  1558. WLAN_REASON_DISASSOC_AP_BUSY = 5,
  1559. WLAN_REASON_CLASS2_FRAME_FROM_NONAUTH_STA = 6,
  1560. WLAN_REASON_CLASS3_FRAME_FROM_NONASSOC_STA = 7,
  1561. WLAN_REASON_DISASSOC_STA_HAS_LEFT = 8,
  1562. WLAN_REASON_STA_REQ_ASSOC_WITHOUT_AUTH = 9,
  1563. /* 802.11h */
  1564. WLAN_REASON_DISASSOC_BAD_POWER = 10,
  1565. WLAN_REASON_DISASSOC_BAD_SUPP_CHAN = 11,
  1566. /* 802.11i */
  1567. WLAN_REASON_INVALID_IE = 13,
  1568. WLAN_REASON_MIC_FAILURE = 14,
  1569. WLAN_REASON_4WAY_HANDSHAKE_TIMEOUT = 15,
  1570. WLAN_REASON_GROUP_KEY_HANDSHAKE_TIMEOUT = 16,
  1571. WLAN_REASON_IE_DIFFERENT = 17,
  1572. WLAN_REASON_INVALID_GROUP_CIPHER = 18,
  1573. WLAN_REASON_INVALID_PAIRWISE_CIPHER = 19,
  1574. WLAN_REASON_INVALID_AKMP = 20,
  1575. WLAN_REASON_UNSUPP_RSN_VERSION = 21,
  1576. WLAN_REASON_INVALID_RSN_IE_CAP = 22,
  1577. WLAN_REASON_IEEE8021X_FAILED = 23,
  1578. WLAN_REASON_CIPHER_SUITE_REJECTED = 24,
  1579. /* TDLS (802.11z) */
  1580. WLAN_REASON_TDLS_TEARDOWN_UNREACHABLE = 25,
  1581. WLAN_REASON_TDLS_TEARDOWN_UNSPECIFIED = 26,
  1582. /* 802.11e */
  1583. WLAN_REASON_DISASSOC_UNSPECIFIED_QOS = 32,
  1584. WLAN_REASON_DISASSOC_QAP_NO_BANDWIDTH = 33,
  1585. WLAN_REASON_DISASSOC_LOW_ACK = 34,
  1586. WLAN_REASON_DISASSOC_QAP_EXCEED_TXOP = 35,
  1587. WLAN_REASON_QSTA_LEAVE_QBSS = 36,
  1588. WLAN_REASON_QSTA_NOT_USE = 37,
  1589. WLAN_REASON_QSTA_REQUIRE_SETUP = 38,
  1590. WLAN_REASON_QSTA_TIMEOUT = 39,
  1591. WLAN_REASON_QSTA_CIPHER_NOT_SUPP = 45,
  1592. /* 802.11s */
  1593. WLAN_REASON_MESH_PEER_CANCELED = 52,
  1594. WLAN_REASON_MESH_MAX_PEERS = 53,
  1595. WLAN_REASON_MESH_CONFIG = 54,
  1596. WLAN_REASON_MESH_CLOSE = 55,
  1597. WLAN_REASON_MESH_MAX_RETRIES = 56,
  1598. WLAN_REASON_MESH_CONFIRM_TIMEOUT = 57,
  1599. WLAN_REASON_MESH_INVALID_GTK = 58,
  1600. WLAN_REASON_MESH_INCONSISTENT_PARAM = 59,
  1601. WLAN_REASON_MESH_INVALID_SECURITY = 60,
  1602. WLAN_REASON_MESH_PATH_ERROR = 61,
  1603. WLAN_REASON_MESH_PATH_NOFORWARD = 62,
  1604. WLAN_REASON_MESH_PATH_DEST_UNREACHABLE = 63,
  1605. WLAN_REASON_MAC_EXISTS_IN_MBSS = 64,
  1606. WLAN_REASON_MESH_CHAN_REGULATORY = 65,
  1607. WLAN_REASON_MESH_CHAN = 66,
  1608. };
  1609. /* Information Element IDs */
  1610. enum ieee80211_eid {
  1611. WLAN_EID_SSID = 0,
  1612. WLAN_EID_SUPP_RATES = 1,
  1613. WLAN_EID_FH_PARAMS = 2, /* reserved now */
  1614. WLAN_EID_DS_PARAMS = 3,
  1615. WLAN_EID_CF_PARAMS = 4,
  1616. WLAN_EID_TIM = 5,
  1617. WLAN_EID_IBSS_PARAMS = 6,
  1618. WLAN_EID_COUNTRY = 7,
  1619. /* 8, 9 reserved */
  1620. WLAN_EID_REQUEST = 10,
  1621. WLAN_EID_QBSS_LOAD = 11,
  1622. WLAN_EID_EDCA_PARAM_SET = 12,
  1623. WLAN_EID_TSPEC = 13,
  1624. WLAN_EID_TCLAS = 14,
  1625. WLAN_EID_SCHEDULE = 15,
  1626. WLAN_EID_CHALLENGE = 16,
  1627. /* 17-31 reserved for challenge text extension */
  1628. WLAN_EID_PWR_CONSTRAINT = 32,
  1629. WLAN_EID_PWR_CAPABILITY = 33,
  1630. WLAN_EID_TPC_REQUEST = 34,
  1631. WLAN_EID_TPC_REPORT = 35,
  1632. WLAN_EID_SUPPORTED_CHANNELS = 36,
  1633. WLAN_EID_CHANNEL_SWITCH = 37,
  1634. WLAN_EID_MEASURE_REQUEST = 38,
  1635. WLAN_EID_MEASURE_REPORT = 39,
  1636. WLAN_EID_QUIET = 40,
  1637. WLAN_EID_IBSS_DFS = 41,
  1638. WLAN_EID_ERP_INFO = 42,
  1639. WLAN_EID_TS_DELAY = 43,
  1640. WLAN_EID_TCLAS_PROCESSING = 44,
  1641. WLAN_EID_HT_CAPABILITY = 45,
  1642. WLAN_EID_QOS_CAPA = 46,
  1643. /* 47 reserved for Broadcom */
  1644. WLAN_EID_RSN = 48,
  1645. WLAN_EID_802_15_COEX = 49,
  1646. WLAN_EID_EXT_SUPP_RATES = 50,
  1647. WLAN_EID_AP_CHAN_REPORT = 51,
  1648. WLAN_EID_NEIGHBOR_REPORT = 52,
  1649. WLAN_EID_RCPI = 53,
  1650. WLAN_EID_MOBILITY_DOMAIN = 54,
  1651. WLAN_EID_FAST_BSS_TRANSITION = 55,
  1652. WLAN_EID_TIMEOUT_INTERVAL = 56,
  1653. WLAN_EID_RIC_DATA = 57,
  1654. WLAN_EID_DSE_REGISTERED_LOCATION = 58,
  1655. WLAN_EID_SUPPORTED_REGULATORY_CLASSES = 59,
  1656. WLAN_EID_EXT_CHANSWITCH_ANN = 60,
  1657. WLAN_EID_HT_OPERATION = 61,
  1658. WLAN_EID_SECONDARY_CHANNEL_OFFSET = 62,
  1659. WLAN_EID_BSS_AVG_ACCESS_DELAY = 63,
  1660. WLAN_EID_ANTENNA_INFO = 64,
  1661. WLAN_EID_RSNI = 65,
  1662. WLAN_EID_MEASUREMENT_PILOT_TX_INFO = 66,
  1663. WLAN_EID_BSS_AVAILABLE_CAPACITY = 67,
  1664. WLAN_EID_BSS_AC_ACCESS_DELAY = 68,
  1665. WLAN_EID_TIME_ADVERTISEMENT = 69,
  1666. WLAN_EID_RRM_ENABLED_CAPABILITIES = 70,
  1667. WLAN_EID_MULTIPLE_BSSID = 71,
  1668. WLAN_EID_BSS_COEX_2040 = 72,
  1669. WLAN_EID_BSS_INTOLERANT_CHL_REPORT = 73,
  1670. WLAN_EID_OVERLAP_BSS_SCAN_PARAM = 74,
  1671. WLAN_EID_RIC_DESCRIPTOR = 75,
  1672. WLAN_EID_MMIE = 76,
  1673. WLAN_EID_ASSOC_COMEBACK_TIME = 77,
  1674. WLAN_EID_EVENT_REQUEST = 78,
  1675. WLAN_EID_EVENT_REPORT = 79,
  1676. WLAN_EID_DIAGNOSTIC_REQUEST = 80,
  1677. WLAN_EID_DIAGNOSTIC_REPORT = 81,
  1678. WLAN_EID_LOCATION_PARAMS = 82,
  1679. WLAN_EID_NON_TX_BSSID_CAP = 83,
  1680. WLAN_EID_SSID_LIST = 84,
  1681. WLAN_EID_MULTI_BSSID_IDX = 85,
  1682. WLAN_EID_FMS_DESCRIPTOR = 86,
  1683. WLAN_EID_FMS_REQUEST = 87,
  1684. WLAN_EID_FMS_RESPONSE = 88,
  1685. WLAN_EID_QOS_TRAFFIC_CAPA = 89,
  1686. WLAN_EID_BSS_MAX_IDLE_PERIOD = 90,
  1687. WLAN_EID_TSF_REQUEST = 91,
  1688. WLAN_EID_TSF_RESPOSNE = 92,
  1689. WLAN_EID_WNM_SLEEP_MODE = 93,
  1690. WLAN_EID_TIM_BCAST_REQ = 94,
  1691. WLAN_EID_TIM_BCAST_RESP = 95,
  1692. WLAN_EID_COLL_IF_REPORT = 96,
  1693. WLAN_EID_CHANNEL_USAGE = 97,
  1694. WLAN_EID_TIME_ZONE = 98,
  1695. WLAN_EID_DMS_REQUEST = 99,
  1696. WLAN_EID_DMS_RESPONSE = 100,
  1697. WLAN_EID_LINK_ID = 101,
  1698. WLAN_EID_WAKEUP_SCHEDUL = 102,
  1699. /* 103 reserved */
  1700. WLAN_EID_CHAN_SWITCH_TIMING = 104,
  1701. WLAN_EID_PTI_CONTROL = 105,
  1702. WLAN_EID_PU_BUFFER_STATUS = 106,
  1703. WLAN_EID_INTERWORKING = 107,
  1704. WLAN_EID_ADVERTISEMENT_PROTOCOL = 108,
  1705. WLAN_EID_EXPEDITED_BW_REQ = 109,
  1706. WLAN_EID_QOS_MAP_SET = 110,
  1707. WLAN_EID_ROAMING_CONSORTIUM = 111,
  1708. WLAN_EID_EMERGENCY_ALERT = 112,
  1709. WLAN_EID_MESH_CONFIG = 113,
  1710. WLAN_EID_MESH_ID = 114,
  1711. WLAN_EID_LINK_METRIC_REPORT = 115,
  1712. WLAN_EID_CONGESTION_NOTIFICATION = 116,
  1713. WLAN_EID_PEER_MGMT = 117,
  1714. WLAN_EID_CHAN_SWITCH_PARAM = 118,
  1715. WLAN_EID_MESH_AWAKE_WINDOW = 119,
  1716. WLAN_EID_BEACON_TIMING = 120,
  1717. WLAN_EID_MCCAOP_SETUP_REQ = 121,
  1718. WLAN_EID_MCCAOP_SETUP_RESP = 122,
  1719. WLAN_EID_MCCAOP_ADVERT = 123,
  1720. WLAN_EID_MCCAOP_TEARDOWN = 124,
  1721. WLAN_EID_GANN = 125,
  1722. WLAN_EID_RANN = 126,
  1723. WLAN_EID_EXT_CAPABILITY = 127,
  1724. /* 128, 129 reserved for Agere */
  1725. WLAN_EID_PREQ = 130,
  1726. WLAN_EID_PREP = 131,
  1727. WLAN_EID_PERR = 132,
  1728. /* 133-136 reserved for Cisco */
  1729. WLAN_EID_PXU = 137,
  1730. WLAN_EID_PXUC = 138,
  1731. WLAN_EID_AUTH_MESH_PEER_EXCH = 139,
  1732. WLAN_EID_MIC = 140,
  1733. WLAN_EID_DESTINATION_URI = 141,
  1734. WLAN_EID_UAPSD_COEX = 142,
  1735. WLAN_EID_WAKEUP_SCHEDULE = 143,
  1736. WLAN_EID_EXT_SCHEDULE = 144,
  1737. WLAN_EID_STA_AVAILABILITY = 145,
  1738. WLAN_EID_DMG_TSPEC = 146,
  1739. WLAN_EID_DMG_AT = 147,
  1740. WLAN_EID_DMG_CAP = 148,
  1741. /* 149 reserved for Cisco */
  1742. WLAN_EID_CISCO_VENDOR_SPECIFIC = 150,
  1743. WLAN_EID_DMG_OPERATION = 151,
  1744. WLAN_EID_DMG_BSS_PARAM_CHANGE = 152,
  1745. WLAN_EID_DMG_BEAM_REFINEMENT = 153,
  1746. WLAN_EID_CHANNEL_MEASURE_FEEDBACK = 154,
  1747. /* 155-156 reserved for Cisco */
  1748. WLAN_EID_AWAKE_WINDOW = 157,
  1749. WLAN_EID_MULTI_BAND = 158,
  1750. WLAN_EID_ADDBA_EXT = 159,
  1751. WLAN_EID_NEXT_PCP_LIST = 160,
  1752. WLAN_EID_PCP_HANDOVER = 161,
  1753. WLAN_EID_DMG_LINK_MARGIN = 162,
  1754. WLAN_EID_SWITCHING_STREAM = 163,
  1755. WLAN_EID_SESSION_TRANSITION = 164,
  1756. WLAN_EID_DYN_TONE_PAIRING_REPORT = 165,
  1757. WLAN_EID_CLUSTER_REPORT = 166,
  1758. WLAN_EID_RELAY_CAP = 167,
  1759. WLAN_EID_RELAY_XFER_PARAM_SET = 168,
  1760. WLAN_EID_BEAM_LINK_MAINT = 169,
  1761. WLAN_EID_MULTIPLE_MAC_ADDR = 170,
  1762. WLAN_EID_U_PID = 171,
  1763. WLAN_EID_DMG_LINK_ADAPT_ACK = 172,
  1764. /* 173 reserved for Symbol */
  1765. WLAN_EID_MCCAOP_ADV_OVERVIEW = 174,
  1766. WLAN_EID_QUIET_PERIOD_REQ = 175,
  1767. /* 176 reserved for Symbol */
  1768. WLAN_EID_QUIET_PERIOD_RESP = 177,
  1769. /* 178-179 reserved for Symbol */
  1770. /* 180 reserved for ISO/IEC 20011 */
  1771. WLAN_EID_EPAC_POLICY = 182,
  1772. WLAN_EID_CLISTER_TIME_OFF = 183,
  1773. WLAN_EID_INTER_AC_PRIO = 184,
  1774. WLAN_EID_SCS_DESCRIPTOR = 185,
  1775. WLAN_EID_QLOAD_REPORT = 186,
  1776. WLAN_EID_HCCA_TXOP_UPDATE_COUNT = 187,
  1777. WLAN_EID_HL_STREAM_ID = 188,
  1778. WLAN_EID_GCR_GROUP_ADDR = 189,
  1779. WLAN_EID_ANTENNA_SECTOR_ID_PATTERN = 190,
  1780. WLAN_EID_VHT_CAPABILITY = 191,
  1781. WLAN_EID_VHT_OPERATION = 192,
  1782. WLAN_EID_EXTENDED_BSS_LOAD = 193,
  1783. WLAN_EID_WIDE_BW_CHANNEL_SWITCH = 194,
  1784. WLAN_EID_VHT_TX_POWER_ENVELOPE = 195,
  1785. WLAN_EID_CHANNEL_SWITCH_WRAPPER = 196,
  1786. WLAN_EID_AID = 197,
  1787. WLAN_EID_QUIET_CHANNEL = 198,
  1788. WLAN_EID_OPMODE_NOTIF = 199,
  1789. WLAN_EID_VENDOR_SPECIFIC = 221,
  1790. WLAN_EID_QOS_PARAMETER = 222,
  1791. };
  1792. /* Action category code */
  1793. enum ieee80211_category {
  1794. WLAN_CATEGORY_SPECTRUM_MGMT = 0,
  1795. WLAN_CATEGORY_QOS = 1,
  1796. WLAN_CATEGORY_DLS = 2,
  1797. WLAN_CATEGORY_BACK = 3,
  1798. WLAN_CATEGORY_PUBLIC = 4,
  1799. WLAN_CATEGORY_RADIO_MEASUREMENT = 5,
  1800. WLAN_CATEGORY_HT = 7,
  1801. WLAN_CATEGORY_SA_QUERY = 8,
  1802. WLAN_CATEGORY_PROTECTED_DUAL_OF_ACTION = 9,
  1803. WLAN_CATEGORY_WNM = 10,
  1804. WLAN_CATEGORY_WNM_UNPROTECTED = 11,
  1805. WLAN_CATEGORY_TDLS = 12,
  1806. WLAN_CATEGORY_MESH_ACTION = 13,
  1807. WLAN_CATEGORY_MULTIHOP_ACTION = 14,
  1808. WLAN_CATEGORY_SELF_PROTECTED = 15,
  1809. WLAN_CATEGORY_DMG = 16,
  1810. WLAN_CATEGORY_WMM = 17,
  1811. WLAN_CATEGORY_FST = 18,
  1812. WLAN_CATEGORY_UNPROT_DMG = 20,
  1813. WLAN_CATEGORY_VHT = 21,
  1814. WLAN_CATEGORY_VENDOR_SPECIFIC_PROTECTED = 126,
  1815. WLAN_CATEGORY_VENDOR_SPECIFIC = 127,
  1816. };
  1817. /* SPECTRUM_MGMT action code */
  1818. enum ieee80211_spectrum_mgmt_actioncode {
  1819. WLAN_ACTION_SPCT_MSR_REQ = 0,
  1820. WLAN_ACTION_SPCT_MSR_RPRT = 1,
  1821. WLAN_ACTION_SPCT_TPC_REQ = 2,
  1822. WLAN_ACTION_SPCT_TPC_RPRT = 3,
  1823. WLAN_ACTION_SPCT_CHL_SWITCH = 4,
  1824. };
  1825. /* HT action codes */
  1826. enum ieee80211_ht_actioncode {
  1827. WLAN_HT_ACTION_NOTIFY_CHANWIDTH = 0,
  1828. WLAN_HT_ACTION_SMPS = 1,
  1829. WLAN_HT_ACTION_PSMP = 2,
  1830. WLAN_HT_ACTION_PCO_PHASE = 3,
  1831. WLAN_HT_ACTION_CSI = 4,
  1832. WLAN_HT_ACTION_NONCOMPRESSED_BF = 5,
  1833. WLAN_HT_ACTION_COMPRESSED_BF = 6,
  1834. WLAN_HT_ACTION_ASEL_IDX_FEEDBACK = 7,
  1835. };
  1836. /* VHT action codes */
  1837. enum ieee80211_vht_actioncode {
  1838. WLAN_VHT_ACTION_COMPRESSED_BF = 0,
  1839. WLAN_VHT_ACTION_GROUPID_MGMT = 1,
  1840. WLAN_VHT_ACTION_OPMODE_NOTIF = 2,
  1841. };
  1842. /* Self Protected Action codes */
  1843. enum ieee80211_self_protected_actioncode {
  1844. WLAN_SP_RESERVED = 0,
  1845. WLAN_SP_MESH_PEERING_OPEN = 1,
  1846. WLAN_SP_MESH_PEERING_CONFIRM = 2,
  1847. WLAN_SP_MESH_PEERING_CLOSE = 3,
  1848. WLAN_SP_MGK_INFORM = 4,
  1849. WLAN_SP_MGK_ACK = 5,
  1850. };
  1851. /* Mesh action codes */
  1852. enum ieee80211_mesh_actioncode {
  1853. WLAN_MESH_ACTION_LINK_METRIC_REPORT,
  1854. WLAN_MESH_ACTION_HWMP_PATH_SELECTION,
  1855. WLAN_MESH_ACTION_GATE_ANNOUNCEMENT,
  1856. WLAN_MESH_ACTION_CONGESTION_CONTROL_NOTIFICATION,
  1857. WLAN_MESH_ACTION_MCCA_SETUP_REQUEST,
  1858. WLAN_MESH_ACTION_MCCA_SETUP_REPLY,
  1859. WLAN_MESH_ACTION_MCCA_ADVERTISEMENT_REQUEST,
  1860. WLAN_MESH_ACTION_MCCA_ADVERTISEMENT,
  1861. WLAN_MESH_ACTION_MCCA_TEARDOWN,
  1862. WLAN_MESH_ACTION_TBTT_ADJUSTMENT_REQUEST,
  1863. WLAN_MESH_ACTION_TBTT_ADJUSTMENT_RESPONSE,
  1864. };
  1865. /* Security key length */
  1866. enum ieee80211_key_len {
  1867. WLAN_KEY_LEN_WEP40 = 5,
  1868. WLAN_KEY_LEN_WEP104 = 13,
  1869. WLAN_KEY_LEN_CCMP = 16,
  1870. WLAN_KEY_LEN_CCMP_256 = 32,
  1871. WLAN_KEY_LEN_TKIP = 32,
  1872. WLAN_KEY_LEN_AES_CMAC = 16,
  1873. WLAN_KEY_LEN_SMS4 = 32,
  1874. WLAN_KEY_LEN_GCMP = 16,
  1875. WLAN_KEY_LEN_GCMP_256 = 32,
  1876. WLAN_KEY_LEN_BIP_CMAC_256 = 32,
  1877. WLAN_KEY_LEN_BIP_GMAC_128 = 16,
  1878. WLAN_KEY_LEN_BIP_GMAC_256 = 32,
  1879. };
  1880. #define IEEE80211_WEP_IV_LEN 4
  1881. #define IEEE80211_WEP_ICV_LEN 4
  1882. #define IEEE80211_CCMP_HDR_LEN 8
  1883. #define IEEE80211_CCMP_MIC_LEN 8
  1884. #define IEEE80211_CCMP_PN_LEN 6
  1885. #define IEEE80211_CCMP_256_HDR_LEN 8
  1886. #define IEEE80211_CCMP_256_MIC_LEN 16
  1887. #define IEEE80211_CCMP_256_PN_LEN 6
  1888. #define IEEE80211_TKIP_IV_LEN 8
  1889. #define IEEE80211_TKIP_ICV_LEN 4
  1890. #define IEEE80211_CMAC_PN_LEN 6
  1891. #define IEEE80211_GMAC_PN_LEN 6
  1892. #define IEEE80211_GCMP_HDR_LEN 8
  1893. #define IEEE80211_GCMP_MIC_LEN 16
  1894. #define IEEE80211_GCMP_PN_LEN 6
  1895. /* Public action codes */
  1896. enum ieee80211_pub_actioncode {
  1897. WLAN_PUB_ACTION_EXT_CHANSW_ANN = 4,
  1898. WLAN_PUB_ACTION_TDLS_DISCOVER_RES = 14,
  1899. };
  1900. /* TDLS action codes */
  1901. enum ieee80211_tdls_actioncode {
  1902. WLAN_TDLS_SETUP_REQUEST = 0,
  1903. WLAN_TDLS_SETUP_RESPONSE = 1,
  1904. WLAN_TDLS_SETUP_CONFIRM = 2,
  1905. WLAN_TDLS_TEARDOWN = 3,
  1906. WLAN_TDLS_PEER_TRAFFIC_INDICATION = 4,
  1907. WLAN_TDLS_CHANNEL_SWITCH_REQUEST = 5,
  1908. WLAN_TDLS_CHANNEL_SWITCH_RESPONSE = 6,
  1909. WLAN_TDLS_PEER_PSM_REQUEST = 7,
  1910. WLAN_TDLS_PEER_PSM_RESPONSE = 8,
  1911. WLAN_TDLS_PEER_TRAFFIC_RESPONSE = 9,
  1912. WLAN_TDLS_DISCOVERY_REQUEST = 10,
  1913. };
  1914. /* Extended Channel Switching capability to be set in the 1st byte of
  1915. * the @WLAN_EID_EXT_CAPABILITY information element
  1916. */
  1917. #define WLAN_EXT_CAPA1_EXT_CHANNEL_SWITCHING BIT(2)
  1918. /* TDLS capabilities in the the 4th byte of @WLAN_EID_EXT_CAPABILITY */
  1919. #define WLAN_EXT_CAPA4_TDLS_BUFFER_STA BIT(4)
  1920. #define WLAN_EXT_CAPA4_TDLS_PEER_PSM BIT(5)
  1921. #define WLAN_EXT_CAPA4_TDLS_CHAN_SWITCH BIT(6)
  1922. /* Interworking capabilities are set in 7th bit of 4th byte of the
  1923. * @WLAN_EID_EXT_CAPABILITY information element
  1924. */
  1925. #define WLAN_EXT_CAPA4_INTERWORKING_ENABLED BIT(7)
  1926. /*
  1927. * TDLS capabililites to be enabled in the 5th byte of the
  1928. * @WLAN_EID_EXT_CAPABILITY information element
  1929. */
  1930. #define WLAN_EXT_CAPA5_TDLS_ENABLED BIT(5)
  1931. #define WLAN_EXT_CAPA5_TDLS_PROHIBITED BIT(6)
  1932. #define WLAN_EXT_CAPA5_TDLS_CH_SW_PROHIBITED BIT(7)
  1933. #define WLAN_EXT_CAPA8_TDLS_WIDE_BW_ENABLED BIT(5)
  1934. #define WLAN_EXT_CAPA8_OPMODE_NOTIF BIT(6)
  1935. /* Defines the maximal number of MSDUs in an A-MSDU. */
  1936. #define WLAN_EXT_CAPA8_MAX_MSDU_IN_AMSDU_LSB BIT(7)
  1937. #define WLAN_EXT_CAPA9_MAX_MSDU_IN_AMSDU_MSB BIT(0)
  1938. /*
  1939. * Fine Timing Measurement Initiator - bit 71 of @WLAN_EID_EXT_CAPABILITY
  1940. * information element
  1941. */
  1942. #define WLAN_EXT_CAPA9_FTM_INITIATOR BIT(7)
  1943. /* TDLS specific payload type in the LLC/SNAP header */
  1944. #define WLAN_TDLS_SNAP_RFTYPE 0x2
  1945. /* BSS Coex IE information field bits */
  1946. #define WLAN_BSS_COEX_INFORMATION_REQUEST BIT(0)
  1947. /**
  1948. * enum - mesh synchronization method identifier
  1949. *
  1950. * @IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET: the default synchronization method
  1951. * @IEEE80211_SYNC_METHOD_VENDOR: a vendor specific synchronization method
  1952. * that will be specified in a vendor specific information element
  1953. */
  1954. enum {
  1955. IEEE80211_SYNC_METHOD_NEIGHBOR_OFFSET = 1,
  1956. IEEE80211_SYNC_METHOD_VENDOR = 255,
  1957. };
  1958. /**
  1959. * enum - mesh path selection protocol identifier
  1960. *
  1961. * @IEEE80211_PATH_PROTOCOL_HWMP: the default path selection protocol
  1962. * @IEEE80211_PATH_PROTOCOL_VENDOR: a vendor specific protocol that will
  1963. * be specified in a vendor specific information element
  1964. */
  1965. enum {
  1966. IEEE80211_PATH_PROTOCOL_HWMP = 1,
  1967. IEEE80211_PATH_PROTOCOL_VENDOR = 255,
  1968. };
  1969. /**
  1970. * enum - mesh path selection metric identifier
  1971. *
  1972. * @IEEE80211_PATH_METRIC_AIRTIME: the default path selection metric
  1973. * @IEEE80211_PATH_METRIC_VENDOR: a vendor specific metric that will be
  1974. * specified in a vendor specific information element
  1975. */
  1976. enum {
  1977. IEEE80211_PATH_METRIC_AIRTIME = 1,
  1978. IEEE80211_PATH_METRIC_VENDOR = 255,
  1979. };
  1980. /**
  1981. * enum ieee80211_root_mode_identifier - root mesh STA mode identifier
  1982. *
  1983. * These attribute are used by dot11MeshHWMPRootMode to set root mesh STA mode
  1984. *
  1985. * @IEEE80211_ROOTMODE_NO_ROOT: the mesh STA is not a root mesh STA (default)
  1986. * @IEEE80211_ROOTMODE_ROOT: the mesh STA is a root mesh STA if greater than
  1987. * this value
  1988. * @IEEE80211_PROACTIVE_PREQ_NO_PREP: the mesh STA is a root mesh STA supports
  1989. * the proactive PREQ with proactive PREP subfield set to 0
  1990. * @IEEE80211_PROACTIVE_PREQ_WITH_PREP: the mesh STA is a root mesh STA
  1991. * supports the proactive PREQ with proactive PREP subfield set to 1
  1992. * @IEEE80211_PROACTIVE_RANN: the mesh STA is a root mesh STA supports
  1993. * the proactive RANN
  1994. */
  1995. enum ieee80211_root_mode_identifier {
  1996. IEEE80211_ROOTMODE_NO_ROOT = 0,
  1997. IEEE80211_ROOTMODE_ROOT = 1,
  1998. IEEE80211_PROACTIVE_PREQ_NO_PREP = 2,
  1999. IEEE80211_PROACTIVE_PREQ_WITH_PREP = 3,
  2000. IEEE80211_PROACTIVE_RANN = 4,
  2001. };
  2002. /*
  2003. * IEEE 802.11-2007 7.3.2.9 Country information element
  2004. *
  2005. * Minimum length is 8 octets, ie len must be evenly
  2006. * divisible by 2
  2007. */
  2008. /* Although the spec says 8 I'm seeing 6 in practice */
  2009. #define IEEE80211_COUNTRY_IE_MIN_LEN 6
  2010. /* The Country String field of the element shall be 3 octets in length */
  2011. #define IEEE80211_COUNTRY_STRING_LEN 3
  2012. /*
  2013. * For regulatory extension stuff see IEEE 802.11-2007
  2014. * Annex I (page 1141) and Annex J (page 1147). Also
  2015. * review 7.3.2.9.
  2016. *
  2017. * When dot11RegulatoryClassesRequired is true and the
  2018. * first_channel/reg_extension_id is >= 201 then the IE
  2019. * compromises of the 'ext' struct represented below:
  2020. *
  2021. * - Regulatory extension ID - when generating IE this just needs
  2022. * to be monotonically increasing for each triplet passed in
  2023. * the IE
  2024. * - Regulatory class - index into set of rules
  2025. * - Coverage class - index into air propagation time (Table 7-27),
  2026. * in microseconds, you can compute the air propagation time from
  2027. * the index by multiplying by 3, so index 10 yields a propagation
  2028. * of 10 us. Valid values are 0-31, values 32-255 are not defined
  2029. * yet. A value of 0 inicates air propagation of <= 1 us.
  2030. *
  2031. * See also Table I.2 for Emission limit sets and table
  2032. * I.3 for Behavior limit sets. Table J.1 indicates how to map
  2033. * a reg_class to an emission limit set and behavior limit set.
  2034. */
  2035. #define IEEE80211_COUNTRY_EXTENSION_ID 201
  2036. /*
  2037. * Channels numbers in the IE must be monotonically increasing
  2038. * if dot11RegulatoryClassesRequired is not true.
  2039. *
  2040. * If dot11RegulatoryClassesRequired is true consecutive
  2041. * subband triplets following a regulatory triplet shall
  2042. * have monotonically increasing first_channel number fields.
  2043. *
  2044. * Channel numbers shall not overlap.
  2045. *
  2046. * Note that max_power is signed.
  2047. */
  2048. struct ieee80211_country_ie_triplet {
  2049. union {
  2050. struct {
  2051. u8 first_channel;
  2052. u8 num_channels;
  2053. s8 max_power;
  2054. } __packed chans;
  2055. struct {
  2056. u8 reg_extension_id;
  2057. u8 reg_class;
  2058. u8 coverage_class;
  2059. } __packed ext;
  2060. };
  2061. } __packed;
  2062. enum ieee80211_timeout_interval_type {
  2063. WLAN_TIMEOUT_REASSOC_DEADLINE = 1 /* 802.11r */,
  2064. WLAN_TIMEOUT_KEY_LIFETIME = 2 /* 802.11r */,
  2065. WLAN_TIMEOUT_ASSOC_COMEBACK = 3 /* 802.11w */,
  2066. };
  2067. /**
  2068. * struct ieee80211_timeout_interval_ie - Timeout Interval element
  2069. * @type: type, see &enum ieee80211_timeout_interval_type
  2070. * @value: timeout interval value
  2071. */
  2072. struct ieee80211_timeout_interval_ie {
  2073. u8 type;
  2074. __le32 value;
  2075. } __packed;
  2076. /* BACK action code */
  2077. enum ieee80211_back_actioncode {
  2078. WLAN_ACTION_ADDBA_REQ = 0,
  2079. WLAN_ACTION_ADDBA_RESP = 1,
  2080. WLAN_ACTION_DELBA = 2,
  2081. };
  2082. /* BACK (block-ack) parties */
  2083. enum ieee80211_back_parties {
  2084. WLAN_BACK_RECIPIENT = 0,
  2085. WLAN_BACK_INITIATOR = 1,
  2086. };
  2087. /* SA Query action */
  2088. enum ieee80211_sa_query_action {
  2089. WLAN_ACTION_SA_QUERY_REQUEST = 0,
  2090. WLAN_ACTION_SA_QUERY_RESPONSE = 1,
  2091. };
  2092. /* cipher suite selectors */
  2093. #define WLAN_CIPHER_SUITE_USE_GROUP 0x000FAC00
  2094. #define WLAN_CIPHER_SUITE_WEP40 0x000FAC01
  2095. #define WLAN_CIPHER_SUITE_TKIP 0x000FAC02
  2096. /* reserved: 0x000FAC03 */
  2097. #define WLAN_CIPHER_SUITE_CCMP 0x000FAC04
  2098. #define WLAN_CIPHER_SUITE_WEP104 0x000FAC05
  2099. #define WLAN_CIPHER_SUITE_AES_CMAC 0x000FAC06
  2100. #define WLAN_CIPHER_SUITE_GCMP 0x000FAC08
  2101. #define WLAN_CIPHER_SUITE_GCMP_256 0x000FAC09
  2102. #define WLAN_CIPHER_SUITE_CCMP_256 0x000FAC0A
  2103. #define WLAN_CIPHER_SUITE_BIP_GMAC_128 0x000FAC0B
  2104. #define WLAN_CIPHER_SUITE_BIP_GMAC_256 0x000FAC0C
  2105. #define WLAN_CIPHER_SUITE_BIP_CMAC_256 0x000FAC0D
  2106. #define WLAN_CIPHER_SUITE_SMS4 0x00147201
  2107. /* AKM suite selectors */
  2108. #define WLAN_AKM_SUITE_8021X 0x000FAC01
  2109. #define WLAN_AKM_SUITE_PSK 0x000FAC02
  2110. #define WLAN_AKM_SUITE_8021X_SHA256 0x000FAC05
  2111. #define WLAN_AKM_SUITE_PSK_SHA256 0x000FAC06
  2112. #define WLAN_AKM_SUITE_TDLS 0x000FAC07
  2113. #define WLAN_AKM_SUITE_SAE 0x000FAC08
  2114. #define WLAN_AKM_SUITE_FT_OVER_SAE 0x000FAC09
  2115. #define WLAN_MAX_KEY_LEN 32
  2116. #define WLAN_PMKID_LEN 16
  2117. #define WLAN_OUI_WFA 0x506f9a
  2118. #define WLAN_OUI_TYPE_WFA_P2P 9
  2119. #define WLAN_OUI_MICROSOFT 0x0050f2
  2120. #define WLAN_OUI_TYPE_MICROSOFT_WPA 1
  2121. #define WLAN_OUI_TYPE_MICROSOFT_WMM 2
  2122. #define WLAN_OUI_TYPE_MICROSOFT_WPS 4
  2123. /*
  2124. * WMM/802.11e Tspec Element
  2125. */
  2126. #define IEEE80211_WMM_IE_TSPEC_TID_MASK 0x0F
  2127. #define IEEE80211_WMM_IE_TSPEC_TID_SHIFT 1
  2128. enum ieee80211_tspec_status_code {
  2129. IEEE80211_TSPEC_STATUS_ADMISS_ACCEPTED = 0,
  2130. IEEE80211_TSPEC_STATUS_ADDTS_INVAL_PARAMS = 0x1,
  2131. };
  2132. struct ieee80211_tspec_ie {
  2133. u8 element_id;
  2134. u8 len;
  2135. u8 oui[3];
  2136. u8 oui_type;
  2137. u8 oui_subtype;
  2138. u8 version;
  2139. __le16 tsinfo;
  2140. u8 tsinfo_resvd;
  2141. __le16 nominal_msdu;
  2142. __le16 max_msdu;
  2143. __le32 min_service_int;
  2144. __le32 max_service_int;
  2145. __le32 inactivity_int;
  2146. __le32 suspension_int;
  2147. __le32 service_start_time;
  2148. __le32 min_data_rate;
  2149. __le32 mean_data_rate;
  2150. __le32 peak_data_rate;
  2151. __le32 max_burst_size;
  2152. __le32 delay_bound;
  2153. __le32 min_phy_rate;
  2154. __le16 sba;
  2155. __le16 medium_time;
  2156. } __packed;
  2157. /**
  2158. * ieee80211_get_qos_ctl - get pointer to qos control bytes
  2159. * @hdr: the frame
  2160. *
  2161. * The qos ctrl bytes come after the frame_control, duration, seq_num
  2162. * and 3 or 4 addresses of length ETH_ALEN.
  2163. * 3 addr: 2 + 2 + 2 + 3*6 = 24
  2164. * 4 addr: 2 + 2 + 2 + 4*6 = 30
  2165. */
  2166. static inline u8 *ieee80211_get_qos_ctl(struct ieee80211_hdr *hdr)
  2167. {
  2168. if (ieee80211_has_a4(hdr->frame_control))
  2169. return (u8 *)hdr + 30;
  2170. else
  2171. return (u8 *)hdr + 24;
  2172. }
  2173. /**
  2174. * ieee80211_get_SA - get pointer to SA
  2175. * @hdr: the frame
  2176. *
  2177. * Given an 802.11 frame, this function returns the offset
  2178. * to the source address (SA). It does not verify that the
  2179. * header is long enough to contain the address, and the
  2180. * header must be long enough to contain the frame control
  2181. * field.
  2182. */
  2183. static inline u8 *ieee80211_get_SA(struct ieee80211_hdr *hdr)
  2184. {
  2185. if (ieee80211_has_a4(hdr->frame_control))
  2186. return hdr->addr4;
  2187. if (ieee80211_has_fromds(hdr->frame_control))
  2188. return hdr->addr3;
  2189. return hdr->addr2;
  2190. }
  2191. /**
  2192. * ieee80211_get_DA - get pointer to DA
  2193. * @hdr: the frame
  2194. *
  2195. * Given an 802.11 frame, this function returns the offset
  2196. * to the destination address (DA). It does not verify that
  2197. * the header is long enough to contain the address, and the
  2198. * header must be long enough to contain the frame control
  2199. * field.
  2200. */
  2201. static inline u8 *ieee80211_get_DA(struct ieee80211_hdr *hdr)
  2202. {
  2203. if (ieee80211_has_tods(hdr->frame_control))
  2204. return hdr->addr3;
  2205. else
  2206. return hdr->addr1;
  2207. }
  2208. /**
  2209. * _ieee80211_is_robust_mgmt_frame - check if frame is a robust management frame
  2210. * @hdr: the frame (buffer must include at least the first octet of payload)
  2211. */
  2212. static inline bool _ieee80211_is_robust_mgmt_frame(struct ieee80211_hdr *hdr)
  2213. {
  2214. if (ieee80211_is_disassoc(hdr->frame_control) ||
  2215. ieee80211_is_deauth(hdr->frame_control))
  2216. return true;
  2217. if (ieee80211_is_action(hdr->frame_control)) {
  2218. u8 *category;
  2219. /*
  2220. * Action frames, excluding Public Action frames, are Robust
  2221. * Management Frames. However, if we are looking at a Protected
  2222. * frame, skip the check since the data may be encrypted and
  2223. * the frame has already been found to be a Robust Management
  2224. * Frame (by the other end).
  2225. */
  2226. if (ieee80211_has_protected(hdr->frame_control))
  2227. return true;
  2228. category = ((u8 *) hdr) + 24;
  2229. return *category != WLAN_CATEGORY_PUBLIC &&
  2230. *category != WLAN_CATEGORY_HT &&
  2231. *category != WLAN_CATEGORY_WNM_UNPROTECTED &&
  2232. *category != WLAN_CATEGORY_SELF_PROTECTED &&
  2233. *category != WLAN_CATEGORY_UNPROT_DMG &&
  2234. *category != WLAN_CATEGORY_VHT &&
  2235. *category != WLAN_CATEGORY_VENDOR_SPECIFIC;
  2236. }
  2237. return false;
  2238. }
  2239. /**
  2240. * ieee80211_is_robust_mgmt_frame - check if skb contains a robust mgmt frame
  2241. * @skb: the skb containing the frame, length will be checked
  2242. */
  2243. static inline bool ieee80211_is_robust_mgmt_frame(struct sk_buff *skb)
  2244. {
  2245. if (skb->len < IEEE80211_MIN_ACTION_SIZE)
  2246. return false;
  2247. return _ieee80211_is_robust_mgmt_frame((void *)skb->data);
  2248. }
  2249. /**
  2250. * ieee80211_is_public_action - check if frame is a public action frame
  2251. * @hdr: the frame
  2252. * @len: length of the frame
  2253. */
  2254. static inline bool ieee80211_is_public_action(struct ieee80211_hdr *hdr,
  2255. size_t len)
  2256. {
  2257. struct ieee80211_mgmt *mgmt = (void *)hdr;
  2258. if (len < IEEE80211_MIN_ACTION_SIZE)
  2259. return false;
  2260. if (!ieee80211_is_action(hdr->frame_control))
  2261. return false;
  2262. return mgmt->u.action.category == WLAN_CATEGORY_PUBLIC;
  2263. }
  2264. /**
  2265. * _ieee80211_is_group_privacy_action - check if frame is a group addressed
  2266. * privacy action frame
  2267. * @hdr: the frame
  2268. */
  2269. static inline bool _ieee80211_is_group_privacy_action(struct ieee80211_hdr *hdr)
  2270. {
  2271. struct ieee80211_mgmt *mgmt = (void *)hdr;
  2272. if (!ieee80211_is_action(hdr->frame_control) ||
  2273. !is_multicast_ether_addr(hdr->addr1))
  2274. return false;
  2275. return mgmt->u.action.category == WLAN_CATEGORY_MESH_ACTION ||
  2276. mgmt->u.action.category == WLAN_CATEGORY_MULTIHOP_ACTION;
  2277. }
  2278. /**
  2279. * ieee80211_is_group_privacy_action - check if frame is a group addressed
  2280. * privacy action frame
  2281. * @skb: the skb containing the frame, length will be checked
  2282. */
  2283. static inline bool ieee80211_is_group_privacy_action(struct sk_buff *skb)
  2284. {
  2285. if (skb->len < IEEE80211_MIN_ACTION_SIZE)
  2286. return false;
  2287. return _ieee80211_is_group_privacy_action((void *)skb->data);
  2288. }
  2289. /**
  2290. * ieee80211_tu_to_usec - convert time units (TU) to microseconds
  2291. * @tu: the TUs
  2292. */
  2293. static inline unsigned long ieee80211_tu_to_usec(unsigned long tu)
  2294. {
  2295. return 1024 * tu;
  2296. }
  2297. /**
  2298. * ieee80211_check_tim - check if AID bit is set in TIM
  2299. * @tim: the TIM IE
  2300. * @tim_len: length of the TIM IE
  2301. * @aid: the AID to look for
  2302. */
  2303. static inline bool ieee80211_check_tim(const struct ieee80211_tim_ie *tim,
  2304. u8 tim_len, u16 aid)
  2305. {
  2306. u8 mask;
  2307. u8 index, indexn1, indexn2;
  2308. if (unlikely(!tim || tim_len < sizeof(*tim)))
  2309. return false;
  2310. aid &= 0x3fff;
  2311. index = aid / 8;
  2312. mask = 1 << (aid & 7);
  2313. indexn1 = tim->bitmap_ctrl & 0xfe;
  2314. indexn2 = tim_len + indexn1 - 4;
  2315. if (index < indexn1 || index > indexn2)
  2316. return false;
  2317. index -= indexn1;
  2318. return !!(tim->virtual_map[index] & mask);
  2319. }
  2320. /**
  2321. * ieee80211_get_tdls_action - get tdls packet action (or -1, if not tdls packet)
  2322. * @skb: the skb containing the frame, length will not be checked
  2323. * @hdr_size: the size of the ieee80211_hdr that starts at skb->data
  2324. *
  2325. * This function assumes the frame is a data frame, and that the network header
  2326. * is in the correct place.
  2327. */
  2328. static inline int ieee80211_get_tdls_action(struct sk_buff *skb, u32 hdr_size)
  2329. {
  2330. if (!skb_is_nonlinear(skb) &&
  2331. skb->len > (skb_network_offset(skb) + 2)) {
  2332. /* Point to where the indication of TDLS should start */
  2333. const u8 *tdls_data = skb_network_header(skb) - 2;
  2334. if (get_unaligned_be16(tdls_data) == ETH_P_TDLS &&
  2335. tdls_data[2] == WLAN_TDLS_SNAP_RFTYPE &&
  2336. tdls_data[3] == WLAN_CATEGORY_TDLS)
  2337. return tdls_data[4];
  2338. }
  2339. return -1;
  2340. }
  2341. /* convert time units */
  2342. #define TU_TO_JIFFIES(x) (usecs_to_jiffies((x) * 1024))
  2343. #define TU_TO_EXP_TIME(x) (jiffies + TU_TO_JIFFIES(x))
  2344. /**
  2345. * ieee80211_action_contains_tpc - checks if the frame contains TPC element
  2346. * @skb: the skb containing the frame, length will be checked
  2347. *
  2348. * This function checks if it's either TPC report action frame or Link
  2349. * Measurement report action frame as defined in IEEE Std. 802.11-2012 8.5.2.5
  2350. * and 8.5.7.5 accordingly.
  2351. */
  2352. static inline bool ieee80211_action_contains_tpc(struct sk_buff *skb)
  2353. {
  2354. struct ieee80211_mgmt *mgmt = (void *)skb->data;
  2355. if (!ieee80211_is_action(mgmt->frame_control))
  2356. return false;
  2357. if (skb->len < IEEE80211_MIN_ACTION_SIZE +
  2358. sizeof(mgmt->u.action.u.tpc_report))
  2359. return false;
  2360. /*
  2361. * TPC report - check that:
  2362. * category = 0 (Spectrum Management) or 5 (Radio Measurement)
  2363. * spectrum management action = 3 (TPC/Link Measurement report)
  2364. * TPC report EID = 35
  2365. * TPC report element length = 2
  2366. *
  2367. * The spectrum management's tpc_report struct is used here both for
  2368. * parsing tpc_report and radio measurement's link measurement report
  2369. * frame, since the relevant part is identical in both frames.
  2370. */
  2371. if (mgmt->u.action.category != WLAN_CATEGORY_SPECTRUM_MGMT &&
  2372. mgmt->u.action.category != WLAN_CATEGORY_RADIO_MEASUREMENT)
  2373. return false;
  2374. /* both spectrum mgmt and link measurement have same action code */
  2375. if (mgmt->u.action.u.tpc_report.action_code !=
  2376. WLAN_ACTION_SPCT_TPC_RPRT)
  2377. return false;
  2378. if (mgmt->u.action.u.tpc_report.tpc_elem_id != WLAN_EID_TPC_REPORT ||
  2379. mgmt->u.action.u.tpc_report.tpc_elem_length !=
  2380. sizeof(struct ieee80211_tpc_report_ie))
  2381. return false;
  2382. return true;
  2383. }
  2384. #endif /* LINUX_IEEE80211_H */