1 /*
2 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4 *
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
8 *
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16 */
17
18 /**
19 * DOC: Define VDEV MLME init/deinit APIs
20 */
21
22 #ifndef _WLAN_VDEV_MLME_MAIN_H_
23 #define _WLAN_VDEV_MLME_MAIN_H_
24
25 #include <wlan_objmgr_psoc_obj.h>
26 #include <wlan_lmac_if_def.h>
27
28 /**
29 * wlan_mlme_get_lmac_tx_ops() - get tx ops
30 * @psoc: pointer to psoc obj
31 *
32 * Return: pointer to tx ops
33 */
34 static inline struct wlan_lmac_if_mlme_tx_ops *
wlan_mlme_get_lmac_tx_ops(struct wlan_objmgr_psoc * psoc)35 wlan_mlme_get_lmac_tx_ops(struct wlan_objmgr_psoc *psoc)
36 {
37 struct wlan_lmac_if_tx_ops *tx_ops;
38
39 tx_ops = wlan_psoc_get_lmac_if_txops(psoc);
40 if (!tx_ops) {
41 qdf_err("tx_ops is NULL");
42 return NULL;
43 }
44
45 return &tx_ops->mops;
46 }
47
48 /**
49 * enum wlan_vdev_state - VDEV state
50 * @WLAN_VDEV_S_INIT: Default state, IDLE state
51 * @WLAN_VDEV_S_START: START state
52 * @WLAN_VDEV_S_DFS_CAC_WAIT: CAC period
53 * @WLAN_VDEV_S_UP: UP state
54 * @WLAN_VDEV_S_SUSPEND: Suspend state
55 * @WLAN_VDEV_S_STOP: STOP state
56 * @WLAN_VDEV_S_MAX: MAX state
57 * @WLAN_VDEV_SS_START_START_PROGRESS: Start progress sub state
58 * @WLAN_VDEV_SS_START_RESTART_PROGRESS: Restart progress sub state
59 * @WLAN_VDEV_SS_START_CONN_PROGRESS: Start connection progress sub state
60 * @WLAN_VDEV_SS_START_DISCONN_PROGRESS: Start Disconnection progress sub state
61 * @WLAN_VDEV_SS_SUSPEND_SUSPEND_DOWN: Suspend down sub state
62 * @WLAN_VDEV_SS_SUSPEND_SUSPEND_RESTART: Suspend restart sub state
63 * @WLAN_VDEV_SS_SUSPEND_HOST_RESTART: Suspend host restart sub state
64 * @WLAN_VDEV_SS_SUSPEND_CSA_RESTART: Suspend CSA restart sub state
65 * @WLAN_VDEV_SS_STOP_STOP_PROGRESS: Stop progress sub state
66 * @WLAN_VDEV_SS_STOP_DOWN_PROGRESS: Stop down progress sub state
67 * @WLAN_VDEV_SS_IDLE: Idle sub state (used, only if a state
68 * does not have substate)
69 * @WLAN_VDEV_SS_MLO_SYNC_WAIT: Sync wait sub state for MLO SAP
70 * @WLAN_VDEV_SS_UP_ACTIVE: Up active sub state
71 * @WLAN_VDEV_SS_MAX: Max substate
72 */
73 enum wlan_vdev_state {
74 WLAN_VDEV_S_INIT = 0,
75 WLAN_VDEV_S_START = 1,
76 WLAN_VDEV_S_DFS_CAC_WAIT = 2,
77 WLAN_VDEV_S_UP = 3,
78 WLAN_VDEV_S_SUSPEND = 4,
79 WLAN_VDEV_S_STOP = 5,
80 WLAN_VDEV_S_MAX = 6,
81 WLAN_VDEV_SS_START_START_PROGRESS = 7,
82 WLAN_VDEV_SS_START_RESTART_PROGRESS = 8,
83 WLAN_VDEV_SS_START_CONN_PROGRESS = 9,
84 WLAN_VDEV_SS_START_DISCONN_PROGRESS = 10,
85 WLAN_VDEV_SS_SUSPEND_SUSPEND_DOWN = 11,
86 WLAN_VDEV_SS_SUSPEND_SUSPEND_RESTART = 12,
87 WLAN_VDEV_SS_SUSPEND_HOST_RESTART = 13,
88 WLAN_VDEV_SS_SUSPEND_CSA_RESTART = 14,
89 WLAN_VDEV_SS_STOP_STOP_PROGRESS = 15,
90 WLAN_VDEV_SS_STOP_DOWN_PROGRESS = 16,
91 WLAN_VDEV_SS_IDLE = 17,
92 WLAN_VDEV_SS_MLO_SYNC_WAIT = 18,
93 WLAN_VDEV_SS_UP_ACTIVE = 19,
94 WLAN_VDEV_SS_MAX = 20,
95 };
96
97 /**
98 * enum wlan_vdev_sm_evt - VDEV SM event
99 * @WLAN_VDEV_SM_EV_START: Start VDEV UP operation
100 * @WLAN_VDEV_SM_EV_START_REQ: Invokes VDEV START handshake
101 * @WLAN_VDEV_SM_EV_RESTART_REQ: Invokes VDEV RESTART handshake
102 * @WLAN_VDEV_SM_EV_START_RESP: Notification on START resp
103 * @WLAN_VDEV_SM_EV_RESTART_RESP: Notification on RESTART resp
104 * @WLAN_VDEV_SM_EV_START_REQ_FAIL: Notification on START req failure
105 * @WLAN_VDEV_SM_EV_RESTART_REQ_FAIL: Notification on RESTART req failure
106 * @WLAN_VDEV_SM_EV_START_SUCCESS: Notification of Join Success
107 * @WLAN_VDEV_SM_EV_CONN_PROGRESS: Invoke Connection/up process
108 * @WLAN_VDEV_SM_EV_STA_CONN_START: Invoke Station Connection process
109 * @WLAN_VDEV_SM_EV_DFS_CAC_WAIT: Invoke DFS CAC WAIT timer
110 * @WLAN_VDEV_SM_EV_DFS_CAC_COMPLETED: Notifies on CAC completion
111 * @WLAN_VDEV_SM_EV_DOWN: Invokes VDEV DOWN operation
112 * @WLAN_VDEV_SM_EV_CONNECTION_FAIL: Notifications for UP/connection failure
113 * @WLAN_VDEV_SM_EV_STOP_RESP: Notification of stop response
114 * @WLAN_VDEV_SM_EV_STOP_FAIL: Notification of stop req failure
115 * @WLAN_VDEV_SM_EV_DOWN_FAIL: Notification of down failure
116 * @WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE: Notification of Peer cleanup complete
117 * @WLAN_VDEV_SM_EV_SUSPEND_RESTART: Invokes suspend restart operation
118 * @WLAN_VDEV_SM_EV_HOST_RESTART: Invokes host only restart operation
119 * @WLAN_VDEV_SM_EV_UP_HOST_RESTART: Moves to UP state without sending UP
120 * command to lower layers
121 * @WLAN_VDEV_SM_EV_FW_VDEV_RESTART: Invokes FW only restart
122 * @WLAN_VDEV_SM_EV_UP_FAIL: Notification of up command failure
123 * @WLAN_VDEV_SM_EV_RADAR_DETECTED: Notification of RADAR detected, Random
124 * channel should be selected before
125 * triggering this event
126 * @WLAN_VDEV_SM_EV_CSA_RESTART: Invokes CSA IE operation
127 * @WLAN_VDEV_SM_EV_CSA_COMPLETE: Notifiction of CSA process complete
128 * @WLAN_VDEV_SM_EV_MLME_DOWN_REQ: Invoke DOWN command operation
129 * @WLAN_VDEV_SM_EV_DOWN_COMPLETE: Notification of DOWN complete
130 * @WLAN_VDEV_SM_EV_ROAM: Notifiction on ROAMING
131 * @WLAN_VDEV_SM_EV_STOP_REQ: Invoke API to initiate STOP handshake
132 * @WLAN_VDEV_SM_EV_CHAN_SWITCH_DISABLED:Test only, CSA completes without
133 * change in channel
134 * @WLAN_VDEV_SM_EV_MLO_SYNC_COMPLETE: MLO mgr triggers this event for the mlo
135 * sap in vdev wait up state, if all the
136 * links finish vdev start rsp.
137 * @WLAN_VDEV_SM_EV_SUSPEND_CSA_RESTART: Invoke peer deletion for only legacy
138 * peers
139 */
140 enum wlan_vdev_sm_evt {
141 WLAN_VDEV_SM_EV_START = 0,
142 WLAN_VDEV_SM_EV_START_REQ = 1,
143 WLAN_VDEV_SM_EV_RESTART_REQ = 2,
144 WLAN_VDEV_SM_EV_START_RESP = 3,
145 WLAN_VDEV_SM_EV_RESTART_RESP = 4,
146 WLAN_VDEV_SM_EV_START_REQ_FAIL = 5,
147 WLAN_VDEV_SM_EV_RESTART_REQ_FAIL = 6,
148 WLAN_VDEV_SM_EV_START_SUCCESS = 7,
149 WLAN_VDEV_SM_EV_CONN_PROGRESS = 8,
150 WLAN_VDEV_SM_EV_STA_CONN_START = 9,
151 WLAN_VDEV_SM_EV_DFS_CAC_WAIT = 10,
152 WLAN_VDEV_SM_EV_DFS_CAC_COMPLETED = 11,
153 WLAN_VDEV_SM_EV_DOWN = 12,
154 WLAN_VDEV_SM_EV_CONNECTION_FAIL = 13,
155 WLAN_VDEV_SM_EV_STOP_RESP = 14,
156 WLAN_VDEV_SM_EV_STOP_FAIL = 15,
157 WLAN_VDEV_SM_EV_DOWN_FAIL = 16,
158 WLAN_VDEV_SM_EV_DISCONNECT_COMPLETE = 17,
159 WLAN_VDEV_SM_EV_SUSPEND_RESTART = 18,
160 WLAN_VDEV_SM_EV_HOST_RESTART = 19,
161 WLAN_VDEV_SM_EV_UP_HOST_RESTART = 20,
162 WLAN_VDEV_SM_EV_FW_VDEV_RESTART = 21,
163 WLAN_VDEV_SM_EV_UP_FAIL = 22,
164 WLAN_VDEV_SM_EV_RADAR_DETECTED = 23,
165 WLAN_VDEV_SM_EV_CSA_RESTART = 24,
166 WLAN_VDEV_SM_EV_CSA_COMPLETE = 25,
167 WLAN_VDEV_SM_EV_MLME_DOWN_REQ = 26,
168 WLAN_VDEV_SM_EV_DOWN_COMPLETE = 27,
169 WLAN_VDEV_SM_EV_ROAM = 28,
170 WLAN_VDEV_SM_EV_STOP_REQ = 29,
171 WLAN_VDEV_SM_EV_CHAN_SWITCH_DISABLED = 30,
172 WLAN_VDEV_SM_EV_MLO_SYNC_COMPLETE = 31,
173 WLAN_VDEV_SM_EV_SUSPEND_CSA_RESTART = 32,
174 };
175
176 /**
177 * wlan_vdev_mlme_init() - Initializes VDEV MLME component
178 *
179 * Registers callbacks with object manager for create/destroy
180 *
181 * Return: SUCCESS on successful registration
182 * FAILURE, if registration fails
183 */
184 QDF_STATUS wlan_vdev_mlme_init(void);
185
186 /**
187 * wlan_vdev_mlme_deinit() - Uninitializes VDEV MLME component
188 *
189 * Unregisters callbacks with object manager for create/destroy
190 *
191 * Return: SUCCESS on successful registration
192 * FAILURE, if registration fails
193 */
194 QDF_STATUS wlan_vdev_mlme_deinit(void);
195
196 /**
197 * wlan_mlme_psoc_enable() - MLME initializations on PSOC enable
198 * @psoc: pointer to psoc object
199 *
200 * Initializes MLME params on PSOC enable
201 *
202 * Return: SUCCESS on successful initialization
203 * FAILURE, if initialization fails
204 */
205 QDF_STATUS wlan_mlme_psoc_enable(struct wlan_objmgr_psoc *psoc);
206
207 /**
208 * wlan_mlme_psoc_disable() - MLME clean up on PSOC disable
209 * @psoc: pointer to psoc object
210 *
211 * cleanup MLME params on PSOC disable
212 *
213 * Return: SUCCESS on successful cleanup
214 * FAILURE, if cleanup fails
215 */
216 QDF_STATUS wlan_mlme_psoc_disable(struct wlan_objmgr_psoc *psoc);
217
218 #ifdef WLAN_FEATURE_DYNAMIC_MAC_ADDR_UPDATE
219 /**
220 * wlan_vdev_mlme_send_set_mac_addr() - Send set MAC address command to FW
221 * @mac_addr: VDEV MAC address
222 * @mld_addr: VDEV MLD address
223 * @vdev: Pointer to object manager VDEV
224 *
225 * Return: QDF_STATUS
226 */
227 QDF_STATUS wlan_vdev_mlme_send_set_mac_addr(struct qdf_mac_addr mac_addr,
228 struct qdf_mac_addr mld_addr,
229 struct wlan_objmgr_vdev *vdev);
230
231 /**
232 * wlan_vdev_mlme_notify_set_mac_addr_response() - Notify FW set mac address
233 * response.
234 * @vdev: VDEV object manager.
235 * @resp_status: FW response status.
236 *
237 * Return: void
238 */
239 void wlan_vdev_mlme_notify_set_mac_addr_response(struct wlan_objmgr_vdev *vdev,
240 uint8_t resp_status);
241 #else
242 static inline
wlan_vdev_mlme_notify_set_mac_addr_response(struct wlan_objmgr_vdev * vdev,uint8_t resp_status)243 void wlan_vdev_mlme_notify_set_mac_addr_response(struct wlan_objmgr_vdev *vdev,
244 uint8_t resp_status)
245 {
246 }
247 #endif
248 #endif
249