1 /*
2  * Copyright (c) 2012-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2022-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 /**
21  * DOC: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __CFG_MLME_FE_WLM_H
25 #define __CFG_MLME_FE_WLM_H
26 
27 /*
28  * Flag definition of 32-bit host latency flags
29  *
30  * |31  18|  17  |  16    |15        8|7    1|     0     |
31  * +------+------+--------+-----------+------+-----------+
32  * | RSVD | HBB  | PM-QOS |  RSVD     | RSVD | RX Thread |
33  * +------+------+--------+-----------+------+-----------+
34  * |       common         |  TX Path  |    RX Path       |
35  *
36  * bit 0-7: Rx path related optimization
37  * bit 0: disable rx_thread for vdev
38  * bit 1-7: Reserved
39  * bit 8-15: Tx path related optimization
40  * bit 8-15: Reserved
41  * bit 16-31: common changes
42  * bit 16: Request for pm_qos vote
43  * bit 17: Request for high ddr bus bandwidth
44  */
45 
46 #define WLM_HOST_RX_THREAD_FLAG         (1 << 0)
47 #define WLM_HOST_PM_QOS_FLAG            (1 << 16)
48 #define WLM_HOST_HBB_FLAG               (1 << 17)
49 
50 #define CFG_MAX_LATENCY_FLAGS "0xFFFFFFFFFFFFFFFF"
51 
52 /*
53  * <ini>
54  * wlm_latency_enable - WLM latency Enable
55  *
56  * @min: 0
57  * @max: 1
58  * @default: 1
59  *
60  * 0 - disable
61  * 1 - enable
62  *
63  * </ini>
64  */
65 #define CFG_LATENCY_ENABLE CFG_INI_BOOL("wlm_latency_enable", \
66 					1, \
67 					"WLM latency Enable")
68 
69 /*
70  * <ini>
71  * wlm_latency_reset_on_disconnect - WLM latency level reset on disconnect
72  *
73  * @min: 0
74  * @max: 1
75  * @default: 0
76  *
77  * 0 - disable
78  * 1 - enable
79  *
80  * </ini>
81  */
82 #define CFG_LATENCY_RESET CFG_INI_BOOL("wlm_latency_reset_on_disconnect", \
83 				       0, \
84 				       "WLM latency reset on disconnect")
85 
86 /*
87  * <ini>
88  * wlm_latency_level - WLM latency level
89  * Define 4 latency level to gain latency
90  *
91  * @min: 0
92  * @max: 3
93  * @default: 0
94  *
95  * 0 - normal
96  * 1 - xr
97  * 2 - low
98  * 3 - ultralow
99  *
100  * </ini>
101  */
102 #define CFG_LATENCY_LEVEL CFG_INI_UINT("wlm_latency_level", \
103 				       0, \
104 				       3, \
105 				       0, \
106 				       CFG_VALUE_OR_DEFAULT, \
107 				       "WLM latency level")
108 
109 #ifdef MULTI_CLIENT_LL_SUPPORT
110 /*
111  * <ini>
112  * wlm_multi_client_ll - Ini to configure multi client latency feature
113  *
114  * @min: 0
115  * @max: 1
116  * @default: 0
117  *
118  * 0 - disable
119  * 1 - enable
120  *
121  * </ini>
122  */
123 #define CFG_WLM_MULTI_CLIENT_LL_SUPPORT CFG_INI_BOOL("wlm_multi_client_ll", \
124 						  0, \
125 						  "wlm multi client ll feature")
126 
127 #define WLM_MULTI_CLIENT_LL_CFG CFG(CFG_WLM_MULTI_CLIENT_LL_SUPPORT)
128 #else
129 #define WLM_MULTI_CLIENT_LL_CFG
130 #endif
131 
132 /*
133  * <ini>
134  * wlm_latency_flags_normal - WLM flags setting for normal level
135  *
136  * @min: 0x0
137  * @max: 0xffffffffffffffff
138  * @default: 0x0
139  *
140  * |31  12|  11  |  10  |9    8|7    6|5    4|3    2|  1  |  0  |
141  * +------+------+------+------+------+------+------+-----+-----+
142  * | RSVD | SSLP | CSLP | RSVD | Roam | RSVD | DWLT | DFS | SUP |
143  * +------+-------------+-------------+-------------------------+
144  * |  WAL |      PS     |     Roam    |         Scan            |
145  *
146  * bit 0: Avoid scan request from HLOS if setting
147  * bit 1: Skip DFS channel SCAN if setting
148  * bit 2-3: Define policy of dwell time/duration for each foreign channel
149  *     (b2 b3)
150  *     (0  0 ): Default scan dwell time
151  *     (0  1 ): Reserve
152  *     (1  0 ): Shrink off channel dwell time
153  *     (1  1 ): Reserve
154  * bit 4-5: Reserve for scan
155  * bit 6-7: Define roaming policy
156  *     (b6 b7)
157  *     (0  0 ): Default roaming behavior, allow roaming in all scenarios
158  *     (0  1 ): Disallow all roaming
159  *     (1  0 ): Allow roaming when final bmissed
160  *     (1  1 ): Reserve
161  * bit 8-9: Reserve for roaming
162  * bit 10: Disable css power collapse if setting
163  * bit 11: Disable sys sleep if setting
164  * bit 12-31: Reserve for future usage
165  *
166  * |63  50|  49  |  48    |47        40|39   33|    32     |
167  * +------+------+--------+------------+-------+-----------+
168  * | RSVD | HBB  | PM-QOS |  RSVD      | RSVD  | RX Thread |
169  * +------+------+--------+------------+-------+-----------+
170  * |       common         |  TX Path   |     RX Path       |
171  *
172  * bit 39-32: Rx path related optimization
173  * bit 32: disable rx_thread for vdev
174  * bit 33-39: Reserved
175  * bit 40-47: Tx path related optimization
176  * bit 40-47: Reserved
177  * bit 48-63: common changes
178  * bit 48: Request for pm_qos vote
179  * bit 49: Request for high ddr bus bandwidth
180  *
181  * </ini>
182  */
183 #define CFG_DEFAULT_NORMAL_FLAGS "0x0"
184 #define CFG_LATENCY_FLAGS_NORMAL \
185 		CFG_INI_STRING("wlm_latency_flags_normal",\
186 			       0, \
187 			       sizeof(CFG_MAX_LATENCY_FLAGS) - 1,\
188 			       CFG_DEFAULT_NORMAL_FLAGS, \
189 			       "WLM flags for normal level")
190 
191 
192 /*
193  * <ini>
194  * wlm_latency_flags_xr - WLM flags setting for XR level
195  *
196  * @min: 0x0
197  * @max: 0xffffffffffffffff
198  * @default: 0x3000100000083
199  *
200  * |31  12|  11  |  10  |9    8|7    6|5    4|3    2|  1  |  0  |
201  * +------+------+------+------+------+------+------+-----+-----+
202  * | RSVD | SSLP | CSLP | RSVD | Roam | RSVD | DWLT | DFS | SUP |
203  * +------+-------------+-------------+-------------------------+
204  * |  WAL |      PS     |     Roam    |         Scan            |
205  *
206  * bit 0: Avoid scan request from HLOS if setting
207  * bit 1: Skip DFS channel SCAN if setting
208  * bit 2-3: Define policy of dwell time/duration for each foreign channel
209  *     (b2 b3)
210  *     (0  0 ): Default scan dwell time
211  *     (0  1 ): Reserve
212  *     (1  0 ): Shrink off channel dwell time
213  *     (1  1 ): Reserve
214  * bit 4-5: Reserve for scan
215  * bit 6-7: Define roaming policy
216  *     (b6 b7)
217  *     (0  0 ): Default roaming behavior, allow roaming in all scenarios
218  *     (0  1 ): Disallow all roaming
219  *     (1  0 ): Allow roaming when final bmissed
220  *     (1  1 ): Reserve
221  * bit 8-9: Reserve for roaming
222  * bit 10: Disable css power collapse if setting
223  * bit 11: Disable sys sleep if setting
224  * bit 12-31: Reserve for future usage
225  *
226  * |63  50|  49  |  48    |47        40|39   33|    32     |
227  * +------+------+--------+------------+-------+-----------+
228  * | RSVD | HBB  | PM-QOS |  RSVD      | RSVD  | RX Thread |
229  * +------+------+--------+------------+-------+-----------+
230  * |       common         |  TX Path   |     RX Path       |
231  *
232  * bit 39-32: Rx path related optimization
233  * bit 32: disable rx_thread for vdev
234  * bit 33-39: Reserved
235  * bit 40-47: Tx path related optimization
236  * bit 40-47: Reserved
237  * bit 48-63: common changes
238  * bit 48: Request for pm_qos vote
239  * bit 49: Request for high ddr bus bandwidth
240  *
241  * </ini>
242  */
243 #define CFG_DEFAULT_XR_FLAGS "0x3000100000083"
244 #define CFG_LATENCY_FLAGS_XR \
245 		CFG_INI_STRING("wlm_latency_flags_xr",\
246 			       0, \
247 			       sizeof(CFG_MAX_LATENCY_FLAGS) - 1,\
248 			       CFG_DEFAULT_XR_FLAGS, \
249 			       "WLM flags for XR level")
250 
251 
252 /*
253  * <ini>
254  * wlm_latency_flags_low - WLM flags setting for low level
255  *
256  * @min: 0x0
257  * @max: 0xffffffffffffffff
258  * @default: 0xa
259  *
260  * |31  12|  11  |  10  |9    8|7    6|5    4|3    2|  1  |  0  |
261  * +------+------+------+------+------+------+------+-----+-----+
262  * | RSVD | SSLP | CSLP | RSVD | Roam | RSVD | DWLT | DFS | SUP |
263  * +------+-------------+-------------+-------------------------+
264  * |  WAL |      PS     |     Roam    |         Scan            |
265  *
266  * bit 0: Avoid scan request from HLOS if setting
267  * bit 1: Skip DFS channel SCAN if setting
268  * bit 2-3: Define policy of dwell time/duration for each foreign channel
269  *     (b2 b3)
270  *     (0  0 ): Default scan dwell time
271  *     (0  1 ): Reserve
272  *     (1  0 ): Shrink off channel dwell time
273  *     (1  1 ): Reserve
274  * bit 4-5: Reserve for scan
275  * bit 6-7: Define roaming policy
276  *     (b6 b7)
277  *     (0  0 ): Default roaming behavior, allow roaming in all scenarios
278  *     (0  1 ): Disallow all roaming
279  *     (1  0 ): Allow roaming when final bmissed
280  *     (1  1 ): Reserve
281  * bit 8-9: Reserve for roaming
282  * bit 10: Disable css power collapse if setting
283  * bit 11: Disable sys sleep if setting
284  * bit 12-31: Reserve for future usage
285  *
286  * |63  50|  49  |  48    |47        40|39   33|    32     |
287  * +------+------+--------+------------+-------+-----------+
288  * | RSVD | HBB  | PM-QOS |  RSVD      | RSVD  | RX Thread |
289  * +------+------+--------+------------+-------+-----------+
290  * |       common         |  TX Path   |     RX Path       |
291  *
292  * bit 39-32: Rx path related optimization
293  * bit 32: disable rx_thread for vdev
294  * bit 33-39: Reserved
295  * bit 40-47: Tx path related optimization
296  * bit 40-47: Reserved
297  * bit 48-63: common changes
298  * bit 48: Request for pm_qos vote
299  * bit 49: Request for high ddr bus bandwidth
300  *
301  * </ini>
302  */
303 #define CFG_DEFAULT_LOW_FLAGS "0xa"
304 #define CFG_LATENCY_FLAGS_LOW \
305 		CFG_INI_STRING("wlm_latency_flags_low",\
306 			       0, \
307 			       sizeof(CFG_MAX_LATENCY_FLAGS) - 1,\
308 			       CFG_DEFAULT_LOW_FLAGS, \
309 			       "WLM flags for low level")
310 
311 /*
312  * <ini>
313  * wlm_latency_flags_ultralow - WLM flags setting for ultralow level
314  *
315  * @min: 0x0
316  * @max: 0xffffffffffffffff
317  * @default: 0xc83
318  *
319  * |31  25|  24  |23  12|  11  |  10  |9    8|7    6|5    4|3    2|  1  |  0  |
320  * +------+------+------+------+------+------+------+------+------+-----+-----+
321  * | RSVD | MLMR | RSVD | SSLP | CSLP | RSVD | Roam | RSVD | DWLT | DFS | SUP |
322  * +------+------+------+-------------+-------------+-------------------------+
323  * |  WAL |  PS  |  WAL |      PS     |     Roam    |         Scan            |
324  *
325  * bit 0: Avoid scan request from HLOS if setting
326  * bit 1: Skip DFS channel SCAN if setting
327  * bit 2-3: Define policy of dwell time/duration for each foreign channel
328  *     (b2 b3)
329  *     (0  0 ): Default scan dwell time
330  *     (0  1 ): Reserve
331  *     (1  0 ): Shrink off channel dwell time
332  *     (1  1 ): Reserve
333  * bit 4-5: Reserve for scan
334  * bit 6-7: Define roaming policy
335  *     (b6 b7)
336  *     (0  0 ): Default roaming behavior, allow roaming in all scenarios
337  *     (0  1 ): Disallow all roaming
338  *     (1  0 ): Allow roaming when final bmissed
339  *     (1  1 ): Reserve
340  * bit 8-9: Reserve for roaming
341  * bit 10: Disable css power collapse if setting
342  * bit 11: Disable sys sleep if setting
343  * bit 12-23: Reserve for future usage
344  * bit 24: Disable MLMR mode
345  * bit 25-31: Reserved for future use
346  *
347  * |63  50|  49  |  48    |47        40|39   33|    32     |
348  * +------+------+--------+------------+-------+-----------+
349  * | RSVD | HBB  | PM-QOS |  RSVD      | RSVD  | RX Thread |
350  * +------+------+--------+------------+-------+-----------+
351  * |       common         |  TX Path   |     RX Path       |
352  *
353  * bit 39-32: Rx path related optimization
354  * bit 32: disable rx_thread for vdev
355  * bit 33-39: Reserved
356  * bit 40-47: Tx path related optimization
357  * bit 40-47: Reserved
358  * bit 48-63: common changes
359  * bit 48: Request for pm_qos vote
360  * bit 49: Request for high ddr bus bandwidth
361  *
362  * </ini>
363  */
364 #define CFG_DEFAULT_ULTLOW_FLAGS "0xc83"
365 #define CFG_LATENCY_FLAGS_ULTLOW \
366 		CFG_INI_STRING("wlm_latency_flags_ultralow",\
367 			       0, \
368 			       sizeof(CFG_MAX_LATENCY_FLAGS) - 1,\
369 			       CFG_DEFAULT_ULTLOW_FLAGS, \
370 			       "WLM flags for ultralow level")
371 
372 #define CFG_FE_WLM_ALL \
373 	CFG(CFG_LATENCY_ENABLE) \
374 	CFG(CFG_LATENCY_RESET) \
375 	CFG(CFG_LATENCY_LEVEL) \
376 	WLM_MULTI_CLIENT_LL_CFG \
377 	CFG(CFG_LATENCY_FLAGS_NORMAL) \
378 	CFG(CFG_LATENCY_FLAGS_XR) \
379 	CFG(CFG_LATENCY_FLAGS_LOW) \
380 	CFG(CFG_LATENCY_FLAGS_ULTLOW)
381 
382 #endif /* __CFG_MLME_FE_WLM_H */
383