wlan_vdev_mlme.h 25 KB

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