xref: /wlan-driver/qcacld-3.0/core/sme/inc/sme_power_save_api.h (revision 5113495b16420b49004c444715d2daae2066e7dc) !
1 /*
2  * Copyright (c) 2015-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 #if !defined(__SME_POWER_SAVE_API_H)
21 #define __SME_POWER_SAVE_API_H
22 
23 #include "sme_power_save.h"
24 #include "ani_global.h"
25 #include "sme_inside.h"
26 
27 QDF_STATUS sme_ps_enable_disable(mac_handle_t mac_handle, uint32_t session_id,
28 				 enum sme_ps_cmd command);
29 
30 QDF_STATUS sme_ps_timer_flush_sync(mac_handle_t mac_handle,
31 				   uint8_t session_id);
32 
33 QDF_STATUS sme_ps_uapsd_enable(mac_handle_t mac_handle, uint32_t session_id);
34 
35 QDF_STATUS sme_ps_uapsd_disable(mac_handle_t mac_handle, uint32_t session_id);
36 
37 QDF_STATUS sme_enable_sta_ps_check(struct mac_context *mac_ctx,
38 				   uint32_t session_id,
39 				   enum sme_ps_cmd command);
40 
41 QDF_STATUS sme_ps_process_command(struct mac_context *mac_ctx,
42 				  uint32_t session_id,
43 				  enum sme_ps_cmd command);
44 
45 /**
46  * sme_ps_set_powersave(): Set powersave state
47  * @mac_handle: Opaque handle to the global MAC context
48  * @vdev_id:    vdev Id
49  * @allow_power_save: allow powersave or not
50  * @timeout:    timeout period in ms
51  * @ap_supports_immediate_power_save: ap support immediate powersave
52  *
53  * Returns: QDF_STATUS
54  */
55 QDF_STATUS sme_ps_set_powersave(mac_handle_t mac_handle,
56 				uint8_t vdev_id, bool allow_power_save,
57 				uint32_t timeout,
58 				bool ap_supports_immediate_power_save);
59 
60 /**
61  * sme_ps_update(): Update current powersave state to target
62  * @mac_handle: Opaque handle to the global MAC context
63  * @vdev_id:    vdev Id
64  *
65  * Returns: QDF_STATUS
66  */
67 QDF_STATUS sme_ps_update(mac_handle_t mac_handle, uint32_t vdev_id);
68 
69 void sme_set_tspec_uapsd_mask_per_session(struct mac_context *mac_ctx,
70 					  struct mac_ts_info *ts_info,
71 					  uint8_t session_id);
72 
73 QDF_STATUS sme_ps_start_uapsd(mac_handle_t mac_handle, uint32_t session_id);
74 QDF_STATUS sme_set_ps_host_offload(mac_handle_t mac_handle,
75 				   struct sir_host_offload_req *request,
76 				   uint8_t session_id);
77 
78 #ifdef WLAN_NS_OFFLOAD
79 QDF_STATUS sme_set_ps_ns_offload(mac_handle_t mac_handle,
80 				 struct sir_host_offload_req *request,
81 				 uint8_t session_id);
82 
83 #endif /* WLAN_NS_OFFLOAD */
84 /* / Post a message to PE module */
85 QDF_STATUS sme_post_pe_message(struct mac_context *mac_ctx,
86 			       struct scheduler_msg *pMsg);
87 
88 /**
89  * sme_ps_enable_auto_ps_timer(): Enable power-save auto timer with timeout
90  * @mac_handle: Opaque handle to the global MAC context
91  * @session_id:    adapter session Id
92  * @timeout:       timeout period in ms
93  *
94  * Returns: QDF_STATUS
95  */
96 QDF_STATUS sme_ps_enable_auto_ps_timer(mac_handle_t mac_handle,
97 				       uint32_t sessionId, uint32_t timeout);
98 QDF_STATUS sme_ps_disable_auto_ps_timer(mac_handle_t mac_handle,
99 					uint32_t sessionId);
100 
101 QDF_STATUS sme_ps_open(mac_handle_t mac_handle);
102 
103 QDF_STATUS sme_ps_open_per_session(mac_handle_t mac_handle,
104 				   uint32_t session_id);
105 
106 void sme_auto_ps_entry_timer_expired(void *ps_param);
107 QDF_STATUS sme_ps_close(mac_handle_t mac_handle);
108 QDF_STATUS sme_ps_close_per_session(mac_handle_t mac_handle,
109 				    uint32_t session_id);
110 #endif /* #if !defined(__SME_POWER_SAVE_API_H) */
111 
112