xref: /wlan-dirver/qca-wifi-host-cmn/umac/cmn_services/obj_mgr/inc/wlan_objmgr_cmn.h (revision d0c05845839e5f2ba5a8dcebe0cd3e4cd4e8dfcf)
1 /*
2  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
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 {
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_POLICY_MGR_ID:         Policy Manager operations
220  * @WLAN_SON_ID:                SON
221  * @WLAN_SA_API_ID:             SA PAI
222  * @WLAN_SPECTRAL_ID:           Spectral operations
223  * @WLAN_SPLITMAC_ID:           SplitMac
224  * @WLAN_DEBUG_ID:              Debug operations
225  * @WLAN_DIRECT_BUF_RX_ID:      Direct Buffer Receive operations
226  * @WLAN_DISA_ID:               DISA (encryption test) operations
227  * @WLAN_FTM_ID:                FTM module
228  * @WLAN_FD_ID:                 FILS Discovery
229  * @WLAN_OCB_NB_ID:             OCB Northbound operations
230  * @WLAN_OCB_SB_ID:             OCB Southbound operations
231  * @WLAN_INIT_DEINIT_ID:        Init deinit module
232  * @WLAN_IPA_ID:                IPA operations
233  * @WLAN_CP_STATS_ID:           Control Plane Statistics Module
234  * @WLAN_GREEN_AP_ID:           Green AP operations
235  * @WLAN_WIFI_POS_OSIF_ID:      wifi positioning (OSID)
236  * @WLAN_WIFI_POS_TGT_IF_ID:    wifi positioning (Target IF)
237  * @WLAN_MLME_OBJ_DEL_ID:       Object delete req/resp tracking with FW
238  * @WLAN_ACTION_OUI_ID:         action oui operations
239  * @WLAN_LEGACY_SAP_ID:         legacy sap fsm
240  * @WLAN_PDEV_TARGET_IF_ID:     Target interface layer for pdev APIs
241  * @WLAN_MLME_SER_IF_ID:        mlme serialization interface layer
242  * @WLAN_SCHEDULER_ID:          mlme scheduler
243  * @WLAN_CFR_ID:                CFG Capture method
244  * @WLAN_VDEV_TARGET_IF_ID:     Target interface layer
245  * @WLAN_RX_PKT_TAG_ID:         RX protocol tag operations
246  * @WLAN_INTEROP_ISSUES_AP_ID:  interop issues ap operation
247  * @WLAN_WDS_ID:                WDS operations
248  * @WLAN_PROXY_ARP_ID:          AP proxy ARP
249  * @WLAN_WNM_ID:                wireless network management operations
250  * @WLAN_RRM_ID:                Radio resource management operations
251  * @WLAN_TR69_ID:               TR69 operations
252  * @WLAN_MGMT_RX_ID:            Legacy offload management frame input handler
253  * @WLAN_MGMT_TX_ID:            Legacy offload management frame output handler
254  * @WLAN_NSS_IF_ID:             NSS offload interface operations
255  * @WLAN_MBO_ID:                MBO operations
256  * @WLAN_RTT_ID:                RTT operations
257  * @WLAN_ALD_ID:                Ath Link Diagnostic operations
258  * @WLAN_ME_ID:                 Multicast enhancement operations
259  * @WLAN_MGMT_HANDLER_ID:       Management frame handler
260  * @WLAN_MLME_HANDLER_ID:       MLME handler
261  * @WLAN_DBDC_ID:               Dual Band Dual Concurrent mode operations
262  * @WLAN_MLME_OBJMGR_ID:        MLME object manager operations VAP, Node
263  * @WLAN_OFFCHAN_TX_ID:         Offchannel Tx operations
264  * @WLAN_MISC_ID:               power manager, PAPI, rate set, etc.
265  * @WLAN_FWOL_NB_ID:            fw offload northbound operations
266  * @WLAN_FWOL_SB_ID:            fw offload southbound operations
267  * @WLAN_PSOC_TARGET_IF_ID      PSOC related target_if operations
268  * @FTM_TIME_SYNC_ID:           ftm time sync operations
269  * @WLAN_PKT_CAPTURE_ID         Packet capture operations
270  * @WLAN_DCS_ID:                DCS operations
271  * @WLAN_IOT_SIM_ID:            IOT Simulation feature
272  * @WLAN_MLME_CM_ID             Connection Manager reference ID
273  * @WLAN_IF_MGR_ID:             Interface manager reference ID
274  * @WLAN_OSIF_SCAN_ID:          SCAN operations in OS IF
275  * @WLAN_OSIF_MGMT_ID:          MGMT frame operations in OS IF
276  * @WLAN_OSIF_STATS_ID:         STATS request operations in OS IF
277  * @WLAN_OSIF_NAN_ID:           NAN operations in OS IF
278  * @WLAN_OSIF_P2P_ID:           P2P operations in OS IF
279  * @WLAN_OSIF_OCB_ID:           OCB operations in OS IF
280  * @WLAN_OSIF_SPECTRAL_ID:      spectal operations in OS IF
281  * @WLAN_OSIF_POWER_ID:         power operations in OS IF
282  * @WLAN_OSIF_TDLS_ID:          TDLS operations in OS IF
283  * @WLAN_OSIF_CM_ID:            Connection manager osif reference id
284  * @WLAN_TXRX_STREAMS_ID:       Preferred TX & RX streams operations
285  * @WLAN_MLO_MGR_ID:            MLO manager reference id
286  * @WLAN_MGMT_RX_REO_ID:        Management rx reorder reference id
287  * @WLAN_MGMT_RX_REO_SIM_ID:    Management rx reorder simulation reference id
288  * @WLAN_LITE_MON_ID:           Lite monitor operations
289  * @WLAN_PRE_CAC_ID:            Pre-CAC operations
290  * @WLAN_DP_ID:                 DP component
291  * @WLAN_REF_ID_MAX:            Max id used to generate ref count tracking array
292  */
293  /* New value added to the enum must also be reflected in function
294   * string_from_dbgid()
295   */
296 typedef enum {
297 	WLAN_OBJMGR_ID        = 0,
298 	WLAN_MLME_SB_ID       = 1,
299 	WLAN_MLME_NB_ID       = 2,
300 	WLAN_MGMT_SB_ID       = 3,
301 	WLAN_MGMT_NB_ID       = 4,
302 	WLAN_HDD_ID_OBJ_MGR   = 5,
303 	WLAN_OSIF_ID          = 6,
304 	WLAN_LEGACY_MAC_ID    = 7,
305 	WLAN_LEGACY_WMA_ID    = 8,
306 	WLAN_SERIALIZATION_ID = 9,
307 	WLAN_PMO_ID           = 10,
308 	WLAN_LEGACY_SME_ID    = 11,
309 	WLAN_SCAN_ID          = 12,
310 	WLAN_WIFI_POS_CORE_ID = 13,
311 	WLAN_DFS_ID           = 14,
312 	WLAN_P2P_ID           = 15,
313 	WLAN_TDLS_SB_ID       = 16,
314 	WLAN_TDLS_NB_ID       = 17,
315 	WLAN_ATF_ID           = 18,
316 	WLAN_CRYPTO_ID        = 19,
317 	WLAN_NAN_ID           = 20,
318 	WLAN_REGULATORY_SB_ID = 21,
319 	WLAN_REGULATORY_NB_ID = 22,
320 	WLAN_OFFCHAN_TXRX_ID  = 23,
321 	WLAN_POLICY_MGR_ID    = 24,
322 	WLAN_SON_ID           = 25,
323 	WLAN_SA_API_ID        = 26,
324 	WLAN_SPECTRAL_ID      = 27,
325 	WLAN_SPLITMAC_ID      = 28,
326 	WLAN_DEBUG_ID         = 29,
327 	WLAN_DIRECT_BUF_RX_ID = 30,
328 	WLAN_DISA_ID          = 31,
329 	WLAN_FTM_ID           = 32,
330 	WLAN_FD_ID            = 33,
331 	WLAN_OCB_NB_ID        = 34,
332 	WLAN_OCB_SB_ID        = 35,
333 	WLAN_INIT_DEINIT_ID   = 36,
334 	WLAN_IPA_ID           = 37,
335 	WLAN_CP_STATS_ID      = 38,
336 	WLAN_GREEN_AP_ID      = 39,
337 	WLAN_WIFI_POS_OSIF_ID = 40,
338 	WLAN_WIFI_POS_TGT_IF_ID = 41,
339 	WLAN_MLME_OBJ_DEL_ID    = 42,
340 	WLAN_ACTION_OUI_ID      = 43,
341 	WLAN_LEGACY_SAP_ID      = 44,
342 	WLAN_PDEV_TARGET_IF_ID     = 45,
343 	WLAN_MLME_SER_IF_ID        = 46,
344 	WLAN_SCHEDULER_ID          = 47,
345 	WLAN_CFR_ID                = 48,
346 	WLAN_VDEV_TARGET_IF_ID     = 49,
347 	WLAN_RX_PKT_TAG_ID         = 50,
348 	WLAN_INTEROP_ISSUES_AP_ID           = 51,
349 	WLAN_WDS_ID           = 52,
350 	WLAN_PROXY_ARP_ID     = 53,
351 	WLAN_WNM_ID           = 54,
352 	WLAN_RRM_ID           = 55,
353 	WLAN_TR69_ID          = 56,
354 	WLAN_MGMT_RX_ID       = 57,
355 	WLAN_MGMT_TX_ID       = 58,
356 	WLAN_NSS_IF_ID        = 59,
357 	WLAN_MBO_ID           = 60,
358 	WLAN_RTT_ID           = 61,
359 	WLAN_ALD_ID           = 62,
360 	WLAN_ME_ID            = 63,
361 	WLAN_MGMT_HANDLER_ID  = 64,
362 	WLAN_MLME_HANDLER_ID  = 65,
363 	WLAN_DBDC_ID          = 66,
364 	WLAN_MLME_OBJMGR_ID   = 67,
365 	WLAN_OFFCHAN_TX_ID    = 68,
366 	WLAN_MISC_ID          = 69,
367 	WLAN_FWOL_NB_ID       = 70,
368 	WLAN_FWOL_SB_ID       = 71,
369 	WLAN_PSOC_TARGET_IF_ID = 72,
370 	FTM_TIME_SYNC_ID       = 73,
371 	WLAN_PKT_CAPTURE_ID   = 74,
372 	WLAN_DCS_ID           = 75,
373 	WLAN_IOT_SIM_ID       = 76,
374 	WLAN_MLME_CM_ID       = 77,
375 	WLAN_IF_MGR_ID        = 78,
376 	/* Create WLAN_OSIF sub id based on functionality */
377 	WLAN_OSIF_SCAN_ID     = 79,
378 	WLAN_OSIF_MGMT_ID     = 80,
379 	WLAN_OSIF_STATS_ID    = 81,
380 	WLAN_OSIF_NAN_ID      = 82,
381 	WLAN_OSIF_P2P_ID      = 83,
382 	WLAN_OSIF_OCB_ID      = 84,
383 	WLAN_OSIF_SPECTRAL_ID = 85,
384 	WLAN_OSIF_POWER_ID    = 86,
385 	WLAN_OSIF_TDLS_ID     = 87,
386 	WLAN_OSIF_CM_ID       = 88,
387 	WLAN_TXRX_STREAMS_ID  = 89,
388 	WLAN_MLO_MGR_ID       = 90,
389 	WLAN_MBSS_ID          = 91,
390 	WLAN_MGMT_RX_REO_ID   = 92,
391 	WLAN_MGMT_RX_REO_SIM_ID   = 93,
392 	WLAN_TWT_ID           = 94,
393 	WLAN_LITE_MON_ID      = 95,
394 	WLAN_PRE_CAC_ID       = 96,
395 	WLAN_DP_ID            = 97,
396 	WLAN_REF_ID_MAX,
397 } wlan_objmgr_ref_dbgid;
398 
399 /**
400  * string_from_dbgid() - Convert Refcnt dbgid to respective string
401  * @id - Reference count debug id
402  *
403  * Debug support function to convert refcnt dbgid to string.
404  * Please note to add new string in the array at index equal to
405  * its enum value in wlan_objmgr_ref_dbgid.
406  */
407 static inline const char *string_from_dbgid(wlan_objmgr_ref_dbgid id)
408 {
409 	static const char *strings[WLAN_REF_ID_MAX] = { "WLAN_OBJMGR_ID",
410 					"WLAN_MLME_SB_ID",
411 					"WLAN_MLME_NB_ID",
412 					"WLAN_MGMT_SB_ID",
413 					"WLAN_MGMT_NB_ID",
414 					"WLAN_HDD_ID_OBJ_MGR",
415 					"WLAN_OSIF_ID",
416 					"WLAN_LEGACY_MAC_ID",
417 					"WLAN_LEGACY_WMA_ID",
418 					"WLAN_SERIALIZATION_ID",
419 					"WLAN_PMO_ID",
420 					"WLAN_LEGACY_SME_ID",
421 					"WLAN_SCAN_ID",
422 					"WLAN_WIFI_POS_CORE_ID",
423 					"WLAN_DFS_ID",
424 					"WLAN_P2P_ID",
425 					"WLAN_TDLS_SB_ID",
426 					"WLAN_TDLS_NB_ID",
427 					"WLAN_ATF_ID",
428 					"WLAN_CRYPTO_ID",
429 					"WLAN_NAN_ID",
430 					"WLAN_REGULATORY_SB_ID",
431 					"WLAN_REGULATORY_NB_ID",
432 					"WLAN_OFFCHAN_TXRX_ID",
433 					"WLAN_POLICY_MGR_ID",
434 					"WLAN_SON_ID",
435 					"WLAN_SA_API_ID",
436 					"WLAN_SPECTRAL_ID",
437 					"WLAN_SPLITMAC_ID",
438 					"WLAN_DEBUG_ID",
439 					"WLAN_DIRECT_BUF_RX_ID",
440 					"WLAN_DISA_ID",
441 					"WLAN_FTM_ID",
442 					"WLAN_FD_ID",
443 					"WLAN_OCB_NB_ID",
444 					"WLAN_OCB_SB_ID",
445 					"WLAN_INIT_DEINIT_ID",
446 					"WLAN_IPA_ID",
447 					"WLAN_CP_STATS_ID",
448 					"WLAN_GREEN_AP_ID",
449 					"WLAN_WIFI_POS_OSIF_ID",
450 					"WLAN_WIFI_POS_TGT_IF_ID",
451 					"WLAN_MLME_OBJ_DEL_ID",
452 					"WLAN_ACTION_OUI_ID",
453 					"WLAN_LEGACY_SAP_ID",
454 					"WLAN_PDEV_TARGET_IF_ID",
455 					"WLAN_MLME_SER_IF_ID",
456 					"WLAN_SCHEDULER_ID",
457 					"WLAN_CFR_ID",
458 					"WLAN_VDEV_TARGET_IF_ID",
459 					"WLAN_RX_PKT_TAG_ID",
460 					"WLAN_INTEROP_ISSUES_AP_ID",
461 					"WLAN_WDS_ID",
462 					"WLAN_PROXY_ARP_ID",
463 					"WLAN_WNM_ID",
464 					"WLAN_RRM_ID",
465 					"WLAN_TR69_ID",
466 					"WLAN_MGMT_RX_ID",
467 					"WLAN_MGMT_TX_ID",
468 					"WLAN_NSS_IF_ID",
469 					"WLAN_MBO_ID",
470 					"WLAN_RTT_ID",
471 					"WLAN_ALD_ID",
472 					"WLAN_ME_ID",
473 					"WLAN_MGMT_HANDLER_ID",
474 					"WLAN_MLME_HANDLER_ID",
475 					"WLAN_DBDC_ID",
476 					"WLAN_MLME_OBJMGR_ID",
477 					"WLAN_OFFCHAN_TX_ID",
478 					"WLAN_MISC_ID",
479 					"WLAN_FWOL_NB_ID",
480 					"WLAN_FWOL_SB_ID",
481 					"WLAN_PSOC_TARGET_IF_ID",
482 					"FTM_TIME_SYNC_ID",
483 					"WLAN_PKT_CAPTURE_ID",
484 					"WLAN_DCS_ID",
485 					"WLAN_IOT_SIM_ID",
486 					"WLAN_MLME_CM_ID",
487 					"WLAN_IF_MGR_ID",
488 					"WLAN_OSIF_SCAN_ID",
489 					"WLAN_OSIF_MGMT_ID",
490 					"WLAN_OSIF_STATS_ID",
491 					"WLAN_OSIF_NAN_ID",
492 					"WLAN_OSIF_P2P_ID",
493 					"WLAN_OSIF_OCB_ID",
494 					"WLAN_OSIF_SPECTRAL_ID",
495 					"WLAN_OSIF_POWER_ID",
496 					"WLAN_OSIF_TDLS_ID",
497 					"WLAN_OSIF_CM_ID",
498 					"WLAN_TXRX_STREAMS_ID",
499 					"WLAN_MLO_MGR_ID",
500 					"WLAN_MBSS_ID",
501 					"WLAN_MGMT_RX_REO_ID",
502 					"WLAN_MGMT_RX_REO_SIM_ID",
503 					"WLAN_TWT_ID",
504 					"WLAN_LITE_MON_ID",
505 					"WLAN_PRE_CAC_ID",
506 					"WLAN_DP_ID"
507 					};
508 
509 	if (id >= WLAN_REF_ID_MAX)
510 		return "Unknown";
511 
512 	return strings[id];
513 }
514 
515 #ifdef WLAN_OBJMGR_DEBUG
516 #define WLAN_OBJMGR_BUG(val) QDF_BUG(val)
517 #else
518 #define WLAN_OBJMGR_BUG(val)
519 #endif
520 
521 #ifndef WLAN_OBJMGR_RATELIMIT_THRESH
522 #define WLAN_OBJMGR_RATELIMIT_THRESH 2
523 #endif
524 
525 #ifdef WLAN_OBJMGR_REF_ID_TRACE
526 #define WLAN_OBJMGR_TRACE_FUNC_SIZE 30
527 /**
528  * struct wlan_objmgr_line_ref - line reference data
529  * @line:  line number
530  * @cnt:   line reference count
531  */
532 struct wlan_objmgr_line_ref {
533 	uint32_t line;
534 	qdf_atomic_t cnt;
535 };
536 
537 /**
538  * struct wlan_objmgr_line_ref_node - line reference node
539  * @line_ref:    line reference data
540  * @next:        pointer to next line reference
541  */
542 struct wlan_objmgr_line_ref_node {
543 	struct wlan_objmgr_line_ref line_ref;
544 	struct wlan_objmgr_line_ref_node *next;
545 };
546 
547 /**
548  * struct wlan_objmgr_trace_func - trace function data
549  * @func:        function pointer
550  * @line_head:   pointer to head line trace reference
551  * @next:        pointer to next function reference
552  */
553 struct wlan_objmgr_trace_func {
554 	char func[WLAN_OBJMGR_TRACE_FUNC_SIZE];
555 	struct wlan_objmgr_line_ref_node *line_head;
556 	struct wlan_objmgr_trace_func *next;
557 };
558 
559 /**
560  * struct wlan_objmgr_trace_id - trace reference data
561  * @num_func:  num of functions
562  * @head:      head pointer to function reference
563  */
564 struct wlan_objmgr_trace_id {
565 	uint32_t num_func;
566 	struct wlan_objmgr_trace_func *head;
567 };
568 
569 /**
570  * struct wlan_objmgr_trace - trace reference data
571  * @references:        reference data
572  * @dereferences:      dereference data
573  * @trace_lock:        lock
574  */
575 struct wlan_objmgr_trace {
576 	struct wlan_objmgr_trace_id references[WLAN_REF_ID_MAX];
577 	struct wlan_objmgr_trace_id dereferences[WLAN_REF_ID_MAX];
578 	qdf_spinlock_t trace_lock;
579 };
580 #endif /*WLAN_OBJMGR_REF_ID_TRACE*/
581 
582 #endif /* _WLAN_OBJMGR_CMN_H_*/
583