wlan_vdev_mlme.h 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385
  1. /*
  2. * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved.
  3. *
  4. * Permission to use, copy, modify, and/or distribute this software for any
  5. * purpose with or without fee is hereby granted, provided that the above
  6. * copyright notice and this permission notice appear in all copies.
  7. *
  8. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  9. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  10. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  11. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  12. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  13. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  14. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  15. */
  16. /**
  17. * DOC: Define VDEV MLME structure and APIs
  18. */
  19. #ifndef _WLAN_VDEV_MLME_H_
  20. #define _WLAN_VDEV_MLME_H_
  21. #include <wlan_vdev_mgr_tgt_if_rx_defs.h>
  22. #include <wlan_objmgr_vdev_obj.h>
  23. #include <wlan_vdev_mlme_api.h>
  24. #include <wlan_ext_mlme_obj_types.h>
  25. struct vdev_mlme_obj;
  26. /* Requestor ID for multiple vdev restart */
  27. #define MULTIPLE_VDEV_RESTART_REQ_ID 0x1234
  28. /* values for vdev_type */
  29. #define WLAN_VDEV_MLME_TYPE_AP 0x1
  30. #define WLAN_VDEV_MLME_TYPE_STA 0x2
  31. #define WLAN_VDEV_MLME_TYPE_IBSS 0x3
  32. #define WLAN_VDEV_MLME_TYPE_MONITOR 0x4
  33. #define WLAN_VDEV_MLME_TYPE_NAN 0x5
  34. #define WLAN_VDEV_MLME_TYPE_OCB 0x6
  35. #define WLAN_VDEV_MLME_TYPE_NDI 0x7
  36. /* values for vdev_subtype */
  37. #define WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE 0x1
  38. #define WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT 0x2
  39. #define WLAN_VDEV_MLME_SUBTYPE_P2P_GO 0x3
  40. #define WLAN_VDEV_MLME_SUBTYPE_PROXY_STA 0x4
  41. #define WLAN_VDEV_MLME_SUBTYPE_MESH 0x5
  42. #define WLAN_VDEV_MLME_SUBTYPE_MESH_11S 0x6
  43. #define WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR 0x7
  44. /* vdev control flags (per bits) */
  45. #define WLAN_VDEV_MLME_FLAGS_NON_MBSSID_AP 0x00000001
  46. #define WLAN_VDEV_MLME_FLAGS_TRANSMIT_AP 0x00000002
  47. #define WLAN_VDEV_MLME_FLAGS_NON_TRANSMIT_AP 0x00000004
  48. /**
  49. * struct vdev_mlme_proto_generic - generic mlme proto structure
  50. * sent in frames
  51. * @dtim_period: frequency of data transmissions per beacon 1-255
  52. * @slot_time: slot time
  53. * @protection_mode: rts cts protection mode
  54. * @beacon_interval: beacon interval
  55. * @ldpc: low density parity check value
  56. * @nss: number of spatial stream
  57. * @nss_2g: 2.4GHz number of spatial stream
  58. * @nss_5g: 5GHz number of spatial stream
  59. * @tsfadjust: adjusted timer sync value
  60. */
  61. struct vdev_mlme_proto_generic {
  62. uint8_t dtim_period;
  63. uint32_t slot_time;
  64. uint32_t protection_mode;
  65. uint16_t beacon_interval;
  66. uint8_t ldpc;
  67. uint8_t nss;
  68. uint8_t nss_2g;
  69. uint8_t nss_5g;
  70. uint64_t tsfadjust;
  71. };
  72. /**
  73. * struct vdev_mlme_proto_ap - ap specific mlme protocol
  74. * @.
  75. */
  76. struct vdev_mlme_proto_ap {
  77. };
  78. /**
  79. * struct vdev_mlme_proto_sta - sta specific mlme protocol
  80. * @assoc_id: association id of station
  81. * @uapsd_cfg: uapsd configuration
  82. */
  83. struct vdev_mlme_proto_sta {
  84. uint16_t assoc_id;
  85. uint16_t uapsd_cfg;
  86. };
  87. /**
  88. * struct vdev_mlme_proto_bss_color - bss color cfg
  89. * @flags: proposed for future use cases, currently not used.
  90. * @evt_type: bss color collision event.
  91. * @current_bss_color: current bss color.
  92. * @detection_period_ms: scan interval for both AP and STA mode.
  93. * @scan_period_ms: scan period for passive scan to detect collision.
  94. * @free_slot_expiry_time_ms: FW to notify host at timer expiry after
  95. * which Host will disable the bss color.
  96. */
  97. struct vdev_mlme_proto_bss_color {
  98. uint32_t flags;
  99. uint8_t evt_type;
  100. uint32_t current_bss_color;
  101. uint32_t detection_period_ms;
  102. uint32_t scan_period_ms;
  103. uint32_t free_slot_expiry_time_ms;
  104. };
  105. /**
  106. * struct vdev_mlme_vht_info - vdev VHT information
  107. * @caps: vht capabilities
  108. * @subfer: su beam former capability
  109. * @subfee: su beam formee capability
  110. * @mubfer: mu beam former capability
  111. * @mubfee: mu beam formee capability
  112. * @implicit_bf: Implicit BF support
  113. * @sounding_dimension: Beamformer number of sounding dimension
  114. * @bfee_sts_cap: beam formee STA capability
  115. * @allow_vht: vht capability status
  116. */
  117. struct vdev_mlme_vht_info {
  118. uint32_t caps;
  119. uint8_t subfer;
  120. uint8_t mubfer;
  121. uint8_t subfee;
  122. uint8_t mubfee;
  123. uint8_t implicit_bf;
  124. uint8_t sounding_dimension;
  125. uint8_t bfee_sts_cap;
  126. bool allow_vht;
  127. };
  128. /**
  129. * struct vdev_mlme_ht_info - vdev HT information
  130. * @ht_caps: HT capabilities
  131. * @allow_ht: HT capability status
  132. */
  133. struct vdev_mlme_ht_info {
  134. uint32_t ht_caps;
  135. bool allow_ht;
  136. };
  137. /**
  138. * struct vdev_mlme_he_ops_info - vdev mlme HEOPS information
  139. * @he_ops: he ops
  140. */
  141. struct vdev_mlme_he_ops_info {
  142. uint32_t he_ops;
  143. };
  144. /**
  145. * struct vdev_mlme_he_ops_info - vdev protocol structure holding information
  146. * that is used in frames
  147. * @generic: generic protocol information
  148. * @ap: ap specific protocol information
  149. * @sta: sta specific protocol information
  150. * @vht_info: vht information
  151. * @ht_info: ht capabilities information
  152. * @he_ops_info: he ops information
  153. * @bss_color: 11ax HE BSS Color information
  154. */
  155. struct vdev_mlme_proto {
  156. struct vdev_mlme_proto_generic generic;
  157. struct vdev_mlme_proto_ap ap;
  158. struct vdev_mlme_proto_sta sta;
  159. struct vdev_mlme_vht_info vht_info;
  160. struct vdev_mlme_ht_info ht_info;
  161. struct vdev_mlme_he_ops_info he_ops_info;
  162. struct vdev_mlme_proto_bss_color bss_color;
  163. };
  164. /**
  165. * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg
  166. * @rts_threshold: RTS threshold
  167. * @frag_threshold: Fragmentation threshold
  168. * @probe_delay: time in msec for delaying to send first probe request
  169. * @repeat_probe_time: probe request transmission time
  170. * @drop_unencry: drop unencrypted status
  171. * @ tx_pwrlimit: Tx power limit
  172. * @tx_power: Tx power
  173. * @minpower: Min power
  174. * @maxpower: Max power
  175. * @maxregpower: max regulatory power
  176. * @antennamax: max antenna
  177. * @reg_class_id: reg domain class id
  178. * @ampdu: ampdu limit
  179. * @amsdu: amsdu limit
  180. * @ssid: service set identifier
  181. * @ssid_len: ssid length
  182. * @type: vdev type
  183. * @sub_type: vdev subtype
  184. * @rx_decap_type: rx decap type
  185. * @tx_decap_type: tx decap type
  186. * @disable_hw_ack: disable ha ack flag
  187. * @bssid: bssid
  188. * @phy_mode: phy mode
  189. */
  190. struct vdev_mlme_mgmt_generic {
  191. uint32_t rts_threshold;
  192. uint32_t frag_threshold;
  193. uint32_t probe_delay;
  194. uint32_t repeat_probe_time;
  195. uint32_t drop_unencry;
  196. uint32_t tx_pwrlimit;
  197. uint8_t tx_power;
  198. uint8_t minpower;
  199. uint8_t maxpower;
  200. uint8_t maxregpower;
  201. uint8_t antennamax;
  202. uint8_t reg_class_id;
  203. uint8_t ampdu;
  204. uint8_t amsdu;
  205. char ssid[WLAN_SSID_MAX_LEN + 1];
  206. uint8_t ssid_len;
  207. uint8_t type;
  208. uint8_t subtype;
  209. uint8_t rx_decap_type;
  210. uint8_t tx_decap_type;
  211. bool disable_hw_ack;
  212. uint8_t bssid[QDF_MAC_ADDR_SIZE];
  213. uint32_t phy_mode;
  214. };
  215. /**
  216. * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
  217. * @hidden_ssid: flag to indicate whether it is hidden ssid
  218. * @cac_duration_ms: cac duration in millseconds
  219. */
  220. struct vdev_mlme_mgmt_ap {
  221. bool hidden_ssid;
  222. uint32_t cac_duration_ms;
  223. };
  224. /**
  225. * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
  226. * @.
  227. */
  228. struct vdev_mlme_mgmt_sta {
  229. };
  230. /**
  231. * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
  232. * @bmiss_first_bcnt: bmiss first time
  233. * @bmiss_final_bcnt: bmiss final time
  234. * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
  235. * inactive
  236. * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
  237. * data-null
  238. * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
  239. */
  240. struct vdev_mlme_inactivity_params {
  241. uint32_t bmiss_first_bcnt;
  242. uint32_t bmiss_final_bcnt;
  243. uint32_t keepalive_min_idle_inactive_time_secs;
  244. uint32_t keepalive_max_idle_inactive_time_secs;
  245. uint32_t keepalive_max_unresponsive_time_secs;
  246. };
  247. /**
  248. * struct vdev_mlme_rate_info - vdev mlme rate information
  249. * @rate_flags: dynamic bandwidth info
  250. * @per_band_tx_mgmt_rate: per band Tx mgmt rate
  251. * @max_rate: max bandwidth rate
  252. * @tx_mgmt_rate: Tx Mgmt rate
  253. * @bcn_tx_rate: beacon Tx rate
  254. * @type: Type of ratemask configuration
  255. * @lower32: Lower 32 bits in the 1st 64-bit value
  256. * @higher32: Higher 32 bits in the 1st 64-bit value
  257. * @lower32_2: Lower 32 bits in the 2nd 64-bit value
  258. * @half_rate: Half rate
  259. * @quarter_rate: quarter rate
  260. */
  261. struct vdev_mlme_rate_info {
  262. uint32_t rate_flags;
  263. uint32_t per_band_tx_mgmt_rate;
  264. uint32_t max_rate;
  265. uint32_t tx_mgmt_rate;
  266. uint32_t bcn_tx_rate;
  267. uint8_t type;
  268. uint32_t lower32;
  269. uint32_t higher32;
  270. uint32_t lower32_2;
  271. bool half_rate;
  272. bool quarter_rate;
  273. };
  274. /**
  275. * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
  276. * @tx_chainmask: Tx chainmask
  277. * @rx_chainmask: Rx Chainmask
  278. * @num_rx_chain: Num of bits set in Rx chain
  279. * @num_tx_chain: Num of bits set in Tx chain
  280. */
  281. struct vdev_mlme_chainmask_info {
  282. uint8_t tx_chainmask;
  283. uint8_t rx_chainmask;
  284. uint8_t num_rx_chain;
  285. uint8_t num_tx_chain;
  286. };
  287. /**
  288. * struct vdev_mlme_powersave_info - vdev mlme powersave information
  289. * @packet_powersave: packet powersave
  290. * @max_li_of_moddtim: max mod dtim
  291. * @dyndtim_cnt: dynamic dtim count
  292. * @listen_interval: listen interval
  293. * @moddtim_cnt: mod dtim count
  294. */
  295. struct vdev_mlme_powersave_info {
  296. uint32_t packet_powersave;
  297. uint32_t max_li_of_moddtim;
  298. uint32_t dyndtim_cnt;
  299. uint32_t listen_interval;
  300. uint32_t moddtim_cnt;
  301. };
  302. /**
  303. * struct vdev_mlme_beacon_info - vdev mlme beacon information
  304. * @beacon_buffer: buffer allocated for beacon frame
  305. * @beacon_offsets: beacon IE's offsets
  306. */
  307. struct vdev_mlme_beacon_info {
  308. qdf_nbuf_t beacon_buffer;
  309. void *beacon_offsets;
  310. };
  311. /**
  312. * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
  313. * @profile_idx: profile index of the connected non-trans ap (mbssid case).
  314. * 0 means invalid.
  315. * @profile_num: the total profile numbers of non-trans aps (mbssid
  316. * case).
  317. * 0 means non-MBSS AP.
  318. * @mbssid-flags: MBSS IE flags indicating vdev type
  319. * @vdevid_trans: id of transmitting vdev for MBSS IE
  320. * @trans_bssid: bssid of transmitted AP (MBSS IE case)
  321. */
  322. struct vdev_mlme_mbss_11ax {
  323. uint32_t profile_idx;
  324. uint32_t profile_num;
  325. uint32_t mbssid_flags;
  326. uint8_t vdevid_trans;
  327. uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
  328. };
  329. /**
  330. * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
  331. * @generic: generic mgmt information
  332. * @ap: ap specific mgmt information
  333. * @sta: sta specific mgmt information
  334. * @inactivity_params: inactivity parameters
  335. * @rate_info: bandwidth rate information
  336. * @chainmask_info: Chainmask information
  337. * @powersave_info: Power save parameters
  338. * @beacon_info: beacon buffer information
  339. * @mbss_11ax: MBSS 11ax information
  340. */
  341. struct vdev_mlme_mgmt {
  342. struct vdev_mlme_mgmt_generic generic;
  343. struct vdev_mlme_mgmt_ap ap;
  344. struct vdev_mlme_mgmt_sta sta;
  345. struct vdev_mlme_inactivity_params inactivity_params;
  346. struct vdev_mlme_rate_info rate_info;
  347. struct vdev_mlme_chainmask_info chainmask_info;
  348. struct vdev_mlme_powersave_info powersave_info;
  349. struct vdev_mlme_beacon_info beacon_info;
  350. struct vdev_mlme_mbss_11ax mbss_11ax;
  351. };
  352. /**
  353. * enum beacon_update_op - Beacon update op type
  354. * @BEACON_INIT: Initialize beacon
  355. * @BEACON_REINIT: Re-initialize beacon
  356. * @BEACON_UPDATE: Update dynamic fields of beacon
  357. * @BEACON_CSA: Enable CSA IE
  358. * @BEACON_FREE: Beacon buffer free
  359. */
  360. enum beacon_update_op {
  361. BEACON_INIT,
  362. BEACON_REINIT,
  363. BEACON_UPDATE,
  364. BEACON_CSA,
  365. BEACON_FREE,
  366. };
  367. /**
  368. * enum vdev_cmd_type - Command type
  369. * @START_REQ: Start request
  370. * @RESTART_REQ: Restart request
  371. * @STOP_REQ: STOP request
  372. * @DELETE_REQ: DELETE request
  373. */
  374. enum vdev_cmd_type {
  375. START_REQ,
  376. RESTART_REQ,
  377. STOP_REQ,
  378. DELETE_REQ,
  379. };
  380. /**
  381. * enum vdev_start_resp_type - start respone type
  382. * @START_RESPONSE: Start response
  383. * @RESTART_RESPONSE: Restart response
  384. */
  385. enum vdev_start_resp_type {
  386. START_RESPONSE = 0,
  387. RESTART_RESPONSE,
  388. };
  389. /**
  390. * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  391. * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params
  392. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  393. * @mlme_vdev_start_send: callback to initiate actions of VDEV
  394. * MLME start operation
  395. * @mlme_vdev_restart_send: callback to initiate actions of VDEV
  396. * MLME restart operation
  397. * @mlme_vdev_stop_start_send: callback to block start/restart VDEV
  398. * request command
  399. * @mlme_vdev_start_continue: callback to initiate operations on
  400. * LMAC/FW start response
  401. * @mlme_vdev_up_send: callback to initiate actions of VDEV
  402. * MLME up operation
  403. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving
  404. * to UP state
  405. * @mlme_vdev_notify_roam_start: callback to initiate roaming
  406. * @mlme_vdev_update_beacon: callback to initiate beacon update
  407. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  408. * peers
  409. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  410. * @mlme_vdev_stop_send: callback to initiate actions of VDEV
  411. * MLME stop operation
  412. * @mlme_vdev_stop_continue: callback to initiate operations on
  413. * LMAC/FW stop response
  414. * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
  415. * peer delete completion
  416. * @mlme_vdev_down_send: callback to initiate actions of VDEV
  417. * MLME down operation
  418. * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start
  419. * start state exit
  420. * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required
  421. * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for
  422. * vdev mlme peer delete all response
  423. */
  424. struct vdev_mlme_ops {
  425. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  426. struct vdev_mlme_obj *vdev_mlme,
  427. uint16_t event_data_len, void *event_data);
  428. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  429. struct vdev_mlme_obj *vdev_mlme,
  430. uint16_t event_data_len, void *event_data);
  431. QDF_STATUS (*mlme_vdev_start_send)(
  432. struct vdev_mlme_obj *vdev_mlme,
  433. uint16_t event_data_len, void *event_data);
  434. QDF_STATUS (*mlme_vdev_restart_send)(
  435. struct vdev_mlme_obj *vdev_mlme,
  436. uint16_t event_data_len, void *event_data);
  437. QDF_STATUS (*mlme_vdev_stop_start_send)(
  438. struct vdev_mlme_obj *vdev_mlme,
  439. enum vdev_cmd_type type,
  440. uint16_t event_data_len, void *event_data);
  441. QDF_STATUS (*mlme_vdev_start_continue)(
  442. struct vdev_mlme_obj *vdev_mlme,
  443. uint16_t event_data_len, void *event_data);
  444. QDF_STATUS (*mlme_vdev_sta_conn_start)(
  445. struct vdev_mlme_obj *vdev_mlme,
  446. uint16_t event_data_len, void *event_data);
  447. QDF_STATUS (*mlme_vdev_start_req_failed)(
  448. struct vdev_mlme_obj *vdev_mlme,
  449. uint16_t event_data_len, void *event_data);
  450. QDF_STATUS (*mlme_vdev_up_send)(
  451. struct vdev_mlme_obj *vdev_mlme,
  452. uint16_t event_data_len, void *event_data);
  453. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  454. struct vdev_mlme_obj *vdev_mlme,
  455. uint16_t event_data_len, void *event_data);
  456. QDF_STATUS (*mlme_vdev_notify_roam_start)(
  457. struct vdev_mlme_obj *vdev_mlme,
  458. uint16_t event_data_len, void *event_data);
  459. QDF_STATUS (*mlme_vdev_update_beacon)(
  460. struct vdev_mlme_obj *vdev_mlme,
  461. enum beacon_update_op op,
  462. uint16_t event_data_len, void *event_data);
  463. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  464. struct vdev_mlme_obj *vdev_mlme,
  465. uint16_t event_data_len, void *event_data);
  466. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  467. struct vdev_mlme_obj *vdev_mlme,
  468. uint16_t event_data_len, void *event_data);
  469. QDF_STATUS (*mlme_vdev_stop_send)(
  470. struct vdev_mlme_obj *vdev_mlme,
  471. uint16_t event_data_len, void *event_data);
  472. QDF_STATUS (*mlme_vdev_stop_continue)(
  473. struct vdev_mlme_obj *vdev_mlme,
  474. uint16_t event_data_len, void *event_data);
  475. QDF_STATUS (*mlme_vdev_down_send)(
  476. struct vdev_mlme_obj *vdev_mlme,
  477. uint16_t event_data_len, void *event_data);
  478. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  479. struct vdev_mlme_obj *vdev_mlme,
  480. uint16_t event_data_len, void *event_data);
  481. QDF_STATUS (*mlme_vdev_ext_delete_rsp)(
  482. struct vdev_mlme_obj *vdev_mlme,
  483. struct vdev_delete_response *rsp);
  484. QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
  485. struct vdev_mlme_obj *vdev_mlme,
  486. struct vdev_stop_response *rsp);
  487. QDF_STATUS (*mlme_vdev_ext_start_rsp)(
  488. struct vdev_mlme_obj *vdev_mlme,
  489. struct vdev_start_response *rsp);
  490. QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
  491. struct vdev_mlme_obj *vdev_mlme);
  492. QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
  493. struct vdev_mlme_obj *vdev_mlme);
  494. QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
  495. struct vdev_mlme_obj *vdev_mlme,
  496. struct peer_delete_all_response *rsp);
  497. };
  498. #ifdef FEATURE_VDEV_RSP_WAKELOCK
  499. /**
  500. * struct wlan_vdev_wakelock - vdev wake lock sub structure
  501. * @start_wakelock: wakelock for vdev start
  502. * @stop_wakelock: wakelock for vdev stop
  503. * @delete_wakelock: wakelock for vdev delete
  504. * @wmi_cmd_rsp_runtime_lock: run time lock
  505. */
  506. struct vdev_mlme_wakelock {
  507. qdf_wake_lock_t start_wakelock;
  508. qdf_wake_lock_t stop_wakelock;
  509. qdf_wake_lock_t delete_wakelock;
  510. qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
  511. };
  512. #endif
  513. /**
  514. * struct vdev_mlme_obj - VDEV MLME component object
  515. * @proto: VDEV MLME proto substructure
  516. * @mgmt: VDEV MLME mgmt substructure
  517. * @sm_lock: VDEV SM lock
  518. * @vdev_cmd_lock: VDEV MLME command atomicity
  519. * @sm_hdl: VDEV SM handle
  520. * @vdev: Pointer to vdev objmgr
  521. * @ops: VDEV MLME callback table
  522. * @ext_vdev_ptr: VDEV MLME legacy pointer
  523. * @vdev_rt: VDEV response timer
  524. * @vdev_wakelock: vdev wakelock sub structure
  525. */
  526. struct vdev_mlme_obj {
  527. struct vdev_mlme_proto proto;
  528. struct vdev_mlme_mgmt mgmt;
  529. #ifdef VDEV_SM_LOCK_SUPPORT
  530. qdf_spinlock_t sm_lock;
  531. qdf_mutex_t vdev_cmd_lock;
  532. #endif
  533. struct wlan_sm *sm_hdl;
  534. struct wlan_objmgr_vdev *vdev;
  535. struct vdev_mlme_ops *ops;
  536. mlme_vdev_ext_t *ext_vdev_ptr;
  537. struct vdev_response_timer vdev_rt;
  538. #ifdef FEATURE_VDEV_RSP_WAKELOCK
  539. struct vdev_mlme_wakelock vdev_wakelock;
  540. #endif
  541. };
  542. /**
  543. * mlme_vdev_validate_basic_params - Validate basic params
  544. * @vdev_mlme_obj: VDEV MLME comp object
  545. * @event_data_len: data size
  546. * @event_data: event data
  547. *
  548. * API validate MLME VDEV basic parameters
  549. *
  550. * Return: SUCCESS on successful validation
  551. * FAILURE, if any parameter is not initialized
  552. */
  553. static inline QDF_STATUS mlme_vdev_validate_basic_params(
  554. struct vdev_mlme_obj *vdev_mlme,
  555. uint16_t event_data_len, void *event_data)
  556. {
  557. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  558. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_validate_basic_params)
  559. ret = vdev_mlme->ops->mlme_vdev_validate_basic_params(
  560. vdev_mlme, event_data_len, event_data);
  561. return ret;
  562. }
  563. /**
  564. * mlme_vdev_reset_proto_params - Reset VDEV protocol params
  565. * @vdev_mlme_obj: VDEV MLME comp object
  566. * @event_data_len: data size
  567. * @event_data: event data
  568. *
  569. * API resets the protocol params fo vdev
  570. *
  571. * Return: SUCCESS on successful reset
  572. * FAILURE, if it fails due to any
  573. */
  574. static inline QDF_STATUS mlme_vdev_reset_proto_params(
  575. struct vdev_mlme_obj *vdev_mlme,
  576. uint16_t event_data_len, void *event_data)
  577. {
  578. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  579. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_reset_proto_params)
  580. ret = vdev_mlme->ops->mlme_vdev_reset_proto_params(
  581. vdev_mlme, event_data_len, event_data);
  582. return ret;
  583. }
  584. /**
  585. * mlme_vdev_start_send - Invokes VDEV start operation
  586. * @vdev_mlme_obj: VDEV MLME comp object
  587. * @event_data_len: data size
  588. * @event_data: event data
  589. *
  590. * API invokes VDEV start operation
  591. *
  592. * Return: SUCCESS on successful completion of start operation
  593. * FAILURE, if it fails due to any
  594. */
  595. static inline QDF_STATUS mlme_vdev_start_send(
  596. struct vdev_mlme_obj *vdev_mlme,
  597. uint16_t event_data_len, void *event_data)
  598. {
  599. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  600. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_send)
  601. ret = vdev_mlme->ops->mlme_vdev_start_send(
  602. vdev_mlme, event_data_len, event_data);
  603. return ret;
  604. }
  605. /**
  606. * mlme_vdev_restart_send - Invokes VDEV restart operation
  607. * @vdev_mlme_obj: VDEV MLME comp object
  608. * @event_data_len: data size
  609. * @event_data: event data
  610. *
  611. * API invokes VDEV restart operation
  612. *
  613. * Return: SUCCESS on successful completion of restart operation
  614. * FAILURE, if it fails due to any
  615. */
  616. static inline QDF_STATUS mlme_vdev_restart_send(
  617. struct vdev_mlme_obj *vdev_mlme,
  618. uint16_t event_data_len, void *event_data)
  619. {
  620. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  621. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_restart_send)
  622. ret = vdev_mlme->ops->mlme_vdev_restart_send(
  623. vdev_mlme, event_data_len, event_data);
  624. return ret;
  625. }
  626. /**
  627. * mlme_vdev_stop_start_send - Invoke block VDEV restart operation
  628. * @vdev_mlme_obj: VDEV MLME comp object
  629. * @restart: restart req/start req
  630. * @event_data_len: data size
  631. * @event_data: event data
  632. *
  633. * API invokes stops pending VDEV restart operation
  634. *
  635. * Return: SUCCESS alsways
  636. */
  637. static inline QDF_STATUS mlme_vdev_stop_start_send(
  638. struct vdev_mlme_obj *vdev_mlme,
  639. uint8_t restart,
  640. uint16_t event_data_len, void *event_data)
  641. {
  642. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  643. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_start_send)
  644. ret = vdev_mlme->ops->mlme_vdev_stop_start_send(
  645. vdev_mlme, restart, event_data_len, event_data);
  646. return ret;
  647. }
  648. /**
  649. * mlme_vdev_start_continue - VDEV start response handling
  650. * @vdev_mlme_obj: VDEV MLME comp object
  651. * @event_data_len: data size
  652. * @event_data: event data
  653. *
  654. * API invokes VDEV start response actions
  655. *
  656. * Return: SUCCESS on successful completion of start response operation
  657. * FAILURE, if it fails due to any
  658. */
  659. static inline QDF_STATUS mlme_vdev_start_continue(
  660. struct vdev_mlme_obj *vdev_mlme,
  661. uint16_t event_data_len, void *event_data)
  662. {
  663. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  664. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_continue)
  665. ret = vdev_mlme->ops->mlme_vdev_start_continue(
  666. vdev_mlme, event_data_len, event_data);
  667. return ret;
  668. }
  669. /**
  670. * mlme_vdev_start_req_failed - Invoke Station VDEV connection, if it pause
  671. * @vdev_mlme_obj: VDEV MLME comp object
  672. * @event_data_len: data size
  673. * @event_data: event data
  674. *
  675. * API invokes on START fail response
  676. *
  677. * Return: SUCCESS on successful invocation of callback
  678. * FAILURE, if it fails due to any
  679. */
  680. static inline QDF_STATUS mlme_vdev_start_req_failed(
  681. struct vdev_mlme_obj *vdev_mlme,
  682. uint16_t event_data_len, void *event_data)
  683. {
  684. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  685. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_req_failed)
  686. ret = vdev_mlme->ops->mlme_vdev_start_req_failed(
  687. vdev_mlme, event_data_len, event_data);
  688. return ret;
  689. }
  690. /**
  691. * mlme_vdev_sta_conn_start - Invoke Station VDEV connection, if it pause
  692. * @vdev_mlme_obj: VDEV MLME comp object
  693. * @event_data_len: data size
  694. * @event_data: event data
  695. *
  696. * API invokes connection SM to start station connection
  697. *
  698. * Return: SUCCESS on successful invocation of connection sm
  699. * FAILURE, if it fails due to any
  700. */
  701. static inline QDF_STATUS mlme_vdev_sta_conn_start(
  702. struct vdev_mlme_obj *vdev_mlme,
  703. uint16_t event_data_len, void *event_data)
  704. {
  705. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  706. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_sta_conn_start)
  707. ret = vdev_mlme->ops->mlme_vdev_sta_conn_start(
  708. vdev_mlme, event_data_len, event_data);
  709. return ret;
  710. }
  711. /**
  712. * mlme_vdev_up_send - VDEV up operation
  713. * @vdev_mlme_obj: VDEV MLME comp object
  714. * @event_data_len: data size
  715. * @event_data: event data
  716. *
  717. * API invokes VDEV up operations
  718. *
  719. * Return: SUCCESS on successful completion of up operation
  720. * FAILURE, if it fails due to any
  721. */
  722. static inline QDF_STATUS mlme_vdev_up_send(
  723. struct vdev_mlme_obj *vdev_mlme,
  724. uint16_t event_data_len, void *event_data)
  725. {
  726. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  727. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_up_send)
  728. ret = vdev_mlme->ops->mlme_vdev_up_send(
  729. vdev_mlme, event_data_len, event_data);
  730. return ret;
  731. }
  732. /**
  733. * mlme_vdev_notify_up_complete - VDEV up state transition notification
  734. * @vdev_mlme_obj: VDEV MLME comp object
  735. * @event_data_len: data size
  736. * @event_data: event data
  737. *
  738. * API notifies MLME on moving to UP state
  739. *
  740. * Return: SUCCESS on successful completion of up notification
  741. * FAILURE, if it fails due to any
  742. */
  743. static inline
  744. QDF_STATUS mlme_vdev_notify_up_complete(struct vdev_mlme_obj *vdev_mlme,
  745. uint16_t event_data_len,
  746. void *event_data)
  747. {
  748. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  749. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_notify_up_complete)
  750. ret = vdev_mlme->ops->mlme_vdev_notify_up_complete(
  751. vdev_mlme, event_data_len, event_data);
  752. return ret;
  753. }
  754. /**
  755. * mlme_vdev_notify_roam_start - VDEV Roaming notification
  756. * @vdev_mlme_obj: VDEV MLME comp object
  757. * @event_len: data size
  758. * @event_data: event data
  759. *
  760. * API notifies MLME on roaming
  761. *
  762. * Return: SUCCESS on successful completion of up notification
  763. * FAILURE, if it fails due to any
  764. */
  765. static inline
  766. QDF_STATUS mlme_vdev_notify_roam_start(struct vdev_mlme_obj *vdev_mlme,
  767. uint16_t event_len, void *event_data)
  768. {
  769. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  770. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_notify_roam_start)
  771. ret = vdev_mlme->ops->mlme_vdev_notify_roam_start(vdev_mlme,
  772. event_len,
  773. event_data);
  774. return ret;
  775. }
  776. /**
  777. * mlme_vdev_update_beacon - Updates beacon
  778. * @vdev_mlme_obj: VDEV MLME comp object
  779. * @op: beacon update type
  780. * @event_data_len: data size
  781. * @event_data: event data
  782. *
  783. * API updates/allocates/frees the beacon
  784. *
  785. * Return: SUCCESS on successful update of beacon
  786. * FAILURE, if it fails due to any
  787. */
  788. static inline
  789. QDF_STATUS mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme,
  790. enum beacon_update_op op,
  791. uint16_t event_data_len, void *event_data)
  792. {
  793. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  794. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_update_beacon)
  795. ret = vdev_mlme->ops->mlme_vdev_update_beacon(vdev_mlme, op,
  796. event_data_len, event_data);
  797. return ret;
  798. }
  799. /**
  800. * mlme_vdev_disconnect_peers - Disconnect peers
  801. * @vdev_mlme_obj: VDEV MLME comp object
  802. * @event_data_len: data size
  803. * @event_data: event data
  804. *
  805. * API trigger stations disconnection with AP VDEV or AP disconnection with STA
  806. * VDEV
  807. *
  808. * Return: SUCCESS on successful invocation of station disconnection
  809. * FAILURE, if it fails due to any
  810. */
  811. static inline QDF_STATUS mlme_vdev_disconnect_peers(
  812. struct vdev_mlme_obj *vdev_mlme,
  813. uint16_t event_data_len, void *event_data)
  814. {
  815. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  816. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_disconnect_peers)
  817. ret = vdev_mlme->ops->mlme_vdev_disconnect_peers(
  818. vdev_mlme, event_data_len, event_data);
  819. return ret;
  820. }
  821. /**
  822. * mlme_vdev_dfs_cac_timer_stop - Stop CAC timer
  823. * @vdev_mlme_obj: VDEV MLME comp object
  824. * @event_data_len: data size
  825. * @event_data: event data
  826. *
  827. * API stops the CAC timer through DFS API
  828. *
  829. * Return: SUCCESS on successful CAC timer stop
  830. * FAILURE, if it fails due to any
  831. */
  832. static inline QDF_STATUS mlme_vdev_dfs_cac_timer_stop(
  833. struct vdev_mlme_obj *vdev_mlme,
  834. uint16_t event_data_len, void *event_data)
  835. {
  836. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  837. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop)
  838. ret = vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop(
  839. vdev_mlme, event_data_len, event_data);
  840. return ret;
  841. }
  842. /**
  843. * mlme_vdev_stop_send - Invokes VDEV stop operation
  844. * @vdev_mlme_obj: VDEV MLME comp object
  845. * @event_data_len: data size
  846. * @event_data: event data
  847. *
  848. * API invokes VDEV stop operation
  849. *
  850. * Return: SUCCESS on successful completion of stop operation
  851. * FAILURE, if it fails due to any
  852. */
  853. static inline QDF_STATUS mlme_vdev_stop_send(
  854. struct vdev_mlme_obj *vdev_mlme,
  855. uint16_t event_data_len, void *event_data)
  856. {
  857. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  858. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_send)
  859. ret = vdev_mlme->ops->mlme_vdev_stop_send(
  860. vdev_mlme, event_data_len, event_data);
  861. return ret;
  862. }
  863. /**
  864. * mlme_vdev_stop_continue - VDEV stop response handling
  865. * @vdev_mlme_obj: VDEV MLME comp object
  866. * @event_data_len: data size
  867. * @event_data: event data
  868. *
  869. * API invokes VDEV stop response actions
  870. *
  871. * Return: SUCCESS on successful completion of stop response operation
  872. * FAILURE, if it fails due to any
  873. */
  874. static inline QDF_STATUS mlme_vdev_stop_continue(
  875. struct vdev_mlme_obj *vdev_mlme,
  876. uint16_t event_data_len, void *event_data)
  877. {
  878. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  879. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_continue)
  880. ret = vdev_mlme->ops->mlme_vdev_stop_continue(vdev_mlme,
  881. event_data_len,
  882. event_data);
  883. return ret;
  884. }
  885. /**
  886. * mlme_vdev_down_send - VDEV down operation
  887. * @vdev_mlme_obj: VDEV MLME comp object
  888. * @event_data_len: data size
  889. * @event_data: event data
  890. *
  891. * API invokes VDEV down operation
  892. *
  893. * Return: SUCCESS on successful completion of VDEV down operation
  894. * FAILURE, if it fails due to any
  895. */
  896. static inline QDF_STATUS mlme_vdev_down_send(
  897. struct vdev_mlme_obj *vdev_mlme,
  898. uint16_t event_data_len, void *event_data)
  899. {
  900. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  901. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_down_send)
  902. ret = vdev_mlme->ops->mlme_vdev_down_send(
  903. vdev_mlme, event_data_len, event_data);
  904. return ret;
  905. }
  906. /**
  907. * mlme_vdev_notify_down_complete - VDEV init state transition notification
  908. * @vdev_mlme_obj: VDEV MLME comp object
  909. * @event_data_len: data size
  910. * @event_data: event data
  911. *
  912. * API notifies MLME on moving to INIT state
  913. *
  914. * Return: SUCCESS on successful completion of down notification
  915. * FAILURE, if it fails due to any
  916. */
  917. static inline QDF_STATUS mlme_vdev_notify_down_complete(
  918. struct vdev_mlme_obj *vdev_mlme,
  919. uint16_t event_data_len, void *event_data)
  920. {
  921. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  922. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_notify_down_complete)
  923. ret = vdev_mlme->ops->mlme_vdev_notify_down_complete(
  924. vdev_mlme, event_data_len, event_data);
  925. return ret;
  926. }
  927. /**
  928. * mlme_vdev_notify_start_state_exit - VDEV SM start state exit notification
  929. * @vdev_mlme_obj: VDEV MLME comp object
  930. *
  931. * API notifies on start state exit
  932. *
  933. * Return: SUCCESS on successful completion of notification
  934. * FAILURE, if it fails due to any
  935. */
  936. static inline QDF_STATUS mlme_vdev_notify_start_state_exit(
  937. struct vdev_mlme_obj *vdev_mlme)
  938. {
  939. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  940. if ((vdev_mlme->ops) &&
  941. vdev_mlme->ops->mlme_vdev_notify_start_state_exit)
  942. ret = vdev_mlme->ops->mlme_vdev_notify_start_state_exit(
  943. vdev_mlme);
  944. return ret;
  945. }
  946. /**
  947. * mlme_vdev_is_newchan_no_cac - Checks new channel requires CAC
  948. * @vdev_mlme_obj: VDEV MLME comp object
  949. *
  950. * API checks whether Channel needs CAC period,
  951. * if yes, it moves to SUSPEND_RESTART to disconnect stations before
  952. * sending RESTART to FW, otherwise, it moves to RESTART_PROGRESS substate
  953. *
  954. * Return: SUCCESS to move to RESTART_PROGRESS substate
  955. * FAILURE, move to SUSPEND_RESTART state
  956. */
  957. static inline QDF_STATUS mlme_vdev_is_newchan_no_cac(
  958. struct vdev_mlme_obj *vdev_mlme)
  959. {
  960. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  961. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_is_newchan_no_cac)
  962. ret = vdev_mlme->ops->mlme_vdev_is_newchan_no_cac(vdev_mlme);
  963. return ret;
  964. }
  965. /**
  966. * wlan_vdev_mlme_set_ssid() - set ssid
  967. * @vdev: VDEV object
  968. * @ssid: SSID (input)
  969. * @ssid_len: Length of SSID
  970. *
  971. * API to set the SSID of VDEV
  972. *
  973. * Caller need to acquire lock with wlan_vdev_obj_lock()
  974. *
  975. * Return: SUCCESS, if update is done
  976. * FAILURE, if ssid length is > max ssid len
  977. */
  978. static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
  979. struct wlan_objmgr_vdev *vdev,
  980. const uint8_t *ssid, uint8_t ssid_len)
  981. {
  982. struct vdev_mlme_obj *vdev_mlme;
  983. /* This API is invoked with lock acquired, do not add log prints */
  984. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  985. if (!vdev_mlme)
  986. return QDF_STATUS_E_FAILURE;
  987. if (ssid_len <= WLAN_SSID_MAX_LEN) {
  988. qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
  989. vdev_mlme->mgmt.generic.ssid_len = ssid_len;
  990. } else {
  991. vdev_mlme->mgmt.generic.ssid_len = 0;
  992. return QDF_STATUS_E_FAILURE;
  993. }
  994. return QDF_STATUS_SUCCESS;
  995. }
  996. /**
  997. * wlan_vdev_mlme_get_ssid() - get ssid
  998. * @vdev: VDEV object
  999. * @ssid: SSID
  1000. * @ssid_len: Length of SSID
  1001. *
  1002. * API to get the SSID of VDEV, it updates the SSID and its length
  1003. * in @ssid, @ssid_len respectively
  1004. *
  1005. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1006. *
  1007. * Return: SUCCESS, if update is done
  1008. * FAILURE, if ssid length is > max ssid len
  1009. */
  1010. static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
  1011. struct wlan_objmgr_vdev *vdev,
  1012. uint8_t *ssid, uint8_t *ssid_len)
  1013. {
  1014. struct vdev_mlme_obj *vdev_mlme;
  1015. /* This API is invoked with lock acquired, do not add log prints */
  1016. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1017. if (!vdev_mlme)
  1018. return QDF_STATUS_E_FAILURE;
  1019. if (vdev_mlme->mgmt.generic.ssid_len > 0) {
  1020. *ssid_len = vdev_mlme->mgmt.generic.ssid_len;
  1021. qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
  1022. } else {
  1023. *ssid_len = 0;
  1024. return QDF_STATUS_E_FAILURE;
  1025. }
  1026. return QDF_STATUS_SUCCESS;
  1027. }
  1028. /**
  1029. * wlan_vdev_mlme_set_nss() - set NSS
  1030. * @vdev: VDEV object
  1031. * @nss: nss configured by user
  1032. *
  1033. * API to set the Number of Spatial streams
  1034. *
  1035. * Return: void
  1036. */
  1037. static inline void wlan_vdev_mlme_set_nss(
  1038. struct wlan_objmgr_vdev *vdev,
  1039. uint8_t nss)
  1040. {
  1041. struct vdev_mlme_obj *vdev_mlme;
  1042. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1043. if (!vdev_mlme)
  1044. return;
  1045. vdev_mlme->proto.generic.nss = nss;
  1046. }
  1047. /**
  1048. * wlan_vdev_mlme_get_nss() - get NSS
  1049. * @vdev: VDEV object
  1050. *
  1051. * API to get the Number of Spatial Streams
  1052. *
  1053. * Return:
  1054. * @nss: nss value
  1055. */
  1056. static inline uint8_t wlan_vdev_mlme_get_nss(
  1057. struct wlan_objmgr_vdev *vdev)
  1058. {
  1059. struct vdev_mlme_obj *vdev_mlme;
  1060. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1061. if (!vdev_mlme)
  1062. return 0;
  1063. return vdev_mlme->proto.generic.nss;
  1064. }
  1065. /**
  1066. * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
  1067. * @vdev: VDEV object
  1068. * @chainmask : chainmask either configured by user or max supported
  1069. *
  1070. * API to set the Tx chainmask
  1071. *
  1072. * Return: void
  1073. */
  1074. static inline void wlan_vdev_mlme_set_txchainmask(
  1075. struct wlan_objmgr_vdev *vdev,
  1076. uint8_t chainmask)
  1077. {
  1078. struct vdev_mlme_obj *vdev_mlme;
  1079. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1080. if (!vdev_mlme)
  1081. return;
  1082. vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
  1083. }
  1084. /**
  1085. * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
  1086. * @vdev: VDEV object
  1087. *
  1088. * API to get the Tx chainmask
  1089. *
  1090. * Return:
  1091. * @chainmask : Tx chainmask either configured by user or max supported
  1092. */
  1093. static inline uint8_t wlan_vdev_mlme_get_txchainmask(
  1094. struct wlan_objmgr_vdev *vdev)
  1095. {
  1096. struct vdev_mlme_obj *vdev_mlme;
  1097. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1098. if (!vdev_mlme)
  1099. return 0;
  1100. return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
  1101. }
  1102. /**
  1103. * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
  1104. * @vdev: VDEV object
  1105. * @chainmask : Rx chainmask either configured by user or max supported
  1106. *
  1107. * API to set the Rx chainmask
  1108. *
  1109. * Return: void
  1110. */
  1111. static inline void wlan_vdev_mlme_set_rxchainmask(
  1112. struct wlan_objmgr_vdev *vdev,
  1113. uint8_t chainmask)
  1114. {
  1115. struct vdev_mlme_obj *vdev_mlme;
  1116. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1117. if (!vdev_mlme)
  1118. return;
  1119. vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
  1120. }
  1121. /**
  1122. * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
  1123. * @vdev: VDEV object
  1124. *
  1125. * API to get the Rx chainmask
  1126. *
  1127. * Return:
  1128. * @chainmask : Rx chainmask either configured by user or max supported
  1129. */
  1130. static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
  1131. struct wlan_objmgr_vdev *vdev)
  1132. {
  1133. struct vdev_mlme_obj *vdev_mlme;
  1134. /* This API is invoked with lock acquired, do not add log prints */
  1135. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1136. if (!vdev_mlme)
  1137. return 0;
  1138. return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
  1139. }
  1140. /**
  1141. * wlan_vdev_mlme_set_txpower() - set tx power
  1142. * @vdev: VDEV object
  1143. * @txpow: tx power either configured by used or max allowed
  1144. *
  1145. * API to set the tx power
  1146. *
  1147. * Return: void
  1148. */
  1149. static inline void wlan_vdev_mlme_set_txpower(
  1150. struct wlan_objmgr_vdev *vdev,
  1151. uint8_t txpow)
  1152. {
  1153. struct vdev_mlme_obj *vdev_mlme;
  1154. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1155. if (!vdev_mlme)
  1156. return;
  1157. vdev_mlme->mgmt.generic.tx_power = txpow;
  1158. }
  1159. /**
  1160. * wlan_vdev_mlme_get_txpower() - get tx power
  1161. * @vdev: VDEV object
  1162. *
  1163. * API to get the tx power
  1164. *
  1165. * Return:
  1166. * @txpow: tx power either configured by used or max allowed
  1167. */
  1168. static inline uint8_t wlan_vdev_mlme_get_txpower(
  1169. struct wlan_objmgr_vdev *vdev)
  1170. {
  1171. struct vdev_mlme_obj *vdev_mlme;
  1172. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1173. if (!vdev_mlme)
  1174. return 0;
  1175. return vdev_mlme->mgmt.generic.tx_power;
  1176. }
  1177. /**
  1178. * wlan_vdev_mlme_set_maxrate() - set max rate
  1179. * @vdev: VDEV object
  1180. * @maxrate: configured by used or based on configured mode
  1181. *
  1182. * API to set the max rate the vdev supports
  1183. *
  1184. * Return: void
  1185. */
  1186. static inline void wlan_vdev_mlme_set_maxrate(
  1187. struct wlan_objmgr_vdev *vdev,
  1188. uint32_t maxrate)
  1189. {
  1190. struct vdev_mlme_obj *vdev_mlme;
  1191. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1192. if (!vdev_mlme)
  1193. return;
  1194. vdev_mlme->mgmt.rate_info.max_rate = maxrate;
  1195. }
  1196. /**
  1197. * wlan_vdev_mlme_get_maxrate() - get max rate
  1198. * @vdev: VDEV object
  1199. *
  1200. * API to get the max rate the vdev supports
  1201. *
  1202. * Return:
  1203. * @maxrate: configured by used or based on configured mode
  1204. */
  1205. static inline uint32_t wlan_vdev_mlme_get_maxrate(
  1206. struct wlan_objmgr_vdev *vdev)
  1207. {
  1208. struct vdev_mlme_obj *vdev_mlme;
  1209. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1210. if (!vdev_mlme)
  1211. return 0;
  1212. return vdev_mlme->mgmt.rate_info.max_rate;
  1213. }
  1214. /**
  1215. * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
  1216. * @vdev: VDEV object
  1217. * @txmgmtrate: Tx Mgmt rate
  1218. *
  1219. * API to set Mgmt Tx rate
  1220. *
  1221. * Return: void
  1222. */
  1223. static inline void wlan_vdev_mlme_set_txmgmtrate(
  1224. struct wlan_objmgr_vdev *vdev,
  1225. uint32_t txmgmtrate)
  1226. {
  1227. struct vdev_mlme_obj *vdev_mlme;
  1228. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1229. if (!vdev_mlme)
  1230. return;
  1231. vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
  1232. }
  1233. /**
  1234. * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
  1235. * @vdev: VDEV object
  1236. *
  1237. * API to get Mgmt Tx rate
  1238. *
  1239. * Return:
  1240. * @txmgmtrate: Tx Mgmt rate
  1241. */
  1242. static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
  1243. struct wlan_objmgr_vdev *vdev)
  1244. {
  1245. struct vdev_mlme_obj *vdev_mlme;
  1246. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1247. if (!vdev_mlme)
  1248. return 0;
  1249. return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
  1250. }
  1251. #endif