xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/include/wlan_vdev_mlme.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: Define VDEV MLME structure and APIs
20  */
21 #ifndef _WLAN_VDEV_MLME_H_
22 #define _WLAN_VDEV_MLME_H_
23 
24 #include <wlan_vdev_mgr_tgt_if_rx_defs.h>
25 #include <wlan_objmgr_vdev_obj.h>
26 #include <wlan_vdev_mlme_api.h>
27 #include <wlan_ext_mlme_obj_types.h>
28 
29 struct vdev_mlme_obj;
30 struct cnx_mgr;
31 
32 /* Requestor ID for multiple vdev restart */
33 #define MULTIPLE_VDEV_RESTART_REQ_ID 0x1234
34 
35 /* values for vdev_type */
36 #define WLAN_VDEV_MLME_TYPE_UNKNOWN   0x0
37 #define WLAN_VDEV_MLME_TYPE_AP   0x1
38 #define WLAN_VDEV_MLME_TYPE_STA  0x2
39 #define WLAN_VDEV_MLME_TYPE_IBSS 0x3
40 #define WLAN_VDEV_MLME_TYPE_MONITOR 0x4
41 #define WLAN_VDEV_MLME_TYPE_NAN 0x5
42 #define WLAN_VDEV_MLME_TYPE_OCB 0x6
43 #define WLAN_VDEV_MLME_TYPE_NDI 0x7
44 
45 /* values for vdev_subtype */
46 #define WLAN_VDEV_MLME_SUBTYPE_UNKNOWN   0x0
47 #define WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE 0x1
48 #define WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT 0x2
49 #define WLAN_VDEV_MLME_SUBTYPE_P2P_GO 0x3
50 #define WLAN_VDEV_MLME_SUBTYPE_PROXY_STA 0x4
51 #define WLAN_VDEV_MLME_SUBTYPE_MESH 0x5
52 #define WLAN_VDEV_MLME_SUBTYPE_MESH_11S   0x6
53 #define WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR 0x7
54 
55 /* vdev control flags (per bits) */
56 #define WLAN_VDEV_MLME_FLAGS_NON_MBSSID_AP      0x00000001
57 #define WLAN_VDEV_MLME_FLAGS_TRANSMIT_AP        0x00000002
58 #define WLAN_VDEV_MLME_FLAGS_NON_TRANSMIT_AP    0x00000004
59 #define WLAN_VDEV_MLME_FLAGS_EMA_MODE           0x00000008
60 #define WLAN_VDEV_MLME_FLAGS_MBSS_CMN_PARAM     0x00000010
61 
62 /**
63  * struct vdev_mlme_proto_generic - generic mlme proto structure
64  * sent in frames
65  * @dtim_period: frequency of data transmissions per beacon 1-255
66  * @slot_time: slot time
67  * @protection_mode: rts cts protection mode
68  * @beacon_interval: beacon interval
69  * @ldpc: low density parity check value
70  * @nss: number of spatial stream
71  * @nss_2g: 2.4GHz number of spatial stream
72  * @nss_5g: 5GHz number of spatial stream
73  * @tsfadjust: adjusted timer sync value
74  */
75 struct vdev_mlme_proto_generic {
76 	uint8_t dtim_period;
77 	uint32_t slot_time;
78 	uint32_t protection_mode;
79 	uint16_t beacon_interval;
80 	uint8_t ldpc;
81 	uint8_t nss;
82 	uint8_t nss_2g;
83 	uint8_t nss_5g;
84 	uint64_t tsfadjust;
85 };
86 
87 /**
88  * struct vdev_mlme_proto_ap - ap specific mlme protocol
89  * @.
90  */
91 struct vdev_mlme_proto_ap {
92 };
93 
94 /**
95  * struct vdev_mlme_proto_sta - sta specific mlme protocol
96  * @assoc_id: association id of station
97  * @uapsd_cfg: uapsd configuration
98  */
99 struct vdev_mlme_proto_sta {
100 	uint16_t assoc_id;
101 	uint16_t uapsd_cfg;
102 };
103 
104 /**
105  * struct vdev_mlme_proto_bss_color - bss color cfg
106  * @flags: proposed for future use cases, currently not used.
107  * @evt_type: bss color collision event.
108  * @current_bss_color: current bss color.
109  * @detection_period_ms: scan interval for both AP and STA mode.
110  * @scan_period_ms: scan period for passive scan to detect collision.
111  * @free_slot_expiry_time_ms: FW to notify host at timer expiry after
112  *                            which Host will disable the bss color.
113  */
114 struct vdev_mlme_proto_bss_color {
115 	uint32_t flags;
116 	uint8_t  evt_type;
117 	uint32_t current_bss_color;
118 	uint32_t detection_period_ms;
119 	uint32_t scan_period_ms;
120 	uint32_t free_slot_expiry_time_ms;
121 };
122 
123 /**
124  * struct vdev_mlme_vht_info - vdev VHT information
125  * @caps: vht capabilities
126  * @subfer: su beam former capability
127  * @subfee: su beam formee capability
128  * @mubfer: mu beam former capability
129  * @mubfee: mu beam formee capability
130  * @implicit_bf: Implicit BF support
131  * @sounding_dimension: Beamformer number of sounding dimension
132  * @bfee_sts_cap: beam formee STA capability
133  * @allow_vht: vht capability status
134  */
135 struct vdev_mlme_vht_info {
136 	uint32_t caps;
137 	uint8_t  subfer;
138 	uint8_t  mubfer;
139 	uint8_t  subfee;
140 	uint8_t  mubfee;
141 	uint8_t  implicit_bf;
142 	uint8_t  sounding_dimension;
143 	uint8_t  bfee_sts_cap;
144 	bool     allow_vht;
145 };
146 
147 /**
148  * struct vdev_mlme_ht_info - vdev HT information
149  * @ht_caps: HT capabilities
150  * @allow_ht: HT capability status
151  */
152 struct vdev_mlme_ht_info {
153 	uint32_t ht_caps;
154 	bool     allow_ht;
155 };
156 
157 /**
158  * struct vdev_mlme_he_ops_info - vdev mlme HEOPS information
159  * @he_ops: he ops
160  */
161 struct vdev_mlme_he_ops_info {
162 	uint32_t he_ops;
163 };
164 
165 #ifdef WLAN_FEATURE_11BE
166 
167 /**
168  * struct vdev_mlme_eht_caps_info - vdev mlme EHT capability information
169  * @eht_maccap_epcspriaccess_support : EPCS Priority Access Supported
170  * @eht_maccap_ehtomctrl_support     : EHT OM Control Support
171  * @eht_maccap_trigtxop_sharing_mode1: Triggered TXOP Sharing mode1 Support
172  * @eht_maccap_trigtxop_sharing_mode2: Triggered TXOP Sharing mode2 Support
173  * @eht_maccap_rtwt_support          : Restricted TWT Support
174  * @eht_maccap_scs_traffic_description : SCS Traffic Description Support
175  * @eht_maccap_max_mpdu_len          : Maximum MPDU Length
176  * @eht_maccap_max_ampdu_len_exp_etn : Maximum A-MPDU Length Exponent Extension
177  * @eht_maccap_trs_support           : EHT TRS Support
178  * @eht_maccap_txop_ret_supp_in_txop_mode2: TXOP Return Support In TXOP
179  *                                          Sharing Mode 2
180  * @eht_phycap_reserved              : Reserved
181  * @eht_phycap_320mhzin6ghz          : Support For 320 MHz In 6 GHz
182  * @eht_phycap_242tonerubwlt20mhz    : Support for 242-tone RU In BW Wider Than
183  *                                     20 MHz
184  * @eht_phycap_ndp4xehtltfand320nsgi : NDP With 4. EHT-LTF And 3.2 .s GI
185  * @eht_phycap_partialbwulmu         : Partial Bandwidth UL MU-MIMO
186  * @eht_phycap_subfmr                : SU Beamformer
187  * @eht_phycap_subfme                : SU Beamformee
188  * @eht_phycap_bfmesslt80mhz         : Beamformee SS (<= 80 MHz)
189  * @eht_phycap_bfmess160mhz          : Beamformee SS (= 160 MHz)
190  * @eht_phycap_bfmess320mhz          : Beamformee SS (= 320 MHz)
191  * @eht_phycap_numsoundlt80mhz       : Number Of Sounding Dimensions (<=80 MHz)
192  * @eht_phycap_numsound160mhz        : Number Of Sounding Dimensions (=160 MHz)
193  * @eht_phycap_numsound320mhz        : Number Of Sounding Dimensions (=320 MHz)
194  * @eht_phycap_ng16sufb              : Ng = 16 SU Feedback
195  * @eht_phycap_ng16mufb              : Ng = 16 MU Feedback
196  * @eht_phycap_codbk42sufb           : Codebook Size {4,2} SU Feedback
197  * @eht_phycap_codbk75mufb           : Codebook Size {4,2} MU Feedback
198  * @eht_phycap_trigsubffb            : Triggered SU Beamforming Feedback
199  * @eht_phycap_trigmubfpartbwfb      : Triggered MU Beamforming Partial B
200  *                                     Feedback
201  * @eht_phycap_trigcqifb             : Triggered CQI Feedback
202  * @eht_phycap_partbwdlmumimo        : Partial Bandwidth DL MU-MIMO
203  * @eht_phycap_psrsr                 : PSR-Based SR Support
204  * @eht_phycap_pwrbstfactor          : Power Boost Factor Support
205  * @eht_phycap_4xehtltfand800nsgi    : EHT MU PPDU With 4xEHT-LTF And 0.8 .s GI
206  * @eht_phycap_maxnc                 : Max Nc
207  * @eht_phycap_nontrigcqifb          : Non-Triggered CQI Feedback
208  * @eht_phycap_tx1024and4096qamls242toneru : Tx 1024-QAM And 4096-QAM <
209  *                                           242-tone RU Support
210  * @eht_phycap_rx1024and4096qamls242toneru : Rx 1024-QAM And 4096-QAM <
211  *                                           242-tone RU Support
212  * @eht_phycap_ppethrespresent       : PPE Thresholds Present
213  * @eht_phycap_cmnnompktpad          : Common Nominal Packet Padding
214  * @eht_phycap_maxnumehtltf          : Maximum Number Of Supported EHT-LTFs
215  * @eht_phycap_supmcs15              : Support of MCS 15
216  * @eht_phycap_ehtdupin6ghz          : Support Of EHT DUP In 6 GHz
217  * @eht_phycap_20mhzopstarxndpwiderbw : Support For 20 MHz Operating STA
218  *                                      Receiving NDP With Wider Bandwidth
219  * @eht_phycap_nonofdmaulmumimolt80mhz : Non-OFDMA UL MU-MIMO (BW <= 80 MHz)
220  * @eht_phycap_nonofdmaulmumimo160mhz : Non-OFDMA UL MU-MIMO (BW = 160 MHz)
221  * @eht_phycap_nonofdmaulmumimo320mhz : Non-OFDMA UL MU-MIMO (BW = 320 MHz)
222  * @eht_phycap_mubfmrlt80mhz         : MU Beamformer (BW <= 80 MHz)
223  * @eht_phycap_mubfmr160mhz          : MU Beamformer (BW = 160 MHz)
224  * @eht_phycap_mubfmr320mhz          : MU Beamformer (BW = 320 MHz)
225  */
226 struct vdev_mlme_eht_caps_info {
227 	uint32_t eht_maccap_epcspriaccess_support :1,
228 		 eht_maccap_ehtomctrl_support     :1,
229 		 eht_maccap_trigtxop_sharing_mode1      :1,
230 		 eht_maccap_trigtxop_sharing_mode2      :1,
231 		 eht_maccap_rtwt_support                :1,
232 		 eht_maccap_scs_traffic_description     :1,
233 		 eht_maccap_max_mpdu_len                :2,
234 		 eht_maccap_max_ampdu_len_exp_etn       :1,
235 		 eht_maccap_trs_support                 :1,
236 		 eht_maccap_txop_ret_supp_in_txop_mode2 :1;
237 	uint32_t eht_phycap_reserved                    :1,
238 		 eht_phycap_320mhzin6ghz                :1,
239 		 eht_phycap_242tonerubwlt20mhz          :1,
240 		 eht_phycap_ndp4xehtltfand320nsgi       :1,
241 		 eht_phycap_partialbwulmu               :1,
242 		 eht_phycap_subfmr                      :1,
243 		 eht_phycap_subfme                      :1,
244 		 eht_phycap_bfmesslt80mhz               :3,
245 		 eht_phycap_bfmess160mhz                :3,
246 		 eht_phycap_bfmess320mhz                :3,
247 		 eht_phycap_numsoundlt80mhz             :3,
248 		 eht_phycap_numsound160mhz              :3,
249 		 eht_phycap_numsound320mhz              :3,
250 		 eht_phycap_ng16sufb                    :1,
251 		 eht_phycap_ng16mufb                    :1,
252 		 eht_phycap_codbk42sufb                 :1,
253 		 eht_phycap_codbk75mufb                 :1,
254 		 eht_phycap_trigsubffb                  :1,
255 		 eht_phycap_trigmubfpartbwfb            :1,
256 		 eht_phycap_trigcqifb                   :1;
257 	uint32_t eht_phycap_partbwdlmumimo              :1,
258 		 eht_phycap_psrsr                       :1,
259 		 eht_phycap_pwrbstfactor                :1,
260 		 eht_phycap_4xehtltfand800nsgi          :1,
261 		 eht_phycap_maxnc                       :4,
262 		 eht_phycap_nontrigcqifb                :1,
263 		 eht_phycap_tx1024and4096qamls242toneru :1,
264 		 eht_phycap_rx1024and4096qamls242toneru :1,
265 		 eht_phycap_ppethrespresent             :1,
266 		 eht_phycap_cmnnompktpad                :2,
267 		 eht_phycap_maxnumehtltf                :5,
268 		 eht_phycap_supmcs15                    :4,
269 		 eht_phycap_ehtdupin6ghz                :1,
270 		 eht_phycap_20mhzopstarxndpwiderbw      :1,
271 		 eht_phycap_nonofdmaulmumimolt80mhz     :1,
272 		 eht_phycap_nonofdmaulmumimo160mhz      :1,
273 		 eht_phycap_nonofdmaulmumimo320mhz      :1,
274 		 eht_phycap_mubfmrlt80mhz               :1,
275 		 eht_phycap_mubfmr160mhz                :1,
276 		 eht_phycap_mubfmr320mhz                :1,
277 		 eht_phycap_tb_sounding_feedback_rl     :1;
278 	uint32_t eht_phycap_rx1024qamwiderbwdlofdma     :1,
279 		 eht_phycap_rx4096qamwiderbwdlofdma     :1;
280 };
281 
282 /**
283  * struct vdev_mlme_eht_ops_info - vdev mlme EHTOPS information
284  * @eht_ops: eht ops
285  */
286 struct vdev_mlme_eht_ops_info {
287 	uint32_t eht_ops;
288 };
289 #endif
290 
291 /**
292  * struct vdev_mlme_he_ops_info - vdev protocol structure holding information
293  * that is used in frames
294  * @generic: generic protocol information
295  * @ap: ap specific protocol information
296  * @sta: sta specific protocol information
297  * @vht_info: vht information
298  * @ht_info: ht capabilities information
299  * @he_ops_info: he ops information
300  * @eht_cap_info: EHT capability information
301  * @eht_ops_info: EHT operation information
302  * @bss_color: 11ax HE BSS Color information
303  */
304 struct vdev_mlme_proto {
305 	struct vdev_mlme_proto_generic generic;
306 	struct vdev_mlme_proto_ap ap;
307 	struct vdev_mlme_proto_sta sta;
308 	struct vdev_mlme_vht_info vht_info;
309 	struct vdev_mlme_ht_info ht_info;
310 	struct vdev_mlme_he_ops_info he_ops_info;
311 #ifdef WLAN_FEATURE_11BE
312 	struct vdev_mlme_eht_caps_info eht_cap_info;
313 	struct vdev_mlme_eht_ops_info eht_ops_info;
314 #endif
315 	struct vdev_mlme_proto_bss_color bss_color;
316 };
317 
318 /**
319  * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg
320  * @rts_threshold: RTS threshold
321  * @frag_threshold: Fragmentation threshold
322  * @probe_delay: time in msec for delaying to send first probe request
323  * @repeat_probe_time: probe request transmission time
324  * @drop_unencry: drop unencrypted status
325  * @ tx_pwrlimit: Tx power limit
326  * @tx_power: Tx power
327  * @minpower: Min power
328  * @maxpower: Max power
329  * @maxregpower: max regulatory power
330  * @antennamax: max antenna
331  * @reg_class_id: reg domain class id
332  * @ampdu: ampdu limit
333  * @amsdu: amsdu limit
334  * @ssid: service set identifier
335  * @ssid_len: ssid length
336  * @type: vdev type
337  * @sub_type: vdev subtype
338  * @rx_decap_type: rx decap type
339  * @tx_encap_type: tx encap type
340  * @disable_hw_ack: disable ha ack flag
341  * @bssid: bssid
342  * @phy_mode: phy mode
343  * @special_vdev_mode: indicates special vdev mode
344  * @he_spr_sr_ctrl:     Spatial reuse SR control
345  * @he_spr_non_srg_pd_max_offset: Non-SRG PD max offset
346  * @he_spr_enabled:     Spatial reuse enabled or not
347  */
348 struct vdev_mlme_mgmt_generic {
349 	uint32_t rts_threshold;
350 	uint32_t frag_threshold;
351 	uint32_t probe_delay;
352 	uint32_t repeat_probe_time;
353 	uint32_t drop_unencry;
354 	uint32_t tx_pwrlimit;
355 	uint8_t tx_power;
356 	uint8_t minpower;
357 	uint8_t maxpower;
358 	uint8_t maxregpower;
359 	uint8_t antennamax;
360 	uint8_t reg_class_id;
361 	uint8_t ampdu;
362 	uint8_t amsdu;
363 	char ssid[WLAN_SSID_MAX_LEN + 1];
364 	uint8_t ssid_len;
365 	uint8_t type;
366 	uint8_t subtype;
367 	uint8_t rx_decap_type;
368 	uint8_t tx_encap_type;
369 	bool disable_hw_ack;
370 	uint8_t bssid[QDF_MAC_ADDR_SIZE];
371 	uint32_t phy_mode;
372 	bool special_vdev_mode;
373 #ifdef WLAN_FEATURE_11AX
374 	uint8_t he_spr_sr_ctrl;
375 	uint8_t he_spr_non_srg_pd_max_offset;
376 	bool he_spr_enabled;
377 #endif
378 };
379 
380 /*
381  * struct wlan_vdev_aid_mgr – AID manager
382  * @aid_bitmap: AID bitmap array
383  * @start_aid: start of AID index
384  * @max_aid: Max allowed AID
385  * @ref_cnt:  to share AID across VDEVs for MBSSID
386  */
387 struct wlan_vdev_aid_mgr {
388 	qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
389 	uint16_t start_aid;
390 	uint16_t max_aid;
391 	qdf_atomic_t ref_cnt;
392 };
393 
394 /**
395  * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
396  * @hidden_ssid: flag to indicate whether it is hidden ssid
397  * @cac_duration_ms: cac duration in millseconds
398  * @aid_mgr: AID bitmap mgr
399  * @max_chan_switch_time: Max channel switch time in milliseconds.
400  * @last_bcn_ts_ms: Timestamp (in milliseconds) of the last beacon sent on the
401  *                  CSA triggered channel.
402  */
403 struct vdev_mlme_mgmt_ap {
404 	bool hidden_ssid;
405 	uint32_t cac_duration_ms;
406 	struct wlan_vdev_aid_mgr *aid_mgr;
407 	uint32_t max_chan_switch_time;
408 	unsigned long last_bcn_ts_ms;
409 };
410 
411 /**
412  * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
413  * @he_mcs_12_13_map: map to indicate mcs12/13 caps of peer&dut
414  */
415 struct vdev_mlme_mgmt_sta {
416 	uint16_t he_mcs_12_13_map;
417 };
418 
419 /**
420  * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
421  * @bmiss_first_bcnt: bmiss first time
422  * @bmiss_final_bcnt: bmiss final time
423  * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
424  * inactive
425  * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
426  * data-null
427  * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
428  */
429 struct vdev_mlme_inactivity_params {
430 	uint32_t bmiss_first_bcnt;
431 	uint32_t bmiss_final_bcnt;
432 	uint32_t keepalive_min_idle_inactive_time_secs;
433 	uint32_t keepalive_max_idle_inactive_time_secs;
434 	uint32_t keepalive_max_unresponsive_time_secs;
435 };
436 
437 /**
438  * enum vdev_ratemask_type - ratemask phy type
439  * @WLAN_VDEV_RATEMASK_TYPE_CCK: phy type CCK
440  * @WLAN_VDEV_RATEMASK_TYPE_HT: phy type ht
441  * @WLAN_VDEV_RATEMASK_TYPE_VHT: phy type vht
442  * WLAN_VDEV_RATEMASK_TYPE_HE: phy type he
443  */
444 enum vdev_ratemask_type {
445 	WLAN_VDEV_RATEMASK_TYPE_CCK,
446 	WLAN_VDEV_RATEMASK_TYPE_HT,
447 	WLAN_VDEV_RATEMASK_TYPE_VHT,
448 	WLAN_VDEV_RATEMASK_TYPE_HE,
449 	WLAN_VDEV_RATEMASK_TYPE_MAX,
450 };
451 
452 /**
453  * struct vdev_ratemask_params -  vdev ratemask parameters
454  * @type: ratemask phy type
455  * @lower32: ratemask lower32 bitmask
456  * @higher32: ratemask higher32 bitmask
457  * @lower32_2: ratemask lower32_2 bitmask
458  * @higher32_2: rtaemask higher32_2 bitmask
459  */
460 struct vdev_ratemask_params {
461 	uint32_t lower32;
462 	uint32_t higher32;
463 	uint32_t lower32_2;
464 	uint32_t higher32_2;
465 };
466 
467 /**
468  * struct vdev_mlme_rate_info - vdev mlme rate information
469  * @rate_flags: dynamic bandwidth info
470  * @per_band_tx_mgmt_rate: per band Tx mgmt rate
471  * @max_rate: max bandwidth rate
472  * @tx_mgmt_rate: Tx Mgmt rate
473  * @bcn_tx_rate: beacon Tx rate
474  * @bcn_tx_rate_code: beacon Tx rate code
475  * @ratemask_params: vdev ratemask params per phy type
476  * @half_rate: Half rate
477  * @quarter_rate: quarter rate
478  */
479 struct vdev_mlme_rate_info {
480 	uint32_t rate_flags;
481 	uint32_t per_band_tx_mgmt_rate;
482 	uint32_t max_rate;
483 	uint32_t tx_mgmt_rate;
484 	uint32_t bcn_tx_rate;
485 #ifdef WLAN_BCN_RATECODE_ENABLE
486 	uint32_t bcn_tx_rate_code;
487 #endif
488 	uint32_t rtscts_tx_rate;
489 	struct vdev_ratemask_params ratemask_params[
490 					WLAN_VDEV_RATEMASK_TYPE_MAX];
491 	bool     half_rate;
492 	bool     quarter_rate;
493 };
494 
495 /**
496  * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
497  * @tx_chainmask: Tx chainmask
498  * @rx_chainmask: Rx Chainmask
499  * @num_rx_chain: Num of bits set in Rx chain
500  * @num_tx_chain: Num of bits set in Tx chain
501  */
502 struct vdev_mlme_chainmask_info {
503 	uint8_t tx_chainmask;
504 	uint8_t rx_chainmask;
505 	uint8_t num_rx_chain;
506 	uint8_t num_tx_chain;
507 };
508 
509 /**
510  * struct vdev_mlme_powersave_info - vdev mlme powersave information
511  * @packet_powersave: packet powersave
512  * @max_li_of_moddtim: max mod dtim
513  * @dyndtim_cnt: dynamic dtim count
514  * @listen_interval: listen interval
515  * @moddtim_cnt: mod dtim count
516  */
517 struct vdev_mlme_powersave_info {
518 	uint32_t packet_powersave;
519 	uint32_t max_li_of_moddtim;
520 	uint32_t dyndtim_cnt;
521 	uint32_t listen_interval;
522 	uint32_t moddtim_cnt;
523 };
524 
525 /**
526  * struct vdev_mlme_beacon_info - vdev mlme beacon information
527  * @beacon_buffer: buffer allocated for beacon frame
528  * @beacon_offsets: beacon IE's offsets
529  */
530 struct vdev_mlme_beacon_info {
531 	qdf_nbuf_t beacon_buffer;
532 	void *beacon_offsets;
533 };
534 
535 /**
536  * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
537  * @profile_idx: profile index of the connected non-trans ap (mbssid case).
538  *              0  means invalid.
539  * @profile_num: the total profile numbers of non-trans aps (mbssid
540  * case).
541  *              0 means non-MBSS AP.
542  * @mbssid-flags: MBSS IE flags indicating vdev type
543  * @vdevid_trans: id of transmitting vdev for MBSS IE
544  * @vdev_bmap: vdev bitmap of VAPs in MBSS group
545  * @is_cmn_param: flag to check mbss common param
546  * @trans_bssid: bssid of transmitted AP (MBSS IE case)
547  * @is_multi_mbssid: Flag to identify multi group mbssid support
548  * @grp_id: Group id of current vdev
549  */
550 struct vdev_mlme_mbss_11ax {
551 	uint32_t profile_idx;
552 	uint32_t profile_num;
553 	uint32_t mbssid_flags;
554 	uint8_t vdevid_trans;
555 	unsigned long vdev_bmap;
556 	bool is_cmn_param;
557 	uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
558 	bool is_multi_mbssid;
559 	uint32_t grp_id;
560 };
561 
562 /**
563  * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
564  * @generic: generic mgmt information
565  * @ap: ap specific mgmt information
566  * @sta: sta specific mgmt information
567  * @inactivity_params: inactivity parameters
568  * @rate_info: bandwidth rate information
569  * @chainmask_info: Chainmask information
570  * @powersave_info: Power save parameters
571  * @beacon_info: beacon buffer information
572  * @mbss_11ax: MBSS 11ax information
573  */
574 struct vdev_mlme_mgmt {
575 	struct vdev_mlme_mgmt_generic generic;
576 	struct vdev_mlme_mgmt_ap ap;
577 	struct vdev_mlme_mgmt_sta sta;
578 	struct vdev_mlme_inactivity_params inactivity_params;
579 	struct vdev_mlme_rate_info rate_info;
580 	struct vdev_mlme_chainmask_info chainmask_info;
581 	struct vdev_mlme_powersave_info powersave_info;
582 	struct vdev_mlme_beacon_info beacon_info;
583 	struct vdev_mlme_mbss_11ax mbss_11ax;
584 };
585 
586 /**
587  * enum beacon_update_op - Beacon update op type
588  * @BEACON_INIT:      Initialize beacon
589  * @BEACON_REINIT:    Re-initialize beacon
590  * @BEACON_UPDATE:    Update dynamic fields of beacon
591  * @BEACON_CSA:       Enable CSA IE
592  * @BEACON_FREE:      Beacon buffer free
593  */
594 enum beacon_update_op {
595 	BEACON_INIT,
596 	BEACON_REINIT,
597 	BEACON_UPDATE,
598 	BEACON_CSA,
599 	BEACON_FREE,
600 };
601 
602 /**
603  * enum vdev_cmd_type - Command type
604  * @START_REQ:      Start request
605  * @RESTART_REQ:    Restart request
606  * @STOP_REQ: STOP request
607  * @DELETE_REQ: DELETE request
608  */
609 enum vdev_cmd_type {
610 	START_REQ,
611 	RESTART_REQ,
612 	STOP_REQ,
613 	DELETE_REQ,
614 };
615 
616 /**
617  * enum vdev_start_resp_type - start respone type
618  * @START_RESPONSE:  Start response
619  * @RESTART_RESPONSE: Restart response
620  */
621 enum vdev_start_resp_type {
622 	START_RESPONSE = 0,
623 	RESTART_RESPONSE,
624 };
625 
626 /**
627  * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
628  * @mlme_vdev_validate_basic_params:    callback to validate VDEV basic params
629  * @mlme_vdev_reset_proto_params:       callback to Reset protocol params
630  * @mlme_vdev_start_send:               callback to initiate actions of VDEV
631  *                                      MLME start operation
632  * @mlme_vdev_restart_send:             callback to initiate actions of VDEV
633  *                                      MLME restart operation
634  * @mlme_vdev_stop_start_send:          callback to block start/restart VDEV
635  *                                      request command
636  * @mlme_vdev_start_continue:           callback to initiate operations on
637  *                                      LMAC/FW start response
638  * @mlme_vdev_sta_conn_start:           callback to initiate STA connection
639  * @mlme_vdev_up_send:                  callback to initiate actions of VDEV
640  *                                      MLME up operation
641  * @mlme_vdev_notify_up_complete:       callback to notify VDEV MLME on moving
642  *                                      to UP state
643  * @mlme_vdev_notify_roam_start:        callback to initiate roaming
644  * @mlme_vdev_update_beacon:            callback to initiate beacon update
645  * @mlme_vdev_disconnect_peers:         callback to initiate disconnection of
646  *                                      peers
647  * @mlme_vdev_dfs_cac_timer_stop:       callback to stop the DFS CAC timer
648  * @mlme_vdev_stop_send:                callback to initiate actions of VDEV
649  *                                      MLME stop operation
650  * @mlme_vdev_stop_continue:            callback to initiate operations on
651  *                                      LMAC/FW stop response
652  * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
653  *                                      peer delete completion
654  * @mlme_vdev_down_send:                callback to initiate actions of VDEV
655  *                                      MLME down operation
656  * @mlme_vdev_notify_start_state_exit:  callback to notify on vdev start
657  *                                      start state exit
658  * @mlme_vdev_is_newchan_no_cac:        callback to check CAC is required
659  * @mlme_vdev_ext_peer_delete_all_rsp:  callback to initiate actions for
660  *                                      vdev mlme peer delete all response
661  * @mlme_vdev_dfs_cac_wait_notify:      callback to notify about CAC state
662  * @mlme_vdev_csa_complete:             callback to indicate CSA complete
663  * @mlme_vdev_sta_disconn_start:        callback to initiate STA disconnection
664  */
665 struct vdev_mlme_ops {
666 	QDF_STATUS (*mlme_vdev_validate_basic_params)(
667 				struct vdev_mlme_obj *vdev_mlme,
668 				uint16_t event_data_len, void *event_data);
669 	QDF_STATUS (*mlme_vdev_reset_proto_params)(
670 				struct vdev_mlme_obj *vdev_mlme,
671 				uint16_t event_data_len, void *event_data);
672 	QDF_STATUS (*mlme_vdev_start_send)(
673 				struct vdev_mlme_obj *vdev_mlme,
674 				uint16_t event_data_len, void *event_data);
675 	QDF_STATUS (*mlme_vdev_restart_send)(
676 				struct vdev_mlme_obj *vdev_mlme,
677 				uint16_t event_data_len, void *event_data);
678 	QDF_STATUS (*mlme_vdev_stop_start_send)(
679 				struct vdev_mlme_obj *vdev_mlme,
680 				enum vdev_cmd_type type,
681 				uint16_t event_data_len, void *event_data);
682 	QDF_STATUS (*mlme_vdev_start_continue)(
683 				struct vdev_mlme_obj *vdev_mlme,
684 				uint16_t event_data_len, void *event_data);
685 	QDF_STATUS (*mlme_vdev_sta_conn_start)(
686 				struct vdev_mlme_obj *vdev_mlme,
687 				uint16_t event_data_len, void *event_data);
688 	QDF_STATUS (*mlme_vdev_start_req_failed)(
689 				struct vdev_mlme_obj *vdev_mlme,
690 				uint16_t event_data_len, void *event_data);
691 	QDF_STATUS (*mlme_vdev_up_send)(
692 				struct vdev_mlme_obj *vdev_mlme,
693 				uint16_t event_data_len, void *event_data);
694 	QDF_STATUS (*mlme_vdev_notify_up_complete)(
695 				struct vdev_mlme_obj *vdev_mlme,
696 				uint16_t event_data_len, void *event_data);
697 	QDF_STATUS (*mlme_vdev_notify_roam_start)(
698 				struct vdev_mlme_obj *vdev_mlme,
699 				uint16_t event_data_len, void *event_data);
700 	QDF_STATUS (*mlme_vdev_update_beacon)(
701 				struct vdev_mlme_obj *vdev_mlme,
702 				enum beacon_update_op op,
703 				uint16_t event_data_len, void *event_data);
704 	QDF_STATUS (*mlme_vdev_disconnect_peers)(
705 				struct vdev_mlme_obj *vdev_mlme,
706 				uint16_t event_data_len, void *event_data);
707 	QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
708 				struct vdev_mlme_obj *vdev_mlme,
709 				uint16_t event_data_len, void *event_data);
710 	QDF_STATUS (*mlme_vdev_stop_send)(
711 				struct vdev_mlme_obj *vdev_mlme,
712 				uint16_t event_data_len, void *event_data);
713 	QDF_STATUS (*mlme_vdev_stop_continue)(
714 				struct vdev_mlme_obj *vdev_mlme,
715 				uint16_t event_data_len, void *event_data);
716 	QDF_STATUS (*mlme_vdev_down_send)(
717 				struct vdev_mlme_obj *vdev_mlme,
718 				uint16_t event_data_len, void *event_data);
719 	QDF_STATUS (*mlme_vdev_notify_down_complete)(
720 				struct vdev_mlme_obj *vdev_mlme,
721 				uint16_t event_data_len, void *event_data);
722 	QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
723 				struct vdev_mlme_obj *vdev_mlme,
724 				struct vdev_stop_response *rsp);
725 	QDF_STATUS (*mlme_vdev_ext_start_rsp)(
726 				struct vdev_mlme_obj *vdev_mlme,
727 				struct vdev_start_response *rsp);
728 	QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
729 				struct vdev_mlme_obj *vdev_mlme);
730 	QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
731 				struct vdev_mlme_obj *vdev_mlme);
732 	QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
733 				struct vdev_mlme_obj *vdev_mlme,
734 				struct peer_delete_all_response *rsp);
735 	QDF_STATUS (*mlme_vdev_dfs_cac_wait_notify)(
736 				struct vdev_mlme_obj *vdev_mlme);
737 	QDF_STATUS (*mlme_vdev_csa_complete)(
738 				struct vdev_mlme_obj *vdev_mlme);
739 	QDF_STATUS (*mlme_vdev_sta_disconn_start)(
740 				struct vdev_mlme_obj *vdev_mlme,
741 				uint16_t event_data_len, void *event_data);
742 
743 };
744 
745 /**
746  * struct vdev_mlme_obj - VDEV MLME component object
747  * @proto: VDEV MLME proto substructure
748  * @mgmt: VDEV MLME mgmt substructure
749  * @sm_lock:              VDEV SM lock
750  * @vdev_cmd_lock:        VDEV MLME command atomicity
751  * @sm_hdl:               VDEV SM handle
752  * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only
753  * @vdev: Pointer to vdev objmgr
754  * @ops:                  VDEV MLME callback table
755  * @ext_vdev_ptr:         VDEV MLME legacy pointer
756  * @reg_tpc_obj:          Regulatory transmit power info
757  * @vdev_rt: VDEV response timer
758  * @vdev_wakelock:  vdev wakelock sub structure
759  */
760 struct vdev_mlme_obj {
761 	struct vdev_mlme_proto proto;
762 	struct vdev_mlme_mgmt  mgmt;
763 #ifdef VDEV_SM_LOCK_SUPPORT
764 	qdf_spinlock_t sm_lock;
765 	qdf_mutex_t vdev_cmd_lock;
766 #endif
767 	struct wlan_sm *sm_hdl;
768 	union {
769 		struct cnx_mgr *cnx_mgr_ctx;
770 	};
771 	struct wlan_objmgr_vdev *vdev;
772 	struct vdev_mlme_ops *ops;
773 	mlme_vdev_ext_t *ext_vdev_ptr;
774 	struct reg_tpc_power_info reg_tpc_obj;
775 };
776 
777 /**
778  * wlan_vdev_mlme_set_ssid() - set ssid
779  * @vdev: VDEV object
780  * @ssid: SSID (input)
781  * @ssid_len: Length of SSID
782  *
783  * API to set the SSID of VDEV
784  *
785  * Caller need to acquire lock with wlan_vdev_obj_lock()
786  *
787  * Return: SUCCESS, if update is done
788  *          FAILURE, if ssid length is > max ssid len
789  */
790 static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
791 				struct wlan_objmgr_vdev *vdev,
792 				const uint8_t *ssid, uint8_t ssid_len)
793 {
794 	struct vdev_mlme_obj *vdev_mlme;
795 
796 	/* This API is invoked with lock acquired, do not add log prints */
797 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
798 	if (!vdev_mlme)
799 		return QDF_STATUS_E_FAILURE;
800 
801 	if (ssid_len <= WLAN_SSID_MAX_LEN) {
802 		qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
803 		vdev_mlme->mgmt.generic.ssid_len = ssid_len;
804 	} else {
805 		vdev_mlme->mgmt.generic.ssid_len = 0;
806 		return QDF_STATUS_E_FAILURE;
807 	}
808 	return QDF_STATUS_SUCCESS;
809 }
810 
811 /**
812  * wlan_vdev_mlme_get_ssid() - get ssid
813  * @vdev: VDEV object
814  * @ssid: SSID
815  * @ssid_len: Length of SSID
816  *
817  * API to get the SSID of VDEV, it updates the SSID and its length
818  * in @ssid, @ssid_len respectively
819  *
820  * Caller need to acquire lock with wlan_vdev_obj_lock()
821  *
822  * Return: SUCCESS, if update is done
823  *          FAILURE, if ssid length is > max ssid len
824  */
825 static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
826 				struct wlan_objmgr_vdev *vdev,
827 				 uint8_t *ssid, uint8_t *ssid_len)
828 {
829 	struct vdev_mlme_obj *vdev_mlme;
830 
831 	/* This API is invoked with lock acquired, do not add log prints */
832 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
833 	if (!vdev_mlme)
834 		return QDF_STATUS_E_FAILURE;
835 
836 	if (vdev_mlme->mgmt.generic.ssid_len > 0) {
837 		*ssid_len = vdev_mlme->mgmt.generic.ssid_len;
838 		qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
839 	} else {
840 		*ssid_len = 0;
841 		return QDF_STATUS_E_FAILURE;
842 	}
843 	return QDF_STATUS_SUCCESS;
844 }
845 
846 /**
847  * wlan_vdev_mlme_set_nss() - set NSS
848  * @vdev: VDEV object
849  * @nss: nss configured by user
850  *
851  * API to set the Number of Spatial streams
852  *
853  * Return: void
854  */
855 static inline void wlan_vdev_mlme_set_nss(
856 				struct wlan_objmgr_vdev *vdev,
857 				uint8_t nss)
858 {
859 	struct vdev_mlme_obj *vdev_mlme;
860 
861 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
862 	if (!vdev_mlme)
863 		return;
864 
865 	vdev_mlme->proto.generic.nss = nss;
866 }
867 
868 /**
869  * wlan_vdev_mlme_get_nss() - get NSS
870  * @vdev: VDEV object
871  *
872  * API to get the Number of Spatial Streams
873  *
874  * Return:
875  * @nss: nss value
876  */
877 static inline uint8_t wlan_vdev_mlme_get_nss(
878 				struct wlan_objmgr_vdev *vdev)
879 {
880 	struct vdev_mlme_obj *vdev_mlme;
881 
882 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
883 	if (!vdev_mlme)
884 		return 0;
885 
886 	return vdev_mlme->proto.generic.nss;
887 }
888 
889 /**
890  * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
891  * @vdev: VDEV object
892  * @chainmask : chainmask either configured by user or max supported
893  *
894  * API to set the Tx chainmask
895  *
896  * Return: void
897  */
898 static inline void wlan_vdev_mlme_set_txchainmask(
899 				struct wlan_objmgr_vdev *vdev,
900 				uint8_t chainmask)
901 {
902 	struct vdev_mlme_obj *vdev_mlme;
903 
904 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
905 
906 	if (!vdev_mlme)
907 		return;
908 
909 	vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
910 }
911 
912 /**
913  * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
914  * @vdev: VDEV object
915  *
916  * API to get the Tx chainmask
917  *
918  * Return:
919  * @chainmask : Tx chainmask either configured by user or max supported
920  */
921 static inline uint8_t wlan_vdev_mlme_get_txchainmask(
922 				struct wlan_objmgr_vdev *vdev)
923 {
924 	struct vdev_mlme_obj *vdev_mlme;
925 
926 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
927 	if (!vdev_mlme)
928 		return 0;
929 
930 	return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
931 }
932 
933 /**
934  * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
935  * @vdev: VDEV object
936  * @chainmask : Rx chainmask either configured by user or max supported
937  *
938  * API to set the Rx chainmask
939  *
940  * Return: void
941  */
942 static inline void wlan_vdev_mlme_set_rxchainmask(
943 				struct wlan_objmgr_vdev *vdev,
944 				uint8_t chainmask)
945 {
946 	struct vdev_mlme_obj *vdev_mlme;
947 
948 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
949 	if (!vdev_mlme)
950 		return;
951 
952 	vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
953 }
954 
955 /**
956  * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
957  * @vdev: VDEV object
958  *
959  * API to get the Rx chainmask
960  *
961  * Return:
962  * @chainmask : Rx chainmask either configured by user or max supported
963  */
964 static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
965 				struct wlan_objmgr_vdev *vdev)
966 {
967 	struct vdev_mlme_obj *vdev_mlme;
968 
969 	/* This API is invoked with lock acquired, do not add log prints */
970 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
971 	if (!vdev_mlme)
972 		return 0;
973 
974 	return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
975 }
976 
977 /**
978  * wlan_vdev_mlme_set_txpower() - set tx power
979  * @vdev: VDEV object
980  * @txpow: tx power either configured by used or max allowed
981  *
982  * API to set the tx power
983  *
984  * Return: void
985  */
986 static inline void wlan_vdev_mlme_set_txpower(
987 					struct wlan_objmgr_vdev *vdev,
988 					uint8_t txpow)
989 {
990 	struct vdev_mlme_obj *vdev_mlme;
991 
992 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
993 	if (!vdev_mlme)
994 		return;
995 
996 	vdev_mlme->mgmt.generic.tx_power = txpow;
997 }
998 
999 /**
1000  * wlan_vdev_mlme_get_txpower() - get tx power
1001  * @vdev: VDEV object
1002  *
1003  * API to get the tx power
1004  *
1005  * Return:
1006  * @txpow: tx power either configured by used or max allowed
1007  */
1008 static inline uint8_t wlan_vdev_mlme_get_txpower(
1009 				struct wlan_objmgr_vdev *vdev)
1010 {
1011 	struct vdev_mlme_obj *vdev_mlme;
1012 
1013 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1014 	if (!vdev_mlme)
1015 		return 0;
1016 
1017 	return vdev_mlme->mgmt.generic.tx_power;
1018 }
1019 
1020 /**
1021  * wlan_vdev_mlme_set_maxrate() - set max rate
1022  * @vdev: VDEV object
1023  * @maxrate: configured by used or based on configured mode
1024  *
1025  * API to set the max rate the vdev supports
1026  *
1027  * Return: void
1028  */
1029 static inline void wlan_vdev_mlme_set_maxrate(
1030 				struct wlan_objmgr_vdev *vdev,
1031 				uint32_t maxrate)
1032 {
1033 	struct vdev_mlme_obj *vdev_mlme;
1034 
1035 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1036 	if (!vdev_mlme)
1037 		return;
1038 
1039 	vdev_mlme->mgmt.rate_info.max_rate = maxrate;
1040 }
1041 
1042 /**
1043  * wlan_vdev_mlme_get_maxrate() - get max rate
1044  * @vdev: VDEV object
1045  *
1046  * API to get the max rate the vdev supports
1047  *
1048  * Return:
1049  * @maxrate: configured by used or based on configured mode
1050  */
1051 static inline uint32_t wlan_vdev_mlme_get_maxrate(
1052 				struct wlan_objmgr_vdev *vdev)
1053 {
1054 	struct vdev_mlme_obj *vdev_mlme;
1055 
1056 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1057 	if (!vdev_mlme)
1058 		return 0;
1059 
1060 	return vdev_mlme->mgmt.rate_info.max_rate;
1061 }
1062 
1063 /**
1064  * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
1065  * @vdev: VDEV object
1066  * @txmgmtrate: Tx Mgmt rate
1067  *
1068  * API to set Mgmt Tx rate
1069  *
1070  * Return: void
1071  */
1072 static inline void wlan_vdev_mlme_set_txmgmtrate(
1073 				struct wlan_objmgr_vdev *vdev,
1074 				uint32_t txmgmtrate)
1075 {
1076 	struct vdev_mlme_obj *vdev_mlme;
1077 
1078 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1079 	if (!vdev_mlme)
1080 		return;
1081 
1082 	vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
1083 }
1084 
1085 /**
1086  * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
1087  * @vdev: VDEV object
1088  *
1089  * API to get Mgmt Tx rate
1090  *
1091  * Return:
1092  * @txmgmtrate: Tx Mgmt rate
1093  */
1094 static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
1095 				struct wlan_objmgr_vdev *vdev)
1096 {
1097 	struct vdev_mlme_obj *vdev_mlme;
1098 
1099 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1100 	if (!vdev_mlme)
1101 		return 0;
1102 
1103 	return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
1104 }
1105 
1106 /**
1107  * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev
1108  * @vdev: VDEV object
1109  *
1110  * API to check given vdev is a special vdev.
1111  *
1112  * Return: true if given vdev is special vdev, else false
1113  */
1114 static inline bool wlan_vdev_mlme_is_special_vdev(
1115 				struct wlan_objmgr_vdev *vdev)
1116 {
1117 	struct vdev_mlme_obj *vdev_mlme;
1118 
1119 	if (!vdev)
1120 		return false;
1121 
1122 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1123 	if (!vdev_mlme)
1124 		return false;
1125 
1126 	return vdev_mlme->mgmt.generic.special_vdev_mode;
1127 }
1128 
1129 #ifdef WLAN_FEATURE_11AX
1130 /**
1131  * wlan_vdev_mlme_set_he_mcs_12_13_map() - set he mcs12/13 map
1132  * @vdev: VDEV object
1133  * @he_mcs_12_13_map: he mcs12/13 map from self&peer
1134  *
1135  * API to set he mcs 12/13 map
1136  *
1137  * Return: void
1138  */
1139 static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
1140 				struct wlan_objmgr_vdev *vdev,
1141 				uint16_t he_mcs_12_13_map)
1142 {
1143 	struct vdev_mlme_obj *vdev_mlme;
1144 
1145 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1146 	if (!vdev_mlme)
1147 		return;
1148 
1149 	vdev_mlme->mgmt.sta.he_mcs_12_13_map = he_mcs_12_13_map;
1150 }
1151 
1152 /**
1153  * wlan_vdev_mlme_get_he_mcs_12_13_map() - get he mcs12/13 map
1154  * @vdev: VDEV object
1155  *
1156  * API to get he mcs12/13 support capability
1157  *
1158  * Return:
1159  * @he_mcs_12_13_map: he mcs12/13 map
1160  */
1161 static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
1162 				struct wlan_objmgr_vdev *vdev)
1163 {
1164 	struct vdev_mlme_obj *vdev_mlme;
1165 
1166 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1167 	if (!vdev_mlme)
1168 		return 0;
1169 
1170 	return vdev_mlme->mgmt.sta.he_mcs_12_13_map;
1171 }
1172 
1173 /**
1174  * wlan_vdev_mlme_get_sr_ctrl() - get spatial reuse SR control
1175  * @vdev: VDEV object
1176  *
1177  * API to retrieve the spatil reuse SR control from VDEV
1178  *
1179  * Caller need to acquire lock with wlan_vdev_obj_lock()
1180  *
1181  * Return:
1182  * @he_spr_sr_ctrl: SR control
1183  */
1184 static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
1185 {
1186 	struct vdev_mlme_obj *vdev_mlme;
1187 
1188 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1189 	if (!vdev_mlme)
1190 		return 0;
1191 
1192 	return vdev_mlme->mgmt.generic.he_spr_sr_ctrl;
1193 }
1194 
1195 /**
1196  * wlan_vdev_mlme_get_pd_offset() - get spatial reuse pd offset
1197  * @vdev: VDEV object
1198  *
1199  * API to retrieve the spatil reuse pd offset from VDEV
1200  *
1201  * Caller need to acquire lock with wlan_vdev_obj_lock()
1202  *
1203  * Return:
1204  * @he_spr_non_srg_pd_max_offset: max pd offset
1205  */
1206 static inline uint8_t wlan_vdev_mlme_get_pd_offset(
1207 						struct wlan_objmgr_vdev *vdev)
1208 {
1209 	struct vdev_mlme_obj *vdev_mlme;
1210 
1211 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1212 	if (!vdev_mlme)
1213 		return 0;
1214 
1215 	return vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset;
1216 }
1217 
1218 /**
1219  * wlan_vdev_mlme_get_he_spr_enabled() - spatial reuse enabled or not
1220  * @vdev: VDEV object
1221  *
1222  * API to check whether the spatil reuse enabled or not
1223  *
1224  * Caller need to acquire lock with wlan_vdev_obj_lock()
1225  *
1226  * Return:
1227  * @he_spr_enabled: Spatial reuse enabled or not
1228  */
1229 static inline bool wlan_vdev_mlme_get_he_spr_enabled(
1230 						struct wlan_objmgr_vdev *vdev)
1231 {
1232 	struct vdev_mlme_obj *vdev_mlme;
1233 
1234 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1235 	if (!vdev_mlme)
1236 		return false;
1237 
1238 	return vdev_mlme->mgmt.generic.he_spr_enabled;
1239 }
1240 
1241 /**
1242  * wlan_vdev_mlme_set_sr_ctrl() - set spatial reuse SR control
1243  * @vdev: VDEV object
1244  *
1245  * API to set the spatil reuse SR control
1246  *
1247  * Caller need to acquire lock with wlan_vdev_obj_lock()
1248  *
1249  * Return: void
1250  */
1251 static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
1252 					      uint8_t sr_ctrl)
1253 {
1254 	struct vdev_mlme_obj *vdev_mlme;
1255 
1256 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1257 	if (!vdev_mlme)
1258 		return;
1259 
1260 	vdev_mlme->mgmt.generic.he_spr_sr_ctrl = sr_ctrl;
1261 }
1262 
1263 /**
1264  * wlan_vdev_mlme_set_pd_offset() - set spatial reuse pd max offset
1265  * @vdev: VDEV object
1266  *
1267  * API to set the spatil reuse pd max offset
1268  *
1269  * Caller need to acquire lock with wlan_vdev_obj_lock()
1270  *
1271  * Return: void
1272  */
1273 static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
1274 						uint8_t pd_max_offset)
1275 {
1276 	struct vdev_mlme_obj *vdev_mlme;
1277 
1278 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1279 	if (!vdev_mlme)
1280 		return;
1281 
1282 	vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset = pd_max_offset;
1283 }
1284 
1285 /**
1286  * wlan_vdev_mlme_set_he_spr_enabled() - set spatial reuse enabled
1287  * @vdev: VDEV object
1288  *
1289  * API to set the spatil reuse enabled
1290  *
1291  * Caller need to acquire lock with wlan_vdev_obj_lock()
1292  *
1293  * Return: void
1294  */
1295 static inline void wlan_vdev_mlme_set_he_spr_enabled(
1296 						struct wlan_objmgr_vdev *vdev,
1297 						bool enable_he_spr)
1298 {
1299 	struct vdev_mlme_obj *vdev_mlme;
1300 
1301 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1302 	if (!vdev_mlme)
1303 		return;
1304 
1305 	vdev_mlme->mgmt.generic.he_spr_enabled = enable_he_spr;
1306 }
1307 #else
1308 static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
1309 				struct wlan_objmgr_vdev *vdev,
1310 				uint16_t he_mcs_12_13_map)
1311 {
1312 }
1313 
1314 static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
1315 				struct wlan_objmgr_vdev *vdev)
1316 {
1317 	return 0;
1318 }
1319 
1320 static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
1321 {
1322 	return 0;
1323 }
1324 
1325 static inline uint8_t wlan_vdev_mlme_get_pd_offset(
1326 						struct wlan_objmgr_vdev *vdev)
1327 {
1328 	return 0;
1329 }
1330 
1331 static inline bool wlan_vdev_mlme_get_he_spr_enabled(
1332 						struct wlan_objmgr_vdev *vdev)
1333 {
1334 	return 0;
1335 }
1336 
1337 static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
1338 					      uint8_t sr_ctrl)
1339 {
1340 }
1341 
1342 static inline void wlan_vdev_mlme_set_pd_offset(struct wlan_objmgr_vdev *vdev,
1343 						uint8_t pd_max_offset)
1344 {
1345 }
1346 
1347 static inline void wlan_vdev_mlme_set_he_spr_enabled(
1348 						struct wlan_objmgr_vdev *vdev,
1349 						bool enable_he_spr)
1350 {
1351 }
1352 #endif
1353 
1354 /**
1355  * wlan_vdev_mlme_set_aid_mgr() - set aid mgr
1356  * @vdev: VDEV object
1357  * @aid_mgr: AID mgr
1358  *
1359  * API to set AID mgr in VDEV MLME cmpt object
1360  *
1361  * Return: void
1362  */
1363 static inline void wlan_vdev_mlme_set_aid_mgr(
1364 				struct wlan_objmgr_vdev *vdev,
1365 				struct wlan_vdev_aid_mgr *aid_mgr)
1366 {
1367 	struct vdev_mlme_obj *vdev_mlme;
1368 
1369 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1370 	if (!vdev_mlme)
1371 		return;
1372 
1373 	vdev_mlme->mgmt.ap.aid_mgr = aid_mgr;
1374 }
1375 
1376 /**
1377  * wlan_vdev_mlme_get_aid_mgr() - get aid mgr
1378  * @vdev: VDEV object
1379  *
1380  * API to get AID mgr in VDEV MLME cmpt object
1381  *
1382  * Return: aid_mgr
1383  */
1384 static inline struct wlan_vdev_aid_mgr *wlan_vdev_mlme_get_aid_mgr(
1385 				struct wlan_objmgr_vdev *vdev)
1386 {
1387 	struct vdev_mlme_obj *vdev_mlme;
1388 
1389 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1390 	if (!vdev_mlme)
1391 		return NULL;
1392 
1393 	return vdev_mlme->mgmt.ap.aid_mgr;
1394 }
1395 
1396 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
1397 /**
1398  * vdev_mgr_cdp_vdev_attach() - MLME API to attach CDP vdev
1399  * @mlme_obj: pointer to vdev_mlme_obj
1400  *
1401  * Return: QDF_STATUS - Success or Failure
1402  */
1403 QDF_STATUS vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj *mlme_obj);
1404 
1405 /**
1406  * vdev_mgr_cdp_vdev_detach() - MLME API to detach CDP vdev
1407  * @mlme_obj: pointer to vdev_mlme_obj
1408  *
1409  * Return: QDF_STATUS - Success or Failure
1410  */
1411 QDF_STATUS vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj *mlme_obj);
1412 #endif
1413 #endif
1414