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_IF_MGR_ID: Interface manager reference ID 273 * @WLAN_OSIF_SCAN_ID: SCAN operations in OS IF 274 * @WLAN_OSIF_MGMT_ID: MGMT frame operations in OS IF 275 * @WLAN_OSIF_STATS_ID: STATS request operations in OS IF 276 * @WLAN_OSIF_NAN_ID: NAN operations in OS IF 277 * @WLAN_OSIF_P2P_ID: P2P operations in OS IF 278 * @WLAN_OSIF_OCB_ID: OCB operations in OS IF 279 * @WLAN_OSIF_SPECTRAL_ID: spectal operations in OS IF 280 * @WLAN_OSIF_POWER_ID: power operations in OS IF 281 * @WLAN_OSIF_TDLS_ID: TDLS operations in OS IF 282 * @WLAN_OSIF_CM_ID: Connection manager osif reference id 283 * @WLAN_REF_ID_MAX: Max id used to generate ref count tracking array 284 */ 285 /* New value added to the enum must also be reflected in function 286 * string_from_dbgid() 287 */ 288 typedef enum { 289 WLAN_OBJMGR_ID = 0, 290 WLAN_MLME_SB_ID = 1, 291 WLAN_MLME_NB_ID = 2, 292 WLAN_MGMT_SB_ID = 3, 293 WLAN_MGMT_NB_ID = 4, 294 WLAN_HDD_ID_OBJ_MGR = 5, 295 WLAN_OSIF_ID = 6, 296 WLAN_LEGACY_MAC_ID = 7, 297 WLAN_LEGACY_WMA_ID = 8, 298 WLAN_SERIALIZATION_ID = 9, 299 WLAN_PMO_ID = 10, 300 WLAN_LEGACY_SME_ID = 11, 301 WLAN_SCAN_ID = 12, 302 WLAN_WIFI_POS_CORE_ID = 13, 303 WLAN_DFS_ID = 14, 304 WLAN_P2P_ID = 15, 305 WLAN_TDLS_SB_ID = 16, 306 WLAN_TDLS_NB_ID = 17, 307 WLAN_ATF_ID = 18, 308 WLAN_CRYPTO_ID = 19, 309 WLAN_NAN_ID = 20, 310 WLAN_REGULATORY_SB_ID = 21, 311 WLAN_REGULATORY_NB_ID = 22, 312 WLAN_OFFCHAN_TXRX_ID = 23, 313 WLAN_POLICY_MGR_ID = 24, 314 WLAN_SON_ID = 25, 315 WLAN_SA_API_ID = 26, 316 WLAN_SPECTRAL_ID = 27, 317 WLAN_SPLITMAC_ID = 28, 318 WLAN_DEBUG_ID = 29, 319 WLAN_DIRECT_BUF_RX_ID = 30, 320 WLAN_DISA_ID = 31, 321 WLAN_FTM_ID = 32, 322 WLAN_FD_ID = 33, 323 WLAN_OCB_NB_ID = 34, 324 WLAN_OCB_SB_ID = 35, 325 WLAN_INIT_DEINIT_ID = 36, 326 WLAN_IPA_ID = 37, 327 WLAN_CP_STATS_ID = 38, 328 WLAN_GREEN_AP_ID = 39, 329 WLAN_WIFI_POS_OSIF_ID = 40, 330 WLAN_WIFI_POS_TGT_IF_ID = 41, 331 WLAN_MLME_OBJ_DEL_ID = 42, 332 WLAN_ACTION_OUI_ID = 43, 333 WLAN_LEGACY_SAP_ID = 44, 334 WLAN_PDEV_TARGET_IF_ID = 45, 335 WLAN_MLME_SER_IF_ID = 46, 336 WLAN_SCHEDULER_ID = 47, 337 WLAN_CFR_ID = 48, 338 WLAN_VDEV_TARGET_IF_ID = 49, 339 WLAN_RX_PKT_TAG_ID = 50, 340 WLAN_INTEROP_ISSUES_AP_ID = 51, 341 WLAN_WDS_ID = 52, 342 WLAN_PROXY_ARP_ID = 53, 343 WLAN_WNM_ID = 54, 344 WLAN_RRM_ID = 55, 345 WLAN_TR69_ID = 56, 346 WLAN_MGMT_RX_ID = 57, 347 WLAN_MGMT_TX_ID = 58, 348 WLAN_NSS_IF_ID = 59, 349 WLAN_MBO_ID = 60, 350 WLAN_RTT_ID = 61, 351 WLAN_ALD_ID = 62, 352 WLAN_ME_ID = 63, 353 WLAN_MGMT_HANDLER_ID = 64, 354 WLAN_MLME_HANDLER_ID = 65, 355 WLAN_DBDC_ID = 66, 356 WLAN_MLME_OBJMGR_ID = 67, 357 WLAN_OFFCHAN_TX_ID = 68, 358 WLAN_MISC_ID = 69, 359 WLAN_FWOL_NB_ID = 70, 360 WLAN_FWOL_SB_ID = 71, 361 WLAN_PSOC_TARGET_IF_ID = 72, 362 FTM_TIME_SYNC_ID = 73, 363 WLAN_PKT_CAPTURE_ID = 74, 364 WLAN_DCS_ID = 75, 365 WLAN_IOT_SIM_ID = 76, 366 WLAN_MLME_CM_ID = 77, 367 WLAN_IF_MGR_ID = 78, 368 /* Create WLAN_OSIF sub id based on functionality */ 369 WLAN_OSIF_SCAN_ID = 79, 370 WLAN_OSIF_MGMT_ID = 80, 371 WLAN_OSIF_STATS_ID = 81, 372 WLAN_OSIF_NAN_ID = 82, 373 WLAN_OSIF_P2P_ID = 83, 374 WLAN_OSIF_OCB_ID = 84, 375 WLAN_OSIF_SPECTRAL_ID = 85, 376 WLAN_OSIF_POWER_ID = 86, 377 WLAN_OSIF_TDLS_ID = 87, 378 WLAN_OSIF_CM_ID = 88, 379 WLAN_REF_ID_MAX, 380 } wlan_objmgr_ref_dbgid; 381 382 /** 383 * string_from_dbgid() - Convert Refcnt dbgid to respective string 384 * @id - Reference count debug id 385 * 386 * Debug support function to convert refcnt dbgid to string. 387 * Please note to add new string in the array at index equal to 388 * its enum value in wlan_objmgr_ref_dbgid. 389 */ 390 static inline const char *string_from_dbgid(wlan_objmgr_ref_dbgid id) 391 { 392 static const char *strings[WLAN_REF_ID_MAX] = { "WLAN_OBJMGR_ID", 393 "WLAN_MLME_SB_ID", 394 "WLAN_MLME_NB_ID", 395 "WLAN_MGMT_SB_ID", 396 "WLAN_MGMT_NB_ID", 397 "WLAN_HDD_ID_OBJ_MGR", 398 "WLAN_OSIF_ID", 399 "WLAN_LEGACY_MAC_ID", 400 "WLAN_LEGACY_WMA_ID", 401 "WLAN_SERIALIZATION_ID", 402 "WLAN_PMO_ID", 403 "WLAN_LEGACY_SME_ID", 404 "WLAN_SCAN_ID", 405 "WLAN_WIFI_POS_CORE_ID", 406 "WLAN_DFS_ID", 407 "WLAN_P2P_ID", 408 "WLAN_TDLS_SB_ID", 409 "WLAN_TDLS_NB_ID", 410 "WLAN_ATF_ID", 411 "WLAN_CRYPTO_ID", 412 "WLAN_NAN_ID", 413 "WLAN_REGULATORY_SB_ID", 414 "WLAN_REGULATORY_NB_ID", 415 "WLAN_OFFCHAN_TXRX_ID", 416 "WLAN_POLICY_MGR_ID", 417 "WLAN_SON_ID", 418 "WLAN_SA_API_ID", 419 "WLAN_SPECTRAL_ID", 420 "WLAN_SPLITMAC_ID", 421 "WLAN_DEBUG_ID", 422 "WLAN_DIRECT_BUF_RX_ID", 423 "WLAN_DISA_ID", 424 "WLAN_FTM_ID", 425 "WLAN_FD_ID", 426 "WLAN_OCB_NB_ID", 427 "WLAN_OCB_SB_ID", 428 "WLAN_INIT_DEINIT_ID", 429 "WLAN_IPA_ID", 430 "WLAN_CP_STATS_ID", 431 "WLAN_GREEN_AP_ID", 432 "WLAN_WIFI_POS_OSIF_ID", 433 "WLAN_WIFI_POS_TGT_IF_ID", 434 "WLAN_MLME_OBJ_DEL_ID", 435 "WLAN_ACTION_OUI_ID", 436 "WLAN_LEGACY_SAP_ID", 437 "WLAN_PDEV_TARGET_IF_ID", 438 "WLAN_MLME_SER_IF_ID", 439 "WLAN_SCHEDULER_ID", 440 "WLAN_CFR_ID", 441 "WLAN_VDEV_TARGET_IF_ID", 442 "WLAN_RX_PKT_TAG_ID", 443 "WLAN_INTEROP_ISSUES_AP_ID", 444 "WLAN_WDS_ID", 445 "WLAN_PROXY_ARP_ID", 446 "WLAN_WNM_ID", 447 "WLAN_RRM_ID", 448 "WLAN_TR69_ID", 449 "WLAN_MGMT_RX_ID", 450 "WLAN_MGMT_TX_ID", 451 "WLAN_NSS_IF_ID", 452 "WLAN_MBO_ID", 453 "WLAN_RTT_ID", 454 "WLAN_ALD_ID", 455 "WLAN_ME_ID", 456 "WLAN_MGMT_HANDLER_ID", 457 "WLAN_MLME_HANDLER_ID", 458 "WLAN_DBDC_ID", 459 "WLAN_MLME_OBJMGR_ID", 460 "WLAN_OFFCHAN_TX_ID", 461 "WLAN_MISC_ID", 462 "WLAN_FWOL_NB_ID", 463 "WLAN_FWOL_SB_ID", 464 "WLAN_PSOC_TARGET_IF_ID", 465 "FTM_TIME_SYNC_ID", 466 "WLAN_PKT_CAPTURE_ID", 467 "WLAN_DCS_ID", 468 "WLAN_IOT_SIM_ID", 469 "WLAN_MLME_CM_ID", 470 "WLAN_IF_MGR_ID", 471 "WLAN_OSIF_SCAN_ID", 472 "WLAN_OSIF_MGMT_ID", 473 "WLAN_OSIF_STATS_ID", 474 "WLAN_OSIF_NAN_ID", 475 "WLAN_OSIF_P2P_ID", 476 "WLAN_OSIF_OCB_ID", 477 "WLAN_OSIF_SPECTRAL_ID", 478 "WLAN_OSIF_POWER_ID", 479 "WLAN_OSIF_TDLS_ID", 480 "WLAN_OSIF_CM_ID", 481 }; 482 483 if (id >= WLAN_REF_ID_MAX) 484 return "Unknown"; 485 486 return strings[id]; 487 } 488 489 #ifdef WLAN_OBJMGR_DEBUG 490 #define WLAN_OBJMGR_BUG(val) QDF_BUG(val) 491 #else 492 #define WLAN_OBJMGR_BUG(val) 493 #endif 494 #define WLAN_OBJMGR_RATELIMIT_THRESH 2 495 496 #ifdef WLAN_OBJMGR_REF_ID_TRACE 497 #define WLAN_OBJMGR_TRACE_FUNC_SIZE 30 498 /** 499 * struct wlan_objmgr_line_ref - line reference data 500 * @line: line number 501 * @cnt: line reference count 502 */ 503 struct wlan_objmgr_line_ref { 504 uint32_t line; 505 qdf_atomic_t cnt; 506 }; 507 508 /** 509 * struct wlan_objmgr_line_ref_node - line reference node 510 * @line_ref: line reference data 511 * @next: pointer to next line reference 512 */ 513 struct wlan_objmgr_line_ref_node { 514 struct wlan_objmgr_line_ref line_ref; 515 struct wlan_objmgr_line_ref_node *next; 516 }; 517 518 /** 519 * struct wlan_objmgr_trace_func - trace function data 520 * @func: function pointer 521 * @line_head: pointer to head line trace reference 522 * @next: pointer to next function reference 523 */ 524 struct wlan_objmgr_trace_func { 525 char func[WLAN_OBJMGR_TRACE_FUNC_SIZE]; 526 struct wlan_objmgr_line_ref_node *line_head; 527 struct wlan_objmgr_trace_func *next; 528 }; 529 530 /** 531 * struct wlan_objmgr_trace_id - trace reference data 532 * @num_func: num of functions 533 * @head: head pointer to function reference 534 */ 535 struct wlan_objmgr_trace_id { 536 uint32_t num_func; 537 struct wlan_objmgr_trace_func *head; 538 }; 539 540 /** 541 * struct wlan_objmgr_trace - trace reference data 542 * @references: reference data 543 * @dereferences: dereference data 544 * @trace_lock: lock 545 */ 546 struct wlan_objmgr_trace { 547 struct wlan_objmgr_trace_id references[WLAN_REF_ID_MAX]; 548 struct wlan_objmgr_trace_id dereferences[WLAN_REF_ID_MAX]; 549 qdf_spinlock_t trace_lock; 550 }; 551 #endif /*WLAN_OBJMGR_REF_ID_TRACE*/ 552 553 #endif /* _WLAN_OBJMGR_CMN_H_*/ 554