1 /* 2 * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2022-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 #if !defined(WLAN_HDD_OBJECT_MANAGER_H) 21 #define WLAN_HDD_OBJECT_MANAGER_H 22 /** 23 * DOC: HDD object manager API file to create/destroy psoc, pdev, vdev 24 * and peer objects by calling object manager APIs 25 * 26 * Common object model has 1 : N mapping between PSOC and PDEV but for MCL 27 * PSOC and PDEV has 1 : 1 mapping. 28 * 29 * MCL object model view is: 30 * 31 * -------- 32 * | PSOC | 33 * -------- 34 * | 35 * | 36 * -------------------------- 37 * | PDEV | 38 * -------------------------- 39 * | | 40 * | | 41 * | | 42 * ---------- ------------- 43 * | vdev 0 | | vdev n | 44 * ---------- ------------- 45 * | | | | 46 * ---------- ---------- ---------- ---------- 47 * | peer 1 | | peer n | | peer 1 | | peer n | 48 * ---------- ---------- ---------- ----------- 49 * 50 */ 51 #include "wlan_hdd_main.h" 52 #include <wlan_objmgr_cmn.h> 53 #include <wlan_objmgr_global_obj.h> 54 #include <wlan_objmgr_psoc_obj.h> 55 #include <wlan_objmgr_pdev_obj.h> 56 #include <wlan_objmgr_vdev_obj.h> 57 #include <wlan_objmgr_peer_obj.h> 58 59 /** 60 * hdd_objmgr_create_and_store_psoc() - Create psoc and store in hdd context 61 * @hdd_ctx: Hdd context 62 * @psoc_id: Psoc Id 63 * 64 * This API creates Psoc object with given @psoc_id and store the psoc reference 65 * to hdd context 66 * 67 * Return: 0 for success, negative error code for failure 68 */ 69 int hdd_objmgr_create_and_store_psoc(struct hdd_context *hdd_ctx, 70 uint8_t psoc_id); 71 72 /** 73 * hdd_objmgr_release_and_destroy_psoc() - Deletes the psoc object 74 * @hdd_ctx: Hdd context 75 * 76 * This API deletes psoc object and release its reference from hdd context 77 * 78 * Return: 0 for success, negative error code for failure 79 */ 80 int hdd_objmgr_release_and_destroy_psoc(struct hdd_context *hdd_ctx); 81 82 /** 83 * hdd_objmgr_update_tgt_max_vdev_psoc() - Update target max vdev number 84 * @hdd_ctx: Hdd context 85 * @max_vdev: Max number of supported vdevs 86 * 87 * This API update target max vdev number to psoc object 88 * 89 * Return: None 90 */ 91 void hdd_objmgr_update_tgt_max_vdev_psoc(struct hdd_context *hdd_ctx, 92 uint8_t max_vdev); 93 94 /** 95 * hdd_objmgr_create_and_store_pdev() - Create pdev and store in hdd context 96 * @hdd_ctx: Hdd context 97 * 98 * This API creates the pdev object and store the pdev reference to hdd context 99 * 100 * Return: 0 for success, negative error code for failure 101 */ 102 int hdd_objmgr_create_and_store_pdev(struct hdd_context *hdd_ctx); 103 104 /** 105 * hdd_objmgr_release_and_destroy_pdev() - Deletes the pdev object 106 * @hdd_ctx: Hdd context 107 * 108 * This API deletes pdev object and release its reference from hdd context 109 * 110 * Return: 0 for success, negative error code for failure 111 */ 112 int hdd_objmgr_release_and_destroy_pdev(struct hdd_context *hdd_ctx); 113 114 /** 115 * hdd_objmgr_set_peer_mlme_auth_state() - set the peer mlme auth state 116 * @vdev: vdev pointer 117 * @is_authenticated: Peer mlme auth state true/false 118 * 119 * This API set the peer mlme auth state 120 * 121 * Return: 0 for success, negative error code for failure 122 */ 123 int hdd_objmgr_set_peer_mlme_auth_state(struct wlan_objmgr_vdev *vdev, 124 bool is_authenticated); 125 126 /** 127 * hdd_objmgr_set_peer_mlme_state() - set the peer mlme state 128 * @vdev: vdev pointer 129 * @peer_state: Peer mlme state 130 * 131 * This API set the peer mlme state 132 * 133 * Return: 0 for success, negative error code for failure 134 */ 135 int hdd_objmgr_set_peer_mlme_state(struct wlan_objmgr_vdev *vdev, 136 enum wlan_peer_state peer_state); 137 138 /** 139 * hdd_objmgr_get_vdev_by_user() - Get reference of vdev from adapter 140 * with user id 141 * @link_info: Pointer of link_info in HDD adapter 142 * @dbgid: reference count dbg id 143 * 144 * Return: pointer to vdev object for success, NULL for failure 145 */ 146 #ifdef WLAN_OBJMGR_REF_ID_TRACE 147 #define hdd_objmgr_get_vdev_by_user(link_info, dbgid) \ 148 __hdd_objmgr_get_vdev_by_user(link_info, dbgid, __func__, __LINE__) 149 struct wlan_objmgr_vdev * 150 __hdd_objmgr_get_vdev_by_user(struct wlan_hdd_link_info *link_info, 151 wlan_objmgr_ref_dbgid id, 152 const char *func, 153 int line); 154 #else 155 #define hdd_objmgr_get_vdev_by_user(link_info, dbgid) \ 156 __hdd_objmgr_get_vdev_by_user(link_info, dbgid, __func__) 157 struct wlan_objmgr_vdev * 158 __hdd_objmgr_get_vdev_by_user(struct wlan_hdd_link_info *link_info, 159 wlan_objmgr_ref_dbgid id, 160 const char *func); 161 #endif 162 163 /** 164 * hdd_objmgr_put_vdev_by_user() - Release reference of vdev object with 165 * user id 166 * @vdev: pointer to vdev object 167 * @dbgid: reference count dbg id 168 * 169 * This API releases vdev object reference which was acquired using 170 * hdd_objmgr_get_vdev_by_user(). 171 * 172 * Return: void 173 */ 174 #ifdef WLAN_OBJMGR_REF_ID_TRACE 175 #define hdd_objmgr_put_vdev_by_user(vdev, dbgid) \ 176 __hdd_objmgr_put_vdev_by_user(vdev, dbgid, __func__, __LINE__) 177 void 178 __hdd_objmgr_put_vdev_by_user(struct wlan_objmgr_vdev *vdev, 179 wlan_objmgr_ref_dbgid id, const char *func, 180 int line); 181 #else 182 #define hdd_objmgr_put_vdev_by_user(vdev, dbgid) \ 183 __hdd_objmgr_put_vdev_by_user(vdev, dbgid, __func__) 184 void 185 __hdd_objmgr_put_vdev_by_user(struct wlan_objmgr_vdev *vdev, 186 wlan_objmgr_ref_dbgid id, const char *func); 187 #endif 188 #endif /* end #if !defined(WLAN_HDD_OBJECT_MANAGER_H) */ 189