1 /*
2  * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 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 struct ml_rv_info;
32 
33 /* Requestor ID for multiple vdev restart */
34 #define MULTIPLE_VDEV_RESTART_REQ_ID 0x1234
35 
36 /* values for vdev_type */
37 #define WLAN_VDEV_MLME_TYPE_UNKNOWN   0x0
38 #define WLAN_VDEV_MLME_TYPE_AP   0x1
39 #define WLAN_VDEV_MLME_TYPE_STA  0x2
40 #define WLAN_VDEV_MLME_TYPE_IBSS 0x3
41 #define WLAN_VDEV_MLME_TYPE_MONITOR 0x4
42 #define WLAN_VDEV_MLME_TYPE_NAN 0x5
43 #define WLAN_VDEV_MLME_TYPE_OCB 0x6
44 #define WLAN_VDEV_MLME_TYPE_NDI 0x7
45 
46 /* values for vdev_subtype */
47 #define WLAN_VDEV_MLME_SUBTYPE_UNKNOWN   0x0
48 #define WLAN_VDEV_MLME_SUBTYPE_P2P_DEVICE 0x1
49 #define WLAN_VDEV_MLME_SUBTYPE_P2P_CLIENT 0x2
50 #define WLAN_VDEV_MLME_SUBTYPE_P2P_GO 0x3
51 #define WLAN_VDEV_MLME_SUBTYPE_PROXY_STA 0x4
52 #define WLAN_VDEV_MLME_SUBTYPE_MESH 0x5
53 #define WLAN_VDEV_MLME_SUBTYPE_MESH_11S   0x6
54 #define WLAN_VDEV_MLME_SUBTYPE_SMART_MONITOR 0x7
55 #define WLAN_VDEV_MLME_SUBTYPE_MLO_BRIDGE 0x8
56 
57 /* vdev control flags (per bits) */
58 #define WLAN_VDEV_MLME_FLAGS_NON_MBSSID_AP      0x00000001
59 #define WLAN_VDEV_MLME_FLAGS_TRANSMIT_AP        0x00000002
60 #define WLAN_VDEV_MLME_FLAGS_NON_TRANSMIT_AP    0x00000004
61 #define WLAN_VDEV_MLME_FLAGS_EMA_MODE           0x00000008
62 #define WLAN_VDEV_MLME_FLAGS_MBSS_CMN_PARAM     0x00000010
63 
64 /**
65  * struct vdev_mlme_proto_generic - generic mlme proto structure
66  * sent in frames
67  * @dtim_period: frequency of data transmissions per beacon 1-255
68  * @slot_time: slot time
69  * @protection_mode: rts cts protection mode
70  * @beacon_interval: beacon interval
71  * @ldpc: low density parity check value
72  * @nss: number of spatial stream
73  * @nss_2g: 2.4GHz number of spatial stream
74  * @nss_5g: 5GHz number of spatial stream
75  * @tsfadjust: adjusted timer sync value
76  */
77 struct vdev_mlme_proto_generic {
78 	uint8_t dtim_period;
79 	uint32_t slot_time;
80 	uint32_t protection_mode;
81 	uint16_t beacon_interval;
82 	uint8_t ldpc;
83 	uint8_t nss;
84 	uint8_t nss_2g;
85 	uint8_t nss_5g;
86 	uint64_t tsfadjust;
87 };
88 
89 /**
90  * struct vdev_mlme_proto_ap - ap specific mlme protocol
91  * @mapping_switch_time: Mapping switch time of T2LM
92  */
93 struct vdev_mlme_proto_ap {
94 	uint16_t mapping_switch_time;
95 };
96 
97 /**
98  * struct vdev_mlme_proto_sta - sta specific mlme protocol
99  * @assoc_id: association id of station
100  * @uapsd_cfg: uapsd configuration
101  */
102 struct vdev_mlme_proto_sta {
103 	uint16_t assoc_id;
104 	uint16_t uapsd_cfg;
105 };
106 
107 /**
108  * struct vdev_mlme_proto_bss_color - bss color cfg
109  * @flags: proposed for future use cases, currently not used.
110  * @evt_type: bss color collision event.
111  * @current_bss_color: current bss color.
112  * @detection_period_ms: scan interval for both AP and STA mode.
113  * @scan_period_ms: scan period for passive scan to detect collision.
114  * @free_slot_expiry_time_ms: FW to notify host at timer expiry after
115  *                            which Host will disable the bss color.
116  */
117 struct vdev_mlme_proto_bss_color {
118 	uint32_t flags;
119 	uint8_t  evt_type;
120 	uint32_t current_bss_color;
121 	uint32_t detection_period_ms;
122 	uint32_t scan_period_ms;
123 	uint32_t free_slot_expiry_time_ms;
124 };
125 
126 /**
127  * struct vdev_mlme_vht_info - vdev VHT information
128  * @caps: vht capabilities
129  * @subfer: su beam former capability
130  * @subfee: su beam formee capability
131  * @mubfer: mu beam former capability
132  * @mubfee: mu beam formee capability
133  * @implicit_bf: Implicit BF support
134  * @sounding_dimension: Beamformer number of sounding dimension
135  * @bfee_sts_cap: beam formee STA capability
136  * @allow_vht: vht capability status
137  */
138 struct vdev_mlme_vht_info {
139 	uint32_t caps;
140 	uint8_t  subfer;
141 	uint8_t  mubfer;
142 	uint8_t  subfee;
143 	uint8_t  mubfee;
144 	uint8_t  implicit_bf;
145 	uint8_t  sounding_dimension;
146 	uint8_t  bfee_sts_cap;
147 	bool     allow_vht;
148 };
149 
150 /**
151  * struct vdev_mlme_ht_info - vdev HT information
152  * @ht_caps: HT capabilities
153  * @allow_ht: HT capability status
154  */
155 struct vdev_mlme_ht_info {
156 	uint32_t ht_caps;
157 	bool     allow_ht;
158 };
159 
160 /**
161  * struct vdev_mlme_he_ops_info - vdev mlme HEOPS information
162  * @he_ops: he ops
163  */
164 struct vdev_mlme_he_ops_info {
165 	uint32_t he_ops;
166 };
167 
168 #ifdef WLAN_FEATURE_11BE
169 
170 /**
171  * struct vdev_mlme_eht_caps_info - vdev mlme EHT capability information
172  * @eht_maccap_epcspriaccess_support : EPCS Priority Access Supported
173  * @eht_maccap_ehtomctrl_support     : EHT OM Control Support
174  * @eht_maccap_trigtxop_sharing_mode1: Triggered TXOP Sharing mode1 Support
175  * @eht_maccap_trigtxop_sharing_mode2: Triggered TXOP Sharing mode2 Support
176  * @eht_maccap_rtwt_support          : Restricted TWT Support
177  * @eht_maccap_scs_traffic_description : SCS Traffic Description Support
178  * @eht_maccap_max_mpdu_len          : Maximum MPDU Length
179  * @eht_maccap_max_ampdu_len_exp_etn : Maximum A-MPDU Length Exponent Extension
180  * @eht_maccap_trs_support           : EHT TRS Support
181  * @eht_maccap_txop_ret_supp_in_txop_mode2: TXOP Return Support In TXOP
182  *                                          Sharing Mode 2
183  * @eht_phycap_reserved              : Reserved
184  * @eht_phycap_320mhzin6ghz          : Support For 320 MHz In 6 GHz
185  * @eht_phycap_242tonerubwlt20mhz    : Support for 242-tone RU In BW Wider Than
186  *                                     20 MHz
187  * @eht_phycap_ndp4xehtltfand320nsgi : NDP With 4. EHT-LTF And 3.2 .s GI
188  * @eht_phycap_partialbwulmu         : Partial Bandwidth UL MU-MIMO
189  * @eht_phycap_subfmr                : SU Beamformer
190  * @eht_phycap_subfme                : SU Beamformee
191  * @eht_phycap_bfmesslt80mhz         : Beamformee SS (<= 80 MHz)
192  * @eht_phycap_bfmess160mhz          : Beamformee SS (= 160 MHz)
193  * @eht_phycap_bfmess320mhz          : Beamformee SS (= 320 MHz)
194  * @eht_phycap_numsoundlt80mhz       : Number Of Sounding Dimensions (<=80 MHz)
195  * @eht_phycap_numsound160mhz        : Number Of Sounding Dimensions (=160 MHz)
196  * @eht_phycap_numsound320mhz        : Number Of Sounding Dimensions (=320 MHz)
197  * @eht_phycap_ng16sufb              : Ng = 16 SU Feedback
198  * @eht_phycap_ng16mufb              : Ng = 16 MU Feedback
199  * @eht_phycap_codbk42sufb           : Codebook Size {4,2} SU Feedback
200  * @eht_phycap_codbk75mufb           : Codebook Size {4,2} MU Feedback
201  * @eht_phycap_trigsubffb            : Triggered SU Beamforming Feedback
202  * @eht_phycap_trigmubfpartbwfb      : Triggered MU Beamforming Partial B
203  *                                     Feedback
204  * @eht_phycap_trigcqifb             : Triggered CQI Feedback
205  * @eht_phycap_partbwdlmumimo        : Partial Bandwidth DL MU-MIMO
206  * @eht_phycap_psrsr                 : PSR-Based SR Support
207  * @eht_phycap_pwrbstfactor          : Power Boost Factor Support
208  * @eht_phycap_4xehtltfand800nsgi    : EHT MU PPDU With 4xEHT-LTF And 0.8 .s GI
209  * @eht_phycap_maxnc                 : Max Nc
210  * @eht_phycap_nontrigcqifb          : Non-Triggered CQI Feedback
211  * @eht_phycap_tx1024and4096qamls242toneru : Tx 1024-QAM And 4096-QAM <
212  *                                           242-tone RU Support
213  * @eht_phycap_rx1024and4096qamls242toneru : Rx 1024-QAM And 4096-QAM <
214  *                                           242-tone RU Support
215  * @eht_phycap_ppethrespresent       : PPE Thresholds Present
216  * @eht_phycap_cmnnompktpad          : Common Nominal Packet Padding
217  * @eht_phycap_maxnumehtltf          : Maximum Number Of Supported EHT-LTFs
218  * @eht_phycap_supmcs15              : Support of MCS 15
219  * @eht_phycap_ehtdupin6ghz          : Support Of EHT DUP In 6 GHz
220  * @eht_phycap_20mhzopstarxndpwiderbw : Support For 20 MHz Operating STA
221  *                                      Receiving NDP With Wider Bandwidth
222  * @eht_phycap_nonofdmaulmumimolt80mhz : Non-OFDMA UL MU-MIMO (BW <= 80 MHz)
223  * @eht_phycap_nonofdmaulmumimo160mhz : Non-OFDMA UL MU-MIMO (BW = 160 MHz)
224  * @eht_phycap_nonofdmaulmumimo320mhz : Non-OFDMA UL MU-MIMO (BW = 320 MHz)
225  * @eht_phycap_mubfmrlt80mhz         : MU Beamformer (BW <= 80 MHz)
226  * @eht_phycap_mubfmr160mhz          : MU Beamformer (BW = 160 MHz)
227  * @eht_phycap_mubfmr320mhz          : MU Beamformer (BW = 320 MHz)
228  * @eht_phycap_tb_sounding_feedback_rl:
229  * @eht_phycap_rx1024qamwiderbwdlofdma:
230  * @eht_phycap_rx4096qamwiderbwdlofdma:
231  */
232 struct vdev_mlme_eht_caps_info {
233 	uint32_t eht_maccap_epcspriaccess_support :1,
234 		 eht_maccap_ehtomctrl_support     :1,
235 		 eht_maccap_trigtxop_sharing_mode1      :1,
236 		 eht_maccap_trigtxop_sharing_mode2      :1,
237 		 eht_maccap_rtwt_support                :1,
238 		 eht_maccap_scs_traffic_description     :1,
239 		 eht_maccap_max_mpdu_len                :2,
240 		 eht_maccap_max_ampdu_len_exp_etn       :1,
241 		 eht_maccap_trs_support                 :1,
242 		 eht_maccap_txop_ret_supp_in_txop_mode2 :1;
243 	uint32_t eht_phycap_reserved                    :1,
244 		 eht_phycap_320mhzin6ghz                :1,
245 		 eht_phycap_242tonerubwlt20mhz          :1,
246 		 eht_phycap_ndp4xehtltfand320nsgi       :1,
247 		 eht_phycap_partialbwulmu               :1,
248 		 eht_phycap_subfmr                      :1,
249 		 eht_phycap_subfme                      :1,
250 		 eht_phycap_bfmesslt80mhz               :3,
251 		 eht_phycap_bfmess160mhz                :3,
252 		 eht_phycap_bfmess320mhz                :3,
253 		 eht_phycap_numsoundlt80mhz             :3,
254 		 eht_phycap_numsound160mhz              :3,
255 		 eht_phycap_numsound320mhz              :3,
256 		 eht_phycap_ng16sufb                    :1,
257 		 eht_phycap_ng16mufb                    :1,
258 		 eht_phycap_codbk42sufb                 :1,
259 		 eht_phycap_codbk75mufb                 :1,
260 		 eht_phycap_trigsubffb                  :1,
261 		 eht_phycap_trigmubfpartbwfb            :1,
262 		 eht_phycap_trigcqifb                   :1;
263 	uint32_t eht_phycap_partbwdlmumimo              :1,
264 		 eht_phycap_psrsr                       :1,
265 		 eht_phycap_pwrbstfactor                :1,
266 		 eht_phycap_4xehtltfand800nsgi          :1,
267 		 eht_phycap_maxnc                       :4,
268 		 eht_phycap_nontrigcqifb                :1,
269 		 eht_phycap_tx1024and4096qamls242toneru :1,
270 		 eht_phycap_rx1024and4096qamls242toneru :1,
271 		 eht_phycap_ppethrespresent             :1,
272 		 eht_phycap_cmnnompktpad                :2,
273 		 eht_phycap_maxnumehtltf                :5,
274 		 eht_phycap_supmcs15                    :4,
275 		 eht_phycap_ehtdupin6ghz                :1,
276 		 eht_phycap_20mhzopstarxndpwiderbw      :1,
277 		 eht_phycap_nonofdmaulmumimolt80mhz     :1,
278 		 eht_phycap_nonofdmaulmumimo160mhz      :1,
279 		 eht_phycap_nonofdmaulmumimo320mhz      :1,
280 		 eht_phycap_mubfmrlt80mhz               :1,
281 		 eht_phycap_mubfmr160mhz                :1,
282 		 eht_phycap_mubfmr320mhz                :1,
283 		 eht_phycap_tb_sounding_feedback_rl     :1;
284 	uint32_t eht_phycap_rx1024qamwiderbwdlofdma     :1,
285 		 eht_phycap_rx4096qamwiderbwdlofdma     :1;
286 };
287 
288 /**
289  * struct vdev_mlme_eht_ops_info - vdev mlme EHTOPS information
290  * @eht_ops: eht ops
291  */
292 struct vdev_mlme_eht_ops_info {
293 	uint32_t eht_ops;
294 };
295 #endif
296 
297 /**
298  * enum mlme_vdev_dot11_mode - Dot11 mode of the vdev
299  * @MLME_VDEV_DOT11_MODE_AUTO: vdev uses mlme_dot11_mode
300  * @MLME_VDEV_DOT11_MODE_11N: vdev supports 11N mode
301  * @MLME_VDEV_DOT11_MODE_11AC: vdev supports 11AC mode
302  * @MLME_VDEV_DOT11_MODE_11AX: vdev supports 11AX mode
303  * @MLME_VDEV_DOT11_MODE_11BE: vdev supports 11BE mode
304  */
305 enum mlme_vdev_dot11_mode {
306 	MLME_VDEV_DOT11_MODE_AUTO,
307 	MLME_VDEV_DOT11_MODE_11N,
308 	MLME_VDEV_DOT11_MODE_11AC,
309 	MLME_VDEV_DOT11_MODE_11AX,
310 	MLME_VDEV_DOT11_MODE_11BE,
311 };
312 
313 /**
314  * struct vdev_mlme_proto - vdev protocol structure holding information
315  * that is used in frames
316  * @vdev_dot11_mode: supported dot11 mode
317  * @generic: generic protocol information
318  * @ap: ap specific protocol information
319  * @sta: sta specific protocol information
320  * @vht_info: vht information
321  * @ht_info: ht capabilities information
322  * @he_ops_info: he ops information
323  * @eht_cap_info: EHT capability information
324  * @eht_ops_info: EHT operation information
325  * @bss_color: 11ax HE BSS Color information
326  */
327 struct vdev_mlme_proto {
328 	enum mlme_vdev_dot11_mode vdev_dot11_mode;
329 	struct vdev_mlme_proto_generic generic;
330 	struct vdev_mlme_proto_ap ap;
331 	struct vdev_mlme_proto_sta sta;
332 	struct vdev_mlme_vht_info vht_info;
333 	struct vdev_mlme_ht_info ht_info;
334 	struct vdev_mlme_he_ops_info he_ops_info;
335 #ifdef WLAN_FEATURE_11BE
336 	struct vdev_mlme_eht_caps_info eht_cap_info;
337 	struct vdev_mlme_eht_ops_info eht_ops_info;
338 #endif
339 	struct vdev_mlme_proto_bss_color bss_color;
340 };
341 
342 /**
343  * struct vdev_mlme_mgmt_generic - generic vdev mlme mgmt cfg
344  * @rts_threshold: RTS threshold
345  * @frag_threshold: Fragmentation threshold
346  * @probe_delay: time in msec for delaying to send first probe request
347  * @repeat_probe_time: probe request transmission time
348  * @drop_unencry: drop unencrypted status
349  * @tx_pwrlimit: Tx power limit
350  * @tx_power: Tx power
351  * @minpower: Min power
352  * @maxpower: Max power
353  * @maxregpower: max regulatory power
354  * @antennamax: max antenna
355  * @reg_class_id: reg domain class id
356  * @ampdu: ampdu limit
357  * @amsdu: amsdu limit
358  * @ssid: service set identifier
359  * @ssid_len: ssid length
360  * @type: vdev type
361  * @subtype: vdev subtype
362  * @rx_decap_type: rx decap type
363  * @tx_encap_type: tx encap type
364  * @disable_hw_ack: disable ha ack flag
365  * @bssid: bssid
366  * @phy_mode: phy mode
367  * @special_vdev_mode: indicates special vdev mode
368  * @is_sap_go_moved_1st_on_csa: Indicates if STA receives
369  *				CSA to a DFS channel
370  * @he_spr_sr_ctrl:     Spatial reuse SR control
371  * @he_spr_non_srg_pd_max_offset: Non-SRG PD max offset
372  * @he_spr_srg_max_pd_offset: SRG PD max offset
373  * @he_spr_srg_min_pd_offset: SRG PD min offset
374  * @he_spr_enabled:     Spatial reuse enabled or not
375  * @he_spr_disabled_due_conc: spr disabled due to concurrency
376  * @sr_prohibit_enabled:
377  * @srg_bss_color: srg bss color
378  * @srg_partial_bssid: srg partial bssid
379  * @he_curr_non_srg_pd_threshold: current configured NON-SRG PD threshold
380  * @he_curr_srg_pd_threshold: current configured SRG PD threshold
381  * @is_pd_threshold_present: PD threshold is present in SR enable command or not
382  * @disable_fd_in_6ghz_band: Disable FD in 6 GHz if OOB discovery is enabled
383  */
384 struct vdev_mlme_mgmt_generic {
385 	uint32_t rts_threshold;
386 	uint32_t frag_threshold;
387 	uint32_t probe_delay;
388 	uint32_t repeat_probe_time;
389 	uint32_t drop_unencry;
390 	uint32_t tx_pwrlimit;
391 	uint8_t tx_power;
392 	uint8_t minpower;
393 	uint8_t maxpower;
394 	uint8_t maxregpower;
395 	uint8_t antennamax;
396 	uint8_t reg_class_id;
397 	uint16_t ampdu;
398 	uint8_t amsdu;
399 	char ssid[WLAN_SSID_MAX_LEN + 1];
400 	uint8_t ssid_len;
401 	uint8_t type;
402 	uint8_t subtype;
403 	uint8_t rx_decap_type;
404 	uint8_t tx_encap_type;
405 	bool disable_hw_ack;
406 	uint8_t bssid[QDF_MAC_ADDR_SIZE];
407 	uint32_t phy_mode;
408 	bool special_vdev_mode;
409 	bool is_sap_go_moved_1st_on_csa;
410 #ifdef WLAN_FEATURE_SR
411 	uint8_t he_spr_sr_ctrl;
412 	uint8_t he_spr_non_srg_pd_max_offset;
413 	uint8_t he_spr_srg_max_pd_offset;
414 	uint8_t he_spr_srg_min_pd_offset;
415 	bool he_spr_enabled;
416 	bool he_spr_disabled_due_conc;
417 	bool sr_prohibit_enabled;
418 	uint64_t srg_bss_color;
419 	uint64_t srg_partial_bssid;
420 	int32_t he_curr_non_srg_pd_threshold;
421 	int32_t he_curr_srg_pd_threshold;
422 	bool is_pd_threshold_present;
423 #endif
424 	bool disable_fd_in_6ghz_band;
425 };
426 
427 /**
428  * struct wlan_vdev_aid_mgr - AID manager
429  * @aid_bitmap: AID bitmap array
430  * @start_aid: start of AID index
431  * @max_aid: Max allowed AID
432  * @ref_cnt:  to share AID across VDEVs for MBSSID
433  */
434 struct wlan_vdev_aid_mgr {
435 	qdf_bitmap(aid_bitmap, WLAN_UMAC_MAX_AID);
436 	uint16_t start_aid;
437 	uint16_t max_aid;
438 	qdf_atomic_t ref_cnt;
439 };
440 
441 /**
442  * struct vdev_mlme_mgmt_ap - ap specific vdev mlme mgmt cfg
443  * @hidden_ssid: flag to indicate whether it is hidden ssid
444  * @cac_duration_ms: cac duration in milliseconds
445  * @aid_mgr: AID bitmap mgr
446  * @max_chan_switch_time: Max channel switch time in milliseconds.
447  * @last_bcn_ts_ms: Timestamp (in milliseconds) of the last beacon sent on the
448  *                  CSA triggered channel.
449  * @is_acs_mode: True if SAP is started in ACS mode
450  */
451 struct vdev_mlme_mgmt_ap {
452 	bool hidden_ssid;
453 	uint32_t cac_duration_ms;
454 	struct wlan_vdev_aid_mgr *aid_mgr;
455 	uint32_t max_chan_switch_time;
456 	unsigned long last_bcn_ts_ms;
457 	bool is_acs_mode;
458 };
459 
460 /**
461  * struct vdev_mlme_mgmt_sta - sta specific vdev mlme mgmt cfg
462  * @he_mcs_12_13_map: map to indicate mcs12/13 caps of peer&dut
463  */
464 struct vdev_mlme_mgmt_sta {
465 	uint16_t he_mcs_12_13_map;
466 };
467 
468 /**
469  * struct vdev_mlme_inactivity_params - vdev mlme inactivity parameters
470  * @bmiss_first_bcnt: bmiss first time
471  * @bmiss_final_bcnt: bmiss final time
472  * @keepalive_min_idle_inactive_time_secs: min time AP consider STA to be
473  * inactive
474  * @keepalive_max_idle_inactive_time_secs: max inactive idle time for AP to send
475  * data-null
476  * @keepalive_max_unresponsive_time_secs: max time to send WMI_STA_KICKOUT
477  */
478 struct vdev_mlme_inactivity_params {
479 	uint32_t bmiss_first_bcnt;
480 	uint32_t bmiss_final_bcnt;
481 	uint32_t keepalive_min_idle_inactive_time_secs;
482 	uint32_t keepalive_max_idle_inactive_time_secs;
483 	uint32_t keepalive_max_unresponsive_time_secs;
484 };
485 
486 /**
487  * enum vdev_ratemask_type - ratemask phy type
488  * @WLAN_VDEV_RATEMASK_TYPE_CCK: phy type CCK
489  * @WLAN_VDEV_RATEMASK_TYPE_HT: phy type ht
490  * @WLAN_VDEV_RATEMASK_TYPE_VHT: phy type vht
491  * @WLAN_VDEV_RATEMASK_TYPE_HE: phy type he
492  * @WLAN_VDEV_RATEMASK_TYPE_EHT: phy type eht
493  * @WLAN_VDEV_RATEMASK_TYPE_MAX: Maximum enumeration
494  */
495 enum vdev_ratemask_type {
496 	WLAN_VDEV_RATEMASK_TYPE_CCK,
497 	WLAN_VDEV_RATEMASK_TYPE_HT,
498 	WLAN_VDEV_RATEMASK_TYPE_VHT,
499 	WLAN_VDEV_RATEMASK_TYPE_HE,
500 	WLAN_VDEV_RATEMASK_TYPE_EHT,
501 	WLAN_VDEV_RATEMASK_TYPE_MAX,
502 };
503 
504 /**
505  * struct vdev_ratemask_params -  vdev ratemask parameters
506  * @type: ratemask phy type
507  * @lower32: ratemask lower32 bitmask
508  * @higher32: ratemask higher32 bitmask
509  * @lower32_2: ratemask lower32_2 bitmask
510  * @higher32_2: rtaemask higher32_2 bitmask
511  */
512 struct vdev_ratemask_params {
513 	uint32_t lower32;
514 	uint32_t higher32;
515 	uint32_t lower32_2;
516 	uint32_t higher32_2;
517 };
518 
519 /**
520  * struct vdev_mlme_rate_info - vdev mlme rate information
521  * @rate_flags: dynamic bandwidth info
522  * @per_band_tx_mgmt_rate: per band Tx mgmt rate
523  * @max_rate: max bandwidth rate
524  * @tx_mgmt_rate: Tx Mgmt rate
525  * @bcn_tx_rate: beacon Tx rate
526  * @bcn_tx_rate_code: beacon Tx rate code
527  * @rtscts_tx_rate: RTS/CTS Tx rate
528  * @ratemask_params: vdev ratemask params per phy type
529  * @half_rate: Half rate
530  * @quarter_rate: quarter rate
531  */
532 struct vdev_mlme_rate_info {
533 	uint32_t rate_flags;
534 	uint32_t per_band_tx_mgmt_rate;
535 	uint32_t max_rate;
536 	uint32_t tx_mgmt_rate;
537 	uint32_t bcn_tx_rate;
538 #ifdef WLAN_BCN_RATECODE_ENABLE
539 	uint32_t bcn_tx_rate_code;
540 #endif
541 	uint32_t rtscts_tx_rate;
542 	struct vdev_ratemask_params ratemask_params[
543 					WLAN_VDEV_RATEMASK_TYPE_MAX];
544 	bool     half_rate;
545 	bool     quarter_rate;
546 };
547 
548 /**
549  * struct vdev_mlme_chainmask_info - vdev mlme chainmask information
550  * @tx_chainmask: Tx chainmask
551  * @rx_chainmask: Rx Chainmask
552  * @num_rx_chain: Num of bits set in Rx chain
553  * @num_tx_chain: Num of bits set in Tx chain
554  */
555 struct vdev_mlme_chainmask_info {
556 	uint8_t tx_chainmask;
557 	uint8_t rx_chainmask;
558 	uint8_t num_rx_chain;
559 	uint8_t num_tx_chain;
560 };
561 
562 /**
563  * struct vdev_mlme_powersave_info - vdev mlme powersave information
564  * @packet_powersave: packet powersave
565  * @max_li_of_moddtim: max mod dtim
566  * @dyndtim_cnt: dynamic dtim count
567  * @listen_interval: listen interval
568  * @moddtim_cnt: mod dtim count
569  */
570 struct vdev_mlme_powersave_info {
571 	uint32_t packet_powersave;
572 	uint32_t max_li_of_moddtim;
573 	uint32_t dyndtim_cnt;
574 	uint32_t listen_interval;
575 	uint32_t moddtim_cnt;
576 };
577 
578 /**
579  * struct vdev_mlme_beacon_info - vdev mlme beacon information
580  * @beacon_buffer: buffer allocated for beacon frame
581  * @beacon_offsets: beacon IE's offsets
582  */
583 struct vdev_mlme_beacon_info {
584 	qdf_nbuf_t beacon_buffer;
585 	void *beacon_offsets;
586 };
587 
588 /**
589  * struct vdev_mlme_mbss_11ax - mbss 11ax fields required for up cmd
590  * @profile_idx: profile index of the connected non-trans ap (mbssid case).
591  *              0  means invalid.
592  * @profile_num: the total profile numbers of non-trans aps (mbssid case).
593  *              0 means non-MBSS AP.
594  * @mbssid_flags: MBSS IE flags indicating vdev type
595  * @vdevid_trans: id of transmitting vdev for MBSS IE
596  * @vdev_bmap: vdev bitmap of VAPs in MBSS group
597  * @is_cmn_param: flag to check mbss common param
598  * @trans_bssid: bssid of transmitted AP (MBSS IE case)
599  * @non_trans_bssid: bssid of non transmitted AP (MBSS IE case)
600  * @is_multi_mbssid: Flag to identify multi group mbssid support
601  * @grp_id: Group id of current vdev
602  */
603 struct vdev_mlme_mbss_11ax {
604 	uint32_t profile_idx;
605 	uint32_t profile_num;
606 	uint32_t mbssid_flags;
607 	uint8_t vdevid_trans;
608 	unsigned long vdev_bmap;
609 	bool is_cmn_param;
610 	uint8_t trans_bssid[QDF_MAC_ADDR_SIZE];
611 	uint8_t non_trans_bssid[QDF_MAC_ADDR_SIZE];
612 	bool is_multi_mbssid;
613 	uint32_t grp_id;
614 };
615 
616 /**
617  * struct vdev_mlme_mgmt - vdev mlme mgmt related cfg
618  * @generic: generic mgmt information
619  * @ap: ap specific mgmt information
620  * @sta: sta specific mgmt information
621  * @inactivity_params: inactivity parameters
622  * @rate_info: bandwidth rate information
623  * @chainmask_info: Chainmask information
624  * @powersave_info: Power save parameters
625  * @beacon_info: beacon buffer information
626  * @mbss_11ax: MBSS 11ax information
627  */
628 struct vdev_mlme_mgmt {
629 	struct vdev_mlme_mgmt_generic generic;
630 	struct vdev_mlme_mgmt_ap ap;
631 	struct vdev_mlme_mgmt_sta sta;
632 	struct vdev_mlme_inactivity_params inactivity_params;
633 	struct vdev_mlme_rate_info rate_info;
634 	struct vdev_mlme_chainmask_info chainmask_info;
635 	struct vdev_mlme_powersave_info powersave_info;
636 	struct vdev_mlme_beacon_info beacon_info;
637 	struct vdev_mlme_mbss_11ax mbss_11ax;
638 };
639 
640 /**
641  * enum beacon_update_op - Beacon update op type
642  * @BEACON_INIT:      Initialize beacon
643  * @BEACON_REINIT:    Re-initialize beacon
644  * @BEACON_UPDATE:    Update dynamic fields of beacon
645  * @BEACON_CSA:       Enable CSA IE
646  * @BEACON_FREE:      Beacon buffer free
647  */
648 enum beacon_update_op {
649 	BEACON_INIT,
650 	BEACON_REINIT,
651 	BEACON_UPDATE,
652 	BEACON_CSA,
653 	BEACON_FREE,
654 };
655 
656 /**
657  * enum vdev_cmd_type - Command type
658  * @START_REQ:      Start request
659  * @RESTART_REQ:    Restart request
660  * @STOP_REQ: STOP request
661  * @DELETE_REQ: DELETE request
662  */
663 enum vdev_cmd_type {
664 	START_REQ,
665 	RESTART_REQ,
666 	STOP_REQ,
667 	DELETE_REQ,
668 };
669 
670 /**
671  * enum vdev_start_resp_type - start respone type
672  * @START_RESPONSE:  Start response
673  * @RESTART_RESPONSE: Restart response
674  */
675 enum vdev_start_resp_type {
676 	START_RESPONSE = 0,
677 	RESTART_RESPONSE,
678 };
679 
680 /**
681  * struct vdev_mlme_ops - VDEV MLME operation callbacks structure
682  * @mlme_vdev_validate_basic_params:    callback to validate VDEV basic params
683  * @mlme_vdev_reset_proto_params:       callback to Reset protocol params
684  * @mlme_vdev_start_send:               callback to initiate actions of VDEV
685  *                                      MLME start operation
686  * @mlme_vdev_restart_send:             callback to initiate actions of VDEV
687  *                                      MLME restart operation
688  * @mlme_vdev_stop_start_send:          callback to block start/restart VDEV
689  *                                      request command
690  * @mlme_vdev_start_continue:           callback to initiate operations on
691  *                                      LMAC/FW start response
692  * @mlme_vdev_sta_conn_start:           callback to initiate STA connection
693  * @mlme_vdev_start_req_failed:
694  * @mlme_vdev_up_send:                  callback to initiate actions of VDEV
695  *                                      MLME up operation
696  * @mlme_vdev_notify_up_complete:       callback to notify VDEV MLME on moving
697  *                                      to UP state
698  * @mlme_vdev_notify_roam_start:        callback to initiate roaming
699  * @mlme_vdev_update_beacon:            callback to initiate beacon update
700  * @mlme_vdev_disconnect_peers:         callback to initiate disconnection of
701  *                                      peers
702  * @mlme_vdev_dfs_cac_timer_stop:       callback to stop the DFS CAC timer
703  * @mlme_vdev_stop_send:                callback to initiate actions of VDEV
704  *                                      MLME stop operation
705  * @mlme_vdev_stop_continue:            callback to initiate operations on
706  *                                      LMAC/FW stop response
707  * @mlme_vdev_bss_peer_delete_continue: callback to initiate operations on BSS
708  *                                      peer delete completion
709  * @mlme_vdev_down_send:                callback to initiate actions of VDEV
710  *                                      MLME down operation
711  * @mlme_vdev_notify_down_complete:
712  * @mlme_vdev_ext_stop_rsp:
713  * @mlme_vdev_ext_start_rsp:
714  * @mlme_vdev_notify_start_state_exit:  callback to notify on vdev start
715  *                                      start state exit
716  * @mlme_vdev_is_newchan_no_cac:        callback to check CAC is required
717  * @mlme_vdev_ext_peer_delete_all_rsp:  callback to initiate actions for
718  *                                      vdev mlme peer delete all response
719  * @mlme_vdev_dfs_cac_wait_notify:      callback to notify about CAC state
720  * @mlme_vdev_csa_complete:             callback to indicate CSA complete
721  * @mlme_vdev_sta_disconn_start:        callback to initiate STA disconnection
722  * @mlme_vdev_reconfig_notify:          callback to notify ml reconfing link
723  *                                      delete start operation after receive
724  *                                      the first ml reconfig IE
725  * @mlme_vdev_reconfig_timer_complete:  callback to process ml reconfing
726  *                                      operation
727  * @mlme_vdev_reconfig_notify_standby: callback to notify to process standby
728  *                                      link removal
729  * @mlme_vdev_notify_mlo_sync_wait_entry:
730  */
731 struct vdev_mlme_ops {
732 	QDF_STATUS (*mlme_vdev_validate_basic_params)(
733 				struct vdev_mlme_obj *vdev_mlme,
734 				uint16_t event_data_len, void *event_data);
735 	QDF_STATUS (*mlme_vdev_reset_proto_params)(
736 				struct vdev_mlme_obj *vdev_mlme,
737 				uint16_t event_data_len, void *event_data);
738 	QDF_STATUS (*mlme_vdev_start_send)(
739 				struct vdev_mlme_obj *vdev_mlme,
740 				uint16_t event_data_len, void *event_data);
741 	QDF_STATUS (*mlme_vdev_restart_send)(
742 				struct vdev_mlme_obj *vdev_mlme,
743 				uint16_t event_data_len, void *event_data);
744 	QDF_STATUS (*mlme_vdev_stop_start_send)(
745 				struct vdev_mlme_obj *vdev_mlme,
746 				enum vdev_cmd_type type,
747 				uint16_t event_data_len, void *event_data);
748 	QDF_STATUS (*mlme_vdev_start_continue)(
749 				struct vdev_mlme_obj *vdev_mlme,
750 				uint16_t event_data_len, void *event_data);
751 	QDF_STATUS (*mlme_vdev_sta_conn_start)(
752 				struct vdev_mlme_obj *vdev_mlme,
753 				uint16_t event_data_len, void *event_data);
754 	QDF_STATUS (*mlme_vdev_start_req_failed)(
755 				struct vdev_mlme_obj *vdev_mlme,
756 				uint16_t event_data_len, void *event_data);
757 	QDF_STATUS (*mlme_vdev_up_send)(
758 				struct vdev_mlme_obj *vdev_mlme,
759 				uint16_t event_data_len, void *event_data);
760 	QDF_STATUS (*mlme_vdev_notify_up_complete)(
761 				struct vdev_mlme_obj *vdev_mlme,
762 				uint16_t event_data_len, void *event_data);
763 	QDF_STATUS (*mlme_vdev_notify_roam_start)(
764 				struct vdev_mlme_obj *vdev_mlme,
765 				uint16_t event_data_len, void *event_data);
766 	QDF_STATUS (*mlme_vdev_update_beacon)(
767 				struct vdev_mlme_obj *vdev_mlme,
768 				enum beacon_update_op op,
769 				uint16_t event_data_len, void *event_data);
770 	QDF_STATUS (*mlme_vdev_disconnect_peers)(
771 				struct vdev_mlme_obj *vdev_mlme,
772 				uint16_t event_data_len, void *event_data,
773 				bool discon_legacy_only);
774 	QDF_STATUS (*mlme_vdev_dfs_cac_timer_stop)(
775 				struct vdev_mlme_obj *vdev_mlme,
776 				uint16_t event_data_len, void *event_data);
777 	QDF_STATUS (*mlme_vdev_stop_send)(
778 				struct vdev_mlme_obj *vdev_mlme,
779 				uint16_t event_data_len, void *event_data);
780 	QDF_STATUS (*mlme_vdev_stop_continue)(
781 				struct vdev_mlme_obj *vdev_mlme,
782 				uint16_t event_data_len, void *event_data);
783 	QDF_STATUS (*mlme_vdev_down_send)(
784 				struct vdev_mlme_obj *vdev_mlme,
785 				uint16_t event_data_len, void *event_data);
786 	QDF_STATUS (*mlme_vdev_notify_down_complete)(
787 				struct vdev_mlme_obj *vdev_mlme,
788 				uint16_t event_data_len, void *event_data);
789 	QDF_STATUS (*mlme_vdev_ext_stop_rsp)(
790 				struct vdev_mlme_obj *vdev_mlme,
791 				struct vdev_stop_response *rsp);
792 	QDF_STATUS (*mlme_vdev_ext_start_rsp)(
793 				struct vdev_mlme_obj *vdev_mlme,
794 				struct vdev_start_response *rsp);
795 	QDF_STATUS (*mlme_vdev_notify_start_state_exit)(
796 				struct vdev_mlme_obj *vdev_mlme);
797 	QDF_STATUS (*mlme_vdev_is_newchan_no_cac)(
798 				struct vdev_mlme_obj *vdev_mlme);
799 	QDF_STATUS (*mlme_vdev_ext_peer_delete_all_rsp)(
800 				struct vdev_mlme_obj *vdev_mlme,
801 				struct peer_delete_all_response *rsp);
802 	QDF_STATUS (*mlme_vdev_dfs_cac_wait_notify)(
803 				struct vdev_mlme_obj *vdev_mlme);
804 	QDF_STATUS (*mlme_vdev_csa_complete)(
805 				struct vdev_mlme_obj *vdev_mlme);
806 	QDF_STATUS (*mlme_vdev_sta_disconn_start)(
807 				struct vdev_mlme_obj *vdev_mlme,
808 				uint16_t event_data_len, void *event_data);
809 	QDF_STATUS (*mlme_vdev_reconfig_notify)(
810 				struct vdev_mlme_obj *vdev_mlme,
811 				uint16_t *tbtt_count, uint16_t bcn_int);
812 	void (*mlme_vdev_reconfig_timer_complete)(
813 				struct vdev_mlme_obj *vdev_mlme);
814 	QDF_STATUS (*mlme_vdev_reconfig_notify_standby)(
815 				struct vdev_mlme_obj *vdev_mlme,
816 				struct ml_rv_info *reconfig_info);
817 	QDF_STATUS (*mlme_vdev_notify_mlo_sync_wait_entry)(
818 				struct vdev_mlme_obj *vdev_mlme);
819 };
820 
821 /**
822  * struct vdev_mlme_obj - VDEV MLME component object
823  * @proto: VDEV MLME proto substructure
824  * @mgmt: VDEV MLME mgmt substructure
825  * @sm_lock:              VDEV SM lock
826  * @vdev_cmd_lock:        VDEV MLME command atomicity
827  * @sm_hdl:               VDEV SM handle
828  * @cnx_mgr_ctx: connection manager context, valid for STA and P2P-CLI mode only
829  * @vdev: Pointer to vdev objmgr
830  * @ops:                  VDEV MLME callback table
831  * @ext_vdev_ptr:         VDEV MLME legacy pointer
832  * @reg_tpc_obj:          Regulatory transmit power info
833  * @ml_reconfig_timer: VDEV ml reconfig timer
834  * @ml_reconfig_started:  Flag to indicate reconfig status for vdev
835  */
836 struct vdev_mlme_obj {
837 	struct vdev_mlme_proto proto;
838 	struct vdev_mlme_mgmt  mgmt;
839 #ifdef VDEV_SM_LOCK_SUPPORT
840 	qdf_spinlock_t sm_lock;
841 	qdf_mutex_t vdev_cmd_lock;
842 #endif
843 	struct wlan_sm *sm_hdl;
844 	union {
845 		struct cnx_mgr *cnx_mgr_ctx;
846 	};
847 	struct wlan_objmgr_vdev *vdev;
848 	struct vdev_mlme_ops *ops;
849 	mlme_vdev_ext_t *ext_vdev_ptr;
850 	struct reg_tpc_power_info reg_tpc_obj;
851 	qdf_timer_t ml_reconfig_timer;
852 	bool ml_reconfig_started;
853 };
854 
855 /**
856  * wlan_vdev_mlme_set_ssid() - set ssid
857  * @vdev: VDEV object
858  * @ssid: SSID (input)
859  * @ssid_len: Length of SSID
860  *
861  * API to set the SSID of VDEV
862  *
863  * Caller need to acquire lock with wlan_vdev_obj_lock()
864  *
865  * Return: QDF_STATUS_SUCCESS, if update is done
866  *         QDF_STATUS error, if ssid length is > max ssid len
867  */
wlan_vdev_mlme_set_ssid(struct wlan_objmgr_vdev * vdev,const uint8_t * ssid,uint8_t ssid_len)868 static inline QDF_STATUS wlan_vdev_mlme_set_ssid(
869 				struct wlan_objmgr_vdev *vdev,
870 				const uint8_t *ssid, uint8_t ssid_len)
871 {
872 	struct vdev_mlme_obj *vdev_mlme;
873 
874 	/* This API is invoked with lock acquired, do not add log prints */
875 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
876 	if (!vdev_mlme)
877 		return QDF_STATUS_E_FAILURE;
878 
879 	if (ssid_len <= WLAN_SSID_MAX_LEN) {
880 		qdf_mem_copy(vdev_mlme->mgmt.generic.ssid, ssid, ssid_len);
881 		vdev_mlme->mgmt.generic.ssid_len = ssid_len;
882 	} else {
883 		vdev_mlme->mgmt.generic.ssid_len = 0;
884 		return QDF_STATUS_E_FAILURE;
885 	}
886 	return QDF_STATUS_SUCCESS;
887 }
888 
889 /**
890  * wlan_vdev_mlme_get_ssid() - get ssid
891  * @vdev: VDEV object
892  * @ssid: SSID
893  * @ssid_len: Length of SSID
894  *
895  * API to get the SSID of VDEV, it updates the SSID and its length
896  * in @ssid, @ssid_len respectively
897  *
898  * Caller need to acquire lock with wlan_vdev_obj_lock()
899  *
900  * Return: SUCCESS, if update is done
901  *          FAILURE, if ssid length is > max ssid len
902  */
wlan_vdev_mlme_get_ssid(struct wlan_objmgr_vdev * vdev,uint8_t * ssid,uint8_t * ssid_len)903 static inline QDF_STATUS wlan_vdev_mlme_get_ssid(
904 				struct wlan_objmgr_vdev *vdev,
905 				 uint8_t *ssid, uint8_t *ssid_len)
906 {
907 	struct vdev_mlme_obj *vdev_mlme;
908 
909 	/* This API is invoked with lock acquired, do not add log prints */
910 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
911 	if (!vdev_mlme)
912 		return QDF_STATUS_E_FAILURE;
913 
914 	if (vdev_mlme->mgmt.generic.ssid_len > 0) {
915 		*ssid_len = vdev_mlme->mgmt.generic.ssid_len;
916 		qdf_mem_copy(ssid, vdev_mlme->mgmt.generic.ssid, *ssid_len);
917 	} else {
918 		*ssid_len = 0;
919 		return QDF_STATUS_E_FAILURE;
920 	}
921 	return QDF_STATUS_SUCCESS;
922 }
923 
924 /**
925  * wlan_vdev_mlme_set_nss() - set NSS
926  * @vdev: VDEV object
927  * @nss: nss configured by user
928  *
929  * API to set the Number of Spatial streams
930  *
931  * Return: void
932  */
wlan_vdev_mlme_set_nss(struct wlan_objmgr_vdev * vdev,uint8_t nss)933 static inline void wlan_vdev_mlme_set_nss(
934 				struct wlan_objmgr_vdev *vdev,
935 				uint8_t nss)
936 {
937 	struct vdev_mlme_obj *vdev_mlme;
938 
939 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
940 	if (!vdev_mlme)
941 		return;
942 
943 	vdev_mlme->proto.generic.nss = nss;
944 }
945 
946 /**
947  * wlan_vdev_mlme_get_nss() - get NSS
948  * @vdev: VDEV object
949  *
950  * API to get the Number of Spatial Streams
951  *
952  * Return: nss value
953  */
wlan_vdev_mlme_get_nss(struct wlan_objmgr_vdev * vdev)954 static inline uint8_t wlan_vdev_mlme_get_nss(
955 				struct wlan_objmgr_vdev *vdev)
956 {
957 	struct vdev_mlme_obj *vdev_mlme;
958 
959 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
960 	if (!vdev_mlme)
961 		return 0;
962 
963 	return vdev_mlme->proto.generic.nss;
964 }
965 
966 /**
967  * wlan_vdev_mlme_set_txchainmask() - set Tx chainmask
968  * @vdev: VDEV object
969  * @chainmask : chainmask either configured by user or max supported
970  *
971  * API to set the Tx chainmask
972  *
973  * Return: void
974  */
wlan_vdev_mlme_set_txchainmask(struct wlan_objmgr_vdev * vdev,uint8_t chainmask)975 static inline void wlan_vdev_mlme_set_txchainmask(
976 				struct wlan_objmgr_vdev *vdev,
977 				uint8_t chainmask)
978 {
979 	struct vdev_mlme_obj *vdev_mlme;
980 
981 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
982 
983 	if (!vdev_mlme)
984 		return;
985 
986 	vdev_mlme->mgmt.chainmask_info.tx_chainmask = chainmask;
987 }
988 
989 /**
990  * wlan_vdev_mlme_get_txchainmask() - get Tx chainmask
991  * @vdev: VDEV object
992  *
993  * API to get the Tx chainmask
994  *
995  * Return: Tx chainmask either configured by user or max supported
996  */
wlan_vdev_mlme_get_txchainmask(struct wlan_objmgr_vdev * vdev)997 static inline uint8_t wlan_vdev_mlme_get_txchainmask(
998 				struct wlan_objmgr_vdev *vdev)
999 {
1000 	struct vdev_mlme_obj *vdev_mlme;
1001 
1002 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1003 	if (!vdev_mlme)
1004 		return 0;
1005 
1006 	return vdev_mlme->mgmt.chainmask_info.tx_chainmask;
1007 }
1008 
1009 /**
1010  * wlan_vdev_mlme_set_rxchainmask() - set Rx chainmask
1011  * @vdev: VDEV object
1012  * @chainmask : Rx chainmask either configured by user or max supported
1013  *
1014  * API to set the Rx chainmask
1015  *
1016  * Return: void
1017  */
wlan_vdev_mlme_set_rxchainmask(struct wlan_objmgr_vdev * vdev,uint8_t chainmask)1018 static inline void wlan_vdev_mlme_set_rxchainmask(
1019 				struct wlan_objmgr_vdev *vdev,
1020 				uint8_t chainmask)
1021 {
1022 	struct vdev_mlme_obj *vdev_mlme;
1023 
1024 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1025 	if (!vdev_mlme)
1026 		return;
1027 
1028 	vdev_mlme->mgmt.chainmask_info.rx_chainmask = chainmask;
1029 }
1030 
1031 /**
1032  * wlan_vdev_mlme_get_rxchainmask() - get Rx chainmask
1033  * @vdev: VDEV object
1034  *
1035  * API to get the Rx chainmask
1036  *
1037  * Return: Rx chainmask either configured by user or max supported
1038  */
wlan_vdev_mlme_get_rxchainmask(struct wlan_objmgr_vdev * vdev)1039 static inline uint8_t wlan_vdev_mlme_get_rxchainmask(
1040 				struct wlan_objmgr_vdev *vdev)
1041 {
1042 	struct vdev_mlme_obj *vdev_mlme;
1043 
1044 	/* This API is invoked with lock acquired, do not add log prints */
1045 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1046 	if (!vdev_mlme)
1047 		return 0;
1048 
1049 	return vdev_mlme->mgmt.chainmask_info.rx_chainmask;
1050 }
1051 
1052 /**
1053  * wlan_vdev_mlme_set_txpower() - set tx power
1054  * @vdev: VDEV object
1055  * @txpow: tx power either configured by used or max allowed
1056  *
1057  * API to set the tx power
1058  *
1059  * Return: void
1060  */
wlan_vdev_mlme_set_txpower(struct wlan_objmgr_vdev * vdev,uint8_t txpow)1061 static inline void wlan_vdev_mlme_set_txpower(
1062 					struct wlan_objmgr_vdev *vdev,
1063 					uint8_t txpow)
1064 {
1065 	struct vdev_mlme_obj *vdev_mlme;
1066 
1067 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1068 	if (!vdev_mlme)
1069 		return;
1070 
1071 	vdev_mlme->mgmt.generic.tx_power = txpow;
1072 }
1073 
1074 /**
1075  * wlan_vdev_mlme_get_txpower() - get tx power
1076  * @vdev: VDEV object
1077  *
1078  * API to get the tx power
1079  *
1080  * Return: tx power either configured by used or max allowed
1081  */
wlan_vdev_mlme_get_txpower(struct wlan_objmgr_vdev * vdev)1082 static inline uint8_t wlan_vdev_mlme_get_txpower(
1083 				struct wlan_objmgr_vdev *vdev)
1084 {
1085 	struct vdev_mlme_obj *vdev_mlme;
1086 
1087 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1088 	if (!vdev_mlme)
1089 		return 0;
1090 
1091 	return vdev_mlme->mgmt.generic.tx_power;
1092 }
1093 
1094 /**
1095  * wlan_vdev_mlme_set_maxrate() - set max rate
1096  * @vdev: VDEV object
1097  * @maxrate: configured by used or based on configured mode
1098  *
1099  * API to set the max rate the vdev supports
1100  *
1101  * Return: void
1102  */
wlan_vdev_mlme_set_maxrate(struct wlan_objmgr_vdev * vdev,uint32_t maxrate)1103 static inline void wlan_vdev_mlme_set_maxrate(
1104 				struct wlan_objmgr_vdev *vdev,
1105 				uint32_t maxrate)
1106 {
1107 	struct vdev_mlme_obj *vdev_mlme;
1108 
1109 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1110 	if (!vdev_mlme)
1111 		return;
1112 
1113 	vdev_mlme->mgmt.rate_info.max_rate = maxrate;
1114 }
1115 
1116 /**
1117  * wlan_vdev_mlme_get_maxrate() - get max rate
1118  * @vdev: VDEV object
1119  *
1120  * API to get the max rate the vdev supports
1121  *
1122  * Return: configured by used or based on configured mode
1123  */
wlan_vdev_mlme_get_maxrate(struct wlan_objmgr_vdev * vdev)1124 static inline uint32_t wlan_vdev_mlme_get_maxrate(
1125 				struct wlan_objmgr_vdev *vdev)
1126 {
1127 	struct vdev_mlme_obj *vdev_mlme;
1128 
1129 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1130 	if (!vdev_mlme)
1131 		return 0;
1132 
1133 	return vdev_mlme->mgmt.rate_info.max_rate;
1134 }
1135 
1136 /**
1137  * wlan_vdev_mlme_set_txmgmtrate() - set txmgmtrate
1138  * @vdev: VDEV object
1139  * @txmgmtrate: Tx Mgmt rate
1140  *
1141  * API to set Mgmt Tx rate
1142  *
1143  * Return: void
1144  */
wlan_vdev_mlme_set_txmgmtrate(struct wlan_objmgr_vdev * vdev,uint32_t txmgmtrate)1145 static inline void wlan_vdev_mlme_set_txmgmtrate(
1146 				struct wlan_objmgr_vdev *vdev,
1147 				uint32_t txmgmtrate)
1148 {
1149 	struct vdev_mlme_obj *vdev_mlme;
1150 
1151 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1152 	if (!vdev_mlme)
1153 		return;
1154 
1155 	vdev_mlme->mgmt.rate_info.tx_mgmt_rate = txmgmtrate;
1156 }
1157 
1158 /**
1159  * wlan_vdev_mlme_get_txmgmtrate() - get txmgmtrate
1160  * @vdev: VDEV object
1161  *
1162  * API to get Mgmt Tx rate
1163  *
1164  * Return: Tx Mgmt rate
1165  */
wlan_vdev_mlme_get_txmgmtrate(struct wlan_objmgr_vdev * vdev)1166 static inline uint32_t wlan_vdev_mlme_get_txmgmtrate(
1167 				struct wlan_objmgr_vdev *vdev)
1168 {
1169 	struct vdev_mlme_obj *vdev_mlme;
1170 
1171 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1172 	if (!vdev_mlme)
1173 		return 0;
1174 
1175 	return vdev_mlme->mgmt.rate_info.tx_mgmt_rate;
1176 }
1177 
1178 /**
1179  * wlan_vdev_mlme_is_special_vdev() - check given vdev is a special vdev
1180  * @vdev: VDEV object
1181  *
1182  * API to check given vdev is a special vdev.
1183  *
1184  * Return: true if given vdev is special vdev, else false
1185  */
wlan_vdev_mlme_is_special_vdev(struct wlan_objmgr_vdev * vdev)1186 static inline bool wlan_vdev_mlme_is_special_vdev(
1187 				struct wlan_objmgr_vdev *vdev)
1188 {
1189 	struct vdev_mlme_obj *vdev_mlme;
1190 
1191 	if (!vdev)
1192 		return false;
1193 
1194 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1195 	if (!vdev_mlme)
1196 		return false;
1197 
1198 	return vdev_mlme->mgmt.generic.special_vdev_mode;
1199 }
1200 
1201 /**
1202  * wlan_vdev_mlme_is_sap_go_move_before_sta() - check if SAP / GO
1203  * moved to new channel before STA's movement upon receiving CSA
1204  *
1205  * @vdev: VDEV object
1206  *
1207  * API to check in STA+SAP/GO SCC concurrency, whether SAP / GO moved before
1208  * STA's movement on receiving CSA from peer AP to connected STA.
1209  *
1210  * Return: true if SAP / GO moved before STA else false
1211  */
1212 static inline
wlan_vdev_mlme_is_sap_go_move_before_sta(struct wlan_objmgr_vdev * vdev)1213 bool wlan_vdev_mlme_is_sap_go_move_before_sta(struct wlan_objmgr_vdev *vdev)
1214 {
1215 	struct vdev_mlme_obj *vdev_mlme;
1216 
1217 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1218 	if (!vdev_mlme)
1219 		return false;
1220 
1221 	return vdev_mlme->mgmt.generic.is_sap_go_moved_1st_on_csa;
1222 }
1223 
1224 /**
1225  * wlan_vdev_mlme_set_sap_go_move_before_sta() - Set flag if SAP / GO
1226  * moves to new channel before STA's movement upon receiving CSA
1227  *
1228  * @vdev: VDEV object
1229  * @sap_go_moved_before_sta: Flag to indicate True when SAP / GO
1230  *  moves before STA
1231  *
1232  * API to set True in STA+SAP/GO SCC concurrency, when SAP / GO moves before
1233  * STA's movement on receiving CSA from peer AP to connected STA.
1234  *
1235  * Return: void
1236  */
1237 static inline
wlan_vdev_mlme_set_sap_go_move_before_sta(struct wlan_objmgr_vdev * vdev,bool sap_go_moved_before_sta)1238 void wlan_vdev_mlme_set_sap_go_move_before_sta(struct wlan_objmgr_vdev *vdev,
1239 					       bool sap_go_moved_before_sta)
1240 {
1241 	struct vdev_mlme_obj *vdev_mlme;
1242 
1243 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1244 	if (!vdev_mlme)
1245 		return;
1246 
1247 	vdev_mlme->mgmt.generic.is_sap_go_moved_1st_on_csa =
1248 						sap_go_moved_before_sta;
1249 }
1250 
1251 #ifdef WLAN_FEATURE_11AX
1252 /**
1253  * wlan_vdev_mlme_set_he_mcs_12_13_map() - set he mcs12/13 map
1254  * @vdev: VDEV object
1255  * @he_mcs_12_13_map: he mcs12/13 map from self&peer
1256  *
1257  * API to set he mcs 12/13 map
1258  *
1259  * Return: void
1260  */
wlan_vdev_mlme_set_he_mcs_12_13_map(struct wlan_objmgr_vdev * vdev,uint16_t he_mcs_12_13_map)1261 static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
1262 				struct wlan_objmgr_vdev *vdev,
1263 				uint16_t he_mcs_12_13_map)
1264 {
1265 	struct vdev_mlme_obj *vdev_mlme;
1266 
1267 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1268 	if (!vdev_mlme)
1269 		return;
1270 
1271 	vdev_mlme->mgmt.sta.he_mcs_12_13_map = he_mcs_12_13_map;
1272 }
1273 
1274 /**
1275  * wlan_vdev_mlme_get_he_mcs_12_13_map() - get he mcs12/13 map
1276  * @vdev: VDEV object
1277  *
1278  * API to get he mcs12/13 support capability
1279  *
1280  * Return: he mcs12/13 map
1281  */
wlan_vdev_mlme_get_he_mcs_12_13_map(struct wlan_objmgr_vdev * vdev)1282 static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
1283 				struct wlan_objmgr_vdev *vdev)
1284 {
1285 	struct vdev_mlme_obj *vdev_mlme;
1286 
1287 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1288 	if (!vdev_mlme)
1289 		return 0;
1290 
1291 	return vdev_mlme->mgmt.sta.he_mcs_12_13_map;
1292 }
1293 
1294 #ifdef WLAN_FEATURE_SR
1295 /**
1296  * wlan_vdev_mlme_get_sr_ctrl() - get spatial reuse SR control
1297  * @vdev: VDEV object
1298  *
1299  * API to retrieve the spatial reuse SR control from VDEV
1300  *
1301  * Caller need to acquire lock with wlan_vdev_obj_lock()
1302  *
1303  * Return: SR control
1304  */
wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev * vdev)1305 static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
1306 {
1307 	struct vdev_mlme_obj *vdev_mlme;
1308 
1309 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1310 	if (!vdev_mlme)
1311 		return 0;
1312 
1313 	return vdev_mlme->mgmt.generic.he_spr_sr_ctrl;
1314 }
1315 
1316 /**
1317  * wlan_vdev_mlme_get_non_srg_pd_offset() - get spatial reuse non srg pd offset
1318  * @vdev: VDEV object
1319  *
1320  * API to retrieve the spatial reuse pd offset from VDEV
1321  *
1322  * Return: max non srg pd offset
1323  */
wlan_vdev_mlme_get_non_srg_pd_offset(struct wlan_objmgr_vdev * vdev)1324 static inline uint8_t wlan_vdev_mlme_get_non_srg_pd_offset(
1325 						struct wlan_objmgr_vdev *vdev)
1326 {
1327 	struct vdev_mlme_obj *vdev_mlme;
1328 
1329 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1330 	if (!vdev_mlme)
1331 		return 0;
1332 
1333 	return vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset;
1334 }
1335 
1336 /**
1337  * wlan_vdev_mlme_get_he_spr_enabled() - spatial reuse enabled or not
1338  * @vdev: VDEV object
1339  *
1340  * API to check whether the spatial reuse enabled or not
1341  *
1342  * Return: true if Spatial reuse enabled, false if not
1343  */
wlan_vdev_mlme_get_he_spr_enabled(struct wlan_objmgr_vdev * vdev)1344 static inline bool wlan_vdev_mlme_get_he_spr_enabled(
1345 						struct wlan_objmgr_vdev *vdev)
1346 {
1347 	struct vdev_mlme_obj *vdev_mlme;
1348 
1349 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1350 	if (!vdev_mlme)
1351 		return false;
1352 
1353 	return vdev_mlme->mgmt.generic.he_spr_enabled;
1354 }
1355 
1356 /**
1357  * wlan_vdev_mlme_is_sr_disable_due_conc() - spatial reuse disabled due
1358  *					     to concurrency
1359  * @vdev: VDEV object
1360  *
1361  * API to check whether the spatial reuse disabled due to concurrency or not
1362  *
1363  * Caller need to acquire lock with wlan_vdev_obj_lock()
1364  *
1365  * Return:
1366  * true/false: true if spatial reuse disabled due to concurrency else false
1367  */
1368 static inline
wlan_vdev_mlme_is_sr_disable_due_conc(struct wlan_objmgr_vdev * vdev)1369 bool wlan_vdev_mlme_is_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev)
1370 {
1371 	struct vdev_mlme_obj *vdev_mlme;
1372 
1373 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1374 	if (!vdev_mlme)
1375 		return false;
1376 
1377 	return vdev_mlme->mgmt.generic.he_spr_disabled_due_conc;
1378 }
1379 
1380 /**
1381  * wlan_vdev_mlme_is_sr_prohibit_en() - spatial reuse PD prohibit enabled
1382  *					/ disabled (HE_SIGA_Val15_Allowed)
1383  * @vdev: VDEV object
1384  *
1385  * API to check whether the spatial reuse PD prohibit is enabled / disabled
1386  *
1387  * Caller need to acquire lock with wlan_vdev_obj_lock()
1388  *
1389  * Return: true/false: Spatial reuse PD prohibit enabled / disabled
1390  */
1391 static inline
wlan_vdev_mlme_is_sr_prohibit_en(struct wlan_objmgr_vdev * vdev)1392 bool wlan_vdev_mlme_is_sr_prohibit_en(struct wlan_objmgr_vdev *vdev)
1393 {
1394 	struct vdev_mlme_obj *vdev_mlme;
1395 
1396 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1397 	if (!vdev_mlme)
1398 		return false;
1399 
1400 	return vdev_mlme->mgmt.generic.sr_prohibit_enabled;
1401 }
1402 
1403 /**
1404  * wlan_vdev_mlme_set_sr_ctrl() - set spatial reuse SR control
1405  * @vdev: VDEV object
1406  * @sr_ctrl: value to set
1407  *
1408  * API to set the spatial reuse SR control
1409  *
1410  * Caller need to acquire lock with wlan_vdev_obj_lock()
1411  *
1412  * Return: void
1413  */
wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev * vdev,uint8_t sr_ctrl)1414 static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
1415 					      uint8_t sr_ctrl)
1416 {
1417 	struct vdev_mlme_obj *vdev_mlme;
1418 
1419 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1420 	if (!vdev_mlme)
1421 		return;
1422 
1423 	vdev_mlme->mgmt.generic.he_spr_sr_ctrl = sr_ctrl;
1424 }
1425 
1426 /**
1427  * wlan_vdev_mlme_set_non_srg_pd_offset() - set spatial reuse non srg
1428  * pd max offset
1429  * @vdev: VDEV object
1430  * @non_srg_pd_max_offset: value to set
1431  *
1432  * API to set the spatial reuse pd max offset
1433  *
1434  * Return: void
1435  */
1436 static inline void
wlan_vdev_mlme_set_non_srg_pd_offset(struct wlan_objmgr_vdev * vdev,uint8_t non_srg_pd_max_offset)1437 wlan_vdev_mlme_set_non_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
1438 				     uint8_t non_srg_pd_max_offset)
1439 {
1440 	struct vdev_mlme_obj *vdev_mlme;
1441 
1442 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1443 	if (!vdev_mlme)
1444 		return;
1445 
1446 	vdev_mlme->mgmt.generic.he_spr_non_srg_pd_max_offset =
1447 						non_srg_pd_max_offset;
1448 }
1449 
1450 /**
1451  * wlan_vdev_mlme_set_he_spr_enabled() - set spatial reuse enabled
1452  * @vdev: VDEV object
1453  * @enable_he_spr: value to set
1454  *
1455  * API to set the spatial reuse enabled
1456  *
1457  * Return: void
1458  */
wlan_vdev_mlme_set_he_spr_enabled(struct wlan_objmgr_vdev * vdev,bool enable_he_spr)1459 static inline void wlan_vdev_mlme_set_he_spr_enabled(
1460 						struct wlan_objmgr_vdev *vdev,
1461 						bool enable_he_spr)
1462 {
1463 	struct vdev_mlme_obj *vdev_mlme;
1464 
1465 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1466 	if (!vdev_mlme)
1467 		return;
1468 
1469 	vdev_mlme->mgmt.generic.he_spr_enabled = enable_he_spr;
1470 }
1471 
1472 /**
1473  * wlan_vdev_mlme_set_sr_disable_due_conc() - set spatial reuse disabled due
1474  *					      to concurrency
1475  * @vdev: VDEV object
1476  * @he_spr_disabled_due_conc: value to set
1477  *
1478  * API to set the spatial reuse disabled due to concurrency
1479  *
1480  * Caller need to acquire lock with wlan_vdev_obj_lock()
1481  *
1482  * Return: void
1483  */
1484 static inline
wlan_vdev_mlme_set_sr_disable_due_conc(struct wlan_objmgr_vdev * vdev,bool he_spr_disabled_due_conc)1485 void wlan_vdev_mlme_set_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev,
1486 					    bool he_spr_disabled_due_conc)
1487 {
1488 	struct vdev_mlme_obj *vdev_mlme;
1489 
1490 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1491 	if (!vdev_mlme)
1492 		return;
1493 
1494 	vdev_mlme->mgmt.generic.he_spr_disabled_due_conc =
1495 						he_spr_disabled_due_conc;
1496 }
1497 
1498 /**
1499  * wlan_vdev_mlme_set_sr_prohibit_en() - set spatial reuse PD prohibit enabled
1500  *					 / disabled (HE_SIGA_Val15_Allowed)
1501  * @vdev: VDEV object
1502  * @sr_prohibit_enabled: True / False - PD Prohibit enabled / disabled
1503  *
1504  * API to set spatial reuse PD prohibit enabled / disabled
1505  *
1506  * Caller need to acquire lock with wlan_vdev_obj_lock()
1507  *
1508  * Return: void
1509  */
1510 static inline
wlan_vdev_mlme_set_sr_prohibit_en(struct wlan_objmgr_vdev * vdev,bool sr_prohibit_enabled)1511 void wlan_vdev_mlme_set_sr_prohibit_en(struct wlan_objmgr_vdev *vdev,
1512 				       bool sr_prohibit_enabled)
1513 {
1514 	struct vdev_mlme_obj *vdev_mlme;
1515 
1516 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1517 	if (!vdev_mlme)
1518 		return;
1519 
1520 	vdev_mlme->mgmt.generic.sr_prohibit_enabled = sr_prohibit_enabled;
1521 }
1522 
1523 /**
1524  * wlan_vdev_mlme_set_srg_pd_offset() - set spatial reuse SRG pd max/min offset
1525  * @vdev: VDEV object
1526  * @srg_max_pd_offset: SRG max pd offset
1527  * @srg_min_pd_offset: SRG min pd offset
1528  *
1529  * API to set the spatial reuse SRG pd min max offset
1530  *
1531  * Return: void
1532  */
1533 static inline
wlan_vdev_mlme_set_srg_pd_offset(struct wlan_objmgr_vdev * vdev,uint8_t srg_max_pd_offset,uint8_t srg_min_pd_offset)1534 void wlan_vdev_mlme_set_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
1535 				      uint8_t srg_max_pd_offset,
1536 				      uint8_t srg_min_pd_offset)
1537 {
1538 	struct vdev_mlme_obj *vdev_mlme;
1539 
1540 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1541 	if (!vdev_mlme)
1542 		return;
1543 
1544 	vdev_mlme->mgmt.generic.he_spr_srg_max_pd_offset = srg_max_pd_offset;
1545 	vdev_mlme->mgmt.generic.he_spr_srg_min_pd_offset = srg_min_pd_offset;
1546 }
1547 
1548 /**
1549  * wlan_vdev_mlme_get_srg_pd_offset() - get spatial reuse SRG pd min/max offset
1550  * @vdev: VDEV object
1551  * @srg_max_pd_offset: SRG max pd offset
1552  * @srg_min_pd_offset: SRG min pd offset
1553  *
1554  * API to set the spatial reuse SRG pd min max offset
1555  *
1556  * Return: void
1557  */
1558 static inline
wlan_vdev_mlme_get_srg_pd_offset(struct wlan_objmgr_vdev * vdev,uint8_t * srg_max_pd_offset,uint8_t * srg_min_pd_offset)1559 void wlan_vdev_mlme_get_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
1560 				      uint8_t *srg_max_pd_offset,
1561 				      uint8_t *srg_min_pd_offset)
1562 {
1563 	struct vdev_mlme_obj *vdev_mlme;
1564 
1565 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1566 	if (!vdev_mlme)
1567 		return;
1568 
1569 	*srg_max_pd_offset = vdev_mlme->mgmt.generic.he_spr_srg_max_pd_offset;
1570 	*srg_min_pd_offset = vdev_mlme->mgmt.generic.he_spr_srg_min_pd_offset;
1571 }
1572 
1573 /**
1574  * wlan_vdev_mlme_set_srg_bss_color_bit_map() - set spatial reuse bss
1575  *					        color bitmap
1576  * @vdev: VDEV object
1577  * @srg_bss_color: SRG BSS color bitmap
1578  *
1579  * API to set the spatial reuse bss color bit map
1580  *
1581  * Return: void
1582  */
1583 static inline
wlan_vdev_mlme_set_srg_bss_color_bit_map(struct wlan_objmgr_vdev * vdev,uint64_t srg_bss_color)1584 void wlan_vdev_mlme_set_srg_bss_color_bit_map(struct wlan_objmgr_vdev *vdev,
1585 					      uint64_t srg_bss_color)
1586 {
1587 	struct vdev_mlme_obj *vdev_mlme;
1588 
1589 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1590 	if (!vdev_mlme)
1591 		return;
1592 
1593 	vdev_mlme->mgmt.generic.srg_bss_color = srg_bss_color;
1594 }
1595 
1596 /**
1597  * wlan_vdev_mlme_set_srg_partial_bssid_bit_map() - set spatial reuse
1598  *						srg partial bitmap
1599  * @vdev: VDEV object
1600  * @srg_partial_bssid: SRG partial BSSID bitmap
1601  *
1602  * API to set the spatial reuse partial bssid bitmap
1603  *
1604  * Return: void
1605  */
1606 static inline
wlan_vdev_mlme_set_srg_partial_bssid_bit_map(struct wlan_objmgr_vdev * vdev,uint64_t srg_partial_bssid)1607 void wlan_vdev_mlme_set_srg_partial_bssid_bit_map(struct wlan_objmgr_vdev *vdev,
1608 						  uint64_t srg_partial_bssid)
1609 {
1610 	struct vdev_mlme_obj *vdev_mlme;
1611 
1612 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1613 	if (!vdev_mlme)
1614 		return;
1615 
1616 	vdev_mlme->mgmt.generic.srg_partial_bssid = srg_partial_bssid;
1617 }
1618 
1619 /**
1620  * wlan_vdev_mlme_get_srg_bss_color_bit_map() - get spatial reuse bss
1621  *						colorbitmap
1622  * @vdev: VDEV object
1623  * @srg_bss_color: SRG BSS color bitmap
1624  *
1625  * API to get the spatial reuse bss color bit map
1626  *
1627  * Return: void
1628  */
1629 static inline
wlan_vdev_mlme_get_srg_bss_color_bit_map(struct wlan_objmgr_vdev * vdev,uint64_t * srg_bss_color)1630 void wlan_vdev_mlme_get_srg_bss_color_bit_map(struct wlan_objmgr_vdev *vdev,
1631 					      uint64_t *srg_bss_color)
1632 {
1633 	struct vdev_mlme_obj *vdev_mlme;
1634 
1635 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1636 	if (!vdev_mlme)
1637 		return;
1638 
1639 	*srg_bss_color = vdev_mlme->mgmt.generic.srg_bss_color;
1640 }
1641 
1642 /**
1643  * wlan_vdev_mlme_get_srg_partial_bssid_bit_map() - get spatial reuse
1644  *						    srg partial bitmap
1645  * @vdev: VDEV object
1646  * @srg_partial_bssid: SRG partial BSSID bitmap
1647  *
1648  * API to get the spatial reuse partial bssid bitmap
1649  *
1650  * Return: void
1651  */
1652 static inline void
wlan_vdev_mlme_get_srg_partial_bssid_bit_map(struct wlan_objmgr_vdev * vdev,uint64_t * srg_partial_bssid)1653 wlan_vdev_mlme_get_srg_partial_bssid_bit_map(struct wlan_objmgr_vdev *vdev,
1654 					     uint64_t *srg_partial_bssid)
1655 {
1656 	struct vdev_mlme_obj *vdev_mlme;
1657 
1658 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1659 	if (!vdev_mlme)
1660 		return;
1661 
1662 	*srg_partial_bssid = vdev_mlme->mgmt.generic.srg_partial_bssid;
1663 }
1664 
1665 /**
1666  * wlan_vdev_mlme_get_current_non_srg_pd_threshold() - get current non srg pd
1667  * threshold
1668  * @vdev: VDEV object
1669  * @non_srg_pd_threshold: NON-SRG pd threshold
1670  *
1671  * API to get non srg pd threshold
1672  *
1673  * Return: void
1674  */
1675 static inline void
wlan_vdev_mlme_get_current_non_srg_pd_threshold(struct wlan_objmgr_vdev * vdev,int32_t * non_srg_pd_threshold)1676 wlan_vdev_mlme_get_current_non_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
1677 						int32_t *non_srg_pd_threshold)
1678 {
1679 	struct vdev_mlme_obj *vdev_mlme;
1680 
1681 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1682 	if (!vdev_mlme)
1683 		return;
1684 
1685 	*non_srg_pd_threshold =
1686 		vdev_mlme->mgmt.generic.he_curr_non_srg_pd_threshold;
1687 }
1688 
1689 /**
1690  * wlan_vdev_mlme_get_current_srg_pd_threshold() - get current srg pd threshold
1691  * @vdev: VDEV object
1692  * @srg_pd_threshold: SRG pd threshold
1693  *
1694  * API to get srg pd threshold
1695  *
1696  * Return: void
1697  */
1698 static inline void
wlan_vdev_mlme_get_current_srg_pd_threshold(struct wlan_objmgr_vdev * vdev,int32_t * srg_pd_threshold)1699 wlan_vdev_mlme_get_current_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
1700 					    int32_t *srg_pd_threshold)
1701 {
1702 	struct vdev_mlme_obj *vdev_mlme;
1703 
1704 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1705 	if (!vdev_mlme)
1706 		return;
1707 
1708 	*srg_pd_threshold =
1709 		vdev_mlme->mgmt.generic.he_curr_srg_pd_threshold;
1710 }
1711 
1712 /**
1713  * wlan_vdev_mlme_set_current_non_srg_pd_threshold() - set current non srg pd
1714  * threshold
1715  * @vdev: VDEV object
1716  * @non_srg_pd_threshold: NON-SRG pd threshold
1717  *
1718  * API to set non srg pd threshold
1719  *
1720  * Return: void
1721  */
1722 static inline void
wlan_vdev_mlme_set_current_non_srg_pd_threshold(struct wlan_objmgr_vdev * vdev,int32_t non_srg_pd_threshold)1723 wlan_vdev_mlme_set_current_non_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
1724 						int32_t non_srg_pd_threshold)
1725 {
1726 	struct vdev_mlme_obj *vdev_mlme;
1727 
1728 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1729 	if (!vdev_mlme)
1730 		return;
1731 
1732 	vdev_mlme->mgmt.generic.he_curr_non_srg_pd_threshold =
1733 						non_srg_pd_threshold;
1734 }
1735 
1736 /**
1737  * wlan_vdev_mlme_set_current_srg_pd_threshold() - set current srg pd threshold
1738  * @vdev: VDEV object
1739  * @srg_pd_threshold: SRG pd threshold
1740  *
1741  * API to set srg pd threshold
1742  *
1743  * Return: void
1744  */
1745 static inline void
wlan_vdev_mlme_set_current_srg_pd_threshold(struct wlan_objmgr_vdev * vdev,int32_t srg_pd_threshold)1746 wlan_vdev_mlme_set_current_srg_pd_threshold(struct wlan_objmgr_vdev *vdev,
1747 					    int32_t srg_pd_threshold)
1748 {
1749 	struct vdev_mlme_obj *vdev_mlme;
1750 
1751 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1752 	if (!vdev_mlme)
1753 		return;
1754 	vdev_mlme->mgmt.generic.he_curr_srg_pd_threshold =
1755 						srg_pd_threshold;
1756 }
1757 
1758 /**
1759  * wlan_vdev_mlme_set_pd_threshold_present() - set is PD threshold
1760  * present or not.
1761  * @vdev: VDEV object
1762  * @is_pd_threshold_present: is PD threshold present
1763  *
1764  * API to set pd threshold present flag
1765  *
1766  * Return: void
1767  */
1768 static inline void
wlan_vdev_mlme_set_pd_threshold_present(struct wlan_objmgr_vdev * vdev,bool is_pd_threshold_present)1769 wlan_vdev_mlme_set_pd_threshold_present(struct wlan_objmgr_vdev *vdev,
1770 					bool is_pd_threshold_present)
1771 {
1772 	struct vdev_mlme_obj *vdev_mlme;
1773 
1774 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1775 	if (!vdev_mlme)
1776 		return;
1777 	vdev_mlme->mgmt.generic.is_pd_threshold_present =
1778 						is_pd_threshold_present;
1779 }
1780 
1781 /**
1782  * wlan_vdev_mlme_get_pd_threshold_present() - get is PD threshold
1783  * present or not.
1784  * @vdev: VDEV object
1785  * @is_pd_threshold_present: is PD threshold present
1786  *
1787  * API to get pd threshold present flag
1788  *
1789  * Return: void
1790  */
1791 static inline void
wlan_vdev_mlme_get_pd_threshold_present(struct wlan_objmgr_vdev * vdev,bool * is_pd_threshold_present)1792 wlan_vdev_mlme_get_pd_threshold_present(struct wlan_objmgr_vdev *vdev,
1793 					bool *is_pd_threshold_present)
1794 {
1795 	struct vdev_mlme_obj *vdev_mlme;
1796 
1797 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1798 	if (!vdev_mlme) {
1799 		*is_pd_threshold_present = false;
1800 		return;
1801 	}
1802 	*is_pd_threshold_present =
1803 			vdev_mlme->mgmt.generic.is_pd_threshold_present;
1804 }
1805 #else
wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev * vdev)1806 static inline uint8_t wlan_vdev_mlme_get_sr_ctrl(struct wlan_objmgr_vdev *vdev)
1807 {
1808 	return 0;
1809 }
1810 
wlan_vdev_mlme_get_non_srg_pd_offset(struct wlan_objmgr_vdev * vdev)1811 static inline uint8_t wlan_vdev_mlme_get_non_srg_pd_offset(
1812 						struct wlan_objmgr_vdev *vdev)
1813 {
1814 	return 0;
1815 }
1816 
wlan_vdev_mlme_get_he_spr_enabled(struct wlan_objmgr_vdev * vdev)1817 static inline bool wlan_vdev_mlme_get_he_spr_enabled(
1818 						struct wlan_objmgr_vdev *vdev)
1819 {
1820 	return 0;
1821 }
1822 
1823 static inline
wlan_vdev_mlme_is_sr_disable_due_conc(struct wlan_objmgr_vdev * vdev)1824 bool wlan_vdev_mlme_is_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev)
1825 {
1826 	return false;
1827 }
1828 
1829 static inline
wlan_vdev_mlme_is_sr_prohibit_en(struct wlan_objmgr_vdev * vdev)1830 bool wlan_vdev_mlme_is_sr_prohibit_en(struct wlan_objmgr_vdev *vdev)
1831 {
1832 	return false;
1833 }
1834 
wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev * vdev,uint8_t sr_ctrl)1835 static inline void wlan_vdev_mlme_set_sr_ctrl(struct wlan_objmgr_vdev *vdev,
1836 					      uint8_t sr_ctrl)
1837 {
1838 }
1839 
1840 static inline void
wlan_vdev_mlme_set_non_srg_pd_offset(struct wlan_objmgr_vdev * vdev,uint8_t non_srg_pd_max_offset)1841 wlan_vdev_mlme_set_non_srg_pd_offset(struct wlan_objmgr_vdev *vdev,
1842 				     uint8_t non_srg_pd_max_offset)
1843 {
1844 }
1845 
wlan_vdev_mlme_set_he_spr_enabled(struct wlan_objmgr_vdev * vdev,bool enable_he_spr)1846 static inline void wlan_vdev_mlme_set_he_spr_enabled(
1847 						struct wlan_objmgr_vdev *vdev,
1848 						bool enable_he_spr)
1849 {
1850 }
1851 
1852 static inline
wlan_vdev_mlme_set_sr_disable_due_conc(struct wlan_objmgr_vdev * vdev,bool he_spr_disabled_due_conc)1853 void wlan_vdev_mlme_set_sr_disable_due_conc(struct wlan_objmgr_vdev *vdev,
1854 					    bool he_spr_disabled_due_conc)
1855 {
1856 }
1857 
1858 static inline
wlan_vdev_mlme_set_sr_prohibit_en(struct wlan_objmgr_vdev * vdev,bool sr_prohibit_enabled)1859 void wlan_vdev_mlme_set_sr_prohibit_en(struct wlan_objmgr_vdev *vdev,
1860 				       bool sr_prohibit_enabled)
1861 {
1862 }
1863 #endif
1864 #else
wlan_vdev_mlme_set_he_mcs_12_13_map(struct wlan_objmgr_vdev * vdev,uint16_t he_mcs_12_13_map)1865 static inline void wlan_vdev_mlme_set_he_mcs_12_13_map(
1866 				struct wlan_objmgr_vdev *vdev,
1867 				uint16_t he_mcs_12_13_map)
1868 {
1869 }
1870 
wlan_vdev_mlme_get_he_mcs_12_13_map(struct wlan_objmgr_vdev * vdev)1871 static inline uint16_t wlan_vdev_mlme_get_he_mcs_12_13_map(
1872 				struct wlan_objmgr_vdev *vdev)
1873 {
1874 	return 0;
1875 }
1876 
1877 #endif
1878 
1879 /**
1880  * wlan_vdev_mlme_set_aid_mgr() - set aid mgr
1881  * @vdev: VDEV object
1882  * @aid_mgr: AID mgr
1883  *
1884  * API to set AID mgr in VDEV MLME cmpt object
1885  *
1886  * Return: void
1887  */
wlan_vdev_mlme_set_aid_mgr(struct wlan_objmgr_vdev * vdev,struct wlan_vdev_aid_mgr * aid_mgr)1888 static inline void wlan_vdev_mlme_set_aid_mgr(
1889 				struct wlan_objmgr_vdev *vdev,
1890 				struct wlan_vdev_aid_mgr *aid_mgr)
1891 {
1892 	struct vdev_mlme_obj *vdev_mlme;
1893 
1894 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1895 	if (!vdev_mlme)
1896 		return;
1897 
1898 	vdev_mlme->mgmt.ap.aid_mgr = aid_mgr;
1899 }
1900 
1901 /**
1902  * wlan_vdev_mlme_get_aid_mgr() - get aid mgr
1903  * @vdev: VDEV object
1904  *
1905  * API to get AID mgr in VDEV MLME cmpt object
1906  *
1907  * Return: aid_mgr
1908  */
wlan_vdev_mlme_get_aid_mgr(struct wlan_objmgr_vdev * vdev)1909 static inline struct wlan_vdev_aid_mgr *wlan_vdev_mlme_get_aid_mgr(
1910 				struct wlan_objmgr_vdev *vdev)
1911 {
1912 	struct vdev_mlme_obj *vdev_mlme;
1913 
1914 	vdev_mlme = wlan_vdev_mlme_get_cmpt_obj(vdev);
1915 	if (!vdev_mlme)
1916 		return NULL;
1917 
1918 	return vdev_mlme->mgmt.ap.aid_mgr;
1919 }
1920 
1921 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
1922 /**
1923  * vdev_mgr_cdp_vdev_attach() - MLME API to attach CDP vdev
1924  * @mlme_obj: pointer to vdev_mlme_obj
1925  *
1926  * Return: QDF_STATUS - Success or Failure
1927  */
1928 QDF_STATUS vdev_mgr_cdp_vdev_attach(struct vdev_mlme_obj *mlme_obj);
1929 
1930 /**
1931  * vdev_mgr_cdp_vdev_detach() - MLME API to detach CDP vdev
1932  * @mlme_obj: pointer to vdev_mlme_obj
1933  *
1934  * Return: QDF_STATUS - Success or Failure
1935  */
1936 QDF_STATUS vdev_mgr_cdp_vdev_detach(struct vdev_mlme_obj *mlme_obj);
1937 #endif
1938 #endif
1939