xref: /wlan-dirver/qca-wifi-host-cmn/wlan_cfg/wlan_cfg.c (revision 302a1d9701784af5f4797b1a9fe07ae820b51907)
1 /*
2  * Copyright (c) 2016-2018 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 "wlan_cfg.h"
28 #include "cfg_ucfg_api.h"
29 
30 /*
31  * FIX THIS -
32  * For now, all these configuration parameters are hardcoded.
33  * Many of these should actually be coming from dts file/ini file
34  */
35 
36 /*
37  * The max allowed size for tx comp ring is 8191.
38  * This is limitted by h/w ring max size.
39  * As this is not a power of 2 it does not work with nss offload so the
40  * nearest available size which is power of 2 is 4096 chosen for nss
41  */
42 
43 #define WLAN_CFG_TX_RING_MASK_0 0x1
44 #define WLAN_CFG_TX_RING_MASK_1 0x2
45 #define WLAN_CFG_TX_RING_MASK_2 0x4
46 #define WLAN_CFG_TX_RING_MASK_3 0x0
47 
48 #define WLAN_CFG_RX_RING_MASK_0 0x1
49 #define WLAN_CFG_RX_RING_MASK_1 0x2
50 #define WLAN_CFG_RX_RING_MASK_2 0x4
51 #define WLAN_CFG_RX_RING_MASK_3 0x8
52 
53 #define WLAN_CFG_RX_MON_RING_MASK_0 0x1
54 #define WLAN_CFG_RX_MON_RING_MASK_1 0x2
55 #define WLAN_CFG_RX_MON_RING_MASK_2 0x4
56 #define WLAN_CFG_RX_MON_RING_MASK_3 0x0
57 
58 #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1
59 #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0
60 #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0
61 #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0
62 
63 #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1
64 #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0
65 #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0
66 #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0
67 
68 #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1
69 #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0
70 #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
71 #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
72 
73 #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
74 #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
75 #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
76 #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
77 
78 #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1
79 #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2
80 #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4
81 #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0
82 
83 #ifdef CONFIG_MCL
84 static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
85 						0,
86 						WLAN_CFG_TX_RING_MASK_0,
87 						0,
88 						0,
89 						0,
90 						0,
91 						0};
92 
93 static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
94 					0,
95 					0,
96 					WLAN_CFG_RX_RING_MASK_0,
97 					0,
98 					WLAN_CFG_RX_RING_MASK_1,
99 					WLAN_CFG_RX_RING_MASK_2,
100 					WLAN_CFG_RX_RING_MASK_3};
101 
102 static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
103 					0,
104 					0,
105 					0,
106 					WLAN_CFG_RX_MON_RING_MASK_0,
107 					WLAN_CFG_RX_MON_RING_MASK_1,
108 					WLAN_CFG_RX_MON_RING_MASK_2,
109 					WLAN_CFG_RX_MON_RING_MASK_3};
110 #else
111 static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
112 						WLAN_CFG_TX_RING_MASK_0,
113 						WLAN_CFG_TX_RING_MASK_1,
114 						WLAN_CFG_TX_RING_MASK_2,
115 						WLAN_CFG_TX_RING_MASK_3};
116 
117 static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
118 					WLAN_CFG_RX_RING_MASK_0,
119 					WLAN_CFG_RX_RING_MASK_1,
120 					WLAN_CFG_RX_RING_MASK_2,
121 					WLAN_CFG_RX_RING_MASK_3};
122 
123 static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
124 					0,
125 					0,
126 					0,
127 					0,
128 					WLAN_CFG_RX_MON_RING_MASK_0,
129 					WLAN_CFG_RX_MON_RING_MASK_1,
130 					WLAN_CFG_RX_MON_RING_MASK_2};
131 
132 #endif
133 
134 static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
135 					WLAN_CFG_RX_ERR_RING_MASK_0,
136 					WLAN_CFG_RX_ERR_RING_MASK_1,
137 					WLAN_CFG_RX_ERR_RING_MASK_2,
138 					WLAN_CFG_RX_ERR_RING_MASK_3};
139 
140 static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
141 					WLAN_CFG_RX_WBM_REL_RING_MASK_0,
142 					WLAN_CFG_RX_WBM_REL_RING_MASK_1,
143 					WLAN_CFG_RX_WBM_REL_RING_MASK_2,
144 					WLAN_CFG_RX_WBM_REL_RING_MASK_3};
145 
146 static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
147 					WLAN_CFG_REO_STATUS_RING_MASK_0,
148 					WLAN_CFG_REO_STATUS_RING_MASK_1,
149 					WLAN_CFG_REO_STATUS_RING_MASK_2,
150 					WLAN_CFG_REO_STATUS_RING_MASK_3};
151 
152 static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
153 					WLAN_CFG_RXDMA2HOST_RING_MASK_0,
154 					WLAN_CFG_RXDMA2HOST_RING_MASK_1,
155 					WLAN_CFG_RXDMA2HOST_RING_MASK_2,
156 					WLAN_CFG_RXDMA2HOST_RING_MASK_3};
157 
158 static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
159 					WLAN_CFG_HOST2RXDMA_RING_MASK_0,
160 					WLAN_CFG_HOST2RXDMA_RING_MASK_1,
161 					WLAN_CFG_HOST2RXDMA_RING_MASK_2,
162 					WLAN_CFG_HOST2RXDMA_RING_MASK_3};
163 
164 /**
165  * struct wlan_cfg_dp_pdev_ctxt - Configuration parameters for pdev (radio)
166  * @rx_dma_buf_ring_size - Size of RxDMA buffer ring
167  * @dma_mon_buf_ring_size - Size of RxDMA Monitor buffer ring
168  * @dma_mon_dest_ring_size - Size of RxDMA Monitor Destination ring
169  * @dma_mon_status_ring_size - Size of RxDMA Monitor Status ring
170  * @rxdma_monitor_desc_ring - rxdma monitor desc ring size
171  */
172 struct wlan_cfg_dp_pdev_ctxt {
173 	int rx_dma_buf_ring_size;
174 	int dma_mon_buf_ring_size;
175 	int dma_mon_dest_ring_size;
176 	int dma_mon_status_ring_size;
177 	int rxdma_monitor_desc_ring;
178 	int num_mac_rings;
179 	int nss_enabled;
180 };
181 
182 /**
183  * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
184  * @psoc - Object manager psoc
185  * Return: wlan_cfg_ctx - Handle to Configuration context
186  */
187 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc)
188 {
189 	int i = 0;
190 
191 	struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
192 		qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
193 
194 	if (wlan_cfg_ctx == NULL)
195 		return NULL;
196 
197 	wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
198 	wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
199 	wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
200 	wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
201 	wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
202 	wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
203 	wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
204 	wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
205 	wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
206 	wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
207 						     CFG_DP_TX_EXT_DESC_POOLS);
208 	wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
209 	wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
210 	wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
211 	wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
212 
213 	wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
214 	wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
215 						  CFG_DP_TX_COMPL_RING_SIZE);
216 
217 	wlan_cfg_ctx->tx_comp_ring_size_nss =
218 		cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
219 	wlan_cfg_ctx->int_batch_threshold_tx =
220 			cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
221 	wlan_cfg_ctx->int_timer_threshold_tx =
222 			cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
223 	wlan_cfg_ctx->int_batch_threshold_rx =
224 			cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
225 	wlan_cfg_ctx->int_timer_threshold_rx =
226 			cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
227 	wlan_cfg_ctx->int_batch_threshold_other =
228 		cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
229 	wlan_cfg_ctx->int_timer_threshold_other =
230 		cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
231 
232 	for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
233 		wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i];
234 		wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i];
235 		wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i];
236 		wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i];
237 		wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
238 					rx_wbm_rel_ring_mask[i];
239 		wlan_cfg_ctx->int_reo_status_ring_mask[i] =
240 					reo_status_ring_mask[i];
241 		wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
242 			rxdma2host_ring_mask[i];
243 		wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
244 			host2rxdma_ring_mask[i];
245 	}
246 
247 	/* This is default mapping and can be overridden by HW config
248 	 * received from FW */
249 	wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1);
250 	if (MAX_PDEV_CNT > 1)
251 		wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3);
252 	if (MAX_PDEV_CNT > 2)
253 		wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2);
254 
255 	wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
256 
257 	wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
258 	wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
259 	wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
260 	wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
261 	/*Enable checksum offload by default*/
262 	wlan_cfg_ctx->tcp_udp_checksumoffload =
263 			cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
264 
265 	wlan_cfg_ctx->defrag_timeout_check =
266 			cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
267 	wlan_cfg_ctx->rx_defrag_min_timeout =
268 			cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
269 
270 	wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
271 						 CFG_DP_WBM_RELEASE_RING);
272 	wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
273 					     CFG_DP_TCL_CMD_RING);
274 	wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
275 						CFG_DP_TCL_STATUS_RING);
276 	wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
277 						  CFG_DP_REO_REINJECT_RING);
278 	wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
279 						CFG_DP_RX_RELEASE_RING);
280 	wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
281 						   CFG_DP_REO_EXCEPTION_RING);
282 	wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
283 					     CFG_DP_REO_CMD_RING);
284 	wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
285 						CFG_DP_REO_STATUS_RING);
286 
287 	wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
288 						  CFG_DP_RXDMA_REFILL_RING);
289 
290 	wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
291 						   CFG_DP_RXDMA_ERR_DST_RING);
292 
293 	return wlan_cfg_ctx;
294 }
295 
296 void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
297 {
298 	qdf_mem_free(wlan_cfg_ctx);
299 }
300 
301 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void *psoc)
302 {
303 	struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
304 		qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
305 
306 	if (wlan_cfg_ctx == NULL)
307 		return NULL;
308 
309 	wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
310 					CFG_DP_RXDMA_BUF_RING);
311 	wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
312 					CFG_DP_RXDMA_MONITOR_BUF_RING);
313 	wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
314 					CFG_DP_RXDMA_MONITOR_DST_RING);
315 	wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
316 					CFG_DP_RXDMA_MONITOR_STATUS_RING);
317 	wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
318 					CFG_DP_RXDMA_MONITOR_DESC_RING);
319 	wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
320 
321 	return wlan_cfg_ctx;
322 }
323 
324 void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
325 {
326 	qdf_mem_free(wlan_cfg_ctx);
327 }
328 
329 void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
330 {
331 	cfg->num_int_ctxts = num;
332 }
333 
334 void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
335 {
336 	cfg->max_peer_id = val;;
337 }
338 
339 void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
340 		int context, int mask)
341 {
342 	cfg->int_tx_ring_mask[context] = mask;
343 }
344 
345 void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
346 		int context, int mask)
347 {
348 	cfg->int_rx_ring_mask[context] = mask;
349 }
350 
351 void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
352 		int context, int mask)
353 {
354 	cfg->int_rx_mon_ring_mask[context] = mask;
355 }
356 
357 void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
358 	int context, int mask)
359 {
360 	cfg->int_rxdma2host_ring_mask[context] = mask;
361 }
362 
363 int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
364 	int context)
365 {
366 	return cfg->int_rxdma2host_ring_mask[context];
367 }
368 
369 void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
370 	int context, int mask)
371 {
372 	cfg->int_host2rxdma_ring_mask[context] = mask;
373 }
374 
375 int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
376 	int context)
377 {
378 	return cfg->int_host2rxdma_ring_mask[context];
379 }
380 
381 void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
382 	int hw_macid)
383 {
384 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
385 	cfg->hw_macid[pdev_idx] = hw_macid;
386 }
387 
388 int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
389 {
390 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
391 	return cfg->hw_macid[pdev_idx];
392 }
393 
394 int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
395 {
396 	qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
397 	return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
398 }
399 
400 void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
401 		int context, int mask)
402 {
403 	cfg->int_ce_ring_mask[context] = mask;
404 }
405 
406 void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
407 		int mask)
408 {
409 	cfg->int_rx_ring_mask[context] = mask;
410 }
411 
412 int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
413 		int context, int mask)
414 {
415 	return cfg->int_rx_err_ring_mask[context] = mask;
416 }
417 
418 int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
419 		int context, int mask)
420 {
421 	return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
422 }
423 
424 int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
425 		int context, int mask)
426 {
427 	return cfg->int_reo_status_ring_mask[context] = mask;
428 }
429 
430 int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
431 {
432 	return cfg->num_int_ctxts;
433 }
434 
435 int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
436 {
437 	return cfg->int_tx_ring_mask[context];
438 }
439 
440 int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
441 {
442 	return cfg->int_rx_ring_mask[context];
443 }
444 
445 int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
446 						int context)
447 {
448 	return cfg->int_rx_err_ring_mask[context];
449 }
450 
451 int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
452 					int context)
453 {
454 	return cfg->int_rx_wbm_rel_ring_mask[context];
455 }
456 
457 int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
458 					int context)
459 {
460 	return cfg->int_reo_status_ring_mask[context];
461 }
462 
463 int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
464 {
465 	return cfg->int_rx_mon_ring_mask[context];
466 }
467 
468 int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
469 {
470 	return cfg->int_ce_ring_mask[context];
471 }
472 
473 uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
474 {
475 	return cfg->max_clients;
476 }
477 
478 uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
479 {
480 	return cfg->max_alloc_size;
481 }
482 
483 int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
484 {
485 	return cfg->per_pdev_tx_ring;
486 }
487 
488 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
489 {
490 	return cfg->per_pdev_lmac_ring;
491 }
492 
493 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
494 {
495 	return cfg->num_tcl_data_rings;
496 }
497 
498 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
499 {
500 	return cfg->tx_ring_size;
501 }
502 
503 int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
504 {
505 	return cfg->tx_comp_ring_size;
506 }
507 
508 int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
509 {
510 	return cfg->per_pdev_rx_ring;
511 }
512 
513 int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
514 {
515 	return cfg->num_reo_dest_rings;
516 }
517 
518 int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
519 {
520 	return cfg->htt_packet_type;            /*htt_pkt_type_ethernet*/
521 }
522 
523 int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
524 {
525 	return cfg->num_tx_desc_pool;
526 }
527 
528 void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
529 {
530 	cfg->num_tx_desc_pool = num_pool;
531 }
532 
533 int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
534 {
535 	return cfg->num_tx_ext_desc_pool;
536 }
537 
538 void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
539 {
540 	cfg->num_tx_ext_desc_pool = num_pool;
541 }
542 
543 int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
544 {
545 	return cfg->reo_dst_ring_size;
546 }
547 
548 void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
549 				    int reo_dst_ring_size)
550 {
551 	cfg->reo_dst_ring_size = reo_dst_ring_size;
552 }
553 
554 void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
555 			       bool raw_mode_war)
556 {
557 	cfg->raw_mode_war = raw_mode_war;
558 }
559 
560 bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
561 {
562 	return cfg->raw_mode_war;
563 }
564 
565 int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
566 {
567 	return cfg->num_tx_desc;
568 }
569 
570 void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
571 {
572 	cfg->num_tx_desc = num_desc;
573 }
574 
575 int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
576 {
577 	return cfg->num_tx_ext_desc;
578 }
579 
580 void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
581 {
582 	cfg->num_tx_ext_desc = num_ext_desc;
583 }
584 
585 uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
586 {
587 	/* TODO: This should be calculated based on target capabilities */
588 	return cfg->max_peer_id;
589 }
590 
591 int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
592 {
593 	return  cfg->dma_mon_buf_ring_size;
594 }
595 
596 int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
597 {
598 	return  cfg->dma_mon_dest_ring_size;
599 }
600 
601 int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
602 {
603 	return  cfg->dma_mon_status_ring_size;
604 }
605 
606 int
607 wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
608 {
609 	return cfg->rxdma_monitor_desc_ring;
610 }
611 
612 int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
613 {
614 	return  cfg->rx_dma_buf_ring_size;
615 }
616 
617 int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
618 {
619 	return  cfg->num_mac_rings;
620 }
621 
622 bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
623 {
624 	return  cfg->lro_enabled;
625 }
626 
627 void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
628 {
629 	cfg->rx_hash = val;
630 }
631 
632 bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
633 {
634 	return  cfg->rx_hash;
635 }
636 
637 int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
638 {
639 	return  cfg->nss_enabled;
640 }
641 
642 void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
643 {
644 	cfg->nss_enabled = nss_enabled;
645 }
646 
647 int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
648 {
649 	return  cfg->nss_cfg;
650 }
651 
652 void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
653 {
654 	cfg->nss_cfg = nss_cfg;
655 	if (cfg->nss_cfg)
656 		cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
657 }
658 
659 int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
660 {
661 	return cfg->int_batch_threshold_tx;
662 }
663 
664 int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
665 {
666 	return cfg->int_timer_threshold_tx;
667 }
668 
669 int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
670 {
671 	return cfg->int_batch_threshold_rx;
672 }
673 
674 int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
675 {
676 	return cfg->int_timer_threshold_rx;
677 }
678 
679 int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
680 {
681 	return cfg->int_batch_threshold_other;
682 }
683 
684 int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
685 {
686 	return cfg->int_timer_threshold_other;
687 }
688 
689 int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
690 {
691 	return cfg->tcp_udp_checksumoffload;
692 }
693 
694 int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
695 {
696 	return cfg->rx_defrag_min_timeout;
697 }
698 
699 int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
700 {
701 	return cfg->defrag_timeout_check;
702 }
703 
704 int
705 wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
706 {
707 	return cfg->wbm_release_ring;
708 }
709 
710 int
711 wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
712 {
713 	return cfg->tcl_cmd_ring;
714 }
715 
716 int
717 wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
718 {
719 	return cfg->tcl_status_ring;
720 }
721 
722 int
723 wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
724 {
725 	return cfg->reo_reinject_ring;
726 }
727 
728 int
729 wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
730 {
731 	return cfg->rx_release_ring;
732 }
733 
734 int
735 wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
736 {
737 	return cfg->reo_exception_ring;
738 }
739 
740 int
741 wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
742 {
743 	return cfg->reo_cmd_ring;
744 }
745 
746 int
747 wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
748 {
749 	return cfg->reo_status_ring;
750 }
751 
752 int
753 wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
754 {
755 	return cfg->rxdma_refill_ring;
756 }
757 
758 int
759 wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
760 {
761 	return cfg->rxdma_err_dst_ring;
762 }
763 
764 #ifdef QCA_LL_TX_FLOW_CONTROL_V2
765 /**
766  * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
767  * @cfg: config context
768  *
769  * Return: stop threshold
770  */
771 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
772 {
773 	return cfg->tx_flow_stop_queue_threshold;
774 }
775 
776 /**
777  * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
778  *					for TX to resume
779  * @cfg: config context
780  *
781  * Return: stop threshold
782  */
783 int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
784 {
785 	return cfg->tx_flow_start_queue_offset;
786 }
787 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */
788