xref: /wlan-driver/qcacld-3.0/core/sme/inc/csr_internal.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2011-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 /**
21  *   \file csr_internal.h
22  *
23  *   Define internal data structure for MAC.
24  */
25 #ifndef CSRINTERNAL_H__
26 #define CSRINTERNAL_H__
27 
28 #include "qdf_status.h"
29 #include "qdf_lock.h"
30 
31 #include "qdf_mc_timer.h"
32 #include "csr_support.h"
33 #include "cds_reg_service.h"
34 #include "wlan_scan_public_structs.h"
35 #include "wlan_cm_roam_api.h"
36 #include "sir_types.h"
37 #include "wlan_mlme_public_struct.h"
38 
39 /* No of sessions to be supported, and a session is for Infra, BT-AMP */
40 #define CSR_IS_SESSION_VALID(mac, sessionId) \
41 	((sessionId) < WLAN_MAX_VDEVS && \
42 	 (mac != NULL) && \
43 	 ((mac)->roam.roamSession != NULL) && \
44 	 (mac)->roam.roamSession[(sessionId)].sessionActive)
45 
46 #define CSR_GET_SESSION(mac, sessionId) \
47 	(sessionId < WLAN_MAX_VDEVS ? \
48 	 &(mac)->roam.roamSession[(sessionId)] : NULL)
49 
50 #define CSR_IS_SESSION_ANY(sessionId) (sessionId == SME_SESSION_ID_ANY)
51 #define CSR_IS_DFS_CH_ROAM_ALLOWED(mac_ctx) \
52 	( \
53 	  ((((mac_ctx)->mlme_cfg->lfr.roaming_dfs_channel) != \
54 	    ROAMING_DFS_CHANNEL_DISABLED) ? true : false) \
55 	)
56 #define CSR_IS_ROAM_PREFER_5GHZ(mac)	\
57 	( \
58 	  ((mac)->mlme_cfg->lfr.roam_prefer_5ghz) \
59 	)
60 
61 /* Used to determine what to set to the MLME_DOT11_MODE */
62 enum csr_cfgdot11mode {
63 	eCSR_CFG_DOT11_MODE_ABG,
64 	eCSR_CFG_DOT11_MODE_11A,
65 	eCSR_CFG_DOT11_MODE_11B,
66 	eCSR_CFG_DOT11_MODE_11G,
67 	eCSR_CFG_DOT11_MODE_11N,
68 	eCSR_CFG_DOT11_MODE_11AC,
69 	eCSR_CFG_DOT11_MODE_11G_ONLY,
70 	eCSR_CFG_DOT11_MODE_11N_ONLY,
71 	eCSR_CFG_DOT11_MODE_11AC_ONLY,
72 	/* This value can never set to CFG. Its for CSR's internal use */
73 	eCSR_CFG_DOT11_MODE_AUTO,
74 	eCSR_CFG_DOT11_MODE_11AX,
75 	eCSR_CFG_DOT11_MODE_11AX_ONLY,
76 	eCSR_CFG_DOT11_MODE_11BE,
77 	eCSR_CFG_DOT11_MODE_11BE_ONLY,
78 	eCSR_CFG_DOT11_MODE_MAX,
79 };
80 
81 enum csr_roam_reason {
82 	eCsrForcedDisassocSta = 1,
83 	eCsrForcedDeauthSta,
84 };
85 
86 enum csr_roam_substate {
87 	eCSR_ROAM_SUBSTATE_NONE = 0,
88 	eCSR_ROAM_SUBSTATE_START_BSS_REQ,
89 	eCSR_ROAM_SUBSTATE_DISASSOC_REQ,
90 	eCSR_ROAM_SUBSTATE_STOP_BSS_REQ,
91 	eCSR_ROAM_SUBSTATE_DEAUTH_REQ,
92 	eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY,
93 	/*  max is 15 unless the bitfield is expanded... */
94 };
95 
96 enum csr_roam_state {
97 	eCSR_ROAMING_STATE_STOP = 0,
98 	eCSR_ROAMING_STATE_IDLE,
99 	eCSR_ROAMING_STATE_JOINING,
100 	eCSR_ROAMING_STATE_JOINED,
101 };
102 
103 enum csr_join_state {
104 	eCsrContinueRoaming,
105 	eCsrStopRoaming,
106 };
107 
108 enum csr_roam_wmstatus_changetypes {
109 	eCsrDisassociated,
110 	eCsrDeauthenticated
111 };
112 
113 struct csr_channel {
114 	uint8_t numChannels;
115 	uint32_t channel_freq_list[CFG_VALID_CHANNEL_LIST_LEN];
116 };
117 
118 struct roam_cmd {
119 	enum csr_roam_reason roamReason;
120 	tSirMacAddr peerMac;
121 	struct qdf_mac_addr peer_mld_addr;
122 	enum wlan_reason_code reason;
123 };
124 
125 struct wmstatus_changecmd {
126 	enum csr_roam_wmstatus_changetypes Type;
127 	union {
128 		struct deauth_ind DeauthIndMsg;
129 		struct disassoc_ind DisassocIndMsg;
130 	} u;
131 
132 };
133 
134 struct csr_config {
135 	uint32_t channelBondingMode24GHz;
136 	uint32_t channelBondingMode5GHz;
137 	eCsrPhyMode phyMode;
138 	enum csr_cfgdot11mode uCfgDot11Mode;
139 	uint32_t HeartbeatThresh50;
140 	enum wmm_user_mode WMMSupportMode;
141 	bool Is11eSupportEnabled;
142 	bool ProprietaryRatesEnabled;
143 	bool fenableMCCMode;
144 	bool mcc_rts_cts_prot_enable;
145 	bool mcc_bcast_prob_resp_enable;
146 	uint8_t fAllowMCCGODiffBI;
147 	uint32_t nVhtChannelWidth;
148 	bool send_smps_action;
149 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
150 	uint8_t cc_switch_mode;
151 #endif
152 	bool obssEnabled;
153 	uint8_t conc_custom_rule1;
154 	uint8_t conc_custom_rule2;
155 	uint8_t is_sta_connection_in_5gz_enabled;
156 	enum force_1x1_type is_force_1x1;
157 	bool wep_tkip_in_he;
158 };
159 
160 struct csr_channel_powerinfo {
161 	tListElem link;
162 	uint32_t first_chan_freq;
163 	uint8_t numChannels;
164 	uint8_t txPower;
165 	uint8_t interChannelOffset;
166 };
167 
168 struct csr_scanstruct {
169 	struct csr_channel channels11d;
170 	struct channel_power defaultPowerTable[CFG_VALID_CHANNEL_LIST_LEN];
171 	struct csr_channel base_channels;  /* The channel base to work on */
172 	tDblLinkList channelPowerInfoList24;
173 	tDblLinkList channelPowerInfoList5G;
174 	/*
175 	 * Customer wants to optimize the scan time. Avoiding scans(passive)
176 	 * on DFS channels while swipping through both bands can save some time
177 	 * (apprx 1.3 sec)
178 	 */
179 	uint8_t fEnableDFSChnlScan;
180 	bool fcc_constraint;
181 	bool pending_channel_list_req;
182 };
183 
184 /*
185  * Save the connected information. This structure + connectedProfile
186  * should contain all information about the connection
187  */
188 struct csr_roam_connectedinfo {
189 	uint32_t nBeaconLength;
190 	uint32_t nAssocReqLength;
191 	uint32_t nAssocRspLength;
192 	/* len of the parsed RIC resp IEs received in reassoc response */
193 	uint32_t nRICRspLength;
194 #ifdef FEATURE_WLAN_ESE
195 	uint32_t nTspecIeLength;
196 #endif
197 	/*
198 	 * Point to a buffer contain the beacon, assoc req, assoc rsp frame, in
199 	 * that order user needs to use nBeaconLength, nAssocReqLength,
200 	 * nAssocRspLength to desice where each frame starts and ends.
201 	 */
202 	uint8_t *pbFrames;
203 };
204 
205 /**
206  * struct csr_disconnect_stats - Disconnect Stats per session
207  * @disconnection_cnt: total no. of disconnections
208  * @disconnection_by_app: diconnections triggered by application
209  * @disassoc_by_peer: disassoc sent by peer
210  * @deauth_by_peer: deauth sent by peer
211  * @bmiss: disconnect triggered by beacon miss
212  * @peer_kickout: disconnect triggered by peer kickout
213  */
214 struct csr_disconnect_stats {
215 	uint32_t disconnection_cnt;
216 	uint32_t disconnection_by_app;
217 	uint32_t disassoc_by_peer;
218 	uint32_t deauth_by_peer;
219 	uint32_t bmiss;
220 	uint32_t peer_kickout;
221 };
222 
223 /**
224  * struct csr_roam_session - CSR per-vdev context
225  * @vdev_id: ID of the vdev for which this entry is applicable
226  * @cb_mode: channel bonding mode
227  * @bcn_int: beacon interval
228  * @update_bcn_int: updated beacon interval
229  * @is_bcn_recv_start: Allow to process bcn recv indication
230  * @beacon_report_do_not_resume: Do not resume the beacon reporting after scan
231  */
232 struct csr_roam_session {
233 	uint8_t vdev_id;
234 	bool sessionActive;     /* true if it is used */
235 
236 	eCsrConnectState connectState;
237 	struct csr_roam_connectedinfo connectedInfo;
238 	tCsrRoamModifyProfileFields modifyProfileFields;
239 	/*
240 	 * to remember some parameters needed for START_BSS.
241 	 * All member must be set every time we try to join
242 	 */
243 	ePhyChanBondState cb_mode;
244 	uint16_t bcn_int;
245 	bool update_bcn_int;
246 
247 #ifdef WLAN_BCN_RECV_FEATURE
248 	bool is_bcn_recv_start;
249 	bool beacon_report_do_not_resume;
250 #endif
251 #ifdef FEATURE_WLAN_ESE
252 	bool isPrevApInfoValid;
253 	uint32_t roamTS1;
254 #endif
255 	bool ch_switch_in_progress;
256 	uint8_t nss;
257 	bool dhcp_done;
258 	struct csr_disconnect_stats disconnect_stats;
259 };
260 
261 struct csr_roamstruct {
262 	struct csr_config configParam;
263 	enum csr_roam_state curState[WLAN_MAX_VDEVS];
264 	enum csr_roam_substate curSubState[WLAN_MAX_VDEVS];
265 	/*
266 	 * This may or may not have the up-to-date valid channel list. It is
267 	 * used to get CFG_VALID_CHANNEL_LIST and not alloc mem all time
268 	 */
269 	int32_t sPendingCommands;
270 	struct csr_roam_session *roamSession;
271 #if defined(WLAN_LOGGING_SOCK_SVC_ENABLE) && \
272 	defined(CONNECTIVITY_PKTLOG)
273 	qdf_mc_timer_t packetdump_timer;
274 #endif
275 	spinlock_t roam_state_lock;
276 };
277 
278 #define CSR_IS_ROAM_STATE(mac, state, sessionId) \
279 			((state) == (mac)->roam.curState[sessionId])
280 #define CSR_IS_ROAM_STOP(mac, sessionId) \
281 		CSR_IS_ROAM_STATE((mac), eCSR_ROAMING_STATE_STOP, sessionId)
282 #define CSR_IS_ROAM_JOINING(mac, sessionId)  \
283 		CSR_IS_ROAM_STATE(mac, eCSR_ROAMING_STATE_JOINING, sessionId)
284 #define CSR_IS_ROAM_JOINED(mac, sessionId) \
285 		CSR_IS_ROAM_STATE(mac, eCSR_ROAMING_STATE_JOINED, sessionId)
286 #define CSR_IS_ROAM_SUBSTATE(mac, subState, sessionId) \
287 		((subState) == (mac)->roam.curSubState[sessionId])
288 #define CSR_IS_ROAM_SUBSTATE_DISASSOC_REQ(mac, sessionId) \
289 		CSR_IS_ROAM_SUBSTATE((mac), eCSR_ROAM_SUBSTATE_DISASSOC_REQ, sessionId)
290 #define CSR_IS_ROAM_SUBSTATE_DEAUTH_REQ(mac, sessionId) \
291 		CSR_IS_ROAM_SUBSTATE((mac), \
292 			eCSR_ROAM_SUBSTATE_DEAUTH_REQ, sessionId)
293 #define CSR_IS_ROAM_SUBSTATE_START_BSS_REQ(mac, sessionId) \
294 		CSR_IS_ROAM_SUBSTATE((mac), \
295 			eCSR_ROAM_SUBSTATE_START_BSS_REQ, sessionId)
296 #define CSR_IS_ROAM_SUBSTATE_STOP_BSS_REQ(mac, sessionId) \
297 		CSR_IS_ROAM_SUBSTATE((mac), \
298 			eCSR_ROAM_SUBSTATE_STOP_BSS_REQ, sessionId)
299 #define CSR_IS_ROAM_SUBSTATE_WAITFORKEY(mac, sessionId) \
300 		CSR_IS_ROAM_SUBSTATE((mac), \
301 			eCSR_ROAM_SUBSTATE_WAIT_FOR_KEY, sessionId)
302 
303 #define CSR_IS_PHY_MODE_DUAL_BAND(phyMode) \
304 	((eCSR_DOT11_MODE_abg & (phyMode)) || \
305 	 (eCSR_DOT11_MODE_11n & (phyMode)) || \
306 	 (eCSR_DOT11_MODE_11ac & (phyMode)) || \
307 	 (eCSR_DOT11_MODE_11ax & (phyMode)) || \
308 	 (eCSR_DOT11_MODE_11be & (phyMode)) || \
309 	 (eCSR_DOT11_MODE_AUTO & (phyMode)))
310 
311 #define CSR_IS_DOT11_MODE_11N(dot11mode) \
312 	((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) || \
313 	 (dot11mode == eCSR_CFG_DOT11_MODE_11N) || \
314 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC) || \
315 	 (dot11mode == eCSR_CFG_DOT11_MODE_11N_ONLY) || \
316 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC_ONLY) || \
317 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX) || \
318 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX_ONLY) || \
319 	 (dot11mode == eCSR_CFG_DOT11_MODE_11BE) || \
320 	 (dot11mode == eCSR_CFG_DOT11_MODE_11BE_ONLY))
321 
322 #define CSR_IS_DOT11_MODE_11AC(dot11mode) \
323 	((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) || \
324 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC) || \
325 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AC_ONLY) || \
326 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX) || \
327 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX_ONLY) || \
328 	 (dot11mode == eCSR_CFG_DOT11_MODE_11BE) || \
329 	 (dot11mode == eCSR_CFG_DOT11_MODE_11BE_ONLY))
330 
331 #define CSR_IS_DOT11_MODE_11AX(dot11mode) \
332 	((dot11mode == eCSR_CFG_DOT11_MODE_AUTO) || \
333 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX) || \
334 	 (dot11mode == eCSR_CFG_DOT11_MODE_11AX_ONLY) || \
335 	 (dot11mode == eCSR_CFG_DOT11_MODE_11BE) || \
336 	 (dot11mode == eCSR_CFG_DOT11_MODE_11BE_ONLY))
337 
338 #define CSR_IS_DOT11_MODE_11BE(dot11mode) \
339 	(((dot11mode) == eCSR_CFG_DOT11_MODE_AUTO) || \
340 	 ((dot11mode) == eCSR_CFG_DOT11_MODE_11BE) || \
341 	 ((dot11mode) == eCSR_CFG_DOT11_MODE_11BE_ONLY))
342 
343 #ifdef WLAN_FEATURE_11BE
344 #define CSR_IS_CFG_DOT11_PHY_MODE_11BE(dot11mode) \
345 	((dot11mode) == eCSR_CFG_DOT11_MODE_11BE)
346 
347 #define CSR_IS_CFG_DOT11_PHY_MODE_11BE_ONLY(dot11mode) \
348 	((dot11mode) == eCSR_CFG_DOT11_MODE_11BE_ONLY)
349 #else
350 #define CSR_IS_CFG_DOT11_PHY_MODE_11BE(dot11mode) 0
351 #define CSR_IS_CFG_DOT11_PHY_MODE_11BE_ONLY(dot11mode) 0
352 #endif
353 /*
354  * this function returns true if the NIC is operating exclusively in
355  * the 2.4 GHz band, meaning. it is NOT operating in the 5.0 GHz band.
356  */
357 #define CSR_IS_24_BAND_ONLY(mac) \
358 	(BIT(REG_BAND_2G) == (mac)->mlme_cfg->gen.band)
359 
360 #define CSR_IS_5G_BAND_ONLY(mac) \
361 	(BIT(REG_BAND_5G) == (mac)->mlme_cfg->gen.band)
362 
363 #define CSR_IS_RADIO_DUAL_BAND(mac) \
364 	((BIT(REG_BAND_2G) | BIT(REG_BAND_5G)) == \
365 		(mac)->mlme_cfg->gen.band_capability)
366 
367 #define CSR_IS_RADIO_BG_ONLY(mac) \
368 	(BIT(REG_BAND_2G) == (mac)->mlme_cfg->gen.band_capability)
369 
370 /*
371  * this function returns true if the NIC is operating exclusively in the 5.0 GHz
372  * band, meaning. it is NOT operating in the 2.4 GHz band
373  */
374 #define CSR_IS_RADIO_A_ONLY(mac) \
375 	(BAND_5G == (mac)->mlme_cfg->gen.band_capability)
376 /* this function returns true if the NIC is operating in both bands. */
377 #define CSR_IS_OPEARTING_DUAL_BAND(mac) \
378 	((BAND_ALL == (mac)->mlme_cfg->gen.band_capability) && \
379 		(BAND_ALL == (mac)->mlme_cfg->gen.band))
380 /*
381  * this function returns true if the NIC can operate in the 5.0 GHz band
382  * (could operate in the 2.4 GHz band also)
383  */
384 #define CSR_IS_OPERATING_A_BAND(mac) \
385 	(CSR_IS_OPEARTING_DUAL_BAND((mac)) || \
386 		CSR_IS_RADIO_A_ONLY((mac)) || CSR_IS_5G_BAND_ONLY((mac)))
387 
388 /*
389  * this function returns true if the NIC can operate in the 2.4 GHz band
390  * (could operate in the 5.0 GHz band also).
391  */
392 #define CSR_IS_OPERATING_BG_BAND(mac) \
393 	(CSR_IS_OPEARTING_DUAL_BAND((mac)) || \
394 		CSR_IS_RADIO_BG_ONLY((mac)) || CSR_IS_24_BAND_ONLY((mac)))
395 
396 #define CSR_IS_ADDTS_WHEN_ACMOFF_SUPPORTED(mac) \
397 	(mac->mlme_cfg->wmm_params.wmm_tspec_element.ts_acm_is_off)
398 
399 /**
400  * csr_get_vdev_dot11_mode() - get the supported dot11mode by vdev
401  * @mac_ctx:  pointer to global mac structure
402  * @vdev_id: vdev id
403  * @curr_dot11_mode: Current dot11 mode
404  *
405  * The function return the min of supported dot11 mode and vdev type dot11mode
406  * for given vdev type.
407  *
408  * Return:csr_cfgdot11mode
409  */
410 enum csr_cfgdot11mode
411 csr_get_vdev_dot11_mode(struct mac_context *mac,
412 			uint8_t vdev_id,
413 			enum csr_cfgdot11mode curr_dot11_mode);
414 
415 QDF_STATUS csr_get_channel_and_power_list(struct mac_context *mac);
416 
417 QDF_STATUS csr_set_modify_profile_fields(struct mac_context *mac,
418 		uint32_t sessionId, tCsrRoamModifyProfileFields *
419 		pModifyProfileFields);
420 QDF_STATUS csr_get_modify_profile_fields(struct mac_context *mac,
421 		uint32_t sessionId, tCsrRoamModifyProfileFields *
422 		pModifyProfileFields);
423 void csr_set_global_cfgs(struct mac_context *mac);
424 void csr_set_default_dot11_mode(struct mac_context *mac);
425 bool csr_is_conn_state_disconnected(struct mac_context *mac,
426 				    uint8_t vdev_id);
427 bool csr_is_conn_state_connected(struct mac_context *mac,
428 					       uint32_t sessionId);
429 bool csr_is_conn_state_wds(struct mac_context *mac, uint32_t sessionId);
430 bool csr_is_conn_state_connected_wds(struct mac_context *mac,
431 						    uint32_t sessionId);
432 bool csr_is_conn_state_disconnected_wds(struct mac_context *mac,
433 		uint32_t sessionId);
434 bool csr_is_any_session_in_connect_state(struct mac_context *mac);
435 bool csr_is_all_session_disconnected(struct mac_context *mac);
436 
437 bool csr_is_infra_ap_started(struct mac_context *mac);
438 bool csr_is_conn_state_connected_infra_ap(struct mac_context *mac,
439 		uint32_t sessionId);
440 QDF_STATUS csr_get_snr(struct mac_context *mac, tCsrSnrCallback callback,
441 			  struct qdf_mac_addr bssId, void *pContext);
442 QDF_STATUS csr_get_config_param(struct mac_context *mac,
443 					  struct csr_config_params *pParam);
444 QDF_STATUS csr_change_default_config_param(struct mac_context *mac,
445 		struct csr_config_params *pParam);
446 QDF_STATUS csr_msg_processor(struct mac_context *mac, void *msg_buf);
447 QDF_STATUS csr_open(struct mac_context *mac);
448 QDF_STATUS csr_init_chan_list(struct mac_context *mac);
449 QDF_STATUS csr_close(struct mac_context *mac);
450 QDF_STATUS csr_start(struct mac_context *mac);
451 QDF_STATUS csr_stop(struct mac_context *mac);
452 QDF_STATUS csr_ready(struct mac_context *mac);
453 
454 /**
455  * csr_get_concurrent_operation_freq() - To get concurrent operating freq
456  * @mac_ctx: Pointer to mac context
457  *
458  * This routine will return operating freq on FIRST BSS that is
459  * active/operating to be used for concurrency mode.
460  * If other BSS is not up or not connected it will return 0
461  *
462  * Return: uint32_t
463  */
464 uint32_t csr_get_concurrent_operation_freq(struct mac_context *mac_ctx);
465 
466 /**
467  * csr_get_beaconing_concurrent_channel() - To get concurrent operating channel
468  * frequency of beaconing interface
469  * @mac_ctx: Pointer to mac context
470  * @vdev_id_to_skip: channel of which vdev id to skip
471  *
472  * This routine will return operating channel of active AP/GO channel
473  * and will skip the channel of vdev_id_to_skip.
474  * If other no requested mode is active it will return 0
475  *
476  * Return: uint32_t
477  */
478 uint32_t csr_get_beaconing_concurrent_channel(struct mac_context *mac_ctx,
479 					      uint8_t vdev_id_to_skip);
480 
481 #ifdef FEATURE_WLAN_MCC_TO_SCC_SWITCH
482 /**
483  * csr_check_concurrent_channel_overlap() - To check concurrent overlap chnls
484  * @mac: Pointer to mac context
485  * @sap_freq: Requested SAP freq
486  * @sap_phymode: SAP phy mode
487  * @cc_switch_mode: concurrent switch mode
488  * @vdev_id: vdev id of SAP/GO requesting
489  *
490  * This routine will be called to check concurrent overlap channels
491  *
492  * Return: uint16_t
493  */
494 uint16_t csr_check_concurrent_channel_overlap(struct mac_context *mac,
495 				uint32_t sap_freq, eCsrPhyMode sap_phymode,
496 				uint8_t cc_switch_mode, uint8_t vdev_id);
497 #endif
498 
499 /* Returns whether the current association is a 11r assoc or not */
500 bool csr_roam_is11r_assoc(struct mac_context *mac, uint8_t sessionId);
501 
502 #ifdef FEATURE_WLAN_ESE
503 /* Returns whether the current association is a ESE assoc or not */
504 bool csr_roam_is_ese_assoc(struct mac_context *mac, uint32_t sessionId);
505 QDF_STATUS csr_get_tsm_stats(struct mac_context *mac,
506 		tCsrTsmStatsCallback callback,
507 		struct qdf_mac_addr bssId,
508 		void *pContext, uint8_t tid);
509 #endif
510 
511 /**
512  * csr_send_channel_change_req() - Post channel change request to LIM
513  * @mac : mac context
514  * @req : channel change request
515  *
516  * This API is primarily used to post Channel Change Req for SAP
517  *
518  *  Return: QDF_STATUS
519  */
520 QDF_STATUS csr_send_channel_change_req(struct mac_context *mac,
521 				       struct channel_change_req *req);
522 
523 /* Post Beacon Tx Start Indication */
524 QDF_STATUS csr_roam_start_beacon_req(struct mac_context *mac,
525 		struct qdf_mac_addr bssid, uint8_t dfsCacWaitStatus);
526 
527 /**
528  * csr_roam_send_chan_sw_ie_request() - Request to transmit CSA IE
529  * @mac_ctx:        Global MAC context
530  * @bssid:          BSSID
531  * @target_chan_freq: Channel frequency on which to send the IE
532  * @csa_ie_reqd:    Include/Exclude CSA IE.
533  * @ch_params:  operating Channel related information
534  * @new_cac_ms: cac duration of new channel
535  *
536  * This function sends request to transmit channel switch announcement
537  * IE to lower layers
538  *
539  * Return: success or failure
540  **/
541 QDF_STATUS csr_roam_send_chan_sw_ie_request(struct mac_context *mac,
542 					    struct qdf_mac_addr bssid,
543 					    uint32_t target_chan_freq,
544 					    uint8_t csaIeReqd,
545 					    struct ch_params *ch_params,
546 					    uint32_t new_cac_ms);
547 
548 QDF_STATUS csr_roam_modify_add_ies(struct mac_context *mac,
549 					tSirModifyIE *pModifyIE,
550 				   eUpdateIEsType updateType);
551 QDF_STATUS
552 csr_roam_update_add_ies(struct mac_context *mac,
553 		tSirUpdateIE *pUpdateIE, eUpdateIEsType updateType);
554 
555 bool csr_nonscan_active_ll_remove_entry(
556 			struct mac_context *mac_ctx,
557 			tListElem *pEntryToRemove, bool inter_locked);
558 tListElem *csr_nonscan_active_ll_peek_head(
559 			struct mac_context *mac_ctx,
560 			bool inter_locked);
561 tListElem *csr_nonscan_pending_ll_peek_head(
562 			struct mac_context *mac_ctx,
563 			bool inter_locked);
564 tListElem *csr_nonscan_pending_ll_next(
565 			struct mac_context *mac_ctx,
566 		tListElem *entry, bool inter_locked);
567 
568 /**
569  * csr_purge_pdev_all_ser_cmd_list() - purge all scan and non-scan
570  * active and pending cmds for all vdevs in pdev
571  * @mac_ctx: pointer to global MAC context
572  *
573  * Return : none
574  */
575 void csr_purge_pdev_all_ser_cmd_list(struct mac_context *mac_ctx);
576 
577 void csr_roam_substate_change(
578 			struct mac_context *mac, enum csr_roam_substate
579 					NewSubstate, uint32_t sessionId);
580 
581 bool csr_is_ndi_started(struct mac_context *mac_ctx, uint32_t session_id);
582 
583 QDF_STATUS csr_roam_update_config(
584 			struct mac_context *mac_ctx, uint8_t session_id,
585 				  uint16_t capab, uint32_t value);
586 
587 /**
588  * csr_is_mcc_channel() - check if using the channel results into MCC
589  * @mac_ctx: pointer to global MAC context
590  * @chan_freq: channel frequency to check for MCC scenario
591  *
592  * Return : true if channel causes MCC, else false
593  */
594 bool csr_is_mcc_channel(struct mac_context *mac_ctx, uint32_t chan_freq);
595 
596 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
597 /**
598  * csr_roam_auth_offload_callback() - Registered CSR Callback function to handle
599  * WPA3 roam pre-auth event from firmware.
600  * @mac_ctx: Global mac context pointer
601  * @vdev_id: Vdev id
602  * @bssid: candidate AP bssid
603  * @akm: candidate AKM
604  */
605 QDF_STATUS
606 csr_roam_auth_offload_callback(struct mac_context *mac_ctx,
607 			       uint8_t vdev_id,
608 			       struct qdf_mac_addr bssid,
609 			       uint32_t akm);
610 #else
611 static inline QDF_STATUS
csr_roam_auth_offload_callback(struct mac_context * mac_ctx,uint8_t vdev_id,struct qdf_mac_addr bssid,uint32_t akm)612 csr_roam_auth_offload_callback(struct mac_context *mac_ctx,
613 			       uint8_t vdev_id,
614 			       struct qdf_mac_addr bssid,
615 			       uint32_t akm)
616 {
617 	return QDF_STATUS_E_NOSUPPORT;
618 }
619 #endif
620 
621 /**
622  * csr_invoke_neighbor_report_request - Send neighbor report invoke command to
623  *					WMA
624  * @mac_ctx: MAC context
625  * @session_id: session id
626  *
627  * API called from IW to invoke neighbor report request to WMA then to FW
628  *
629  * Return: QDF_STATUS
630  */
631 QDF_STATUS csr_invoke_neighbor_report_request(uint8_t session_id,
632 				struct sRrmNeighborReq *neighbor_report_req,
633 				bool send_resp_to_host);
634 
635 /**
636  * csr_set_vdev_ies_per_band() - sends the per band IEs to vdev
637  * @mac_handle: Opaque handle to the global MAC context
638  * @vdev_id: vdev_id for which IE is targeted
639  * @device_mode: vdev mode
640  *
641  * Return: None
642  */
643 void csr_set_vdev_ies_per_band(mac_handle_t mac_handle, uint8_t vdev_id,
644 			       enum QDF_OPMODE device_mode);
645 #endif
646