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