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