1 /*
2 * Copyright (c) 2022-2023 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 * DOC: wlan_twt_api.h
20 */
21 #ifndef _WLAN_TWT_API_H_
22 #define _WLAN_TWT_API_H_
23
24 #if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
25 #include <wlan_objmgr_psoc_obj.h>
26 #include <wlan_objmgr_global_obj.h>
27 #include <wlan_lmac_if_def.h>
28 #include <wlan_twt_public_structs.h>
29
30 #define twt_alert(params...) \
31 QDF_TRACE_FATAL(QDF_MODULE_ID_TWT, params)
32 #define twt_err(params...) \
33 QDF_TRACE_ERROR(QDF_MODULE_ID_TWT, params)
34 #define twt_warn(params...) \
35 QDF_TRACE_WARN(QDF_MODULE_ID_TWT, params)
36 #define twt_notice(params...) \
37 QDF_TRACE_INFO(QDF_MODULE_ID_TWT, params)
38 #define twt_debug(params...) \
39 QDF_TRACE_DEBUG(QDF_MODULE_ID_TWT, params)
40
41 #define twt_nofl_alert(params...) \
42 QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_TWT, params)
43 #define twt_nofl_err(params...) \
44 QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_TWT, params)
45 #define twt_nofl_warn(params...) \
46 QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_TWT, params)
47 #define twt_nofl_notice(params...) \
48 QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_TWT, params)
49 #define twt_nofl_debug(params...) \
50 QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_TWT, params)
51
52 /**
53 * twt_psoc_enable() - twt psoc enable
54 * @psoc: psoc handle
55 *
56 * return: QDF_STATUS
57 */
58 QDF_STATUS twt_psoc_enable(struct wlan_objmgr_psoc *psoc);
59
60 /**
61 * twt_psoc_disable() - twt psoc disable
62 * @psoc: psoc handle
63 *
64 * return: QDF_STATUS
65 */
66 QDF_STATUS twt_psoc_disable(struct wlan_objmgr_psoc *psoc);
67
68 /**
69 * wlan_twt_init() - twt init
70 *
71 * return: QDF_STATUS
72 */
73 QDF_STATUS wlan_twt_init(void);
74
75 /**
76 * wlan_twt_deinit() - twt de-init
77 *
78 * return: QDF_STATUS
79 */
80 QDF_STATUS wlan_twt_deinit(void);
81
82 /**
83 * wlan_twt_get_tx_ops() - get tx ops
84 * @psoc: psoc handle
85 *
86 * return: QDF_STATUS
87 */
88 struct wlan_lmac_if_twt_tx_ops *
89 wlan_twt_get_tx_ops(struct wlan_objmgr_psoc *psoc);
90
91 /**
92 * wlan_twt_get_rx_ops() - get rx ops
93 * @psoc: psoc handle
94 *
95 * return: QDF_STATUS
96 */
97 struct wlan_lmac_if_twt_rx_ops *
98 wlan_twt_get_rx_ops(struct wlan_objmgr_psoc *psoc);
99
100 /**
101 * wlan_twt_psoc_get_comp_private_obj() - get twt priv obj
102 * @psoc: psoc handle
103 *
104 * return: QDF_STATUS
105 */
106 struct twt_psoc_priv_obj*
107 wlan_twt_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc);
108
109 /**
110 * wlan_set_peer_twt_capabilities() - set peer twt capabilities
111 * @psoc: psoc handle
112 * @peer_mac: peer mac address
113 * @peer_cap: TWT peer capability bitmap. Refer enum
114 * wlan_twt_capabilities for representation.
115 *
116 * return: QDF_STATUS
117 */
118 QDF_STATUS
119 wlan_set_peer_twt_capabilities(struct wlan_objmgr_psoc *psoc,
120 struct qdf_mac_addr *peer_mac,
121 uint8_t peer_cap);
122 /**
123 * wlan_twt_psoc_set_pmo_enable() - twt psoc set enable
124 * @psoc: psoc handle
125 * @reason: twt enable reason
126 *
127 * return: QDF_STATUS
128 */
129 QDF_STATUS
130 wlan_twt_psoc_set_pmo_enable(struct wlan_objmgr_psoc *psoc,
131 enum twt_disable_reason reason);
132 /**
133 * wlan_twt_psoc_set_pmo_disable() - twt psoc set disable
134 * @psoc: psoc handle
135 * @reason: twt disable reason
136 *
137 * return: QDF_STATUS
138 */
139 QDF_STATUS
140 wlan_twt_psoc_set_pmo_disable(struct wlan_objmgr_psoc *psoc,
141 enum twt_disable_reason reason);
142
143 #else
144 static inline
twt_psoc_enable(struct wlan_objmgr_psoc * psoc)145 QDF_STATUS twt_psoc_enable(struct wlan_objmgr_psoc *psoc)
146 {
147 return QDF_STATUS_SUCCESS;
148 }
149
150 static inline
twt_psoc_disable(struct wlan_objmgr_psoc * psoc)151 QDF_STATUS twt_psoc_disable(struct wlan_objmgr_psoc *psoc)
152 {
153 return QDF_STATUS_SUCCESS;
154 }
155
156 static inline
wlan_twt_init(void)157 QDF_STATUS wlan_twt_init(void)
158 {
159 return QDF_STATUS_SUCCESS;
160 }
161
162 static inline
wlan_twt_deinit(void)163 QDF_STATUS wlan_twt_deinit(void)
164 {
165 return QDF_STATUS_SUCCESS;
166 }
167
168 static inline
wlan_set_peer_twt_capabilities(struct wlan_objmgr_psoc * psoc,struct qdf_mac_addr * peer_mac,uint8_t peer_cap)169 QDF_STATUS wlan_set_peer_twt_capabilities(struct wlan_objmgr_psoc *psoc,
170 struct qdf_mac_addr *peer_mac,
171 uint8_t peer_cap)
172 {
173 return QDF_STATUS_SUCCESS;
174 }
175
176 QDF_STATUS
177 wlan_twt_psoc_set_pmo_enable(struct wlan_objmgr_psoc *psoc,
178 enum twt_disable_reason reason);
179
180 QDF_STATUS
181 wlan_twt_psoc_set_pmo_disable(struct wlan_objmgr_psoc *psoc,
182 enum twt_disable_reason reason);
183 #endif
184 #endif /* _WLAN_TWT_API_H_ */
185