xref: /wlan-driver/qcacld-3.0/core/hdd/inc/hdd_dp_cfg.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1 /*
2  * Copyright (c) 2012-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 /**
21  * DOC: This file contains centralized definitions of converged configuration.
22  */
23 
24 #ifndef __HDD_DP_CONFIG_H
25 #define __HDD_DP_CONFIG_H
26 
27 #define CFG_ENABLE_RX_THREAD		BIT(0)
28 #define CFG_ENABLE_RPS			BIT(1)
29 #define CFG_ENABLE_NAPI			BIT(2)
30 #define CFG_ENABLE_DYNAMIC_RPS		BIT(3)
31 #define CFG_ENABLE_DP_RX_THREADS	BIT(4)
32 #define CFG_RX_MODE_MAX (CFG_ENABLE_RX_THREAD | \
33 					  CFG_ENABLE_RPS | \
34 					  CFG_ENABLE_NAPI | \
35 					  CFG_ENABLE_DYNAMIC_RPS | \
36 					  CFG_ENABLE_DP_RX_THREADS)
37 #ifdef MDM_PLATFORM
38 #define CFG_RX_MODE_DEFAULT 0
39 #elif defined(HELIUMPLUS)
40 #define CFG_RX_MODE_DEFAULT CFG_ENABLE_NAPI
41 #endif
42 
43 #ifndef CFG_RX_MODE_DEFAULT
44 #if defined(FEATURE_WLAN_DP_RX_THREADS)
45 #define CFG_RX_MODE_DEFAULT (CFG_ENABLE_DP_RX_THREADS | CFG_ENABLE_NAPI)
46 #else
47 #define CFG_RX_MODE_DEFAULT (CFG_ENABLE_RX_THREAD | CFG_ENABLE_NAPI)
48 #endif
49 #endif
50 
51 /* Max # of packets to be processed in 1 tx comp loop */
52 #define CFG_DP_TX_COMP_LOOP_PKT_LIMIT_DEFAULT 64
53 #define CFG_DP_TX_COMP_LOOP_PKT_LIMIT_MAX (1024 * 1024)
54 
55 /*Max # of packets to be processed in 1 rx reap loop */
56 #define CFG_DP_RX_REAP_LOOP_PKT_LIMIT_DEFAULT 64
57 #define CFG_DP_RX_REAP_LOOP_PKT_LIMIT_MAX (1024 * 1024)
58 
59 /* Max # of HP OOS (out of sync) updates */
60 #define CFG_DP_RX_HP_OOS_UPDATE_LIMIT_DEFAULT 0
61 #define CFG_DP_RX_HP_OOS_UPDATE_LIMIT_MAX 1024
62 
63 /* Max Yield time duration for RX Softirq */
64 #define CFG_DP_RX_SOFTIRQ_MAX_YIELD_TIME_NS_DEFAULT (500 * 1000)
65 #define CFG_DP_RX_SOFTIRQ_MAX_YIELD_TIME_NS_MAX (10 * 1000 * 1000)
66 
67 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
68 
69 /*
70  * <ini>
71  * TxFlowLowWaterMark - Low watermark for pausing network queues
72  *
73  * @Min: 0
74  * @Max: 1000
75  * @Default: 300
76  *
77  * This ini specifies the low watermark of data packets transmitted
78  * before pausing netif queues in tx flow path. It is only applicable
79  * where legacy flow control is used i.e.for Rome.
80  *
81  * Related: TxFlowHighWaterMarkOffset, TxFlowMaxQueueDepth,
82  *          TxLbwFlowLowWaterMark, TxLbwFlowHighWaterMarkOffset,
83  *          TxLbwFlowMaxQueueDepth, TxHbwFlowLowWaterMark,
84  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
85  *
86  * Supported Feature: Dynamic Flow Control
87  *
88  * Usage: Internal
89  *
90  * </ini>
91  */
92 #define CFG_DP_LL_TX_FLOW_LWM \
93 		CFG_INI_UINT( \
94 		"TxFlowLowWaterMark", \
95 		0, \
96 		1000, \
97 		300, \
98 		CFG_VALUE_OR_DEFAULT, \
99 		"Low watermark for pausing network queues")
100 
101 /*
102  * <ini>
103  * TxFlowHighWaterMarkOffset - High Watermark offset to unpause Netif queues
104  * @Min: 0
105  * @Max: 300
106  * @Default: 94
107  *
108  * This ini specifies the offset to upause the netif queues
109  * when they are paused due to insufficient descriptors as guided by
110  * ini TxFlowLowWaterMark. It is only applicable where legacy flow control
111  * is used i.e.for Rome.
112  *
113  * Related: TxFlowLowWaterMark, TxFlowMaxQueueDepth,
114  *          TxLbwFlowLowWaterMark, TxLbwFlowHighWaterMarkOffset,
115  *          TxLbwFlowMaxQueueDepth, TxHbwFlowLowWaterMark,
116  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
117  *
118  * Supported Feature: Dynamic Flow Control
119  *
120  * Usage: Internal
121  *
122  * </ini>
123  */
124 #define CFG_DP_LL_TX_FLOW_HWM_OFFSET \
125 		CFG_INI_UINT( \
126 		"TxFlowHighWaterMarkOffset", \
127 		0, \
128 		300, \
129 		94, \
130 		CFG_VALUE_OR_DEFAULT, \
131 		"High Watermark offset to unpause Netif queues")
132 
133 /*
134  * <ini>
135  * TxFlowMaxQueueDepth - Max pause queue depth.
136  *
137  * @Min: 400
138  * @Max: 3500
139  * @Default: 1500
140  *
141  * This ini specifies the max queue pause depth.It is only applicable
142  * where legacy flow control is used i.e.for Rome.
143  *
144  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
145  *          TxLbwFlowLowWaterMark, TxLbwFlowHighWaterMarkOffset,
146  *          TxLbwFlowMaxQueueDepth, TxHbwFlowLowWaterMark,
147  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
148  *
149  * Supported Feature: Dynamic Flow Control
150  *
151  * Usage: Internal
152  *
153  * </ini>
154  */
155 #define CFG_DP_LL_TX_FLOW_MAX_Q_DEPTH \
156 		CFG_INI_UINT( \
157 		"TxFlowMaxQueueDepth", \
158 		400, \
159 		3500, \
160 		1500, \
161 		CFG_VALUE_OR_DEFAULT, \
162 		"Max pause queue depth")
163 
164 /*
165  * <ini>
166  * TxLbwFlowLowWaterMark - Low watermark for pausing network queues
167  *                         in low bandwidth band
168  * @Min: 0
169  * @Max: 1000
170  * @Default: 450
171  *
172  * This ini specifies the low watermark of data packets transmitted
173  * before pausing netif queues in tx flow path in low bandwidth band.
174  * It is only applicable where legacy flow control is used i.e.for Rome.
175  *
176  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
177  *          TxFlowMaxQueueDepth, TxLbwFlowHighWaterMarkOffset,
178  *          TxLbwFlowMaxQueueDepth, TxHbwFlowLowWaterMark,
179  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
180  *
181  * Supported Feature: Dynamic Flow Control
182  *
183  * Usage: Internal
184  *
185  * </ini>
186  */
187 #define CFG_DP_LL_TX_LBW_FLOW_LWM \
188 		CFG_INI_UINT( \
189 		"TxLbwFlowLowWaterMark", \
190 		0, \
191 		1000, \
192 		450, \
193 		CFG_VALUE_OR_DEFAULT, \
194 		"Low watermark for pausing network queues")
195 
196 /*
197  * <ini>
198  * TxLbwFlowHighWaterMarkOffset - High Watermark offset to unpause Netif queues
199  *                                in low bandwidth band.
200  * @Min: 0
201  * @Max: 300
202  * @Default: 50
203  *
204  * This ini specifies the offset to upause the netif queues
205  * when they are paused due to insufficient descriptors as guided by
206  * ini TxLbwFlowLowWaterMark in low bandwidth band. It is only applicable
207  * where legacy flow control is used i.e.for Rome.
208  *
209  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
210  *          TxFlowMaxQueueDepth, TxLbwFlowLowWaterMark,
211  *          TxLbwFlowMaxQueueDepth, TxHbwFlowLowWaterMark,
212  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
213  *
214  * Supported Feature: Dynamic Flow Control
215  *
216  * Usage: Internal
217  *
218  * </ini>
219  */
220 #define CFG_DP_LL_TX_LBW_FLOW_HWM_OFFSET \
221 		CFG_INI_UINT( \
222 		"TxLbwFlowHighWaterMarkOffset", \
223 		0, \
224 		300, \
225 		50, \
226 		CFG_VALUE_OR_DEFAULT, \
227 		"High Watermark offset to unpause Netif queues")
228 
229 /*
230  * <ini>
231  * TxLbwFlowMaxQueueDepth - Max pause queue depth in low bandwidth band
232  *
233  * @Min: 400
234  * @Max: 3500
235  * @Default: 750
236  *
237  * This ini specifies the max queue pause depth in low bandwidth band.
238  * It is only applicable where legacy flow control is used i.e.for Rome.
239  *
240  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
241  *          TxFlowMaxQueueDepth, TxLbwFlowLowWaterMark,
242  *          TxLbwFlowHighWaterMarkOffset, TxHbwFlowLowWaterMark,
243  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
244  *
245  * Supported Feature: Dynamic Flow Control
246  *
247  * Usage: Internal
248  *
249  * </ini>
250  */
251 #define CFG_DP_LL_TX_LBW_FLOW_MAX_Q_DEPTH \
252 		CFG_INI_UINT( \
253 		"TxLbwFlowMaxQueueDepth", \
254 		400, \
255 		3500, \
256 		750, \
257 		CFG_VALUE_OR_DEFAULT, \
258 		"Max pause queue depth in low bandwidth band")
259 
260 /*
261  * <ini>
262  * TxHbwFlowLowWaterMark - Low watermark for pausing network queues
263  *                         in high bandwidth band
264  * @Min: 0
265  * @Max: 1000
266  * @Default: 406
267  *
268  * This ini specifies the threshold of data packets transmitted
269  * before pausing netif queues.It is only applicable where
270  * legacy flow control is used i.e.for Rome.
271  *
272  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
273  *          TxFlowMaxQueueDepth, TxLbwFlowLowWaterMark,
274  *          TxLbwFlowHighWaterMarkOffset, TxLbwFlowMaxQueueDepth,
275  *          TxHbwFlowHighWaterMarkOffset, TxHbwFlowMaxQueueDepth
276  *
277  * Supported Feature: Dynamic Flow Control
278  *
279  * Usage: Internal
280  *
281  * </ini>
282  */
283 #define CFG_DP_LL_TX_HBW_FLOW_LWM \
284 		CFG_INI_UINT( \
285 		"TxHbwFlowLowWaterMark", \
286 		0, \
287 		1000, \
288 		406, \
289 		CFG_VALUE_OR_DEFAULT, \
290 		"Low watermark for pausing network queues")
291 
292 /*
293  * <ini>
294  * TxHbwFlowHighWaterMarkOffset - High Watermark offset to unpause Netif queues
295  *                                in high bandwidth band.
296  * @Min: 0
297  * @Max: 300
298  * @Default: 94
299  *
300  * This ini specifies the offset to upause the netif queues
301  * when they are paused due to insufficient descriptors as guided by
302  * ini TxHbwFlowLowWaterMark in high bandwidth band. It is only applicable
303  * where legacy flow control is used i.e.for Rome.
304  *
305  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
306  *          TxFlowMaxQueueDepth, TxLbwFlowLowWaterMark,
307  *          TxLbwFlowHighWaterMarkOffset, TxLbwFlowMaxQueueDepth,
308  *          TxHbwFlowLowWaterMark, TxHbwFlowMaxQueueDepth
309  *
310  * Supported Feature: Dynamic Flow Control
311  *
312  * Usage: Internal
313  *
314  * </ini>
315  */
316 #define CFG_DP_LL_TX_HBW_FLOW_HWM_OFFSET \
317 		CFG_INI_UINT( \
318 		"TxHbwFlowHighWaterMarkOffset", \
319 		0, \
320 		300, \
321 		94, \
322 		CFG_VALUE_OR_DEFAULT, \
323 		"High Watermark offset to unpause Netif queues")
324 
325 /*
326  * <ini>
327  * TxHbwFlowMaxQueueDepth - Max pause queue depth in high bandwidth band
328  * @Min: 4000
329  * @Max: 3500
330  * @Default: 1500
331  *
332  * This ini specifies the max queue pause depth in high bandwidth band.
333  * It is only applicable where legacy flow control is used i.e.for Rome.
334  *
335  * Related: TxFlowLowWaterMark, TxFlowHighWaterMarkOffset,
336  *          TxFlowMaxQueueDepth, TxLbwFlowLowWaterMark,
337  *          TxLbwFlowHighWaterMarkOffset, TxLbwFlowMaxQueueDepth,
338  *          TxHbwFlowLowWaterMark, TxHbwFlowHighWaterMarkOffset
339  *
340  * Supported Feature: Dynamic Flow Control
341  *
342  * Usage: Internal
343  *
344  * </ini>
345  */
346 #define CFG_DP_LL_TX_HBW_FLOW_MAX_Q_DEPTH \
347 		CFG_INI_UINT( \
348 		"TxHbwFlowMaxQueueDepth", \
349 		400, \
350 		3500, \
351 		1500, \
352 		CFG_VALUE_OR_DEFAULT, \
353 		"Max pause queue depth in high bandwidth band")
354 
355 #endif /* QCA_LL_LEGACY_TX_FLOW_CONTROL */
356 
357 #ifdef WLAN_FEATURE_MSCS
358 /*
359  * <ini>
360  * mscs_pkt_threshold - Voice pkt count threshold
361  *
362  * @Min: 0
363  * @Max: 10000
364  * @Default: 1200
365  *
366  * This ini specifies the Voice pkt count threshold to
367  * Send MSCS action frame to AP
368  *
369  * Usage: Internal
370  *
371  * </ini>
372  */
373 #define CFG_VO_PKT_COUNT_THRESHOLD \
374 		CFG_INI_UINT( \
375 		"mscs_pkt_threshold", \
376 		0, \
377 		10000, \
378 		1200, \
379 		CFG_VALUE_OR_DEFAULT, \
380 		"Voice pkt count threshold")
381 
382 /*
383  * <ini>
384  * mscs_voice_interval - mscs voice interval in sec
385  *
386  * @Min: 0
387  * @Max: 300
388  * @Default: 30
389  *
390  * This ini specifies the mscs voice interval to
391  * monitor voice tx packet count to send MSCS action frame
392  *
393  * Related: mscs_pkt_threshold
394  *
395  * Usage: Internal
396  *
397  * </ini>
398  */
399 #define CFG_MSCS_VOICE_INTERVAL \
400 		CFG_INI_UINT( \
401 		"mscs_voice_interval", \
402 		0, \
403 		300, \
404 		30, \
405 		CFG_VALUE_OR_DEFAULT, \
406 		"mscs voice interval")
407 
408 #define CFG_MSCS_FEATURE_ALL \
409 		CFG(CFG_VO_PKT_COUNT_THRESHOLD) \
410 		CFG(CFG_MSCS_VOICE_INTERVAL)
411 
412 #else
413 #define CFG_MSCS_FEATURE_ALL
414 #endif
415 
416 /*
417  * <ini>
418  * NAPI_CPU_AFFINITY_MASK - CPU mask to affine NAPIs
419  *
420  * @Min: 0
421  * @Max: 0xFF
422  * @Default: 0
423  *
424  * This ini is used to set NAPI IRQ CPU affinity
425  *
426  * Supported Feature: NAPI
427  *
428  * Usage: Internal
429  *
430  * </ini>
431  */
432 #define CFG_DP_NAPI_CE_CPU_MASK \
433 		CFG_INI_UINT( \
434 		"NAPI_CPU_AFFINITY_MASK", \
435 		0, \
436 		0xFF, \
437 		0, \
438 		CFG_VALUE_OR_DEFAULT, \
439 		"CPU mask to affine NAPIs")
440 
441 /*
442  * <ini>
443  * gWmiCreditCount - Credit count for WMI exchange
444  * @0: Not allowed
445  * @1: Serialize WMI commands, 1 command at a time
446  * @Default: 2: As advertised by FW
447  *
448  * This ini is used to serialize the WMI commandsif required.
449  *
450  * Related: None
451  *
452  * Usage: External
453  *
454  * <ini>
455  */
456 #define WLAN_CFG_WMI_CREDIT_DEFAULT	0
457 #define WLAN_CFG_WMI_CREDIT_MIN		1
458 #define WLAN_CFG_WMI_CREDIT_MAX		2
459 
460 #define CFG_DP_HTC_WMI_CREDIT_CNT \
461 		CFG_INI_UINT("gWmiCreditCount", \
462 		 WLAN_CFG_WMI_CREDIT_MIN, \
463 		 WLAN_CFG_WMI_CREDIT_MAX, \
464 		 WLAN_CFG_WMI_CREDIT_DEFAULT, \
465 		 CFG_VALUE_OR_DEFAULT, "WMI HTC CREDIT COUNT")
466 
467 #ifdef QCA_LL_LEGACY_TX_FLOW_CONTROL
468 #define CFG_HDD_DP_LEGACY_TX_FLOW \
469 	CFG(CFG_DP_LL_TX_FLOW_LWM) \
470 	CFG(CFG_DP_LL_TX_FLOW_HWM_OFFSET) \
471 	CFG(CFG_DP_LL_TX_FLOW_MAX_Q_DEPTH) \
472 	CFG(CFG_DP_LL_TX_LBW_FLOW_LWM) \
473 	CFG(CFG_DP_LL_TX_LBW_FLOW_HWM_OFFSET) \
474 	CFG(CFG_DP_LL_TX_LBW_FLOW_MAX_Q_DEPTH) \
475 	CFG(CFG_DP_LL_TX_HBW_FLOW_LWM) \
476 	CFG(CFG_DP_LL_TX_HBW_FLOW_HWM_OFFSET) \
477 	CFG(CFG_DP_LL_TX_HBW_FLOW_MAX_Q_DEPTH)
478 #else
479 #define CFG_HDD_DP_LEGACY_TX_FLOW
480 #endif
481 
482 #ifdef FEATURE_ENABLE_CE_DP_IRQ_AFFINE
483 /*
484  * <ini>
485  * Enable_ce_dp_irq_affine - Enable/disable affinity on datapath CE IRQs
486  *
487  * @Min: 0
488  * @Max: 1
489  * Default: 0
490  *
491  * This ini param is used to enable/disable the affinity on datapath
492  * Copy Engine IRQs.
493  *
494  * Supported Feature: STA/SAP
495  *
496  * Usage: External
497  *
498  * </ini>
499  */
500 #define CFG_ENABLE_CE_DP_IRQ_AFFINE CFG_INI_BOOL(\
501 			"Enable_ce_dp_irq_affine", \
502 			0, \
503 			"Enable/disable irq affinity on datapath CEs")
504 #define CFG_ENABLE_CE_DP_IRQ_AFFINE_ALL \
505 	CFG(CFG_ENABLE_CE_DP_IRQ_AFFINE)
506 #else
507 #define CFG_ENABLE_CE_DP_IRQ_AFFINE_ALL
508 #endif
509 
510 #define CFG_HDD_DP_ALL \
511 	CFG(CFG_DP_NAPI_CE_CPU_MASK) \
512 	CFG(CFG_DP_HTC_WMI_CREDIT_CNT) \
513 	CFG_MSCS_FEATURE_ALL \
514 	CFG_HDD_DP_LEGACY_TX_FLOW \
515 	CFG_ENABLE_CE_DP_IRQ_AFFINE_ALL
516 #endif
517