xref: /wlan-dirver/qca-wifi-host-cmn/wlan_cfg/wlan_cfg.c (revision f28396d060cff5c6519f883cb28ae0116ce479f1)
1 /*
2  * Copyright (c) 2016-2020 The Linux Foundation. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for
5  * any purpose with or without fee is hereby granted, provided that the
6  * above copyright notice and this permission notice appear in all
7  * copies.
8  *
9  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16  * PERFORMANCE OF THIS SOFTWARE.
17  */
18 
19 #if defined(CONFIG_HL_SUPPORT)
20 #include "wlan_tgt_def_config_hl.h"
21 #else
22 #include "wlan_tgt_def_config.h"
23 #endif
24 
25 #include "qdf_trace.h"
26 #include "qdf_mem.h"
27 #include <cdp_txrx_ops.h>
28 #include "wlan_cfg.h"
29 #include "cfg_ucfg_api.h"
30 #include "hal_api.h"
31 #include "dp_types.h"
32 
33 /*
34  * FIX THIS -
35  * For now, all these configuration parameters are hardcoded.
36  * Many of these should actually be coming from dts file/ini file
37  */
38 
39 /*
40  * The max allowed size for tx comp ring is 8191.
41  * This is limitted by h/w ring max size.
42  * As this is not a power of 2 it does not work with nss offload so the
43  * nearest available size which is power of 2 is 4096 chosen for nss
44  */
45 
46 #define WLAN_CFG_TX_RING_MASK_0 0x1
47 #define WLAN_CFG_TX_RING_MASK_1 0x2
48 #define WLAN_CFG_TX_RING_MASK_2 0x4
49 #define WLAN_CFG_TX_RING_MASK_3 0x0
50 
51 #define WLAN_CFG_RX_RING_MASK_0 0x1
52 #define WLAN_CFG_RX_RING_MASK_1 0x2
53 #define WLAN_CFG_RX_RING_MASK_2 0x4
54 #define WLAN_CFG_RX_RING_MASK_3 0x8
55 
56 #define WLAN_CFG_RX_MON_RING_MASK_0 0x1
57 #define WLAN_CFG_RX_MON_RING_MASK_1 0x2
58 #define WLAN_CFG_RX_MON_RING_MASK_2 0x4
59 #define WLAN_CFG_RX_MON_RING_MASK_3 0x0
60 
61 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0 0x1
62 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1 0x2
63 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2 0x4
64 
65 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0 0x1
66 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1 0x2
67 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2 0x4
68 
69 #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1
70 #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0
71 #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0
72 #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0
73 
74 #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1
75 #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0
76 #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0
77 #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0
78 
79 #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1
80 #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0
81 #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
82 #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
83 
84 #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
85 #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
86 #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
87 #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
88 
89 #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1
90 #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2
91 #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4
92 #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0
93 
94 #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1)
95 static const int tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
96 	WLAN_CFG_TX_RING_MASK_0, 0, 0, 0, 0, 0, 0};
97 
98 #ifndef IPA_OFFLOAD
99 static const int rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
100 	0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, WLAN_CFG_RX_RING_MASK_2, WLAN_CFG_RX_RING_MASK_3, 0, 0};
101 #else
102 static const int rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
103 	0, WLAN_CFG_RX_RING_MASK_0, WLAN_CFG_RX_RING_MASK_1, WLAN_CFG_RX_RING_MASK_2, 0, 0, 0};
104 #endif
105 
106 static const int rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
107 	0, WLAN_CFG_RX_MON_RING_MASK_0, WLAN_CFG_RX_MON_RING_MASK_1, 0, 0, 0, 0};
108 
109 static const int host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
110 	0, 0, 0, 0, 0, 0, 0};
111 
112 static const int rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
113 	0, 0, 0, 0, 0, WLAN_CFG_RXDMA2HOST_RING_MASK_0, WLAN_CFG_RXDMA2HOST_RING_MASK_1};
114 
115 static const int host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
116 	0, 0, 0, 0, 0, 0, 0};
117 
118 static const int rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
119 	0, 0, 0, 0, 0, 0, 0};
120 
121 static const int rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
122 	0, 0, 0, 0, 0, 0, WLAN_CFG_RX_ERR_RING_MASK_0};
123 
124 static const int rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
125 	0, 0, 0, 0, 0, 0, WLAN_CFG_RX_WBM_REL_RING_MASK_0};
126 
127 static const int reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
128 	0, 0, 0, 0, 0, 0, WLAN_CFG_REO_STATUS_RING_MASK_0};
129 
130 static const int tx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
131 	0, 0, 0, 0, 0, 0, 0};
132 
133 static const int rx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
134 	0, 0, 0, 0, 0, 0, 0};
135 
136 static const int rx_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
137 	0, 0, 0, 0, 0, 0, 0};
138 
139 static const int host2rxdma_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
140 	0, 0, 0, 0, 0, 0, 0};
141 
142 static const int rxdma2host_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
143 	0, 0, 0, 0, 0, 0, 0};
144 
145 static const int host2rxdma_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
146 	0, 0, 0, 0, 0, 0, 0};
147 
148 static const int rxdma2host_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
149 	0, 0, 0, 0, 0, 0, 0};
150 
151 static const int rx_err_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
152 	0, 0, 0, 0, 0, 0, 0};
153 
154 static const int rx_wbm_rel_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
155 	0, 0, 0, 0, 0, 0, 0};
156 
157 static const int reo_status_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
158 	0, 0, 0, 0, 0, 0, 0};
159 
160 #else
161 
162 static const int tx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
163 						WLAN_CFG_TX_RING_MASK_0,
164 						WLAN_CFG_TX_RING_MASK_1,
165 						WLAN_CFG_TX_RING_MASK_2,
166 						WLAN_CFG_TX_RING_MASK_3};
167 
168 static const int rx_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
169 					WLAN_CFG_RX_RING_MASK_0,
170 					WLAN_CFG_RX_RING_MASK_1,
171 					WLAN_CFG_RX_RING_MASK_2,
172 					WLAN_CFG_RX_RING_MASK_3};
173 
174 static const int rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
175 					0, 0, 0};
176 
177 static const int host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
178 					0, 0, 0, 0};
179 
180 static const int rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
181 					0, 0, 0, 0};
182 
183 static const int host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
184 					WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
185 					WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
186 					WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
187 
188 static const int rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
189 					WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
190 					WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
191 					WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
192 
193 static const int rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
194 					WLAN_CFG_RX_ERR_RING_MASK_0,
195 					WLAN_CFG_RX_ERR_RING_MASK_1,
196 					WLAN_CFG_RX_ERR_RING_MASK_2,
197 					WLAN_CFG_RX_ERR_RING_MASK_3};
198 
199 static const int rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
200 					WLAN_CFG_RX_WBM_REL_RING_MASK_0,
201 					WLAN_CFG_RX_WBM_REL_RING_MASK_1,
202 					WLAN_CFG_RX_WBM_REL_RING_MASK_2,
203 					WLAN_CFG_RX_WBM_REL_RING_MASK_3};
204 
205 static const int reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = {
206 					WLAN_CFG_REO_STATUS_RING_MASK_0,
207 					WLAN_CFG_REO_STATUS_RING_MASK_1,
208 					WLAN_CFG_REO_STATUS_RING_MASK_2,
209 					WLAN_CFG_REO_STATUS_RING_MASK_3};
210 
211 static const int tx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
212 						WLAN_CFG_TX_RING_MASK_0,
213 						WLAN_CFG_TX_RING_MASK_1,
214 						WLAN_CFG_TX_RING_MASK_2,
215 						WLAN_CFG_TX_RING_MASK_3};
216 
217 static const int rx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
218 					0,
219 					0,
220 					0,
221 					0,
222 					0,
223 					0,
224 					0,
225 					WLAN_CFG_RX_RING_MASK_0,
226 					WLAN_CFG_RX_RING_MASK_1,
227 					WLAN_CFG_RX_RING_MASK_2,
228 					WLAN_CFG_RX_RING_MASK_3};
229 
230 static const int rx_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
231 					0,
232 					0,
233 					0,
234 					0,
235 					WLAN_CFG_RX_MON_RING_MASK_0,
236 					WLAN_CFG_RX_MON_RING_MASK_1,
237 					WLAN_CFG_RX_MON_RING_MASK_2};
238 
239 static const int host2rxdma_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
240 					WLAN_CFG_HOST2RXDMA_RING_MASK_0,
241 					WLAN_CFG_HOST2RXDMA_RING_MASK_1,
242 					WLAN_CFG_HOST2RXDMA_RING_MASK_2,
243 					WLAN_CFG_HOST2RXDMA_RING_MASK_3};
244 
245 static const int rxdma2host_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
246 					WLAN_CFG_RXDMA2HOST_RING_MASK_0,
247 					WLAN_CFG_RXDMA2HOST_RING_MASK_1,
248 					WLAN_CFG_RXDMA2HOST_RING_MASK_2,
249 					WLAN_CFG_RXDMA2HOST_RING_MASK_3};
250 
251 static const int host2rxdma_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
252 					0,
253 					0,
254 					0,
255 					0,
256 					WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0,
257 					WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1,
258 					WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2};
259 
260 static const int rxdma2host_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
261 					0,
262 					0,
263 					0,
264 					0,
265 					WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0,
266 					WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1,
267 					WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2};
268 
269 static const int rx_err_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
270 					WLAN_CFG_RX_ERR_RING_MASK_0,
271 					WLAN_CFG_RX_ERR_RING_MASK_1,
272 					WLAN_CFG_RX_ERR_RING_MASK_2,
273 					WLAN_CFG_RX_ERR_RING_MASK_3};
274 
275 static const int rx_wbm_rel_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
276 					WLAN_CFG_RX_WBM_REL_RING_MASK_0,
277 					WLAN_CFG_RX_WBM_REL_RING_MASK_1,
278 					WLAN_CFG_RX_WBM_REL_RING_MASK_2,
279 					WLAN_CFG_RX_WBM_REL_RING_MASK_3};
280 
281 static const int reo_status_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = {
282 					WLAN_CFG_REO_STATUS_RING_MASK_0,
283 					WLAN_CFG_REO_STATUS_RING_MASK_1,
284 					WLAN_CFG_REO_STATUS_RING_MASK_2,
285 					WLAN_CFG_REO_STATUS_RING_MASK_3};
286 #endif /* MAX_PDEV_CNT == 1 */
287 
288 /**
289  * g_wlan_srng_cfg[] - Per ring_type specific configuration
290  *
291  */
292 struct wlan_srng_cfg g_wlan_srng_cfg[MAX_RING_TYPES];
293 
294 /* REO_DST ring configuration */
295 struct wlan_srng_cfg wlan_srng_reo_cfg = {
296 	.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING,
297 	.batch_count_threshold = 0,
298 	.low_threshold = 0,
299 };
300 
301 /* WBM2SW_RELEASE ring configuration */
302 struct wlan_srng_cfg wlan_srng_wbm_release_cfg = {
303 	.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING,
304 	.batch_count_threshold = 0,
305 	.low_threshold = 0,
306 };
307 
308 /* RXDMA_BUF ring configuration */
309 struct wlan_srng_cfg wlan_srng_rxdma_buf_cfg = {
310 	.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
311 	.batch_count_threshold = 0,
312 	.low_threshold = WLAN_CFG_RXDMA_REFILL_RING_SIZE >> 3,
313 };
314 
315 /* RXDMA_MONITOR_BUF ring configuration */
316 struct wlan_srng_cfg wlan_srng_rxdma_monitor_buf_cfg = {
317 	.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
318 	.batch_count_threshold = 0,
319 	.low_threshold = WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE >> 3,
320 };
321 
322 /* RXDMA_MONITOR_STATUS ring configuration */
323 struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = {
324 	.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX,
325 	.batch_count_threshold = 0,
326 	.low_threshold = WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE >> 3,
327 };
328 
329 /* DEFAULT_CONFIG ring configuration */
330 struct wlan_srng_cfg wlan_srng_default_cfg = {
331 	.timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_OTHER,
332 	.batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_OTHER,
333 	.low_threshold = 0,
334 };
335 
336 void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg)
337 {
338 	g_wlan_srng_cfg[REO_DST] = wlan_srng_reo_cfg;
339 	g_wlan_srng_cfg[WBM2SW_RELEASE] = wlan_srng_wbm_release_cfg;
340 	g_wlan_srng_cfg[REO_EXCEPTION] = wlan_srng_default_cfg;
341 	g_wlan_srng_cfg[REO_REINJECT] = wlan_srng_default_cfg;
342 	g_wlan_srng_cfg[REO_CMD] = wlan_srng_default_cfg;
343 	g_wlan_srng_cfg[REO_STATUS] = wlan_srng_default_cfg;
344 	g_wlan_srng_cfg[TCL_DATA] = wlan_srng_default_cfg;
345 	g_wlan_srng_cfg[TCL_CMD] = wlan_srng_default_cfg;
346 	g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg;
347 	g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg;
348 	g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg;
349 	g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg;
350 	g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg;
351 	g_wlan_srng_cfg[RXDMA_MONITOR_BUF] =
352 			wlan_srng_rxdma_monitor_buf_cfg;
353 	g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] =
354 			wlan_srng_rxdma_monitor_status_cfg;
355 	g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg;
356 	g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg;
357 	g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg;
358 #ifdef WLAN_FEATURE_CIF_CFR
359 	g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg;
360 #endif
361 	*wlan_cfg = g_wlan_srng_cfg;
362 }
363 
364 static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = {
365 	0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2,
366 	0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0,
367 	0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4,
368 	0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c,
369 	0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa
370 };
371 
372 void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx,
373 				     int interrupt_mode,
374 				     bool is_monitor_mode) {
375 	int i = 0;
376 
377 	if (interrupt_mode == DP_INTR_INTEGRATED) {
378 		for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
379 			wlan_cfg_ctx->int_tx_ring_mask[i] =
380 					tx_ring_mask_integrated[i];
381 			wlan_cfg_ctx->int_rx_ring_mask[i] =
382 					rx_ring_mask_integrated[i];
383 			wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
384 				rx_mon_ring_mask_integrated[i];
385 			wlan_cfg_ctx->int_rx_err_ring_mask[i] =
386 				rx_err_ring_mask_integrated[i];
387 			wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
388 					rx_wbm_rel_ring_mask_integrated[i];
389 			wlan_cfg_ctx->int_reo_status_ring_mask[i] =
390 					reo_status_ring_mask_integrated[i];
391 			wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
392 				rxdma2host_ring_mask_integrated[i];
393 			wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
394 				host2rxdma_ring_mask_integrated[i];
395 			wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
396 				host2rxdma_mon_ring_mask_integrated[i];
397 			wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
398 				rxdma2host_mon_ring_mask_integrated[i];
399 		}
400 	} else if (interrupt_mode == DP_INTR_MSI || interrupt_mode ==
401 		   DP_INTR_POLL) {
402 		for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
403 			wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i];
404 			wlan_cfg_ctx->int_rx_mon_ring_mask[i] =
405 				rx_mon_ring_mask_msi[i];
406 			wlan_cfg_ctx->int_rx_err_ring_mask[i] =
407 				rx_err_ring_mask_msi[i];
408 			wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
409 						rx_wbm_rel_ring_mask_msi[i];
410 			wlan_cfg_ctx->int_reo_status_ring_mask[i] =
411 						reo_status_ring_mask_msi[i];
412 			if (is_monitor_mode) {
413 				wlan_cfg_ctx->int_rx_ring_mask[i] = 0;
414 				wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 0;
415 			} else {
416 				wlan_cfg_ctx->int_rx_ring_mask[i] =
417 					rx_ring_mask_msi[i];
418 				wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
419 					rxdma2host_ring_mask_msi[i];
420 			}
421 			wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
422 				host2rxdma_ring_mask_msi[i];
423 			wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] =
424 				host2rxdma_mon_ring_mask_msi[i];
425 			wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] =
426 				rxdma2host_mon_ring_mask_msi[i];
427 		}
428 	} else {
429 		qdf_err("Interrupt mode %d", interrupt_mode);
430 	}
431 }
432 
433 /**
434  * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
435  * @psoc - Object manager psoc
436  * Return: wlan_cfg_ctx - Handle to Configuration context
437  */
438 struct wlan_cfg_dp_soc_ctxt *
439 wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc)
440 {
441 	struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
442 		qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
443 
444 	if (!wlan_cfg_ctx)
445 		return NULL;
446 
447 	wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE;
448 	wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
449 	wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
450 	wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
451 	wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
452 	wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
453 	wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
454 	wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
455 	wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
456 	wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
457 	wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
458 						     CFG_DP_TX_EXT_DESC_POOLS);
459 	wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
460 	wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN;
461 	wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
462 	wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
463 	wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
464 
465 	wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
466 	wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
467 						  CFG_DP_TX_COMPL_RING_SIZE);
468 
469 	wlan_cfg_ctx->tx_comp_ring_size_nss =
470 		cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
471 
472 	wlan_cfg_ctx->int_batch_threshold_tx =
473 			cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
474 	wlan_cfg_ctx->int_timer_threshold_tx =
475 			cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
476 	wlan_cfg_ctx->int_batch_threshold_rx =
477 			cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
478 	wlan_cfg_ctx->int_timer_threshold_rx =
479 			cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
480 	wlan_cfg_ctx->int_batch_threshold_other =
481 		cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
482 	wlan_cfg_ctx->int_timer_threshold_other =
483 		cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
484 	wlan_cfg_ctx->pktlog_buffer_size =
485 		cfg_get(psoc, CFG_DP_PKTLOG_BUFFER_SIZE);
486 
487 	/* This is default mapping and can be overridden by HW config
488 	 * received from FW */
489 	wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 0, 0);
490 	if (MAX_PDEV_CNT > 1)
491 		wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 1, 2);
492 	if (MAX_PDEV_CNT > 2)
493 		wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 2, 1);
494 
495 	wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
496 
497 	wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
498 	wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
499 	wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
500 	wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
501 	wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
502 	wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
503 	wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
504 	wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
505 	wlan_cfg_ctx->peer_flow_ctrl_enabled =
506 			cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
507 	wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
508 	/*Enable checksum offload by default*/
509 	wlan_cfg_ctx->tcp_udp_checksumoffload =
510 			cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
511 	wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING);
512 	wlan_cfg_ctx->defrag_timeout_check =
513 			cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
514 	wlan_cfg_ctx->rx_defrag_min_timeout =
515 			cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
516 
517 	wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
518 						 CFG_DP_WBM_RELEASE_RING);
519 	wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
520 					     CFG_DP_TCL_CMD_RING);
521 	wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
522 						CFG_DP_TCL_STATUS_RING);
523 	wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
524 						  CFG_DP_REO_REINJECT_RING);
525 	wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
526 						CFG_DP_RX_RELEASE_RING);
527 	wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
528 						   CFG_DP_REO_EXCEPTION_RING);
529 	wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
530 					     CFG_DP_REO_CMD_RING);
531 	wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
532 						CFG_DP_REO_STATUS_RING);
533 	wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
534 						  CFG_DP_RXDMA_REFILL_RING);
535 	wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc,
536 						CFG_DP_TX_DESC_LIMIT_0);
537 	wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc,
538 						CFG_DP_TX_DESC_LIMIT_1);
539 	wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc,
540 						CFG_DP_TX_DESC_LIMIT_2);
541 	wlan_cfg_ctx->tx_device_limit = cfg_get(psoc,
542 						CFG_DP_TX_DEVICE_LIMIT);
543 	wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc,
544 						CFG_DP_TX_SW_INTERNODE_QUEUE);
545 	wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
546 						   CFG_DP_RXDMA_ERR_DST_RING);
547 	wlan_cfg_ctx->enable_data_stall_detection =
548 		cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION);
549 	wlan_cfg_ctx->tx_flow_start_queue_offset =
550 		cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET);
551 	wlan_cfg_ctx->tx_flow_stop_queue_threshold =
552 		cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH);
553 	wlan_cfg_ctx->disable_intra_bss_fwd =
554 		cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION);
555 	wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc,
556 						   CFG_DP_RX_SW_DESC_WEIGHT);
557 	wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key;
558 	wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH;
559 	wlan_cfg_ctx->is_rx_flow_tag_enabled =
560 			cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE);
561 	wlan_cfg_ctx->is_rx_flow_search_table_per_pdev =
562 			cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV);
563 	wlan_cfg_ctx->rx_flow_search_table_size =
564 			cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE);
565 	wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled =
566 			cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE);
567 	wlan_cfg_ctx->mon_drop_thresh =
568 		cfg_get(psoc, CFG_DP_RXDMA_MONITOR_RX_DROP_THRESHOLD);
569 	return wlan_cfg_ctx;
570 }
571 
572 void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
573 {
574 	qdf_mem_free(wlan_cfg_ctx);
575 }
576 
577 struct wlan_cfg_dp_pdev_ctxt *
578 wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
579 {
580 	struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
581 		qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
582 
583 	if (!wlan_cfg_ctx)
584 		return NULL;
585 
586 	wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
587 					CFG_DP_RXDMA_BUF_RING);
588 	wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
589 					CFG_DP_RXDMA_MONITOR_BUF_RING);
590 	wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
591 					CFG_DP_RXDMA_MONITOR_DST_RING);
592 	wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
593 					CFG_DP_RXDMA_MONITOR_STATUS_RING);
594 	wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
595 					CFG_DP_RXDMA_MONITOR_DESC_RING);
596 	wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
597 
598 	return wlan_cfg_ctx;
599 }
600 
601 void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
602 {
603 	if (wlan_cfg_ctx)
604 		qdf_mem_free(wlan_cfg_ctx);
605 }
606 
607 int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg)
608 {
609 	return cfg->mon_drop_thresh;
610 }
611 
612 void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
613 {
614 	cfg->num_int_ctxts = num;
615 }
616 
617 void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
618 {
619 	cfg->max_peer_id = val;
620 }
621 
622 void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
623 {
624 	cfg->max_ast_idx = val;
625 }
626 
627 int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
628 {
629 	return cfg->max_ast_idx;
630 }
631 
632 void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
633 		int context, int mask)
634 {
635 	cfg->int_tx_ring_mask[context] = mask;
636 }
637 
638 void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
639 			       int context, int mask)
640 {
641 	cfg->int_rx_ring_mask[context] = mask;
642 }
643 
644 void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
645 		int context, int mask)
646 {
647 	cfg->int_rx_mon_ring_mask[context] = mask;
648 }
649 
650 int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
651 					  int context)
652 {
653 	return cfg->int_host2rxdma_mon_ring_mask[context];
654 }
655 
656 void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
657 					   int context, int mask)
658 {
659 	cfg->int_host2rxdma_mon_ring_mask[context] = mask;
660 }
661 
662 int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
663 					  int context)
664 {
665 	return cfg->int_rxdma2host_mon_ring_mask[context];
666 }
667 
668 void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
669 					   int context, int mask)
670 {
671 	cfg->int_rxdma2host_mon_ring_mask[context] = mask;
672 }
673 
674 void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
675 	int context, int mask)
676 {
677 	cfg->int_rxdma2host_ring_mask[context] = mask;
678 }
679 
680 int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
681 	int context)
682 {
683 	return cfg->int_rxdma2host_ring_mask[context];
684 }
685 
686 void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
687 	int context, int mask)
688 {
689 	cfg->int_host2rxdma_ring_mask[context] = mask;
690 }
691 
692 int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
693 	int context)
694 {
695 	return cfg->int_host2rxdma_ring_mask[context];
696 }
697 
698 void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
699 			     int hw_macid)
700 {
701 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
702 	cfg->hw_macid[pdev_idx] = hw_macid;
703 }
704 
705 int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
706 {
707 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
708 	return cfg->hw_macid[pdev_idx];
709 }
710 
711 int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg,
712 				int hw_macid)
713 {
714 	int idx;
715 
716 	for (idx = 0; idx < MAX_NUM_LMAC_HW; idx++) {
717 		if (cfg->hw_macid[idx] == hw_macid)
718 			return (idx + 1);
719 	}
720 	qdf_assert_always(idx < MAX_PDEV_CNT);
721 	return WLAN_INVALID_PDEV_ID;
722 }
723 
724 void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
725 			   int hw_macid)
726 {
727 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
728 	qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
729 
730 	cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx;
731 }
732 
733 int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid)
734 {
735 	qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
736 	return cfg->hw_macid_pdev_id_map[hw_macid];
737 }
738 
739 void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
740 		int context, int mask)
741 {
742 	cfg->int_ce_ring_mask[context] = mask;
743 }
744 
745 void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
746 		int mask)
747 {
748 	cfg->int_rx_ring_mask[context] = mask;
749 }
750 
751 int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
752 		int context, int mask)
753 {
754 	return cfg->int_rx_err_ring_mask[context] = mask;
755 }
756 
757 int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
758 		int context, int mask)
759 {
760 	return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
761 }
762 
763 int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
764 		int context, int mask)
765 {
766 	return cfg->int_reo_status_ring_mask[context] = mask;
767 }
768 
769 int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
770 {
771 	return cfg->num_int_ctxts;
772 }
773 
774 int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
775 {
776 	return cfg->int_tx_ring_mask[context];
777 }
778 
779 int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
780 {
781 	return cfg->int_rx_ring_mask[context];
782 }
783 
784 int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
785 						int context)
786 {
787 	return cfg->int_rx_err_ring_mask[context];
788 }
789 
790 int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
791 					int context)
792 {
793 	return cfg->int_rx_wbm_rel_ring_mask[context];
794 }
795 
796 int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
797 					int context)
798 {
799 	return cfg->int_reo_status_ring_mask[context];
800 }
801 
802 int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
803 {
804 	return cfg->int_rx_mon_ring_mask[context];
805 }
806 
807 int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
808 {
809 	return cfg->int_ce_ring_mask[context];
810 }
811 
812 uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
813 {
814 	return cfg->max_clients;
815 }
816 
817 uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
818 {
819 	return cfg->max_alloc_size;
820 }
821 
822 int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
823 {
824 	return cfg->per_pdev_tx_ring;
825 }
826 
827 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
828 {
829 	return cfg->per_pdev_lmac_ring;
830 }
831 
832 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
833 {
834 	return cfg->num_tcl_data_rings;
835 }
836 
837 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
838 {
839 	return cfg->tx_ring_size;
840 }
841 
842 int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
843 {
844 	return cfg->tx_comp_ring_size;
845 }
846 
847 int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
848 {
849 	return cfg->per_pdev_rx_ring;
850 }
851 
852 int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
853 {
854 	return cfg->num_reo_dest_rings;
855 }
856 
857 int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
858 {
859 	return cfg->htt_packet_type;            /*htt_pkt_type_ethernet*/
860 }
861 
862 int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
863 {
864 	return cfg->num_tx_desc_pool;
865 }
866 
867 void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
868 {
869 	cfg->num_tx_desc_pool = num_pool;
870 }
871 
872 int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
873 {
874 	return cfg->num_tx_ext_desc_pool;
875 }
876 
877 void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
878 {
879 	cfg->num_tx_ext_desc_pool = num_pool;
880 }
881 
882 int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
883 {
884 	return cfg->reo_dst_ring_size;
885 }
886 
887 void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
888 				    int reo_dst_ring_size)
889 {
890 	cfg->reo_dst_ring_size = reo_dst_ring_size;
891 }
892 
893 void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
894 			       bool raw_mode_war)
895 {
896 	cfg->raw_mode_war = raw_mode_war;
897 }
898 
899 bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
900 {
901 	return cfg->raw_mode_war;
902 }
903 
904 int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
905 {
906 	return cfg->num_tx_desc;
907 }
908 
909 void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
910 {
911 	cfg->num_tx_desc = num_desc;
912 }
913 
914 int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
915 {
916 	return cfg->min_tx_desc;
917 }
918 
919 int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
920 {
921 	return cfg->num_tx_ext_desc;
922 }
923 
924 void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
925 {
926 	cfg->num_tx_ext_desc = num_ext_desc;
927 }
928 
929 uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
930 {
931 	/* TODO: This should be calculated based on target capabilities */
932 	return cfg->max_peer_id;
933 }
934 
935 int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
936 {
937 	return  cfg->dma_mon_buf_ring_size;
938 }
939 
940 int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
941 {
942 	return  cfg->dma_mon_dest_ring_size;
943 }
944 
945 int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
946 {
947 	return  cfg->dma_mon_status_ring_size;
948 }
949 
950 int
951 wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
952 {
953 	return cfg->rxdma_monitor_desc_ring;
954 }
955 
956 int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
957 {
958 	return  cfg->rx_dma_buf_ring_size;
959 }
960 
961 int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
962 {
963 	return  cfg->num_mac_rings;
964 }
965 
966 bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
967 {
968 	return  cfg->gro_enabled;
969 }
970 
971 bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
972 {
973 	return  cfg->lro_enabled;
974 }
975 
976 bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
977 {
978 	return  cfg->ipa_enabled;
979 }
980 
981 void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
982 {
983 	cfg->rx_hash = val;
984 }
985 
986 bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
987 {
988 	return  cfg->rx_hash;
989 }
990 
991 int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
992 {
993 	return  cfg->nss_enabled;
994 }
995 
996 void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
997 {
998 	cfg->nss_enabled = nss_enabled;
999 }
1000 
1001 int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
1002 {
1003 	return  cfg->nss_cfg;
1004 }
1005 
1006 void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
1007 {
1008 	cfg->nss_cfg = nss_cfg;
1009 	if (cfg->nss_cfg)
1010 		cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
1011 }
1012 
1013 int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
1014 {
1015 	return cfg->int_batch_threshold_tx;
1016 }
1017 
1018 int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
1019 {
1020 	return cfg->int_timer_threshold_tx;
1021 }
1022 
1023 int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
1024 {
1025 	return cfg->int_batch_threshold_rx;
1026 }
1027 
1028 int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
1029 {
1030 	return cfg->int_timer_threshold_rx;
1031 }
1032 
1033 int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
1034 {
1035 	return cfg->int_batch_threshold_other;
1036 }
1037 
1038 int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
1039 {
1040 	return cfg->int_timer_threshold_other;
1041 }
1042 
1043 int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
1044 {
1045 	return cfg->int_timer_threshold_mon;
1046 }
1047 
1048 int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
1049 {
1050 	return cfg->tcp_udp_checksumoffload;
1051 }
1052 
1053 int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
1054 {
1055 	return cfg->rx_defrag_min_timeout;
1056 }
1057 
1058 int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
1059 {
1060 	return cfg->defrag_timeout_check;
1061 }
1062 
1063 int
1064 wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1065 {
1066 	return cfg->wbm_release_ring;
1067 }
1068 
1069 int
1070 wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1071 {
1072 	return cfg->tcl_cmd_ring;
1073 }
1074 
1075 int
1076 wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1077 {
1078 	return cfg->tcl_status_ring;
1079 }
1080 
1081 int
1082 wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1083 {
1084 	return cfg->reo_reinject_ring;
1085 }
1086 
1087 int
1088 wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1089 {
1090 	return cfg->rx_release_ring;
1091 }
1092 
1093 int
1094 wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1095 {
1096 	return cfg->reo_exception_ring;
1097 }
1098 
1099 int
1100 wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1101 {
1102 	return cfg->reo_cmd_ring;
1103 }
1104 
1105 int
1106 wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1107 {
1108 	return cfg->reo_status_ring;
1109 }
1110 
1111 int
1112 wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1113 {
1114 	return cfg->rxdma_refill_ring;
1115 }
1116 
1117 int
1118 wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
1119 {
1120 	return cfg->tx_desc_limit_0;
1121 }
1122 
1123 int
1124 wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
1125 {
1126 	return cfg->tx_desc_limit_1;
1127 }
1128 
1129 int
1130 wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
1131 {
1132 	return cfg->tx_desc_limit_2;
1133 }
1134 
1135 int
1136 wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
1137 {
1138 	return cfg->tx_device_limit;
1139 }
1140 
1141 int
1142 wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
1143 {
1144 	return cfg->tx_sw_internode_queue;
1145 }
1146 
1147 int
1148 wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1149 {
1150 	return cfg->rxdma_err_dst_ring;
1151 }
1152 
1153 int
1154 wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
1155 {
1156 	return cfg->rx_sw_desc_weight;
1157 }
1158 
1159 bool
1160 wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
1161 		     enum cdp_capabilities dp_caps)
1162 {
1163 	switch (dp_caps) {
1164 	case CDP_CFG_DP_TSO:
1165 		return cfg->tso_enabled;
1166 	case CDP_CFG_DP_LRO:
1167 		return cfg->lro_enabled;
1168 	case CDP_CFG_DP_SG:
1169 		return cfg->sg_enabled;
1170 	case CDP_CFG_DP_GRO:
1171 		return cfg->gro_enabled;
1172 	case CDP_CFG_DP_OL_TX_CSUM:
1173 		return cfg->ol_tx_csum_enabled;
1174 	case CDP_CFG_DP_OL_RX_CSUM:
1175 		return cfg->ol_rx_csum_enabled;
1176 	case CDP_CFG_DP_RAWMODE:
1177 		return cfg->rawmode_enabled;
1178 	case CDP_CFG_DP_PEER_FLOW_CTRL:
1179 		return cfg->peer_flow_ctrl_enabled;
1180 	default:
1181 		return false;
1182 	}
1183 }
1184 
1185 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
1186 /**
1187  * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
1188  * @cfg: config context
1189  *
1190  * Return: stop threshold
1191  */
1192 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
1193 {
1194 	return cfg->tx_flow_stop_queue_threshold;
1195 }
1196 
1197 /**
1198  * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
1199  *					for TX to resume
1200  * @cfg: config context
1201  *
1202  * Return: stop threshold
1203  */
1204 int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
1205 {
1206 	return cfg->tx_flow_start_queue_offset;
1207 }
1208 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
1209 
1210 void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
1211 				      bool val)
1212 {
1213 	cfg->is_rx_flow_tag_enabled = val;
1214 }
1215 
1216 uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
1217 {
1218 	return cfg->rx_toeplitz_hash_key;
1219 }
1220 
1221 uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
1222 {
1223 	return cfg->rx_flow_max_search;
1224 }
1225 
1226 bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
1227 {
1228 	return cfg->is_rx_flow_tag_enabled;
1229 }
1230 
1231 void
1232 wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
1233 					   bool val)
1234 {
1235 	cfg->is_rx_flow_search_table_per_pdev = val;
1236 }
1237 
1238 bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
1239 {
1240 	return cfg->is_rx_flow_search_table_per_pdev;
1241 }
1242 
1243 void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
1244 					    uint16_t val)
1245 {
1246 	cfg->rx_flow_search_table_size = val;
1247 }
1248 
1249 uint16_t
1250 wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1251 {
1252 	return  cfg->rx_flow_search_table_size;
1253 }
1254 
1255 void
1256 wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
1257 					      bool val)
1258 {
1259 	cfg->is_rx_mon_protocol_flow_tag_enabled = val;
1260 }
1261 
1262 bool
1263 wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
1264 {
1265 	return cfg->is_rx_mon_protocol_flow_tag_enabled;
1266 }
1267