wlan_vdev_mlme.h 38 KB

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