1 /* 2 * Copyright (c) 2018-2019, 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 any 6 * purpose with or without fee is hereby granted, provided that the above 7 * copyright notice and this permission notice appear in all copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 16 */ 17 18 /** 19 * DOC: Define VDEV MLME public APIs 20 */ 21 22 #ifndef _WLAN_VDEV_MLME_API_H_ 23 #define _WLAN_VDEV_MLME_API_H_ 24 25 #include <wlan_ext_mlme_obj_types.h> 26 /** 27 * wlan_vdev_mlme_get_cmpt_obj - Retrieves MLME component object 28 * from VDEV object 29 * @vdev: pointer to vdev object 30 * 31 * Retrieves MLME component object from VDEV object 32 * 33 * Return: comp handle on SUCCESS 34 * NULL, if it fails to retrieve 35 */ 36 struct vdev_mlme_obj *wlan_vdev_mlme_get_cmpt_obj( 37 struct wlan_objmgr_vdev *vdev); 38 /** 39 * wlan_vdev_mlme_set_ext_hdl - Sets legacy handle 40 * @vdev: pointer to vdev object 41 * @ext_hdl: pointer to legacy handle 42 * 43 * Sets Legacy handle to MLME component object 44 * 45 * Return: 46 */ 47 void wlan_vdev_mlme_set_ext_hdl(struct wlan_objmgr_vdev *vdev, 48 mlme_vdev_ext_t *ext_hdl); 49 50 /** 51 * wlan_vdev_mlme_get_ext_hdl - Returns legacy handle 52 * @vdev: pointer to vdev object 53 * 54 * Retrieves legacy handle from vdev mlme component object 55 * 56 * Return: legacy handle on SUCCESS 57 * NULL, if it fails to retrieve 58 */ 59 mlme_vdev_ext_t *wlan_vdev_mlme_get_ext_hdl(struct wlan_objmgr_vdev *vdev); 60 61 /** 62 * wlan_vdev_mlme_sm_deliver_evt() - Delivers event to VDEV MLME SM 63 * @vdev: Object manager VDEV object 64 * @event: MLME event 65 * @event_data_len: data size 66 * @event_data: event data 67 * 68 * API to dispatch event to VDEV MLME SM with lock acquired 69 * 70 * Return: SUCCESS: on handling event 71 * FAILURE: on ignoring the event 72 */ 73 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt(struct wlan_objmgr_vdev *vdev, 74 enum wlan_vdev_sm_evt event, 75 uint16_t event_data_len, 76 void *event_data); 77 78 /** 79 * wlan_vdev_mlme_sm_deliver_evt_sync() - Delivers event to VDEV MLME SM sync 80 * @vdev: Object manager VDEV object 81 * @event: MLME event 82 * @event_data_len: data size 83 * @event_data: event data 84 * 85 * API to dispatch event to VDEV MLME SM with lock acquired 86 * 87 * Return: SUCCESS: on handling event 88 * FAILURE: on ignoring the event 89 */ 90 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt_sync(struct wlan_objmgr_vdev *vdev, 91 enum wlan_vdev_sm_evt event, 92 uint16_t event_data_len, 93 void *event_data); 94 95 #ifdef SM_ENG_HIST_ENABLE 96 /** 97 * wlan_vdev_mlme_sm_history_print() - Prints SM history 98 * @vdev: Object manager VDEV object 99 * 100 * API to print SM history 101 * 102 * Return: void 103 */ 104 void wlan_vdev_mlme_sm_history_print(struct wlan_objmgr_vdev *vdev); 105 106 #endif 107 108 /** 109 * wlan_vdev_allow_connect_n_tx() - Checks whether VDEV is in operational state 110 * @vdev: Object manager VDEV object 111 * 112 * API to checks the VDEV MLME SM state to allow tx or connections 113 * 114 * Return: SUCCESS: to allow tx or connection 115 * FAILURE: otherwise failure 116 */ 117 QDF_STATUS wlan_vdev_allow_connect_n_tx(struct wlan_objmgr_vdev *vdev); 118 119 /** 120 * wlan_vdev_mlme_is_active() - Checks whether VDEV is in active state 121 * @vdev: Object manager VDEV object 122 * 123 * API to checks the VDEV MLME SM state to check channel is configured in FW 124 * 125 * Return: SUCCESS: valid channel is configured 126 * FAILURE: otherwise failure 127 */ 128 QDF_STATUS wlan_vdev_mlme_is_active(struct wlan_objmgr_vdev *vdev); 129 130 /** 131 * wlan_vdev_chan_config_valid() - Checks whether VDEV chan config valid 132 * @vdev: Object manager VDEV object 133 * 134 * API to checks the VDEV MLME SM state to check channel is configured in Host 135 * 136 * Return: SUCCESS: valid channel is configured 137 * FAILURE: otherwise failure 138 */ 139 QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev); 140 141 /** 142 * wlan_vdev_mlme_is_csa_restart() - Checks whether VDEV MLME SM is in CSA 143 * @vdev: Object manager VDEV object 144 * 145 * API to checks the VDEV MLME SM state for CSA_RESTART substate 146 * 147 * Return: SUCCESS: if it is in CSA_RESTART sub state 148 * FAILURE: otherwise failure 149 */ 150 QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev); 151 152 /** 153 * wlan_vdev_is_going_down() - Checks whether VDEV is being brought down 154 * @vdev: Object manager VDEV object 155 * 156 * API to checks the VDEV MLME SM state to check VDEV is being brought down 157 * 158 * Return: SUCCESS: valid channel is configured 159 * FAILURE: otherwise failure 160 */ 161 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev); 162 163 /** 164 * wlan_vdev_is_mlo_peer_create_allowed() - Checks whether PEER can be created 165 * @vdev: Object manager VDEV object 166 * 167 * API to check the VDEV MLME SM state to allow PEER association in MLD 168 * 169 * Return: SUCCESS: if peer create can be allowed 170 * FAILURE: otherwise failure 171 */ 172 QDF_STATUS wlan_vdev_is_mlo_peer_create_allowed(struct wlan_objmgr_vdev *vdev); 173 174 /** 175 * wlan_vdev_is_restart_progress() - Checks VDEV restart is in progress 176 * @vdev: Object manager VDEV object 177 * 178 * API to check whether restarts is in progress 179 * 180 * Return: SUCCESS: if restart is in progress 181 * FAILURE: otherwise failure 182 */ 183 QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev); 184 185 /** 186 * wlan_vdev_is_dfs_cac_wait() - Checks VDEV is in cac wait state 187 * @vdev: Object manager VDEV object 188 * 189 * API to check whether state is cac wait state 190 * 191 * Return: SUCCESS: if state is cac wait state 192 * FAILURE: otherwise failure 193 */ 194 QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev); 195 196 /** 197 * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity 198 * 199 * API to take VDEV MLME command lock 200 * 201 * Return: void 202 */ 203 void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev); 204 205 /** 206 * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity 207 * 208 * API to release VDEV MLME command lock 209 * 210 * Return: void 211 */ 212 void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev); 213 214 /** 215 * wlan_vdev_mlme_is_scan_allowed() - Checks whether scan is allowed 216 * @vdev: Object manager VDEV object 217 * 218 * API to checks the VDEV MLME SM state to check scan is allowed 219 * 220 * Return: SUCCESS: if scan is allowed 221 * FAILURE: otherwise failure 222 */ 223 QDF_STATUS wlan_vdev_mlme_is_scan_allowed(struct wlan_objmgr_vdev *vdev); 224 225 /** 226 * wlan_vdev_mlme_is_init_state() - Checks whether vdev is in init state 227 * @vdev: Object manager VDEV object 228 * 229 * API to checks the VDEV MLME SM state is in init state or not 230 * 231 * Return: SUCCESS: if vdev is in init state 232 * FAILURE: otherwise failure 233 */ 234 QDF_STATUS wlan_vdev_mlme_is_init_state(struct wlan_objmgr_vdev *vdev); 235 236 /** 237 * wlan_vdev_is_up_active_state() - Checks whether vdev is in up active state 238 * @vdev: Object manager VDEV object 239 * 240 * API to checks the VDEV MLME SM state is in UP ACTIVE state 241 * 242 * Return: SUCCESS: if vdev is in UP ACTIVE state 243 * FAILURE: otherwise failure 244 */ 245 QDF_STATUS wlan_vdev_is_up_active_state(struct wlan_objmgr_vdev *vdev); 246 247 #ifdef WLAN_FEATURE_11BE_MLO 248 /** 249 * wlan_vdev_mlme_get_is_mlo_link() - check if its mlo link vdev 250 * @psoc: PSOC object 251 * @vdev_id: VDEV Id 252 * 253 * Return: True if it is mlo link, otherwise false. 254 */ 255 bool 256 wlan_vdev_mlme_get_is_mlo_link(struct wlan_objmgr_psoc *psoc, 257 uint8_t vdev_id); 258 259 /** 260 * wlan_vdev_mlme_get_is_mlo_vdev() - check if its mlo assoc vdev 261 * @psoc: PSOC object 262 * @vdev_id: VDEV Id 263 * 264 * Return: True if it is mlo link, otherwise false. 265 */ 266 bool 267 wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc, 268 uint8_t vdev_id); 269 #else 270 static inline bool 271 wlan_vdev_mlme_get_is_mlo_link(struct wlan_objmgr_psoc *psoc, 272 uint8_t vdev_id) 273 { 274 return false; 275 } 276 277 static inline bool 278 wlan_vdev_mlme_get_is_mlo_vdev(struct wlan_objmgr_psoc *psoc, 279 uint8_t vdev_id) 280 { 281 return false; 282 } 283 #endif 284 #endif 285