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 init/deinit APIs 19 */ 20 21 #ifndef _WLAN_VDEV_MLME_MAIN_H_ 22 #define _WLAN_VDEV_MLME_MAIN_H_ 23 24 #include <wlan_objmgr_psoc_obj.h> 25 #include <wlan_lmac_if_def.h> 26 27 /** 28 * wlan_mlme_get_lmac_tx_ops() - get tx ops 29 * @psoc: pointer to psoc obj 30 * 31 * Return: pointer to tx ops 32 */ 33 static inline struct wlan_lmac_if_mlme_tx_ops * 34 wlan_mlme_get_lmac_tx_ops(struct wlan_objmgr_psoc *psoc) 35 { 36 return &psoc->soc_cb.tx_ops.mops; 37 } 38 39 #ifdef CMN_VDEV_MLME_SM_ENABLE 40 /** 41 * enum wlan_vdev_state - VDEV state 42 * @WLAN_VDEV_S_INIT: Default state, IDLE state 43 * @WLAN_VDEV_S_START: START state 44 * @WLAN_VDEV_S_DFS_CAC_WAIT: CAC period 45 * @WLAN_VDEV_S_UP: UP state 46 * @WLAN_VDEV_S_SUSPEND: Suspend state 47 * @WLAN_VDEV_S_STOP: STOP state 48 * @WLAN_VDEV_S_MAX: MAX state 49 * @WLAN_VDEV_SS_START_START_PROGRESS: Start progress sub state 50 * @WLAN_VDEV_SS_START_RESTART_PROGRESS: Restart progress sub state 51 * @WLAN_VDEV_SS_START_CONN_PROGRESS: Start connection progress sub state 52 * @WLAN_VDEV_SS_START_DISCONN_PROGRESS: Start Disconnection progress sub state 53 * @WLAN_VDEV_SS_SUSPEND_SUSPEND_DOWN: Suspend down sub state 54 * @WLAN_VDEV_SS_SUSPEND_SUSPEND_RESTART: Suspend restart sub state 55 * @WLAN_VDEV_SS_SUSPEND_HOST_RESTART: Suspend host restart sub state 56 * @WLAN_VDEV_SS_SUSPEND_CSA_RESTART: Suspend CSA restart sub state 57 * @WLAN_VDEV_SS_STOP_STOP_PROGRESS: Stop progress sub state 58 * @WLAN_VDEV_SS_STOP_DOWN_PROGRESS: Stop down progress sub state 59 * @WLAN_VDEV_SS_IDLE: Idle sub state (used, only if a state 60 * does not have substate) 61 * @WLAN_VDEV_SS_MAX: Max substate 62 */ 63 enum wlan_vdev_state { 64 WLAN_VDEV_S_INIT = 0, 65 WLAN_VDEV_S_START = 1, 66 WLAN_VDEV_S_DFS_CAC_WAIT = 2, 67 WLAN_VDEV_S_UP = 3, 68 WLAN_VDEV_S_SUSPEND = 4, 69 WLAN_VDEV_S_STOP = 5, 70 WLAN_VDEV_S_MAX = 6, 71 WLAN_VDEV_SS_START_START_PROGRESS = 7, 72 WLAN_VDEV_SS_START_RESTART_PROGRESS = 8, 73 WLAN_VDEV_SS_START_CONN_PROGRESS = 9, 74 WLAN_VDEV_SS_START_DISCONN_PROGRESS = 10, 75 WLAN_VDEV_SS_SUSPEND_SUSPEND_DOWN = 11, 76 WLAN_VDEV_SS_SUSPEND_SUSPEND_RESTART = 12, 77 WLAN_VDEV_SS_SUSPEND_HOST_RESTART = 13, 78 WLAN_VDEV_SS_SUSPEND_CSA_RESTART = 14, 79 WLAN_VDEV_SS_STOP_STOP_PROGRESS = 15, 80 WLAN_VDEV_SS_STOP_DOWN_PROGRESS = 16, 81 WLAN_VDEV_SS_IDLE = 17, 82 WLAN_VDEV_SS_MAX = 18, 83 }; 84 85 /** 86 * enum wlan_vdev_sm_evt - VDEV SM event 87 * @WLAN_VDEV_SM_EV_START: Start VDEV UP operation 88 * @WLAN_VDEV_SM_EV_START_REQ: Invokes VDEV START handshake 89 * @WLAN_VDEV_SM_EV_RESTART_REQ: Invokes VDEV RESTART handshake 90 * @WLAN_VDEV_SM_EV_START_RESP: Notification on START resp 91 * @WLAN_VDEV_SM_EV_RESTART_RESP: Notification on RESTART resp 92 * @WLAN_VDEV_SM_EV_START_REQ_FAIL: Notification on START req failure 93 * @WLAN_VDEV_SM_EV_RESTART_REQ_FAIL: Notification on RESTART req failure 94 * @WLAN_VDEV_SM_EV_START_SUCCESS: Notification of Join Success 95 * @WLAN_VDEV_SM_EV_CONN_PROGRESS: Invoke Connection/up process 96 * @WLAN_VDEV_SM_EV_STA_CONN_START: Invoke Station Connection process 97 * @WLAN_VDEV_SM_EV_DFS_CAC_WAIT: Invoke DFS CAC WAIT timer 98 * @WLAN_VDEV_SM_EV_DFS_CAC_COMPLETED: Notifies on CAC completion 99 * @WLAN_VDEV_SM_EV_DOWN: Invokes VDEV DOWN operation 100 * @WLAN_VDEV_SM_EV_CONNECTION_FAIL: Notifications for UP/connection failure 101 * @WLAN_VDEV_SM_EV_STOP_RESP: Notifcation of stop response 102 * @WLAN_VDEV_SM_EV_STOP_FAIL: Notification of stop req failure 103 * @WLAN_VDEV_SM_EV_DOWN_FAIL: Notification of down failure 104 * @WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE: Notification of Peer cleanup complete 105 * @WLAN_VDEV_SM_EV_SUSPEND_RESTART: Invokes suspend restart operation 106 * @WLAN_VDEV_SM_EV_HOST_RESTART: Invokes host only restart operation 107 * @WLAN_VDEV_SM_EV_UP_HOST_RESTART: Moves to UP state without sending UP 108 * command to lower layers 109 * @WLAN_VDEV_SM_EV_FW_VDEV_RESTART: Invokes FW only restart 110 * @WLAN_VDEV_SM_EV_UP_FAIL: Notification of up command failure 111 * @WLAN_VDEV_SM_EV_RADAR_DETECTED: Notification of RADAR detected, Random 112 * channel should be selected before 113 * triggering this event 114 * @WLAN_VDEV_SM_EV_CSA_RESTART: Invokes CSA IE operation 115 * @WLAN_VDEV_SM_EV_CSA_COMPLETE: Notifiction of CSA process complete 116 * @WLAN_VDEV_SM_EV_MLME_DOWN_REQ: Invoke DOWN command operation 117 * @WLAN_VDEV_SM_EV_DOWN_COMPLETE: Notification of DOWN complete 118 * @WLAN_VDEV_SM_EV_ROAM: Notifiction on ROAMING 119 * @WLAN_VDEV_SM_EV_STOP_REQ: Invoke API to initiate STOP handshake 120 */ 121 enum wlan_vdev_sm_evt { 122 WLAN_VDEV_SM_EV_START = 0, 123 WLAN_VDEV_SM_EV_START_REQ = 1, 124 WLAN_VDEV_SM_EV_RESTART_REQ = 2, 125 WLAN_VDEV_SM_EV_START_RESP = 3, 126 WLAN_VDEV_SM_EV_RESTART_RESP = 4, 127 WLAN_VDEV_SM_EV_START_REQ_FAIL = 5, 128 WLAN_VDEV_SM_EV_RESTART_REQ_FAIL = 6, 129 WLAN_VDEV_SM_EV_START_SUCCESS = 7, 130 WLAN_VDEV_SM_EV_CONN_PROGRESS = 8, 131 WLAN_VDEV_SM_EV_STA_CONN_START = 9, 132 WLAN_VDEV_SM_EV_DFS_CAC_WAIT = 10, 133 WLAN_VDEV_SM_EV_DFS_CAC_COMPLETED = 11, 134 WLAN_VDEV_SM_EV_DOWN = 12, 135 WLAN_VDEV_SM_EV_CONNECTION_FAIL = 13, 136 WLAN_VDEV_SM_EV_STOP_RESP = 14, 137 WLAN_VDEV_SM_EV_STOP_FAIL = 15, 138 WLAN_VDEV_SM_EV_DOWN_FAIL = 16, 139 WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE = 17, 140 WLAN_VDEV_SM_EV_SUSPEND_RESTART = 18, 141 WLAN_VDEV_SM_EV_HOST_RESTART = 19, 142 WLAN_VDEV_SM_EV_UP_HOST_RESTART = 20, 143 WLAN_VDEV_SM_EV_FW_VDEV_RESTART = 21, 144 WLAN_VDEV_SM_EV_UP_FAIL = 22, 145 WLAN_VDEV_SM_EV_RADAR_DETECTED = 23, 146 WLAN_VDEV_SM_EV_CSA_RESTART = 24, 147 WLAN_VDEV_SM_EV_CSA_COMPLETE = 25, 148 WLAN_VDEV_SM_EV_MLME_DOWN_REQ = 26, 149 WLAN_VDEV_SM_EV_DOWN_COMPLETE = 27, 150 WLAN_VDEV_SM_EV_ROAM = 28, 151 WLAN_VDEV_SM_EV_STOP_REQ = 29, 152 }; 153 154 #else 155 156 /** 157 * enum wlan_vdev_state - VDEV state 158 * @WLAN_VDEV_S_INIT: Default state, IDLE state 159 * @WLAN_VDEV_S_SCAN: SCAN state 160 * @WLAN_VDEV_S_JOIN: Join state 161 * @WLAN_VDEV_S_DFS_WAIT:CAC period 162 * @WLAN_VDEV_S_RUN: RUN state 163 * @WLAN_VDEV_S_STOP: STOP state 164 * @WLAN_VDEV_S_RESET: RESET state, STOP+INIT+JOIN 165 * @WLAN_VDEV_S_MAX: MAX state 166 */ 167 enum wlan_vdev_state { 168 WLAN_VDEV_S_INIT = 0, 169 WLAN_VDEV_S_SCAN = 1, 170 WLAN_VDEV_S_JOIN = 2, 171 WLAN_VDEV_S_DFS_WAIT = 3, 172 WLAN_VDEV_S_RUN = 4, 173 WLAN_VDEV_S_STOP = 5, 174 WLAN_VDEV_S_RESET = 6, 175 WLAN_VDEV_S_MAX, 176 }; 177 #endif 178 179 #ifdef CMN_VDEV_MLME_CMPT_ENABLE 180 181 /** 182 * wlan_vdev_mlme_init - Initializes VDEV MLME component 183 * 184 * Registers callbacks with object manager for create/destroy 185 * 186 * Return: SUCCESS on successful registration 187 * FAILURE, if registration fails 188 */ 189 QDF_STATUS wlan_vdev_mlme_init(void); 190 191 /** 192 * wlan_vdev_mlme_deinit - Uninitializes VDEV MLME component 193 * 194 * Unregisters callbacks with object manager for create/destroy 195 * 196 * Return: SUCCESS on successful registration 197 * FAILURE, if registration fails 198 */ 199 QDF_STATUS wlan_vdev_mlme_deinit(void); 200 201 /** 202 * wlan_mlme_psoc_enable - MLME initializations on PSOC enable 203 * 204 * Initializes MLME params on PSOC eable 205 * 206 * Return: SUCCESS on successful initialization 207 * FAILURE, if initialization fails 208 */ 209 QDF_STATUS wlan_mlme_psoc_enable(struct wlan_objmgr_psoc *psoc); 210 211 /** 212 * wlan_mlme_psoc_disable - MLME clean up on PSOC disable 213 * 214 * cleanup MLME params on PSOC eable 215 * 216 * Return: SUCCESS on successful cleanup 217 * FAILURE, if cleanup fails 218 */ 219 QDF_STATUS wlan_mlme_psoc_disable(struct wlan_objmgr_psoc *psoc); 220 #else 221 222 /** 223 * wlan_vdev_mlme_init - Initializes MLME component 224 * 225 * Registers callbacks with object manager for create/destroy 226 * 227 * Return: SUCCESS on successful registration 228 * FAILURE, if registration fails 229 */ 230 static inline QDF_STATUS wlan_vdev_mlme_init(void) 231 { 232 return QDF_STATUS_SUCCESS; 233 } 234 235 /** 236 * wlan_vdev_mlme_deinit - Uninitializes MLME component 237 * 238 * Unregisters callbacks with object manager for create/destroy 239 * 240 * Return: SUCCESS on successful registration 241 * FAILURE, if registration fails 242 */ 243 static inline QDF_STATUS wlan_vdev_mlme_deinit(void) 244 { 245 return QDF_STATUS_SUCCESS; 246 } 247 248 /** 249 * wlan_mlme_psoc_enable - MLME initializations on PSOC enable 250 * 251 * Initializes MLME params on PSOC eable 252 * 253 * Return: SUCCESS on successful initialization 254 * FAILURE, if initialization fails 255 */ 256 static inline QDF_STATUS wlan_mlme_psoc_enable(struct wlan_objmgr_psoc *psoc) 257 { 258 return QDF_STATUS_SUCCESS; 259 } 260 261 /** 262 * wlan_mlme_psoc_disable - MLME clean up on PSOC disable 263 * 264 * cleanup MLME params on PSOC eable 265 * 266 * Return: SUCCESS on successful cleanup 267 * FAILURE, if cleanup fails 268 */ 269 static inline QDF_STATUS wlan_mlme_psoc_disable(struct wlan_objmgr_psoc *psoc) 270 { 271 return QDF_STATUS_SUCCESS; 272 } 273 274 #endif 275 #endif 276