xref: /wlan-driver/qcacld-3.0/components/mlme/dispatcher/inc/wlan_mlme_twt_ucfg_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2021, The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for any
6  * purpose with or without fee is hereby granted, provided that the above
7  * copyright notice and this permission notice appear in all copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
16  */
17 
18 /**
19  * DOC: declare UCFG APIs for TWT exposed by the mlme component
20  */
21 
22 #ifndef _WLAN_MLME_TWT_UCFG_API_H_
23 #define _WLAN_MLME_TWT_UCFG_API_H_
24 
25 #include <cfg_ucfg_api.h>
26 #include <wlan_mlme_public_struct.h>
27 #include <wlan_mlme_twt_public_struct.h>
28 #include <wlan_objmgr_psoc_obj.h>
29 #include <wlan_objmgr_global_obj.h>
30 #include <wlan_mlme_api.h>
31 #include <wlan_mlme_main.h>
32 #include <wlan_mlme_twt_api.h>
33 
34 #if defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) && \
35 	defined(WLAN_TWT_CONV_SUPPORTED)
36 static inline
ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)37 QDF_STATUS ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc *psoc,
38 				      struct qdf_mac_addr *peer_mac,
39 				      uint8_t dialog_id)
40 {
41 	return QDF_STATUS_E_NOSUPPORT;
42 }
43 
44 static inline bool
ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc * psoc)45 ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
46 {
47 	return QDF_STATUS_E_NOSUPPORT;
48 }
49 
50 static inline QDF_STATUS
ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc * psoc,bool * val)51 ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
52 			    bool *val)
53 {
54 	*val = false;
55 	return QDF_STATUS_E_NOSUPPORT;
56 }
57 
58 static inline QDF_STATUS
ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc * psoc,bool val)59 ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
60 			    bool val)
61 {
62 	return QDF_STATUS_E_NOSUPPORT;
63 }
64 
65 static inline QDF_STATUS
ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc * psoc,bool * val)66 ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
67 			    bool *val)
68 {
69 	*val = false;
70 	return QDF_STATUS_E_NOSUPPORT;
71 }
72 
73 static inline QDF_STATUS
ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc * psoc,bool val)74 ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
75 			    bool val)
76 {
77 	return QDF_STATUS_E_NOSUPPORT;
78 }
79 
80 static inline bool
ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)81 ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc *psoc,
82 			    struct qdf_mac_addr *peer_mac, uint8_t dialog_id)
83 {
84 	return 0;
85 }
86 
87 static inline void
ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,bool is_set)88 ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc *psoc,
89 			     struct qdf_mac_addr *peer_mac,
90 			     uint8_t dialog_id, bool is_set)
91 {}
92 
93 static inline
ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_session_state state)94 void ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc *psoc,
95 				     struct qdf_mac_addr *peer_mac,
96 				     uint8_t dialog_id,
97 				     enum wlan_twt_session_state state)
98 {}
99 
100 static inline enum wlan_twt_session_state
ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)101 ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc *psoc,
102 				struct qdf_mac_addr *peer_mac,
103 				uint8_t dialog_id)
104 {
105 	return WLAN_TWT_SETUP_STATE_NOT_ESTABLISHED;
106 }
107 
108 static inline QDF_STATUS
ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc * psoc,bool val)109 ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool val)
110 {
111 	return QDF_STATUS_E_NOSUPPORT;
112 }
113 
114 static inline QDF_STATUS
ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc * psoc,bool * val)115 ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool *val)
116 {
117 	*val = false;
118 	return QDF_STATUS_E_NOSUPPORT;
119 }
120 
121 static inline QDF_STATUS
ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)122 ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc *psoc,
123 			       struct qdf_mac_addr *peer_mac,
124 			       uint8_t dialog_id)
125 {
126 	return QDF_STATUS_E_NOSUPPORT;
127 }
128 
129 static inline QDF_STATUS
ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_commands cmd)130 ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
131 				      struct qdf_mac_addr *peer_mac,
132 				      uint8_t dialog_id,
133 				      enum wlan_twt_commands cmd)
134 {
135 	return QDF_STATUS_E_FAILURE;
136 }
137 
138 #elif defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX)
139 /**
140  * ucfg_mlme_get_twt_requestor() - Get twt requestor
141  * @psoc: pointer to psoc object
142  * @val:  Pointer to the value which will be filled for the caller
143  *
144  * Return: QDF Status
145  */
146 QDF_STATUS
147 ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
148 			    bool *val);
149 
150 /**
151  * ucfg_mlme_set_twt_requestor() - Set twt requestor
152  * @psoc: pointer to psoc object
153  * @val:  value that needs to set to this config
154  *
155  * Return: QDF Status
156  */
157 QDF_STATUS
158 ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
159 			    bool val);
160 
161 /**
162  * ucfg_mlme_get_twt_responder() - Get twt responder
163  * @psoc: pointer to psoc object
164  * @val:  Pointer to the value which will be filled for the caller
165  *
166  * Return: QDF Status
167  */
168 QDF_STATUS
169 ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
170 			    bool *val);
171 
172 /**
173  * ucfg_mlme_set_twt_responder() - Set twt responder
174  * @psoc: pointer to psoc object
175  * @val:  value that needs to set to this config
176  *
177  * Return: QDF Status
178  */
179 QDF_STATUS
180 ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
181 			    bool val);
182 
183 /**
184  * ucfg_mlme_get_twt_congestion_timeout() - Get twt congestion timeout
185  * @psoc: pointer to psoc object
186  * @val:  Pointer to the value which will be filled for the caller
187  *
188  * Return: QDF Status
189  */
190 QDF_STATUS
191 ucfg_mlme_get_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
192 				     uint32_t *val);
193 
194 /**
195  * ucfg_mlme_set_twt_congestion_timeout() - Set twt congestion timeout
196  * @psoc: pointer to psoc object
197  * @val:  value that needs to set to this config
198  *
199  * Return: QDF Status
200  */
201 QDF_STATUS
202 ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
203 				     uint32_t val);
204 
205 /**
206  * ucfg_mlme_is_twt_enabled() - Get global twt config support
207  * @psoc: pointer to psoc object
208  *
209  * Return: True if TWT is enabled else false.
210  */
211 static inline bool
ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc * psoc)212 ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
213 {
214 	return mlme_is_twt_enabled(psoc);
215 }
216 
217 /**
218  * ucfg_mlme_set_enable_twt() - Set global twt config support
219  * @psoc: pointer to psoc object
220  * @val:  value that needs to set to this config
221  *
222  * Return: QDF Status
223  */
224 QDF_STATUS
225 ucfg_mlme_set_enable_twt(struct wlan_objmgr_psoc *psoc,
226 			 bool val);
227 
228 /*
229  * ucfg_mlme_get_twt_bcast_requestor() - Get twt requestor enabled
230  * @psoc: pointer to psoc object
231  * @val:  Pointer to the value which will be filled for the caller
232  *
233  * Return: QDF Status
234  */
235 QDF_STATUS
236 ucfg_mlme_get_twt_bcast_requestor(struct wlan_objmgr_psoc *psoc,
237 				  bool *val);
238 
239 /**
240  * ucfg_mlme_get_twt_bcast_responder() - Get twt responder enabled
241  * @psoc: pointer to psoc object
242  * @val:  Pointer to the value which will be filled for the caller
243  *
244  * Return: QDF Status
245  */
246 QDF_STATUS
247 ucfg_mlme_get_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
248 				  bool *val);
249 /*
250  * 1. If both of the new service caps
251  * WMI_SERVICE_BROADCAST_TWT_REQUESTER And
252  * WMI_SERVICE_BROADCAST_TWT_RESPONDER are enabled then the old
253  * WMI_SERVICE_BROADCAST_TWT will be set to 1.
254  *
255  * 2.a. If any of the new service caps in case of new firmware:
256  * WMI_SERVICE_BROADCAST_TWT_REQUESTER And
257  * WMI_SERVICE_BROADCAST_TWT_RESPONDER is DISABLED then the old
258  * WMI_SERVICE_BROADCAST_TWT will be set to 0.
259  *
260  * 2.b In case of new firmware wants to disable broadcast TWT:
261  * all 3 WMI_SERVICE_BROADCAST_TWT_REQUESTER,
262  * WMI_SERVICE_BROADCAST_TWT_RESPONDER &
263  * WMI_SERVICE_BROADCAST_TWT will be disabled.
264  *
265  * 2.c IN case of old firmware:
266  * WMI_SERVICE_BROADCAST_TWT will be 1 and
267  * WMI_SERVICE_BROADCAST_TWT_REQUESTER,
268  * WMI_SERVICE_BROADCAST_TWT_RESPONDER will be 0.
269  *
270  * bcast_requestor_cfg/bcast_responder_cfg is intersection of
271  * "enable_twt", "twt_bcast_req_resp_config" ini and above target
272  * service cap combination.
273  */
274 
275 /**
276  * ucfg_mlme_set_twt_bcast_requestor() - Set Global twt bcast requestor support
277  * @psoc: pointer to psoc object
278  * @val:  Value to be set to config
279  *
280  * The caller of ucfg_mlme_set_twt_bcast_requestor() updates with the
281  * intersection of "enable_twt", "twt_bcast_req_resp_config" ini and the
282  * WMI_SERVICE_BROADCAST_TWT_REQUESTOR, WMI_SERVICE_BROADCAST_TWT
283  * combination.
284  *
285  * Return: QDF Status
286  */
287 QDF_STATUS
288 ucfg_mlme_set_twt_bcast_requestor(struct wlan_objmgr_psoc *psoc,
289 				  bool val);
290 
291 /**
292  * ucfg_mlme_set_twt_bcast_responder() - Set Global twt bcast responder support
293  * @psoc: pointer to psoc object
294  * @val:  Value to be set to config
295  *
296  * The caller of ucfg_mlme_set_twt_bcast_requestor() updates with the
297  * intersection of "enable_twt", "twt_bcast_req_resp_config" ini and the
298  * WMI_SERVICE_BROADCAST_TWT_RESPONDER, WMI_SERVICE_BROADCAST_TWT
299  * combination.
300  *
301  * Return: QDF Status
302  */
303 QDF_STATUS
304 ucfg_mlme_set_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
305 				  bool val);
306 
307 /**
308  * ucfg_mlme_set_twt_requestor_flag() - Set twt requestor flag
309  * @psoc: pointer to psoc object
310  * @val: Value to be set to config
311  *
312  * Return: QDF Status
313  */
314 QDF_STATUS ucfg_mlme_set_twt_requestor_flag(struct wlan_objmgr_psoc *psoc,
315 					    bool val);
316 
317 /**
318  * ucfg_mlme_set_twt_responder_flag() - Set twt responder flag
319  * @psoc: pointer to psoc object
320  * @val: Value to be set to config
321  *
322  * Return: QDF Status
323  */
324 QDF_STATUS ucfg_mlme_set_twt_responder_flag(struct wlan_objmgr_psoc *psoc,
325 					    bool val);
326 /**
327  * ucfg_mlme_set_twt_res_service_cap() - Set twt responder service capability
328  * @psoc: pointer to psoc object
329  * @val: Value to be set to config
330  *
331  * Return: QDF Status
332  */
333 QDF_STATUS
334 ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool val);
335 
336 /**
337  * ucfg_mlme_get_twt_res_service_cap() - Get twt responder service capability
338  * @psoc: pointer to psoc object
339  * @val: Value to be set to config
340  *
341  * Return: QDF Status
342  */
343 QDF_STATUS
344 ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool *val);
345 
346 /**
347  * ucfg_mlme_reset_twt_active_cmd() - Reset twt active cmd if ack fail
348  * This is to handle back to back command. If ack failed for active
349  * command then reset this command to allow new twt command.
350  * @psoc: pointer to psoc object
351  * @peer_mac: peer mac address
352  * @dialog_id: dialog id
353  *
354  * Return: QDF Status
355  */
356 QDF_STATUS ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc *psoc,
357 					  struct qdf_mac_addr *peer_mac,
358 					  uint8_t dialog_id);
359 
360 /**
361  * ucfg_mlme_is_twt_setup_in_progress() - Get TWT setup in progress for
362  * given dialog id
363  * @psoc: Pointer to global PSOC object
364  * @peer_mac: Global peer mac address
365  * @dialog_id: Dialog id
366  *
367  * Return: True if already the TWT setup is in progress
368  */
369 static inline bool
ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)370 ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
371 				   struct qdf_mac_addr *peer_mac,
372 				   uint8_t dialog_id)
373 {
374 	return mlme_is_twt_setup_in_progress(psoc, peer_mac, dialog_id);
375 }
376 
377 /**
378  * ucfg_mlme_is_max_twt_sessions_reached() - Check if the maximum number of
379  * TWT sessions reached or not excluding the given dialog_id
380  * @psoc: Pointer to global PSOC object
381  * @peer_mac: Global peer mac address
382  * @dialog_id: dialog id
383  *
384  * Check if the number of active TWT sessions is equal to the maximum number
385  * of TWT sessions supported. Only count the TWT session slot if it not
386  * TWT_ALL_SESSIONS_DIALOG_ID and dialog id is different from input dialog_id,
387  * because if same dialog_id already exists in the TWT sessions, we should
388  * return false since re-negotiation is supported on existing dialog_id.
389  *
390  * Return: True if slot is available for dialog_id, false otherwise
391  */
392 static inline bool
ucfg_mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)393 ucfg_mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc *psoc,
394 				      struct qdf_mac_addr *peer_mac,
395 				      uint8_t dialog_id)
396 {
397 	return mlme_is_max_twt_sessions_reached(psoc, peer_mac, dialog_id);
398 }
399 
400 /**
401  * ucfg_mlme_twt_is_command_in_progress() - Check if given command is in
402  * progress
403  * @psoc: Pointer to global PSOC object
404  * @peer_mac: Global peer mac address
405  * @dialog_id: TWT session dialog id
406  * @cmd: TWT command
407  * @active_cmd: Fill active command in this output parameter
408  *
409  * Return: True if given command is in progress
410  */
411 static inline bool
ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_commands cmd,enum wlan_twt_commands * active_cmd)412 ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
413 				     struct qdf_mac_addr *peer_mac,
414 				     uint8_t dialog_id,
415 				     enum wlan_twt_commands cmd,
416 				     enum wlan_twt_commands *active_cmd)
417 {
418 	return mlme_twt_is_command_in_progress(psoc, peer_mac, dialog_id,
419 					       cmd, active_cmd);
420 }
421 
422 static inline QDF_STATUS
ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_commands cmd)423 ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
424 				      struct qdf_mac_addr *peer_mac,
425 				      uint8_t dialog_id,
426 				      enum wlan_twt_commands cmd)
427 {
428 	return mlme_set_twt_command_in_progress(psoc, peer_mac, dialog_id, cmd);
429 }
430 
431 /**
432  * ucfg_mlme_set_twt_setup_done() - Set TWT setup done flag
433  * @psoc: Pointer to global PSOC object
434  * @peer_mac: Global peer mac address
435  * @dialog_id: TWT session dialog id
436  * @is_set: true if setup done flag needs to be set
437  *
438  * Return: None
439  */
440 static inline void
ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,bool is_set)441 ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc *psoc,
442 			     struct qdf_mac_addr *peer_mac,
443 			     uint8_t dialog_id, bool is_set)
444 {
445 	mlme_set_twt_setup_done(psoc, peer_mac, dialog_id, is_set);
446 }
447 
448 /**
449  * ucfg_mlme_is_twt_setup_done() - Get if the TWT setup for given dialog id
450  * is complete.
451  * @psoc: Pointer to global psoc object
452  * @peer_mac:  Pointer to peer mac address
453  * @dialog_id: TWT session dialog id
454  *
455  * Return: True if TWT setup is successful for the dialog id
456  */
457 static inline bool
ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)458 ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc *psoc,
459 			    struct qdf_mac_addr *peer_mac, uint8_t dialog_id)
460 {
461 	return mlme_is_twt_setup_done(psoc, peer_mac, dialog_id);
462 }
463 
464 /**
465  * ucfg_mlme_is_flexible_twt_enabled() - Get if flexible TWT is enabled
466  * @psoc: Pointer to global psoc object
467  *
468  * Return: True if flexible TWT is supported
469  */
470 static inline
ucfg_mlme_is_flexible_twt_enabled(struct wlan_objmgr_psoc * psoc)471 bool ucfg_mlme_is_flexible_twt_enabled(struct wlan_objmgr_psoc *psoc)
472 {
473 	return mlme_is_flexible_twt_enabled(psoc);
474 }
475 
476 /**
477  * ucfg_mlme_get_twt_peer_capabilities() - Get peer capabilities
478  * @psoc: Pointer to global psoc object
479  * @peer_mac: Pointer to peer mac address
480  *
481  * Return: Peer capabilities bitmap
482  */
483 static inline
ucfg_mlme_get_twt_peer_capabilities(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac)484 uint8_t ucfg_mlme_get_twt_peer_capabilities(struct wlan_objmgr_psoc *psoc,
485 					    struct qdf_mac_addr *peer_mac)
486 {
487 	return mlme_get_twt_peer_capabilities(psoc, peer_mac);
488 }
489 
490 /**
491  * ucfg_mlme_get_twt_peer_bcast_capabilities() - Get peer broadcast capabilities
492  * @psoc: Pointer to global psoc object
493  * @peer_mac: Pointer to peer mac address
494  *
495  * Return: Return True if peer responder capabilities support else False
496  */
497 bool ucfg_mlme_get_twt_peer_bcast_capabilities(struct wlan_objmgr_psoc *psoc,
498 					       struct qdf_mac_addr *peer_mac);
499 
500 /**
501  * ucfg_mlme_get_twt_peer_responder_capabilities() - Get peer responder
502  * capabilities
503  * @psoc: Pointer to global psoc object
504  * @peer_mac: Pointer to peer mac address
505  *
506  * Return: Return True if peer responder capabilities support else False
507  */
508 bool ucfg_mlme_get_twt_peer_responder_capabilities(
509 						struct wlan_objmgr_psoc *psoc,
510 						struct qdf_mac_addr *peer_mac);
511 
512 /**
513  * ucfg_mlme_init_twt_context() - Initialize TWT context
514  * @psoc: Pointer to global psoc object
515  * @peer_mac: Pointer to peer mac address
516  * @dialog_id: Dialog id
517  *
518  * Return: QDF_STATUS
519  */
520 static inline
ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)521 QDF_STATUS ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc *psoc,
522 				      struct qdf_mac_addr *peer_mac,
523 				      uint8_t dialog_id)
524 {
525 	return mlme_init_twt_context(psoc, peer_mac, dialog_id);
526 }
527 
528 /**
529  * ucfg_mlme_is_24ghz_twt_enabled() - Get if host triggered TWT is enabled on
530  * 2.4Ghz band.
531  * @psoc: Pointer to global psoc object
532  *
533  * Return: True if host TWT is enabled on 2.4 Ghz band.
534  */
535 static inline bool
ucfg_mlme_is_24ghz_twt_enabled(struct wlan_objmgr_psoc * psoc)536 ucfg_mlme_is_24ghz_twt_enabled(struct wlan_objmgr_psoc *psoc)
537 {
538 	return mlme_is_24ghz_twt_enabled(psoc);
539 }
540 
541 /**
542  * ucfg_mlme_set_twt_nudge_tgt_cap() - Set TWT nudge target capability.
543  * @psoc: Pointer to global psoc object
544  * @val: Value to set
545  *
546  * Return: QDF_STATUS
547  */
548 QDF_STATUS
549 ucfg_mlme_set_twt_nudge_tgt_cap(struct wlan_objmgr_psoc *psoc, bool val);
550 
551 /**
552  * ucfg_mlme_get_twt_nudge_tgt_cap() - Get TWT Nudge target capability
553  * @psoc: Pointer to global psoc object
554  * @val: Value to set
555  *
556  * Return: QDF_STATUS
557  */
558 QDF_STATUS
559 ucfg_mlme_get_twt_nudge_tgt_cap(struct wlan_objmgr_psoc *psoc, bool *val);
560 
561 /**
562  * ucfg_mlme_set_twt_all_twt_tgt_cap() - Set TWT all dialog support target
563  * @psoc: Pointer to global psoc object
564  * @val: Value to set
565  *
566  * Return: QDF_STATUS
567  */
568 QDF_STATUS
569 ucfg_mlme_set_twt_all_twt_tgt_cap(struct wlan_objmgr_psoc *psoc, bool val);
570 
571 /**
572  * ucfg_mlme_get_twt_all_twt_tgt_cap()  - Get TWT all dialog support target
573  * capability
574  * @psoc: Pointer to global psoc object
575  * @val: Value to set
576  *
577  * Return: QDF_STATUS
578  */
579 QDF_STATUS
580 ucfg_mlme_get_twt_all_twt_tgt_cap(struct wlan_objmgr_psoc *psoc, bool *val);
581 
582 /**
583  * ucfg_mlme_set_twt_statistics_tgt_cap()  - Set TWT statistics target
584  * capability
585  * @psoc: Pointer to global psoc object
586  * @val: Value to set
587  *
588  * Return: QDF_STATUS
589  */
590 QDF_STATUS
591 ucfg_mlme_set_twt_statistics_tgt_cap(struct wlan_objmgr_psoc *psoc, bool val);
592 
593 /**
594  * ucfg_mlme_get_twt_statistics_tgt_cap() - Get TWT statistics target capability
595  * @psoc: Pointer to global psoc object
596  * @val: Value to set
597  *
598  * Return: QDF_STATUS
599  */
600 QDF_STATUS
601 ucfg_mlme_get_twt_statistics_tgt_cap(struct wlan_objmgr_psoc *psoc, bool *val);
602 
603 /**
604  * ucfg_mlme_set_twt_session_state()  - Set TWT session state
605  * @psoc: Pointer to global psoc object
606  * @peer_mac:  Pointer to peer mac address
607  * @dialog_id: TWT session dialog id
608  * @state: TWT state
609  *
610  * Return: None
611  */
612 static inline
ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_session_state state)613 void ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc *psoc,
614 				     struct qdf_mac_addr *peer_mac,
615 				     uint8_t dialog_id,
616 				     enum wlan_twt_session_state state)
617 {
618 	mlme_set_twt_session_state(psoc, peer_mac, dialog_id, state);
619 }
620 
621 /**
622  * ucfg_mlme_get_twt_session_state()  - Get TWT session state
623  * @psoc: Pointer to global psoc object
624  * @peer_mac:  Pointer to peer mac address
625  * @dialog_id: TWT session dialog id
626  *
627  * Return: enum wlan_twt_session_state
628  */
629 static inline enum wlan_twt_session_state
ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)630 ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc *psoc,
631 				struct qdf_mac_addr *peer_mac,
632 				uint8_t dialog_id)
633 {
634 	return mlme_get_twt_session_state(psoc, peer_mac, dialog_id);
635 }
636 #else
637 static inline QDF_STATUS
ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc * psoc,bool * val)638 ucfg_mlme_get_twt_requestor(struct wlan_objmgr_psoc *psoc,
639 			    bool *val)
640 {
641 	*val = false;
642 	return QDF_STATUS_E_NOSUPPORT;
643 }
644 
645 static inline QDF_STATUS
ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc * psoc,bool val)646 ucfg_mlme_set_twt_requestor(struct wlan_objmgr_psoc *psoc,
647 			    bool val)
648 {
649 	return QDF_STATUS_E_NOSUPPORT;
650 }
651 
652 static inline QDF_STATUS
ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc * psoc,bool * val)653 ucfg_mlme_get_twt_responder(struct wlan_objmgr_psoc *psoc,
654 			    bool *val)
655 {
656 	*val = false;
657 	return QDF_STATUS_E_NOSUPPORT;
658 }
659 
660 static inline QDF_STATUS
ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc * psoc,bool val)661 ucfg_mlme_set_twt_responder(struct wlan_objmgr_psoc *psoc,
662 			    bool val)
663 {
664 	return QDF_STATUS_E_NOSUPPORT;
665 }
666 
667 static inline QDF_STATUS
ucfg_mlme_get_twt_congestion_timeout(struct wlan_objmgr_psoc * psoc,uint32_t * val)668 ucfg_mlme_get_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
669 				     uint32_t *val)
670 {
671 	*val = 0;
672 	return QDF_STATUS_E_NOSUPPORT;
673 }
674 
675 static inline QDF_STATUS
ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc * psoc,uint32_t val)676 ucfg_mlme_set_twt_congestion_timeout(struct wlan_objmgr_psoc *psoc,
677 				     uint32_t val)
678 {
679 	return QDF_STATUS_E_NOSUPPORT;
680 }
681 
682 static inline bool
ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc * psoc)683 ucfg_mlme_is_twt_enabled(struct wlan_objmgr_psoc *psoc)
684 {
685 	return QDF_STATUS_E_NOSUPPORT;
686 }
687 
688 static inline QDF_STATUS
ucfg_mlme_set_enable_twt(struct wlan_objmgr_psoc * psoc,bool val)689 ucfg_mlme_set_enable_twt(struct wlan_objmgr_psoc *psoc,
690 			 bool val)
691 {
692 	return QDF_STATUS_E_NOSUPPORT;
693 }
694 
695 static inline bool
ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)696 ucfg_mlme_is_twt_setup_done(struct wlan_objmgr_psoc *psoc,
697 			    struct qdf_mac_addr *peer_mac, uint8_t dialog_id)
698 {
699 	return 0;
700 }
701 
702 static inline void
ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,bool is_set)703 ucfg_mlme_set_twt_setup_done(struct wlan_objmgr_psoc *psoc,
704 			     struct qdf_mac_addr *peer_mac,
705 			     uint8_t dialog_id, bool is_set)
706 {}
707 
708 static inline bool
ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)709 ucfg_mlme_is_twt_setup_in_progress(struct wlan_objmgr_psoc *psoc,
710 				   struct qdf_mac_addr *peer_mac,
711 				   uint8_t dialog_id)
712 {
713 	return false;
714 }
715 
716 static inline bool
ucfg_mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)717 ucfg_mlme_is_max_twt_sessions_reached(struct wlan_objmgr_psoc *psoc,
718 				      struct qdf_mac_addr *peer_mac,
719 				      uint8_t dialog_id)
720 {
721 	return false;
722 }
723 
724 static inline QDF_STATUS
ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_commands cmd)725 ucfg_mlme_set_twt_command_in_progress(struct wlan_objmgr_psoc *psoc,
726 				      struct qdf_mac_addr *peer_mac,
727 				      uint8_t dialog_id,
728 				      enum wlan_twt_commands cmd)
729 {
730 	return QDF_STATUS_E_FAILURE;
731 }
732 
733 static inline bool
ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_commands cmd,enum wlan_twt_commands * active_cmd)734 ucfg_mlme_twt_is_command_in_progress(struct wlan_objmgr_psoc *psoc,
735 				     struct qdf_mac_addr *peer_mac,
736 				     uint8_t dialog_id,
737 				     enum wlan_twt_commands cmd,
738 				     enum wlan_twt_commands *active_cmd)
739 {
740 	return false;
741 }
742 
743 static inline QDF_STATUS
ucfg_mlme_get_twt_bcast_requestor(struct wlan_objmgr_psoc * psoc,bool * val)744 ucfg_mlme_get_twt_bcast_requestor(struct wlan_objmgr_psoc *psoc,
745 				  bool *val)
746 {
747 	*val = false;
748 	return QDF_STATUS_E_NOSUPPORT;
749 }
750 
751 static inline QDF_STATUS
ucfg_mlme_set_twt_bcast_requestor(struct wlan_objmgr_psoc * psoc,bool val)752 ucfg_mlme_set_twt_bcast_requestor(struct wlan_objmgr_psoc *psoc,
753 				  bool val)
754 {
755 	return QDF_STATUS_E_NOSUPPORT;
756 }
757 
758 static inline QDF_STATUS
ucfg_mlme_get_twt_bcast_responder(struct wlan_objmgr_psoc * psoc,bool * val)759 ucfg_mlme_get_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
760 				  bool *val)
761 {
762 	*val = false;
763 	return QDF_STATUS_E_NOSUPPORT;
764 }
765 
766 static inline QDF_STATUS
ucfg_mlme_set_twt_bcast_responder(struct wlan_objmgr_psoc * psoc,bool val)767 ucfg_mlme_set_twt_bcast_responder(struct wlan_objmgr_psoc *psoc,
768 				  bool val)
769 {
770 	return QDF_STATUS_E_NOSUPPORT;
771 }
772 
773 static inline QDF_STATUS
ucfg_mlme_set_twt_requestor_flag(struct wlan_objmgr_psoc * psoc,bool val)774 ucfg_mlme_set_twt_requestor_flag(struct wlan_objmgr_psoc *psoc,
775 				 bool val)
776 {
777 	return QDF_STATUS_E_NOSUPPORT;
778 }
779 
780 static inline QDF_STATUS
ucfg_mlme_set_twt_responder_flag(struct wlan_objmgr_psoc * psoc,bool val)781 ucfg_mlme_set_twt_responder_flag(struct wlan_objmgr_psoc *psoc,
782 				 bool val)
783 {
784 	return QDF_STATUS_E_NOSUPPORT;
785 }
786 
787 static inline
ucfg_mlme_is_flexible_twt_enabled(struct wlan_objmgr_psoc * psoc)788 bool ucfg_mlme_is_flexible_twt_enabled(struct wlan_objmgr_psoc *psoc)
789 {
790 	return false;
791 }
792 
793 static inline
ucfg_mlme_get_twt_peer_capabilities(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac)794 uint8_t ucfg_mlme_get_twt_peer_capabilities(struct wlan_objmgr_psoc *psoc,
795 					    struct qdf_mac_addr *peer_mac)
796 {
797 	return 0;
798 }
799 
800 static inline
ucfg_mlme_get_twt_peer_bcast_capabilities(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac)801 bool ucfg_mlme_get_twt_peer_bcast_capabilities(struct wlan_objmgr_psoc *psoc,
802 					       struct qdf_mac_addr *peer_mac)
803 {
804 	return false;
805 }
806 
807 static inline
ucfg_mlme_get_twt_peer_responder_capabilities(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac)808 bool ucfg_mlme_get_twt_peer_responder_capabilities(
809 						struct wlan_objmgr_psoc *psoc,
810 						struct qdf_mac_addr *peer_mac)
811 {
812 	return false;
813 }
814 
815 static inline
ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)816 QDF_STATUS ucfg_mlme_init_twt_context(struct wlan_objmgr_psoc *psoc,
817 				      struct qdf_mac_addr *peer_mac,
818 				      uint8_t dialog_id)
819 {
820 	return QDF_STATUS_E_NOSUPPORT;
821 }
822 
823 static inline bool
ucfg_mlme_is_24ghz_twt_enabled(struct wlan_objmgr_psoc * psoc)824 ucfg_mlme_is_24ghz_twt_enabled(struct wlan_objmgr_psoc *psoc)
825 {
826 	return false;
827 }
828 
829 static inline QDF_STATUS
ucfg_mlme_get_twt_nudge_tgt_cap(struct wlan_objmgr_psoc * psoc,bool * val)830 ucfg_mlme_get_twt_nudge_tgt_cap(struct wlan_objmgr_psoc *psoc, bool *val)
831 {
832 	*val = false;
833 	return QDF_STATUS_E_NOSUPPORT;
834 }
835 
836 static inline QDF_STATUS
ucfg_mlme_get_twt_all_twt_tgt_cap(struct wlan_objmgr_psoc * psoc,bool * val)837 ucfg_mlme_get_twt_all_twt_tgt_cap(struct wlan_objmgr_psoc *psoc, bool *val)
838 {
839 	*val = false;
840 	return QDF_STATUS_E_NOSUPPORT;
841 }
842 
843 static inline QDF_STATUS
ucfg_mlme_get_twt_statistics_tgt_cap(struct wlan_objmgr_psoc * psoc,bool * val)844 ucfg_mlme_get_twt_statistics_tgt_cap(struct wlan_objmgr_psoc *psoc, bool *val)
845 {
846 	*val = false;
847 	return QDF_STATUS_E_NOSUPPORT;
848 }
849 
850 static inline QDF_STATUS
ucfg_mlme_set_twt_nudge_tgt_cap(struct wlan_objmgr_psoc * psoc,bool val)851 ucfg_mlme_set_twt_nudge_tgt_cap(struct wlan_objmgr_psoc *psoc, bool val)
852 {
853 	return QDF_STATUS_E_NOSUPPORT;
854 }
855 
856 static inline QDF_STATUS
ucfg_mlme_set_twt_all_twt_tgt_cap(struct wlan_objmgr_psoc * psoc,bool val)857 ucfg_mlme_set_twt_all_twt_tgt_cap(struct wlan_objmgr_psoc *psoc, bool val)
858 {
859 	return QDF_STATUS_E_NOSUPPORT;
860 }
861 
862 static inline QDF_STATUS
ucfg_mlme_set_twt_statistics_tgt_cap(struct wlan_objmgr_psoc * psoc,bool val)863 ucfg_mlme_set_twt_statistics_tgt_cap(struct wlan_objmgr_psoc *psoc, bool val)
864 {
865 	return QDF_STATUS_E_NOSUPPORT;
866 }
867 
868 static inline
ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id,enum wlan_twt_session_state state)869 void ucfg_mlme_set_twt_session_state(struct wlan_objmgr_psoc *psoc,
870 				     struct qdf_mac_addr *peer_mac,
871 				     uint8_t dialog_id,
872 				     enum wlan_twt_session_state state)
873 {}
874 
875 static inline enum wlan_twt_session_state
ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)876 ucfg_mlme_get_twt_session_state(struct wlan_objmgr_psoc *psoc,
877 				struct qdf_mac_addr *peer_mac,
878 				uint8_t dialog_id)
879 {
880 	return WLAN_TWT_SETUP_STATE_NOT_ESTABLISHED;
881 }
882 
883 static inline QDF_STATUS
ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc * psoc,bool val)884 ucfg_mlme_set_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool val)
885 {
886 	return QDF_STATUS_E_NOSUPPORT;
887 }
888 
889 static inline QDF_STATUS
ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc * psoc,bool * val)890 ucfg_mlme_get_twt_res_service_cap(struct wlan_objmgr_psoc *psoc, bool *val)
891 {
892 	*val = false;
893 	return QDF_STATUS_E_NOSUPPORT;
894 }
895 
896 static inline QDF_STATUS
ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t dialog_id)897 ucfg_mlme_reset_twt_active_cmd(struct wlan_objmgr_psoc *psoc,
898 			       struct qdf_mac_addr *peer_mac,
899 			       uint8_t dialog_id)
900 {
901 	return QDF_STATUS_E_NOSUPPORT;
902 }
903 
904 #endif /* defined(WLAN_SUPPORT_TWT) && defined(WLAN_FEATURE_11AX) */
905 #endif /* _WLAN_MLME_TWT_UCFG_API_H_ */
906