wlan_vdev_mlme.h 38 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382
  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. * @.
  218. */
  219. struct vdev_mlme_mgmt_ap {
  220. };
  221. /**
  222. * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
  223. * @.
  224. */
  225. struct vdev_mlme_mgmt_sta {
  226. };
  227. /**
  228. * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
  229. * @bmiss_first_bcnt: bmiss first time
  230. * @bmiss_final_bcnt: bmiss final time
  231. * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
  232. * inactive
  233. * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
  234. * data-null
  235. * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
  236. */
  237. struct vdev_mlme_inactivity_params {
  238. uint32_t bmiss_first_bcnt;
  239. uint32_t bmiss_final_bcnt;
  240. uint32_t keepalive_min_idle_inactive_time_secs;
  241. uint32_t keepalive_max_idle_inactive_time_secs;
  242. uint32_t keepalive_max_unresponsive_time_secs;
  243. };
  244. /**
  245. * struct vdev_mlme_rate_info - vdev mlme rate information
  246. * @rate_flags: dynamic bandwidth info
  247. * @per_band_tx_mgmt_rate: per band Tx mgmt rate
  248. * @max_rate: max bandwidth rate
  249. * @tx_mgmt_rate: Tx Mgmt rate
  250. * @bcn_tx_rate: beacon Tx rate
  251. * @type: Type of ratemask configuration
  252. * @lower32: Lower 32 bits in the 1st 64-bit value
  253. * @higher32: Higher 32 bits in the 1st 64-bit value
  254. * @lower32_2: Lower 32 bits in the 2nd 64-bit value
  255. * @half_rate: Half rate
  256. * @quarter_rate: quarter rate
  257. */
  258. struct vdev_mlme_rate_info {
  259. uint32_t rate_flags;
  260. uint32_t per_band_tx_mgmt_rate;
  261. uint32_t max_rate;
  262. uint32_t tx_mgmt_rate;
  263. uint32_t bcn_tx_rate;
  264. uint8_t type;
  265. uint32_t lower32;
  266. uint32_t higher32;
  267. uint32_t lower32_2;
  268. bool half_rate;
  269. bool quarter_rate;
  270. };
  271. /**
  272. * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
  273. * @tx_chainmask: Tx chainmask
  274. * @rx_chainmask: Rx Chainmask
  275. * @num_rx_chain: Num of bits set in Rx chain
  276. * @num_tx_chain: Num of bits set in Tx chain
  277. */
  278. struct vdev_mlme_chainmask_info {
  279. uint8_t tx_chainmask;
  280. uint8_t rx_chainmask;
  281. uint8_t num_rx_chain;
  282. uint8_t num_tx_chain;
  283. };
  284. /**
  285. * struct vdev_mlme_powersave_info - vdev mlme powersave information
  286. * @packet_powersave: packet powersave
  287. * @max_li_of_moddtim: max mod dtim
  288. * @dyndtim_cnt: dynamic dtim count
  289. * @listen_interval: listen interval
  290. * @moddtim_cnt: mod dtim count
  291. */
  292. struct vdev_mlme_powersave_info {
  293. uint32_t packet_powersave;
  294. uint32_t max_li_of_moddtim;
  295. uint32_t dyndtim_cnt;
  296. uint32_t listen_interval;
  297. uint32_t moddtim_cnt;
  298. };
  299. /**
  300. * struct vdev_mlme_beacon_info - vdev mlme beacon information
  301. * @beacon_buffer: buffer allocated for beacon frame
  302. * @beacon_offsets: beacon IE's offsets
  303. */
  304. struct vdev_mlme_beacon_info {
  305. qdf_nbuf_t beacon_buffer;
  306. void *beacon_offsets;
  307. };
  308. /**
  309. * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
  310. * @profile_idx: profile index of the connected non-trans ap (mbssid case).
  311. * 0 means invalid.
  312. * @profile_num: the total profile numbers of non-trans aps (mbssid
  313. * case).
  314. * 0 means non-MBSS AP.
  315. * @mbssid-flags: MBSS IE flags indicating vdev type
  316. * @vdevid_trans: id of transmitting vdev for MBSS IE
  317. * @trans_bssid: bssid of transmitted AP (MBSS IE case)
  318. */
  319. struct vdev_mlme_mbss_11ax {
  320. uint32_t profile_idx;
  321. uint32_t profile_num;
  322. uint32_t mbssid_flags;
  323. uint8_t vdevid_trans;
  324. uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
  325. };
  326. /**
  327. * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
  328. * @generic: generic mgmt information
  329. * @ap: ap specific mgmt information
  330. * @sta: sta specific mgmt information
  331. * @inactivity_params: inactivity parameters
  332. * @rate_info: bandwidth rate information
  333. * @chainmask_info: Chainmask information
  334. * @powersave_info: Power save parameters
  335. * @beacon_info: beacon buffer information
  336. * @mbss_11ax: MBSS 11ax information
  337. */
  338. struct vdev_mlme_mgmt {
  339. struct vdev_mlme_mgmt_generic generic;
  340. struct vdev_mlme_mgmt_ap ap;
  341. struct vdev_mlme_mgmt_sta sta;
  342. struct vdev_mlme_inactivity_params inactivity_params;
  343. struct vdev_mlme_rate_info rate_info;
  344. struct vdev_mlme_chainmask_info chainmask_info;
  345. struct vdev_mlme_powersave_info powersave_info;
  346. struct vdev_mlme_beacon_info beacon_info;
  347. struct vdev_mlme_mbss_11ax mbss_11ax;
  348. };
  349. /**
  350. * enum beacon_update_op - Beacon update op type
  351. * @BEACON_INIT: Initialize beacon
  352. * @BEACON_REINIT: Re-initialize beacon
  353. * @BEACON_UPDATE: Update dynamic fields of beacon
  354. * @BEACON_CSA: Enable CSA IE
  355. * @BEACON_FREE: Beacon buffer free
  356. */
  357. enum beacon_update_op {
  358. BEACON_INIT,
  359. BEACON_REINIT,
  360. BEACON_UPDATE,
  361. BEACON_CSA,
  362. BEACON_FREE,
  363. };
  364. /**
  365. * enum vdev_cmd_type - Command type
  366. * @START_REQ: Start request
  367. * @RESTART_REQ: Restart request
  368. * @STOP_REQ: STOP request
  369. * @DELETE_REQ: DELETE request
  370. */
  371. enum vdev_cmd_type {
  372. START_REQ,
  373. RESTART_REQ,
  374. STOP_REQ,
  375. DELETE_REQ,
  376. };
  377. /**
  378. * enum vdev_start_resp_type - start respone type
  379. * @START_RESPONSE: Start response
  380. * @RESTART_RESPONSE: Restart response
  381. */
  382. enum vdev_start_resp_type {
  383. START_RESPONSE = 0,
  384. RESTART_RESPONSE,
  385. };
  386. /**
  387. * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  388. * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params
  389. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  390. * @mlme_vdev_start_send: callback to initiate actions of VDEV
  391. * MLME start operation
  392. * @mlme_vdev_restart_send: callback to initiate actions of VDEV
  393. * MLME restart operation
  394. * @mlme_vdev_stop_start_send: callback to block start/restart VDEV
  395. * request command
  396. * @mlme_vdev_start_continue: callback to initiate operations on
  397. * LMAC/FW start response
  398. * @mlme_vdev_up_send: callback to initiate actions of VDEV
  399. * MLME up operation
  400. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving
  401. * to UP state
  402. * @mlme_vdev_notify_roam_start: callback to initiate roaming
  403. * @mlme_vdev_update_beacon: callback to initiate beacon update
  404. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  405. * peers
  406. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  407. * @mlme_vdev_stop_send: callback to initiate actions of VDEV
  408. * MLME stop operation
  409. * @mlme_vdev_stop_continue: callback to initiate operations on
  410. * LMAC/FW stop response
  411. * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
  412. * peer delete completion
  413. * @mlme_vdev_down_send: callback to initiate actions of VDEV
  414. * MLME down operation
  415. * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start
  416. * start state exit
  417. * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required
  418. * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for
  419. * vdev mlme peer delete all response
  420. */
  421. struct vdev_mlme_ops {
  422. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  423. struct vdev_mlme_obj *vdev_mlme,
  424. uint16_t event_data_len, void *event_data);
  425. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  426. struct vdev_mlme_obj *vdev_mlme,
  427. uint16_t event_data_len, void *event_data);
  428. QDF_STATUS (*mlme_vdev_start_send)(
  429. struct vdev_mlme_obj *vdev_mlme,
  430. uint16_t event_data_len, void *event_data);
  431. QDF_STATUS (*mlme_vdev_restart_send)(
  432. struct vdev_mlme_obj *vdev_mlme,
  433. uint16_t event_data_len, void *event_data);
  434. QDF_STATUS (*mlme_vdev_stop_start_send)(
  435. struct vdev_mlme_obj *vdev_mlme,
  436. enum vdev_cmd_type type,
  437. uint16_t event_data_len, void *event_data);
  438. QDF_STATUS (*mlme_vdev_start_continue)(
  439. struct vdev_mlme_obj *vdev_mlme,
  440. uint16_t event_data_len, void *event_data);
  441. QDF_STATUS (*mlme_vdev_sta_conn_start)(
  442. struct vdev_mlme_obj *vdev_mlme,
  443. uint16_t event_data_len, void *event_data);
  444. QDF_STATUS (*mlme_vdev_start_req_failed)(
  445. struct vdev_mlme_obj *vdev_mlme,
  446. uint16_t event_data_len, void *event_data);
  447. QDF_STATUS (*mlme_vdev_up_send)(
  448. struct vdev_mlme_obj *vdev_mlme,
  449. uint16_t event_data_len, void *event_data);
  450. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  451. struct vdev_mlme_obj *vdev_mlme,
  452. uint16_t event_data_len, void *event_data);
  453. QDF_STATUS (*mlme_vdev_notify_roam_start)(
  454. struct vdev_mlme_obj *vdev_mlme,
  455. uint16_t event_data_len, void *event_data);
  456. QDF_STATUS (*mlme_vdev_update_beacon)(
  457. struct vdev_mlme_obj *vdev_mlme,
  458. enum beacon_update_op op,
  459. uint16_t event_data_len, void *event_data);
  460. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  461. struct vdev_mlme_obj *vdev_mlme,
  462. uint16_t event_data_len, void *event_data);
  463. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  464. struct vdev_mlme_obj *vdev_mlme,
  465. uint16_t event_data_len, void *event_data);
  466. QDF_STATUS (*mlme_vdev_stop_send)(
  467. struct vdev_mlme_obj *vdev_mlme,
  468. uint16_t event_data_len, void *event_data);
  469. QDF_STATUS (*mlme_vdev_stop_continue)(
  470. struct vdev_mlme_obj *vdev_mlme,
  471. uint16_t event_data_len, void *event_data);
  472. QDF_STATUS (*mlme_vdev_down_send)(
  473. struct vdev_mlme_obj *vdev_mlme,
  474. uint16_t event_data_len, void *event_data);
  475. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  476. struct vdev_mlme_obj *vdev_mlme,
  477. uint16_t event_data_len, void *event_data);
  478. QDF_STATUS (*mlme_vdev_ext_delete_rsp)(
  479. struct vdev_mlme_obj *vdev_mlme,
  480. struct vdev_delete_response *rsp);
  481. QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
  482. struct vdev_mlme_obj *vdev_mlme,
  483. struct vdev_stop_response *rsp);
  484. QDF_STATUS (*mlme_vdev_ext_start_rsp)(
  485. struct vdev_mlme_obj *vdev_mlme,
  486. struct vdev_start_response *rsp);
  487. QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
  488. struct vdev_mlme_obj *vdev_mlme);
  489. QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
  490. struct vdev_mlme_obj *vdev_mlme);
  491. QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
  492. struct vdev_mlme_obj *vdev_mlme,
  493. struct peer_delete_all_response *rsp);
  494. };
  495. #ifdef FEATURE_VDEV_RSP_WAKELOCK
  496. /**
  497. * struct wlan_vdev_wakelock - vdev wake lock sub structure
  498. * @start_wakelock: wakelock for vdev start
  499. * @stop_wakelock: wakelock for vdev stop
  500. * @delete_wakelock: wakelock for vdev delete
  501. * @wmi_cmd_rsp_runtime_lock: run time lock
  502. */
  503. struct vdev_mlme_wakelock {
  504. qdf_wake_lock_t start_wakelock;
  505. qdf_wake_lock_t stop_wakelock;
  506. qdf_wake_lock_t delete_wakelock;
  507. qdf_runtime_lock_t wmi_cmd_rsp_runtime_lock;
  508. };
  509. #endif
  510. /**
  511. * struct vdev_mlme_obj - VDEV MLME component object
  512. * @proto: VDEV MLME proto substructure
  513. * @mgmt: VDEV MLME mgmt substructure
  514. * @sm_lock: VDEV SM lock
  515. * @vdev_cmd_lock: VDEV MLME command atomicity
  516. * @sm_hdl: VDEV SM handle
  517. * @vdev: Pointer to vdev objmgr
  518. * @ops: VDEV MLME callback table
  519. * @ext_vdev_ptr: VDEV MLME legacy pointer
  520. * @vdev_rt: VDEV response timer
  521. * @vdev_wakelock: vdev wakelock sub structure
  522. */
  523. struct vdev_mlme_obj {
  524. struct vdev_mlme_proto proto;
  525. struct vdev_mlme_mgmt mgmt;
  526. #ifdef VDEV_SM_LOCK_SUPPORT
  527. qdf_spinlock_t sm_lock;
  528. qdf_mutex_t vdev_cmd_lock;
  529. #endif
  530. struct wlan_sm *sm_hdl;
  531. struct wlan_objmgr_vdev *vdev;
  532. struct vdev_mlme_ops *ops;
  533. mlme_vdev_ext_t *ext_vdev_ptr;
  534. struct vdev_response_timer vdev_rt;
  535. #ifdef FEATURE_VDEV_RSP_WAKELOCK
  536. struct vdev_mlme_wakelock vdev_wakelock;
  537. #endif
  538. };
  539. /**
  540. * mlme_vdev_validate_basic_params - Validate basic params
  541. * @vdev_mlme_obj: VDEV MLME comp object
  542. * @event_data_len: data size
  543. * @event_data: event data
  544. *
  545. * API validate MLME VDEV basic parameters
  546. *
  547. * Return: SUCCESS on successful validation
  548. * FAILURE, if any parameter is not initialized
  549. */
  550. static inline QDF_STATUS mlme_vdev_validate_basic_params(
  551. struct vdev_mlme_obj *vdev_mlme,
  552. uint16_t event_data_len, void *event_data)
  553. {
  554. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  555. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_validate_basic_params)
  556. ret = vdev_mlme->ops->mlme_vdev_validate_basic_params(
  557. vdev_mlme, event_data_len, event_data);
  558. return ret;
  559. }
  560. /**
  561. * mlme_vdev_reset_proto_params - Reset VDEV protocol params
  562. * @vdev_mlme_obj: VDEV MLME comp object
  563. * @event_data_len: data size
  564. * @event_data: event data
  565. *
  566. * API resets the protocol params fo vdev
  567. *
  568. * Return: SUCCESS on successful reset
  569. * FAILURE, if it fails due to any
  570. */
  571. static inline QDF_STATUS mlme_vdev_reset_proto_params(
  572. struct vdev_mlme_obj *vdev_mlme,
  573. uint16_t event_data_len, void *event_data)
  574. {
  575. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  576. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_reset_proto_params)
  577. ret = vdev_mlme->ops->mlme_vdev_reset_proto_params(
  578. vdev_mlme, event_data_len, event_data);
  579. return ret;
  580. }
  581. /**
  582. * mlme_vdev_start_send - Invokes VDEV start operation
  583. * @vdev_mlme_obj: VDEV MLME comp object
  584. * @event_data_len: data size
  585. * @event_data: event data
  586. *
  587. * API invokes VDEV start operation
  588. *
  589. * Return: SUCCESS on successful completion of start operation
  590. * FAILURE, if it fails due to any
  591. */
  592. static inline QDF_STATUS mlme_vdev_start_send(
  593. struct vdev_mlme_obj *vdev_mlme,
  594. uint16_t event_data_len, void *event_data)
  595. {
  596. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  597. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_send)
  598. ret = vdev_mlme->ops->mlme_vdev_start_send(
  599. vdev_mlme, event_data_len, event_data);
  600. return ret;
  601. }
  602. /**
  603. * mlme_vdev_restart_send - Invokes VDEV restart operation
  604. * @vdev_mlme_obj: VDEV MLME comp object
  605. * @event_data_len: data size
  606. * @event_data: event data
  607. *
  608. * API invokes VDEV restart operation
  609. *
  610. * Return: SUCCESS on successful completion of restart operation
  611. * FAILURE, if it fails due to any
  612. */
  613. static inline QDF_STATUS mlme_vdev_restart_send(
  614. struct vdev_mlme_obj *vdev_mlme,
  615. uint16_t event_data_len, void *event_data)
  616. {
  617. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  618. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_restart_send)
  619. ret = vdev_mlme->ops->mlme_vdev_restart_send(
  620. vdev_mlme, event_data_len, event_data);
  621. return ret;
  622. }
  623. /**
  624. * mlme_vdev_stop_start_send - Invoke block VDEV restart operation
  625. * @vdev_mlme_obj: VDEV MLME comp object
  626. * @restart: restart req/start req
  627. * @event_data_len: data size
  628. * @event_data: event data
  629. *
  630. * API invokes stops pending VDEV restart operation
  631. *
  632. * Return: SUCCESS alsways
  633. */
  634. static inline QDF_STATUS mlme_vdev_stop_start_send(
  635. struct vdev_mlme_obj *vdev_mlme,
  636. uint8_t restart,
  637. uint16_t event_data_len, void *event_data)
  638. {
  639. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  640. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_start_send)
  641. ret = vdev_mlme->ops->mlme_vdev_stop_start_send(
  642. vdev_mlme, restart, event_data_len, event_data);
  643. return ret;
  644. }
  645. /**
  646. * mlme_vdev_start_continue - VDEV start response handling
  647. * @vdev_mlme_obj: VDEV MLME comp object
  648. * @event_data_len: data size
  649. * @event_data: event data
  650. *
  651. * API invokes VDEV start response actions
  652. *
  653. * Return: SUCCESS on successful completion of start response operation
  654. * FAILURE, if it fails due to any
  655. */
  656. static inline QDF_STATUS mlme_vdev_start_continue(
  657. struct vdev_mlme_obj *vdev_mlme,
  658. uint16_t event_data_len, void *event_data)
  659. {
  660. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  661. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_continue)
  662. ret = vdev_mlme->ops->mlme_vdev_start_continue(
  663. vdev_mlme, event_data_len, event_data);
  664. return ret;
  665. }
  666. /**
  667. * mlme_vdev_start_req_failed - Invoke Station VDEV connection, if it pause
  668. * @vdev_mlme_obj: VDEV MLME comp object
  669. * @event_data_len: data size
  670. * @event_data: event data
  671. *
  672. * API invokes on START fail response
  673. *
  674. * Return: SUCCESS on successful invocation of callback
  675. * FAILURE, if it fails due to any
  676. */
  677. static inline QDF_STATUS mlme_vdev_start_req_failed(
  678. struct vdev_mlme_obj *vdev_mlme,
  679. uint16_t event_data_len, void *event_data)
  680. {
  681. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  682. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_start_req_failed)
  683. ret = vdev_mlme->ops->mlme_vdev_start_req_failed(
  684. vdev_mlme, event_data_len, event_data);
  685. return ret;
  686. }
  687. /**
  688. * mlme_vdev_sta_conn_start - Invoke Station VDEV connection, if it pause
  689. * @vdev_mlme_obj: VDEV MLME comp object
  690. * @event_data_len: data size
  691. * @event_data: event data
  692. *
  693. * API invokes connection SM to start station connection
  694. *
  695. * Return: SUCCESS on successful invocation of connection sm
  696. * FAILURE, if it fails due to any
  697. */
  698. static inline QDF_STATUS mlme_vdev_sta_conn_start(
  699. struct vdev_mlme_obj *vdev_mlme,
  700. uint16_t event_data_len, void *event_data)
  701. {
  702. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  703. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_sta_conn_start)
  704. ret = vdev_mlme->ops->mlme_vdev_sta_conn_start(
  705. vdev_mlme, event_data_len, event_data);
  706. return ret;
  707. }
  708. /**
  709. * mlme_vdev_up_send - VDEV up operation
  710. * @vdev_mlme_obj: VDEV MLME comp object
  711. * @event_data_len: data size
  712. * @event_data: event data
  713. *
  714. * API invokes VDEV up operations
  715. *
  716. * Return: SUCCESS on successful completion of up operation
  717. * FAILURE, if it fails due to any
  718. */
  719. static inline QDF_STATUS mlme_vdev_up_send(
  720. struct vdev_mlme_obj *vdev_mlme,
  721. uint16_t event_data_len, void *event_data)
  722. {
  723. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  724. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_up_send)
  725. ret = vdev_mlme->ops->mlme_vdev_up_send(
  726. vdev_mlme, event_data_len, event_data);
  727. return ret;
  728. }
  729. /**
  730. * mlme_vdev_notify_up_complete - VDEV up state transition notification
  731. * @vdev_mlme_obj: VDEV MLME comp object
  732. * @event_data_len: data size
  733. * @event_data: event data
  734. *
  735. * API notifies MLME on moving to UP state
  736. *
  737. * Return: SUCCESS on successful completion of up notification
  738. * FAILURE, if it fails due to any
  739. */
  740. static inline
  741. QDF_STATUS mlme_vdev_notify_up_complete(struct vdev_mlme_obj *vdev_mlme,
  742. uint16_t event_data_len,
  743. void *event_data)
  744. {
  745. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  746. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_notify_up_complete)
  747. ret = vdev_mlme->ops->mlme_vdev_notify_up_complete(
  748. vdev_mlme, event_data_len, event_data);
  749. return ret;
  750. }
  751. /**
  752. * mlme_vdev_notify_roam_start - VDEV Roaming notification
  753. * @vdev_mlme_obj: VDEV MLME comp object
  754. * @event_len: data size
  755. * @event_data: event data
  756. *
  757. * API notifies MLME on roaming
  758. *
  759. * Return: SUCCESS on successful completion of up notification
  760. * FAILURE, if it fails due to any
  761. */
  762. static inline
  763. QDF_STATUS mlme_vdev_notify_roam_start(struct vdev_mlme_obj *vdev_mlme,
  764. uint16_t event_len, void *event_data)
  765. {
  766. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  767. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_notify_roam_start)
  768. ret = vdev_mlme->ops->mlme_vdev_notify_roam_start(vdev_mlme,
  769. event_len,
  770. event_data);
  771. return ret;
  772. }
  773. /**
  774. * mlme_vdev_update_beacon - Updates beacon
  775. * @vdev_mlme_obj: VDEV MLME comp object
  776. * @op: beacon update type
  777. * @event_data_len: data size
  778. * @event_data: event data
  779. *
  780. * API updates/allocates/frees the beacon
  781. *
  782. * Return: SUCCESS on successful update of beacon
  783. * FAILURE, if it fails due to any
  784. */
  785. static inline
  786. QDF_STATUS mlme_vdev_update_beacon(struct vdev_mlme_obj *vdev_mlme,
  787. enum beacon_update_op op,
  788. uint16_t event_data_len, void *event_data)
  789. {
  790. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  791. if (vdev_mlme->ops && vdev_mlme->ops->mlme_vdev_update_beacon)
  792. ret = vdev_mlme->ops->mlme_vdev_update_beacon(vdev_mlme, op,
  793. event_data_len, event_data);
  794. return ret;
  795. }
  796. /**
  797. * mlme_vdev_disconnect_peers - Disconnect peers
  798. * @vdev_mlme_obj: VDEV MLME comp object
  799. * @event_data_len: data size
  800. * @event_data: event data
  801. *
  802. * API trigger stations disconnection with AP VDEV or AP disconnection with STA
  803. * VDEV
  804. *
  805. * Return: SUCCESS on successful invocation of station disconnection
  806. * FAILURE, if it fails due to any
  807. */
  808. static inline QDF_STATUS mlme_vdev_disconnect_peers(
  809. struct vdev_mlme_obj *vdev_mlme,
  810. uint16_t event_data_len, void *event_data)
  811. {
  812. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  813. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_disconnect_peers)
  814. ret = vdev_mlme->ops->mlme_vdev_disconnect_peers(
  815. vdev_mlme, event_data_len, event_data);
  816. return ret;
  817. }
  818. /**
  819. * mlme_vdev_dfs_cac_timer_stop - Stop CAC timer
  820. * @vdev_mlme_obj: VDEV MLME comp object
  821. * @event_data_len: data size
  822. * @event_data: event data
  823. *
  824. * API stops the CAC timer through DFS API
  825. *
  826. * Return: SUCCESS on successful CAC timer stop
  827. * FAILURE, if it fails due to any
  828. */
  829. static inline QDF_STATUS mlme_vdev_dfs_cac_timer_stop(
  830. struct vdev_mlme_obj *vdev_mlme,
  831. uint16_t event_data_len, void *event_data)
  832. {
  833. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  834. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop)
  835. ret = vdev_mlme->ops->mlme_vdev_dfs_cac_timer_stop(
  836. vdev_mlme, event_data_len, event_data);
  837. return ret;
  838. }
  839. /**
  840. * mlme_vdev_stop_send - Invokes VDEV stop operation
  841. * @vdev_mlme_obj: VDEV MLME comp object
  842. * @event_data_len: data size
  843. * @event_data: event data
  844. *
  845. * API invokes VDEV stop operation
  846. *
  847. * Return: SUCCESS on successful completion of stop operation
  848. * FAILURE, if it fails due to any
  849. */
  850. static inline QDF_STATUS mlme_vdev_stop_send(
  851. struct vdev_mlme_obj *vdev_mlme,
  852. uint16_t event_data_len, void *event_data)
  853. {
  854. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  855. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_send)
  856. ret = vdev_mlme->ops->mlme_vdev_stop_send(
  857. vdev_mlme, event_data_len, event_data);
  858. return ret;
  859. }
  860. /**
  861. * mlme_vdev_stop_continue - VDEV stop response handling
  862. * @vdev_mlme_obj: VDEV MLME comp object
  863. * @event_data_len: data size
  864. * @event_data: event data
  865. *
  866. * API invokes VDEV stop response actions
  867. *
  868. * Return: SUCCESS on successful completion of stop response operation
  869. * FAILURE, if it fails due to any
  870. */
  871. static inline QDF_STATUS mlme_vdev_stop_continue(
  872. struct vdev_mlme_obj *vdev_mlme,
  873. uint16_t event_data_len, void *event_data)
  874. {
  875. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  876. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_stop_continue)
  877. ret = vdev_mlme->ops->mlme_vdev_stop_continue(vdev_mlme,
  878. event_data_len,
  879. event_data);
  880. return ret;
  881. }
  882. /**
  883. * mlme_vdev_down_send - VDEV down operation
  884. * @vdev_mlme_obj: VDEV MLME comp object
  885. * @event_data_len: data size
  886. * @event_data: event data
  887. *
  888. * API invokes VDEV down operation
  889. *
  890. * Return: SUCCESS on successful completion of VDEV down operation
  891. * FAILURE, if it fails due to any
  892. */
  893. static inline QDF_STATUS mlme_vdev_down_send(
  894. struct vdev_mlme_obj *vdev_mlme,
  895. uint16_t event_data_len, void *event_data)
  896. {
  897. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  898. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_down_send)
  899. ret = vdev_mlme->ops->mlme_vdev_down_send(
  900. vdev_mlme, event_data_len, event_data);
  901. return ret;
  902. }
  903. /**
  904. * mlme_vdev_notify_down_complete - VDEV init state transition notification
  905. * @vdev_mlme_obj: VDEV MLME comp object
  906. * @event_data_len: data size
  907. * @event_data: event data
  908. *
  909. * API notifies MLME on moving to INIT state
  910. *
  911. * Return: SUCCESS on successful completion of down notification
  912. * FAILURE, if it fails due to any
  913. */
  914. static inline QDF_STATUS mlme_vdev_notify_down_complete(
  915. struct vdev_mlme_obj *vdev_mlme,
  916. uint16_t event_data_len, void *event_data)
  917. {
  918. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  919. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_notify_down_complete)
  920. ret = vdev_mlme->ops->mlme_vdev_notify_down_complete(
  921. vdev_mlme, event_data_len, event_data);
  922. return ret;
  923. }
  924. /**
  925. * mlme_vdev_notify_start_state_exit - VDEV SM start state exit notification
  926. * @vdev_mlme_obj: VDEV MLME comp object
  927. *
  928. * API notifies on start state exit
  929. *
  930. * Return: SUCCESS on successful completion of notification
  931. * FAILURE, if it fails due to any
  932. */
  933. static inline QDF_STATUS mlme_vdev_notify_start_state_exit(
  934. struct vdev_mlme_obj *vdev_mlme)
  935. {
  936. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  937. if ((vdev_mlme->ops) &&
  938. vdev_mlme->ops->mlme_vdev_notify_start_state_exit)
  939. ret = vdev_mlme->ops->mlme_vdev_notify_start_state_exit(
  940. vdev_mlme);
  941. return ret;
  942. }
  943. /**
  944. * mlme_vdev_is_newchan_no_cac - Checks new channel requires CAC
  945. * @vdev_mlme_obj: VDEV MLME comp object
  946. *
  947. * API checks whether Channel needs CAC period,
  948. * if yes, it moves to SUSPEND_RESTART to disconnect stations before
  949. * sending RESTART to FW, otherwise, it moves to RESTART_PROGRESS substate
  950. *
  951. * Return: SUCCESS to move to RESTART_PROGRESS substate
  952. * FAILURE, move to SUSPEND_RESTART state
  953. */
  954. static inline QDF_STATUS mlme_vdev_is_newchan_no_cac(
  955. struct vdev_mlme_obj *vdev_mlme)
  956. {
  957. QDF_STATUS ret = QDF_STATUS_SUCCESS;
  958. if ((vdev_mlme->ops) && vdev_mlme->ops->mlme_vdev_is_newchan_no_cac)
  959. ret = vdev_mlme->ops->mlme_vdev_is_newchan_no_cac(vdev_mlme);
  960. return ret;
  961. }
  962. /**
  963. * wlan_vdev_mlme_set_ssid() - set ssid
  964. * @vdev: VDEV object
  965. * @ssid: SSID (input)
  966. * @ssid_len: Length of SSID
  967. *
  968. * API to set the SSID of VDEV
  969. *
  970. * Caller need to acquire lock with wlan_vdev_obj_lock()
  971. *
  972. * Return: SUCCESS, if update is done
  973. * FAILURE, if ssid length is > max ssid len
  974. */
  975. static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
  976. struct wlan_objmgr_vdev *vdev,
  977. const uint8_t *ssid, uint8_t ssid_len)
  978. {
  979. struct vdev_mlme_obj *vdev_mlme;
  980. /* This API is invoked with lock acquired, do not add log prints */
  981. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  982. if (!vdev_mlme)
  983. return QDF_STATUS_E_FAILURE;
  984. if (ssid_len <= WLAN_SSID_MAX_LEN) {
  985. qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
  986. vdev_mlme->mgmt.generic.ssid_len = ssid_len;
  987. } else {
  988. vdev_mlme->mgmt.generic.ssid_len = 0;
  989. return QDF_STATUS_E_FAILURE;
  990. }
  991. return QDF_STATUS_SUCCESS;
  992. }
  993. /**
  994. * wlan_vdev_mlme_get_ssid() - get ssid
  995. * @vdev: VDEV object
  996. * @ssid: SSID
  997. * @ssid_len: Length of SSID
  998. *
  999. * API to get the SSID of VDEV, it updates the SSID and its length
  1000. * in @ssid, @ssid_len respectively
  1001. *
  1002. * Caller need to acquire lock with wlan_vdev_obj_lock()
  1003. *
  1004. * Return: SUCCESS, if update is done
  1005. * FAILURE, if ssid length is > max ssid len
  1006. */
  1007. static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
  1008. struct wlan_objmgr_vdev *vdev,
  1009. uint8_t *ssid, uint8_t *ssid_len)
  1010. {
  1011. struct vdev_mlme_obj *vdev_mlme;
  1012. /* This API is invoked with lock acquired, do not add log prints */
  1013. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1014. if (!vdev_mlme)
  1015. return QDF_STATUS_E_FAILURE;
  1016. if (vdev_mlme->mgmt.generic.ssid_len > 0) {
  1017. *ssid_len = vdev_mlme->mgmt.generic.ssid_len;
  1018. qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
  1019. } else {
  1020. *ssid_len = 0;
  1021. return QDF_STATUS_E_FAILURE;
  1022. }
  1023. return QDF_STATUS_SUCCESS;
  1024. }
  1025. /**
  1026. * wlan_vdev_mlme_set_nss() - set NSS
  1027. * @vdev: VDEV object
  1028. * @nss: nss configured by user
  1029. *
  1030. * API to set the Number of Spatial streams
  1031. *
  1032. * Return: void
  1033. */
  1034. static inline void wlan_vdev_mlme_set_nss(
  1035. struct wlan_objmgr_vdev *vdev,
  1036. uint8_t nss)
  1037. {
  1038. struct vdev_mlme_obj *vdev_mlme;
  1039. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1040. if (!vdev_mlme)
  1041. return;
  1042. vdev_mlme->proto.generic.nss = nss;
  1043. }
  1044. /**
  1045. * wlan_vdev_mlme_get_nss() - get NSS
  1046. * @vdev: VDEV object
  1047. *
  1048. * API to get the Number of Spatial Streams
  1049. *
  1050. * Return:
  1051. * @nss: nss value
  1052. */
  1053. static inline uint8_t wlan_vdev_mlme_get_nss(
  1054. struct wlan_objmgr_vdev *vdev)
  1055. {
  1056. struct vdev_mlme_obj *vdev_mlme;
  1057. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1058. if (!vdev_mlme)
  1059. return 0;
  1060. return vdev_mlme->proto.generic.nss;
  1061. }
  1062. /**
  1063. * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
  1064. * @vdev: VDEV object
  1065. * @chainmask : chainmask either configured by user or max supported
  1066. *
  1067. * API to set the Tx chainmask
  1068. *
  1069. * Return: void
  1070. */
  1071. static inline void wlan_vdev_mlme_set_txchainmask(
  1072. struct wlan_objmgr_vdev *vdev,
  1073. uint8_t chainmask)
  1074. {
  1075. struct vdev_mlme_obj *vdev_mlme;
  1076. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1077. if (!vdev_mlme)
  1078. return;
  1079. vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
  1080. }
  1081. /**
  1082. * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
  1083. * @vdev: VDEV object
  1084. *
  1085. * API to get the Tx chainmask
  1086. *
  1087. * Return:
  1088. * @chainmask : Tx chainmask either configured by user or max supported
  1089. */
  1090. static inline uint8_t wlan_vdev_mlme_get_txchainmask(
  1091. struct wlan_objmgr_vdev *vdev)
  1092. {
  1093. struct vdev_mlme_obj *vdev_mlme;
  1094. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1095. if (!vdev_mlme)
  1096. return 0;
  1097. return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
  1098. }
  1099. /**
  1100. * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
  1101. * @vdev: VDEV object
  1102. * @chainmask : Rx chainmask either configured by user or max supported
  1103. *
  1104. * API to set the Rx chainmask
  1105. *
  1106. * Return: void
  1107. */
  1108. static inline void wlan_vdev_mlme_set_rxchainmask(
  1109. struct wlan_objmgr_vdev *vdev,
  1110. uint8_t chainmask)
  1111. {
  1112. struct vdev_mlme_obj *vdev_mlme;
  1113. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1114. if (!vdev_mlme)
  1115. return;
  1116. vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
  1117. }
  1118. /**
  1119. * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
  1120. * @vdev: VDEV object
  1121. *
  1122. * API to get the Rx chainmask
  1123. *
  1124. * Return:
  1125. * @chainmask : Rx chainmask either configured by user or max supported
  1126. */
  1127. static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
  1128. struct wlan_objmgr_vdev *vdev)
  1129. {
  1130. struct vdev_mlme_obj *vdev_mlme;
  1131. /* This API is invoked with lock acquired, do not add log prints */
  1132. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1133. if (!vdev_mlme)
  1134. return 0;
  1135. return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
  1136. }
  1137. /**
  1138. * wlan_vdev_mlme_set_txpower() - set tx power
  1139. * @vdev: VDEV object
  1140. * @txpow: tx power either configured by used or max allowed
  1141. *
  1142. * API to set the tx power
  1143. *
  1144. * Return: void
  1145. */
  1146. static inline void wlan_vdev_mlme_set_txpower(
  1147. struct wlan_objmgr_vdev *vdev,
  1148. uint8_t txpow)
  1149. {
  1150. struct vdev_mlme_obj *vdev_mlme;
  1151. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1152. if (!vdev_mlme)
  1153. return;
  1154. vdev_mlme->mgmt.generic.tx_power = txpow;
  1155. }
  1156. /**
  1157. * wlan_vdev_mlme_get_txpower() - get tx power
  1158. * @vdev: VDEV object
  1159. *
  1160. * API to get the tx power
  1161. *
  1162. * Return:
  1163. * @txpow: tx power either configured by used or max allowed
  1164. */
  1165. static inline uint8_t wlan_vdev_mlme_get_txpower(
  1166. struct wlan_objmgr_vdev *vdev)
  1167. {
  1168. struct vdev_mlme_obj *vdev_mlme;
  1169. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1170. if (!vdev_mlme)
  1171. return 0;
  1172. return vdev_mlme->mgmt.generic.tx_power;
  1173. }
  1174. /**
  1175. * wlan_vdev_mlme_set_maxrate() - set max rate
  1176. * @vdev: VDEV object
  1177. * @maxrate: configured by used or based on configured mode
  1178. *
  1179. * API to set the max rate the vdev supports
  1180. *
  1181. * Return: void
  1182. */
  1183. static inline void wlan_vdev_mlme_set_maxrate(
  1184. struct wlan_objmgr_vdev *vdev,
  1185. uint32_t maxrate)
  1186. {
  1187. struct vdev_mlme_obj *vdev_mlme;
  1188. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1189. if (!vdev_mlme)
  1190. return;
  1191. vdev_mlme->mgmt.rate_info.max_rate = maxrate;
  1192. }
  1193. /**
  1194. * wlan_vdev_mlme_get_maxrate() - get max rate
  1195. * @vdev: VDEV object
  1196. *
  1197. * API to get the max rate the vdev supports
  1198. *
  1199. * Return:
  1200. * @maxrate: configured by used or based on configured mode
  1201. */
  1202. static inline uint32_t wlan_vdev_mlme_get_maxrate(
  1203. struct wlan_objmgr_vdev *vdev)
  1204. {
  1205. struct vdev_mlme_obj *vdev_mlme;
  1206. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1207. if (!vdev_mlme)
  1208. return 0;
  1209. return vdev_mlme->mgmt.rate_info.max_rate;
  1210. }
  1211. /**
  1212. * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
  1213. * @vdev: VDEV object
  1214. * @txmgmtrate: Tx Mgmt rate
  1215. *
  1216. * API to set Mgmt Tx rate
  1217. *
  1218. * Return: void
  1219. */
  1220. static inline void wlan_vdev_mlme_set_txmgmtrate(
  1221. struct wlan_objmgr_vdev *vdev,
  1222. uint32_t txmgmtrate)
  1223. {
  1224. struct vdev_mlme_obj *vdev_mlme;
  1225. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1226. if (!vdev_mlme)
  1227. return;
  1228. vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
  1229. }
  1230. /**
  1231. * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
  1232. * @vdev: VDEV object
  1233. *
  1234. * API to get Mgmt Tx rate
  1235. *
  1236. * Return:
  1237. * @txmgmtrate: Tx Mgmt rate
  1238. */
  1239. static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
  1240. struct wlan_objmgr_vdev *vdev)
  1241. {
  1242. struct vdev_mlme_obj *vdev_mlme;
  1243. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  1244. if (!vdev_mlme)
  1245. return 0;
  1246. return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
  1247. }
  1248. #endif