xref: /wlan-driver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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   * DOC: This file provides the common definitions for object manager
21   */
22 
23 #ifndef _WLAN_OBJMGR_CMN_H_
24 #define _WLAN_OBJMGR_CMN_H_
25 
26 #include "qdf_lock.h"
27 #include "qdf_list.h"
28 #include "qdf_status.h"
29 #include "wlan_cmn.h"
30 #include "qdf_atomic.h"
31 
32 /* No. of PSOCs can be supported */
33 #define WLAN_OBJMGR_MAX_DEVICES 5
34 
35 /* size of Hash */
36 #define WLAN_PEER_HASHSIZE 64
37 
38 /* simple hash is enough for variation of macaddr */
39 #define WLAN_PEER_HASH(addr)   \
40 (((const uint8_t *)(addr))[QDF_MAC_ADDR_SIZE - 1] % WLAN_PEER_HASHSIZE)
41 
42 #define obj_mgr_log(level, args...) \
43 		QDF_TRACE(QDF_MODULE_ID_OBJ_MGR, level, ## args)
44 #define obj_mgr_logfl(level, format, args...) \
45 		obj_mgr_log(level, FL(format), ## args)
46 #define obj_mgr_log_level(level, format, args...)\
47 		obj_mgr_logfl(level, format, ## args)
48 
49 #define obj_mgr_alert(params...) \
50 	QDF_TRACE_FATAL(QDF_MODULE_ID_OBJ_MGR, params)
51 #define obj_mgr_err(params...) \
52 	QDF_TRACE_ERROR(QDF_MODULE_ID_OBJ_MGR, params)
53 #define obj_mgr_warn(params...) \
54 	QDF_TRACE_WARN(QDF_MODULE_ID_OBJ_MGR, params)
55 #define obj_mgr_info(params...) \
56 	QDF_TRACE_INFO(QDF_MODULE_ID_OBJ_MGR, params)
57 #define obj_mgr_debug(params...) \
58 	QDF_TRACE_DEBUG(QDF_MODULE_ID_OBJ_MGR, params)
59 
60 #define objmgr_nofl_alert(params...) \
61 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_OBJ_MGR, params)
62 #define objmgr_nofl_err(params...) \
63 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_OBJ_MGR, params)
64 #define objmgr_nofl_warn(params...) \
65 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_OBJ_MGR, params)
66 #define objmgr_nofl_info(params...) \
67 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_OBJ_MGR, params)
68 #define objmgr_nofl_debug(params...) \
69 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_OBJ_MGR, params)
70 
71 #define obj_mgr_debug_hex(ptr, size) \
72 	qdf_trace_hex_dump(QDF_MODULE_ID_OBJ_MGR, \
73 			   QDF_TRACE_LEVEL_DEBUG, ptr, size)
74 
75 /**
76  * enum WLAN_OBJ_STATE - State of Object
77  * @WLAN_OBJ_STATE_ALLOCATED:           Common object is allocated, but not
78  *                                      fully initialized
79  * @WLAN_OBJ_STATE_CREATED:             All component objects are created
80  * @WLAN_OBJ_STATE_DELETED:             All component objects are destroyed
81  * @WLAN_OBJ_STATE_PARTIALLY_CREATED:   Few/All component objects creation is
82  *                                      in progress
83  * @WLAN_OBJ_STATE_PARTIALLY_DELETED:   Component objects deletion is triggered,
84  *                                      they are yet to be destroyed
85  * @WLAN_OBJ_STATE_COMP_DEL_PROGRESS:   If a component is disabled run time,
86  *                                      and this state is used to represent the
87  *                                      deletion in progress after that
88  *                                      component object is destroyed, object
89  *                                      state would be moved to CREATED state
90  * @WLAN_OBJ_STATE_LOGICALLY_DELETED:   Object deletion has been initiated,
91  *                                      object destroy invoked once references
92  *                                      are released
93  * @WLAN_OBJ_STATE_CREATION_FAILED:     any component object is failed to be
94  *                                      created
95  * @WLAN_OBJ_STATE_DELETION_FAILED:     any component object is failed to be
96  *                                      destroyed
97  */
98 typedef enum {
99 	WLAN_OBJ_STATE_ALLOCATED          = 0,
100 	WLAN_OBJ_STATE_CREATED            = 1,
101 	WLAN_OBJ_STATE_DELETED            = 2,
102 	WLAN_OBJ_STATE_PARTIALLY_CREATED  = 3,
103 	WLAN_OBJ_STATE_PARTIALLY_DELETED  = 4,
104 	WLAN_OBJ_STATE_COMP_DEL_PROGRESS  = 5,
105 	WLAN_OBJ_STATE_LOGICALLY_DELETED  = 6,
106 	WLAN_OBJ_STATE_CREATION_FAILED    = 7,
107 	WLAN_OBJ_STATE_DELETION_FAILED    = 8,
108 } WLAN_OBJ_STATE;
109 
110 /* Object type is assigned with value */
111 enum wlan_objmgr_obj_type {
112 	WLAN_PSOC_OP      = 0,
113 	WLAN_PDEV_OP      = 1,
114 	WLAN_VDEV_OP      = 2,
115 	WLAN_PEER_OP      = 3,
116 	WLAN_OBJ_TYPE_MAX = 4,
117 };
118 
119 /**
120  * struct wlan_peer_list - peer list hash
121  * @peer_hash:      peer sub lists
122  * @peer_list_lock: List lock, this has to be acquired on
123  *		    accessing/updating the list
124  *
125  *  Peer list, it maintains sublists based on the MAC address as hash
126  *  Note: For DA WDS similar peer list has to be maintained
127  *  This peer list will not have WDS nodes
128  */
129 struct wlan_peer_list {
130 	qdf_list_t peer_hash[WLAN_PEER_HASHSIZE];
131 	qdf_spinlock_t peer_list_lock;
132 };
133 
134 struct wlan_objmgr_psoc;
135 struct wlan_objmgr_pdev;
136 struct wlan_objmgr_vdev;
137 struct wlan_objmgr_peer;
138 
139 /* Create handler would return the following status
140 	QDF_STATUS_SUCCESS--
141 		For synchronous handler:- this is returned on successful
142 	component object creation
143 
144 	QDF_STATUS_COMP_DISABLED--
145 		For synchronous handler:- this is returned on if component
146 	doesn't want to allocate
147 
148 	QDF_STATUS_COMP_ASYNC--
149 		For asynchronous handler:- this is returned on if component
150 	needs a context break
151 
152 	QDF_STATUS_E_NOMEM--
153 		For synchronous handler:- this is returned on if component
154 	can't allocate
155 	QDF_STATUS_E_FAILURE--
156 		For synchronous handler:- If it is failed,
157 		For asynchronous handler:- If it is failed to post message
158 	(means, not required)/feature is not supported
159 */
160 typedef QDF_STATUS (*wlan_objmgr_psoc_create_handler)(
161 				struct wlan_objmgr_psoc *psoc, void *arg);
162 typedef QDF_STATUS (*wlan_objmgr_psoc_destroy_handler)(
163 				struct wlan_objmgr_psoc *psoc, void *arg);
164 typedef void (*wlan_objmgr_psoc_status_handler)(struct wlan_objmgr_psoc *psoc,
165 					 void *arg, QDF_STATUS status);
166 
167 typedef QDF_STATUS (*wlan_objmgr_pdev_create_handler)(
168 				struct wlan_objmgr_pdev *pdev, void *arg);
169 typedef QDF_STATUS (*wlan_objmgr_pdev_destroy_handler)(
170 				struct wlan_objmgr_pdev *pdev, void *arg);
171 typedef void (*wlan_objmgr_pdev_status_handler)(
172 				struct wlan_objmgr_pdev *pdev, void *arg,
173 						QDF_STATUS status);
174 
175 typedef QDF_STATUS (*wlan_objmgr_vdev_create_handler)(
176 				struct wlan_objmgr_vdev *vdev, void *arg);
177 typedef QDF_STATUS (*wlan_objmgr_vdev_destroy_handler)(
178 				struct wlan_objmgr_vdev *vdev, void *arg);
179 typedef void (*wlan_objmgr_vdev_status_handler)(
180 				struct wlan_objmgr_vdev *vdev, void *arg,
181 						QDF_STATUS status);
182 typedef void (*wlan_objmgr_vdev_peer_free_notify_handler)(
183 				struct wlan_objmgr_vdev *vdev);
184 
185 
186 typedef QDF_STATUS (*wlan_objmgr_peer_create_handler)(
187 				struct wlan_objmgr_peer *peer, void *arg);
188 typedef QDF_STATUS (*wlan_objmgr_peer_destroy_handler)(
189 				struct wlan_objmgr_peer *peer, void *arg);
190 typedef void (*wlan_objmgr_peer_status_handler)(
191 				struct wlan_objmgr_peer *peer, void *arg,
192 						QDF_STATUS status);
193 
194 /**
195  * enum wlan_objmgr_ref_dbgid - ref count debug id
196  * @WLAN_OBJMGR_ID:             Object manager internal operations
197  * @WLAN_MLME_SB_ID:            MLME Southbound operations
198  * @WLAN_MLME_NB_ID:            MLME Northbound operations
199  * @WLAN_MGMT_SB_ID:            MGMT Northbound operations
200  * @WLAN_MGMT_NB_ID:            MGMT Southbound operations
201  * @WLAN_HDD_ID_OBJ_MGR:        HDD Object Manager operations
202  * @WLAN_OSIF_ID:               New component's OS IF ID
203  * @WLAN_LEGACY_MAC_ID:         Legacy MAC operations
204  * @WLAN_LEGACY_WMA_ID:         Legacy WMA operations
205  * @WLAN_SERIALIZATION_ID:      Serialization operations
206  * @WLAN_PMO_ID:                power manager offload (PMO) ID
207  * @WLAN_LEGACY_SME_ID:         Legacy SME operations
208  * @WLAN_SCAN_ID:               scan operations
209  * @WLAN_WIFI_POS_CORE_ID:      wifi positioning (CORE)
210  * @WLAN_DFS_ID:                DFS operations
211  * @WLAN_P2P_ID:                P2P operations
212  * @WLAN_TDLS_SB_ID:            TDLS Southbound operations
213  * @WLAN_TDLS_NB_ID:            TDLS Northbound operations
214  * @WLAN_ATF_ID:                Airtime Fairness operations
215  * @WLAN_CRYPTO_ID:             Crypto service operation
216  * @WLAN_NAN_ID:                nan operations
217  * @WLAN_REGULATORY_SB_ID:      SB regulatory operations
218  * @WLAN_REGULATORY_NB_ID:      NB regulatory operations
219  * @WLAN_OFFCHAN_TXRX_ID:       Offchannel TxRx
220  * @WLAN_POLICY_MGR_ID:         Policy Manager operations
221  * @WLAN_SON_ID:                SON
222  * @WLAN_SA_API_ID:             SA PAI
223  * @WLAN_SPECTRAL_ID:           Spectral operations
224  * @WLAN_SPLITMAC_ID:           SplitMac
225  * @WLAN_DEBUG_ID:              Debug operations
226  * @WLAN_DIRECT_BUF_RX_ID:      Direct Buffer Receive operations
227  * @WLAN_DISA_ID:               DISA (encryption test) operations
228  * @WLAN_FTM_ID:                FTM module
229  * @WLAN_FD_ID:                 FILS Discovery
230  * @WLAN_OCB_NB_ID:             OCB Northbound operations
231  * @WLAN_OCB_SB_ID:             OCB Southbound operations
232  * @WLAN_INIT_DEINIT_ID:        Init deinit module
233  * @WLAN_IPA_ID:                IPA operations
234  * @WLAN_CP_STATS_ID:           Control Plane Statistics Module
235  * @WLAN_GREEN_AP_ID:           Green AP operations
236  * @WLAN_WIFI_POS_OSIF_ID:      wifi positioning (OSID)
237  * @WLAN_WIFI_POS_TGT_IF_ID:    wifi positioning (Target IF)
238  * @WLAN_MLME_OBJ_DEL_ID:       Object delete req/resp tracking with FW
239  * @WLAN_ACTION_OUI_ID:         action oui operations
240  * @WLAN_LEGACY_SAP_ID:         legacy sap fsm
241  * @WLAN_PDEV_TARGET_IF_ID:     Target interface layer for pdev APIs
242  * @WLAN_MLME_SER_IF_ID:        mlme serialization interface layer
243  * @WLAN_SCHEDULER_ID:          mlme scheduler
244  * @WLAN_CFR_ID:                CFG Capture method
245  * @WLAN_VDEV_TARGET_IF_ID:     Target interface layer
246  * @WLAN_RX_PKT_TAG_ID:         RX protocol tag operations
247  * @WLAN_INTEROP_ISSUES_AP_ID:  interop issues ap operation
248  * @WLAN_WDS_ID:                WDS operations
249  * @WLAN_PROXY_ARP_ID:          AP proxy ARP
250  * @WLAN_WNM_ID:                wireless network management operations
251  * @WLAN_RRM_ID:                Radio resource management operations
252  * @WLAN_TR69_ID:               TR69 operations
253  * @WLAN_MGMT_RX_ID:            Legacy offload management frame input handler
254  * @WLAN_MGMT_TX_ID:            Legacy offload management frame output handler
255  * @WLAN_NSS_IF_ID:             NSS offload interface operations
256  * @WLAN_MBO_ID:                MBO operations
257  * @WLAN_RTT_ID:                RTT operations
258  * @WLAN_ALD_ID:                Ath Link Diagnostic operations
259  * @WLAN_ME_ID:                 Multicast enhancement operations
260  * @WLAN_MGMT_HANDLER_ID:       Management frame handler
261  * @WLAN_MLME_HANDLER_ID:       MLME handler
262  * @WLAN_DBDC_ID:               Dual Band Dual Concurrent mode operations
263  * @WLAN_MLME_OBJMGR_ID:        MLME object manager operations VAP, Node
264  * @WLAN_OFFCHAN_TX_ID:         Offchannel Tx operations
265  * @WLAN_MISC_ID:               power manager, PAPI, rate set, etc.
266  * @WLAN_FWOL_NB_ID:            fw offload northbound operations
267  * @WLAN_FWOL_SB_ID:            fw offload southbound operations
268  * @WLAN_PSOC_TARGET_IF_ID:     PSOC related target_if operations
269  * @FTM_TIME_SYNC_ID:           ftm time sync operations
270  * @WLAN_PKT_CAPTURE_ID:        Packet capture operations
271  * @WLAN_DCS_ID:                DCS operations
272  * @WLAN_IOT_SIM_ID:            IOT Simulation feature
273  * @WLAN_MLME_CM_ID:            Connection Manager reference ID
274  * @WLAN_IF_MGR_ID:             Interface manager reference ID
275  * @WLAN_OSIF_SCAN_ID:          SCAN operations in OS IF
276  * @WLAN_OSIF_MGMT_ID:          MGMT frame operations in OS IF
277  * @WLAN_OSIF_STATS_ID:         STATS request operations in OS IF
278  * @WLAN_OSIF_NAN_ID:           NAN operations in OS IF
279  * @WLAN_OSIF_P2P_ID:           P2P operations in OS IF
280  * @WLAN_OSIF_OCB_ID:           OCB operations in OS IF
281  * @WLAN_OSIF_SPECTRAL_ID:      spectal operations in OS IF
282  * @WLAN_OSIF_POWER_ID:         power operations in OS IF
283  * @WLAN_OSIF_TDLS_ID:          TDLS operations in OS IF
284  * @WLAN_OSIF_CM_ID:            Connection manager osif reference id
285  * @WLAN_TXRX_STREAMS_ID:       Preferred TX & RX streams operations
286  * @WLAN_MLO_MGR_ID:            MLO manager reference id
287  * @WLAN_MBSS_ID:               MBSS reference ID
288  * @WLAN_MGMT_RX_REO_ID:        Management rx reorder reference id
289  * @WLAN_MGMT_RX_REO_SIM_ID:    Management rx reorder simulation reference id
290  * @WLAN_TWT_ID:                TWT component id
291  * @WLAN_LITE_MON_ID:           Lite monitor operations
292  * @WLAN_PRE_CAC_ID:            Pre-CAC operations
293  * @WLAN_DP_ID:                 DP component
294  * @WLAN_UMAC_RESET_ID:         Umac reset feature reference id
295  * @WLAN_COAP_ID:               Constrained Application Protocol reference id
296  * @WLAN_SAWF_ID:               Service Aware Wifi reference id
297  * @WLAN_QMI_ID:                QMI component id
298  * @WLAN_AFC_ID:                AFC reference id
299  * @WLAN_INTRA_BSS:             Intra bss reference id
300  * @WLAN_ROAM_ID:               Roam reference id
301  * @WLAN_LL_SAP_ID:             LL SAP reference id
302  * @WLAN_COEX_ID:               COEX reference id
303  * @WLAN_REF_ID_MAX:            Max id used to generate ref count tracking array
304  */
305  /* New value added to the enum must also be reflected in function
306   * string_from_dbgid()
307   */
308 typedef enum {
309 	WLAN_OBJMGR_ID        = 0,
310 	WLAN_MLME_SB_ID       = 1,
311 	WLAN_MLME_NB_ID       = 2,
312 	WLAN_MGMT_SB_ID       = 3,
313 	WLAN_MGMT_NB_ID       = 4,
314 	WLAN_HDD_ID_OBJ_MGR   = 5,
315 	WLAN_OSIF_ID          = 6,
316 	WLAN_LEGACY_MAC_ID    = 7,
317 	WLAN_LEGACY_WMA_ID    = 8,
318 	WLAN_SERIALIZATION_ID = 9,
319 	WLAN_PMO_ID           = 10,
320 	WLAN_LEGACY_SME_ID    = 11,
321 	WLAN_SCAN_ID          = 12,
322 	WLAN_WIFI_POS_CORE_ID = 13,
323 	WLAN_DFS_ID           = 14,
324 	WLAN_P2P_ID           = 15,
325 	WLAN_TDLS_SB_ID       = 16,
326 	WLAN_TDLS_NB_ID       = 17,
327 	WLAN_ATF_ID           = 18,
328 	WLAN_CRYPTO_ID        = 19,
329 	WLAN_NAN_ID           = 20,
330 	WLAN_REGULATORY_SB_ID = 21,
331 	WLAN_REGULATORY_NB_ID = 22,
332 	WLAN_OFFCHAN_TXRX_ID  = 23,
333 	WLAN_POLICY_MGR_ID    = 24,
334 	WLAN_SON_ID           = 25,
335 	WLAN_SA_API_ID        = 26,
336 	WLAN_SPECTRAL_ID      = 27,
337 	WLAN_SPLITMAC_ID      = 28,
338 	WLAN_DEBUG_ID         = 29,
339 	WLAN_DIRECT_BUF_RX_ID = 30,
340 	WLAN_DISA_ID          = 31,
341 	WLAN_FTM_ID           = 32,
342 	WLAN_FD_ID            = 33,
343 	WLAN_OCB_NB_ID        = 34,
344 	WLAN_OCB_SB_ID        = 35,
345 	WLAN_INIT_DEINIT_ID   = 36,
346 	WLAN_IPA_ID           = 37,
347 	WLAN_CP_STATS_ID      = 38,
348 	WLAN_GREEN_AP_ID      = 39,
349 	WLAN_WIFI_POS_OSIF_ID = 40,
350 	WLAN_WIFI_POS_TGT_IF_ID = 41,
351 	WLAN_MLME_OBJ_DEL_ID    = 42,
352 	WLAN_ACTION_OUI_ID      = 43,
353 	WLAN_LEGACY_SAP_ID      = 44,
354 	WLAN_PDEV_TARGET_IF_ID     = 45,
355 	WLAN_MLME_SER_IF_ID        = 46,
356 	WLAN_SCHEDULER_ID          = 47,
357 	WLAN_CFR_ID                = 48,
358 	WLAN_VDEV_TARGET_IF_ID     = 49,
359 	WLAN_RX_PKT_TAG_ID         = 50,
360 	WLAN_INTEROP_ISSUES_AP_ID           = 51,
361 	WLAN_WDS_ID           = 52,
362 	WLAN_PROXY_ARP_ID     = 53,
363 	WLAN_WNM_ID           = 54,
364 	WLAN_RRM_ID           = 55,
365 	WLAN_TR69_ID          = 56,
366 	WLAN_MGMT_RX_ID       = 57,
367 	WLAN_MGMT_TX_ID       = 58,
368 	WLAN_NSS_IF_ID        = 59,
369 	WLAN_MBO_ID           = 60,
370 	WLAN_RTT_ID           = 61,
371 	WLAN_ALD_ID           = 62,
372 	WLAN_ME_ID            = 63,
373 	WLAN_MGMT_HANDLER_ID  = 64,
374 	WLAN_MLME_HANDLER_ID  = 65,
375 	WLAN_DBDC_ID          = 66,
376 	WLAN_MLME_OBJMGR_ID   = 67,
377 	WLAN_OFFCHAN_TX_ID    = 68,
378 	WLAN_MISC_ID          = 69,
379 	WLAN_FWOL_NB_ID       = 70,
380 	WLAN_FWOL_SB_ID       = 71,
381 	WLAN_PSOC_TARGET_IF_ID = 72,
382 	FTM_TIME_SYNC_ID       = 73,
383 	WLAN_PKT_CAPTURE_ID   = 74,
384 	WLAN_DCS_ID           = 75,
385 	WLAN_IOT_SIM_ID       = 76,
386 	WLAN_MLME_CM_ID       = 77,
387 	WLAN_IF_MGR_ID        = 78,
388 	/* Create WLAN_OSIF sub id based on functionality */
389 	WLAN_OSIF_SCAN_ID     = 79,
390 	WLAN_OSIF_MGMT_ID     = 80,
391 	WLAN_OSIF_STATS_ID    = 81,
392 	WLAN_OSIF_NAN_ID      = 82,
393 	WLAN_OSIF_P2P_ID      = 83,
394 	WLAN_OSIF_OCB_ID      = 84,
395 	WLAN_OSIF_SPECTRAL_ID = 85,
396 	WLAN_OSIF_POWER_ID    = 86,
397 	WLAN_OSIF_TDLS_ID     = 87,
398 	WLAN_OSIF_CM_ID       = 88,
399 	WLAN_TXRX_STREAMS_ID  = 89,
400 	WLAN_MLO_MGR_ID       = 90,
401 	WLAN_MBSS_ID          = 91,
402 	WLAN_MGMT_RX_REO_ID   = 92,
403 	WLAN_MGMT_RX_REO_SIM_ID   = 93,
404 	WLAN_TWT_ID           = 94,
405 	WLAN_LITE_MON_ID      = 95,
406 	WLAN_PRE_CAC_ID       = 96,
407 	WLAN_DP_ID            = 97,
408 	WLAN_UMAC_RESET_ID    = 98,
409 	WLAN_COAP_ID          = 99,
410 	WLAN_SAWF_ID          = 100,
411 	WLAN_QMI_ID           = 101,
412 	WLAN_AFC_ID           = 102,
413 	WLAN_INTRA_BSS        = 103,
414 	WLAN_ROAM_ID          = 104,
415 	WLAN_LL_SAP_ID        = 105,
416 	WLAN_COEX_ID          = 106,
417 	WLAN_REF_ID_MAX,
418 } wlan_objmgr_ref_dbgid;
419 
420 /**
421  * string_from_dbgid() - Convert Refcnt dbgid to respective string
422  * @id: Reference count debug id
423  *
424  * Debug support function to convert refcnt dbgid to string.
425  * Please note to add new string in the array at index equal to
426  * its enum value in wlan_objmgr_ref_dbgid.
427  */
string_from_dbgid(wlan_objmgr_ref_dbgid id)428 static inline const char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
429 {
430 	static const char *strings[WLAN_REF_ID_MAX] = { "WLAN_OBJMGR_ID",
431 					"WLAN_MLME_SB_ID",
432 					"WLAN_MLME_NB_ID",
433 					"WLAN_MGMT_SB_ID",
434 					"WLAN_MGMT_NB_ID",
435 					"WLAN_HDD_ID_OBJ_MGR",
436 					"WLAN_OSIF_ID",
437 					"WLAN_LEGACY_MAC_ID",
438 					"WLAN_LEGACY_WMA_ID",
439 					"WLAN_SERIALIZATION_ID",
440 					"WLAN_PMO_ID",
441 					"WLAN_LEGACY_SME_ID",
442 					"WLAN_SCAN_ID",
443 					"WLAN_WIFI_POS_CORE_ID",
444 					"WLAN_DFS_ID",
445 					"WLAN_P2P_ID",
446 					"WLAN_TDLS_SB_ID",
447 					"WLAN_TDLS_NB_ID",
448 					"WLAN_ATF_ID",
449 					"WLAN_CRYPTO_ID",
450 					"WLAN_NAN_ID",
451 					"WLAN_REGULATORY_SB_ID",
452 					"WLAN_REGULATORY_NB_ID",
453 					"WLAN_OFFCHAN_TXRX_ID",
454 					"WLAN_POLICY_MGR_ID",
455 					"WLAN_SON_ID",
456 					"WLAN_SA_API_ID",
457 					"WLAN_SPECTRAL_ID",
458 					"WLAN_SPLITMAC_ID",
459 					"WLAN_DEBUG_ID",
460 					"WLAN_DIRECT_BUF_RX_ID",
461 					"WLAN_DISA_ID",
462 					"WLAN_FTM_ID",
463 					"WLAN_FD_ID",
464 					"WLAN_OCB_NB_ID",
465 					"WLAN_OCB_SB_ID",
466 					"WLAN_INIT_DEINIT_ID",
467 					"WLAN_IPA_ID",
468 					"WLAN_CP_STATS_ID",
469 					"WLAN_GREEN_AP_ID",
470 					"WLAN_WIFI_POS_OSIF_ID",
471 					"WLAN_WIFI_POS_TGT_IF_ID",
472 					"WLAN_MLME_OBJ_DEL_ID",
473 					"WLAN_ACTION_OUI_ID",
474 					"WLAN_LEGACY_SAP_ID",
475 					"WLAN_PDEV_TARGET_IF_ID",
476 					"WLAN_MLME_SER_IF_ID",
477 					"WLAN_SCHEDULER_ID",
478 					"WLAN_CFR_ID",
479 					"WLAN_VDEV_TARGET_IF_ID",
480 					"WLAN_RX_PKT_TAG_ID",
481 					"WLAN_INTEROP_ISSUES_AP_ID",
482 					"WLAN_WDS_ID",
483 					"WLAN_PROXY_ARP_ID",
484 					"WLAN_WNM_ID",
485 					"WLAN_RRM_ID",
486 					"WLAN_TR69_ID",
487 					"WLAN_MGMT_RX_ID",
488 					"WLAN_MGMT_TX_ID",
489 					"WLAN_NSS_IF_ID",
490 					"WLAN_MBO_ID",
491 					"WLAN_RTT_ID",
492 					"WLAN_ALD_ID",
493 					"WLAN_ME_ID",
494 					"WLAN_MGMT_HANDLER_ID",
495 					"WLAN_MLME_HANDLER_ID",
496 					"WLAN_DBDC_ID",
497 					"WLAN_MLME_OBJMGR_ID",
498 					"WLAN_OFFCHAN_TX_ID",
499 					"WLAN_MISC_ID",
500 					"WLAN_FWOL_NB_ID",
501 					"WLAN_FWOL_SB_ID",
502 					"WLAN_PSOC_TARGET_IF_ID",
503 					"FTM_TIME_SYNC_ID",
504 					"WLAN_PKT_CAPTURE_ID",
505 					"WLAN_DCS_ID",
506 					"WLAN_IOT_SIM_ID",
507 					"WLAN_MLME_CM_ID",
508 					"WLAN_IF_MGR_ID",
509 					"WLAN_OSIF_SCAN_ID",
510 					"WLAN_OSIF_MGMT_ID",
511 					"WLAN_OSIF_STATS_ID",
512 					"WLAN_OSIF_NAN_ID",
513 					"WLAN_OSIF_P2P_ID",
514 					"WLAN_OSIF_OCB_ID",
515 					"WLAN_OSIF_SPECTRAL_ID",
516 					"WLAN_OSIF_POWER_ID",
517 					"WLAN_OSIF_TDLS_ID",
518 					"WLAN_OSIF_CM_ID",
519 					"WLAN_TXRX_STREAMS_ID",
520 					"WLAN_MLO_MGR_ID",
521 					"WLAN_MBSS_ID",
522 					"WLAN_MGMT_RX_REO_ID",
523 					"WLAN_MGMT_RX_REO_SIM_ID",
524 					"WLAN_TWT_ID",
525 					"WLAN_LITE_MON_ID",
526 					"WLAN_PRE_CAC_ID",
527 					"WLAN_DP_ID",
528 					"WLAN_UMAC_RESET_ID",
529 					"WLAN_COAP_ID",
530 					"WLAN_SAWF_ID",
531 					"WLAN_QMI_ID",
532 					"WLAN_AFC_ID",
533 					"WLAN_INTRA_BSS",
534 					"WLAN_ROAM_ID",
535 					"WLAN_LL_SAP_ID",
536 					"WLAN_COEX_ID"
537 					};
538 
539 	if (id >= WLAN_REF_ID_MAX)
540 		return "Unknown";
541 
542 	return strings[id];
543 }
544 
545 #ifdef WLAN_OBJMGR_DEBUG
546 #define WLAN_OBJMGR_BUG(val) QDF_BUG(val)
547 #else
548 #define WLAN_OBJMGR_BUG(val)
549 #endif
550 
551 #ifndef WLAN_OBJMGR_RATELIMIT_THRESH
552 #define WLAN_OBJMGR_RATELIMIT_THRESH 2
553 #endif
554 
555 #ifdef WLAN_OBJMGR_REF_ID_TRACE
556 #define WLAN_OBJMGR_TRACE_FUNC_SIZE 30
557 /**
558  * struct wlan_objmgr_line_ref - line reference data
559  * @line:  line number
560  * @cnt:   line reference count
561  */
562 struct wlan_objmgr_line_ref {
563 	uint32_t line;
564 	qdf_atomic_t cnt;
565 };
566 
567 /**
568  * struct wlan_objmgr_line_ref_node - line reference node
569  * @line_ref:    line reference data
570  * @next:        pointer to next line reference
571  */
572 struct wlan_objmgr_line_ref_node {
573 	struct wlan_objmgr_line_ref line_ref;
574 	struct wlan_objmgr_line_ref_node *next;
575 };
576 
577 /**
578  * struct wlan_objmgr_trace_func - trace function data
579  * @func:        function pointer
580  * @line_head:   pointer to head line trace reference
581  * @next:        pointer to next function reference
582  */
583 struct wlan_objmgr_trace_func {
584 	char func[WLAN_OBJMGR_TRACE_FUNC_SIZE];
585 	struct wlan_objmgr_line_ref_node *line_head;
586 	struct wlan_objmgr_trace_func *next;
587 };
588 
589 /**
590  * struct wlan_objmgr_trace_id - trace reference data
591  * @num_func:  num of functions
592  * @head:      head pointer to function reference
593  */
594 struct wlan_objmgr_trace_id {
595 	uint32_t num_func;
596 	struct wlan_objmgr_trace_func *head;
597 };
598 
599 /**
600  * struct wlan_objmgr_trace - trace reference data
601  * @references:        reference data
602  * @dereferences:      dereference data
603  * @trace_lock:        lock
604  */
605 struct wlan_objmgr_trace {
606 	struct wlan_objmgr_trace_id references[WLAN_REF_ID_MAX];
607 	struct wlan_objmgr_trace_id dereferences[WLAN_REF_ID_MAX];
608 	qdf_spinlock_t trace_lock;
609 };
610 #endif /*WLAN_OBJMGR_REF_ID_TRACE*/
611 
612 #endif /* _WLAN_OBJMGR_CMN_H_*/
613