xref: /wlan-dirver/qca-wifi-host-cmn/umac/twt/dispatcher/inc/wlan_twt_api.h (revision 901120c066e139c7f8a2c8e4820561fdd83c67ef)
1 /*
2  * Copyright (c) 2022 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  * @psoc: psoc handle
70  *
71  * return: QDF_STATUS
72  */
73 QDF_STATUS wlan_twt_init(void);
74 
75 /**
76  * wlan_twt_deinit() - twt de-init
77  * @psoc: psoc handle
78  *
79  * return: QDF_STATUS
80  */
81 QDF_STATUS wlan_twt_deinit(void);
82 
83 /**
84  * wlan_twt_get_tx_ops() - get tx ops
85  * @psoc: psoc handle
86  *
87  * return: QDF_STATUS
88  */
89 struct wlan_lmac_if_twt_tx_ops *
90 wlan_twt_get_tx_ops(struct wlan_objmgr_psoc *psoc);
91 
92 /**
93  * wlan_twt_get_rx_ops() - get rx ops
94  * @psoc: psoc handle
95  *
96  * return: QDF_STATUS
97  */
98 struct wlan_lmac_if_twt_rx_ops *
99 wlan_twt_get_rx_ops(struct wlan_objmgr_psoc *psoc);
100 
101 /**
102  * wlan_twt_psoc_get_comp_private_obj() - get twt priv obj
103  * @psoc: psoc handle
104  *
105  * return: QDF_STATUS
106  */
107 struct twt_psoc_priv_obj*
108 wlan_twt_psoc_get_comp_private_obj(struct wlan_objmgr_psoc *psoc);
109 
110 /**
111  * wlan_set_peer_twt_capabilities() - set peer twt capabilities
112  * @psoc: psoc handle
113  * @peer_mac: peer mac address
114  * @peer_cap: TWT peer capability bitmap. Refer enum
115  * wlan_twt_capabilities for representation.
116  *
117  * return: QDF_STATUS
118  */
119 QDF_STATUS
120 wlan_set_peer_twt_capabilities(struct wlan_objmgr_psoc *psoc,
121 			       struct qdf_mac_addr *peer_mac,
122 			       uint8_t peer_cap);
123 
124 #else
125 static inline
126 QDF_STATUS twt_psoc_enable(struct wlan_objmgr_psoc *psoc)
127 {
128 	return QDF_STATUS_SUCCESS;
129 }
130 
131 static inline
132 QDF_STATUS twt_psoc_disable(struct wlan_objmgr_psoc *psoc)
133 {
134 	return QDF_STATUS_SUCCESS;
135 }
136 
137 static inline
138 QDF_STATUS wlan_twt_init(void)
139 {
140 	return QDF_STATUS_SUCCESS;
141 }
142 
143 static inline
144 QDF_STATUS wlan_twt_deinit(void)
145 {
146 	return QDF_STATUS_SUCCESS;
147 }
148 #endif
149 #endif /* _WLAN_TWT_API_H_ */
150