1 /*
2  * Copyright (c) 2012-2020 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 MLME BTM related CFG/INI Items.
22  */
23 
24 #ifndef CFG_MLME_BTM_H_
25 #define CFG_MLME_BTM_H_
26 
27 /*
28  * <ini>
29  * prefer_btm_query - Prefer btm query over 11k neighbor report
30  * @Min: 0
31  * @Max: 1
32  * @Default: 1
33  *
34  * This ini is used to enable the STA to send BTM query instead of
35  * 11k neighbor report.
36  *
37  * Supported Feature: STA
38  *
39  * Usage: External
40  *
41  * </ini>
42  */
43 #define CFG_PREFER_BTM_QUERY CFG_INI_BOOL( \
44 			"prefer_btm_query", \
45 			1, \
46 			"prefer btm query over 11k neighbor report")
47 
48 /*
49  * <ini>
50  * prefer_roam_score_for_candidate_selection - choose to sort the candidates on
51  * roam score or preferred AP
52  * @Min: 0
53  * @Max: 1
54  * @Default: 1
55  *
56  * This ini is used to enable the the firmware to sort the candidates
57  * based on the roam score rather than selecting APs as per the order
58  * of the APs sent by the connected AP.
59  *
60  * Supported Feature: Roaming
61  *
62  * Usage: External
63  *
64  * </ini>
65  */
66 #define CFG_ENABLE_BTM_ABRIDGE CFG_INI_BOOL( \
67 			"prefer_roam_score_for_candidate_selection", \
68 			1, \
69 			"sort candidate based on roam score")
70 
71 /*
72  * <ini>
73  * btm_offload_config - Configure BTM
74  * @Min: 0x00000000
75  * @Max: 0xFFFFFFFF
76  * @Default: 0x000001c1
77  *
78  * This ini is used to configure BTM
79  *
80  * Bit 0: Enable/Disable the BTM offload. Set this to 1 will
81  * enable and 0 will disable BTM offload.
82  *
83  * BIT 2, 1: Action on non matching candidate with cache. If a BTM request
84  * is received from AP then the candidate AP's may/may-not be present in
85  * the firmware scan cache . Based on below config firmware will decide
86  * whether to forward BTM frame to host or consume with firmware and proceed
87  * with Roaming to candidate AP.
88  * 00 scan and consume
89  * 01 no scan and forward to host
90  * 10, 11 reserved
91  *
92  * BIT 5, 4, 3: Roaming handoff decisions on multiple candidates match
93  * for unsolicited BTM request.
94  * 000 match if exact BSSIDs are found
95  * 001 match if at least one top priority BSSID only
96  * 010, 011, 100, 101, 110, 111 reserved
97  * In case of solicited request intersection of Roam cache/candidates
98  * with candidates in BTM request is taken into consideration.
99  *
100  * BIT 6: Set this to 1 will send BTM query frame and 0 not sent.
101  *
102  * BIT 7: Roam BTM candidates based on the roam score instead of BTM preferred
103  * value
104  *
105  * BIT 8: BTM query preference over 11k neighbor report request
106  *
107  * BIT 9: BTM query with candidate list
108  *
109  * BIT 10: When this bit is set, Firmware will forward BTM Request Frame to
110  * driver when the frame contains MBO assoc retry attribute. Driver will send
111  * this frame to supplicant and supplicant will use the frame info for
112  * denylisting the AP so for the next connection framework will avoid this AP.
113  *
114  * BIT 11-31: Reserved
115  *
116  * Supported Feature: STA
117  *
118  * Usage: External
119  *
120  * </ini>
121  */
122 #define CFG_BTM_ENABLE CFG_INI_UINT( \
123 	"btm_offload_config", \
124 	0x00000000, \
125 	0xffffffff, \
126 	0x000001c1, \
127 	CFG_VALUE_OR_DEFAULT, \
128 	"configure btm offload")
129 
130 /*
131  * <ini>
132  * btm_solicited_timeout - timeout value for waiting BTM request
133  * @Min: 1
134  * @Max: 10000
135  * @Default: 100
136  *
137  * This ini is used to configure timeout value for waiting BTM request.
138  * Unit: millionsecond
139  *
140  * Supported Feature: STA
141  *
142  * Usage: External
143  *
144  * </ini>
145  */
146 #define CFG_BTM_SOLICITED_TIMEOUT CFG_INI_UINT( \
147 	"btm_solicited_timeout", \
148 	1, \
149 	10000, \
150 	100, \
151 	CFG_VALUE_OR_DEFAULT, \
152 	"configure timeout value for waiting BTM request")
153 
154 /*
155  * <ini>
156  * btm_max_attempt_cnt - Maximum attempt for sending BTM query to ESS
157  * @Min: 1
158  * @Max: 0xFFFFFFFF
159  * @Default: 3
160  *
161  * This ini is used to configure maximum attempt for sending BTM query to ESS.
162  *
163  * Supported Feature: STA
164  *
165  * Usage: External
166  *
167  * </ini>
168  */
169 #define CFG_BTM_MAX_ATTEMPT_CNT CFG_INI_UINT( \
170 	"btm_max_attempt_cnt", \
171 	1, \
172 	0xFFFFFFFF, \
173 	3, \
174 	CFG_VALUE_OR_DEFAULT, \
175 	"configure maximum attempt for sending BTM query to ESS")
176 
177 /*
178  * <ini>
179  * btm_sticky_time - Stick time after roaming to new AP by BTM
180  * @Min: 0
181  * @Max: 0x0000FFFF
182  * @Default: 0
183  *
184  * This ini is used to configure Stick time after roaming to new AP by BTM.
185  * Unit: seconds
186  *
187  * Supported Feature: STA
188  *
189  * Usage: External
190  *
191  * </ini>
192  */
193 #define CFG_BTM_STICKY_TIME CFG_INI_UINT( \
194 	"btm_sticky_time", \
195 	0, \
196 	0x0000FFFF, \
197 	0, \
198 	CFG_VALUE_OR_DEFAULT, \
199 	"configure Stick time after roaming to new AP by BTM")
200 
201 /*
202  * <ini>
203  * roam_candidate_validity_timer - roam cache entries validity timer
204  * @Min: 0
205  * @Max: 0xffffffff
206  * @Default: 0xffffffff
207  *
208  * This value is the timeout values for the cached roam candidate
209  * entries in firmware. If this value is 0, then that entry is not
210  * valid
211  *
212  * Supported Feature: Roaming
213  *
214  * Usage: External
215  *
216  * </ini>
217  */
218 #define CFG_BTM_VALIDITY_TIMER CFG_INI_UINT( \
219 			"roam_candidate_validity_timer", \
220 			0, \
221 			0xffffffff, \
222 			0xffffffff, \
223 			CFG_VALUE_OR_DEFAULT, \
224 			"BTM validity timer")
225 
226 /*
227  * <ini>
228  * btm_disassoc_timer_threshold - Disassociation timer threshold to wait
229  * after which the full scan for roaming can be started after the AP has sent
230  * the disassoc imminent
231  * @Min: 0
232  * @Max: 0xffffffff
233  * @Default: 10000
234  *
235  * When AP sends, BTM request with disassoc imminent bit set, the STA should
236  * roam to a new AP within the disassc timeout provided by the ap. If the Roam
237  * scan period is less than the disassoc timeout value, then instead of
238  * triggering the roam scan immediately, STA can wait for this
239  * btm_disassoc_timer_threshold and then start roaming.
240  *
241  * Supported Feature: Roaming
242  *
243  * Usage: External
244  *
245  * </ini>
246  */
247 #define CFG_BTM_DISASSOC_TIMER_THRESHOLD CFG_INI_UINT( \
248 			"btm_disassoc_timer_threshold", \
249 			0, \
250 			0xffffffff, \
251 			10000, \
252 			CFG_VALUE_OR_DEFAULT, \
253 			"BTM disassociation timer threshold")
254 
255 /*
256  * <ini>
257  * btm_query_bitmask - To send BTM query with candidate list on various roam
258  * scans reasons
259  * @Min: 0
260  * @Max: 0xFFFFFFFF
261  * @Default: 0x8
262  *
263  * This new ini is introduced to configure the bitmask for various roam scan
264  * reasons. Fw sends "BTM query with preferred candidate list" only for those
265  * roam scans which are enable through this bitmask.
266 
267  * For Example:
268  * Bitmask : 0x8 (LOW_RSSI) refer enum WMI_ROAM_TRIGGER_REASON_ID
269  * Bitmask : 0xDA (PER, LOW_RSSI, HIGH_RSSI, MAWC, DENSE)
270  * refer enum WMI_ROAM_TRIGGER_REASON_ID
271  *
272  * Related: None
273  *
274  * Supported Feature: Roaming
275  *
276  * Usage: External
277  *
278  * </ini>
279  */
280 #define CFG_BTM_QUERY_BITMASK CFG_INI_UINT( \
281 			"btm_query_bitmask", \
282 			0, \
283 			0xFFFFFFFF, \
284 			0x8, \
285 			CFG_VALUE_OR_DEFAULT, \
286 			"btm query with candidate list bitmask")
287 
288 /*
289  * <ini>
290  * minimum_btm_candidate_score - Consider the AP as roam candidate only if
291  * its score is greater than minimum_btm_candidate_score.
292  * @Min: 0
293  * @Max: 10000
294  * @Default: 2600
295  *
296  * This ini is applicable only for candidate selection during BTM roam trigger.
297  * For this roam_score_delta_bitmap bit 10 should be set to 1.
298  *
299  * Related: None
300  *
301  * Supported Feature: Roaming
302  *
303  * Usage: External
304  *
305  * </ini>
306  */
307 #define CFG_MIN_BTM_CANDIDATE_SCORE CFG_INI_UINT( \
308 	"minimum_btm_candidate_score", \
309 	0, \
310 	10000, \
311 	2600, \
312 	CFG_VALUE_OR_DEFAULT, \
313 	"Minimum BTM candidate score")
314 
315 #define CFG_BTM_ALL \
316 	CFG(CFG_PREFER_BTM_QUERY) \
317 	CFG(CFG_ENABLE_BTM_ABRIDGE) \
318 	CFG(CFG_BTM_ENABLE) \
319 	CFG(CFG_BTM_SOLICITED_TIMEOUT) \
320 	CFG(CFG_BTM_MAX_ATTEMPT_CNT) \
321 	CFG(CFG_BTM_STICKY_TIME) \
322 	CFG(CFG_BTM_VALIDITY_TIMER) \
323 	CFG(CFG_BTM_DISASSOC_TIMER_THRESHOLD) \
324 	CFG(CFG_BTM_QUERY_BITMASK) \
325 	CFG(CFG_MIN_BTM_CANDIDATE_SCORE)
326 
327 #endif /* CFG_MLME_BTM_H_ */
328