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