xref: /wlan-dirver/qca-wifi-host-cmn/umac/mlme/include/wlan_mlme_cmn.h (revision ad85c389289a03e320cd08dea21861f9857892fc)
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 #ifdef CMN_VDEV_MLME_CMPT_ENABLE
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_pdev_ext_hdl_create:        callback to invoke creation of legacy
30  *                                   pdev object
31  * @mlme_pdev_ext_hdl_destroy:       callback to invoke destroy of legacy
32  *                                   pdev object
33  * @mlme_vdev_ext_hdl_create:        callback to invoke creation of legacy
34  *                                   vdev object
35  * @mlme_vdev_ext_hdl_post_create:   callback to invoke post creation actions
36  *                                   of legacy vdev object
37  * @mlme_vdev_ext_hdl_destroy:       callback to invoke destroy of legacy
38  *                                   vdev object
39  * @mlme_vdev_start_fw_send:         callback to invoke vdev start command
40  * @mlme_vdev_stop_fw_send:          callback to invoke vdev stop command
41  * @mlme_vdev_down_fw_send:          callback to invoke vdev down command
42  * @mlme_multivdev_restart_fw_send:  callback to invoke multivdev restart
43  *                                   command
44  * @mlme_vdev_enqueue_exp_cmd:       callback to enqueue exception command
45  *                                   required by serialization
46  */
47 struct mlme_ext_ops {
48 	QDF_STATUS (*mlme_pdev_ext_hdl_create)(
49 				struct pdev_mlme_obj *pdev_mlme);
50 	QDF_STATUS (*mlme_pdev_ext_hdl_destroy)(
51 				struct pdev_mlme_obj *pdev_mlme);
52 	QDF_STATUS (*mlme_vdev_ext_hdl_create)(
53 				struct vdev_mlme_obj *vdev_mlme);
54 	QDF_STATUS (*mlme_vdev_ext_hdl_post_create)(
55 				struct vdev_mlme_obj *vdev_mlme);
56 	QDF_STATUS (*mlme_vdev_ext_hdl_destroy)(
57 				struct vdev_mlme_obj *vdev_mlme);
58 	QDF_STATUS (*mlme_vdev_start_fw_send)(
59 				struct wlan_objmgr_vdev *vdev, uint8_t restart);
60 	QDF_STATUS (*mlme_vdev_stop_fw_send)(struct wlan_objmgr_vdev *vdev);
61 	QDF_STATUS (*mlme_vdev_down_fw_send)(struct wlan_objmgr_vdev *vdev);
62 	QDF_STATUS (*mlme_multivdev_restart_fw_send)(
63 				struct wlan_objmgr_pdev *pdev);
64 	QDF_STATUS (*mlme_vdev_enqueue_exp_cmd)(
65 				struct vdev_mlme_obj *vdev_mlme,
66 				uint8_t cmd_type);
67 };
68 
69 /**
70  * mlme_pdev_ops_ext_hdl_create - Alloc PDEV mlme ext handle
71  * @pdev_mlme_obj:  PDEV MLME comp object
72  *
73  * API to allocate PDEV MLME ext handle
74  *
75  * Return: SUCCESS on successful allocation
76  *         Else FAILURE
77  */
78 QDF_STATUS mlme_pdev_ops_ext_hdl_create(struct pdev_mlme_obj *pdev_mlme);
79 
80 /**
81  * mlme_pdev_ops_ext_hdl_destroy - Destroy PDEV mlme ext handle
82  * @pdev_mlme_obj:  PDEV MLME comp object
83  *
84  * API to free pdev MLME ext handle
85  *
86  * Return: SUCCESS on successful free
87  *         Else FAILURE
88  */
89 QDF_STATUS mlme_pdev_ops_ext_hdl_destroy(struct pdev_mlme_obj *pdev_mlme);
90 
91 /**
92  * mlme_vdev_ops_ext_hdl_create - Alloc VDEV mlme ext handle
93  * @vdev_mlme_obj:  VDEV MLME comp object
94  *
95  * API to allocate VDEV MLME ext handle
96  *
97  * Return: SUCCESS on successful allocation
98  *         Else FAILURE
99  */
100 QDF_STATUS mlme_vdev_ops_ext_hdl_create(struct vdev_mlme_obj *vdev_mlme);
101 
102 /**
103  * mlme_vdev_ops_ext_hdl_post_create - Perform post VDEV mlme ext handle alloc
104  *                                     operations
105  * @vdev_mlme_obj:  VDEV MLME comp object
106  *
107  * API to perform post vdev MLME ext handle allocation operations
108  *
109  * Return: SUCCESS on initialization successful
110  *         Else FAILURE
111  */
112 QDF_STATUS mlme_vdev_ops_ext_hdl_post_create(struct vdev_mlme_obj *vdev_mlme);
113 
114 /**
115  * mlme_vdev_ops_ext_hdl_destroy - Destroy VDEV mlme ext handle
116  * @vdev_mlme_obj:  VDEV MLME comp object
117  *
118  * API to free vdev MLME ext handle
119  *
120  * Return: SUCCESS on successful free
121  *         Else FAILURE
122  */
123 QDF_STATUS mlme_vdev_ops_ext_hdl_destroy(struct vdev_mlme_obj *vdev_mlme);
124 
125 /**
126  * mlme_vdev_enqueue_exp_ser_cmd - Enqueue exception serialization cmd
127  * @vdev_mlme_obj:  VDEV MLME comp object
128  * @cmd_type: Serialization command type
129  *
130  * API to enqueue the exception serialization command, used by
131  * mlme-serialization wrapper layer
132  *
133  * Return: SUCCESS on successful enqueuing the command
134  *         Else FAILURE
135  */
136 QDF_STATUS mlme_vdev_enqueue_exp_ser_cmd(struct vdev_mlme_obj *vdev_mlme,
137 					 uint8_t cmd_type);
138 
139 /**
140  * mlme_vdev_ops_start_fw_send - Send WMI START/RESTART commmand to FW
141  * @vdev:  VDEV object
142  *
143  * API to send WMI start/restart command to FW
144  *
145  * Return: SUCCESS on successful sending the command
146  *         Else FAILURE
147  */
148 QDF_STATUS mlme_vdev_ops_start_fw_send(struct wlan_objmgr_vdev *vdev,
149 				       uint8_t restart);
150 
151 /**
152  * mlme_vdev_ops_multivdev_restart_fw_cmd_send - Send WMI Multivdev restart
153  *                                              commmand to FW
154  * @pdev:  PDEV object
155  *
156  * API to send WMI multivdev restart command to FW
157  *
158  * Return: SUCCESS on successful sending the command
159  *         Else FAILURE
160  */
161 QDF_STATUS mlme_vdev_ops_multivdev_restart_fw_cmd_send(
162 						struct wlan_objmgr_pdev *pdev);
163 
164 /**
165  * mlme_vdev_ops_stop_fw_send - Send WMI STOP commmand to FW
166  * @vdev:  VDEV object
167  *
168  * API to send WMI stop command to FW
169  *
170  * Return: SUCCESS on successful sending the command
171  *         Else FAILURE
172  */
173 QDF_STATUS mlme_vdev_ops_stop_fw_send(struct wlan_objmgr_vdev *vdev);
174 
175 /**
176  * mlme_vdev_ops_down_fw_send - Send WMI Down commmand to FW
177  * @vdev:  VDEV object
178  *
179  * API to send WMI down command to FW
180  *
181  * Return: SUCCESS on successful sending the command
182  *         Else FAILURE
183  */
184 QDF_STATUS mlme_vdev_ops_down_fw_send(struct wlan_objmgr_vdev *vdev);
185 
186 /**
187  * mlme_set_ops_register_cb - Sets ops registration callback
188  * @ops_cb:  Function pointer
189  *
190  * API to set ops registration call back
191  *
192  * Return: void
193  */
194 typedef struct mlme_ext_ops *(*mlme_get_global_ops_cb)(void);
195 void mlme_set_ops_register_cb(mlme_get_global_ops_cb ops_cb);
196 
197 /**
198  * wlan_cmn_mlme_init - Initializes MLME component
199  *
200  * Registers callbacks with object manager for create/destroy
201  *
202  * Return: SUCCESS on successful registration
203  *         FAILURE, if registration fails
204  */
205 QDF_STATUS wlan_cmn_mlme_init(void);
206 
207 /**
208  * wlan_cmn_mlme_deinit - Uninitializes MLME component
209  *
210  * Unregisters callbacks with object manager for create/destroy
211  *
212  * Return: SUCCESS on successful registration
213  *         FAILURE, if registration fails
214  */
215 QDF_STATUS wlan_cmn_mlme_deinit(void);
216 #else
217 static inline QDF_STATUS wlan_cmn_mlme_init(void)
218 {
219 	return QDF_STATUS_SUCCESS;
220 }
221 
222 static inline QDF_STATUS wlan_cmn_mlme_deinit(void)
223 {
224 	return QDF_STATUS_SUCCESS;
225 }
226 #endif
227 
228 #endif
229