xref: /wlan-driver/qcacld-3.0/os_if/twt/inc/osif_twt_ext_req.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 /**
20  * DOC: osif_twt_ext_req.h
21  *
22  * WLAN Host Device Driver file for TWT (Target Wake Time) support.
23  *
24  */
25 #ifndef _OSIF_TWT_EXT_REQ_H_
26 #define _OSIF_TWT_EXT_REQ_H_
27 
28 #include <wlan_objmgr_psoc_obj.h>
29 #include <wlan_twt_public_structs.h>
30 #include <qca_vendor.h>
31 #include <wlan_objmgr_peer_obj.h>
32 
33 #define TWT_WAKE_INTVL_MULTIPLICATION_FACTOR    1024
34 #define TWT_WAKE_DURATION_MULTIPLICATION_FACTOR 256
35 
36 #if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
37 /**
38  * osif_twt_setup_req() - Process TWT setup operation
39  * in the received vendor command and send it to firmware
40  * @vdev: vdev
41  * @twt_param_attr: nl attributes
42  *
43  * sets up TWT setup request from HDD. request is passed
44  * to TWT core
45  *
46  * Handles QCA_WLAN_TWT_SETUP
47  *
48  * Return: success on 0, failure on non-zero
49  */
50 int osif_twt_setup_req(struct wlan_objmgr_vdev *vdev,
51 		       struct nlattr *twt_param_attr);
52 
53 /**
54  * osif_twt_sta_teardown_req() - Process TWT sta teardown operation
55  * in the received vendor command and send it to firmware
56  * @vdev: vdev
57  * @twt_param_attr: nl attributes
58  *
59  * sets up TWT teardown request from HDD. request is passed
60  * to TWT core
61  *
62  * Handles QCA_WLAN_TWT_TEARDOWN
63  *
64  * Return: success on 0, failure on non-zero
65  */
66 int osif_twt_sta_teardown_req(struct wlan_objmgr_vdev *vdev,
67 			      struct nlattr *twt_param_attr);
68 
69 /**
70  * osif_twt_sap_teardown_req() - Process TWT sap teardown operation
71  * in the received vendor command and send it to firmware
72  * @vdev: vdev
73  * @twt_param_attr: nl attributes
74  *
75  * sets up TWT teardown request from HDD. request is passed
76  * to TWT core
77  *
78  * Handles QCA_WLAN_TWT_TEARDOWN
79  *
80  * Return: success on 0, failure on non-zero
81  */
82 int osif_twt_sap_teardown_req(struct wlan_objmgr_vdev *vdev,
83 			      struct nlattr *twt_param_attr);
84 
85 /**
86  * osif_twt_handle_renego_failure() - Handle twt renegotiation failure
87  * @psoc: pointer to psoc
88  * @add_dialog_event: event data
89  *
90  * Return: none
91  */
92 void
93 osif_twt_handle_renego_failure(struct wlan_objmgr_psoc *psoc,
94 		       struct twt_add_dialog_complete_event *add_dialog_event);
95 
96 /**
97  * osif_twt_pause_req() - Process TWT pause operation
98  * in the received vendor command and send it to firmware
99  * @vdev: vdev
100  * @twt_param_attr: nl attributes
101  *
102  * sets up TWT pause request from HDD. request is passed
103  * to TWT core
104  *
105  * Handles QCA_WLAN_TWT_SUSPEND
106  *
107  * Return: success on 0, failure on non-zero
108  */
109 int osif_twt_pause_req(struct wlan_objmgr_vdev *vdev,
110 		       struct nlattr *twt_param_attr);
111 
112 /**
113  * osif_twt_resume_req() - Process TWT resume operation
114  * in the received vendor command and send it to firmware
115  * @vdev: vdev
116  * @twt_param_attr: nl attributes
117  *
118  * sets up TWT resume request from HDD. request is passed
119  * to TWT core
120  *
121  * Handles QCA_WLAN_TWT_RESUME
122  *
123  * Return: success on 0, failure on non-zero
124  */
125 int osif_twt_resume_req(struct wlan_objmgr_vdev *vdev,
126 		       struct nlattr *twt_param_attr);
127 
128 /**
129  * osif_twt_nudge_req() - Process TWT nudge operation
130  * in the received vendor command and send it to firmware
131  * @vdev: vdev
132  * @twt_param_attr: nl attributes
133  *
134  * sets up TWT nudge request from HDD. request is passed
135  * to TWT core
136  *
137  * Handles QCA_WLAN_TWT_NUDGE
138  *
139  * Return: success on 0, failure on non-zero
140  */
141 int osif_twt_nudge_req(struct wlan_objmgr_vdev *vdev,
142 		       struct nlattr *twt_param_attr);
143 
144 /**
145  * osif_twt_get_capabilities() - Process TWT get capabilities
146  * in the received vendor command.
147  * @vdev: vdev
148  *
149  * Handles QCA_WLAN_TWT_GET_CAPABILITIES
150  *
151  * Return: 0 on success, negative value on failure
152  */
153 int osif_twt_get_capabilities(struct wlan_objmgr_vdev *vdev);
154 
155 /**
156  * osif_twt_send_get_capabilities_response  - TWT pack and send response to
157  * userspace for get capabilities command
158  * @psoc: pointer to global psoc
159  * @vdev: pointer to vdev
160  *
161  * Return: QDF_STATUS
162  */
163 QDF_STATUS
164 osif_twt_send_get_capabilities_response(struct wlan_objmgr_psoc *psoc,
165 					struct wlan_objmgr_vdev *vdev);
166 
167 /**
168  * osif_fill_peer_macaddr  - find peer from vdev and fill mac address
169  * @vdev: vdev pointer
170  * @mac_addr: output buffer to copy mac address
171  *
172  * This is the utility function, which finds peer bss info from the vdev
173  * and fill the output buffer with mac address
174  *
175  * Return: errno
176  */
177 int osif_fill_peer_macaddr(struct wlan_objmgr_vdev *vdev, uint8_t *mac_addr);
178 
179 /**
180  * osif_twt_get_session_req() - Extract get TWT NL attributes
181  * @vdev: vdev pointer
182  * @twt_param_attr: TWT NL attributes coming from the user space
183  *
184  * Return: errno
185  */
186 int osif_twt_get_session_req(struct wlan_objmgr_vdev *vdev,
187 			     struct nlattr *twt_param_attr);
188 
189 /**
190  * osif_twt_get_session_traffic_stats() - Extract traffic stats NL attributes
191  * @vdev: vdev pointer
192  * @twt_param_attr: TWT NL attributes coming from the user space
193  *
194  * Return: errno
195  */
196 int osif_twt_get_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
197 				       struct nlattr *twt_param_attr);
198 
199 /**
200  * osif_twt_get_stats_response() - Post get stats response to user space
201  * @vdev: vdev pointer
202  * @params: cp stats event params
203  * @num_session_stats: number of session stats
204  *
205  * Return: QDF_STATUS
206  */
207 QDF_STATUS osif_twt_get_stats_response(struct wlan_objmgr_vdev *vdev,
208 				       struct twt_infra_cp_stats_event *params,
209 				       uint32_t num_session_stats);
210 
211 int osif_twt_clear_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
212 					 struct nlattr *twt_param_attr);
213 
214 /**
215  * osif_twt_set_param() - pdev TWT param send
216  * @vdev: Pointer to vdev object
217  * @twt_param_attr: nlattr for TWT access category
218  *
219  * Return: QDF Status
220  */
221 int osif_twt_set_param(struct wlan_objmgr_vdev *vdev,
222 		       struct nlattr *twt_param_attr);
223 
224 /**
225  * __osif_twt_work_handler() - TWT work handler
226  * @vdev: vdev pointer
227  *
228  * Return: None
229  */
230 void __osif_twt_work_handler(struct wlan_objmgr_vdev *vdev);
231 
232 /**
233  * osif_twt_work_handler() - TWT work wrapper function
234  * @data: data pointer
235  *
236  * Return: None
237  */
238 void osif_twt_work_handler(void *data);
239 
240 /**
241  * osif_twt_create_work() - TWT create work
242  * @vdev: vdev pointer
243  *
244  * Return: QDF_STATUS
245  */
246 QDF_STATUS osif_twt_create_work(struct wlan_objmgr_vdev *vdev);
247 
248 /**
249  * osif_twt_destroy_work() - TWT destroy work
250  * @vdev: vdev pointer
251  *
252  * Return: QDF_STATUS
253  */
254 QDF_STATUS osif_twt_destroy_work(struct wlan_objmgr_vdev *vdev);
255 #else
256 static inline
osif_twt_setup_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)257 int osif_twt_setup_req(struct wlan_objmgr_vdev *vdev,
258 		       struct nlattr *twt_param_attr)
259 {
260 	return 0;
261 }
262 
263 static inline
osif_twt_get_capabilities(struct wlan_objmgr_vdev * vdev)264 int osif_twt_get_capabilities(struct wlan_objmgr_vdev *vdev)
265 {
266 	return 0;
267 }
268 
269 static inline
osif_twt_sta_teardown_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)270 int osif_twt_sta_teardown_req(struct wlan_objmgr_vdev *vdev,
271 			      struct nlattr *twt_param_attr)
272 {
273 	return 0;
274 }
275 
276 static inline
osif_twt_sap_teardown_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)277 int osif_twt_sap_teardown_req(struct wlan_objmgr_vdev *vdev,
278 			      struct nlattr *twt_param_attr)
279 {
280 	return 0;
281 }
282 
283 static inline
osif_twt_pause_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)284 int osif_twt_pause_req(struct wlan_objmgr_vdev *vdev,
285 		       struct nlattr *twt_param_attr)
286 {
287 	return 0;
288 }
289 
290 static inline
osif_twt_resume_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)291 int osif_twt_resume_req(struct wlan_objmgr_vdev *vdev,
292 		       struct nlattr *twt_param_attr)
293 {
294 	return 0;
295 }
296 
297 static inline
osif_twt_nudge_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)298 int osif_twt_nudge_req(struct wlan_objmgr_vdev *vdev,
299 		       struct nlattr *twt_param_attr)
300 {
301 	return 0;
302 }
303 
304 static inline
osif_twt_get_session_req(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)305 int osif_twt_get_session_req(struct wlan_objmgr_vdev *vdev,
306 			     struct nlattr *twt_param_attr)
307 {
308 	return 0;
309 }
310 
311 static inline
osif_twt_get_session_traffic_stats(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)312 int osif_twt_get_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
313 				       struct nlattr *twt_param_attr)
314 {
315 	return 0;
316 }
317 
318 static inline
osif_twt_clear_session_traffic_stats(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)319 int osif_twt_clear_session_traffic_stats(struct wlan_objmgr_vdev *vdev,
320 					 struct nlattr *twt_param_attr)
321 {
322 	return 0;
323 }
324 
325 static inline
osif_twt_set_param(struct wlan_objmgr_vdev * vdev,struct nlattr * twt_param_attr)326 int osif_twt_set_param(struct wlan_objmgr_vdev *vdev,
327 		       struct nlattr *twt_param_attr)
328 {
329 	return 0;
330 }
331 
332 static inline
__osif_twt_work_handler(struct wlan_objmgr_vdev * vdev)333 void __osif_twt_work_handler(struct wlan_objmgr_vdev *vdev)
334 {
335 }
336 
337 static inline
osif_twt_work_handler(void * data)338 void osif_twt_work_handler(void *data)
339 {
340 }
341 #endif
342 #endif /* _OSIF_TWT_EXT_REQ_H_ */
343 
344