xref: /wlan-driver/qcacld-3.0/components/umac/twt/dispatcher/inc/cfg_twt.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
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 /**
20  * DOC: This file contains TWT config related definitions
21  */
22 
23 #ifndef __CFG_TWT_H_
24 #define __CFG_TWT_H_
25 
26 #if defined(WLAN_SUPPORT_TWT) && defined(WLAN_TWT_CONV_SUPPORTED)
27 /*
28  * <ini>
29  * twt_requestor - twt requestor.
30  * @Min: 0
31  * @Max: 1
32  * @Default: 1
33  *
34  * This cfg is used to store twt requestor config.
35  *
36  * Related: NA
37  *
38  * Supported Feature: 11AX
39  *
40  * Usage: Internal
41  *
42  * </ini>
43  */
44 #define CFG_TWT_REQUESTOR CFG_INI_BOOL( \
45 		"twt_requestor", \
46 		1, \
47 		"TWT requestor")
48 /*
49  * <ini>
50  * twt_responder - twt responder.
51  * @Min: 0
52  * @Max: 1
53  * @Default: false
54  *
55  * This cfg is used to store twt responder config.
56  *
57  * Related: NA
58  *
59  * Supported Feature: 11AX
60  *
61  * Usage: Internal
62  *
63  * </ini>
64  */
65 #define CFG_TWT_RESPONDER CFG_INI_BOOL( \
66 		"twt_responder", \
67 		false, \
68 		"TWT responder")
69 
70 /*
71  * <ini>
72  * enable_twt - Enable Target Wake Time support.
73  * @Min: 0
74  * @Max: 1
75  * @Default: 1
76  *
77  * This ini is used to enable or disable TWT support.
78  *
79  * Related: NA
80  *
81  * Supported Feature: 11AX
82  *
83  * Usage: External
84  *
85  * </ini>
86  */
87 #define CFG_ENABLE_TWT CFG_INI_BOOL( \
88 		"enable_twt", \
89 		1, \
90 		"TWT support")
91 
92 /*
93  * <ini>
94  * twt_congestion_timeout - Target wake time congestion timeout.
95  * @Min: 0
96  * @Max: 10000
97  * @Default: 100
98  *
99  * STA uses this timer to continuously monitor channel congestion levels to
100  * decide whether to start or stop TWT. This ini is used to configure the
101  * target wake time congestion timeout value in the units of milliseconds.
102  * A value of Zero indicates that this is a host triggered TWT and all the
103  * necessary configuration for TWT will be directed from the host.
104  *
105  * Related: NA
106  *
107  * Supported Feature: 11AX
108  *
109  * Usage: External
110  *
111  * </ini>
112  */
113 #define CFG_TWT_CONGESTION_TIMEOUT CFG_INI_UINT( \
114 		"twt_congestion_timeout", \
115 		0, \
116 		10000, \
117 		100, \
118 		CFG_VALUE_OR_DEFAULT, \
119 		"twt congestion timeout")
120 /*
121  * <ini>
122  * twt_bcast_req_resp_config - To enable broadcast twt requestor and responder.
123  * @Min: 0 Disable the extended twt capability
124  * @Max: 3
125  * @Default: 1
126  *
127  * This cfg is used to configure the broadcast TWT requestor and responder.
128  * Bitmap for enabling the broadcast twt requestor and responder.
129  * BIT 0: Enable/Disable broadcast twt requestor.
130  * BIT 1: Enable/Disable broadcast twt responder.
131  * BIT 2-31: Reserved
132  *
133  * Related: CFG_ENABLE_TWT
134  * Related: CFG_TWT_RESPONDER
135  * Related: CFG_TWT_REQUESTOR
136  *
137  * Supported Feature: 11AX
138  *
139  * Usage: External
140  *
141  * </ini>
142  */
143 /* defines to extract the requestor/responder capabilities from cfg */
144 #define TWT_BCAST_REQ_INDEX    0
145 #define TWT_BCAST_REQ_BITS     1
146 #define TWT_BCAST_RES_INDEX    1
147 #define TWT_BCAST_RES_BITS     1
148 
149 #define CFG_BCAST_TWT_REQ_RESP CFG_INI_UINT( \
150 		"twt_bcast_req_resp_config", \
151 		0, \
152 		3, \
153 		1, \
154 		CFG_VALUE_OR_DEFAULT, \
155 		"BROADCAST TWT CAPABILITY")
156 
157 #define CFG_TWT_GET_BCAST_REQ(_bcast_conf) \
158 	QDF_GET_BITS(_bcast_conf, \
159 		     TWT_BCAST_REQ_INDEX, \
160 		     TWT_BCAST_REQ_BITS)
161 
162 #define CFG_TWT_GET_BCAST_RES(_bcast_conf) \
163 	QDF_GET_BITS(_bcast_conf, \
164 		     TWT_BCAST_RES_INDEX, \
165 		     TWT_BCAST_RES_BITS)
166 
167 /*
168  * <ini>
169  * rtwt_req_resp_config - To enable restricted twt requestor and responder.
170  * @Min: 0 Disable the extended twt capability
171  * @Max: 3
172  * @Default: 0
173  *
174  * This cfg is used to configure the restricted TWT requestor and responder.
175  * Bitmap for enabling the restricted twt requestor and responder.
176  * BIT 0: Enable/Disable restricted twt requestor.
177  * BIT 1: Enable/Disable restricted twt responder.
178  * BIT 2-31: Reserved
179  *
180  * Related: CFG_ENABLE_TWT
181  * Related: CFG_TWT_RESPONDER
182  * Related: CFG_TWT_REQUESTOR
183  *
184  * Supported Feature: 11AX
185  *
186  * Usage: External
187  *
188  * </ini>
189  */
190 /* defines to extract the requestor/responder capabilities from cfg */
191 #define RTWT_REQ_INDEX    0
192 #define RTWT_REQ_BITS     1
193 #define RTWT_RES_INDEX    1
194 #define RTWT_RES_BITS     1
195 
196 #define CFG_RTWT_REQ_RESP CFG_INI_UINT( \
197 		"rtwt_req_resp_config", \
198 		0, \
199 		3, \
200 		0, \
201 		CFG_VALUE_OR_DEFAULT, \
202 		"RESTRICTED TWT CAPABILITY")
203 
204 #define CFG_GET_RTWT_REQ(_rtwt_conf) \
205 	QDF_GET_BITS(_rtwt_conf, \
206 		     RTWT_REQ_INDEX, \
207 		     RTWT_REQ_BITS)
208 
209 #define CFG_GET_RTWT_RES(_rtwt_conf) \
210 	QDF_GET_BITS(_rtwt_conf, \
211 		     RTWT_RES_INDEX, \
212 		     RTWT_RES_BITS)
213 
214 /*
215  * <ini>
216  * enable_twt_24ghz - Enable Target wake time when STA is connected on 2.4Ghz
217  * band.
218  * @Min: 0
219  * @Max: 1
220  * @Default: 1
221  *
222  * This ini is used to enable/disable the host TWT when STA is connected to AP
223  * in 2.4Ghz band.
224  *
225  * Related: NA
226  *
227  * Supported Feature: 11AX
228  *
229  * Usage: External
230  *
231  * </ini>
232  */
233 #define CFG_ENABLE_TWT_24GHZ CFG_INI_BOOL( \
234 		"enable_twt_24ghz", \
235 		true, \
236 		"enable twt in 2.4Ghz band")
237 /*
238  * <ini>
239  * twt_disable_info - Enable/Disable TWT info frame.
240  * @Min: 0
241  * @Max: 1
242  * @Default: 0
243  *
244  * This ini is used to enable/disable TWT Info frame
245  *
246  * Related: NA
247  *
248  * Supported Feature: 11AX
249  *
250  * Usage: External
251  *
252  * </ini>
253  */
254 #define CFG_DISABLE_TWT_INFO_FRAME CFG_INI_BOOL( \
255 		"twt_disable_info", \
256 		false, \
257 		"disable twt info frame")
258 
259 #define CFG_HE_FLEX_TWT_SCHED CFG_BOOL( \
260 				"he_flex_twt_sched", \
261 				0, \
262 				"HE Flex Twt Sched")
263 
264 /*
265  * <ini>
266  * enable_twt_in_11n - Enable TWT support in 11n mode
267  * @MIN: 0
268  * @MAX: 1
269  * @Default: 0
270  *
271  * This ini is used to enable/disable TWT support 11n mode.
272  * Generally by default TWT support present from HE capable
273  * devices but if this ini is enabled then it will support
274  * partially from 11n mode itself.
275  *
276  * Related: NA
277  *
278  * Usage: External
279  *
280  * </ini>
281  */
282 #define CFG_TWT_ENABLE_IN_11N CFG_INI_BOOL( \
283 		"enable_twt_in_11n", \
284 		false, \
285 		"enable twt support in 11n mode")
286 
287 #define CFG_TWT_ALL \
288 	CFG(CFG_ENABLE_TWT) \
289 	CFG(CFG_TWT_REQUESTOR) \
290 	CFG(CFG_TWT_RESPONDER) \
291 	CFG(CFG_TWT_CONGESTION_TIMEOUT) \
292 	CFG(CFG_BCAST_TWT_REQ_RESP) \
293 	CFG(CFG_ENABLE_TWT_24GHZ) \
294 	CFG(CFG_DISABLE_TWT_INFO_FRAME) \
295 	CFG(CFG_TWT_ENABLE_IN_11N) \
296 	CFG(CFG_RTWT_REQ_RESP)
297 #elif !defined(WLAN_SUPPORT_TWT) && !defined(WLAN_TWT_CONV_SUPPORTED)
298 #define CFG_TWT_ALL
299 #endif
300 #endif /* __CFG_TWT_H_ */
301