wlan_vdev_mlme.h 41 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415
  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_enabled: Spatial reuse enabled or not
  328. * @pd_threshold: pd threshold sent by userspace
  329. */
  330. struct vdev_mlme_mgmt_generic {
  331. uint32_t rts_threshold;
  332. uint32_t frag_threshold;
  333. uint32_t probe_delay;
  334. uint32_t repeat_probe_time;
  335. uint32_t drop_unencry;
  336. uint32_t tx_pwrlimit;
  337. uint8_t tx_power;
  338. uint8_t minpower;
  339. uint8_t maxpower;
  340. uint8_t maxregpower;
  341. uint8_t antennamax;
  342. uint8_t reg_class_id;
  343. uint8_t ampdu;
  344. uint8_t amsdu;
  345. char ssid[WLAN_SSID_MAX_LEN + 1];
  346. uint8_t ssid_len;
  347. uint8_t type;
  348. uint8_t subtype;
  349. uint8_t rx_decap_type;
  350. uint8_t tx_encap_type;
  351. bool disable_hw_ack;
  352. uint8_t bssid[QDF_MAC_ADDR_SIZE];
  353. uint32_t phy_mode;
  354. bool special_vdev_mode;
  355. #ifdef WLAN_FEATURE_SR
  356. uint8_t he_spr_sr_ctrl;
  357. uint8_t he_spr_non_srg_pd_max_offset;
  358. bool he_spr_enabled;
  359. int32_t pd_threshold;
  360. #endif
  361. };
  362. /*
  363. * struct wlan_vdev_aid_mgr – AID manager
  364. * @aid_bitmap: AID bitmap array
  365. * @start_aid: start of AID index
  366. * @max_aid: Max allowed AID
  367. * @ref_cnt: to share AID across VDEVs for MBSSID
  368. */
  369. struct wlan_vdev_aid_mgr {
  370. qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
  371. uint16_t start_aid;
  372. uint16_t max_aid;
  373. qdf_atomic_t ref_cnt;
  374. };
  375. /**
  376. * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
  377. * @hidden_ssid: flag to indicate whether it is hidden ssid
  378. * @cac_duration_ms: cac duration in milliseconds
  379. * @aid_mgr: AID bitmap mgr
  380. * @max_chan_switch_time: Max channel switch time in milliseconds.
  381. * @last_bcn_ts_ms: Timestamp (in milliseconds) of the last beacon sent on the
  382. * CSA triggered channel.
  383. */
  384. struct vdev_mlme_mgmt_ap {
  385. bool hidden_ssid;
  386. uint32_t cac_duration_ms;
  387. struct wlan_vdev_aid_mgr *aid_mgr;
  388. uint32_t max_chan_switch_time;
  389. unsigned long last_bcn_ts_ms;
  390. };
  391. /**
  392. * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
  393. * @he_mcs_12_13_map: map to indicate mcs12/13 caps of peer&dut
  394. */
  395. struct vdev_mlme_mgmt_sta {
  396. uint16_t he_mcs_12_13_map;
  397. };
  398. /**
  399. * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
  400. * @bmiss_first_bcnt: bmiss first time
  401. * @bmiss_final_bcnt: bmiss final time
  402. * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
  403. * inactive
  404. * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
  405. * data-null
  406. * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
  407. */
  408. struct vdev_mlme_inactivity_params {
  409. uint32_t bmiss_first_bcnt;
  410. uint32_t bmiss_final_bcnt;
  411. uint32_t keepalive_min_idle_inactive_time_secs;
  412. uint32_t keepalive_max_idle_inactive_time_secs;
  413. uint32_t keepalive_max_unresponsive_time_secs;
  414. };
  415. /**
  416. * enum vdev_ratemask_type - ratemask phy type
  417. * @WLAN_VDEV_RATEMASK_TYPE_CCK: phy type CCK
  418. * @WLAN_VDEV_RATEMASK_TYPE_HT: phy type ht
  419. * @WLAN_VDEV_RATEMASK_TYPE_VHT: phy type vht
  420. * WLAN_VDEV_RATEMASK_TYPE_HE: phy type he
  421. */
  422. enum vdev_ratemask_type {
  423. WLAN_VDEV_RATEMASK_TYPE_CCK,
  424. WLAN_VDEV_RATEMASK_TYPE_HT,
  425. WLAN_VDEV_RATEMASK_TYPE_VHT,
  426. WLAN_VDEV_RATEMASK_TYPE_HE,
  427. WLAN_VDEV_RATEMASK_TYPE_MAX,
  428. };
  429. /**
  430. * struct vdev_ratemask_params - vdev ratemask parameters
  431. * @type: ratemask phy type
  432. * @lower32: ratemask lower32 bitmask
  433. * @higher32: ratemask higher32 bitmask
  434. * @lower32_2: ratemask lower32_2 bitmask
  435. * @higher32_2: rtaemask higher32_2 bitmask
  436. */
  437. struct vdev_ratemask_params {
  438. uint32_t lower32;
  439. uint32_t higher32;
  440. uint32_t lower32_2;
  441. uint32_t higher32_2;
  442. };
  443. /**
  444. * struct vdev_mlme_rate_info - vdev mlme rate information
  445. * @rate_flags: dynamic bandwidth info
  446. * @per_band_tx_mgmt_rate: per band Tx mgmt rate
  447. * @max_rate: max bandwidth rate
  448. * @tx_mgmt_rate: Tx Mgmt rate
  449. * @bcn_tx_rate: beacon Tx rate
  450. * @bcn_tx_rate_code: beacon Tx rate code
  451. * @ratemask_params: vdev ratemask params per phy type
  452. * @half_rate: Half rate
  453. * @quarter_rate: quarter rate
  454. */
  455. struct vdev_mlme_rate_info {
  456. uint32_t rate_flags;
  457. uint32_t per_band_tx_mgmt_rate;
  458. uint32_t max_rate;
  459. uint32_t tx_mgmt_rate;
  460. uint32_t bcn_tx_rate;
  461. #ifdef WLAN_BCN_RATECODE_ENABLE
  462. uint32_t bcn_tx_rate_code;
  463. #endif
  464. uint32_t rtscts_tx_rate;
  465. struct vdev_ratemask_params ratemask_params[
  466. WLAN_VDEV_RATEMASK_TYPE_MAX];
  467. bool half_rate;
  468. bool quarter_rate;
  469. };
  470. /**
  471. * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
  472. * @tx_chainmask: Tx chainmask
  473. * @rx_chainmask: Rx Chainmask
  474. * @num_rx_chain: Num of bits set in Rx chain
  475. * @num_tx_chain: Num of bits set in Tx chain
  476. */
  477. struct vdev_mlme_chainmask_info {
  478. uint8_t tx_chainmask;
  479. uint8_t rx_chainmask;
  480. uint8_t num_rx_chain;
  481. uint8_t num_tx_chain;
  482. };
  483. /**
  484. * struct vdev_mlme_powersave_info - vdev mlme powersave information
  485. * @packet_powersave: packet powersave
  486. * @max_li_of_moddtim: max mod dtim
  487. * @dyndtim_cnt: dynamic dtim count
  488. * @listen_interval: listen interval
  489. * @moddtim_cnt: mod dtim count
  490. */
  491. struct vdev_mlme_powersave_info {
  492. uint32_t packet_powersave;
  493. uint32_t max_li_of_moddtim;
  494. uint32_t dyndtim_cnt;
  495. uint32_t listen_interval;
  496. uint32_t moddtim_cnt;
  497. };
  498. /**
  499. * struct vdev_mlme_beacon_info - vdev mlme beacon information
  500. * @beacon_buffer: buffer allocated for beacon frame
  501. * @beacon_offsets: beacon IE's offsets
  502. */
  503. struct vdev_mlme_beacon_info {
  504. qdf_nbuf_t beacon_buffer;
  505. void *beacon_offsets;
  506. };
  507. /**
  508. * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
  509. * @profile_idx: profile index of the connected non-trans ap (mbssid case).
  510. * 0 means invalid.
  511. * @profile_num: the total profile numbers of non-trans aps (mbssid
  512. * case).
  513. * 0 means non-MBSS AP.
  514. * @mbssid-flags: MBSS IE flags indicating vdev type
  515. * @vdevid_trans: id of transmitting vdev for MBSS IE
  516. * @vdev_bmap: vdev bitmap of VAPs in MBSS group
  517. * @is_cmn_param: flag to check mbss common param
  518. * @trans_bssid: bssid of transmitted AP (MBSS IE case)
  519. * @is_multi_mbssid: Flag to identify multi group mbssid support
  520. * @grp_id: Group id of current vdev
  521. */
  522. struct vdev_mlme_mbss_11ax {
  523. uint32_t profile_idx;
  524. uint32_t profile_num;
  525. uint32_t mbssid_flags;
  526. uint8_t vdevid_trans;
  527. unsigned long vdev_bmap;
  528. bool is_cmn_param;
  529. uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
  530. bool is_multi_mbssid;
  531. uint32_t grp_id;
  532. };
  533. /**
  534. * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
  535. * @generic: generic mgmt information
  536. * @ap: ap specific mgmt information
  537. * @sta: sta specific mgmt information
  538. * @inactivity_params: inactivity parameters
  539. * @rate_info: bandwidth rate information
  540. * @chainmask_info: Chainmask information
  541. * @powersave_info: Power save parameters
  542. * @beacon_info: beacon buffer information
  543. * @mbss_11ax: MBSS 11ax information
  544. */
  545. struct vdev_mlme_mgmt {
  546. struct vdev_mlme_mgmt_generic generic;
  547. struct vdev_mlme_mgmt_ap ap;
  548. struct vdev_mlme_mgmt_sta sta;
  549. struct vdev_mlme_inactivity_params inactivity_params;
  550. struct vdev_mlme_rate_info rate_info;
  551. struct vdev_mlme_chainmask_info chainmask_info;
  552. struct vdev_mlme_powersave_info powersave_info;
  553. struct vdev_mlme_beacon_info beacon_info;
  554. struct vdev_mlme_mbss_11ax mbss_11ax;
  555. };
  556. /**
  557. * enum beacon_update_op - Beacon update op type
  558. * @BEACON_INIT: Initialize beacon
  559. * @BEACON_REINIT: Re-initialize beacon
  560. * @BEACON_UPDATE: Update dynamic fields of beacon
  561. * @BEACON_CSA: Enable CSA IE
  562. * @BEACON_FREE: Beacon buffer free
  563. */
  564. enum beacon_update_op {
  565. BEACON_INIT,
  566. BEACON_REINIT,
  567. BEACON_UPDATE,
  568. BEACON_CSA,
  569. BEACON_FREE,
  570. };
  571. /**
  572. * enum vdev_cmd_type - Command type
  573. * @START_REQ: Start request
  574. * @RESTART_REQ: Restart request
  575. * @STOP_REQ: STOP request
  576. * @DELETE_REQ: DELETE request
  577. */
  578. enum vdev_cmd_type {
  579. START_REQ,
  580. RESTART_REQ,
  581. STOP_REQ,
  582. DELETE_REQ,
  583. };
  584. /**
  585. * enum vdev_start_resp_type - start respone type
  586. * @START_RESPONSE: Start response
  587. * @RESTART_RESPONSE: Restart response
  588. */
  589. enum vdev_start_resp_type {
  590. START_RESPONSE = 0,
  591. RESTART_RESPONSE,
  592. };
  593. /**
  594. * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  595. * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params
  596. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  597. * @mlme_vdev_start_send: callback to initiate actions of VDEV
  598. * MLME start operation
  599. * @mlme_vdev_restart_send: callback to initiate actions of VDEV
  600. * MLME restart operation
  601. * @mlme_vdev_stop_start_send: callback to block start/restart VDEV
  602. * request command
  603. * @mlme_vdev_start_continue: callback to initiate operations on
  604. * LMAC/FW start response
  605. * @mlme_vdev_sta_conn_start: callback to initiate STA connection
  606. * @mlme_vdev_up_send: callback to initiate actions of VDEV
  607. * MLME up operation
  608. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving
  609. * to UP state
  610. * @mlme_vdev_notify_roam_start: callback to initiate roaming
  611. * @mlme_vdev_update_beacon: callback to initiate beacon update
  612. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  613. * peers
  614. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  615. * @mlme_vdev_stop_send: callback to initiate actions of VDEV
  616. * MLME stop operation
  617. * @mlme_vdev_stop_continue: callback to initiate operations on
  618. * LMAC/FW stop response
  619. * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
  620. * peer delete completion
  621. * @mlme_vdev_down_send: callback to initiate actions of VDEV
  622. * MLME down operation
  623. * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start
  624. * start state exit
  625. * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required
  626. * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for
  627. * vdev mlme peer delete all response
  628. * @mlme_vdev_dfs_cac_wait_notify: callback to notify about CAC state
  629. * @mlme_vdev_csa_complete: callback to indicate CSA complete
  630. * @mlme_vdev_sta_disconn_start: callback to initiate STA disconnection
  631. */
  632. struct vdev_mlme_ops {
  633. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  634. struct vdev_mlme_obj *vdev_mlme,
  635. uint16_t event_data_len, void *event_data);
  636. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  637. struct vdev_mlme_obj *vdev_mlme,
  638. uint16_t event_data_len, void *event_data);
  639. QDF_STATUS (*mlme_vdev_start_send)(
  640. struct vdev_mlme_obj *vdev_mlme,
  641. uint16_t event_data_len, void *event_data);
  642. QDF_STATUS (*mlme_vdev_restart_send)(
  643. struct vdev_mlme_obj *vdev_mlme,
  644. uint16_t event_data_len, void *event_data);
  645. QDF_STATUS (*mlme_vdev_stop_start_send)(
  646. struct vdev_mlme_obj *vdev_mlme,
  647. enum vdev_cmd_type type,
  648. uint16_t event_data_len, void *event_data);
  649. QDF_STATUS (*mlme_vdev_start_continue)(
  650. struct vdev_mlme_obj *vdev_mlme,
  651. uint16_t event_data_len, void *event_data);
  652. QDF_STATUS (*mlme_vdev_sta_conn_start)(
  653. struct vdev_mlme_obj *vdev_mlme,
  654. uint16_t event_data_len, void *event_data);
  655. QDF_STATUS (*mlme_vdev_start_req_failed)(
  656. struct vdev_mlme_obj *vdev_mlme,
  657. uint16_t event_data_len, void *event_data);
  658. QDF_STATUS (*mlme_vdev_up_send)(
  659. struct vdev_mlme_obj *vdev_mlme,
  660. uint16_t event_data_len, void *event_data);
  661. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  662. struct vdev_mlme_obj *vdev_mlme,
  663. uint16_t event_data_len, void *event_data);
  664. QDF_STATUS (*mlme_vdev_notify_roam_start)(
  665. struct vdev_mlme_obj *vdev_mlme,
  666. uint16_t event_data_len, void *event_data);
  667. QDF_STATUS (*mlme_vdev_update_beacon)(
  668. struct vdev_mlme_obj *vdev_mlme,
  669. enum beacon_update_op op,
  670. uint16_t event_data_len, void *event_data);
  671. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  672. struct vdev_mlme_obj *vdev_mlme,
  673. uint16_t event_data_len, void *event_data);
  674. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  675. struct vdev_mlme_obj *vdev_mlme,
  676. uint16_t event_data_len, void *event_data);
  677. QDF_STATUS (*mlme_vdev_stop_send)(
  678. struct vdev_mlme_obj *vdev_mlme,
  679. uint16_t event_data_len, void *event_data);
  680. QDF_STATUS (*mlme_vdev_stop_continue)(
  681. struct vdev_mlme_obj *vdev_mlme,
  682. uint16_t event_data_len, void *event_data);
  683. QDF_STATUS (*mlme_vdev_down_send)(
  684. struct vdev_mlme_obj *vdev_mlme,
  685. uint16_t event_data_len, void *event_data);
  686. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  687. struct vdev_mlme_obj *vdev_mlme,
  688. uint16_t event_data_len, void *event_data);
  689. QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
  690. struct vdev_mlme_obj *vdev_mlme,
  691. struct vdev_stop_response *rsp);
  692. QDF_STATUS (*mlme_vdev_ext_start_rsp)(
  693. struct vdev_mlme_obj *vdev_mlme,
  694. struct vdev_start_response *rsp);
  695. QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
  696. struct vdev_mlme_obj *vdev_mlme);
  697. QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
  698. struct vdev_mlme_obj *vdev_mlme);
  699. QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
  700. struct vdev_mlme_obj *vdev_mlme,
  701. struct peer_delete_all_response *rsp);
  702. QDF_STATUS (*mlme_vdev_dfs_cac_wait_notify)(
  703. struct vdev_mlme_obj *vdev_mlme);
  704. QDF_STATUS (*mlme_vdev_csa_complete)(
  705. struct vdev_mlme_obj *vdev_mlme);
  706. QDF_STATUS (*mlme_vdev_sta_disconn_start)(
  707. struct vdev_mlme_obj *vdev_mlme,
  708. uint16_t event_data_len, void *event_data);
  709. };
  710. /**
  711. * struct vdev_mlme_obj - VDEV MLME component object
  712. * @proto: VDEV MLME proto substructure
  713. * @mgmt: VDEV MLME mgmt substructure
  714. * @sm_lock: VDEV SM lock
  715. * @vdev_cmd_lock: VDEV MLME command atomicity
  716. * @sm_hdl: VDEV SM handle
  717. * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only
  718. * @vdev: Pointer to vdev objmgr
  719. * @ops: VDEV MLME callback table
  720. * @ext_vdev_ptr: VDEV MLME legacy pointer
  721. * @reg_tpc_obj: Regulatory transmit power info
  722. * @vdev_rt: VDEV response timer
  723. * @vdev_wakelock: vdev wakelock sub structure
  724. */
  725. struct vdev_mlme_obj {
  726. struct vdev_mlme_proto proto;
  727. struct vdev_mlme_mgmt mgmt;
  728. #ifdef VDEV_SM_LOCK_SUPPORT
  729. qdf_spinlock_t sm_lock;
  730. qdf_mutex_t vdev_cmd_lock;
  731. #endif
  732. struct wlan_sm *sm_hdl;
  733. union {
  734. struct cnx_mgr *cnx_mgr_ctx;
  735. };
  736. struct wlan_objmgr_vdev *vdev;
  737. struct vdev_mlme_ops *ops;
  738. mlme_vdev_ext_t *ext_vdev_ptr;
  739. struct reg_tpc_power_info reg_tpc_obj;
  740. };
  741. /**
  742. * wlan_vdev_mlme_set_ssid() - set ssid
  743. * @vdev: VDEV object
  744. * @ssid: SSID (input)
  745. * @ssid_len: Length of SSID
  746. *
  747. * API to set the SSID of VDEV
  748. *
  749. * Caller need to acquire lock with wlan_vdev_obj_lock()
  750. *
  751. * Return: SUCCESS, if update is done
  752. * FAILURE, if ssid length is > max ssid len
  753. */
  754. static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
  755. struct wlan_objmgr_vdev *vdev,
  756. const uint8_t *ssid, uint8_t ssid_len)
  757. {
  758. struct vdev_mlme_obj *vdev_mlme;
  759. /* This API is invoked with lock acquired, do not add log prints */
  760. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  761. if (!vdev_mlme)
  762. return QDF_STATUS_E_FAILURE;
  763. if (ssid_len <= WLAN_SSID_MAX_LEN) {
  764. qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
  765. vdev_mlme->mgmt.generic.ssid_len = ssid_len;
  766. } else {
  767. vdev_mlme->mgmt.generic.ssid_len = 0;
  768. return QDF_STATUS_E_FAILURE;
  769. }
  770. return QDF_STATUS_SUCCESS;
  771. }
  772. /**
  773. * wlan_vdev_mlme_get_ssid() - get ssid
  774. * @vdev: VDEV object
  775. * @ssid: SSID
  776. * @ssid_len: Length of SSID
  777. *
  778. * API to get the SSID of VDEV, it updates the SSID and its length
  779. * in @ssid, @ssid_len respectively
  780. *
  781. * Caller need to acquire lock with wlan_vdev_obj_lock()
  782. *
  783. * Return: SUCCESS, if update is done
  784. * FAILURE, if ssid length is > max ssid len
  785. */
  786. static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
  787. struct wlan_objmgr_vdev *vdev,
  788. uint8_t *ssid, uint8_t *ssid_len)
  789. {
  790. struct vdev_mlme_obj *vdev_mlme;
  791. /* This API is invoked with lock acquired, do not add log prints */
  792. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  793. if (!vdev_mlme)
  794. return QDF_STATUS_E_FAILURE;
  795. if (vdev_mlme->mgmt.generic.ssid_len > 0) {
  796. *ssid_len = vdev_mlme->mgmt.generic.ssid_len;
  797. qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
  798. } else {
  799. *ssid_len = 0;
  800. return QDF_STATUS_E_FAILURE;
  801. }
  802. return QDF_STATUS_SUCCESS;
  803. }
  804. /**
  805. * wlan_vdev_mlme_set_nss() - set NSS
  806. * @vdev: VDEV object
  807. * @nss: nss configured by user
  808. *
  809. * API to set the Number of Spatial streams
  810. *
  811. * Return: void
  812. */
  813. static inline void wlan_vdev_mlme_set_nss(
  814. struct wlan_objmgr_vdev *vdev,
  815. uint8_t nss)
  816. {
  817. struct vdev_mlme_obj *vdev_mlme;
  818. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  819. if (!vdev_mlme)
  820. return;
  821. vdev_mlme->proto.generic.nss = nss;
  822. }
  823. /**
  824. * wlan_vdev_mlme_get_nss() - get NSS
  825. * @vdev: VDEV object
  826. *
  827. * API to get the Number of Spatial Streams
  828. *
  829. * Return:
  830. * @nss: nss value
  831. */
  832. static inline uint8_t wlan_vdev_mlme_get_nss(
  833. struct wlan_objmgr_vdev *vdev)
  834. {
  835. struct vdev_mlme_obj *vdev_mlme;
  836. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  837. if (!vdev_mlme)
  838. return 0;
  839. return vdev_mlme->proto.generic.nss;
  840. }
  841. /**
  842. * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
  843. * @vdev: VDEV object
  844. * @chainmask : chainmask either configured by user or max supported
  845. *
  846. * API to set the Tx chainmask
  847. *
  848. * Return: void
  849. */
  850. static inline void wlan_vdev_mlme_set_txchainmask(
  851. struct wlan_objmgr_vdev *vdev,
  852. uint8_t chainmask)
  853. {
  854. struct vdev_mlme_obj *vdev_mlme;
  855. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  856. if (!vdev_mlme)
  857. return;
  858. vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
  859. }
  860. /**
  861. * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
  862. * @vdev: VDEV object
  863. *
  864. * API to get the Tx chainmask
  865. *
  866. * Return:
  867. * @chainmask : Tx chainmask either configured by user or max supported
  868. */
  869. static inline uint8_t wlan_vdev_mlme_get_txchainmask(
  870. struct wlan_objmgr_vdev *vdev)
  871. {
  872. struct vdev_mlme_obj *vdev_mlme;
  873. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  874. if (!vdev_mlme)
  875. return 0;
  876. return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
  877. }
  878. /**
  879. * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
  880. * @vdev: VDEV object
  881. * @chainmask : Rx chainmask either configured by user or max supported
  882. *
  883. * API to set the Rx chainmask
  884. *
  885. * Return: void
  886. */
  887. static inline void wlan_vdev_mlme_set_rxchainmask(
  888. struct wlan_objmgr_vdev *vdev,
  889. uint8_t chainmask)
  890. {
  891. struct vdev_mlme_obj *vdev_mlme;
  892. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  893. if (!vdev_mlme)
  894. return;
  895. vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
  896. }
  897. /**
  898. * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
  899. * @vdev: VDEV object
  900. *
  901. * API to get the Rx chainmask
  902. *
  903. * Return:
  904. * @chainmask : Rx chainmask either configured by user or max supported
  905. */
  906. static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
  907. struct wlan_objmgr_vdev *vdev)
  908. {
  909. struct vdev_mlme_obj *vdev_mlme;
  910. /* This API is invoked with lock acquired, do not add log prints */
  911. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  912. if (!vdev_mlme)
  913. return 0;
  914. return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
  915. }
  916. /**
  917. * wlan_vdev_mlme_set_txpower() - set tx power
  918. * @vdev: VDEV object
  919. * @txpow: tx power either configured by used or max allowed
  920. *
  921. * API to set the tx power
  922. *
  923. * Return: void
  924. */
  925. static inline void wlan_vdev_mlme_set_txpower(
  926. struct wlan_objmgr_vdev *vdev,
  927. uint8_t txpow)
  928. {
  929. struct vdev_mlme_obj *vdev_mlme;
  930. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  931. if (!vdev_mlme)
  932. return;
  933. vdev_mlme->mgmt.generic.tx_power = txpow;
  934. }
  935. /**
  936. * wlan_vdev_mlme_get_txpower() - get tx power
  937. * @vdev: VDEV object
  938. *
  939. * API to get the tx power
  940. *
  941. * Return:
  942. * @txpow: tx power either configured by used or max allowed
  943. */
  944. static inline uint8_t wlan_vdev_mlme_get_txpower(
  945. struct wlan_objmgr_vdev *vdev)
  946. {
  947. struct vdev_mlme_obj *vdev_mlme;
  948. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  949. if (!vdev_mlme)
  950. return 0;
  951. return vdev_mlme->mgmt.generic.tx_power;
  952. }
  953. /**
  954. * wlan_vdev_mlme_set_maxrate() - set max rate
  955. * @vdev: VDEV object
  956. * @maxrate: configured by used or based on configured mode
  957. *
  958. * API to set the max rate the vdev supports
  959. *
  960. * Return: void
  961. */
  962. static inline void wlan_vdev_mlme_set_maxrate(
  963. struct wlan_objmgr_vdev *vdev,
  964. uint32_t maxrate)
  965. {
  966. struct vdev_mlme_obj *vdev_mlme;
  967. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  968. if (!vdev_mlme)
  969. return;
  970. vdev_mlme->mgmt.rate_info.max_rate = maxrate;
  971. }
  972. /**
  973. * wlan_vdev_mlme_get_maxrate() - get max rate
  974. * @vdev: VDEV object
  975. *
  976. * API to get the max rate the vdev supports
  977. *
  978. * Return:
  979. * @maxrate: configured by used or based on configured mode
  980. */
  981. static inline uint32_t wlan_vdev_mlme_get_maxrate(
  982. struct wlan_objmgr_vdev *vdev)
  983. {
  984. struct vdev_mlme_obj *vdev_mlme;
  985. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  986. if (!vdev_mlme)
  987. return 0;
  988. return vdev_mlme->mgmt.rate_info.max_rate;
  989. }
  990. /**
  991. * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
  992. * @vdev: VDEV object
  993. * @txmgmtrate: Tx Mgmt rate
  994. *
  995. * API to set Mgmt Tx rate
  996. *
  997. * Return: void
  998. */
  999. static inline void wlan_vdev_mlme_set_txmgmtrate(
  1000. struct wlan_objmgr_vdev *vdev,
  1001. uint32_t txmgmtrate)
  1002. {
  1003. struct vdev_mlme_obj *vdev_mlme;
  1004. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1005. if (!vdev_mlme)
  1006. return;
  1007. vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
  1008. }
  1009. /**
  1010. * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
  1011. * @vdev: VDEV object
  1012. *
  1013. * API to get Mgmt Tx rate
  1014. *
  1015. * Return:
  1016. * @txmgmtrate: Tx Mgmt rate
  1017. */
  1018. static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
  1019. struct wlan_objmgr_vdev *vdev)
  1020. {
  1021. struct vdev_mlme_obj *vdev_mlme;
  1022. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1023. if (!vdev_mlme)
  1024. return 0;
  1025. return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
  1026. }
  1027. /**
  1028. * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev
  1029. * @vdev: VDEV object
  1030. *
  1031. * API to check given vdev is a special vdev.
  1032. *
  1033. * Return: true if given vdev is special vdev, else false
  1034. */
  1035. static inline bool wlan_vdev_mlme_is_special_vdev(
  1036. struct wlan_objmgr_vdev *vdev)
  1037. {
  1038. struct vdev_mlme_obj *vdev_mlme;
  1039. if (!vdev)
  1040. return false;
  1041. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1042. if (!vdev_mlme)
  1043. return false;
  1044. return vdev_mlme->mgmt.generic.special_vdev_mode;
  1045. }
  1046. #ifdef WLAN_FEATURE_11AX
  1047. /**
  1048. * wlan_vdev_mlme_set_he_mcs_12_13_map() - set he mcs12/13 map
  1049. * @vdev: VDEV object
  1050. * @he_mcs_12_13_map: he mcs12/13 map from self&peer
  1051. *
  1052. * API to set he mcs 12/13 map
  1053. *
  1054. * Return: void
  1055. */
  1056. static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
  1057. struct wlan_objmgr_vdev *vdev,
  1058. uint16_t he_mcs_12_13_map)
  1059. {
  1060. struct vdev_mlme_obj *vdev_mlme;
  1061. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1062. if (!vdev_mlme)
  1063. return;
  1064. vdev_mlme->mgmt.sta.he_mcs_12_13_map = he_mcs_12_13_map;
  1065. }
  1066. /**
  1067. * wlan_vdev_mlme_get_he_mcs_12_13_map() - get he mcs12/13 map
  1068. * @vdev: VDEV object
  1069. *
  1070. * API to get he mcs12/13 support capability
  1071. *
  1072. * Return:
  1073. * @he_mcs_12_13_map: he mcs12/13 map
  1074. */
  1075. static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
  1076. struct wlan_objmgr_vdev *vdev)
  1077. {
  1078. struct vdev_mlme_obj *vdev_mlme;
  1079. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1080. if (!vdev_mlme)
  1081. return 0;
  1082. return vdev_mlme->mgmt.sta.he_mcs_12_13_map;
  1083. }
  1084. /**
  1085. * wlan_vdev_mlme_get_sr_ctrl() - get spatial reuse SR control
  1086. * @vdev: VDEV object
  1087. *
  1088. * API to retrieve the spatil reuse SR control from VDEV
  1089. *
  1090. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1091. *
  1092. * Return:
  1093. * @he_spr_sr_ctrl: SR control
  1094. */
  1095. static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
  1096. {
  1097. struct vdev_mlme_obj *vdev_mlme;
  1098. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1099. if (!vdev_mlme)
  1100. return 0;
  1101. return vdev_mlme->mgmt.generic.he_spr_sr_ctrl;
  1102. }
  1103. /**
  1104. * wlan_vdev_mlme_get_pd_offset() - get spatial reuse pd offset
  1105. * @vdev: VDEV object
  1106. *
  1107. * API to retrieve the spatil reuse pd offset from VDEV
  1108. *
  1109. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1110. *
  1111. * Return:
  1112. * @he_spr_non_srg_pd_max_offset: max pd offset
  1113. */
  1114. static inline uint8_t wlan_vdev_mlme_get_pd_offset(
  1115. struct wlan_objmgr_vdev *vdev)
  1116. {
  1117. struct vdev_mlme_obj *vdev_mlme;
  1118. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1119. if (!vdev_mlme)
  1120. return 0;
  1121. return vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset;
  1122. }
  1123. /**
  1124. * wlan_vdev_mlme_get_he_spr_enabled() - spatial reuse enabled or not
  1125. * @vdev: VDEV object
  1126. *
  1127. * API to check whether the spatil reuse enabled or not
  1128. *
  1129. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1130. *
  1131. * Return:
  1132. * @he_spr_enabled: Spatial reuse enabled or not
  1133. */
  1134. static inline bool wlan_vdev_mlme_get_he_spr_enabled(
  1135. struct wlan_objmgr_vdev *vdev)
  1136. {
  1137. struct vdev_mlme_obj *vdev_mlme;
  1138. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1139. if (!vdev_mlme)
  1140. return false;
  1141. return vdev_mlme->mgmt.generic.he_spr_enabled;
  1142. }
  1143. /**
  1144. * wlan_vdev_mlme_set_sr_ctrl() - set spatial reuse SR control
  1145. * @vdev: VDEV object
  1146. *
  1147. * API to set the spatil reuse SR control
  1148. *
  1149. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1150. *
  1151. * Return: void
  1152. */
  1153. static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
  1154. uint8_t sr_ctrl)
  1155. {
  1156. struct vdev_mlme_obj *vdev_mlme;
  1157. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1158. if (!vdev_mlme)
  1159. return;
  1160. vdev_mlme->mgmt.generic.he_spr_sr_ctrl = sr_ctrl;
  1161. }
  1162. /**
  1163. * wlan_vdev_mlme_set_pd_offset() - set spatial reuse pd max offset
  1164. * @vdev: VDEV object
  1165. *
  1166. * API to set the spatil reuse pd max offset
  1167. *
  1168. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1169. *
  1170. * Return: void
  1171. */
  1172. static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
  1173. uint8_t pd_max_offset)
  1174. {
  1175. struct vdev_mlme_obj *vdev_mlme;
  1176. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1177. if (!vdev_mlme)
  1178. return;
  1179. vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset = pd_max_offset;
  1180. }
  1181. /**
  1182. * wlan_vdev_mlme_set_he_spr_enabled() - set spatial reuse enabled
  1183. * @vdev: VDEV object
  1184. *
  1185. * API to set the spatil reuse enabled
  1186. *
  1187. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1188. *
  1189. * Return: void
  1190. */
  1191. static inline void wlan_vdev_mlme_set_he_spr_enabled(
  1192. struct wlan_objmgr_vdev *vdev,
  1193. bool enable_he_spr)
  1194. {
  1195. struct vdev_mlme_obj *vdev_mlme;
  1196. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1197. if (!vdev_mlme)
  1198. return;
  1199. vdev_mlme->mgmt.generic.he_spr_enabled = enable_he_spr;
  1200. }
  1201. #else
  1202. static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
  1203. struct wlan_objmgr_vdev *vdev,
  1204. uint16_t he_mcs_12_13_map)
  1205. {
  1206. }
  1207. static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
  1208. struct wlan_objmgr_vdev *vdev)
  1209. {
  1210. return 0;
  1211. }
  1212. static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
  1213. {
  1214. return 0;
  1215. }
  1216. static inline uint8_t wlan_vdev_mlme_get_pd_offset(
  1217. struct wlan_objmgr_vdev *vdev)
  1218. {
  1219. return 0;
  1220. }
  1221. static inline bool wlan_vdev_mlme_get_he_spr_enabled(
  1222. struct wlan_objmgr_vdev *vdev)
  1223. {
  1224. return 0;
  1225. }
  1226. static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
  1227. uint8_t sr_ctrl)
  1228. {
  1229. }
  1230. static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
  1231. uint8_t pd_max_offset)
  1232. {
  1233. }
  1234. static inline void wlan_vdev_mlme_set_he_spr_enabled(
  1235. struct wlan_objmgr_vdev *vdev,
  1236. bool enable_he_spr)
  1237. {
  1238. }
  1239. #endif
  1240. /**
  1241. * wlan_vdev_mlme_set_aid_mgr() - set aid mgr
  1242. * @vdev: VDEV object
  1243. * @aid_mgr: AID mgr
  1244. *
  1245. * API to set AID mgr in VDEV MLME cmpt object
  1246. *
  1247. * Return: void
  1248. */
  1249. static inline void wlan_vdev_mlme_set_aid_mgr(
  1250. struct wlan_objmgr_vdev *vdev,
  1251. struct wlan_vdev_aid_mgr *aid_mgr)
  1252. {
  1253. struct vdev_mlme_obj *vdev_mlme;
  1254. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1255. if (!vdev_mlme)
  1256. return;
  1257. vdev_mlme->mgmt.ap.aid_mgr = aid_mgr;
  1258. }
  1259. /**
  1260. * wlan_vdev_mlme_get_aid_mgr() - get aid mgr
  1261. * @vdev: VDEV object
  1262. *
  1263. * API to get AID mgr in VDEV MLME cmpt object
  1264. *
  1265. * Return: aid_mgr
  1266. */
  1267. static inline struct wlan_vdev_aid_mgr *wlan_vdev_mlme_get_aid_mgr(
  1268. struct wlan_objmgr_vdev *vdev)
  1269. {
  1270. struct vdev_mlme_obj *vdev_mlme;
  1271. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1272. if (!vdev_mlme)
  1273. return NULL;
  1274. return vdev_mlme->mgmt.ap.aid_mgr;
  1275. }
  1276. #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
  1277. /**
  1278. * vdev_mgr_cdp_vdev_attach() - MLME API to attach CDP vdev
  1279. * @mlme_obj: pointer to vdev_mlme_obj
  1280. *
  1281. * Return: QDF_STATUS - Success or Failure
  1282. */
  1283. QDF_STATUS vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj *mlme_obj);
  1284. /**
  1285. * vdev_mgr_cdp_vdev_detach() - MLME API to detach CDP vdev
  1286. * @mlme_obj: pointer to vdev_mlme_obj
  1287. *
  1288. * Return: QDF_STATUS - Success or Failure
  1289. */
  1290. QDF_STATUS vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj *mlme_obj);
  1291. #endif
  1292. #endif