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 /** 25 * wlan_vdev_mlme_get_cmpt_obj - Retrieves MLME component object 26 * from VDEV object 27 * @vdev: pointer to vdev object 28 * 29 * Retrieves MLME component object from VDEV object 30 * 31 * Return: comp handle on SUCCESS 32 * NULL, if it fails to retrieve 33 */ 34 struct vdev_mlme_obj *wlan_vdev_mlme_get_cmpt_obj( 35 struct wlan_objmgr_vdev *vdev); 36 /** 37 * wlan_vdev_mlme_set_ext_hdl - Sets legacy handle 38 * @vdev: pointer to vdev object 39 * @ext_hdl: pointer to legacy handle 40 * 41 * Sets Legacy handle to MLME component object 42 * 43 * Return: 44 */ 45 void wlan_vdev_mlme_set_ext_hdl(struct wlan_objmgr_vdev *vdev, void *ext_hdl); 46 47 /** 48 * wlan_vdev_mlme_get_ext_hdl - Returns legacy handle 49 * @vdev: pointer to vdev object 50 * 51 * Retrieves legacy handle from vdev mlme component object 52 * 53 * Return: legacy handle on SUCCESS 54 * NULL, if it fails to retrieve 55 */ 56 void *wlan_vdev_mlme_get_ext_hdl(struct wlan_objmgr_vdev *vdev); 57 58 #ifdef CMN_VDEV_MLME_SM_ENABLE 59 /** 60 * wlan_vdev_mlme_sm_deliver_evt() - Delivers event to VDEV MLME SM 61 * @vdev: Object manager VDEV object 62 * @event: MLME event 63 * @event_data_len: data size 64 * @event_data: event data 65 * 66 * API to dispatch event to VDEV MLME SM with lock acquired 67 * 68 * Return: SUCCESS: on handling event 69 * FAILURE: on ignoring the event 70 */ 71 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt(struct wlan_objmgr_vdev *vdev, 72 enum wlan_vdev_sm_evt event, 73 uint16_t event_data_len, 74 void *event_data); 75 76 /** 77 * wlan_vdev_mlme_sm_deliver_evt_sync() - Delivers event to VDEV MLME SM sync 78 * @vdev: Object manager VDEV object 79 * @event: MLME event 80 * @event_data_len: data size 81 * @event_data: event data 82 * 83 * API to dispatch event to VDEV MLME SM with lock acquired 84 * 85 * Return: SUCCESS: on handling event 86 * FAILURE: on ignoring the event 87 */ 88 QDF_STATUS wlan_vdev_mlme_sm_deliver_evt_sync(struct wlan_objmgr_vdev *vdev, 89 enum wlan_vdev_sm_evt event, 90 uint16_t event_data_len, 91 void *event_data); 92 93 #ifdef SM_ENG_HIST_ENABLE 94 /** 95 * wlan_vdev_mlme_sm_history_print() - Prints SM history 96 * @vdev: Object manager VDEV object 97 * 98 * API to print SM history 99 * 100 * Return: void 101 */ 102 void wlan_vdev_mlme_sm_history_print(struct wlan_objmgr_vdev *vdev); 103 104 #endif 105 106 /** 107 * wlan_vdev_allow_connect_n_tx() - Checks whether VDEV is in operational state 108 * @vdev: Object manager VDEV object 109 * 110 * API to checks the VDEV MLME SM state to allow tx or connections 111 * 112 * Return: SUCCESS: to allow tx or connection 113 * FAILURE: otherwise failure 114 */ 115 QDF_STATUS wlan_vdev_allow_connect_n_tx(struct wlan_objmgr_vdev *vdev); 116 117 /** 118 * wlan_vdev_mlme_is_active() - Checks whether VDEV is in active state 119 * @vdev: Object manager VDEV object 120 * 121 * API to checks the VDEV MLME SM state to check channel is configured in FW 122 * 123 * Return: SUCCESS: valid channel is configured 124 * FAILURE: otherwise failure 125 */ 126 QDF_STATUS wlan_vdev_mlme_is_active(struct wlan_objmgr_vdev *vdev); 127 128 /** 129 * wlan_vdev_chan_config_valid() - Checks whether VDEV chan config valid 130 * @vdev: Object manager VDEV object 131 * 132 * API to checks the VDEV MLME SM state to check channel is configured in Host 133 * 134 * Return: SUCCESS: valid channel is configured 135 * FAILURE: otherwise failure 136 */ 137 QDF_STATUS wlan_vdev_chan_config_valid(struct wlan_objmgr_vdev *vdev); 138 139 /** 140 * wlan_vdev_mlme_is_csa_restart() - Checks whether VDEV MLME SM is in CSA 141 * @vdev: Object manager VDEV object 142 * 143 * API to checks the VDEV MLME SM state for CSA_RESTART substate 144 * 145 * Return: SUCCESS: if it is in CSA_RESTART sub state 146 * FAILURE: otherwise failure 147 */ 148 QDF_STATUS wlan_vdev_mlme_is_csa_restart(struct wlan_objmgr_vdev *vdev); 149 150 /** 151 * wlan_vdev_is_going_down() - Checks whether VDEV is being brought down 152 * @vdev: Object manager VDEV object 153 * 154 * API to checks the VDEV MLME SM state to check VDEV is being brought down 155 * 156 * Return: SUCCESS: valid channel is configured 157 * FAILURE: otherwise failure 158 */ 159 QDF_STATUS wlan_vdev_is_going_down(struct wlan_objmgr_vdev *vdev); 160 161 /** 162 * wlan_vdev_is_restart_progress() - Checks VDEV restart is in progress 163 * @vdev: Object manager VDEV object 164 * 165 * API to check whether restarts is in progress 166 * 167 * Return: SUCCESS: if restart is in progress 168 * FAILURE: otherwise failure 169 */ 170 QDF_STATUS wlan_vdev_is_restart_progress(struct wlan_objmgr_vdev *vdev); 171 172 /** 173 * wlan_vdev_is_dfs_cac_wait() - Checks VDEV is in cac wait state 174 * @vdev: Object manager VDEV object 175 * 176 * API to check whether state is cac wait state 177 * 178 * Return: SUCCESS: if state is cac wait state 179 * FAILURE: otherwise failure 180 */ 181 QDF_STATUS wlan_vdev_is_dfs_cac_wait(struct wlan_objmgr_vdev *vdev); 182 183 /** 184 * wlan_vdev_mlme_cmd_lock - Acquire lock for command queuing atomicity 185 * 186 * API to take VDEV MLME command lock 187 * 188 * Return: void 189 */ 190 void wlan_vdev_mlme_cmd_lock(struct wlan_objmgr_vdev *vdev); 191 192 /** 193 * wlan_vdev_mlme_cmd_unlock - Release lock for command queuing atomicity 194 * 195 * API to release VDEV MLME command lock 196 * 197 * Return: void 198 */ 199 void wlan_vdev_mlme_cmd_unlock(struct wlan_objmgr_vdev *vdev); 200 201 /** 202 * wlan_vdev_mlme_is_scan_allowed() - Checks whether scan is allowed 203 * @vdev: Object manager VDEV object 204 * 205 * API to checks the VDEV MLME SM state to check scan is allowed 206 * 207 * Return: SUCCESS: if scan is allowed 208 * FAILURE: otherwise failure 209 */ 210 QDF_STATUS wlan_vdev_mlme_is_scan_allowed(struct wlan_objmgr_vdev *vdev); 211 #endif 212 #endif 213