wlan_vdev_mlme.h 28 KB

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