wlan_vdev_mlme.h 44 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539
  1. /*
  2. * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
  3. * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
  4. *
  5. * Permission to use, copy, modify, and/or distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. /**
  18. * DOC: Define VDEV MLME structure and APIs
  19. */
  20. #ifndef _WLAN_VDEV_MLME_H_
  21. #define _WLAN_VDEV_MLME_H_
  22. #include <wlan_vdev_mgr_tgt_if_rx_defs.h>
  23. #include <wlan_objmgr_vdev_obj.h>
  24. #include <wlan_vdev_mlme_api.h>
  25. #include <wlan_ext_mlme_obj_types.h>
  26. struct vdev_mlme_obj;
  27. struct cnx_mgr;
  28. /* Requestor ID for multiple vdev restart */
  29. #define MULTIPLE_VDEV_RESTART_REQ_ID 0x1234
  30. /* values for vdev_type */
  31. #define WLAN_VDEV_MLME_TYPE_UNKNOWN 0x0
  32. #define WLAN_VDEV_MLME_TYPE_AP 0x1
  33. #define WLAN_VDEV_MLME_TYPE_STA 0x2
  34. #define WLAN_VDEV_MLME_TYPE_IBSS 0x3
  35. #define WLAN_VDEV_MLME_TYPE_MONITOR 0x4
  36. #define WLAN_VDEV_MLME_TYPE_NAN 0x5
  37. #define WLAN_VDEV_MLME_TYPE_OCB 0x6
  38. #define WLAN_VDEV_MLME_TYPE_NDI 0x7
  39. /* values for vdev_subtype */
  40. #define WLAN_VDEV_MLME_SUBTYPE_UNKNOWN 0x0
  41. #define WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE 0x1
  42. #define WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT 0x2
  43. #define WLAN_VDEV_MLME_SUBTYPE_P2P_GO 0x3
  44. #define WLAN_VDEV_MLME_SUBTYPE_PROXY_STA 0x4
  45. #define WLAN_VDEV_MLME_SUBTYPE_MESH 0x5
  46. #define WLAN_VDEV_MLME_SUBTYPE_MESH_11S 0x6
  47. #define WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR 0x7
  48. /* vdev control flags (per bits) */
  49. #define WLAN_VDEV_MLME_FLAGS_NON_MBSSID_AP 0x00000001
  50. #define WLAN_VDEV_MLME_FLAGS_TRANSMIT_AP 0x00000002
  51. #define WLAN_VDEV_MLME_FLAGS_NON_TRANSMIT_AP 0x00000004
  52. #define WLAN_VDEV_MLME_FLAGS_EMA_MODE 0x00000008
  53. #define WLAN_VDEV_MLME_FLAGS_MBSS_CMN_PARAM 0x00000010
  54. /**
  55. * struct vdev_mlme_proto_generic - generic mlme proto structure
  56. * sent in frames
  57. * @dtim_period: frequency of data transmissions per beacon 1-255
  58. * @slot_time: slot time
  59. * @protection_mode: rts cts protection mode
  60. * @beacon_interval: beacon interval
  61. * @ldpc: low density parity check value
  62. * @nss: number of spatial stream
  63. * @nss_2g: 2.4GHz number of spatial stream
  64. * @nss_5g: 5GHz number of spatial stream
  65. * @tsfadjust: adjusted timer sync value
  66. */
  67. struct vdev_mlme_proto_generic {
  68. uint8_t dtim_period;
  69. uint32_t slot_time;
  70. uint32_t protection_mode;
  71. uint16_t beacon_interval;
  72. uint8_t ldpc;
  73. uint8_t nss;
  74. uint8_t nss_2g;
  75. uint8_t nss_5g;
  76. uint64_t tsfadjust;
  77. };
  78. /**
  79. * struct vdev_mlme_proto_ap - ap specific mlme protocol
  80. * @.
  81. */
  82. struct vdev_mlme_proto_ap {
  83. };
  84. /**
  85. * struct vdev_mlme_proto_sta - sta specific mlme protocol
  86. * @assoc_id: association id of station
  87. * @uapsd_cfg: uapsd configuration
  88. */
  89. struct vdev_mlme_proto_sta {
  90. uint16_t assoc_id;
  91. uint16_t uapsd_cfg;
  92. };
  93. /**
  94. * struct vdev_mlme_proto_bss_color - bss color cfg
  95. * @flags: proposed for future use cases, currently not used.
  96. * @evt_type: bss color collision event.
  97. * @current_bss_color: current bss color.
  98. * @detection_period_ms: scan interval for both AP and STA mode.
  99. * @scan_period_ms: scan period for passive scan to detect collision.
  100. * @free_slot_expiry_time_ms: FW to notify host at timer expiry after
  101. * which Host will disable the bss color.
  102. */
  103. struct vdev_mlme_proto_bss_color {
  104. uint32_t flags;
  105. uint8_t evt_type;
  106. uint32_t current_bss_color;
  107. uint32_t detection_period_ms;
  108. uint32_t scan_period_ms;
  109. uint32_t free_slot_expiry_time_ms;
  110. };
  111. /**
  112. * struct vdev_mlme_vht_info - vdev VHT information
  113. * @caps: vht capabilities
  114. * @subfer: su beam former capability
  115. * @subfee: su beam formee capability
  116. * @mubfer: mu beam former capability
  117. * @mubfee: mu beam formee capability
  118. * @implicit_bf: Implicit BF support
  119. * @sounding_dimension: Beamformer number of sounding dimension
  120. * @bfee_sts_cap: beam formee STA capability
  121. * @allow_vht: vht capability status
  122. */
  123. struct vdev_mlme_vht_info {
  124. uint32_t caps;
  125. uint8_t subfer;
  126. uint8_t mubfer;
  127. uint8_t subfee;
  128. uint8_t mubfee;
  129. uint8_t implicit_bf;
  130. uint8_t sounding_dimension;
  131. uint8_t bfee_sts_cap;
  132. bool allow_vht;
  133. };
  134. /**
  135. * struct vdev_mlme_ht_info - vdev HT information
  136. * @ht_caps: HT capabilities
  137. * @allow_ht: HT capability status
  138. */
  139. struct vdev_mlme_ht_info {
  140. uint32_t ht_caps;
  141. bool allow_ht;
  142. };
  143. /**
  144. * struct vdev_mlme_he_ops_info - vdev mlme HEOPS information
  145. * @he_ops: he ops
  146. */
  147. struct vdev_mlme_he_ops_info {
  148. uint32_t he_ops;
  149. };
  150. #ifdef WLAN_FEATURE_11BE
  151. /**
  152. * struct vdev_mlme_eht_caps_info - vdev mlme EHT capability information
  153. * @eht_maccap_epcspriaccess_support : EPCS Priority Access Supported
  154. * @eht_maccap_ehtomctrl_support : EHT OM Control Support
  155. * @eht_maccap_trigtxop_sharing_mode1: Triggered TXOP Sharing mode1 Support
  156. * @eht_maccap_trigtxop_sharing_mode2: Triggered TXOP Sharing mode2 Support
  157. * @eht_maccap_rtwt_support : Restricted TWT Support
  158. * @eht_maccap_scs_traffic_description : SCS Traffic Description Support
  159. * @eht_maccap_max_mpdu_len : Maximum MPDU Length
  160. * @eht_maccap_max_ampdu_len_exp_etn : Maximum A-MPDU Length Exponent Extension
  161. * @eht_maccap_trs_support : EHT TRS Support
  162. * @eht_maccap_txop_ret_supp_in_txop_mode2: TXOP Return Support In TXOP
  163. * Sharing Mode 2
  164. * @eht_phycap_reserved : Reserved
  165. * @eht_phycap_320mhzin6ghz : Support For 320 MHz In 6 GHz
  166. * @eht_phycap_242tonerubwlt20mhz : Support for 242-tone RU In BW Wider Than
  167. * 20 MHz
  168. * @eht_phycap_ndp4xehtltfand320nsgi : NDP With 4. EHT-LTF And 3.2 .s GI
  169. * @eht_phycap_partialbwulmu : Partial Bandwidth UL MU-MIMO
  170. * @eht_phycap_subfmr : SU Beamformer
  171. * @eht_phycap_subfme : SU Beamformee
  172. * @eht_phycap_bfmesslt80mhz : Beamformee SS (<= 80 MHz)
  173. * @eht_phycap_bfmess160mhz : Beamformee SS (= 160 MHz)
  174. * @eht_phycap_bfmess320mhz : Beamformee SS (= 320 MHz)
  175. * @eht_phycap_numsoundlt80mhz : Number Of Sounding Dimensions (<=80 MHz)
  176. * @eht_phycap_numsound160mhz : Number Of Sounding Dimensions (=160 MHz)
  177. * @eht_phycap_numsound320mhz : Number Of Sounding Dimensions (=320 MHz)
  178. * @eht_phycap_ng16sufb : Ng = 16 SU Feedback
  179. * @eht_phycap_ng16mufb : Ng = 16 MU Feedback
  180. * @eht_phycap_codbk42sufb : Codebook Size {4,2} SU Feedback
  181. * @eht_phycap_codbk75mufb : Codebook Size {4,2} MU Feedback
  182. * @eht_phycap_trigsubffb : Triggered SU Beamforming Feedback
  183. * @eht_phycap_trigmubfpartbwfb : Triggered MU Beamforming Partial B
  184. * Feedback
  185. * @eht_phycap_trigcqifb : Triggered CQI Feedback
  186. * @eht_phycap_partbwdlmumimo : Partial Bandwidth DL MU-MIMO
  187. * @eht_phycap_psrsr : PSR-Based SR Support
  188. * @eht_phycap_pwrbstfactor : Power Boost Factor Support
  189. * @eht_phycap_4xehtltfand800nsgi : EHT MU PPDU With 4xEHT-LTF And 0.8 .s GI
  190. * @eht_phycap_maxnc : Max Nc
  191. * @eht_phycap_nontrigcqifb : Non-Triggered CQI Feedback
  192. * @eht_phycap_tx1024and4096qamls242toneru : Tx 1024-QAM And 4096-QAM <
  193. * 242-tone RU Support
  194. * @eht_phycap_rx1024and4096qamls242toneru : Rx 1024-QAM And 4096-QAM <
  195. * 242-tone RU Support
  196. * @eht_phycap_ppethrespresent : PPE Thresholds Present
  197. * @eht_phycap_cmnnompktpad : Common Nominal Packet Padding
  198. * @eht_phycap_maxnumehtltf : Maximum Number Of Supported EHT-LTFs
  199. * @eht_phycap_supmcs15 : Support of MCS 15
  200. * @eht_phycap_ehtdupin6ghz : Support Of EHT DUP In 6 GHz
  201. * @eht_phycap_20mhzopstarxndpwiderbw : Support For 20 MHz Operating STA
  202. * Receiving NDP With Wider Bandwidth
  203. * @eht_phycap_nonofdmaulmumimolt80mhz : Non-OFDMA UL MU-MIMO (BW <= 80 MHz)
  204. * @eht_phycap_nonofdmaulmumimo160mhz : Non-OFDMA UL MU-MIMO (BW = 160 MHz)
  205. * @eht_phycap_nonofdmaulmumimo320mhz : Non-OFDMA UL MU-MIMO (BW = 320 MHz)
  206. * @eht_phycap_mubfmrlt80mhz : MU Beamformer (BW <= 80 MHz)
  207. * @eht_phycap_mubfmr160mhz : MU Beamformer (BW = 160 MHz)
  208. * @eht_phycap_mubfmr320mhz : MU Beamformer (BW = 320 MHz)
  209. */
  210. struct vdev_mlme_eht_caps_info {
  211. uint32_t eht_maccap_epcspriaccess_support :1,
  212. eht_maccap_ehtomctrl_support :1,
  213. eht_maccap_trigtxop_sharing_mode1 :1,
  214. eht_maccap_trigtxop_sharing_mode2 :1,
  215. eht_maccap_rtwt_support :1,
  216. eht_maccap_scs_traffic_description :1,
  217. eht_maccap_max_mpdu_len :2,
  218. eht_maccap_max_ampdu_len_exp_etn :1,
  219. eht_maccap_trs_support :1,
  220. eht_maccap_txop_ret_supp_in_txop_mode2 :1;
  221. uint32_t eht_phycap_reserved :1,
  222. eht_phycap_320mhzin6ghz :1,
  223. eht_phycap_242tonerubwlt20mhz :1,
  224. eht_phycap_ndp4xehtltfand320nsgi :1,
  225. eht_phycap_partialbwulmu :1,
  226. eht_phycap_subfmr :1,
  227. eht_phycap_subfme :1,
  228. eht_phycap_bfmesslt80mhz :3,
  229. eht_phycap_bfmess160mhz :3,
  230. eht_phycap_bfmess320mhz :3,
  231. eht_phycap_numsoundlt80mhz :3,
  232. eht_phycap_numsound160mhz :3,
  233. eht_phycap_numsound320mhz :3,
  234. eht_phycap_ng16sufb :1,
  235. eht_phycap_ng16mufb :1,
  236. eht_phycap_codbk42sufb :1,
  237. eht_phycap_codbk75mufb :1,
  238. eht_phycap_trigsubffb :1,
  239. eht_phycap_trigmubfpartbwfb :1,
  240. eht_phycap_trigcqifb :1;
  241. uint32_t eht_phycap_partbwdlmumimo :1,
  242. eht_phycap_psrsr :1,
  243. eht_phycap_pwrbstfactor :1,
  244. eht_phycap_4xehtltfand800nsgi :1,
  245. eht_phycap_maxnc :4,
  246. eht_phycap_nontrigcqifb :1,
  247. eht_phycap_tx1024and4096qamls242toneru :1,
  248. eht_phycap_rx1024and4096qamls242toneru :1,
  249. eht_phycap_ppethrespresent :1,
  250. eht_phycap_cmnnompktpad :2,
  251. eht_phycap_maxnumehtltf :5,
  252. eht_phycap_supmcs15 :4,
  253. eht_phycap_ehtdupin6ghz :1,
  254. eht_phycap_20mhzopstarxndpwiderbw :1,
  255. eht_phycap_nonofdmaulmumimolt80mhz :1,
  256. eht_phycap_nonofdmaulmumimo160mhz :1,
  257. eht_phycap_nonofdmaulmumimo320mhz :1,
  258. eht_phycap_mubfmrlt80mhz :1,
  259. eht_phycap_mubfmr160mhz :1,
  260. eht_phycap_mubfmr320mhz :1,
  261. eht_phycap_tb_sounding_feedback_rl :1;
  262. uint32_t eht_phycap_rx1024qamwiderbwdlofdma :1,
  263. eht_phycap_rx4096qamwiderbwdlofdma :1;
  264. };
  265. /**
  266. * struct vdev_mlme_eht_ops_info - vdev mlme EHTOPS information
  267. * @eht_ops: eht ops
  268. */
  269. struct vdev_mlme_eht_ops_info {
  270. uint32_t eht_ops;
  271. };
  272. #endif
  273. /**
  274. * struct vdev_mlme_he_ops_info - vdev protocol structure holding information
  275. * that is used in frames
  276. * @generic: generic protocol information
  277. * @ap: ap specific protocol information
  278. * @sta: sta specific protocol information
  279. * @vht_info: vht information
  280. * @ht_info: ht capabilities information
  281. * @he_ops_info: he ops information
  282. * @eht_cap_info: EHT capability information
  283. * @eht_ops_info: EHT operation information
  284. * @bss_color: 11ax HE BSS Color information
  285. */
  286. struct vdev_mlme_proto {
  287. struct vdev_mlme_proto_generic generic;
  288. struct vdev_mlme_proto_ap ap;
  289. struct vdev_mlme_proto_sta sta;
  290. struct vdev_mlme_vht_info vht_info;
  291. struct vdev_mlme_ht_info ht_info;
  292. struct vdev_mlme_he_ops_info he_ops_info;
  293. #ifdef WLAN_FEATURE_11BE
  294. struct vdev_mlme_eht_caps_info eht_cap_info;
  295. struct vdev_mlme_eht_ops_info eht_ops_info;
  296. #endif
  297. struct vdev_mlme_proto_bss_color bss_color;
  298. };
  299. /**
  300. * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg
  301. * @rts_threshold: RTS threshold
  302. * @frag_threshold: Fragmentation threshold
  303. * @probe_delay: time in msec for delaying to send first probe request
  304. * @repeat_probe_time: probe request transmission time
  305. * @drop_unencry: drop unencrypted status
  306. * @ tx_pwrlimit: Tx power limit
  307. * @tx_power: Tx power
  308. * @minpower: Min power
  309. * @maxpower: Max power
  310. * @maxregpower: max regulatory power
  311. * @antennamax: max antenna
  312. * @reg_class_id: reg domain class id
  313. * @ampdu: ampdu limit
  314. * @amsdu: amsdu limit
  315. * @ssid: service set identifier
  316. * @ssid_len: ssid length
  317. * @type: vdev type
  318. * @sub_type: vdev subtype
  319. * @rx_decap_type: rx decap type
  320. * @tx_encap_type: tx encap type
  321. * @disable_hw_ack: disable ha ack flag
  322. * @bssid: bssid
  323. * @phy_mode: phy mode
  324. * @special_vdev_mode: indicates special vdev mode
  325. * @he_spr_sr_ctrl: Spatial reuse SR control
  326. * @he_spr_non_srg_pd_max_offset: Non-SRG PD max offset
  327. * @he_spr_srg_max_pd_offset: SRG PD max offset
  328. * @he_spr_srg_min_pd_offset: SRG PD min offset
  329. * @he_spr_enabled: Spatial reuse enabled or not
  330. * @pd_threshold: pd threshold sent by userspace
  331. * @he_spr_disabled_due_conc: spr disabled due to concurrency
  332. */
  333. struct vdev_mlme_mgmt_generic {
  334. uint32_t rts_threshold;
  335. uint32_t frag_threshold;
  336. uint32_t probe_delay;
  337. uint32_t repeat_probe_time;
  338. uint32_t drop_unencry;
  339. uint32_t tx_pwrlimit;
  340. uint8_t tx_power;
  341. uint8_t minpower;
  342. uint8_t maxpower;
  343. uint8_t maxregpower;
  344. uint8_t antennamax;
  345. uint8_t reg_class_id;
  346. uint8_t ampdu;
  347. uint8_t amsdu;
  348. char ssid[WLAN_SSID_MAX_LEN + 1];
  349. uint8_t ssid_len;
  350. uint8_t type;
  351. uint8_t subtype;
  352. uint8_t rx_decap_type;
  353. uint8_t tx_encap_type;
  354. bool disable_hw_ack;
  355. uint8_t bssid[QDF_MAC_ADDR_SIZE];
  356. uint32_t phy_mode;
  357. bool special_vdev_mode;
  358. #ifdef WLAN_FEATURE_SR
  359. uint8_t he_spr_sr_ctrl;
  360. uint8_t he_spr_non_srg_pd_max_offset;
  361. uint8_t he_spr_srg_max_pd_offset;
  362. uint8_t he_spr_srg_min_pd_offset;
  363. bool he_spr_enabled;
  364. int32_t pd_threshold;
  365. bool he_spr_disabled_due_conc;
  366. #endif
  367. };
  368. /*
  369. * struct wlan_vdev_aid_mgr – AID manager
  370. * @aid_bitmap: AID bitmap array
  371. * @start_aid: start of AID index
  372. * @max_aid: Max allowed AID
  373. * @ref_cnt: to share AID across VDEVs for MBSSID
  374. */
  375. struct wlan_vdev_aid_mgr {
  376. qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
  377. uint16_t start_aid;
  378. uint16_t max_aid;
  379. qdf_atomic_t ref_cnt;
  380. };
  381. /**
  382. * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
  383. * @hidden_ssid: flag to indicate whether it is hidden ssid
  384. * @cac_duration_ms: cac duration in milliseconds
  385. * @aid_mgr: AID bitmap mgr
  386. * @max_chan_switch_time: Max channel switch time in milliseconds.
  387. * @last_bcn_ts_ms: Timestamp (in milliseconds) of the last beacon sent on the
  388. * CSA triggered channel.
  389. */
  390. struct vdev_mlme_mgmt_ap {
  391. bool hidden_ssid;
  392. uint32_t cac_duration_ms;
  393. struct wlan_vdev_aid_mgr *aid_mgr;
  394. uint32_t max_chan_switch_time;
  395. unsigned long last_bcn_ts_ms;
  396. };
  397. /**
  398. * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
  399. * @he_mcs_12_13_map: map to indicate mcs12/13 caps of peer&dut
  400. */
  401. struct vdev_mlme_mgmt_sta {
  402. uint16_t he_mcs_12_13_map;
  403. };
  404. /**
  405. * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
  406. * @bmiss_first_bcnt: bmiss first time
  407. * @bmiss_final_bcnt: bmiss final time
  408. * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
  409. * inactive
  410. * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
  411. * data-null
  412. * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
  413. */
  414. struct vdev_mlme_inactivity_params {
  415. uint32_t bmiss_first_bcnt;
  416. uint32_t bmiss_final_bcnt;
  417. uint32_t keepalive_min_idle_inactive_time_secs;
  418. uint32_t keepalive_max_idle_inactive_time_secs;
  419. uint32_t keepalive_max_unresponsive_time_secs;
  420. };
  421. /**
  422. * enum vdev_ratemask_type - ratemask phy type
  423. * @WLAN_VDEV_RATEMASK_TYPE_CCK: phy type CCK
  424. * @WLAN_VDEV_RATEMASK_TYPE_HT: phy type ht
  425. * @WLAN_VDEV_RATEMASK_TYPE_VHT: phy type vht
  426. * WLAN_VDEV_RATEMASK_TYPE_HE: phy type he
  427. */
  428. enum vdev_ratemask_type {
  429. WLAN_VDEV_RATEMASK_TYPE_CCK,
  430. WLAN_VDEV_RATEMASK_TYPE_HT,
  431. WLAN_VDEV_RATEMASK_TYPE_VHT,
  432. WLAN_VDEV_RATEMASK_TYPE_HE,
  433. WLAN_VDEV_RATEMASK_TYPE_MAX,
  434. };
  435. /**
  436. * struct vdev_ratemask_params - vdev ratemask parameters
  437. * @type: ratemask phy type
  438. * @lower32: ratemask lower32 bitmask
  439. * @higher32: ratemask higher32 bitmask
  440. * @lower32_2: ratemask lower32_2 bitmask
  441. * @higher32_2: rtaemask higher32_2 bitmask
  442. */
  443. struct vdev_ratemask_params {
  444. uint32_t lower32;
  445. uint32_t higher32;
  446. uint32_t lower32_2;
  447. uint32_t higher32_2;
  448. };
  449. /**
  450. * struct vdev_mlme_rate_info - vdev mlme rate information
  451. * @rate_flags: dynamic bandwidth info
  452. * @per_band_tx_mgmt_rate: per band Tx mgmt rate
  453. * @max_rate: max bandwidth rate
  454. * @tx_mgmt_rate: Tx Mgmt rate
  455. * @bcn_tx_rate: beacon Tx rate
  456. * @bcn_tx_rate_code: beacon Tx rate code
  457. * @ratemask_params: vdev ratemask params per phy type
  458. * @half_rate: Half rate
  459. * @quarter_rate: quarter rate
  460. */
  461. struct vdev_mlme_rate_info {
  462. uint32_t rate_flags;
  463. uint32_t per_band_tx_mgmt_rate;
  464. uint32_t max_rate;
  465. uint32_t tx_mgmt_rate;
  466. uint32_t bcn_tx_rate;
  467. #ifdef WLAN_BCN_RATECODE_ENABLE
  468. uint32_t bcn_tx_rate_code;
  469. #endif
  470. uint32_t rtscts_tx_rate;
  471. struct vdev_ratemask_params ratemask_params[
  472. WLAN_VDEV_RATEMASK_TYPE_MAX];
  473. bool half_rate;
  474. bool quarter_rate;
  475. };
  476. /**
  477. * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
  478. * @tx_chainmask: Tx chainmask
  479. * @rx_chainmask: Rx Chainmask
  480. * @num_rx_chain: Num of bits set in Rx chain
  481. * @num_tx_chain: Num of bits set in Tx chain
  482. */
  483. struct vdev_mlme_chainmask_info {
  484. uint8_t tx_chainmask;
  485. uint8_t rx_chainmask;
  486. uint8_t num_rx_chain;
  487. uint8_t num_tx_chain;
  488. };
  489. /**
  490. * struct vdev_mlme_powersave_info - vdev mlme powersave information
  491. * @packet_powersave: packet powersave
  492. * @max_li_of_moddtim: max mod dtim
  493. * @dyndtim_cnt: dynamic dtim count
  494. * @listen_interval: listen interval
  495. * @moddtim_cnt: mod dtim count
  496. */
  497. struct vdev_mlme_powersave_info {
  498. uint32_t packet_powersave;
  499. uint32_t max_li_of_moddtim;
  500. uint32_t dyndtim_cnt;
  501. uint32_t listen_interval;
  502. uint32_t moddtim_cnt;
  503. };
  504. /**
  505. * struct vdev_mlme_beacon_info - vdev mlme beacon information
  506. * @beacon_buffer: buffer allocated for beacon frame
  507. * @beacon_offsets: beacon IE's offsets
  508. */
  509. struct vdev_mlme_beacon_info {
  510. qdf_nbuf_t beacon_buffer;
  511. void *beacon_offsets;
  512. };
  513. /**
  514. * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
  515. * @profile_idx: profile index of the connected non-trans ap (mbssid case).
  516. * 0 means invalid.
  517. * @profile_num: the total profile numbers of non-trans aps (mbssid
  518. * case).
  519. * 0 means non-MBSS AP.
  520. * @mbssid-flags: MBSS IE flags indicating vdev type
  521. * @vdevid_trans: id of transmitting vdev for MBSS IE
  522. * @vdev_bmap: vdev bitmap of VAPs in MBSS group
  523. * @is_cmn_param: flag to check mbss common param
  524. * @trans_bssid: bssid of transmitted AP (MBSS IE case)
  525. * @is_multi_mbssid: Flag to identify multi group mbssid support
  526. * @grp_id: Group id of current vdev
  527. */
  528. struct vdev_mlme_mbss_11ax {
  529. uint32_t profile_idx;
  530. uint32_t profile_num;
  531. uint32_t mbssid_flags;
  532. uint8_t vdevid_trans;
  533. unsigned long vdev_bmap;
  534. bool is_cmn_param;
  535. uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
  536. bool is_multi_mbssid;
  537. uint32_t grp_id;
  538. };
  539. /**
  540. * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
  541. * @generic: generic mgmt information
  542. * @ap: ap specific mgmt information
  543. * @sta: sta specific mgmt information
  544. * @inactivity_params: inactivity parameters
  545. * @rate_info: bandwidth rate information
  546. * @chainmask_info: Chainmask information
  547. * @powersave_info: Power save parameters
  548. * @beacon_info: beacon buffer information
  549. * @mbss_11ax: MBSS 11ax information
  550. */
  551. struct vdev_mlme_mgmt {
  552. struct vdev_mlme_mgmt_generic generic;
  553. struct vdev_mlme_mgmt_ap ap;
  554. struct vdev_mlme_mgmt_sta sta;
  555. struct vdev_mlme_inactivity_params inactivity_params;
  556. struct vdev_mlme_rate_info rate_info;
  557. struct vdev_mlme_chainmask_info chainmask_info;
  558. struct vdev_mlme_powersave_info powersave_info;
  559. struct vdev_mlme_beacon_info beacon_info;
  560. struct vdev_mlme_mbss_11ax mbss_11ax;
  561. };
  562. /**
  563. * enum beacon_update_op - Beacon update op type
  564. * @BEACON_INIT: Initialize beacon
  565. * @BEACON_REINIT: Re-initialize beacon
  566. * @BEACON_UPDATE: Update dynamic fields of beacon
  567. * @BEACON_CSA: Enable CSA IE
  568. * @BEACON_FREE: Beacon buffer free
  569. */
  570. enum beacon_update_op {
  571. BEACON_INIT,
  572. BEACON_REINIT,
  573. BEACON_UPDATE,
  574. BEACON_CSA,
  575. BEACON_FREE,
  576. };
  577. /**
  578. * enum vdev_cmd_type - Command type
  579. * @START_REQ: Start request
  580. * @RESTART_REQ: Restart request
  581. * @STOP_REQ: STOP request
  582. * @DELETE_REQ: DELETE request
  583. */
  584. enum vdev_cmd_type {
  585. START_REQ,
  586. RESTART_REQ,
  587. STOP_REQ,
  588. DELETE_REQ,
  589. };
  590. /**
  591. * enum vdev_start_resp_type - start respone type
  592. * @START_RESPONSE: Start response
  593. * @RESTART_RESPONSE: Restart response
  594. */
  595. enum vdev_start_resp_type {
  596. START_RESPONSE = 0,
  597. RESTART_RESPONSE,
  598. };
  599. /**
  600. * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  601. * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params
  602. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  603. * @mlme_vdev_start_send: callback to initiate actions of VDEV
  604. * MLME start operation
  605. * @mlme_vdev_restart_send: callback to initiate actions of VDEV
  606. * MLME restart operation
  607. * @mlme_vdev_stop_start_send: callback to block start/restart VDEV
  608. * request command
  609. * @mlme_vdev_start_continue: callback to initiate operations on
  610. * LMAC/FW start response
  611. * @mlme_vdev_sta_conn_start: callback to initiate STA connection
  612. * @mlme_vdev_up_send: callback to initiate actions of VDEV
  613. * MLME up operation
  614. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving
  615. * to UP state
  616. * @mlme_vdev_notify_roam_start: callback to initiate roaming
  617. * @mlme_vdev_update_beacon: callback to initiate beacon update
  618. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  619. * peers
  620. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  621. * @mlme_vdev_stop_send: callback to initiate actions of VDEV
  622. * MLME stop operation
  623. * @mlme_vdev_stop_continue: callback to initiate operations on
  624. * LMAC/FW stop response
  625. * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
  626. * peer delete completion
  627. * @mlme_vdev_down_send: callback to initiate actions of VDEV
  628. * MLME down operation
  629. * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start
  630. * start state exit
  631. * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required
  632. * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for
  633. * vdev mlme peer delete all response
  634. * @mlme_vdev_dfs_cac_wait_notify: callback to notify about CAC state
  635. * @mlme_vdev_csa_complete: callback to indicate CSA complete
  636. * @mlme_vdev_sta_disconn_start: callback to initiate STA disconnection
  637. */
  638. struct vdev_mlme_ops {
  639. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  640. struct vdev_mlme_obj *vdev_mlme,
  641. uint16_t event_data_len, void *event_data);
  642. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  643. struct vdev_mlme_obj *vdev_mlme,
  644. uint16_t event_data_len, void *event_data);
  645. QDF_STATUS (*mlme_vdev_start_send)(
  646. struct vdev_mlme_obj *vdev_mlme,
  647. uint16_t event_data_len, void *event_data);
  648. QDF_STATUS (*mlme_vdev_restart_send)(
  649. struct vdev_mlme_obj *vdev_mlme,
  650. uint16_t event_data_len, void *event_data);
  651. QDF_STATUS (*mlme_vdev_stop_start_send)(
  652. struct vdev_mlme_obj *vdev_mlme,
  653. enum vdev_cmd_type type,
  654. uint16_t event_data_len, void *event_data);
  655. QDF_STATUS (*mlme_vdev_start_continue)(
  656. struct vdev_mlme_obj *vdev_mlme,
  657. uint16_t event_data_len, void *event_data);
  658. QDF_STATUS (*mlme_vdev_sta_conn_start)(
  659. struct vdev_mlme_obj *vdev_mlme,
  660. uint16_t event_data_len, void *event_data);
  661. QDF_STATUS (*mlme_vdev_start_req_failed)(
  662. struct vdev_mlme_obj *vdev_mlme,
  663. uint16_t event_data_len, void *event_data);
  664. QDF_STATUS (*mlme_vdev_up_send)(
  665. struct vdev_mlme_obj *vdev_mlme,
  666. uint16_t event_data_len, void *event_data);
  667. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  668. struct vdev_mlme_obj *vdev_mlme,
  669. uint16_t event_data_len, void *event_data);
  670. QDF_STATUS (*mlme_vdev_notify_roam_start)(
  671. struct vdev_mlme_obj *vdev_mlme,
  672. uint16_t event_data_len, void *event_data);
  673. QDF_STATUS (*mlme_vdev_update_beacon)(
  674. struct vdev_mlme_obj *vdev_mlme,
  675. enum beacon_update_op op,
  676. uint16_t event_data_len, void *event_data);
  677. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  678. struct vdev_mlme_obj *vdev_mlme,
  679. uint16_t event_data_len, void *event_data);
  680. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  681. struct vdev_mlme_obj *vdev_mlme,
  682. uint16_t event_data_len, void *event_data);
  683. QDF_STATUS (*mlme_vdev_stop_send)(
  684. struct vdev_mlme_obj *vdev_mlme,
  685. uint16_t event_data_len, void *event_data);
  686. QDF_STATUS (*mlme_vdev_stop_continue)(
  687. struct vdev_mlme_obj *vdev_mlme,
  688. uint16_t event_data_len, void *event_data);
  689. QDF_STATUS (*mlme_vdev_down_send)(
  690. struct vdev_mlme_obj *vdev_mlme,
  691. uint16_t event_data_len, void *event_data);
  692. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  693. struct vdev_mlme_obj *vdev_mlme,
  694. uint16_t event_data_len, void *event_data);
  695. QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
  696. struct vdev_mlme_obj *vdev_mlme,
  697. struct vdev_stop_response *rsp);
  698. QDF_STATUS (*mlme_vdev_ext_start_rsp)(
  699. struct vdev_mlme_obj *vdev_mlme,
  700. struct vdev_start_response *rsp);
  701. QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
  702. struct vdev_mlme_obj *vdev_mlme);
  703. QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
  704. struct vdev_mlme_obj *vdev_mlme);
  705. QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
  706. struct vdev_mlme_obj *vdev_mlme,
  707. struct peer_delete_all_response *rsp);
  708. QDF_STATUS (*mlme_vdev_dfs_cac_wait_notify)(
  709. struct vdev_mlme_obj *vdev_mlme);
  710. QDF_STATUS (*mlme_vdev_csa_complete)(
  711. struct vdev_mlme_obj *vdev_mlme);
  712. QDF_STATUS (*mlme_vdev_sta_disconn_start)(
  713. struct vdev_mlme_obj *vdev_mlme,
  714. uint16_t event_data_len, void *event_data);
  715. };
  716. /**
  717. * struct vdev_mlme_obj - VDEV MLME component object
  718. * @proto: VDEV MLME proto substructure
  719. * @mgmt: VDEV MLME mgmt substructure
  720. * @sm_lock: VDEV SM lock
  721. * @vdev_cmd_lock: VDEV MLME command atomicity
  722. * @sm_hdl: VDEV SM handle
  723. * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only
  724. * @vdev: Pointer to vdev objmgr
  725. * @ops: VDEV MLME callback table
  726. * @ext_vdev_ptr: VDEV MLME legacy pointer
  727. * @reg_tpc_obj: Regulatory transmit power info
  728. * @vdev_rt: VDEV response timer
  729. * @vdev_wakelock: vdev wakelock sub structure
  730. */
  731. struct vdev_mlme_obj {
  732. struct vdev_mlme_proto proto;
  733. struct vdev_mlme_mgmt mgmt;
  734. #ifdef VDEV_SM_LOCK_SUPPORT
  735. qdf_spinlock_t sm_lock;
  736. qdf_mutex_t vdev_cmd_lock;
  737. #endif
  738. struct wlan_sm *sm_hdl;
  739. union {
  740. struct cnx_mgr *cnx_mgr_ctx;
  741. };
  742. struct wlan_objmgr_vdev *vdev;
  743. struct vdev_mlme_ops *ops;
  744. mlme_vdev_ext_t *ext_vdev_ptr;
  745. struct reg_tpc_power_info reg_tpc_obj;
  746. };
  747. /**
  748. * wlan_vdev_mlme_set_ssid() - set ssid
  749. * @vdev: VDEV object
  750. * @ssid: SSID (input)
  751. * @ssid_len: Length of SSID
  752. *
  753. * API to set the SSID of VDEV
  754. *
  755. * Caller need to acquire lock with wlan_vdev_obj_lock()
  756. *
  757. * Return: SUCCESS, if update is done
  758. * FAILURE, if ssid length is > max ssid len
  759. */
  760. static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
  761. struct wlan_objmgr_vdev *vdev,
  762. const uint8_t *ssid, uint8_t ssid_len)
  763. {
  764. struct vdev_mlme_obj *vdev_mlme;
  765. /* This API is invoked with lock acquired, do not add log prints */
  766. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  767. if (!vdev_mlme)
  768. return QDF_STATUS_E_FAILURE;
  769. if (ssid_len <= WLAN_SSID_MAX_LEN) {
  770. qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
  771. vdev_mlme->mgmt.generic.ssid_len = ssid_len;
  772. } else {
  773. vdev_mlme->mgmt.generic.ssid_len = 0;
  774. return QDF_STATUS_E_FAILURE;
  775. }
  776. return QDF_STATUS_SUCCESS;
  777. }
  778. /**
  779. * wlan_vdev_mlme_get_ssid() - get ssid
  780. * @vdev: VDEV object
  781. * @ssid: SSID
  782. * @ssid_len: Length of SSID
  783. *
  784. * API to get the SSID of VDEV, it updates the SSID and its length
  785. * in @ssid, @ssid_len respectively
  786. *
  787. * Caller need to acquire lock with wlan_vdev_obj_lock()
  788. *
  789. * Return: SUCCESS, if update is done
  790. * FAILURE, if ssid length is > max ssid len
  791. */
  792. static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
  793. struct wlan_objmgr_vdev *vdev,
  794. uint8_t *ssid, uint8_t *ssid_len)
  795. {
  796. struct vdev_mlme_obj *vdev_mlme;
  797. /* This API is invoked with lock acquired, do not add log prints */
  798. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  799. if (!vdev_mlme)
  800. return QDF_STATUS_E_FAILURE;
  801. if (vdev_mlme->mgmt.generic.ssid_len > 0) {
  802. *ssid_len = vdev_mlme->mgmt.generic.ssid_len;
  803. qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
  804. } else {
  805. *ssid_len = 0;
  806. return QDF_STATUS_E_FAILURE;
  807. }
  808. return QDF_STATUS_SUCCESS;
  809. }
  810. /**
  811. * wlan_vdev_mlme_set_nss() - set NSS
  812. * @vdev: VDEV object
  813. * @nss: nss configured by user
  814. *
  815. * API to set the Number of Spatial streams
  816. *
  817. * Return: void
  818. */
  819. static inline void wlan_vdev_mlme_set_nss(
  820. struct wlan_objmgr_vdev *vdev,
  821. uint8_t nss)
  822. {
  823. struct vdev_mlme_obj *vdev_mlme;
  824. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  825. if (!vdev_mlme)
  826. return;
  827. vdev_mlme->proto.generic.nss = nss;
  828. }
  829. /**
  830. * wlan_vdev_mlme_get_nss() - get NSS
  831. * @vdev: VDEV object
  832. *
  833. * API to get the Number of Spatial Streams
  834. *
  835. * Return:
  836. * @nss: nss value
  837. */
  838. static inline uint8_t wlan_vdev_mlme_get_nss(
  839. struct wlan_objmgr_vdev *vdev)
  840. {
  841. struct vdev_mlme_obj *vdev_mlme;
  842. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  843. if (!vdev_mlme)
  844. return 0;
  845. return vdev_mlme->proto.generic.nss;
  846. }
  847. /**
  848. * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
  849. * @vdev: VDEV object
  850. * @chainmask : chainmask either configured by user or max supported
  851. *
  852. * API to set the Tx chainmask
  853. *
  854. * Return: void
  855. */
  856. static inline void wlan_vdev_mlme_set_txchainmask(
  857. struct wlan_objmgr_vdev *vdev,
  858. uint8_t chainmask)
  859. {
  860. struct vdev_mlme_obj *vdev_mlme;
  861. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  862. if (!vdev_mlme)
  863. return;
  864. vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
  865. }
  866. /**
  867. * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
  868. * @vdev: VDEV object
  869. *
  870. * API to get the Tx chainmask
  871. *
  872. * Return:
  873. * @chainmask : Tx chainmask either configured by user or max supported
  874. */
  875. static inline uint8_t wlan_vdev_mlme_get_txchainmask(
  876. struct wlan_objmgr_vdev *vdev)
  877. {
  878. struct vdev_mlme_obj *vdev_mlme;
  879. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  880. if (!vdev_mlme)
  881. return 0;
  882. return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
  883. }
  884. /**
  885. * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
  886. * @vdev: VDEV object
  887. * @chainmask : Rx chainmask either configured by user or max supported
  888. *
  889. * API to set the Rx chainmask
  890. *
  891. * Return: void
  892. */
  893. static inline void wlan_vdev_mlme_set_rxchainmask(
  894. struct wlan_objmgr_vdev *vdev,
  895. uint8_t chainmask)
  896. {
  897. struct vdev_mlme_obj *vdev_mlme;
  898. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  899. if (!vdev_mlme)
  900. return;
  901. vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
  902. }
  903. /**
  904. * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
  905. * @vdev: VDEV object
  906. *
  907. * API to get the Rx chainmask
  908. *
  909. * Return:
  910. * @chainmask : Rx chainmask either configured by user or max supported
  911. */
  912. static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
  913. struct wlan_objmgr_vdev *vdev)
  914. {
  915. struct vdev_mlme_obj *vdev_mlme;
  916. /* This API is invoked with lock acquired, do not add log prints */
  917. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  918. if (!vdev_mlme)
  919. return 0;
  920. return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
  921. }
  922. /**
  923. * wlan_vdev_mlme_set_txpower() - set tx power
  924. * @vdev: VDEV object
  925. * @txpow: tx power either configured by used or max allowed
  926. *
  927. * API to set the tx power
  928. *
  929. * Return: void
  930. */
  931. static inline void wlan_vdev_mlme_set_txpower(
  932. struct wlan_objmgr_vdev *vdev,
  933. uint8_t txpow)
  934. {
  935. struct vdev_mlme_obj *vdev_mlme;
  936. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  937. if (!vdev_mlme)
  938. return;
  939. vdev_mlme->mgmt.generic.tx_power = txpow;
  940. }
  941. /**
  942. * wlan_vdev_mlme_get_txpower() - get tx power
  943. * @vdev: VDEV object
  944. *
  945. * API to get the tx power
  946. *
  947. * Return:
  948. * @txpow: tx power either configured by used or max allowed
  949. */
  950. static inline uint8_t wlan_vdev_mlme_get_txpower(
  951. struct wlan_objmgr_vdev *vdev)
  952. {
  953. struct vdev_mlme_obj *vdev_mlme;
  954. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  955. if (!vdev_mlme)
  956. return 0;
  957. return vdev_mlme->mgmt.generic.tx_power;
  958. }
  959. /**
  960. * wlan_vdev_mlme_set_maxrate() - set max rate
  961. * @vdev: VDEV object
  962. * @maxrate: configured by used or based on configured mode
  963. *
  964. * API to set the max rate the vdev supports
  965. *
  966. * Return: void
  967. */
  968. static inline void wlan_vdev_mlme_set_maxrate(
  969. struct wlan_objmgr_vdev *vdev,
  970. uint32_t maxrate)
  971. {
  972. struct vdev_mlme_obj *vdev_mlme;
  973. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  974. if (!vdev_mlme)
  975. return;
  976. vdev_mlme->mgmt.rate_info.max_rate = maxrate;
  977. }
  978. /**
  979. * wlan_vdev_mlme_get_maxrate() - get max rate
  980. * @vdev: VDEV object
  981. *
  982. * API to get the max rate the vdev supports
  983. *
  984. * Return:
  985. * @maxrate: configured by used or based on configured mode
  986. */
  987. static inline uint32_t wlan_vdev_mlme_get_maxrate(
  988. struct wlan_objmgr_vdev *vdev)
  989. {
  990. struct vdev_mlme_obj *vdev_mlme;
  991. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  992. if (!vdev_mlme)
  993. return 0;
  994. return vdev_mlme->mgmt.rate_info.max_rate;
  995. }
  996. /**
  997. * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
  998. * @vdev: VDEV object
  999. * @txmgmtrate: Tx Mgmt rate
  1000. *
  1001. * API to set Mgmt Tx rate
  1002. *
  1003. * Return: void
  1004. */
  1005. static inline void wlan_vdev_mlme_set_txmgmtrate(
  1006. struct wlan_objmgr_vdev *vdev,
  1007. uint32_t txmgmtrate)
  1008. {
  1009. struct vdev_mlme_obj *vdev_mlme;
  1010. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1011. if (!vdev_mlme)
  1012. return;
  1013. vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
  1014. }
  1015. /**
  1016. * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
  1017. * @vdev: VDEV object
  1018. *
  1019. * API to get Mgmt Tx rate
  1020. *
  1021. * Return:
  1022. * @txmgmtrate: Tx Mgmt rate
  1023. */
  1024. static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
  1025. struct wlan_objmgr_vdev *vdev)
  1026. {
  1027. struct vdev_mlme_obj *vdev_mlme;
  1028. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1029. if (!vdev_mlme)
  1030. return 0;
  1031. return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
  1032. }
  1033. /**
  1034. * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev
  1035. * @vdev: VDEV object
  1036. *
  1037. * API to check given vdev is a special vdev.
  1038. *
  1039. * Return: true if given vdev is special vdev, else false
  1040. */
  1041. static inline bool wlan_vdev_mlme_is_special_vdev(
  1042. struct wlan_objmgr_vdev *vdev)
  1043. {
  1044. struct vdev_mlme_obj *vdev_mlme;
  1045. if (!vdev)
  1046. return false;
  1047. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1048. if (!vdev_mlme)
  1049. return false;
  1050. return vdev_mlme->mgmt.generic.special_vdev_mode;
  1051. }
  1052. #ifdef WLAN_FEATURE_11AX
  1053. /**
  1054. * wlan_vdev_mlme_set_he_mcs_12_13_map() - set he mcs12/13 map
  1055. * @vdev: VDEV object
  1056. * @he_mcs_12_13_map: he mcs12/13 map from self&peer
  1057. *
  1058. * API to set he mcs 12/13 map
  1059. *
  1060. * Return: void
  1061. */
  1062. static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
  1063. struct wlan_objmgr_vdev *vdev,
  1064. uint16_t he_mcs_12_13_map)
  1065. {
  1066. struct vdev_mlme_obj *vdev_mlme;
  1067. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1068. if (!vdev_mlme)
  1069. return;
  1070. vdev_mlme->mgmt.sta.he_mcs_12_13_map = he_mcs_12_13_map;
  1071. }
  1072. /**
  1073. * wlan_vdev_mlme_get_he_mcs_12_13_map() - get he mcs12/13 map
  1074. * @vdev: VDEV object
  1075. *
  1076. * API to get he mcs12/13 support capability
  1077. *
  1078. * Return:
  1079. * @he_mcs_12_13_map: he mcs12/13 map
  1080. */
  1081. static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
  1082. struct wlan_objmgr_vdev *vdev)
  1083. {
  1084. struct vdev_mlme_obj *vdev_mlme;
  1085. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1086. if (!vdev_mlme)
  1087. return 0;
  1088. return vdev_mlme->mgmt.sta.he_mcs_12_13_map;
  1089. }
  1090. #ifdef WLAN_FEATURE_SR
  1091. /**
  1092. * wlan_vdev_mlme_get_sr_ctrl() - get spatial reuse SR control
  1093. * @vdev: VDEV object
  1094. *
  1095. * API to retrieve the spatial reuse SR control from VDEV
  1096. *
  1097. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1098. *
  1099. * Return:
  1100. * @he_spr_sr_ctrl: SR control
  1101. */
  1102. static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
  1103. {
  1104. struct vdev_mlme_obj *vdev_mlme;
  1105. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1106. if (!vdev_mlme)
  1107. return 0;
  1108. return vdev_mlme->mgmt.generic.he_spr_sr_ctrl;
  1109. }
  1110. /**
  1111. * wlan_vdev_mlme_get_pd_offset() - get spatial reuse pd offset
  1112. * @vdev: VDEV object
  1113. *
  1114. * API to retrieve the spatial reuse pd offset from VDEV
  1115. *
  1116. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1117. *
  1118. * Return:
  1119. * @he_spr_non_srg_pd_max_offset: max pd offset
  1120. */
  1121. static inline uint8_t wlan_vdev_mlme_get_pd_offset(
  1122. struct wlan_objmgr_vdev *vdev)
  1123. {
  1124. struct vdev_mlme_obj *vdev_mlme;
  1125. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1126. if (!vdev_mlme)
  1127. return 0;
  1128. return vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset;
  1129. }
  1130. /**
  1131. * wlan_vdev_mlme_get_he_spr_enabled() - spatial reuse enabled or not
  1132. * @vdev: VDEV object
  1133. *
  1134. * API to check whether the spatial reuse enabled or not
  1135. *
  1136. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1137. *
  1138. * Return:
  1139. * @he_spr_enabled: Spatial reuse enabled or not
  1140. */
  1141. static inline bool wlan_vdev_mlme_get_he_spr_enabled(
  1142. struct wlan_objmgr_vdev *vdev)
  1143. {
  1144. struct vdev_mlme_obj *vdev_mlme;
  1145. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1146. if (!vdev_mlme)
  1147. return false;
  1148. return vdev_mlme->mgmt.generic.he_spr_enabled;
  1149. }
  1150. /**
  1151. * wlan_vdev_mlme_is_sr_disable_due_conc() - spatial reuse disabled due
  1152. * to concurrency
  1153. * @vdev: VDEV object
  1154. *
  1155. * API to check whether the spatial reuse disabled due to concurrency or not
  1156. *
  1157. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1158. *
  1159. * Return:
  1160. * true/false: true if spatial reuse disabled due to concurrency else false
  1161. */
  1162. static inline
  1163. bool wlan_vdev_mlme_is_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev)
  1164. {
  1165. struct vdev_mlme_obj *vdev_mlme;
  1166. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1167. if (!vdev_mlme)
  1168. return false;
  1169. return vdev_mlme->mgmt.generic.he_spr_disabled_due_conc;
  1170. }
  1171. /**
  1172. * wlan_vdev_mlme_set_sr_ctrl() - set spatial reuse SR control
  1173. * @vdev: VDEV object
  1174. *
  1175. * API to set the spatial reuse SR control
  1176. *
  1177. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1178. *
  1179. * Return: void
  1180. */
  1181. static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
  1182. uint8_t sr_ctrl)
  1183. {
  1184. struct vdev_mlme_obj *vdev_mlme;
  1185. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1186. if (!vdev_mlme)
  1187. return;
  1188. vdev_mlme->mgmt.generic.he_spr_sr_ctrl = sr_ctrl;
  1189. }
  1190. /**
  1191. * wlan_vdev_mlme_set_pd_offset() - set spatial reuse pd max offset
  1192. * @vdev: VDEV object
  1193. *
  1194. * API to set the spatial reuse pd max offset
  1195. *
  1196. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1197. *
  1198. * Return: void
  1199. */
  1200. static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
  1201. uint8_t pd_max_offset)
  1202. {
  1203. struct vdev_mlme_obj *vdev_mlme;
  1204. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1205. if (!vdev_mlme)
  1206. return;
  1207. vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset = pd_max_offset;
  1208. }
  1209. /**
  1210. * wlan_vdev_mlme_set_he_spr_enabled() - set spatial reuse enabled
  1211. * @vdev: VDEV object
  1212. *
  1213. * API to set the spatial reuse enabled
  1214. *
  1215. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1216. *
  1217. * Return: void
  1218. */
  1219. static inline void wlan_vdev_mlme_set_he_spr_enabled(
  1220. struct wlan_objmgr_vdev *vdev,
  1221. bool enable_he_spr)
  1222. {
  1223. struct vdev_mlme_obj *vdev_mlme;
  1224. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1225. if (!vdev_mlme)
  1226. return;
  1227. vdev_mlme->mgmt.generic.he_spr_enabled = enable_he_spr;
  1228. }
  1229. /**
  1230. * wlan_vdev_mlme_set_sr_disable_due_conc() - set spatial reuse disabled due
  1231. * to concurrency
  1232. * @vdev: VDEV object
  1233. *
  1234. * API to set the spatial reuse disabled due to concurrency
  1235. *
  1236. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1237. *
  1238. * Return: void
  1239. */
  1240. static inline
  1241. void wlan_vdev_mlme_set_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev,
  1242. bool he_spr_disabled_due_conc)
  1243. {
  1244. struct vdev_mlme_obj *vdev_mlme;
  1245. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1246. if (!vdev_mlme)
  1247. return;
  1248. vdev_mlme->mgmt.generic.he_spr_disabled_due_conc =
  1249. he_spr_disabled_due_conc;
  1250. }
  1251. /**
  1252. * wlan_vdev_mlme_set_srg_pd_offset() - set spatial reuse SRG pd max/min offset
  1253. * @vdev: VDEV object
  1254. * @srg_max_pd_offset: SRG max pd offset
  1255. * @srg_min_pd_offset: SRG min pd offset
  1256. *
  1257. * API to set the spatial reuse SRG pd min max offset
  1258. *
  1259. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1260. *
  1261. * Return: void
  1262. */
  1263. static inline
  1264. void wlan_vdev_mlme_set_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
  1265. uint8_t srg_max_pd_offset,
  1266. uint8_t srg_min_pd_offset)
  1267. {
  1268. struct vdev_mlme_obj *vdev_mlme;
  1269. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1270. if (!vdev_mlme)
  1271. return;
  1272. vdev_mlme->mgmt.generic.he_spr_srg_max_pd_offset = srg_max_pd_offset;
  1273. vdev_mlme->mgmt.generic.he_spr_srg_min_pd_offset = srg_min_pd_offset;
  1274. }
  1275. /**
  1276. * wlan_vdev_mlme_get_srg_pd_offset() - get spatial reuse SRG pd min/max offset
  1277. * @vdev: VDEV object
  1278. * @srg_max_pd_offset: SRG max pd offset
  1279. * @srg_min_pd_offset: SRG min pd offset
  1280. *
  1281. * API to set the spatial reuse SRG pd min max offset
  1282. *
  1283. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1284. *
  1285. * Return: void
  1286. */
  1287. static inline
  1288. void wlan_vdev_mlme_get_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
  1289. uint8_t *srg_max_pd_offset,
  1290. uint8_t *srg_min_pd_offset)
  1291. {
  1292. struct vdev_mlme_obj *vdev_mlme;
  1293. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1294. if (!vdev_mlme)
  1295. return;
  1296. *srg_max_pd_offset = vdev_mlme->mgmt.generic.he_spr_srg_max_pd_offset;
  1297. *srg_min_pd_offset = vdev_mlme->mgmt.generic.he_spr_srg_min_pd_offset;
  1298. }
  1299. #else
  1300. static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
  1301. {
  1302. return 0;
  1303. }
  1304. static inline uint8_t wlan_vdev_mlme_get_pd_offset(
  1305. struct wlan_objmgr_vdev *vdev)
  1306. {
  1307. return 0;
  1308. }
  1309. static inline bool wlan_vdev_mlme_get_he_spr_enabled(
  1310. struct wlan_objmgr_vdev *vdev)
  1311. {
  1312. return 0;
  1313. }
  1314. static inline
  1315. bool wlan_vdev_mlme_is_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev)
  1316. {
  1317. return false;
  1318. }
  1319. static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
  1320. uint8_t sr_ctrl)
  1321. {
  1322. }
  1323. static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
  1324. uint8_t pd_max_offset)
  1325. {
  1326. }
  1327. static inline void wlan_vdev_mlme_set_he_spr_enabled(
  1328. struct wlan_objmgr_vdev *vdev,
  1329. bool enable_he_spr)
  1330. {
  1331. }
  1332. static inline
  1333. void wlan_vdev_mlme_set_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev,
  1334. bool he_spr_disabled_due_conc)
  1335. {
  1336. }
  1337. #endif
  1338. #else
  1339. static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
  1340. struct wlan_objmgr_vdev *vdev,
  1341. uint16_t he_mcs_12_13_map)
  1342. {
  1343. }
  1344. static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
  1345. struct wlan_objmgr_vdev *vdev)
  1346. {
  1347. return 0;
  1348. }
  1349. #endif
  1350. /**
  1351. * wlan_vdev_mlme_set_aid_mgr() - set aid mgr
  1352. * @vdev: VDEV object
  1353. * @aid_mgr: AID mgr
  1354. *
  1355. * API to set AID mgr in VDEV MLME cmpt object
  1356. *
  1357. * Return: void
  1358. */
  1359. static inline void wlan_vdev_mlme_set_aid_mgr(
  1360. struct wlan_objmgr_vdev *vdev,
  1361. struct wlan_vdev_aid_mgr *aid_mgr)
  1362. {
  1363. struct vdev_mlme_obj *vdev_mlme;
  1364. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1365. if (!vdev_mlme)
  1366. return;
  1367. vdev_mlme->mgmt.ap.aid_mgr = aid_mgr;
  1368. }
  1369. /**
  1370. * wlan_vdev_mlme_get_aid_mgr() - get aid mgr
  1371. * @vdev: VDEV object
  1372. *
  1373. * API to get AID mgr in VDEV MLME cmpt object
  1374. *
  1375. * Return: aid_mgr
  1376. */
  1377. static inline struct wlan_vdev_aid_mgr *wlan_vdev_mlme_get_aid_mgr(
  1378. struct wlan_objmgr_vdev *vdev)
  1379. {
  1380. struct vdev_mlme_obj *vdev_mlme;
  1381. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1382. if (!vdev_mlme)
  1383. return NULL;
  1384. return vdev_mlme->mgmt.ap.aid_mgr;
  1385. }
  1386. #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
  1387. /**
  1388. * vdev_mgr_cdp_vdev_attach() - MLME API to attach CDP vdev
  1389. * @mlme_obj: pointer to vdev_mlme_obj
  1390. *
  1391. * Return: QDF_STATUS - Success or Failure
  1392. */
  1393. QDF_STATUS vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj *mlme_obj);
  1394. /**
  1395. * vdev_mgr_cdp_vdev_detach() - MLME API to detach CDP vdev
  1396. * @mlme_obj: pointer to vdev_mlme_obj
  1397. *
  1398. * Return: QDF_STATUS - Success or Failure
  1399. */
  1400. QDF_STATUS vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj *mlme_obj);
  1401. #endif
  1402. #endif