diff --git a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_global_obj.h b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_global_obj.h index ef9494b07a91..6899ea9c4531 100644 --- a/umac/cmn_services/obj_mgr/inc/wlan_objmgr_global_obj.h +++ b/umac/cmn_services/obj_mgr/inc/wlan_objmgr_global_obj.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2016-2017 The Linux Foundation. All rights reserved. + * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. * * Permission to use, copy, modify, and/or distribute this software for * any purpose with or without fee is hereby granted, provided that the @@ -480,4 +480,29 @@ QDF_STATUS wlan_objmgr_unregister_peer_status_handler( wlan_objmgr_peer_status_handler handler, void *args); +/** + * APIs to operations on psoc + */ +typedef void (*wlan_objmgr_psoc_handler)(struct wlan_objmgr_psoc *psoc, + void *arg, + uint8_t index); + +/** + * wlan_objmgr_iterate_psoc_list() - iterate through all psocs + * + * @handler: the handler will be called for each psoc + * the handler should be implemented to perform required operation + * @arg: agruments passed by caller + * @dbg_id: id of the caller + * + * API to be used for performing the operations on all psoc + * The "handler" here shouldn't take g_umac_glb_obj->global_lock lock when + * processing + * + * Return: SUCCESS/FAILURE + */ +QDF_STATUS wlan_objmgr_iterate_psoc_list( + wlan_objmgr_psoc_handler handler, + void *arg, wlan_objmgr_ref_dbgid dbg_id); + #endif /* _WLAN_OBJMGR_GLOBAL_OBJ_H_*/ diff --git a/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c b/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c index 6fea3c09992b..4ce269ee834e 100644 --- a/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c +++ b/umac/cmn_services/obj_mgr/src/wlan_objmgr_global_obj.c @@ -785,3 +785,27 @@ void wlan_objmgr_print_ref_ids(qdf_atomic_t *id, return; } + +QDF_STATUS wlan_objmgr_iterate_psoc_list( + wlan_objmgr_psoc_handler handler, + void *arg, wlan_objmgr_ref_dbgid dbg_id) +{ + uint8_t index = 0; + + qdf_spin_lock_bh(&g_umac_glb_obj->global_lock); + + while (index < WLAN_OBJMGR_MAX_DEVICES) { + if (g_umac_glb_obj->psoc[index]) { + handler((void *)g_umac_glb_obj->psoc[index], + arg, index); + } + index++; + } + + qdf_spin_unlock_bh(&g_umac_glb_obj->global_lock); + + return QDF_STATUS_SUCCESS; +} + +qdf_export_symbol(wlan_objmgr_iterate_psoc_list); +