1 /*
2  * Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2023 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 #if !defined(__NAN_CFG_H__)
21 #define __NAN_CFG_H__
22 
23 /**
24  * DOC: nan_cfg.h
25  *
26  * NAN feature INI configuration parameter definitions
27  */
28 #include "cfg_define.h"
29 #include "cfg_converged.h"
30 #include "qdf_types.h"
31 
32 /*
33  * <ini>
34  * gEnableNanSupport - NAN feature support configuration
35  * @Min: 0
36  * @Max: 1
37  * @Default: 1
38  *
39  * When set to 1 NAN feature will be enabled.
40  *
41  * Related: None
42  *
43  * Supported Feature: NAN
44  *
45  * Usage: External
46  *
47  * </ini>
48  */
49 #define CFG_NAN_ENABLE CFG_INI_BOOL("gEnableNanSupport", \
50 				    1, \
51 				    "Enable NAN Support")
52 
53 /*
54  * <ini>
55  * nan_separate_iface_support: Separate iface creation for NAN
56  * @Min: 0
57  * @Max: 1
58  * @Default: 1
59  *
60  * Value is 1 when Host HDD supports separate iface creation
61  * for NAN.
62  *
63  * Related: None
64  *
65  * Supported Feature: NAN
66  *
67  * Usage: External
68  *
69  * </ini>
70  */
71 #define CFG_NAN_SEPARATE_IFACE_SUPP CFG_INI_BOOL("nan_separate_iface_support", \
72 						 1, \
73 						 "Separate iface for NAN")
74 
75 
76 /*
77  * <ini>
78  * genable_nan_datapath - Enable NaN data path feature. NaN data path
79  *                        enables NAN supported devices to exchange
80  *                        data over TCP/UDP network stack.
81  * @Min: 0
82  * @Max: 1
83  * @Default: 1
84  *
85  * When set to 1 NAN Datapath feature will be enabled.
86  *
87  * Related: gEnableNanSupport
88  *
89  * Supported Feature: NAN
90  *
91  * Usage: External
92  *
93  * </ini>
94  */
95 #define CFG_NAN_DATAPATH_ENABLE CFG_INI_BOOL("genable_nan_datapath", \
96 					     1, \
97 					     "Enable NAN Datapath support")
98 
99 /*
100  * <ini>
101  * gEnableNDIMacRandomization - When enabled this will randomize NDI Mac
102  * @Min: 0
103  * @Max: 1
104  * @Default: 1
105  *
106  * When enabled this will randomize NDI Mac
107  *
108  * Related: gEnableNanSupport
109  *
110  * Supported Feature: NAN
111  *
112  * Usage: External
113  *
114  * </ini>
115  */
116 #define CFG_NAN_RANDOMIZE_NDI_MAC CFG_INI_BOOL("gEnableNDIMacRandomization", \
117 					       1, \
118 					       "Enable NAN MAC Randomization")
119 
120 /*
121  * <ini>
122  * ndp_inactivity_timeout - To configure duration of how many seconds
123  * without TX/RX data traffic, NDI vdev can kickout the connected
124  * peer(i.e. NDP Termination).
125  *
126  * @Min: 0
127  * @Max: 1800
128  * @Default: 60
129  *
130  * Related: None
131  *
132  * Supported Feature: NAN
133  *
134  * Usage: External
135  *
136  * </ini>
137  */
138 #define CFG_NAN_NDP_INACTIVITY_TIMEOUT CFG_INI_UINT("ndp_inactivity_timeout", \
139 						    0, \
140 						    1800, \
141 						    60, \
142 						    CFG_VALUE_OR_DEFAULT, \
143 						    "NDP Auto Terminate time")
144 
145 /*
146  * <ini>
147  * gNdpKeepAlivePeriod - To configure duration of how many seconds
148  * to wait to kickout peer if peer is not reachable.
149  *
150  * @Min: 10
151  * @Max: 30
152  * @Default: 14
153  *
154  * Related: None
155  *
156  * Supported Feature: NAN
157  *
158  * Usage: External
159  *
160  * </ini>
161  */
162 
163 #define CFG_NDP_KEEP_ALIVE_PERIOD CFG_INI_UINT( \
164 			"gNdpKeepAlivePeriod", \
165 			10, \
166 			30, \
167 			14, \
168 			CFG_VALUE_OR_DEFAULT, \
169 			"Keep alive timeout of a peer")
170 
171 /* MAX NDP sessions supported */
172 #define MAX_NDP_SESSIONS 8
173 
174 /*
175  * <ini>
176  * ndp_max_sessions - To configure max ndp sessions
177  * supported by host.
178  *
179  * @Min: 1
180  * @Max: 8
181  * @Default: 8
182  *
183  * Related: None
184  *
185  * Supported Feature: NAN
186  *
187  * Usage: Internal
188  *
189  * </ini>
190  */
191 
192 #define CFG_NDP_MAX_SESSIONS CFG_INI_UINT( \
193 			"ndp_max_sessions", \
194 			1, \
195 			MAX_NDP_SESSIONS, \
196 			8, \
197 			CFG_VALUE_OR_DEFAULT, \
198 			"max ndp sessions host supports")
199 
200 /*
201  * <ini>
202  * gSupportMp0Discovery - To support discovery of NAN cluster with
203  * Master Preference (MP) as 0 when a new device is enabling NAN.
204  *
205  * @Min: 0
206  * @Max: 1
207  * @Default: 0
208  *
209  * Related: None
210  *
211  * Supported Feature: NAN
212  *
213  * Usage: External
214  *
215  * </ini>
216  */
217 #define CFG_SUPPORT_MP0_DISCOVERY CFG_INI_BOOL( \
218 			"gSupportMp0Discovery", \
219 			1, \
220 			"Enable/Disable discovery of NAN cluster with Master Preference (MP) as 0")
221 /*
222  * <ini>
223  * ndi_max_support - To configure max number of ndi host supports
224  *
225  * @Min: 1
226  * @Max: 2
227  * @Default: 1
228  *
229  * Related: None
230  *
231  * Supported Feature: NAN
232  *
233  * Usage: Internal
234  *
235  * </ini>
236  */
237 #define CFG_NDI_MAX_SUPPORT CFG_INI_UINT( \
238 			"ndi_max_support", \
239 			1, \
240 			2, \
241 			1, \
242 			CFG_VALUE_OR_DEFAULT, \
243 			"Max number of NDI host supports")
244 
245 /*
246  * <ini>
247  * nan_feature_config - Bitmap to enable/disable a particular NAN/NDP feature
248  *
249  * @Min: 0
250  * @Max: 0xFFFF
251  * @Default: 0
252  *
253  * This parameter helps to enable/disable a particular feature config by setting
254  * corresponding bit and send to firmware through the VDEV param
255  * wmi_vdev_param_enable_disable_nan_config_features
256  * Acceptable values for this:
257  * BIT(0): Allow DW configuration from framework in sync role.
258  *	   If this is not set, firmware shall follow the spec/default behavior.
259  * BIT(1) to BIT(31): Reserved
260  *
261  * Related: None
262  *
263  * Supported Feature: NAN
264  *
265  * Usage: External
266  *
267  * </ini>
268  */
269 #define CFG_NAN_FEATURE_CONFIG CFG_INI_UINT( \
270 			"nan_feature_config", \
271 			0, \
272 			0xFFFF, \
273 			0, \
274 			CFG_VALUE_OR_DEFAULT, \
275 			"Enable the specified NAN features in firmware")
276 
277 /*
278  * <ini>
279  * disable_6g_nan - Disable NAN feature support in 6GHz
280  * @Min: 0
281  * @Max: 1
282  * @Default: 0
283  *
284  * When set to 1 NAN feature will be disabled in 6GHz.
285  *
286  * Related: None
287  *
288  * Supported Feature: NAN
289  *
290  * Usage: External
291  *
292  * </ini>
293  */
294 #define CFG_DISABLE_6G_NAN CFG_INI_BOOL("disable_6g_nan", \
295 					0, \
296 					"Disable NAN Support in 6GHz")
297 
298 /*
299  * <ini>
300  * g_nan_enable_eht_cap- enable/disable NAN EHT CAP
301  * @Min: 0
302  * @Max: 1
303  * @Default: 0
304  *
305  * This ini is used to enable/disable NAN EHT capability
306  *
307  * Related: None
308  *
309  * Supported Feature: NAN
310  *
311  * Usage: Internal/External
312  *
313  * </ini>
314  */
315 #define CFG_NAN_ENABLE_EHT_CAP CFG_INI_BOOL("g_nan_enable_eht_cap", \
316 					     0, \
317 					     "Enable NAN EHT CAP")
318 
319 
320 #ifdef WLAN_FEATURE_NAN
321 #define CFG_NAN_DISC CFG(CFG_NAN_ENABLE) \
322 			CFG(CFG_DISABLE_6G_NAN) \
323 			CFG(CFG_NDP_KEEP_ALIVE_PERIOD) \
324 			CFG(CFG_SUPPORT_MP0_DISCOVERY)
325 #define CFG_NAN_DP      CFG(CFG_NAN_DATAPATH_ENABLE) \
326 			CFG(CFG_NAN_RANDOMIZE_NDI_MAC) \
327 			CFG(CFG_NAN_NDP_INACTIVITY_TIMEOUT) \
328 			CFG(CFG_NAN_SEPARATE_IFACE_SUPP)
329 #else
330 #define CFG_NAN_DISC
331 #define CFG_NAN_DP
332 #endif
333 
334 #define CFG_NAN_ALL     CFG_NAN_DISC \
335 			CFG_NAN_DP \
336 			CFG(CFG_NDP_MAX_SESSIONS) \
337 			CFG(CFG_NDI_MAX_SUPPORT) \
338 			CFG(CFG_NAN_FEATURE_CONFIG) \
339 			CFG(CFG_NAN_ENABLE_EHT_CAP)
340 
341 #endif
342