wlan_vdev_mlme.h 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989
  1. /*
  2. * Copyright (c) 2018-2021 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. * @special_vdev_mode: indicates special vdev mode
  194. */
  195. struct vdev_mlme_mgmt_generic {
  196. uint32_t rts_threshold;
  197. uint32_t frag_threshold;
  198. uint32_t probe_delay;
  199. uint32_t repeat_probe_time;
  200. uint32_t drop_unencry;
  201. uint32_t tx_pwrlimit;
  202. uint8_t tx_power;
  203. uint8_t minpower;
  204. uint8_t maxpower;
  205. uint8_t maxregpower;
  206. uint8_t antennamax;
  207. uint8_t reg_class_id;
  208. uint8_t ampdu;
  209. uint8_t amsdu;
  210. char ssid[WLAN_SSID_MAX_LEN + 1];
  211. uint8_t ssid_len;
  212. uint8_t type;
  213. uint8_t subtype;
  214. uint8_t rx_decap_type;
  215. uint8_t tx_encap_type;
  216. bool disable_hw_ack;
  217. uint8_t bssid[QDF_MAC_ADDR_SIZE];
  218. uint32_t phy_mode;
  219. bool special_vdev_mode;
  220. };
  221. /**
  222. * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
  223. * @hidden_ssid: flag to indicate whether it is hidden ssid
  224. * @cac_duration_ms: cac duration in millseconds
  225. */
  226. struct vdev_mlme_mgmt_ap {
  227. bool hidden_ssid;
  228. uint32_t cac_duration_ms;
  229. };
  230. /**
  231. * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
  232. * @he_mcs_12_13_map: map to indicate mcs12/13 caps of peer&dut
  233. */
  234. struct vdev_mlme_mgmt_sta {
  235. uint16_t he_mcs_12_13_map;
  236. };
  237. /**
  238. * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
  239. * @bmiss_first_bcnt: bmiss first time
  240. * @bmiss_final_bcnt: bmiss final time
  241. * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
  242. * inactive
  243. * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
  244. * data-null
  245. * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
  246. */
  247. struct vdev_mlme_inactivity_params {
  248. uint32_t bmiss_first_bcnt;
  249. uint32_t bmiss_final_bcnt;
  250. uint32_t keepalive_min_idle_inactive_time_secs;
  251. uint32_t keepalive_max_idle_inactive_time_secs;
  252. uint32_t keepalive_max_unresponsive_time_secs;
  253. };
  254. /**
  255. * struct vdev_mlme_rate_info - vdev mlme rate information
  256. * @rate_flags: dynamic bandwidth info
  257. * @per_band_tx_mgmt_rate: per band Tx mgmt rate
  258. * @max_rate: max bandwidth rate
  259. * @tx_mgmt_rate: Tx Mgmt rate
  260. * @bcn_tx_rate: beacon Tx rate
  261. * @bcn_tx_rate_code: beacon Tx rate code
  262. * @type: Type of ratemask configuration
  263. * @lower32: Lower 32 bits in the 1st 64-bit value
  264. * @higher32: Higher 32 bits in the 1st 64-bit value
  265. * @lower32_2: Lower 32 bits in the 2nd 64-bit value
  266. * @half_rate: Half rate
  267. * @quarter_rate: quarter rate
  268. */
  269. struct vdev_mlme_rate_info {
  270. uint32_t rate_flags;
  271. uint32_t per_band_tx_mgmt_rate;
  272. uint32_t max_rate;
  273. uint32_t tx_mgmt_rate;
  274. uint32_t bcn_tx_rate;
  275. #ifdef WLAN_BCN_RATECODE_ENABLE
  276. uint32_t bcn_tx_rate_code;
  277. #endif
  278. uint32_t rtscts_tx_rate;
  279. uint8_t type;
  280. uint32_t lower32;
  281. uint32_t higher32;
  282. uint32_t lower32_2;
  283. bool half_rate;
  284. bool quarter_rate;
  285. };
  286. /**
  287. * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
  288. * @tx_chainmask: Tx chainmask
  289. * @rx_chainmask: Rx Chainmask
  290. * @num_rx_chain: Num of bits set in Rx chain
  291. * @num_tx_chain: Num of bits set in Tx chain
  292. */
  293. struct vdev_mlme_chainmask_info {
  294. uint8_t tx_chainmask;
  295. uint8_t rx_chainmask;
  296. uint8_t num_rx_chain;
  297. uint8_t num_tx_chain;
  298. };
  299. /**
  300. * struct vdev_mlme_powersave_info - vdev mlme powersave information
  301. * @packet_powersave: packet powersave
  302. * @max_li_of_moddtim: max mod dtim
  303. * @dyndtim_cnt: dynamic dtim count
  304. * @listen_interval: listen interval
  305. * @moddtim_cnt: mod dtim count
  306. */
  307. struct vdev_mlme_powersave_info {
  308. uint32_t packet_powersave;
  309. uint32_t max_li_of_moddtim;
  310. uint32_t dyndtim_cnt;
  311. uint32_t listen_interval;
  312. uint32_t moddtim_cnt;
  313. };
  314. /**
  315. * struct vdev_mlme_beacon_info - vdev mlme beacon information
  316. * @beacon_buffer: buffer allocated for beacon frame
  317. * @beacon_offsets: beacon IE's offsets
  318. */
  319. struct vdev_mlme_beacon_info {
  320. qdf_nbuf_t beacon_buffer;
  321. void *beacon_offsets;
  322. };
  323. /**
  324. * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
  325. * @profile_idx: profile index of the connected non-trans ap (mbssid case).
  326. * 0 means invalid.
  327. * @profile_num: the total profile numbers of non-trans aps (mbssid
  328. * case).
  329. * 0 means non-MBSS AP.
  330. * @mbssid-flags: MBSS IE flags indicating vdev type
  331. * @vdevid_trans: id of transmitting vdev for MBSS IE
  332. * @trans_bssid: bssid of transmitted AP (MBSS IE case)
  333. */
  334. struct vdev_mlme_mbss_11ax {
  335. uint32_t profile_idx;
  336. uint32_t profile_num;
  337. uint32_t mbssid_flags;
  338. uint8_t vdevid_trans;
  339. uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
  340. };
  341. /**
  342. * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
  343. * @generic: generic mgmt information
  344. * @ap: ap specific mgmt information
  345. * @sta: sta specific mgmt information
  346. * @inactivity_params: inactivity parameters
  347. * @rate_info: bandwidth rate information
  348. * @chainmask_info: Chainmask information
  349. * @powersave_info: Power save parameters
  350. * @beacon_info: beacon buffer information
  351. * @mbss_11ax: MBSS 11ax information
  352. */
  353. struct vdev_mlme_mgmt {
  354. struct vdev_mlme_mgmt_generic generic;
  355. struct vdev_mlme_mgmt_ap ap;
  356. struct vdev_mlme_mgmt_sta sta;
  357. struct vdev_mlme_inactivity_params inactivity_params;
  358. struct vdev_mlme_rate_info rate_info;
  359. struct vdev_mlme_chainmask_info chainmask_info;
  360. struct vdev_mlme_powersave_info powersave_info;
  361. struct vdev_mlme_beacon_info beacon_info;
  362. struct vdev_mlme_mbss_11ax mbss_11ax;
  363. };
  364. /**
  365. * enum beacon_update_op - Beacon update op type
  366. * @BEACON_INIT: Initialize beacon
  367. * @BEACON_REINIT: Re-initialize beacon
  368. * @BEACON_UPDATE: Update dynamic fields of beacon
  369. * @BEACON_CSA: Enable CSA IE
  370. * @BEACON_FREE: Beacon buffer free
  371. */
  372. enum beacon_update_op {
  373. BEACON_INIT,
  374. BEACON_REINIT,
  375. BEACON_UPDATE,
  376. BEACON_CSA,
  377. BEACON_FREE,
  378. };
  379. /**
  380. * enum vdev_cmd_type - Command type
  381. * @START_REQ: Start request
  382. * @RESTART_REQ: Restart request
  383. * @STOP_REQ: STOP request
  384. * @DELETE_REQ: DELETE request
  385. */
  386. enum vdev_cmd_type {
  387. START_REQ,
  388. RESTART_REQ,
  389. STOP_REQ,
  390. DELETE_REQ,
  391. };
  392. /**
  393. * enum vdev_start_resp_type - start respone type
  394. * @START_RESPONSE: Start response
  395. * @RESTART_RESPONSE: Restart response
  396. */
  397. enum vdev_start_resp_type {
  398. START_RESPONSE = 0,
  399. RESTART_RESPONSE,
  400. };
  401. /**
  402. * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
  403. * @mlme_vdev_validate_basic_params: callback to validate VDEV basic params
  404. * @mlme_vdev_reset_proto_params: callback to Reset protocol params
  405. * @mlme_vdev_start_send: callback to initiate actions of VDEV
  406. * MLME start operation
  407. * @mlme_vdev_restart_send: callback to initiate actions of VDEV
  408. * MLME restart operation
  409. * @mlme_vdev_stop_start_send: callback to block start/restart VDEV
  410. * request command
  411. * @mlme_vdev_start_continue: callback to initiate operations on
  412. * LMAC/FW start response
  413. * @mlme_vdev_sta_conn_start: callback to initiate STA connection
  414. * @mlme_vdev_up_send: callback to initiate actions of VDEV
  415. * MLME up operation
  416. * @mlme_vdev_notify_up_complete: callback to notify VDEV MLME on moving
  417. * to UP state
  418. * @mlme_vdev_notify_roam_start: callback to initiate roaming
  419. * @mlme_vdev_update_beacon: callback to initiate beacon update
  420. * @mlme_vdev_disconnect_peers: callback to initiate disconnection of
  421. * peers
  422. * @mlme_vdev_dfs_cac_timer_stop: callback to stop the DFS CAC timer
  423. * @mlme_vdev_stop_send: callback to initiate actions of VDEV
  424. * MLME stop operation
  425. * @mlme_vdev_stop_continue: callback to initiate operations on
  426. * LMAC/FW stop response
  427. * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
  428. * peer delete completion
  429. * @mlme_vdev_down_send: callback to initiate actions of VDEV
  430. * MLME down operation
  431. * @mlme_vdev_notify_start_state_exit: callback to notify on vdev start
  432. * start state exit
  433. * @mlme_vdev_is_newchan_no_cac: callback to check CAC is required
  434. * @mlme_vdev_ext_peer_delete_all_rsp: callback to initiate actions for
  435. * vdev mlme peer delete all response
  436. * @mlme_vdev_dfs_cac_wait_notify: callback to notify about CAC state
  437. * @mlme_vdev_csa_complete: callback to indicate CSA complete
  438. * @mlme_vdev_sta_disconn_start: callback to initiate STA disconnection
  439. */
  440. struct vdev_mlme_ops {
  441. QDF_STATUS (*mlme_vdev_validate_basic_params)(
  442. struct vdev_mlme_obj *vdev_mlme,
  443. uint16_t event_data_len, void *event_data);
  444. QDF_STATUS (*mlme_vdev_reset_proto_params)(
  445. struct vdev_mlme_obj *vdev_mlme,
  446. uint16_t event_data_len, void *event_data);
  447. QDF_STATUS (*mlme_vdev_start_send)(
  448. struct vdev_mlme_obj *vdev_mlme,
  449. uint16_t event_data_len, void *event_data);
  450. QDF_STATUS (*mlme_vdev_restart_send)(
  451. struct vdev_mlme_obj *vdev_mlme,
  452. uint16_t event_data_len, void *event_data);
  453. QDF_STATUS (*mlme_vdev_stop_start_send)(
  454. struct vdev_mlme_obj *vdev_mlme,
  455. enum vdev_cmd_type type,
  456. uint16_t event_data_len, void *event_data);
  457. QDF_STATUS (*mlme_vdev_start_continue)(
  458. struct vdev_mlme_obj *vdev_mlme,
  459. uint16_t event_data_len, void *event_data);
  460. QDF_STATUS (*mlme_vdev_sta_conn_start)(
  461. struct vdev_mlme_obj *vdev_mlme,
  462. uint16_t event_data_len, void *event_data);
  463. QDF_STATUS (*mlme_vdev_start_req_failed)(
  464. struct vdev_mlme_obj *vdev_mlme,
  465. uint16_t event_data_len, void *event_data);
  466. QDF_STATUS (*mlme_vdev_up_send)(
  467. struct vdev_mlme_obj *vdev_mlme,
  468. uint16_t event_data_len, void *event_data);
  469. QDF_STATUS (*mlme_vdev_notify_up_complete)(
  470. struct vdev_mlme_obj *vdev_mlme,
  471. uint16_t event_data_len, void *event_data);
  472. QDF_STATUS (*mlme_vdev_notify_roam_start)(
  473. struct vdev_mlme_obj *vdev_mlme,
  474. uint16_t event_data_len, void *event_data);
  475. QDF_STATUS (*mlme_vdev_update_beacon)(
  476. struct vdev_mlme_obj *vdev_mlme,
  477. enum beacon_update_op op,
  478. uint16_t event_data_len, void *event_data);
  479. QDF_STATUS (*mlme_vdev_disconnect_peers)(
  480. struct vdev_mlme_obj *vdev_mlme,
  481. uint16_t event_data_len, void *event_data);
  482. QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
  483. struct vdev_mlme_obj *vdev_mlme,
  484. uint16_t event_data_len, void *event_data);
  485. QDF_STATUS (*mlme_vdev_stop_send)(
  486. struct vdev_mlme_obj *vdev_mlme,
  487. uint16_t event_data_len, void *event_data);
  488. QDF_STATUS (*mlme_vdev_stop_continue)(
  489. struct vdev_mlme_obj *vdev_mlme,
  490. uint16_t event_data_len, void *event_data);
  491. QDF_STATUS (*mlme_vdev_down_send)(
  492. struct vdev_mlme_obj *vdev_mlme,
  493. uint16_t event_data_len, void *event_data);
  494. QDF_STATUS (*mlme_vdev_notify_down_complete)(
  495. struct vdev_mlme_obj *vdev_mlme,
  496. uint16_t event_data_len, void *event_data);
  497. QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
  498. struct vdev_mlme_obj *vdev_mlme,
  499. struct vdev_stop_response *rsp);
  500. QDF_STATUS (*mlme_vdev_ext_start_rsp)(
  501. struct vdev_mlme_obj *vdev_mlme,
  502. struct vdev_start_response *rsp);
  503. QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
  504. struct vdev_mlme_obj *vdev_mlme);
  505. QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
  506. struct vdev_mlme_obj *vdev_mlme);
  507. QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
  508. struct vdev_mlme_obj *vdev_mlme,
  509. struct peer_delete_all_response *rsp);
  510. QDF_STATUS (*mlme_vdev_dfs_cac_wait_notify)(
  511. struct vdev_mlme_obj *vdev_mlme);
  512. QDF_STATUS (*mlme_vdev_csa_complete)(
  513. struct vdev_mlme_obj *vdev_mlme);
  514. QDF_STATUS (*mlme_vdev_sta_disconn_start)(
  515. struct vdev_mlme_obj *vdev_mlme,
  516. uint16_t event_data_len, void *event_data);
  517. };
  518. /**
  519. * struct vdev_mlme_obj - VDEV MLME component object
  520. * @proto: VDEV MLME proto substructure
  521. * @mgmt: VDEV MLME mgmt substructure
  522. * @sm_lock: VDEV SM lock
  523. * @vdev_cmd_lock: VDEV MLME command atomicity
  524. * @sm_hdl: VDEV SM handle
  525. * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only
  526. * @vdev: Pointer to vdev objmgr
  527. * @ops: VDEV MLME callback table
  528. * @ext_vdev_ptr: VDEV MLME legacy pointer
  529. * @reg_tpc_obj: Regulatory transmit power info
  530. * @vdev_rt: VDEV response timer
  531. * @vdev_wakelock: vdev wakelock sub structure
  532. */
  533. struct vdev_mlme_obj {
  534. struct vdev_mlme_proto proto;
  535. struct vdev_mlme_mgmt mgmt;
  536. #ifdef VDEV_SM_LOCK_SUPPORT
  537. qdf_spinlock_t sm_lock;
  538. qdf_mutex_t vdev_cmd_lock;
  539. #endif
  540. struct wlan_sm *sm_hdl;
  541. union {
  542. struct cnx_mgr *cnx_mgr_ctx;
  543. };
  544. struct wlan_objmgr_vdev *vdev;
  545. struct vdev_mlme_ops *ops;
  546. mlme_vdev_ext_t *ext_vdev_ptr;
  547. struct reg_tpc_power_info reg_tpc_obj;
  548. };
  549. /**
  550. * wlan_vdev_mlme_set_ssid() - set ssid
  551. * @vdev: VDEV object
  552. * @ssid: SSID (input)
  553. * @ssid_len: Length of SSID
  554. *
  555. * API to set the SSID of VDEV
  556. *
  557. * Caller need to acquire lock with wlan_vdev_obj_lock()
  558. *
  559. * Return: SUCCESS, if update is done
  560. * FAILURE, if ssid length is > max ssid len
  561. */
  562. static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
  563. struct wlan_objmgr_vdev *vdev,
  564. const uint8_t *ssid, uint8_t ssid_len)
  565. {
  566. struct vdev_mlme_obj *vdev_mlme;
  567. /* This API is invoked with lock acquired, do not add log prints */
  568. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  569. if (!vdev_mlme)
  570. return QDF_STATUS_E_FAILURE;
  571. if (ssid_len <= WLAN_SSID_MAX_LEN) {
  572. qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
  573. vdev_mlme->mgmt.generic.ssid_len = ssid_len;
  574. } else {
  575. vdev_mlme->mgmt.generic.ssid_len = 0;
  576. return QDF_STATUS_E_FAILURE;
  577. }
  578. return QDF_STATUS_SUCCESS;
  579. }
  580. /**
  581. * wlan_vdev_mlme_get_ssid() - get ssid
  582. * @vdev: VDEV object
  583. * @ssid: SSID
  584. * @ssid_len: Length of SSID
  585. *
  586. * API to get the SSID of VDEV, it updates the SSID and its length
  587. * in @ssid, @ssid_len respectively
  588. *
  589. * Caller need to acquire lock with wlan_vdev_obj_lock()
  590. *
  591. * Return: SUCCESS, if update is done
  592. * FAILURE, if ssid length is > max ssid len
  593. */
  594. static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
  595. struct wlan_objmgr_vdev *vdev,
  596. uint8_t *ssid, uint8_t *ssid_len)
  597. {
  598. struct vdev_mlme_obj *vdev_mlme;
  599. /* This API is invoked with lock acquired, do not add log prints */
  600. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  601. if (!vdev_mlme)
  602. return QDF_STATUS_E_FAILURE;
  603. if (vdev_mlme->mgmt.generic.ssid_len > 0) {
  604. *ssid_len = vdev_mlme->mgmt.generic.ssid_len;
  605. qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
  606. } else {
  607. *ssid_len = 0;
  608. return QDF_STATUS_E_FAILURE;
  609. }
  610. return QDF_STATUS_SUCCESS;
  611. }
  612. /**
  613. * wlan_vdev_mlme_set_nss() - set NSS
  614. * @vdev: VDEV object
  615. * @nss: nss configured by user
  616. *
  617. * API to set the Number of Spatial streams
  618. *
  619. * Return: void
  620. */
  621. static inline void wlan_vdev_mlme_set_nss(
  622. struct wlan_objmgr_vdev *vdev,
  623. uint8_t nss)
  624. {
  625. struct vdev_mlme_obj *vdev_mlme;
  626. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  627. if (!vdev_mlme)
  628. return;
  629. vdev_mlme->proto.generic.nss = nss;
  630. }
  631. /**
  632. * wlan_vdev_mlme_get_nss() - get NSS
  633. * @vdev: VDEV object
  634. *
  635. * API to get the Number of Spatial Streams
  636. *
  637. * Return:
  638. * @nss: nss value
  639. */
  640. static inline uint8_t wlan_vdev_mlme_get_nss(
  641. struct wlan_objmgr_vdev *vdev)
  642. {
  643. struct vdev_mlme_obj *vdev_mlme;
  644. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  645. if (!vdev_mlme)
  646. return 0;
  647. return vdev_mlme->proto.generic.nss;
  648. }
  649. /**
  650. * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
  651. * @vdev: VDEV object
  652. * @chainmask : chainmask either configured by user or max supported
  653. *
  654. * API to set the Tx chainmask
  655. *
  656. * Return: void
  657. */
  658. static inline void wlan_vdev_mlme_set_txchainmask(
  659. struct wlan_objmgr_vdev *vdev,
  660. uint8_t chainmask)
  661. {
  662. struct vdev_mlme_obj *vdev_mlme;
  663. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  664. if (!vdev_mlme)
  665. return;
  666. vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
  667. }
  668. /**
  669. * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
  670. * @vdev: VDEV object
  671. *
  672. * API to get the Tx chainmask
  673. *
  674. * Return:
  675. * @chainmask : Tx chainmask either configured by user or max supported
  676. */
  677. static inline uint8_t wlan_vdev_mlme_get_txchainmask(
  678. struct wlan_objmgr_vdev *vdev)
  679. {
  680. struct vdev_mlme_obj *vdev_mlme;
  681. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  682. if (!vdev_mlme)
  683. return 0;
  684. return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
  685. }
  686. /**
  687. * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
  688. * @vdev: VDEV object
  689. * @chainmask : Rx chainmask either configured by user or max supported
  690. *
  691. * API to set the Rx chainmask
  692. *
  693. * Return: void
  694. */
  695. static inline void wlan_vdev_mlme_set_rxchainmask(
  696. struct wlan_objmgr_vdev *vdev,
  697. uint8_t chainmask)
  698. {
  699. struct vdev_mlme_obj *vdev_mlme;
  700. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  701. if (!vdev_mlme)
  702. return;
  703. vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
  704. }
  705. /**
  706. * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
  707. * @vdev: VDEV object
  708. *
  709. * API to get the Rx chainmask
  710. *
  711. * Return:
  712. * @chainmask : Rx chainmask either configured by user or max supported
  713. */
  714. static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
  715. struct wlan_objmgr_vdev *vdev)
  716. {
  717. struct vdev_mlme_obj *vdev_mlme;
  718. /* This API is invoked with lock acquired, do not add log prints */
  719. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  720. if (!vdev_mlme)
  721. return 0;
  722. return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
  723. }
  724. /**
  725. * wlan_vdev_mlme_set_txpower() - set tx power
  726. * @vdev: VDEV object
  727. * @txpow: tx power either configured by used or max allowed
  728. *
  729. * API to set the tx power
  730. *
  731. * Return: void
  732. */
  733. static inline void wlan_vdev_mlme_set_txpower(
  734. struct wlan_objmgr_vdev *vdev,
  735. uint8_t txpow)
  736. {
  737. struct vdev_mlme_obj *vdev_mlme;
  738. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  739. if (!vdev_mlme)
  740. return;
  741. vdev_mlme->mgmt.generic.tx_power = txpow;
  742. }
  743. /**
  744. * wlan_vdev_mlme_get_txpower() - get tx power
  745. * @vdev: VDEV object
  746. *
  747. * API to get the tx power
  748. *
  749. * Return:
  750. * @txpow: tx power either configured by used or max allowed
  751. */
  752. static inline uint8_t wlan_vdev_mlme_get_txpower(
  753. struct wlan_objmgr_vdev *vdev)
  754. {
  755. struct vdev_mlme_obj *vdev_mlme;
  756. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  757. if (!vdev_mlme)
  758. return 0;
  759. return vdev_mlme->mgmt.generic.tx_power;
  760. }
  761. /**
  762. * wlan_vdev_mlme_set_maxrate() - set max rate
  763. * @vdev: VDEV object
  764. * @maxrate: configured by used or based on configured mode
  765. *
  766. * API to set the max rate the vdev supports
  767. *
  768. * Return: void
  769. */
  770. static inline void wlan_vdev_mlme_set_maxrate(
  771. struct wlan_objmgr_vdev *vdev,
  772. uint32_t maxrate)
  773. {
  774. struct vdev_mlme_obj *vdev_mlme;
  775. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  776. if (!vdev_mlme)
  777. return;
  778. vdev_mlme->mgmt.rate_info.max_rate = maxrate;
  779. }
  780. /**
  781. * wlan_vdev_mlme_get_maxrate() - get max rate
  782. * @vdev: VDEV object
  783. *
  784. * API to get the max rate the vdev supports
  785. *
  786. * Return:
  787. * @maxrate: configured by used or based on configured mode
  788. */
  789. static inline uint32_t wlan_vdev_mlme_get_maxrate(
  790. struct wlan_objmgr_vdev *vdev)
  791. {
  792. struct vdev_mlme_obj *vdev_mlme;
  793. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  794. if (!vdev_mlme)
  795. return 0;
  796. return vdev_mlme->mgmt.rate_info.max_rate;
  797. }
  798. /**
  799. * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
  800. * @vdev: VDEV object
  801. * @txmgmtrate: Tx Mgmt rate
  802. *
  803. * API to set Mgmt Tx rate
  804. *
  805. * Return: void
  806. */
  807. static inline void wlan_vdev_mlme_set_txmgmtrate(
  808. struct wlan_objmgr_vdev *vdev,
  809. uint32_t txmgmtrate)
  810. {
  811. struct vdev_mlme_obj *vdev_mlme;
  812. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  813. if (!vdev_mlme)
  814. return;
  815. vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
  816. }
  817. /**
  818. * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
  819. * @vdev: VDEV object
  820. *
  821. * API to get Mgmt Tx rate
  822. *
  823. * Return:
  824. * @txmgmtrate: Tx Mgmt rate
  825. */
  826. static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
  827. struct wlan_objmgr_vdev *vdev)
  828. {
  829. struct vdev_mlme_obj *vdev_mlme;
  830. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  831. if (!vdev_mlme)
  832. return 0;
  833. return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
  834. }
  835. /**
  836. * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev
  837. * @vdev: VDEV object
  838. *
  839. * API to check given vdev is a special vdev.
  840. *
  841. * Return: true if given vdev is special vdev, else false
  842. */
  843. static inline bool wlan_vdev_mlme_is_special_vdev(
  844. struct wlan_objmgr_vdev *vdev)
  845. {
  846. struct vdev_mlme_obj *vdev_mlme;
  847. if (!vdev)
  848. return false;
  849. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  850. if (!vdev_mlme)
  851. return false;
  852. return vdev_mlme->mgmt.generic.special_vdev_mode;
  853. }
  854. #ifdef WLAN_FEATURE_11AX
  855. /**
  856. * wlan_vdev_mlme_set_he_mcs_12_13_map() - set he mcs12/13 map
  857. * @vdev: VDEV object
  858. * @he_mcs_12_13_map: he mcs12/13 map from self&peer
  859. *
  860. * API to set he mcs 12/13 map
  861. *
  862. * Return: void
  863. */
  864. static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
  865. struct wlan_objmgr_vdev *vdev,
  866. uint16_t he_mcs_12_13_map)
  867. {
  868. struct vdev_mlme_obj *vdev_mlme;
  869. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  870. if (!vdev_mlme)
  871. return;
  872. vdev_mlme->mgmt.sta.he_mcs_12_13_map = he_mcs_12_13_map;
  873. }
  874. /**
  875. * wlan_vdev_mlme_get_he_mcs_12_13_map() - get he mcs12/13 map
  876. * @vdev: VDEV object
  877. *
  878. * API to get he mcs12/13 support capability
  879. *
  880. * Return:
  881. * @he_mcs_12_13_map: he mcs12/13 map
  882. */
  883. static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
  884. struct wlan_objmgr_vdev *vdev)
  885. {
  886. struct vdev_mlme_obj *vdev_mlme;
  887. vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
  888. if (!vdev_mlme)
  889. return 0;
  890. return vdev_mlme->mgmt.sta.he_mcs_12_13_map;
  891. }
  892. #else
  893. static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
  894. struct wlan_objmgr_vdev *vdev,
  895. uint16_t he_mcs_12_13_map)
  896. {
  897. }
  898. static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
  899. struct wlan_objmgr_vdev *vdev)
  900. {
  901. return 0;
  902. }
  903. #endif
  904. #endif