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