xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/include/wlan_mlme_cmn.h (revision f28396d060cff5c6519f883cb28ae0116ce479f1)
1 /*
2  * Copyright (c) 2019-2020 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 Common MLME structure and APIs
19  */
20 #ifndef _WLAN_MLME_CMN_H_
21 #define _WLAN_MLME_CMN_H_
22 
23 #include <include/wlan_psoc_mlme.h>
24 #include <include/wlan_pdev_mlme.h>
25 #include <include/wlan_vdev_mlme.h>
26 
27 /**
28  * struct vdev_mlme_ext_ops - VDEV MLME legacy callbacks structure
29  * @mlme_psoc_ext_hdl_create:        callback to invoke creation of legacy
30  *                                   psoc object
31  * @mlme_psoc_ext_hdl_destroy:       callback to invoke destroy of legacy
32  *                                   psoc object
33  * @mlme_pdev_ext_hdl_create:        callback to invoke creation of legacy
34  *                                   pdev object
35  * @mlme_pdev_ext_hdl_destroy:       callback to invoke destroy of legacy
36  *                                   pdev object
37  * @mlme_vdev_ext_hdl_create:        callback to invoke creation of legacy
38  *                                   vdev object
39  * @mlme_vdev_ext_hdl_post_create:   callback to invoke post creation actions
40  *                                   of legacy vdev object
41  * @mlme_vdev_ext_hdl_destroy:       callback to invoke destroy of legacy
42  *                                   vdev object
43  * @mlme_vdev_start_fw_send:         callback to invoke vdev start command
44  * @mlme_vdev_stop_fw_send:          callback to invoke vdev stop command
45  * @mlme_vdev_down_fw_send:          callback to invoke vdev down command
46  * @mlme_multivdev_restart_fw_send:  callback to invoke multivdev restart
47  *                                   command
48  * @mlme_vdev_enqueue_exp_cmd:       callback to enqueue exception command
49  *                                   required by serialization
50  * @mlme_multi_vdev_restart_resp:    callback to process multivdev restart
51  *				     response
52  */
53 struct mlme_ext_ops {
54 	QDF_STATUS (*mlme_psoc_ext_hdl_create)(
55 				struct psoc_mlme_obj *psoc_mlme);
56 	QDF_STATUS (*mlme_psoc_ext_hdl_destroy)(
57 				struct psoc_mlme_obj *pdev_mlme);
58 	QDF_STATUS (*mlme_pdev_ext_hdl_create)(
59 				struct pdev_mlme_obj *pdev_mlme);
60 	QDF_STATUS (*mlme_pdev_ext_hdl_destroy)(
61 				struct pdev_mlme_obj *pdev_mlme);
62 	QDF_STATUS (*mlme_vdev_ext_hdl_create)(
63 				struct vdev_mlme_obj *vdev_mlme);
64 	QDF_STATUS (*mlme_vdev_ext_hdl_post_create)(
65 				struct vdev_mlme_obj *vdev_mlme);
66 	QDF_STATUS (*mlme_vdev_ext_hdl_destroy)(
67 				struct vdev_mlme_obj *vdev_mlme);
68 	QDF_STATUS (*mlme_vdev_start_fw_send)(
69 				struct wlan_objmgr_vdev *vdev, uint8_t restart);
70 	QDF_STATUS (*mlme_vdev_stop_fw_send)(struct wlan_objmgr_vdev *vdev);
71 	QDF_STATUS (*mlme_vdev_down_fw_send)(struct wlan_objmgr_vdev *vdev);
72 	QDF_STATUS (*mlme_multivdev_restart_fw_send)(
73 				struct wlan_objmgr_pdev *pdev);
74 	QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)(
75 				struct vdev_mlme_obj *vdev_mlme,
76 				uint8_t cmd_type);
77 	QDF_STATUS (*mlme_vdev_ext_delete_rsp)(
78 					   struct wlan_objmgr_psoc *psoc,
79 					   struct vdev_delete_response *rsp);
80 	QDF_STATUS (*mlme_multi_vdev_restart_resp)(
81 				struct wlan_objmgr_psoc *psoc,
82 				struct multi_vdev_restart_resp *resp);
83 };
84 
85 /**
86  * mlme_psoc_ops_ext_hdl_create() - Alloc PSOC mlme ext handle
87  * @psoc_mlme:  PSOC MLME comp object
88  *
89  * API to allocate PSOC MLME ext handle
90  *
91  * Return: SUCCESS on successful allocation
92  *         Else FAILURE
93  */
94 QDF_STATUS mlme_psoc_ops_ext_hdl_create(struct psoc_mlme_obj *psoc_mlme);
95 
96 /**
97  * mlme_psoc_ops_ext_hdl_destroy() - Destroy PSOC mlme ext handle
98  * @psoc_mlme:  PSOC MLME comp object
99  *
100  * API to free psoc MLME ext handle
101  *
102  * Return: SUCCESS on successful free
103  *         Else FAILURE
104  */
105 QDF_STATUS mlme_psoc_ops_ext_hdl_destroy(struct psoc_mlme_obj *psoc_mlme);
106 
107 /**
108  * mlme_pdev_ops_ext_hdl_create - Alloc PDEV mlme ext handle
109  * @pdev_mlme_obj:  PDEV MLME comp object
110  *
111  * API to allocate PDEV MLME ext handle
112  *
113  * Return: SUCCESS on successful allocation
114  *         Else FAILURE
115  */
116 QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme);
117 
118 /**
119  * mlme_pdev_ops_ext_hdl_destroy - Destroy PDEV mlme ext handle
120  * @pdev_mlme_obj:  PDEV MLME comp object
121  *
122  * API to free pdev MLME ext handle
123  *
124  * Return: SUCCESS on successful free
125  *         Else FAILURE
126  */
127 QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme);
128 
129 /**
130  * mlme_vdev_ops_ext_hdl_create - Alloc VDEV mlme ext handle
131  * @vdev_mlme_obj:  VDEV MLME comp object
132  *
133  * API to allocate VDEV MLME ext handle
134  *
135  * Return: SUCCESS on successful allocation
136  *         Else FAILURE
137  */
138 QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme);
139 
140 /**
141  * mlme_vdev_ops_ext_hdl_post_create - Perform post VDEV mlme ext handle alloc
142  *                                     operations
143  * @vdev_mlme_obj:  VDEV MLME comp object
144  *
145  * API to perform post vdev MLME ext handle allocation operations
146  *
147  * Return: SUCCESS on initialization successful
148  *         Else FAILURE
149  */
150 QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme);
151 
152 /**
153  * mlme_vdev_ops_ext_hdl_destroy - Destroy VDEV mlme ext handle
154  * @vdev_mlme_obj:  VDEV MLME comp object
155  *
156  * API to free vdev MLME ext handle
157  *
158  * Return: SUCCESS on successful free
159  *         Else FAILURE
160  */
161 QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme);
162 
163 /**
164  * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd
165  * @vdev_mlme_obj:  VDEV MLME comp object
166  * @cmd_type: Serialization command type
167  *
168  * API to enqueue the exception serialization command, used by
169  * mlme-serialization wrapper layer
170  *
171  * Return: SUCCESS on successful enqueuing the command
172  *         Else FAILURE
173  */
174 QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme,
175 					 uint8_t cmd_type);
176 
177 /**
178  * mlme_vdev_ops_start_fw_send - Send WMI START/RESTART commmand to FW
179  * @vdev:  VDEV object
180  *
181  * API to send WMI start/restart command to FW
182  *
183  * Return: SUCCESS on successful sending the command
184  *         Else FAILURE
185  */
186 QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev,
187 				       uint8_t restart);
188 
189 /**
190  * mlme_vdev_ops_multivdev_restart_fw_cmd_send - Send WMI Multivdev restart
191  *                                              commmand to FW
192  * @pdev:  PDEV object
193  *
194  * API to send WMI multivdev restart command to FW
195  *
196  * Return: SUCCESS on successful sending the command
197  *         Else FAILURE
198  */
199 QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send(
200 						struct wlan_objmgr_pdev *pdev);
201 
202 /**
203  * mlme_vdev_ops_stop_fw_send - Send WMI STOP commmand to FW
204  * @vdev:  VDEV object
205  *
206  * API to send WMI stop command to FW
207  *
208  * Return: SUCCESS on successful sending the command
209  *         Else FAILURE
210  */
211 QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev);
212 
213 /**
214  * mlme_vdev_ops_down_fw_send - Send WMI Down commmand to FW
215  * @vdev:  VDEV object
216  *
217  * API to send WMI down command to FW
218  *
219  * Return: SUCCESS on successful sending the command
220  *         Else FAILURE
221  */
222 QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev);
223 
224 /*
225  * mlme_vdev_ops_ext_hdl_multivdev_restart_resp() - Handler multivdev restart
226  * response event
227  * @psoc: PSOC object manager handle
228  * @resp: Restart response event
229  *
230  * Return: Success on successful handling of the response event,
231  *         Else failure
232  */
233 QDF_STATUS mlme_vdev_ops_ext_hdl_multivdev_restart_resp(
234 		struct wlan_objmgr_psoc *psoc,
235 		struct multi_vdev_restart_resp *resp);
236 
237 /**
238  * mlme_set_ops_register_cb - Sets ops registration callback
239  * @ops_cb:  Function pointer
240  *
241  * API to set ops registration call back
242  *
243  * Return: void
244  */
245 typedef struct mlme_ext_ops *(*mlme_get_global_ops_cb)(void);
246 void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb);
247 
248 /**
249  * wlan_cmn_mlme_init - Initializes MLME component
250  *
251  * Registers callbacks with object manager for create/destroy
252  *
253  * Return: SUCCESS on successful registration
254  *         FAILURE, if registration fails
255  */
256 QDF_STATUS wlan_cmn_mlme_init(void);
257 
258 /**
259  * wlan_cmn_mlme_deinit - Uninitializes MLME component
260  *
261  * Unregisters callbacks with object manager for create/destroy
262  *
263  * Return: SUCCESS on successful registration
264  *         FAILURE, if registration fails
265  */
266 QDF_STATUS wlan_cmn_mlme_deinit(void);
267 
268 /**
269  * mlme_vdev_ops_ext_hdl_delete_rsp - Vdev Delete response ext handler
270  * @psoc: PSOC object
271  * @rsp: Vdev delete response received from the firmware
272  *
273  * API to invoke the legacy delete response handler for legacy cleanup
274  *
275  * Return: SUCCESS on successful deletion
276  *         FAILURE, if deletion fails
277  */
278 QDF_STATUS mlme_vdev_ops_ext_hdl_delete_rsp(struct wlan_objmgr_psoc *psoc,
279 					    struct vdev_delete_response *rsp);
280 #endif
281