wlan_vdev_mlme.h 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885
  1. /*
  2. * Copyright (c) 2018-2020 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_UNKNOWN 0x0
  30. #define WLAN_VDEV_MLME_TYPE_AP 0x1
  31. #define WLAN_VDEV_MLME_TYPE_STA 0x2
  32. #define WLAN_VDEV_MLME_TYPE_IBSS 0x3
  33. #define WLAN_VDEV_MLME_TYPE_MONITOR 0x4
  34. #define WLAN_VDEV_MLME_TYPE_NAN 0x5
  35. #define WLAN_VDEV_MLME_TYPE_OCB 0x6
  36. #define WLAN_VDEV_MLME_TYPE_NDI 0x7
  37. /* values for vdev_subtype */
  38. #define WLAN_VDEV_MLME_SUBTYPE_UNKNOWN 0x0
  39. #define WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE 0x1
  40. #define WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT 0x2
  41. #define WLAN_VDEV_MLME_SUBTYPE_P2P_GO 0x3
  42. #define WLAN_VDEV_MLME_SUBTYPE_PROXY_STA 0x4
  43. #define WLAN_VDEV_MLME_SUBTYPE_MESH 0x5
  44. #define WLAN_VDEV_MLME_SUBTYPE_MESH_11S 0x6
  45. #define WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR 0x7
  46. /* vdev control flags (per bits) */
  47. #define WLAN_VDEV_MLME_FLAGS_NON_MBSSID_AP 0x00000001
  48. #define WLAN_VDEV_MLME_FLAGS_TRANSMIT_AP 0x00000002
  49. #define WLAN_VDEV_MLME_FLAGS_NON_TRANSMIT_AP 0x00000004
  50. /**
  51. * struct vdev_mlme_proto_generic - generic mlme proto structure
  52. * sent in frames
  53. * @dtim_period: frequency of data transmissions per beacon 1-255
  54. * @slot_time: slot time
  55. * @protection_mode: rts cts protection mode
  56. * @beacon_interval: beacon interval
  57. * @ldpc: low density parity check value
  58. * @nss: number of spatial stream
  59. * @nss_2g: 2.4GHz number of spatial stream
  60. * @nss_5g: 5GHz number of spatial stream
  61. * @tsfadjust: adjusted timer sync value
  62. */
  63. struct vdev_mlme_proto_generic {
  64. uint8_t dtim_period;
  65. uint32_t slot_time;
  66. uint32_t protection_mode;
  67. uint16_t beacon_interval;
  68. uint8_t ldpc;
  69. uint8_t nss;
  70. uint8_t nss_2g;
  71. uint8_t nss_5g;
  72. uint64_t tsfadjust;
  73. };
  74. /**
  75. * struct vdev_mlme_proto_ap - ap specific mlme protocol
  76. * @.
  77. */
  78. struct vdev_mlme_proto_ap {
  79. };
  80. /**
  81. * struct vdev_mlme_proto_sta - sta specific mlme protocol
  82. * @assoc_id: association id of station
  83. * @uapsd_cfg: uapsd configuration
  84. */
  85. struct vdev_mlme_proto_sta {
  86. uint16_t assoc_id;
  87. uint16_t uapsd_cfg;
  88. };
  89. /**
  90. * struct vdev_mlme_proto_bss_color - bss color cfg
  91. * @flags: proposed for future use cases, currently not used.
  92. * @evt_type: bss color collision event.
  93. * @current_bss_color: current bss color.
  94. * @detection_period_ms: scan interval for both AP and STA mode.
  95. * @scan_period_ms: scan period for passive scan to detect collision.
  96. * @free_slot_expiry_time_ms: FW to notify host at timer expiry after
  97. * which Host will disable the bss color.
  98. */
  99. struct vdev_mlme_proto_bss_color {
  100. uint32_t flags;
  101. uint8_t evt_type;
  102. uint32_t current_bss_color;
  103. uint32_t detection_period_ms;
  104. uint32_t scan_period_ms;
  105. uint32_t free_slot_expiry_time_ms;
  106. };
  107. /**
  108. * struct vdev_mlme_vht_info - vdev VHT information
  109. * @caps: vht capabilities
  110. * @subfer: su beam former capability
  111. * @subfee: su beam formee capability
  112. * @mubfer: mu beam former capability
  113. * @mubfee: mu beam formee capability
  114. * @implicit_bf: Implicit BF support
  115. * @sounding_dimension: Beamformer number of sounding dimension
  116. * @bfee_sts_cap: beam formee STA capability
  117. * @allow_vht: vht capability status
  118. */
  119. struct vdev_mlme_vht_info {
  120. uint32_t caps;
  121. uint8_t subfer;
  122. uint8_t mubfer;
  123. uint8_t subfee;
  124. uint8_t mubfee;
  125. uint8_t implicit_bf;
  126. uint8_t sounding_dimension;
  127. uint8_t bfee_sts_cap;
  128. bool allow_vht;
  129. };
  130. /**
  131. * struct vdev_mlme_ht_info - vdev HT information
  132. * @ht_caps: HT capabilities
  133. * @allow_ht: HT capability status
  134. */
  135. struct vdev_mlme_ht_info {
  136. uint32_t ht_caps;
  137. bool allow_ht;
  138. };
  139. /**
  140. * struct vdev_mlme_he_ops_info - vdev mlme HEOPS information
  141. * @he_ops: he ops
  142. */
  143. struct vdev_mlme_he_ops_info {
  144. uint32_t he_ops;
  145. };
  146. /**
  147. * struct vdev_mlme_he_ops_info - vdev protocol structure holding information
  148. * that is used in frames
  149. * @generic: generic protocol information
  150. * @ap: ap specific protocol information
  151. * @sta: sta specific protocol information
  152. * @vht_info: vht information
  153. * @ht_info: ht capabilities information
  154. * @he_ops_info: he ops information
  155. * @bss_color: 11ax HE BSS Color information
  156. */
  157. struct vdev_mlme_proto {
  158. struct vdev_mlme_proto_generic generic;
  159. struct vdev_mlme_proto_ap ap;
  160. struct vdev_mlme_proto_sta sta;
  161. struct vdev_mlme_vht_info vht_info;
  162. struct vdev_mlme_ht_info ht_info;
  163. struct vdev_mlme_he_ops_info he_ops_info;
  164. struct vdev_mlme_proto_bss_color bss_color;
  165. };
  166. /**
  167. * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg
  168. * @rts_threshold: RTS threshold
  169. * @frag_threshold: Fragmentation threshold
  170. * @probe_delay: time in msec for delaying to send first probe request
  171. * @repeat_probe_time: probe request transmission time
  172. * @drop_unencry: drop unencrypted status
  173. * @ tx_pwrlimit: Tx power limit
  174. * @tx_power: Tx power
  175. * @minpower: Min power
  176. * @maxpower: Max power
  177. * @maxregpower: max regulatory power
  178. * @antennamax: max antenna
  179. * @reg_class_id: reg domain class id
  180. * @ampdu: ampdu limit
  181. * @amsdu: amsdu limit
  182. * @ssid: service set identifier
  183. * @ssid_len: ssid length
  184. * @type: vdev type
  185. * @sub_type: vdev subtype
  186. * @rx_decap_type: rx decap type
  187. * @tx_encap_type: tx encap type
  188. * @disable_hw_ack: disable ha ack flag
  189. * @bssid: bssid
  190. * @phy_mode: phy mode
  191. */
  192. struct vdev_mlme_mgmt_generic {
  193. uint32_t rts_threshold;
  194. uint32_t frag_threshold;
  195. uint32_t probe_delay;
  196. uint32_t repeat_probe_time;
  197. uint32_t drop_unencry;
  198. uint32_t tx_pwrlimit;
  199. uint8_t tx_power;
  200. uint8_t minpower;
  201. uint8_t maxpower;
  202. uint8_t maxregpower;
  203. uint8_t antennamax;
  204. uint8_t reg_class_id;
  205. uint8_t ampdu;
  206. uint8_t amsdu;
  207. char ssid[WLAN_SSID_MAX_LEN + 1];
  208. uint8_t ssid_len;
  209. uint8_t type;
  210. uint8_t subtype;
  211. uint8_t rx_decap_type;
  212. uint8_t tx_encap_type;
  213. bool disable_hw_ack;
  214. uint8_t bssid[QDF_MAC_ADDR_SIZE];
  215. uint32_t phy_mode;
  216. };
  217. /**
  218. * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
  219. * @hidden_ssid: flag to indicate whether it is hidden ssid
  220. * @cac_duration_ms: cac duration in millseconds
  221. */
  222. struct vdev_mlme_mgmt_ap {
  223. bool hidden_ssid;
  224. uint32_t cac_duration_ms;
  225. };
  226. /**
  227. * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
  228. * @.
  229. */
  230. struct vdev_mlme_mgmt_sta {
  231. };
  232. /**
  233. * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
  234. * @bmiss_first_bcnt: bmiss first time
  235. * @bmiss_final_bcnt: bmiss final time
  236. * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
  237. * inactive
  238. * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
  239. * data-null
  240. * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
  241. */
  242. struct vdev_mlme_inactivity_params {
  243. uint32_t bmiss_first_bcnt;
  244. uint32_t bmiss_final_bcnt;
  245. uint32_t keepalive_min_idle_inactive_time_secs;
  246. uint32_t keepalive_max_idle_inactive_time_secs;
  247. uint32_t keepalive_max_unresponsive_time_secs;
  248. };
  249. /**
  250. * struct vdev_mlme_rate_info - vdev mlme rate information
  251. * @rate_flags: dynamic bandwidth info
  252. * @per_band_tx_mgmt_rate: per band Tx mgmt rate
  253. * @max_rate: max bandwidth rate
  254. * @tx_mgmt_rate: Tx Mgmt rate
  255. * @bcn_tx_rate: beacon Tx rate
  256. * @bcn_tx_rate_code: beacon Tx rate code
  257. * @type: Type of ratemask configuration
  258. * @lower32: Lower 32 bits in the 1st 64-bit value
  259. * @higher32: Higher 32 bits in the 1st 64-bit value
  260. * @lower32_2: Lower 32 bits in the 2nd 64-bit value
  261. * @half_rate: Half rate
  262. * @quarter_rate: quarter rate
  263. */
  264. struct vdev_mlme_rate_info {
  265. uint32_t rate_flags;
  266. uint32_t per_band_tx_mgmt_rate;
  267. uint32_t max_rate;
  268. uint32_t tx_mgmt_rate;
  269. uint32_t bcn_tx_rate;
  270. #ifdef WLAN_BCN_RATECODE_ENABLE
  271. uint32_t bcn_tx_rate_code;
  272. #endif
  273. uint8_t type;
  274. uint32_t lower32;
  275. uint32_t higher32;
  276. uint32_t lower32_2;
  277. bool half_rate;
  278. bool quarter_rate;
  279. };
  280. /**
  281. * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
  282. * @tx_chainmask: Tx chainmask
  283. * @rx_chainmask: Rx Chainmask
  284. * @num_rx_chain: Num of bits set in Rx chain
  285. * @num_tx_chain: Num of bits set in Tx chain
  286. */
  287. struct vdev_mlme_chainmask_info {
  288. uint8_t tx_chainmask;
  289. uint8_t rx_chainmask;
  290. uint8_t num_rx_chain;
  291. uint8_t num_tx_chain;
  292. };
  293. /**
  294. * struct vdev_mlme_powersave_info - vdev mlme powersave information
  295. * @packet_powersave: packet powersave
  296. * @max_li_of_moddtim: max mod dtim
  297. * @dyndtim_cnt: dynamic dtim count
  298. * @listen_interval: listen interval
  299. * @moddtim_cnt: mod dtim count
  300. */
  301. struct vdev_mlme_powersave_info {
  302. uint32_t packet_powersave;
  303. uint32_t max_li_of_moddtim;
  304. uint32_t dyndtim_cnt;
  305. uint32_t listen_interval;
  306. uint32_t moddtim_cnt;
  307. };
  308. /**
  309. * struct vdev_mlme_beacon_info - vdev mlme beacon information
  310. * @beacon_buffer: buffer allocated for beacon frame
  311. * @beacon_offsets: beacon IE's offsets
  312. */
  313. struct vdev_mlme_beacon_info {
  314. qdf_nbuf_t beacon_buffer;
  315. void *beacon_offsets;
  316. };
  317. /**
  318. * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
  319. * @profile_idx: profile index of the connected non-trans ap (mbssid case).
  320. * 0 means invalid.
  321. * @profile_num: the total profile numbers of non-trans aps (mbssid
  322. * case).
  323. * 0 means non-MBSS AP.
  324. * @mbssid-flags: MBSS IE flags indicating vdev type
  325. * @vdevid_trans: id of transmitting vdev for MBSS IE
  326. * @trans_bssid: bssid of transmitted AP (MBSS IE case)
  327. */
  328. struct vdev_mlme_mbss_11ax {
  329. uint32_t profile_idx;
  330. uint32_t profile_num;
  331. uint32_t mbssid_flags;
  332. uint8_t vdevid_trans;
  333. uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
  334. };
  335. /**
  336. * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
  337. * @generic: generic mgmt information
  338. * @ap: ap specific mgmt information
  339. * @sta: sta specific mgmt information
  340. * @inactivity_params: inactivity parameters
  341. * @rate_info: bandwidth rate information
  342. * @chainmask_info: Chainmask information
  343. * @powersave_info: Power save parameters
  344. * @beacon_info: beacon buffer information
  345. * @mbss_11ax: MBSS 11ax information
  346. */
  347. struct vdev_mlme_mgmt {
  348. struct vdev_mlme_mgmt_generic generic;
  349. struct vdev_mlme_mgmt_ap ap;
  350. struct vdev_mlme_mgmt_sta sta;
  351. struct vdev_mlme_inactivity_params inactivity_params;
  352. struct vdev_mlme_rate_info rate_info;
  353. struct vdev_mlme_chainmask_info chainmask_info;
  354. struct vdev_mlme_powersave_info powersave_info;
  355. struct vdev_mlme_beacon_info beacon_info;
  356. struct vdev_mlme_mbss_11ax mbss_11ax;
  357. };
  358. /**
  359. * enum beacon_update_op - Beacon update op type
  360. * @BEACON_INIT: Initialize beacon
  361. * @BEACON_REINIT: Re-initialize beacon
  362. * @BEACON_UPDATE: Update dynamic fields of beacon
  363. * @BEACON_CSA: Enable CSA IE
  364. * @BEACON_FREE: Beacon buffer free
  365. */
  366. enum beacon_update_op {
  367. BEACON_INIT,
  368. BEACON_REINIT,
  369. BEACON_UPDATE,
  370. BEACON_CSA,
  371. BEACON_FREE,
  372. };
  373. /**
  374. * enum vdev_cmd_type - Command type
  375. * @START_REQ: Start request
  376. * @RESTART_REQ: Restart request
  377. * @STOP_REQ: STOP request
  378. * @DELETE_REQ: DELETE request
  379. */
  380. enum vdev_cmd_type {
  381. START_REQ,
  382. RESTART_REQ,
  383. STOP_REQ,
  384. DELETE_REQ,
  385. };
  386. /**
  387. * enum vdev_start_resp_type - start respone type
  388. * @START_RESPONSE: Start response
  389. * @RESTART_RESPONSE: Restart response
  390. */
  391. enum vdev_start_resp_type {
  392. START_RESPONSE = 0,
  393. RESTART_RESPONSE,
  394. };
  395. /**
  396. * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  397. * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params
  398. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  399. * @mlme_vdev_start_send: callback to initiate actions of VDEV
  400. * MLME start operation
  401. * @mlme_vdev_restart_send: callback to initiate actions of VDEV
  402. * MLME restart operation
  403. * @mlme_vdev_stop_start_send: callback to block start/restart VDEV
  404. * request command
  405. * @mlme_vdev_start_continue: callback to initiate operations on
  406. * LMAC/FW start response
  407. * @mlme_vdev_up_send: callback to initiate actions of VDEV
  408. * MLME up operation
  409. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving
  410. * to UP state
  411. * @mlme_vdev_notify_roam_start: callback to initiate roaming
  412. * @mlme_vdev_update_beacon: callback to initiate beacon update
  413. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  414. * peers
  415. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  416. * @mlme_vdev_stop_send: callback to initiate actions of VDEV
  417. * MLME stop operation
  418. * @mlme_vdev_stop_continue: callback to initiate operations on
  419. * LMAC/FW stop response
  420. * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
  421. * peer delete completion
  422. * @mlme_vdev_down_send: callback to initiate actions of VDEV
  423. * MLME down operation
  424. * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start
  425. * start state exit
  426. * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required
  427. * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for
  428. * vdev mlme peer delete all response
  429. */
  430. struct vdev_mlme_ops {
  431. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  432. struct vdev_mlme_obj *vdev_mlme,
  433. uint16_t event_data_len, void *event_data);
  434. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  435. struct vdev_mlme_obj *vdev_mlme,
  436. uint16_t event_data_len, void *event_data);
  437. QDF_STATUS (*mlme_vdev_start_send)(
  438. struct vdev_mlme_obj *vdev_mlme,
  439. uint16_t event_data_len, void *event_data);
  440. QDF_STATUS (*mlme_vdev_restart_send)(
  441. struct vdev_mlme_obj *vdev_mlme,
  442. uint16_t event_data_len, void *event_data);
  443. QDF_STATUS (*mlme_vdev_stop_start_send)(
  444. struct vdev_mlme_obj *vdev_mlme,
  445. enum vdev_cmd_type type,
  446. uint16_t event_data_len, void *event_data);
  447. QDF_STATUS (*mlme_vdev_start_continue)(
  448. struct vdev_mlme_obj *vdev_mlme,
  449. uint16_t event_data_len, void *event_data);
  450. QDF_STATUS (*mlme_vdev_sta_conn_start)(
  451. struct vdev_mlme_obj *vdev_mlme,
  452. uint16_t event_data_len, void *event_data);
  453. QDF_STATUS (*mlme_vdev_start_req_failed)(
  454. struct vdev_mlme_obj *vdev_mlme,
  455. uint16_t event_data_len, void *event_data);
  456. QDF_STATUS (*mlme_vdev_up_send)(
  457. struct vdev_mlme_obj *vdev_mlme,
  458. uint16_t event_data_len, void *event_data);
  459. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  460. struct vdev_mlme_obj *vdev_mlme,
  461. uint16_t event_data_len, void *event_data);
  462. QDF_STATUS (*mlme_vdev_notify_roam_start)(
  463. struct vdev_mlme_obj *vdev_mlme,
  464. uint16_t event_data_len, void *event_data);
  465. QDF_STATUS (*mlme_vdev_update_beacon)(
  466. struct vdev_mlme_obj *vdev_mlme,
  467. enum beacon_update_op op,
  468. uint16_t event_data_len, void *event_data);
  469. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  470. struct vdev_mlme_obj *vdev_mlme,
  471. uint16_t event_data_len, void *event_data);
  472. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  473. struct vdev_mlme_obj *vdev_mlme,
  474. uint16_t event_data_len, void *event_data);
  475. QDF_STATUS (*mlme_vdev_stop_send)(
  476. struct vdev_mlme_obj *vdev_mlme,
  477. uint16_t event_data_len, void *event_data);
  478. QDF_STATUS (*mlme_vdev_stop_continue)(
  479. struct vdev_mlme_obj *vdev_mlme,
  480. uint16_t event_data_len, void *event_data);
  481. QDF_STATUS (*mlme_vdev_down_send)(
  482. struct vdev_mlme_obj *vdev_mlme,
  483. uint16_t event_data_len, void *event_data);
  484. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  485. struct vdev_mlme_obj *vdev_mlme,
  486. uint16_t event_data_len, void *event_data);
  487. QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
  488. struct vdev_mlme_obj *vdev_mlme,
  489. struct vdev_stop_response *rsp);
  490. QDF_STATUS (*mlme_vdev_ext_start_rsp)(
  491. struct vdev_mlme_obj *vdev_mlme,
  492. struct vdev_start_response *rsp);
  493. QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
  494. struct vdev_mlme_obj *vdev_mlme);
  495. QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
  496. struct vdev_mlme_obj *vdev_mlme);
  497. QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
  498. struct vdev_mlme_obj *vdev_mlme,
  499. struct peer_delete_all_response *rsp);
  500. };
  501. /**
  502. * struct vdev_mlme_obj - VDEV MLME component object
  503. * @proto: VDEV MLME proto substructure
  504. * @mgmt: VDEV MLME mgmt substructure
  505. * @sm_lock: VDEV SM lock
  506. * @vdev_cmd_lock: VDEV MLME command atomicity
  507. * @sm_hdl: VDEV SM handle
  508. * @vdev: Pointer to vdev objmgr
  509. * @ops: VDEV MLME callback table
  510. * @ext_vdev_ptr: VDEV MLME legacy pointer
  511. * @vdev_rt: VDEV response timer
  512. * @vdev_wakelock: vdev wakelock sub structure
  513. */
  514. struct vdev_mlme_obj {
  515. struct vdev_mlme_proto proto;
  516. struct vdev_mlme_mgmt mgmt;
  517. #ifdef VDEV_SM_LOCK_SUPPORT
  518. qdf_spinlock_t sm_lock;
  519. qdf_mutex_t vdev_cmd_lock;
  520. #endif
  521. struct wlan_sm *sm_hdl;
  522. struct wlan_objmgr_vdev *vdev;
  523. struct vdev_mlme_ops *ops;
  524. mlme_vdev_ext_t *ext_vdev_ptr;
  525. };
  526. /**
  527. * wlan_vdev_mlme_set_ssid() - set ssid
  528. * @vdev: VDEV object
  529. * @ssid: SSID (input)
  530. * @ssid_len: Length of SSID
  531. *
  532. * API to set the SSID of VDEV
  533. *
  534. * Caller need to acquire lock with wlan_vdev_obj_lock()
  535. *
  536. * Return: SUCCESS, if update is done
  537. * FAILURE, if ssid length is > max ssid len
  538. */
  539. static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
  540. struct wlan_objmgr_vdev *vdev,
  541. const uint8_t *ssid, uint8_t ssid_len)
  542. {
  543. struct vdev_mlme_obj *vdev_mlme;
  544. /* This API is invoked with lock acquired, do not add log prints */
  545. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  546. if (!vdev_mlme)
  547. return QDF_STATUS_E_FAILURE;
  548. if (ssid_len <= WLAN_SSID_MAX_LEN) {
  549. qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
  550. vdev_mlme->mgmt.generic.ssid_len = ssid_len;
  551. } else {
  552. vdev_mlme->mgmt.generic.ssid_len = 0;
  553. return QDF_STATUS_E_FAILURE;
  554. }
  555. return QDF_STATUS_SUCCESS;
  556. }
  557. /**
  558. * wlan_vdev_mlme_get_ssid() - get ssid
  559. * @vdev: VDEV object
  560. * @ssid: SSID
  561. * @ssid_len: Length of SSID
  562. *
  563. * API to get the SSID of VDEV, it updates the SSID and its length
  564. * in @ssid, @ssid_len respectively
  565. *
  566. * Caller need to acquire lock with wlan_vdev_obj_lock()
  567. *
  568. * Return: SUCCESS, if update is done
  569. * FAILURE, if ssid length is > max ssid len
  570. */
  571. static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
  572. struct wlan_objmgr_vdev *vdev,
  573. uint8_t *ssid, uint8_t *ssid_len)
  574. {
  575. struct vdev_mlme_obj *vdev_mlme;
  576. /* This API is invoked with lock acquired, do not add log prints */
  577. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  578. if (!vdev_mlme)
  579. return QDF_STATUS_E_FAILURE;
  580. if (vdev_mlme->mgmt.generic.ssid_len > 0) {
  581. *ssid_len = vdev_mlme->mgmt.generic.ssid_len;
  582. qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
  583. } else {
  584. *ssid_len = 0;
  585. return QDF_STATUS_E_FAILURE;
  586. }
  587. return QDF_STATUS_SUCCESS;
  588. }
  589. /**
  590. * wlan_vdev_mlme_set_nss() - set NSS
  591. * @vdev: VDEV object
  592. * @nss: nss configured by user
  593. *
  594. * API to set the Number of Spatial streams
  595. *
  596. * Return: void
  597. */
  598. static inline void wlan_vdev_mlme_set_nss(
  599. struct wlan_objmgr_vdev *vdev,
  600. uint8_t nss)
  601. {
  602. struct vdev_mlme_obj *vdev_mlme;
  603. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  604. if (!vdev_mlme)
  605. return;
  606. vdev_mlme->proto.generic.nss = nss;
  607. }
  608. /**
  609. * wlan_vdev_mlme_get_nss() - get NSS
  610. * @vdev: VDEV object
  611. *
  612. * API to get the Number of Spatial Streams
  613. *
  614. * Return:
  615. * @nss: nss value
  616. */
  617. static inline uint8_t wlan_vdev_mlme_get_nss(
  618. struct wlan_objmgr_vdev *vdev)
  619. {
  620. struct vdev_mlme_obj *vdev_mlme;
  621. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  622. if (!vdev_mlme)
  623. return 0;
  624. return vdev_mlme->proto.generic.nss;
  625. }
  626. /**
  627. * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
  628. * @vdev: VDEV object
  629. * @chainmask : chainmask either configured by user or max supported
  630. *
  631. * API to set the Tx chainmask
  632. *
  633. * Return: void
  634. */
  635. static inline void wlan_vdev_mlme_set_txchainmask(
  636. struct wlan_objmgr_vdev *vdev,
  637. uint8_t chainmask)
  638. {
  639. struct vdev_mlme_obj *vdev_mlme;
  640. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  641. if (!vdev_mlme)
  642. return;
  643. vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
  644. }
  645. /**
  646. * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
  647. * @vdev: VDEV object
  648. *
  649. * API to get the Tx chainmask
  650. *
  651. * Return:
  652. * @chainmask : Tx chainmask either configured by user or max supported
  653. */
  654. static inline uint8_t wlan_vdev_mlme_get_txchainmask(
  655. struct wlan_objmgr_vdev *vdev)
  656. {
  657. struct vdev_mlme_obj *vdev_mlme;
  658. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  659. if (!vdev_mlme)
  660. return 0;
  661. return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
  662. }
  663. /**
  664. * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
  665. * @vdev: VDEV object
  666. * @chainmask : Rx chainmask either configured by user or max supported
  667. *
  668. * API to set the Rx chainmask
  669. *
  670. * Return: void
  671. */
  672. static inline void wlan_vdev_mlme_set_rxchainmask(
  673. struct wlan_objmgr_vdev *vdev,
  674. uint8_t chainmask)
  675. {
  676. struct vdev_mlme_obj *vdev_mlme;
  677. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  678. if (!vdev_mlme)
  679. return;
  680. vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
  681. }
  682. /**
  683. * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
  684. * @vdev: VDEV object
  685. *
  686. * API to get the Rx chainmask
  687. *
  688. * Return:
  689. * @chainmask : Rx chainmask either configured by user or max supported
  690. */
  691. static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
  692. struct wlan_objmgr_vdev *vdev)
  693. {
  694. struct vdev_mlme_obj *vdev_mlme;
  695. /* This API is invoked with lock acquired, do not add log prints */
  696. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  697. if (!vdev_mlme)
  698. return 0;
  699. return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
  700. }
  701. /**
  702. * wlan_vdev_mlme_set_txpower() - set tx power
  703. * @vdev: VDEV object
  704. * @txpow: tx power either configured by used or max allowed
  705. *
  706. * API to set the tx power
  707. *
  708. * Return: void
  709. */
  710. static inline void wlan_vdev_mlme_set_txpower(
  711. struct wlan_objmgr_vdev *vdev,
  712. uint8_t txpow)
  713. {
  714. struct vdev_mlme_obj *vdev_mlme;
  715. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  716. if (!vdev_mlme)
  717. return;
  718. vdev_mlme->mgmt.generic.tx_power = txpow;
  719. }
  720. /**
  721. * wlan_vdev_mlme_get_txpower() - get tx power
  722. * @vdev: VDEV object
  723. *
  724. * API to get the tx power
  725. *
  726. * Return:
  727. * @txpow: tx power either configured by used or max allowed
  728. */
  729. static inline uint8_t wlan_vdev_mlme_get_txpower(
  730. struct wlan_objmgr_vdev *vdev)
  731. {
  732. struct vdev_mlme_obj *vdev_mlme;
  733. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  734. if (!vdev_mlme)
  735. return 0;
  736. return vdev_mlme->mgmt.generic.tx_power;
  737. }
  738. /**
  739. * wlan_vdev_mlme_set_maxrate() - set max rate
  740. * @vdev: VDEV object
  741. * @maxrate: configured by used or based on configured mode
  742. *
  743. * API to set the max rate the vdev supports
  744. *
  745. * Return: void
  746. */
  747. static inline void wlan_vdev_mlme_set_maxrate(
  748. struct wlan_objmgr_vdev *vdev,
  749. uint32_t maxrate)
  750. {
  751. struct vdev_mlme_obj *vdev_mlme;
  752. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  753. if (!vdev_mlme)
  754. return;
  755. vdev_mlme->mgmt.rate_info.max_rate = maxrate;
  756. }
  757. /**
  758. * wlan_vdev_mlme_get_maxrate() - get max rate
  759. * @vdev: VDEV object
  760. *
  761. * API to get the max rate the vdev supports
  762. *
  763. * Return:
  764. * @maxrate: configured by used or based on configured mode
  765. */
  766. static inline uint32_t wlan_vdev_mlme_get_maxrate(
  767. struct wlan_objmgr_vdev *vdev)
  768. {
  769. struct vdev_mlme_obj *vdev_mlme;
  770. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  771. if (!vdev_mlme)
  772. return 0;
  773. return vdev_mlme->mgmt.rate_info.max_rate;
  774. }
  775. /**
  776. * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
  777. * @vdev: VDEV object
  778. * @txmgmtrate: Tx Mgmt rate
  779. *
  780. * API to set Mgmt Tx rate
  781. *
  782. * Return: void
  783. */
  784. static inline void wlan_vdev_mlme_set_txmgmtrate(
  785. struct wlan_objmgr_vdev *vdev,
  786. uint32_t txmgmtrate)
  787. {
  788. struct vdev_mlme_obj *vdev_mlme;
  789. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  790. if (!vdev_mlme)
  791. return;
  792. vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
  793. }
  794. /**
  795. * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
  796. * @vdev: VDEV object
  797. *
  798. * API to get Mgmt Tx rate
  799. *
  800. * Return:
  801. * @txmgmtrate: Tx Mgmt rate
  802. */
  803. static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
  804. struct wlan_objmgr_vdev *vdev)
  805. {
  806. struct vdev_mlme_obj *vdev_mlme;
  807. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  808. if (!vdev_mlme)
  809. return 0;
  810. return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
  811. }
  812. #endif