1 /* 2 * Copyright (c) 2018-2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for any 5 * purpose with or without fee is hereby granted, provided that the above 6 * copyright notice and this permission notice appear in all copies. 7 * 8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES 9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF 10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR 11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES 12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN 13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF 14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. 15 */ 16 17 /** 18 * DOC: Define VDEV MLME public APIs 19 */ 20 21 #ifndef _WLAN_VDEV_MLME_API_H_ 22 #define _WLAN_VDEV_MLME_API_H_ 23 24 #include <wlan_ext_mlme_obj_types.h> 25 /** 26 * wlan_vdev_mlme_get_cmpt_obj - Retrieves MLME component object 27 * from VDEV object 28 * @vdev: pointer to vdev object 29 * 30 * Retrieves MLME component object from VDEV object 31 * 32 * Return: comp handle on SUCCESS 33 * NULL, if it fails to retrieve 34 */ 35 struct vdev_mlme_obj *wlan_vdev_mlme_get_cmpt_obj( 36 struct wlan_objmgr_vdev *vdev); 37 /** 38 * wlan_vdev_mlme_set_ext_hdl - Sets legacy handle 39 * @vdev: pointer to vdev object 40 * @ext_hdl: pointer to legacy handle 41 * 42 * Sets Legacy handle to MLME component object 43 * 44 * Return: 45 */ 46 void wlan_vdev_mlme_set_ext_hdl(struct wlan_objmgr_vdev *vdev, 47 mlme_vdev_ext_t *ext_hdl); 48 49 /** 50 * wlan_vdev_mlme_get_ext_hdl - Returns legacy handle 51 * @vdev: pointer to vdev object 52 * 53 * Retrieves legacy handle from vdev mlme component object 54 * 55 * Return: legacy handle on SUCCESS 56 * NULL, if it fails to retrieve 57 */ 58 mlme_vdev_ext_t *wlan_vdev_mlme_get_ext_hdl(struct wlan_objmgr_vdev *vdev); 59 60 /** 61 * wlan_vdev_mlme_sm_deliver_evt() - Delivers event to VDEV MLME SM 62 * @vdev: Object manager VDEV object 63 * @event: MLME event 64 * @event_data_len: data size 65 * @event_data: event data 66 * 67 * API to dispatch event to VDEV MLME SM with lock acquired 68 * 69 * Return: SUCCESS: on handling event 70 * FAILURE: on ignoring the event 71 */ 72 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt(struct wlan_objmgr_vdev *vdev, 73 enum wlan_vdev_sm_evt event, 74 uint16_t event_data_len, 75 void *event_data); 76 77 /** 78 * wlan_vdev_mlme_sm_deliver_evt_sync() - Delivers event to VDEV MLME SM sync 79 * @vdev: Object manager VDEV object 80 * @event: MLME event 81 * @event_data_len: data size 82 * @event_data: event data 83 * 84 * API to dispatch event to VDEV MLME SM with lock acquired 85 * 86 * Return: SUCCESS: on handling event 87 * FAILURE: on ignoring the event 88 */ 89 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt_sync(struct wlan_objmgr_vdev *vdev, 90 enum wlan_vdev_sm_evt event, 91 uint16_t event_data_len, 92 void *event_data); 93 94 #ifdef SM_ENG_HIST_ENABLE 95 /** 96 * wlan_vdev_mlme_sm_history_print() - Prints SM history 97 * @vdev: Object manager VDEV object 98 * 99 * API to print SM history 100 * 101 * Return: void 102 */ 103 void wlan_vdev_mlme_sm_history_print(struct wlan_objmgr_vdev *vdev); 104 105 #endif 106 107 /** 108 * wlan_vdev_allow_connect_n_tx() - Checks whether VDEV is in operational state 109 * @vdev: Object manager VDEV object 110 * 111 * API to checks the VDEV MLME SM state to allow tx or connections 112 * 113 * Return: SUCCESS: to allow tx or connection 114 * FAILURE: otherwise failure 115 */ 116 QDF_STATUS wlan_vdev_allow_connect_n_tx(struct wlan_objmgr_vdev *vdev); 117 118 /** 119 * wlan_vdev_mlme_is_active() - Checks whether VDEV is in active state 120 * @vdev: Object manager VDEV object 121 * 122 * API to checks the VDEV MLME SM state to check channel is configured in FW 123 * 124 * Return: SUCCESS: valid channel is configured 125 * FAILURE: otherwise failure 126 */ 127 QDF_STATUS wlan_vdev_mlme_is_active(struct wlan_objmgr_vdev *vdev); 128 129 /** 130 * wlan_vdev_chan_config_valid() - Checks whether VDEV chan config valid 131 * @vdev: Object manager VDEV object 132 * 133 * API to checks the VDEV MLME SM state to check channel is configured in Host 134 * 135 * Return: SUCCESS: valid channel is configured 136 * FAILURE: otherwise failure 137 */ 138 QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev); 139 140 /** 141 * wlan_vdev_mlme_is_csa_restart() - Checks whether VDEV MLME SM is in CSA 142 * @vdev: Object manager VDEV object 143 * 144 * API to checks the VDEV MLME SM state for CSA_RESTART substate 145 * 146 * Return: SUCCESS: if it is in CSA_RESTART sub state 147 * FAILURE: otherwise failure 148 */ 149 QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev); 150 151 /** 152 * wlan_vdev_is_going_down() - Checks whether VDEV is being brought down 153 * @vdev: Object manager VDEV object 154 * 155 * API to checks the VDEV MLME SM state to check VDEV is being brought down 156 * 157 * Return: SUCCESS: valid channel is configured 158 * FAILURE: otherwise failure 159 */ 160 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev); 161 162 /** 163 * wlan_vdev_is_restart_progress() - Checks VDEV restart is in progress 164 * @vdev: Object manager VDEV object 165 * 166 * API to check whether restarts is in progress 167 * 168 * Return: SUCCESS: if restart is in progress 169 * FAILURE: otherwise failure 170 */ 171 QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev); 172 173 /** 174 * wlan_vdev_is_dfs_cac_wait() - Checks VDEV is in cac wait state 175 * @vdev: Object manager VDEV object 176 * 177 * API to check whether state is cac wait state 178 * 179 * Return: SUCCESS: if state is cac wait state 180 * FAILURE: otherwise failure 181 */ 182 QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev); 183 184 /** 185 * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity 186 * 187 * API to take VDEV MLME command lock 188 * 189 * Return: void 190 */ 191 void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev); 192 193 /** 194 * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity 195 * 196 * API to release VDEV MLME command lock 197 * 198 * Return: void 199 */ 200 void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev); 201 202 /** 203 * wlan_vdev_mlme_is_scan_allowed() - Checks whether scan is allowed 204 * @vdev: Object manager VDEV object 205 * 206 * API to checks the VDEV MLME SM state to check scan is allowed 207 * 208 * Return: SUCCESS: if scan is allowed 209 * FAILURE: otherwise failure 210 */ 211 QDF_STATUS wlan_vdev_mlme_is_scan_allowed(struct wlan_objmgr_vdev *vdev); 212 213 /** 214 * wlan_vdev_mlme_is_init_state() - Checks whether vdev is in init state 215 * @vdev: Object manager VDEV object 216 * 217 * API to checks the VDEV MLME SM state is in init state or not 218 * 219 * Return: SUCCESS: if vdev is in init state 220 * FAILURE: otherwise failure 221 */ 222 QDF_STATUS wlan_vdev_mlme_is_init_state(struct wlan_objmgr_vdev *vdev); 223 #endif 224