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