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