xref: /wlan-driver/qcacld-3.0/core/mac/src/pe/include/lim_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2011-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
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  *
22  * This file lim_api.h contains the definitions exported by
23  * LIM module.
24  * Author:        Chandra Modumudi
25  * Date:          02/11/02
26  * History:-
27  * Date           Modified by    Modification Information
28  * --------------------------------------------------------------------
29  *
30  */
31 #ifndef __LIM_API_H
32 #define __LIM_API_H
33 #include "wni_api.h"
34 #include "sir_api.h"
35 #include "ani_global.h"
36 #include "sir_mac_prot_def.h"
37 #include "sir_common.h"
38 #include "sir_debug.h"
39 #include "sch_global.h"
40 #include "utils_api.h"
41 #include "lim_global.h"
42 #include "wma_if.h"
43 #include "wma_types.h"
44 #include "scheduler_api.h"
45 #include "spatial_reuse_api.h"
46 
47 /* Macro to count heartbeat */
48 #define limResetHBPktCount(pe_session)   (pe_session->LimRxedBeaconCntDuringHB = 0)
49 
50 /* Useful macros for fetching various states in mac->lim */
51 /* gLimSystemRole */
52 #define GET_LIM_SYSTEM_ROLE(pe_session)      (pe_session->limSystemRole)
53 #define LIM_IS_AP_ROLE(pe_session)           (GET_LIM_SYSTEM_ROLE(pe_session) == eLIM_AP_ROLE)
54 #define LIM_IS_STA_ROLE(pe_session)          (GET_LIM_SYSTEM_ROLE(pe_session) == eLIM_STA_ROLE)
55 #define LIM_IS_UNKNOWN_ROLE(pe_session)      (GET_LIM_SYSTEM_ROLE(pe_session) == eLIM_UNKNOWN_ROLE)
56 #define LIM_IS_P2P_DEVICE_ROLE(pe_session)   (GET_LIM_SYSTEM_ROLE(pe_session) == eLIM_P2P_DEVICE_ROLE)
57 #define LIM_IS_P2P_DEVICE_GO(pe_session)     (GET_LIM_SYSTEM_ROLE(pe_session) == eLIM_P2P_DEVICE_GO)
58 #define LIM_IS_NDI_ROLE(pe_session) \
59 		(GET_LIM_SYSTEM_ROLE(pe_session) == eLIM_NDI_ROLE)
60 /* gLimSmeState */
61 #define GET_LIM_SME_STATE(mac)                 (mac->lim.gLimSmeState)
62 #define SET_LIM_SME_STATE(mac, state)          (mac->lim.gLimSmeState = state)
63 /* gLimMlmState */
64 #define GET_LIM_MLM_STATE(mac)                 (mac->lim.gLimMlmState)
65 #define SET_LIM_MLM_STATE(mac, state)          (mac->lim.gLimMlmState = state)
66 /*tpdphHashNode mlmStaContext*/
67 #define GET_LIM_STA_CONTEXT_MLM_STATE(sta)   (sta->mlmStaContext.mlmState)
68 #define SET_LIM_STA_CONTEXT_MLM_STATE(sta, state)  (sta->mlmStaContext.mlmState = state)
69 #define LIM_IS_CONNECTION_ACTIVE(pe_session)  (pe_session->LimRxedBeaconCntDuringHB)
70 /*mac->lim.gLimProcessDefdMsgs*/
71 #define GET_LIM_PROCESS_DEFD_MESGS(mac) (mac->lim.gLimProcessDefdMsgs)
72 
73 #ifdef WLAN_FEATURE_SR
74 /**
75  * enum sr_status_of_roamed_ap - SR(Spatial Reuse) status of roamed AP
76  * SR_DISALLOW: SR not supported by roamed AP
77  * SR_THRESHOLD_IN_RANGE: SR is supported by roamed AP/after param change
78  * in beacon/probe resp and the configured threshold is in range.
79  * SR_THRESHOLD_NOT_IN_RANGE: SR is supported by roamed AP/after param change
80  * in beacon/probe resp and configured threshold is not in range.
81  */
82 enum sr_status_of_roamed_ap {
83 	SR_DISALLOW,
84 	SR_THRESHOLD_IN_RANGE,
85 	SR_THRESHOLD_NOT_IN_RANGE,
86 };
87 #endif
88 
89 /**
90  * lim_post_msg_api() - post normal priority PE message
91  * @mac: mac context
92  * @msg: message to be posted
93  *
94  * This function is called to post a message to the tail of the PE
95  * message queue to be processed in the MC Thread with normal
96  * priority.
97  *
98  * Return: QDF_STATUS_SUCCESS on success, other QDF_STATUS on error
99  */
100 QDF_STATUS lim_post_msg_api(struct mac_context *mac, struct scheduler_msg *msg);
101 
102 static inline void
lim_post_msg_to_process_deferred_queue(struct mac_context * mac)103 lim_post_msg_to_process_deferred_queue(struct mac_context *mac)
104 {
105 	struct scheduler_msg msg = {0};
106 	QDF_STATUS status;
107 
108 	if (!mac->lim.gLimProcessDefdMsgs || !mac->lim.gLimDeferredMsgQ.size)
109 		return;
110 
111 	msg.type = SIR_LIM_PROCESS_DEFERRED_QUEUE;
112 	msg.bodyptr = NULL;
113 	msg.bodyval = 0;
114 
115 	status = lim_post_msg_api(mac, &msg);
116 	if (QDF_IS_STATUS_ERROR(status))
117 		pe_err("Failed to post lim msg:0x%x", msg.type);
118 }
119 
120 #define SET_LIM_PROCESS_DEFD_MESGS(mac, val) \
121 	mac->lim.gLimProcessDefdMsgs = val; \
122 	pe_debug("Defer LIM msg %d", val); \
123 	lim_post_msg_to_process_deferred_queue(mac);
124 
125 /* LIM exported function templates */
126 #define LIM_MIN_BCN_PR_LENGTH  12
127 #define LIM_BCN_PR_CAPABILITY_OFFSET 10
128 #define LIM_ASSOC_REQ_IE_OFFSET 4
129 
130 /**
131  * enum lim_vendor_ie_access_policy - vendor ie access policy
132  * @LIM_ACCESS_POLICY_NONE: access policy not valid
133  * @LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT: respond only if vendor ie
134  *         is present in probe request and assoc request frames
135  * @LIM_ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT: do not respond if vendor
136  *         ie is present in probe request or assoc request frames
137  */
138 enum lim_vendor_ie_access_policy {
139 	LIM_ACCESS_POLICY_NONE,
140 	LIM_ACCESS_POLICY_RESPOND_IF_IE_IS_PRESENT,
141 	LIM_ACCESS_POLICY_DONOT_RESPOND_IF_IE_IS_PRESENT,
142 };
143 
144 typedef enum eMgmtFrmDropReason {
145 	eMGMT_DROP_NO_DROP,
146 	eMGMT_DROP_NOT_LAST_IBSS_BCN,
147 	eMGMT_DROP_INFRA_BCN_IN_IBSS,
148 	eMGMT_DROP_SCAN_MODE_FRAME,
149 	eMGMT_DROP_NON_SCAN_MODE_FRAME,
150 	eMGMT_DROP_INVALID_SIZE,
151 	eMGMT_DROP_SPURIOUS_FRAME,
152 	eMGMT_DROP_DUPLICATE_AUTH_FRAME,
153 	eMGMT_DROP_EXCESSIVE_MGMT_FRAME,
154 	eMGMT_DROP_DEAUTH_DURING_ROAM_STARTED,
155 } tMgmtFrmDropReason;
156 
157 /**
158  * Function to initialize LIM state machines.
159  * This called upon LIM thread creation.
160  */
161 QDF_STATUS lim_initialize(struct mac_context *);
162 QDF_STATUS pe_open(struct mac_context *mac, struct cds_config_info *cds_cfg);
163 QDF_STATUS pe_close(struct mac_context *mac);
164 QDF_STATUS lim_start(struct mac_context *mac);
165 QDF_STATUS pe_start(struct mac_context *mac);
166 void pe_stop(struct mac_context *mac);
167 
168 /**
169  * is_mgmt_protected  -  check RMF enabled for the peer
170  * @vdev_id: vdev id
171  * @peer_mac_addr: peer mac address
172  *
173  * Return: True if RMF enabled and key is installed
174  */
175 bool is_mgmt_protected(uint32_t vdev_id, const uint8_t *peer_mac_addr);
176 
177 /**
178  * lim_stop_pmfcomeback_timer() - stop pmf comeback timer
179  * @session: Pointer to PE session
180  *
181  * Return: None
182  */
183 void lim_stop_pmfcomeback_timer(struct pe_session *session);
184 
185 /**
186  * pe_register_mgmt_rx_frm_callback() - registers callback for receiving
187  *                                      mgmt rx frames
188  * @mac_ctx: mac global ctx
189  *
190  * This function registers a PE function to mgmt txrx component and a WMA
191  * function to WMI layer as event handler for receiving mgmt frames.
192  *
193  * Return: None
194  */
195 void pe_register_mgmt_rx_frm_callback(struct mac_context *mac_ctx);
196 
197 /**
198  * pe_deregister_mgmt_rx_frm_callback() - degisters callback for receiving
199  *                                        mgmt rx frames
200  * @mac_ctx: mac global ctx
201  *
202  * This function deregisters the PE function registered to mgmt txrx component
203  * and the WMA function registered to WMI layer as event handler for receiving
204  * mgmt frames.
205  *
206  * Return: None
207  */
208 void pe_deregister_mgmt_rx_frm_callback(struct mac_context *mac_ctx);
209 
210 /**
211  * pe_register_callbacks_with_wma() - register SME and PE callback functions to
212  * WMA.
213  * @mac: mac global ctx
214  * @ready_req: Ready request parameters, containing callback pointers
215  *
216  * Return: None
217  */
218 void pe_register_callbacks_with_wma(struct mac_context *mac,
219 				    struct sme_ready_req *ready_req);
220 
221 /**
222  * Function to cleanup LIM state.
223  * This called upon reset/persona change etc
224  */
225 void lim_cleanup(struct mac_context *);
226 
227 /**
228  * lim_post_msg_high_priority() - post high priority PE message
229  * @mac: mac context
230  * @msg: message to be posted
231  *
232  * This function is called to post a message to the head of the PE
233  * message queue to be processed in the MC Thread with expedited
234  * priority.
235  *
236  * Return: QDF_STATUS_SUCCESS on success, other QDF_STATUS on error
237  */
238 QDF_STATUS lim_post_msg_high_priority(struct mac_context *mac,
239 				      struct scheduler_msg *msg);
240 
241 /**
242  * Function to process messages posted to LIM thread
243  * and dispatch to various sub modules within LIM module.
244  */
245 void lim_message_processor(struct mac_context *, struct scheduler_msg *);
246 
247 /* / Function used by other Sirius modules to read global SME state */
lim_get_sme_state(struct mac_context * mac)248 static inline tLimSmeStates lim_get_sme_state(struct mac_context *mac)
249 {
250 	return mac->lim.gLimSmeState;
251 }
252 
253 /**
254  * lim_received_hb_handler() - This function is called by
255  * sch_beacon_process() upon receiving a Beacon on STA. This
256  * also gets called upon receiving Probe Response after heat
257  * beat failure is detected.
258  *
259  * @mac - global mac structure
260  * @chan_freq - channel frequency indicated in Beacon, Probe
261  *
262  * Response return - none
263  */
264 void lim_received_hb_handler(struct mac_context *, uint32_t,
265 			     struct pe_session *);
266 
267 /* / Function that triggers STA context deletion */
268 void lim_trigger_sta_deletion(struct mac_context *mac, tpDphHashNode sta,
269 			      struct pe_session *pe_session);
270 
271 #ifdef FEATURE_WLAN_TDLS
272 /* Function that sends TDLS Del Sta indication to SME */
273 void lim_send_sme_tdls_del_sta_ind(struct mac_context *mac, tpDphHashNode sta,
274 				   struct pe_session *pe_session,
275 				   uint16_t reasonCode);
276 #endif
277 
278 /**
279  * lim_detect_change_in_ap_capabilities() - Detect any change in AP's
280  * capabilities.
281  * @mac: Pointer to Global MAC structure
282  * @pBeacon: Pointer to parsed Beacon/probe rsp structure
283  * @session: pe session
284  * @is_bcn: if passed pointer is beacon or probe
285  *
286  * Return: void
287  */
288 void lim_detect_change_in_ap_capabilities(struct mac_context *mac,
289 					  tpSirProbeRespBeacon pBeacon,
290 					  struct pe_session *session,
291 					  bool is_bcn);
292 
293 QDF_STATUS lim_update_short_slot(struct mac_context *mac,
294 				    tpSirProbeRespBeacon pBeacon,
295 				    tpUpdateBeaconParams pBeaconParams,
296 				    struct pe_session *);
297 
298 /**
299  * lim_ps_offload_handle_missed_beacon_ind() - handle missed beacon indication
300  * @mac: global mac context
301  * @msg: message
302  *
303  * This function process the SIR_HAL_MISSED_BEACON_IND
304  * message from HAL, to do active AP probing.
305  *
306  * Return: void
307  */
308 void lim_ps_offload_handle_missed_beacon_ind(struct mac_context *mac,
309 					     struct scheduler_msg *msg);
310 
311 void lim_send_heart_beat_timeout_ind(struct mac_context *mac, struct pe_session *pe_session);
312 tMgmtFrmDropReason lim_is_pkt_candidate_for_drop(struct mac_context *mac,
313 						 uint8_t *pRxPacketInfo,
314 						 uint32_t subType);
315 
316 bool lim_is_sb_disconnect_allowed_fl(struct pe_session *session,
317 				     const char *func, uint32_t line);
318 
319 /**
320  * lim_is_sb_disconnect_allowed() - check pe session state to see if disconnect
321  * is already in progress.
322  * @session: pe session
323  *
324  * Return: false if disconnect is already in progress
325  */
326 #define lim_is_sb_disconnect_allowed(session) \
327 	lim_is_sb_disconnect_allowed_fl(session, __func__, __LINE__)
328 
329 #ifdef WLAN_FEATURE_ROAM_OFFLOAD
330 /**
331  * pe_roam_synch_callback() - Callback registered at wma, gets invoked when
332  * ROAM SYNCH event is received from firmware
333  * @mac_ctx: global mac context
334  * @vdev_id: VDEV id
335  * @roam_sync_ind_ptr: Structure with roam synch parameters
336  * @ie_len: ie length
337  * @reason: Operation to be done by the callback
338  *
339  * This is a PE level callback called from WMA to complete the roam synch
340  * propagation at PE level and also fill the BSS descriptor which will be
341  * helpful further to complete the roam synch propagation.
342  *
343  * Return: QDF_STATUS
344  */
345 QDF_STATUS
346 pe_roam_synch_callback(struct mac_context *mac_ctx,
347 		       uint8_t vdev_id,
348 		       struct roam_offload_synch_ind *roam_sync_ind_ptr,
349 		       uint16_t ie_len,
350 		       enum sir_roam_op_code reason);
351 
352 void
353 lim_check_ft_initial_im_association(struct roam_offload_synch_ind *roam_synch,
354 				    struct pe_session *session_entry);
355 
356 /**
357  * pe_disconnect_callback() - Callback to handle deauth event is received
358  * from firmware
359  * @mac: pointer to global mac context
360  * @vdev_id: VDEV in which the event was received
361  * @deauth_disassoc_frame: Deauth/disassoc frame received from firmware
362  * @deauth_disassoc_frame_len: Length of @deauth_disassoc_frame
363  * @reason_code: Fw sent reason code if disassoc/deauth frame is not
364  * available
365  *
366  * Return: QDF_STATUS
367  */
368 QDF_STATUS
369 pe_disconnect_callback(struct mac_context *mac, uint8_t vdev_id,
370 		       uint8_t *deauth_disassoc_frame,
371 		       uint16_t deauth_disassoc_frame_len,
372 		       uint16_t reason_code);
373 
374 QDF_STATUS
375 pe_set_ie_for_roam_invoke(struct mac_context *mac_ctx, uint8_t vdev_id,
376 			  uint16_t dot11_mode, enum QDF_OPMODE opmode);
377 
378 #else
379 static inline QDF_STATUS
pe_roam_synch_callback(struct mac_context * mac_ctx,uint8_t vdev_id,struct roam_offload_synch_ind * roam_sync_ind_ptr,uint16_t ie_len,enum sir_roam_op_code reason)380 pe_roam_synch_callback(struct mac_context *mac_ctx,
381 		       uint8_t vdev_id,
382 		       struct roam_offload_synch_ind *roam_sync_ind_ptr,
383 		       uint16_t ie_len,
384 		       enum sir_roam_op_code reason)
385 {
386 	return QDF_STATUS_E_NOSUPPORT;
387 }
388 
389 static inline QDF_STATUS
pe_disconnect_callback(struct mac_context * mac,uint8_t vdev_id,uint8_t * deauth_disassoc_frame,uint16_t deauth_disassoc_frame_len,uint16_t reason_code)390 pe_disconnect_callback(struct mac_context *mac, uint8_t vdev_id,
391 		       uint8_t *deauth_disassoc_frame,
392 		       uint16_t deauth_disassoc_frame_len,
393 		       uint16_t reason_code)
394 {
395 	return QDF_STATUS_E_NOSUPPORT;
396 }
397 
398 static inline QDF_STATUS
pe_set_ie_for_roam_invoke(struct mac_context * mac_ctx,uint8_t vdev_id,uint16_t dot11_mode,enum QDF_OPMODE opmode)399 pe_set_ie_for_roam_invoke(struct mac_context *mac_ctx, uint8_t vdev_id,
400 			  uint16_t dot11_mode, enum QDF_OPMODE opmode)
401 {
402 	return QDF_STATUS_E_NOSUPPORT;
403 }
404 #endif
405 
406 /**
407  * lim_update_lost_link_info() - update lost link information to SME
408  * @mac: global MAC handle
409  * @session: PE session
410  * @rssi: rssi value from the received frame
411  *
412  * Return: None
413  */
414 void lim_update_lost_link_info(struct mac_context *mac, struct pe_session *session,
415 				int32_t rssi);
416 
417 /**
418  * lim_mon_init_session() - create PE session for monitor mode operation
419  * @mac_ptr: mac pointer
420  * @msg: Pointer to struct sir_create_session type.
421  *
422  * Return: NONE
423  */
424 void lim_mon_init_session(struct mac_context *mac_ptr,
425 			  struct sir_create_session *msg);
426 
427 /**
428  * lim_mon_deinit_session() - delete PE session for monitor mode operation
429  * @mac_ptr: mac pointer
430  * @msg: Pointer to struct sir_delete_session type.
431  *
432  * Return: NONE
433  */
434 void lim_mon_deinit_session(struct mac_context *mac_ptr,
435 			    struct sir_delete_session *msg);
436 
437 #define limGetQosMode(pe_session, pVal) (*(pVal) = (pe_session)->limQosEnabled)
438 #define limGetWmeMode(pe_session, pVal) (*(pVal) = (pe_session)->limWmeEnabled)
439 #define limGetWsmMode(pe_session, pVal) (*(pVal) = (pe_session)->limWsmEnabled)
440 /* ----------------------------------------------------------------------- */
lim_get_phy_mode(struct mac_context * mac,uint32_t * phyMode,struct pe_session * pe_session)441 static inline void lim_get_phy_mode(struct mac_context *mac, uint32_t *phyMode,
442 				    struct pe_session *pe_session)
443 {
444 	*phyMode =
445 		pe_session ? pe_session->gLimPhyMode : mac->lim.gLimPhyMode;
446 }
447 
448 /* ----------------------------------------------------------------------- */
lim_get_rf_band_new(struct mac_context * mac,enum reg_wifi_band * band,struct pe_session * pe_session)449 static inline void lim_get_rf_band_new(struct mac_context *mac,
450 				       enum reg_wifi_band *band,
451 				       struct pe_session *pe_session)
452 {
453 	*band = pe_session ? pe_session->limRFBand : REG_BAND_UNKNOWN;
454 }
455 
456 /**
457  * pe_mc_process_handler() - Message Processor for PE
458  * @msg: Pointer to the message structure
459  *
460  * Verifies the system is in a mode where messages are expected to be
461  * processed, and if so, routes the message to the appropriate handler
462  * based upon message type.
463  *
464  * Return: QDF_STATUS_SUCCESS if the message was handled, otherwise an
465  *         appropriate QDF_STATUS error code
466  */
467 QDF_STATUS pe_mc_process_handler(struct scheduler_msg *msg);
468 
469 /** -------------------------------------------------------------
470    \fn pe_free_msg
471    \brief Called by CDS scheduler (function cds_sched_flush_mc_mqs)
472  \      to free a given PE message on the TX and MC thread.
473  \      This happens when there are messages pending in the PE
474  \      queue when system is being stopped and reset.
475    \param   struct mac_context *mac
476    \param   struct scheduler_msg       pMsg
477    \return none
478    -----------------------------------------------------------------*/
479 void pe_free_msg(struct mac_context *mac, struct scheduler_msg *pMsg);
480 
481 /**
482  * lim_process_abort_scan_ind() - abort the scan which is presently being run
483  *
484  * @mac_ctx: Pointer to Global MAC structure
485  * @vdev_id: vdev_id
486  * @scan_id: Scan ID from the scan request
487  * @scan_requesor_id: Entity requesting the scan
488  *
489  * @return: None
490  */
491 void lim_process_abort_scan_ind(struct mac_context *mac, uint8_t vdev_id,
492 	uint32_t scan_id, uint32_t scan_requestor_id);
493 
494 void __lim_process_sme_assoc_cnf_new(struct mac_context *, uint32_t, uint32_t *);
495 
496 /**
497  * lim_handle_frame_genby_mbssid() - wrapper for beacon and probe response
498  * @frame: the pointer of frame data
499  * @frame_len: the length of frame data
500  * @frm_subtype: frame type
501  * @bssid: the pointer to bssid
502  *
503  * This function is used as wrapper to handle the beacon and probe response
504  * frames which is generated by MBSSID frame.
505  *
506  * Return: QDF_STATUS
507  */
508 QDF_STATUS lim_handle_frame_genby_mbssid(uint8_t *frame, uint32_t frame_len,
509 					 uint8_t frm_subtype, char *bssid);
510 
511 /**
512  * lim_process_sme_addts_rsp_timeout(): Send addts rsp timeout to SME
513  * @mac: Pointer to Global MAC structure
514  * @param: Addts rsp timer count
515  *
516  * This function is used to reset the addts sent flag and
517  * send addts rsp timeout to SME
518  *
519  * Return: None
520  */
521 void lim_process_sme_addts_rsp_timeout(struct mac_context *mac, uint32_t param);
522 QDF_STATUS lim_update_ext_cap_ie(struct mac_context *mac_ctx, uint8_t *ie_data,
523 				 uint8_t *local_ie_buf, uint16_t *local_ie_len,
524 				 struct pe_session *session);
525 
526 /**
527  * lim_handle_sap_beacon(): Handle the beacon received from scan module for SAP
528  * @pdev: pointer to the pdev object
529  * @scan_entry: pointer to the scan cache entry for the beacon
530  *
531  * Registered as callback to the scan module for handling beacon frames.
532  * This API filters the and allows beacons for SAP protection mechanisms
533  * if there are active SAP sessions and the received beacon's channel
534  * matches the SAP active channel
535  *
536  * Return: None
537  */
538 void lim_handle_sap_beacon(struct wlan_objmgr_pdev *pdev,
539 					struct scan_cache_entry *scan_entry);
540 
541 /**
542  * lim_translate_rsn_oui_to_akm_type() - translate RSN OUI to AKM type
543  * @auth_suite: auth suite
544  *
545  * Return: AKM type
546  */
547 enum ani_akm_type lim_translate_rsn_oui_to_akm_type(uint8_t auth_suite[4]);
548 
549 #ifdef WLAN_SUPPORT_TWT
550 /**
551  * lim_fill_roamed_peer_twt_caps() - Update Peer TWT capabilities
552  * @mac_ctx: Pointer to mac context
553  * @vdev_id: vdev id
554  * @roam_synch: Pointer to roam synch indication
555  *
556  * Return: None
557  */
558 void lim_fill_roamed_peer_twt_caps(struct mac_context *mac_ctx, uint8_t vdev_id,
559 				   struct roam_offload_synch_ind *roam_synch);
560 
561 /**
562  * lim_set_twt_peer_capabilities() - Update Peer TWT capabilities
563  * @mac_ctx: Pointer to mac context
564  * @peer_mac: peer mac address
565  * @he_cap: pointer to HE capabilities IE
566  * @he_op: pointer to HE IE
567  *
568  * Based on the peer IE capabilities, update the TWT peer private object
569  *
570  * Return: None
571  */
572 void lim_set_twt_peer_capabilities(struct mac_context *mac_ctx,
573 				   struct qdf_mac_addr *peer_mac,
574 				   tDot11fIEhe_cap *he_cap,
575 				   tDot11fIEhe_op *he_op);
576 
577 /**
578  * lim_set_twt_ext_capabilities() - Update twt caps for 11n devices
579  * @mac_ctx: Pointer to mac context
580  * @peer_mac: peer mac address
581  * @ext_cap: pointer to Extended capabilities IE
582  *
583  */
584 void lim_set_twt_ext_capabilities(struct mac_context *mac_ctx,
585 				  struct qdf_mac_addr *peer_mac,
586 				  struct s_ext_cap *ext_cap);
587 #else
588 static inline
lim_fill_roamed_peer_twt_caps(struct mac_context * mac_ctx,uint8_t vdev_id,struct roam_offload_synch_ind * roam_synch)589 void lim_fill_roamed_peer_twt_caps(struct mac_context *mac_ctx, uint8_t vdev_id,
590 				   struct roam_offload_synch_ind *roam_synch)
591 {}
592 
593 static inline
lim_set_twt_peer_capabilities(struct mac_context * mac_ctx,struct qdf_mac_addr * peer_mac,tDot11fIEhe_cap * he_cap,tDot11fIEhe_op * he_op)594 void lim_set_twt_peer_capabilities(struct mac_context *mac_ctx,
595 				    struct qdf_mac_addr *peer_mac,
596 				    tDot11fIEhe_cap *he_cap,
597 				    tDot11fIEhe_op *he_op)
598 {}
599 
600 static inline
lim_set_twt_ext_capabilities(struct mac_context * mac_ctx,struct qdf_mac_addr * peer_mac,struct s_ext_cap * ext_cap)601 void lim_set_twt_ext_capabilities(struct mac_context *mac_ctx,
602 				  struct qdf_mac_addr *peer_mac,
603 				  struct s_ext_cap *ext_cap)
604 {}
605 #endif
606 
607 /**
608  * lim_get_basic_rates() - Get basic rates for the given frequency
609  * @b_rates: Pointer to rates
610  * @chan_freq: frequency for which rates are required
611  *
612  * This api will get basic rates for the given frequency
613  *
614  * Return: void
615  */
616 void lim_get_basic_rates(tSirMacRateSet *b_rates, uint32_t chan_freq);
617 
618 #define FW_CTS2SELF_PROFILE 34
619 
620 /**
621  * lim_enable_cts_to_self_for_exempted_iot_ap() - enable cts to self for iot ap
622  * @mac_ctx: mac context
623  * @session: pe session
624  * @ie_ptr: ie pointer
625  * @ie_len: ie length
626  *
627  * Return: true on success else false
628  */
629 bool lim_enable_cts_to_self_for_exempted_iot_ap(
630 				       struct mac_context *mac_ctx,
631 				       struct pe_session *session,
632 				       uint8_t *ie_ptr,
633 				       uint16_t ie_len);
634 
635 /**
636  * lim_fill_pe_session() - Lim fill pe session
637  * @mac_ctx: Pointer to mac context
638  * @session: pe session
639  * @bss_desc: Pointer to bss description
640  *
641  * This api will fill lim pe session with info
642  * from bss description
643  *
644  * Return: qdf status
645  */
646 QDF_STATUS
647 lim_fill_pe_session(struct mac_context *mac_ctx,
648 		    struct pe_session *session,
649 		    struct bss_description *bss_desc);
650 
651 /**
652  * lim_update_omn_ie_ch_width() - update omn_ie_ch_width in struct
653  * assoc_channel_info while processing bcn/probe resp/assoc resp/re-assoc resp
654  * @vdev: VDEV object manager
655  * @ch_width: ch_width present in OMN IE
656  *
657  * Return: none
658  */
659 void lim_update_omn_ie_ch_width(struct wlan_objmgr_vdev *vdev,
660 				enum phy_ch_width ch_width);
661 
662 #ifdef WLAN_FEATURE_11BE_MLO
663 /*
664  * lim_add_bcn_probe() - Add the generated probe resp to scan DB
665  * @vdev: VDEV object manager
666  * @bcn_probe: Pointer to bcn/probe
667  * @len: Length of frame.
668  * @freq: Freq on frame.
669  * @rssi: RSSI of the frame.
670  *
671  * Prepares the meta data to add the generated bcn/probe frame to
672  * scan DB.
673  *
674  * Return: QDF_STATUS
675  */
676 QDF_STATUS
677 lim_add_bcn_probe(struct wlan_objmgr_vdev *vdev, uint8_t *bcn_probe,
678 		  uint32_t len, qdf_freq_t freq, int32_t rssi);
679 
680 /**
681  * lim_update_mlo_mgr_info() - API to update mlo_mgr link info
682  * @mac_ctx: Pointer to mac context
683  * @vdev: vdev
684  * @link_addr: link address
685  * @link_id: Link id
686  * @freq: chan freq
687  *
688  * This api will update link sp[ecific info into mlo_mgr
689  *
690  * Return: qdf_status
691  */
692 QDF_STATUS
693 lim_update_mlo_mgr_info(struct mac_context *mac_ctx,
694 			struct wlan_objmgr_vdev *vdev,
695 			struct qdf_mac_addr *link_addr, uint8_t link_id,
696 			uint16_t freq);
697 /**
698  * lim_gen_link_specific_probe_rsp() - Generate link specific prb response
699  * @mac_ctx: Pointer to mac context
700  * @session_entry: pe session
701  * @rcvd_probe_resp: Pointer to received prb resp from AP.
702  * @probe_rsp: ptr to prb rsp
703  * @probe_rsp_len: length of prb rsp
704  * @rssi : rssi for link
705  *
706  * This api will generate link specific probe response
707  * and save in scan database.
708  *
709  * Return: qdf status
710  */
711 QDF_STATUS
712 lim_gen_link_specific_probe_rsp(struct mac_context *mac_ctx,
713 				struct pe_session *session_entry,
714 				tpSirProbeRespBeacon rcvd_probe_resp,
715 				uint8_t *probe_rsp,
716 				uint32_t probe_rsp_len,
717 				int32_t rssi);
718 /**
719  * lim_check_for_ml_probe_req() - check if ml probe req is sent
720  * @session: pe session
721  *
722  * Return qdf status
723  */
724 QDF_STATUS lim_check_for_ml_probe_req(struct pe_session *session);
725 
726 /**
727  * lim_process_cu_for_probe_rsp() - process critical update for probe response
728  * @mac_ctx: Pointer to mac context
729  * @session: pe session
730  * @probe_rsp: ptr to probe response
731  * @probe_rsp_len: length of probe response
732  *
733  * This api will generate link specific probe response and invoke function
734  * to process critical update IEs
735  *
736  * Return: qdf status
737  */
738 QDF_STATUS
739 lim_process_cu_for_probe_rsp(struct mac_context *mac_ctx,
740 			     struct pe_session *session,
741 			     uint8_t *probe_rsp,
742 			     uint32_t probe_rsp_len);
743 
744 #else
745 static inline QDF_STATUS
lim_add_bcn_probe(struct wlan_objmgr_vdev * vdev,uint8_t * bcn_probe,uint32_t len,qdf_freq_t freq,int32_t rssi)746 lim_add_bcn_probe(struct wlan_objmgr_vdev *vdev, uint8_t *bcn_probe,
747 		  uint32_t len, qdf_freq_t freq, int32_t rssi)
748 {
749 	return QDF_STATUS_E_NOSUPPORT;
750 }
751 
752 static inline QDF_STATUS
lim_update_mlo_mgr_info(struct mac_context * mac_ctx,struct wlan_objmgr_vdev * vdev,struct qdf_mac_addr * link_addr,uint8_t link_id,uint16_t freq)753 lim_update_mlo_mgr_info(struct mac_context *mac_ctx,
754 			struct wlan_objmgr_vdev *vdev,
755 			struct qdf_mac_addr *link_addr, uint8_t link_id,
756 			uint16_t freq)
757 {
758 	return QDF_STATUS_SUCCESS;
759 }
760 
761 static inline QDF_STATUS
lim_gen_link_specific_probe_rsp(struct mac_context * mac_ctx,struct pe_session * session_entry,tpSirProbeRespBeacon rcvd_probe_resp,uint8_t * probe_rsp,uint32_t probe_rsp_len,int32_t rssi)762 lim_gen_link_specific_probe_rsp(struct mac_context *mac_ctx,
763 				struct pe_session *session_entry,
764 				tpSirProbeRespBeacon rcvd_probe_resp,
765 				uint8_t *probe_rsp,
766 				uint32_t probe_rsp_len,
767 				int32_t rssi)
768 {
769 	return QDF_STATUS_SUCCESS;
770 }
771 
772 static inline QDF_STATUS
lim_check_for_ml_probe_req(struct pe_session * session)773 lim_check_for_ml_probe_req(struct pe_session *session)
774 {
775 	return QDF_STATUS_E_NOSUPPORT;
776 }
777 
778 static inline QDF_STATUS
lim_process_cu_for_probe_rsp(struct mac_context * mac_ctx,struct pe_session * session,uint8_t * probe_rsp,uint32_t probe_rsp_len)779 lim_process_cu_for_probe_rsp(struct mac_context *mac_ctx,
780 			     struct pe_session *session,
781 			     uint8_t *probe_rsp,
782 			     uint32_t probe_rsp_len)
783 {
784 	return QDF_STATUS_SUCCESS;
785 }
786 #endif
787 
788 #ifdef WLAN_FEATURE_SR
789 
790 /**
791  * lim_update_vdev_sr_elements() - Update VDEV variable with
792  * parsed values received in SRP IE
793  * @session_entry: pe session
794  * @sta_ds: STA node
795  *
796  * Return void
797  */
798 void lim_update_vdev_sr_elements(struct pe_session *session_entry,
799 				 tpDphHashNode sta_ds);
800 
801 /**
802  * lim_process_srp_ie() - process srp ie during re/association
803  * @tpSirAssocRsp: assoc response
804  * @tpDphHashNode: sta node
805  *
806  * Return: success/failure
807  */
808 QDF_STATUS lim_process_srp_ie(tpSirAssocRsp ar, tpDphHashNode sta_ds);
809 
810 /**
811  * lim_handle_sr_cap() - To handle SR(Spatial Reuse) capability
812  * of roamed AP
813  * @vdev: objmgr vdev
814  * @reason: reason for the update
815  *
816  * This function is to check and compare SR cap of previous and
817  * roamed AP and takes decision to send event to userspace.
818  *
819  * Return: None
820  */
821 void lim_handle_sr_cap(struct wlan_objmgr_vdev *vdev,
822 		       enum sr_osif_reason_code reason);
823 
824 #else
825 static inline void
lim_update_vdev_sr_elements(struct pe_session * session_entry,tpDphHashNode sta_ds)826 lim_update_vdev_sr_elements(struct pe_session *session_entry,
827 			    tpDphHashNode sta_ds)
828 {
829 }
830 
831 static inline
lim_process_srp_ie(tpSirAssocRsp ar,tpDphHashNode sta_ds)832 QDF_STATUS lim_process_srp_ie(tpSirAssocRsp ar, tpDphHashNode sta_ds)
833 {
834 	return QDF_STATUS_SUCCESS;
835 }
836 
837 static inline void
lim_handle_sr_cap(struct wlan_objmgr_vdev * vdev,enum sr_osif_reason_code reason)838 lim_handle_sr_cap(struct wlan_objmgr_vdev *vdev,
839 		  enum sr_osif_reason_code reason)
840 {
841 }
842 #endif
843 
844 #if defined(WLAN_FEATURE_ROAM_OFFLOAD) && defined(WLAN_FEATURE_11BE_MLO)
845 /**
846  * lim_cm_roam_create_session() - Create pe session for legacy to MLO roaming
847  * @mac_ctx: Pointer to mac context
848  * @vdev_id: vdev id
849  * @roam_synch: Pointer to roam synch indication
850  *
851  * This api will check if vdev is link vdev and create a new pe session
852  * for legacy to MLO roaming case.
853  *
854  * Return: pe session
855  */
856 struct pe_session *
857 lim_cm_roam_create_session(struct mac_context *mac_ctx,
858 			   uint8_t vdev_id,
859 			   struct roam_offload_synch_ind *sync_ind);
860 
861 /**
862  * lim_create_and_fill_link_session() - handler for legacy to mlo roaming
863  * @mac_ctx: Pointer to mac context
864  * @vdev_id: vdev id
865  * @roam_synch: Pointer to roam synch indication
866  * @ie_len: ie length
867  *
868  * This is a lim level api called to handle legacy to MLO roaming scenario.
869  *
870  * Return: qdf status
871  */
872 QDF_STATUS
873 lim_create_and_fill_link_session(struct mac_context *mac_ctx,
874 				 uint8_t vdev_id,
875 				 struct roam_offload_synch_ind *sync_ind,
876 				 uint16_t ie_len);
877 
878 /**
879  * lim_cm_fill_link_session() - Update link session parameters
880  * @mac_ctx: Pointer to mac context
881  * @vdev_id: vdev id
882  * @pe_session: Pointer to pe session
883  * @roam_synch: Pointer to roam synch indication
884  * @ie_len: ie length
885  *
886  * This api will fill pe session and also fill the BSS descriptor
887  * which will be helpful further to complete the roam synch propagation.
888  *
889  * Return: qdf status
890  */
891 QDF_STATUS
892 lim_cm_fill_link_session(struct mac_context *mac_ctx,
893 			 uint8_t vdev_id,
894 			 struct pe_session *pe_session,
895 			 struct roam_offload_synch_ind *sync_ind,
896 			 uint16_t ie_len);
897 
898 /**
899  * lim_roam_mlo_create_peer() - Create roam mlo peer
900  * @mac_ctx: Pointer to mac context
901  * @sync_ind: Pointer to roam synch indication
902  * @vdev_id: vdev id
903  * @peer_mac: Peer mac pointer
904  *
905  * This api will create mlo peer called during mlo roaming scenario
906  *
907  * Return: QDF_STATUS
908  */
909 QDF_STATUS lim_roam_mlo_create_peer(struct mac_context *mac,
910 				    struct roam_offload_synch_ind *sync_ind,
911 				    uint8_t vdev_id, uint8_t *peer_mac);
912 
913 /**
914  * lim_mlo_roam_delete_link_peer() - Delete mlo link peer
915  * @pe_session: Pointer to pe session
916  * @sta_ds: sta state node
917  *
918  * This api will delete mlo link peer called during mlo roaming scenario
919  *
920  * Return: none
921  */
922 void
923 lim_mlo_roam_delete_link_peer(struct pe_session *pe_session,
924 			      tpDphHashNode sta_ds);
925 #else
926 static inline struct pe_session *
lim_cm_roam_create_session(struct mac_context * mac_ctx,uint8_t vdev_id,struct roam_offload_synch_ind * sync_ind)927 lim_cm_roam_create_session(struct mac_context *mac_ctx,
928 			   uint8_t vdev_id,
929 			   struct roam_offload_synch_ind *sync_ind)
930 {
931 	return NULL;
932 }
933 
934 static inline QDF_STATUS
lim_create_and_fill_link_session(struct mac_context * mac_ctx,uint8_t vdev_id,struct roam_offload_synch_ind * sync_ind,uint16_t ie_len)935 lim_create_and_fill_link_session(struct mac_context *mac_ctx,
936 				 uint8_t vdev_id,
937 				 struct roam_offload_synch_ind *sync_ind,
938 				 uint16_t ie_len)
939 {
940 	return QDF_STATUS_E_NOSUPPORT;
941 }
942 
943 static inline QDF_STATUS
lim_cm_fill_link_session(struct mac_context * mac_ctx,uint8_t vdev_id,struct pe_session * pe_session,struct roam_offload_synch_ind * sync_ind,uint16_t ie_len)944 lim_cm_fill_link_session(struct mac_context *mac_ctx,
945 			 uint8_t vdev_id,
946 			 struct pe_session *pe_session,
947 			 struct roam_offload_synch_ind *sync_ind,
948 			 uint16_t ie_len)
949 {
950 	return QDF_STATUS_E_NOSUPPORT;
951 }
952 
953 static inline QDF_STATUS
lim_roam_mlo_create_peer(struct mac_context * mac,struct roam_offload_synch_ind * sync_ind,uint8_t vdev_id,uint8_t * peer_mac)954 lim_roam_mlo_create_peer(struct mac_context *mac,
955 			 struct roam_offload_synch_ind *sync_ind,
956 			 uint8_t vdev_id, uint8_t *peer_mac)
957 {
958 	return QDF_STATUS_SUCCESS;
959 }
960 
961 static inline void
lim_mlo_roam_delete_link_peer(struct pe_session * pe_session,tpDphHashNode sta_ds)962 lim_mlo_roam_delete_link_peer(struct pe_session *pe_session,
963 			      tpDphHashNode sta_ds)
964 {
965 }
966 #endif /* WLAN_FEATURE_ROAM_OFFLOAD && WLAN_FEATURE_11BE_MLO */
967 
968 enum ani_akm_type
969 lim_get_connected_akm(struct pe_session *session, int32_t ucast_cipher,
970 		      int32_t auth_mode, int32_t akm);
971 
972 /**
973  * lim_get_encrypt_ed_type() - Get encrypt type
974  * @ucast_cipher: Ucast cipher
975  *
976  * Return: Encryption type enum
977  */
978 tAniEdType lim_get_encrypt_ed_type(int32_t ucast_cipher);
979 /************************************************************/
980 #endif /* __LIM_API_H */
981