xref: /wlan-dirver/qca-wifi-host-cmn/umac/twt/dispatcher/inc/wlan_twt_api.h (revision 54ab05a36f58e470e5b322a774385b90ea47f785)
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 
29 #define twt_alert(params...) \
30 	QDF_TRACE_FATAL(QDF_MODULE_ID_TWT, params)
31 #define twt_err(params...) \
32 	QDF_TRACE_ERROR(QDF_MODULE_ID_TWT, params)
33 #define twt_warn(params...) \
34 	QDF_TRACE_WARN(QDF_MODULE_ID_TWT, params)
35 #define twt_notice(params...) \
36 	QDF_TRACE_INFO(QDF_MODULE_ID_TWT, params)
37 #define twt_debug(params...) \
38 	QDF_TRACE_DEBUG(QDF_MODULE_ID_TWT, params)
39 
40 #define twt_nofl_alert(params...) \
41 	QDF_TRACE_FATAL_NO_FL(QDF_MODULE_ID_TWT, params)
42 #define twt_nofl_err(params...) \
43 	QDF_TRACE_ERROR_NO_FL(QDF_MODULE_ID_TWT, params)
44 #define twt_nofl_warn(params...) \
45 	QDF_TRACE_WARN_NO_FL(QDF_MODULE_ID_TWT, params)
46 #define twt_nofl_notice(params...) \
47 	QDF_TRACE_INFO_NO_FL(QDF_MODULE_ID_TWT, params)
48 #define twt_nofl_debug(params...) \
49 	QDF_TRACE_DEBUG_NO_FL(QDF_MODULE_ID_TWT, params)
50 
51 /**
52  * twt_psoc_enable() - twt psoc enable
53  * @psoc: psoc handle
54  *
55  * return: QDF_STATUS
56  */
57 QDF_STATUS twt_psoc_enable(struct wlan_objmgr_psoc *psoc);
58 
59 /**
60  * twt_psoc_disable() - twt psoc disable
61  * @psoc: psoc handle
62  *
63  * return: QDF_STATUS
64  */
65 QDF_STATUS twt_psoc_disable(struct wlan_objmgr_psoc *psoc);
66 
67 /**
68  * wlan_twt_init() - twt init
69  *
70  * return: QDF_STATUS
71  */
72 QDF_STATUS wlan_twt_init(void);
73 
74 /**
75  * wlan_twt_deinit() - twt de-init
76  *
77  * return: QDF_STATUS
78  */
79 QDF_STATUS wlan_twt_deinit(void);
80 
81 /**
82  * wlan_twt_get_tx_ops() - get tx ops
83  * @psoc: psoc handle
84  *
85  * return: QDF_STATUS
86  */
87 struct wlan_lmac_if_twt_tx_ops *
88 wlan_twt_get_tx_ops(struct wlan_objmgr_psoc *psoc);
89 
90 /**
91  * wlan_twt_get_rx_ops() - get rx ops
92  * @psoc: psoc handle
93  *
94  * return: QDF_STATUS
95  */
96 struct wlan_lmac_if_twt_rx_ops *
97 wlan_twt_get_rx_ops(struct wlan_objmgr_psoc *psoc);
98 
99 /**
100  * wlan_twt_psoc_get_comp_private_obj() - get twt priv obj
101  * @psoc: psoc handle
102  *
103  * return: QDF_STATUS
104  */
105 struct twt_psoc_priv_obj*
106 wlan_twt_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc);
107 
108 /**
109  * wlan_set_peer_twt_capabilities() - set peer twt capabilities
110  * @psoc: psoc handle
111  * @peer_mac: peer mac address
112  * @peer_cap: TWT peer capability bitmap. Refer enum
113  * wlan_twt_capabilities for representation.
114  *
115  * return: QDF_STATUS
116  */
117 QDF_STATUS
118 wlan_set_peer_twt_capabilities(struct wlan_objmgr_psoc *psoc,
119 			       struct qdf_mac_addr *peer_mac,
120 			       uint8_t peer_cap);
121 
122 #else
123 static inline
124 QDF_STATUS twt_psoc_enable(struct wlan_objmgr_psoc *psoc)
125 {
126 	return QDF_STATUS_SUCCESS;
127 }
128 
129 static inline
130 QDF_STATUS twt_psoc_disable(struct wlan_objmgr_psoc *psoc)
131 {
132 	return QDF_STATUS_SUCCESS;
133 }
134 
135 static inline
136 QDF_STATUS wlan_twt_init(void)
137 {
138 	return QDF_STATUS_SUCCESS;
139 }
140 
141 static inline
142 QDF_STATUS wlan_twt_deinit(void)
143 {
144 	return QDF_STATUS_SUCCESS;
145 }
146 
147 static inline
148 QDF_STATUS wlan_set_peer_twt_capabilities(struct wlan_objmgr_psoc *psoc,
149 					  struct qdf_mac_addr *peer_mac,
150 					  uint8_t peer_cap)
151 {
152 	return QDF_STATUS_SUCCESS;
153 }
154 #endif
155 #endif /* _WLAN_TWT_API_H_ */
156