1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-2024 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 configuration definitions for MLME REG.
22  */
23 
24 #ifndef CFG_MLME_REG_H__
25 #define CFG_MLME_REG_H__
26 
27 /*
28  * <ini>
29  * gSelfGenFrmPwr - self-generated frame power in tx chain mask
30  * for CCK rates
31  * @Min: 0
32  * @Max: 0xffff
33  * @Default: 0
34  *
35  * gSelfGenFrmPwr is to set self-generated frame power in tx chain mask
36  * for CCK rates
37  *
38  * Related: None
39  *
40  * Supported Feature: STA
41  *
42  * Usage: Internal/External
43  *
44  * </ini>
45  */
46 #define CFG_SELF_GEN_FRM_PWR CFG_INI_UINT( \
47 	"gSelfGenFrmPwr", \
48 	0, \
49 	0xffff, \
50 	0, \
51 	CFG_VALUE_OR_DEFAULT, \
52 	"set the self gen power value")
53 
54 /*
55  * <ini>
56  * enable_11d_in_world_mode - enable 11d in world mode
57  * @Min: 0
58  * @Max: 1
59  * @Default: 0
60  *
61  * This ini enables 11d in world mode, irrespective of value of
62  * g11dSupportEnabled
63  *
64  * Usage: External
65  *
66  * </ini>
67  */
68 #define CFG_ENABLE_11D_IN_WORLD_MODE CFG_INI_BOOL( \
69 	"enable_11d_in_world_mode", \
70 	0, \
71 	"enable 11d in world mode")
72 
73 /*
74  * <ini>
75  * etsi_srd_chan_in_master_mode - Enable/disable ETSI SRD channels in
76  * master mode PCL and ACS functionality
77  * @Min: 0
78  * @Max: 0xFF
79  * @Default: 6
80  *
81  * etsi_srd_chan_in_master_mode is to enable/disable ETSI SRD channels in
82  * master mode PCL and ACS functionality
83  * Bit map for enabling the SRD mode in various modes are as follows:-
84  * BIT 0:- Enable/Disable SRD channels for SAP.
85  * BIT 1:- Enable/Disable SRD channels for P2P-GO.
86  * BIT 2:- Enable/Disable SRD channels for NAN.
87  * Rest of the bits are currently reserved for future SRD channel support for
88  * other vdevs.
89  *
90  * Related: None
91  *
92  * Supported Feature: SAP/P2P-GO
93  *
94  * Usage: Internal/External
95  *
96  * </ini>
97  */
98 #define CFG_ETSI_SRD_CHAN_IN_MASTER_MODE CFG_INI_UINT( \
99 	"etsi13_srd_chan_in_master_mode", \
100 	0, \
101 	0xff, \
102 	6, \
103 	CFG_VALUE_OR_DEFAULT, \
104 	"enable/disable ETSI SRD channels in master mode")
105 
106 /*
107  * <ini>
108  * enable_nan_indoor_channel - Enable Indoor channels for NAN
109  * @Min: 0
110  * @Max: 1
111  * @Default: 0
112  *
113  * This ini is used to support to indoor channels for NAN interface
114  * Customer can config this item to enable/disable NAN in indoor channel
115  *
116  * Related: None
117  *
118  * Supported Feature: NAN
119  *
120  * Usage: External
121  *
122  * </ini>
123  */
124 #define CFG_INDOOR_CHANNEL_SUPPORT_FOR_NAN CFG_INI_BOOL( \
125 	"enable_nan_indoor_channel", \
126 	0, \
127 	"enable/disable indoor channels for NAN")
128 
129 /*
130  * <ini>
131  * fcc_5dot9_ghz_chan_in_master_mode - Enable/disable 5.9 GHz channels in
132  * master mode for US
133  * @Min: 0
134  * @Max: 1
135  * @Default: 0
136  *
137  * fcc_5dot9_ghz_chan_in_master_mode is to enable/disable 5.9 GHz channels
138  * in master mode for FCC reg domain
139  *
140  * Related: None
141  *
142  * Supported Feature: SAP/P2P-GO
143  *
144  * Usage: Internal/External
145  *
146  * </ini>
147  */
148 #define CFG_FCC_5DOT9_GHZ_CHAN_IN_MASTER_MODE CFG_INI_BOOL( \
149 	"fcc_5dot9_ghz_chan_in_master_mode", \
150 	0, \
151 	"enable/disable FCC 5.9 GHz channels in master mode")
152 
153 #ifdef SAP_AVOID_ACS_FREQ_LIST
154 #define SAP_AVOID_ACS_FREQ_LIST_DEFAULT ""
155 
156 /*
157  * <ini>
158  * sap_avoid_acs_freq_list - Avoid configured frequencies from acs
159  * @Default: No frequencies are configured, it means consider all
160  * the frequencies for acs
161  *
162  * This ini is to configure the frequencies which needs to be
163  * avoided during acs and sap will not come up on these channels
164  * Ex: sap_avoid_acs_freq_list=2412,2417,2422,2427,2467,2472
165  *
166  * Related: Feature flag SAP_AVOID_ACS_FREQ_LIST
167  *
168  * Supported Feature: SAP
169  *
170  * Usage: External
171  *
172  * </ini>
173  */
174 
175 #define CFG_SAP_AVOID_ACS_FREQ_LIST CFG_INI_STRING( \
176 	"sap_avoid_acs_freq_list", \
177 	0, \
178 	CFG_VALID_CHANNEL_LIST_STRING_LEN, \
179 	SAP_AVOID_ACS_FREQ_LIST_DEFAULT, \
180 	"Avoid configured frequencies during acs")
181 #define CFG_SAP_AVOID_ACS_FREQ_LIST_ALL CFG(CFG_SAP_AVOID_ACS_FREQ_LIST)
182 #else
183 #define CFG_SAP_AVOID_ACS_FREQ_LIST_ALL
184 #endif
185 
186 /*
187  * <ini>
188  * restart_beaconing_on_chan_avoid_event - control the beaconing entity to move
189  * away from active LTE channels
190  * @Min: 0
191  * @Max: 2
192  * @Default: 1
193  *
194  * This ini is used to control the beaconing entity (SAP/GO) to move away from
195  * active LTE channels when channel avoidance event is received
196  * restart_beaconing_on_chan_avoid_event=0: Don't allow beaconing entity move
197  * from active LTE channels
198  * restart_beaconing_on_chan_avoid_event=1: Allow beaconing entity move from
199  * active LTE channels
200  * restart_beaconing_on_chan_avoid_event=2: Allow beaconing entity move from
201  * 2.4G active LTE channels only
202  *
203  * Related: None
204  *
205  * Supported Feature: channel avoidance
206  *
207  * Usage: Internal/External
208  *
209  * </ini>
210  */
211 #define CFG_RESTART_BEACONING_ON_CH_AVOID CFG_INI_UINT( \
212 	"restart_beaconing_on_chan_avoid_event", \
213 	0, \
214 	2, \
215 	1, \
216 	CFG_VALUE_OR_DEFAULT, \
217 	"control the beaconing entity to move away from active LTE channels")
218 
219 /*
220  * <ini>
221  * gindoor_channel_support - support to start sap in indoor channel
222  * @Min: 0
223  * @Max: 1
224  * @Default: 0
225  *
226  * This ini is to support to start sap in indoor channel.
227  * Customer can config this item to enable/disable sap in indoor channel
228  *
229  * Related: None
230  *
231  * Supported Feature: SAP
232  *
233  * Usage: External
234  *
235  * </ini>
236  */
237 #define CFG_INDOOR_CHANNEL_SUPPORT CFG_INI_BOOL( \
238 	"gindoor_channel_support", \
239 	0, \
240 	"enable/disable sap in indoor channel")
241 
242 /*
243  * <ini>
244  * scan_11d_interval - 11d scan interval in ms
245  * @Min: 1 sec
246  * @Max: 10 hr
247  * @Default: 1 hr
248  *
249  * This ini sets the 11d scan interval in FW
250  *
251  * Related: None
252  *
253  * Supported Feature: STA
254  *
255  * Usage: External
256  *
257  * </ini>
258  */
259 
260 #define CFG_SCAN_11D_INTERVAL CFG_INI_UINT( \
261 	"scan_11d_interval", \
262 	1000, \
263 	36000000, \
264 	3600000, \
265 	CFG_VALUE_OR_DEFAULT, \
266 	"set the 11d scan interval in FW")
267 
268 /*
269  * <ini>
270  * ignore_fw_reg_offload_ind - If set, Ignore the FW offload indication
271  * @Min: 0
272  * @Max: 1
273  * @Default: 0
274  *
275  * This ini is used to ignore regdb offload indication from FW and
276  * regulatory will be treated as non offload.
277  *
278  * Related: None
279  *
280  * Supported Feature: STA/AP
281  *
282  * Usage: External
283  *
284  * </ini>
285  */
286 #define CFG_IGNORE_FW_REG_OFFLOAD_IND CFG_INI_BOOL( \
287 		"ignore_fw_reg_offload_ind", \
288 		0, \
289 		"Ignore Regulatory offloads Indication from FW")
290 
291 /*
292  * <ini>
293  * enable_pending_list_req - Sets Pending channel List Req.
294  * @Min: 0
295  * @Max: 1
296  * @Default: 1
297  *
298  * This option enables/disables SCAN_CHAN_LIST_CMDID channel list command to FW
299  * till the current scan is complete.
300  *
301  * Related: None
302  *
303  * Supported Feature: STA
304  *
305  * Usage: External
306  *
307  * </ini>
308  */
309 #define CFG_ENABLE_PENDING_CHAN_LIST_REQ CFG_INI_BOOL( \
310 			"enable_pending_list_req", \
311 			1, \
312 			"Enable Pending list req")
313 
314 #if defined(CONFIG_BAND_6GHZ) && defined(CONFIG_AFC_SUPPORT)
315 /*
316  * afc_reg_no_action - Whether action to AFC response
317  * @Min: 0
318  * @Max: 1
319  * @Default: 0
320  *
321  * This cfg is used to control whether action to AFC response.
322  *
323  * Related: None
324  *
325  * Supported Feature: SAP
326  *
327  */
328 #define CFG_AFC_REG_NO_ACTION CFG_BOOL( \
329 	"afc_reg_no_action", false, \
330 	"driver/user space action needed for afc resp")
331 
332 /*
333  * enable_6ghz_sp_pwrmode_supp - Enable 6Ghz SP power mode
334  * @Min: 0
335  * @Max: 1
336  * @Default: 0
337  *
338  * This cfg is used to control support of 6Ghz SP power mode.
339  *
340  * Related: None
341  *
342  * Supported Feature: SAP
343  *
344  */
345 #define CFG_6GHZ_SP_POWER_MODE_SUPP CFG_INI_BOOL( \
346 	"enable_6ghz_sp_pwrmode_supp", false, \
347 	"Enable support for SP Power mode in 6GHz")
348 
349 /*
350  * afc_disable_timer_check - Disable AFC timer check
351  * @Min: 0
352  * @Max: 1
353  * @Default: 0
354  *
355  * This cfg is used to control whether disable AFC timer check.
356  *
357  * Related: None
358  *
359  * Supported Feature: SAP
360  *
361  */
362 #define CFG_AFC_TIMER_CHECK_DIS CFG_BOOL( \
363 	"afc_disable_timer_check", false, \
364 	"Disable the AFC request timer in FW")
365 
366 /*
367  * afc_disable_request_id_check - Disable AFC request id check
368  * @Min: 0
369  * @Max: 1
370  * @Default: 0
371  *
372  * This ini is used to control whether disable AFC request id check.
373  *
374  * Related: None
375  *
376  * Supported Feature: SAP
377  *
378  */
379 #define CFG_AFC_REQ_ID_CHECK_DIS CFG_BOOL( \
380 	"afc_disable_request_id_check", false, \
381 	"Disable the AFC request ID check in FW")
382 
383 #define CFG_AFC_REG_ALL \
384 	CFG(CFG_AFC_REG_NO_ACTION) \
385 	CFG(CFG_6GHZ_SP_POWER_MODE_SUPP) \
386 	CFG(CFG_AFC_TIMER_CHECK_DIS) \
387 	CFG(CFG_AFC_REQ_ID_CHECK_DIS)
388 #else
389 #define CFG_AFC_REG_ALL
390 #endif
391 
392 /*
393  * <ini>
394  * retain_nol_across_regdmn - Retain NOL across reg domain
395  * @Min: 0
396  * @Max: 1
397  * @Default: 1
398  *
399  * This ini is used to set if NOL needs to be retained
400  * on the reg domain change.
401  *
402  * Related: None
403  *
404  * Supported Feature: SAP
405  *
406  * Usage: External
407  *
408  * </ini>
409  */
410 #define CFG_RETAIN_NOL_ACROSS_REG_DOMAIN CFG_INI_BOOL( \
411 		"retain_nol_across_regdmn", \
412 		1, \
413 		"Retain NOL even if the regdomain changes")
414 
415 #ifdef FEATURE_WLAN_CH_AVOID_EXT
416 
417 /**
418  * enum ignore_fw_coex_info_modes - Represents modes
419  * @IGNORE_FW_COEX_INFO_ON_SAP_MODE: Set this bit to ignore fw coex info on
420  *                                   SAP mode
421  * @IGNORE_FW_COEX_INFO_ON_P2P_GO_MODE: Set this bit to ignore fw coex info
422  *                                   on P2P-GO mode
423  */
424 enum ignore_fw_coex_info_modes {
425 	IGNORE_FW_COEX_INFO_ON_SAP_MODE = 1 << 0,
426 	IGNORE_FW_COEX_INFO_ON_P2P_GO_MODE = 1 << 1
427 };
428 
429 /*
430  * <ini>
431  * coex_unsafe_chan_nb_user_prefer- Used to handle coex unsafe freq
432  * event
433  *
434  * @Min: 0
435  * @Max: 0xFF
436  * @Default: 0
437  *
438  * Bit map of the modes to consider/ignore firmware provided coex/unsafe
439  * channels.
440  * Firmware provided coex/unsafe channel info is ignored if the corresponding
441  * bit is set to 1.
442  * Firmware provided coex/unsafe channel info is honored if the corresponding
443  * bit is set to 0.
444  *
445  * BIT 0: Don't honor firmware coex info for SAP mode
446  * BIT 1: Don't honor firmware coex info for P2P-GO mode
447  * Rest of the bits are currently reserved
448  *
449  * This ini is used to handle coex unsafe freq event
450  * Usage: External
451  *
452  * </ini>
453  */
454 #define CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER CFG_INI_UINT( \
455 		"coex_unsafe_chan_nb_user_prefer", \
456 		0, \
457 		0xff, \
458 		0, \
459 		CFG_VALUE_OR_DEFAULT, \
460 		"Honor coex unsafe freq event from firmware")
461 /*
462  * <ini>
463  * coex_unsafe_chan_reg_disable - Used to disable reg channels
464  * for coex unsafe freq event
465  *
466  * @Min: 0 (Don't disable reg channels for coex unsafe chan event)
467  * @Max: 1 (Disable reg channels for coex unsafe chan event)
468  * Default: 0
469  *
470  * This ini is used to disable reg channels for coex unsafe chan
471  * event
472  * Usage: External
473  *
474  * </ini>
475  */
476 #define CFG_COEX_UNSAFE_CHAN_REG_DISABLE CFG_INI_BOOL( \
477 		"coex_unsafe_chan_reg_disable", \
478 		0, \
479 		"Disable reg channels for coex unsafe chan event")
480 
481 #define CFG_COEX_UNSAFE_CHAN_ALL \
482 	CFG(CFG_COEX_UNSAFE_CHAN_NB_USER_PREFER) \
483 	CFG(CFG_COEX_UNSAFE_CHAN_REG_DISABLE)
484 #else
485 #define CFG_COEX_UNSAFE_CHAN_ALL
486 #endif
487 
488 #define CFG_REG_ALL \
489 	CFG_COEX_UNSAFE_CHAN_ALL \
490 	CFG(CFG_SELF_GEN_FRM_PWR) \
491 	CFG(CFG_ENABLE_PENDING_CHAN_LIST_REQ) \
492 	CFG(CFG_ENABLE_11D_IN_WORLD_MODE) \
493 	CFG(CFG_ETSI_SRD_CHAN_IN_MASTER_MODE) \
494 	CFG(CFG_INDOOR_CHANNEL_SUPPORT_FOR_NAN) \
495 	CFG(CFG_FCC_5DOT9_GHZ_CHAN_IN_MASTER_MODE) \
496 	CFG(CFG_RESTART_BEACONING_ON_CH_AVOID) \
497 	CFG(CFG_INDOOR_CHANNEL_SUPPORT) \
498 	CFG(CFG_SCAN_11D_INTERVAL) \
499 	CFG(CFG_IGNORE_FW_REG_OFFLOAD_IND) \
500 	CFG_AFC_REG_ALL \
501 	CFG(CFG_RETAIN_NOL_ACROSS_REG_DOMAIN) \
502 	CFG_SAP_AVOID_ACS_FREQ_LIST_ALL
503 
504 #endif /* CFG_MLME_REG_H__ */
505