xref: /wlan-dirver/qca-wifi-host-cmn/wlan_cfg/wlan_cfg.c (revision fed4bfb04901bc53e8f21d8cfd8d4a151e546d11)
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 	wlan_cfg_ctx->is_rx_fisa_enabled = cfg_get(psoc, CFG_DP_RX_FISA_ENABLE);
570 	return wlan_cfg_ctx;
571 }
572 
573 void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
574 {
575 	qdf_mem_free(wlan_cfg_ctx);
576 }
577 
578 struct wlan_cfg_dp_pdev_ctxt *
579 wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc)
580 {
581 	struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
582 		qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
583 
584 	if (!wlan_cfg_ctx)
585 		return NULL;
586 
587 	wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
588 					CFG_DP_RXDMA_BUF_RING);
589 	wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
590 					CFG_DP_RXDMA_MONITOR_BUF_RING);
591 	wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
592 					CFG_DP_RXDMA_MONITOR_DST_RING);
593 	wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
594 					CFG_DP_RXDMA_MONITOR_STATUS_RING);
595 	wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
596 					CFG_DP_RXDMA_MONITOR_DESC_RING);
597 	wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
598 
599 	return wlan_cfg_ctx;
600 }
601 
602 void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
603 {
604 	if (wlan_cfg_ctx)
605 		qdf_mem_free(wlan_cfg_ctx);
606 }
607 
608 int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg)
609 {
610 	return cfg->mon_drop_thresh;
611 }
612 
613 void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
614 {
615 	cfg->num_int_ctxts = num;
616 }
617 
618 void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
619 {
620 	cfg->max_peer_id = val;
621 }
622 
623 void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
624 {
625 	cfg->max_ast_idx = val;
626 }
627 
628 int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg)
629 {
630 	return cfg->max_ast_idx;
631 }
632 
633 void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
634 		int context, int mask)
635 {
636 	cfg->int_tx_ring_mask[context] = mask;
637 }
638 
639 void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
640 			       int context, int mask)
641 {
642 	cfg->int_rx_ring_mask[context] = mask;
643 }
644 
645 void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
646 		int context, int mask)
647 {
648 	cfg->int_rx_mon_ring_mask[context] = mask;
649 }
650 
651 int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
652 					  int context)
653 {
654 	return cfg->int_host2rxdma_mon_ring_mask[context];
655 }
656 
657 void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
658 					   int context, int mask)
659 {
660 	cfg->int_host2rxdma_mon_ring_mask[context] = mask;
661 }
662 
663 int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
664 					  int context)
665 {
666 	return cfg->int_rxdma2host_mon_ring_mask[context];
667 }
668 
669 void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
670 					   int context, int mask)
671 {
672 	cfg->int_rxdma2host_mon_ring_mask[context] = mask;
673 }
674 
675 void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
676 	int context, int mask)
677 {
678 	cfg->int_rxdma2host_ring_mask[context] = mask;
679 }
680 
681 int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
682 	int context)
683 {
684 	return cfg->int_rxdma2host_ring_mask[context];
685 }
686 
687 void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
688 	int context, int mask)
689 {
690 	cfg->int_host2rxdma_ring_mask[context] = mask;
691 }
692 
693 int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
694 	int context)
695 {
696 	return cfg->int_host2rxdma_ring_mask[context];
697 }
698 
699 void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
700 			     int hw_macid)
701 {
702 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
703 	cfg->hw_macid[pdev_idx] = hw_macid;
704 }
705 
706 int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
707 {
708 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
709 	return cfg->hw_macid[pdev_idx];
710 }
711 
712 int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg,
713 				int hw_macid)
714 {
715 	int idx;
716 
717 	for (idx = 0; idx < MAX_NUM_LMAC_HW; idx++) {
718 		if (cfg->hw_macid[idx] == hw_macid)
719 			return (idx + 1);
720 	}
721 	qdf_assert_always(idx < MAX_PDEV_CNT);
722 	return WLAN_INVALID_PDEV_ID;
723 }
724 
725 void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
726 			   int hw_macid)
727 {
728 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
729 	qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
730 
731 	cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx;
732 }
733 
734 int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid)
735 {
736 	qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW);
737 	return cfg->hw_macid_pdev_id_map[hw_macid];
738 }
739 
740 void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
741 		int context, int mask)
742 {
743 	cfg->int_ce_ring_mask[context] = mask;
744 }
745 
746 void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
747 		int mask)
748 {
749 	cfg->int_rx_ring_mask[context] = mask;
750 }
751 
752 int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
753 		int context, int mask)
754 {
755 	return cfg->int_rx_err_ring_mask[context] = mask;
756 }
757 
758 int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
759 		int context, int mask)
760 {
761 	return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
762 }
763 
764 int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
765 		int context, int mask)
766 {
767 	return cfg->int_reo_status_ring_mask[context] = mask;
768 }
769 
770 int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
771 {
772 	return cfg->num_int_ctxts;
773 }
774 
775 int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
776 {
777 	return cfg->int_tx_ring_mask[context];
778 }
779 
780 int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
781 {
782 	return cfg->int_rx_ring_mask[context];
783 }
784 
785 int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
786 						int context)
787 {
788 	return cfg->int_rx_err_ring_mask[context];
789 }
790 
791 int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
792 					int context)
793 {
794 	return cfg->int_rx_wbm_rel_ring_mask[context];
795 }
796 
797 int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
798 					int context)
799 {
800 	return cfg->int_reo_status_ring_mask[context];
801 }
802 
803 int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
804 {
805 	return cfg->int_rx_mon_ring_mask[context];
806 }
807 
808 int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
809 {
810 	return cfg->int_ce_ring_mask[context];
811 }
812 
813 uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
814 {
815 	return cfg->max_clients;
816 }
817 
818 uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
819 {
820 	return cfg->max_alloc_size;
821 }
822 
823 int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
824 {
825 	return cfg->per_pdev_tx_ring;
826 }
827 
828 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
829 {
830 	return cfg->per_pdev_lmac_ring;
831 }
832 
833 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
834 {
835 	return cfg->num_tcl_data_rings;
836 }
837 
838 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
839 {
840 	return cfg->tx_ring_size;
841 }
842 
843 int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
844 {
845 	return cfg->tx_comp_ring_size;
846 }
847 
848 int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
849 {
850 	return cfg->per_pdev_rx_ring;
851 }
852 
853 int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
854 {
855 	return cfg->num_reo_dest_rings;
856 }
857 
858 int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
859 {
860 	return cfg->htt_packet_type;            /*htt_pkt_type_ethernet*/
861 }
862 
863 int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
864 {
865 	return cfg->num_tx_desc_pool;
866 }
867 
868 void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
869 {
870 	cfg->num_tx_desc_pool = num_pool;
871 }
872 
873 int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
874 {
875 	return cfg->num_tx_ext_desc_pool;
876 }
877 
878 void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
879 {
880 	cfg->num_tx_ext_desc_pool = num_pool;
881 }
882 
883 int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
884 {
885 	return cfg->reo_dst_ring_size;
886 }
887 
888 void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
889 				    int reo_dst_ring_size)
890 {
891 	cfg->reo_dst_ring_size = reo_dst_ring_size;
892 }
893 
894 void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
895 			       bool raw_mode_war)
896 {
897 	cfg->raw_mode_war = raw_mode_war;
898 }
899 
900 bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
901 {
902 	return cfg->raw_mode_war;
903 }
904 
905 int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
906 {
907 	return cfg->num_tx_desc;
908 }
909 
910 void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
911 {
912 	cfg->num_tx_desc = num_desc;
913 }
914 
915 int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
916 {
917 	return cfg->min_tx_desc;
918 }
919 
920 int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
921 {
922 	return cfg->num_tx_ext_desc;
923 }
924 
925 void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
926 {
927 	cfg->num_tx_ext_desc = num_ext_desc;
928 }
929 
930 uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
931 {
932 	/* TODO: This should be calculated based on target capabilities */
933 	return cfg->max_peer_id;
934 }
935 
936 int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
937 {
938 	return  cfg->dma_mon_buf_ring_size;
939 }
940 
941 int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
942 {
943 	return  cfg->dma_mon_dest_ring_size;
944 }
945 
946 int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
947 {
948 	return  cfg->dma_mon_status_ring_size;
949 }
950 
951 int
952 wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
953 {
954 	return cfg->rxdma_monitor_desc_ring;
955 }
956 
957 int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
958 {
959 	return  cfg->rx_dma_buf_ring_size;
960 }
961 
962 int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
963 {
964 	return  cfg->num_mac_rings;
965 }
966 
967 bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
968 {
969 	return  cfg->gro_enabled;
970 }
971 
972 bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
973 {
974 	return  cfg->lro_enabled;
975 }
976 
977 bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
978 {
979 	return  cfg->ipa_enabled;
980 }
981 
982 void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
983 {
984 	cfg->rx_hash = val;
985 }
986 
987 bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
988 {
989 	return  cfg->rx_hash;
990 }
991 
992 int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
993 {
994 	return  cfg->nss_enabled;
995 }
996 
997 void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
998 {
999 	cfg->nss_enabled = nss_enabled;
1000 }
1001 
1002 int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
1003 {
1004 	return  cfg->nss_cfg;
1005 }
1006 
1007 void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
1008 {
1009 	cfg->nss_cfg = nss_cfg;
1010 	if (cfg->nss_cfg)
1011 		cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
1012 }
1013 
1014 int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
1015 {
1016 	return cfg->int_batch_threshold_tx;
1017 }
1018 
1019 int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
1020 {
1021 	return cfg->int_timer_threshold_tx;
1022 }
1023 
1024 int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
1025 {
1026 	return cfg->int_batch_threshold_rx;
1027 }
1028 
1029 int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
1030 {
1031 	return cfg->int_timer_threshold_rx;
1032 }
1033 
1034 int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
1035 {
1036 	return cfg->int_batch_threshold_other;
1037 }
1038 
1039 int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
1040 {
1041 	return cfg->int_timer_threshold_other;
1042 }
1043 
1044 int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg)
1045 {
1046 	return cfg->int_timer_threshold_mon;
1047 }
1048 
1049 int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
1050 {
1051 	return cfg->tcp_udp_checksumoffload;
1052 }
1053 
1054 int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
1055 {
1056 	return cfg->rx_defrag_min_timeout;
1057 }
1058 
1059 int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
1060 {
1061 	return cfg->defrag_timeout_check;
1062 }
1063 
1064 int
1065 wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1066 {
1067 	return cfg->wbm_release_ring;
1068 }
1069 
1070 int
1071 wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1072 {
1073 	return cfg->tcl_cmd_ring;
1074 }
1075 
1076 int
1077 wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1078 {
1079 	return cfg->tcl_status_ring;
1080 }
1081 
1082 int
1083 wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1084 {
1085 	return cfg->reo_reinject_ring;
1086 }
1087 
1088 int
1089 wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1090 {
1091 	return cfg->rx_release_ring;
1092 }
1093 
1094 int
1095 wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1096 {
1097 	return cfg->reo_exception_ring;
1098 }
1099 
1100 int
1101 wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1102 {
1103 	return cfg->reo_cmd_ring;
1104 }
1105 
1106 int
1107 wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1108 {
1109 	return cfg->reo_status_ring;
1110 }
1111 
1112 int
1113 wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1114 {
1115 	return cfg->rxdma_refill_ring;
1116 }
1117 
1118 int
1119 wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg)
1120 {
1121 	return cfg->tx_desc_limit_0;
1122 }
1123 
1124 int
1125 wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg)
1126 {
1127 	return cfg->tx_desc_limit_1;
1128 }
1129 
1130 int
1131 wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg)
1132 {
1133 	return cfg->tx_desc_limit_2;
1134 }
1135 
1136 int
1137 wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg)
1138 {
1139 	return cfg->tx_device_limit;
1140 }
1141 
1142 int
1143 wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg)
1144 {
1145 	return cfg->tx_sw_internode_queue;
1146 }
1147 
1148 int
1149 wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1150 {
1151 	return cfg->rxdma_err_dst_ring;
1152 }
1153 
1154 int
1155 wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg)
1156 {
1157 	return cfg->rx_sw_desc_weight;
1158 }
1159 
1160 bool
1161 wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
1162 		     enum cdp_capabilities dp_caps)
1163 {
1164 	switch (dp_caps) {
1165 	case CDP_CFG_DP_TSO:
1166 		return cfg->tso_enabled;
1167 	case CDP_CFG_DP_LRO:
1168 		return cfg->lro_enabled;
1169 	case CDP_CFG_DP_SG:
1170 		return cfg->sg_enabled;
1171 	case CDP_CFG_DP_GRO:
1172 		return cfg->gro_enabled;
1173 	case CDP_CFG_DP_OL_TX_CSUM:
1174 		return cfg->ol_tx_csum_enabled;
1175 	case CDP_CFG_DP_OL_RX_CSUM:
1176 		return cfg->ol_rx_csum_enabled;
1177 	case CDP_CFG_DP_RAWMODE:
1178 		return cfg->rawmode_enabled;
1179 	case CDP_CFG_DP_PEER_FLOW_CTRL:
1180 		return cfg->peer_flow_ctrl_enabled;
1181 	default:
1182 		return false;
1183 	}
1184 }
1185 
1186 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
1187 /**
1188  * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
1189  * @cfg: config context
1190  *
1191  * Return: stop threshold
1192  */
1193 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
1194 {
1195 	return cfg->tx_flow_stop_queue_threshold;
1196 }
1197 
1198 /**
1199  * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
1200  *					for TX to resume
1201  * @cfg: config context
1202  *
1203  * Return: stop threshold
1204  */
1205 int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
1206 {
1207 	return cfg->tx_flow_start_queue_offset;
1208 }
1209 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
1210 
1211 void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
1212 				      bool val)
1213 {
1214 	cfg->is_rx_flow_tag_enabled = val;
1215 }
1216 
1217 uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg)
1218 {
1219 	return cfg->rx_toeplitz_hash_key;
1220 }
1221 
1222 uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg)
1223 {
1224 	return cfg->rx_flow_max_search;
1225 }
1226 
1227 bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
1228 {
1229 	return cfg->is_rx_flow_tag_enabled;
1230 }
1231 
1232 #ifdef WLAN_SUPPORT_RX_FISA
1233 bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
1234 {
1235 	return (bool)(cfg->is_rx_fisa_enabled);
1236 }
1237 #else
1238 bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
1239 {
1240 	return false;
1241 }
1242 #endif
1243 
1244 void
1245 wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg,
1246 					   bool val)
1247 {
1248 	cfg->is_rx_flow_search_table_per_pdev = val;
1249 }
1250 
1251 bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg)
1252 {
1253 	return cfg->is_rx_flow_search_table_per_pdev;
1254 }
1255 
1256 void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg,
1257 					    uint16_t val)
1258 {
1259 	cfg->rx_flow_search_table_size = val;
1260 }
1261 
1262 uint16_t
1263 wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg)
1264 {
1265 	return  cfg->rx_flow_search_table_size;
1266 }
1267 
1268 void
1269 wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg,
1270 					      bool val)
1271 {
1272 	cfg->is_rx_mon_protocol_flow_tag_enabled = val;
1273 }
1274 
1275 bool
1276 wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
1277 {
1278 	return cfg->is_rx_mon_protocol_flow_tag_enabled;
1279 }
1280