xref: /wlan-driver/qcacld-3.0/components/mlme/dispatcher/inc/cfg_mlme_twt.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2011-2018, 2020-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 /**
21  * DOC: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __CFG_MLME_TWT_H
25 #define __CFG_MLME_TWT_H
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: 0
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  * enable_twt_24ghz - Enable Target wake time when STA is connected on 2.4Ghz
170  * band.
171  * @Min: 0
172  * @Max: 1
173  * @Default: 1
174  *
175  * This ini is used to enable/disable the host TWT when STA is connected to AP
176  * in 2.4Ghz band.
177  *
178  * Related: NA
179  *
180  * Supported Feature: 11AX
181  *
182  * Usage: External
183  *
184  * </ini>
185  */
186 #define CFG_ENABLE_TWT_24GHZ CFG_INI_BOOL( \
187 		"enable_twt_24ghz", \
188 		true, \
189 		"enable twt in 2.4Ghz band")
190 
191 #define CFG_TWT_ALL \
192 	CFG(CFG_ENABLE_TWT) \
193 	CFG(CFG_TWT_REQUESTOR) \
194 	CFG(CFG_TWT_RESPONDER) \
195 	CFG(CFG_TWT_CONGESTION_TIMEOUT) \
196 	CFG(CFG_BCAST_TWT_REQ_RESP) \
197 	CFG(CFG_ENABLE_TWT_24GHZ)
198 #endif
199 #endif /* __CFG_MLME_TWT_H */
200