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