blob: d4aa81ac2cbd89863248d7f8dbc49719c81aa793 [file] [log] [blame]
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +05301/*
psimhafc2f91b2018-01-10 15:30:03 -08002 * Copyright (c) 2016-2018 The Linux Foundation. All rights reserved.
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +05303 *
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"
Akshay Kosigia4f6e172018-09-03 21:42:27 +053027#include <cdp_txrx_ops.h>
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +053028#include "wlan_cfg.h"
Vivek126db5d2018-07-25 22:05:04 +053029#include "cfg_ucfg_api.h"
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +053030
31/*
32 * FIX THIS -
33 * For now, all these configuration parameters are hardcoded.
34 * Many of these should actually be coming from dts file/ini file
35 */
Pamidipati, Vijay45b1df22017-06-21 03:20:25 +053036
Bharat Kumar Mdd67f452017-07-17 22:37:56 +053037/*
38 * The max allowed size for tx comp ring is 8191.
39 * This is limitted by h/w ring max size.
40 * As this is not a power of 2 it does not work with nss offload so the
Jeff Johnson23dbde82018-05-05 23:55:52 -070041 * nearest available size which is power of 2 is 4096 chosen for nss
Bharat Kumar Mdd67f452017-07-17 22:37:56 +053042 */
Ravi Joshifb39e002017-02-11 21:18:40 -080043
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +053044#define WLAN_CFG_TX_RING_MASK_0 0x1
45#define WLAN_CFG_TX_RING_MASK_1 0x2
46#define WLAN_CFG_TX_RING_MASK_2 0x4
47#define WLAN_CFG_TX_RING_MASK_3 0x0
48
49#define WLAN_CFG_RX_RING_MASK_0 0x1
50#define WLAN_CFG_RX_RING_MASK_1 0x2
51#define WLAN_CFG_RX_RING_MASK_2 0x4
52#define WLAN_CFG_RX_RING_MASK_3 0x8
53
54#define WLAN_CFG_RX_MON_RING_MASK_0 0x1
55#define WLAN_CFG_RX_MON_RING_MASK_1 0x2
56#define WLAN_CFG_RX_MON_RING_MASK_2 0x4
57#define WLAN_CFG_RX_MON_RING_MASK_3 0x0
58
Nandha Kishore Easwaran82ac62e2017-06-20 17:55:07 +053059#define WLAN_CFG_RX_ERR_RING_MASK_0 0x1
60#define WLAN_CFG_RX_ERR_RING_MASK_1 0x0
61#define WLAN_CFG_RX_ERR_RING_MASK_2 0x0
62#define WLAN_CFG_RX_ERR_RING_MASK_3 0x0
63
64#define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1
65#define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0
66#define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0
67#define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0
68
69#define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1
70#define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0
71#define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0
72#define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0
73
Karunakar Dasineni10185472017-06-19 16:32:06 -070074#define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1
75#define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2
76#define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4
77#define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0
78
Karunakar Dasineni87f0c5d2017-10-29 21:54:21 -070079#define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1
80#define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2
81#define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4
82#define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0
83
Houston Hoffman648a9182017-05-21 23:27:50 -070084#ifdef CONFIG_MCL
85static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
86 0,
87 WLAN_CFG_TX_RING_MASK_0,
88 0,
89 0,
psimhaf098e732017-09-06 19:37:06 -070090 0,
91 0,
92 0};
Houston Hoffman648a9182017-05-21 23:27:50 -070093
Pramod Simhab2ef27b2018-09-14 14:43:19 -070094#ifndef IPA_OFFLOAD
Houston Hoffman648a9182017-05-21 23:27:50 -070095static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
96 0,
97 0,
98 WLAN_CFG_RX_RING_MASK_0,
99 0,
100 WLAN_CFG_RX_RING_MASK_1,
101 WLAN_CFG_RX_RING_MASK_2,
102 WLAN_CFG_RX_RING_MASK_3};
Pramod Simhab2ef27b2018-09-14 14:43:19 -0700103#else
104static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
105 0,
106 0,
107 WLAN_CFG_RX_RING_MASK_0,
108 0,
109 WLAN_CFG_RX_RING_MASK_1,
110 WLAN_CFG_RX_RING_MASK_2,
111 0};
112#endif
Houston Hoffman648a9182017-05-21 23:27:50 -0700113
114static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
115 0,
116 0,
117 0,
118 WLAN_CFG_RX_MON_RING_MASK_0,
119 WLAN_CFG_RX_MON_RING_MASK_1,
120 WLAN_CFG_RX_MON_RING_MASK_2,
121 WLAN_CFG_RX_MON_RING_MASK_3};
Jinwei Chen38c92c62018-09-17 15:24:43 +0800122
123static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
124 WLAN_CFG_HOST2RXDMA_RING_MASK_0,
125 0,
126 0,
127 0,
128 0,
129 0,
130 0};
Houston Hoffman648a9182017-05-21 23:27:50 -0700131#else
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530132static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
133 WLAN_CFG_TX_RING_MASK_0,
134 WLAN_CFG_TX_RING_MASK_1,
135 WLAN_CFG_TX_RING_MASK_2,
136 WLAN_CFG_TX_RING_MASK_3};
137
138static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
139 WLAN_CFG_RX_RING_MASK_0,
140 WLAN_CFG_RX_RING_MASK_1,
141 WLAN_CFG_RX_RING_MASK_2,
142 WLAN_CFG_RX_RING_MASK_3};
143
144static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
Karunakar Dasineni860938e2018-03-14 17:28:15 -0700145 0,
146 0,
147 0,
148 0,
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530149 WLAN_CFG_RX_MON_RING_MASK_0,
150 WLAN_CFG_RX_MON_RING_MASK_1,
Karunakar Dasineni860938e2018-03-14 17:28:15 -0700151 WLAN_CFG_RX_MON_RING_MASK_2};
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530152
Jinwei Chen38c92c62018-09-17 15:24:43 +0800153static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
154 WLAN_CFG_HOST2RXDMA_RING_MASK_0,
155 WLAN_CFG_HOST2RXDMA_RING_MASK_1,
156 WLAN_CFG_HOST2RXDMA_RING_MASK_2,
157 WLAN_CFG_HOST2RXDMA_RING_MASK_3};
Houston Hoffman648a9182017-05-21 23:27:50 -0700158#endif
159
Nandha Kishore Easwaran82ac62e2017-06-20 17:55:07 +0530160static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
161 WLAN_CFG_RX_ERR_RING_MASK_0,
162 WLAN_CFG_RX_ERR_RING_MASK_1,
163 WLAN_CFG_RX_ERR_RING_MASK_2,
164 WLAN_CFG_RX_ERR_RING_MASK_3};
165
166static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
167 WLAN_CFG_RX_WBM_REL_RING_MASK_0,
168 WLAN_CFG_RX_WBM_REL_RING_MASK_1,
169 WLAN_CFG_RX_WBM_REL_RING_MASK_2,
170 WLAN_CFG_RX_WBM_REL_RING_MASK_3};
171
172static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
173 WLAN_CFG_REO_STATUS_RING_MASK_0,
174 WLAN_CFG_REO_STATUS_RING_MASK_1,
175 WLAN_CFG_REO_STATUS_RING_MASK_2,
176 WLAN_CFG_REO_STATUS_RING_MASK_3};
177
Karunakar Dasineni10185472017-06-19 16:32:06 -0700178static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = {
179 WLAN_CFG_RXDMA2HOST_RING_MASK_0,
180 WLAN_CFG_RXDMA2HOST_RING_MASK_1,
181 WLAN_CFG_RXDMA2HOST_RING_MASK_2,
182 WLAN_CFG_RXDMA2HOST_RING_MASK_3};
183
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530184/**
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530185 * struct wlan_cfg_dp_pdev_ctxt - Configuration parameters for pdev (radio)
186 * @rx_dma_buf_ring_size - Size of RxDMA buffer ring
187 * @dma_mon_buf_ring_size - Size of RxDMA Monitor buffer ring
188 * @dma_mon_dest_ring_size - Size of RxDMA Monitor Destination ring
189 * @dma_mon_status_ring_size - Size of RxDMA Monitor Status ring
Vivek126db5d2018-07-25 22:05:04 +0530190 * @rxdma_monitor_desc_ring - rxdma monitor desc ring size
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530191 */
192struct wlan_cfg_dp_pdev_ctxt {
193 int rx_dma_buf_ring_size;
194 int dma_mon_buf_ring_size;
195 int dma_mon_dest_ring_size;
196 int dma_mon_status_ring_size;
Vivek126db5d2018-07-25 22:05:04 +0530197 int rxdma_monitor_desc_ring;
Dhanashri Atred4032ab2017-01-17 15:05:41 -0800198 int num_mac_rings;
Bharat Kumar M9a5d5372017-05-08 17:41:42 +0530199 int nss_enabled;
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530200};
201
202/**
203 * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration
Vivek126db5d2018-07-25 22:05:04 +0530204 * @psoc - Object manager psoc
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530205 * Return: wlan_cfg_ctx - Handle to Configuration context
206 */
Vivek126db5d2018-07-25 22:05:04 +0530207struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc)
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530208{
209 int i = 0;
Pamidipati, Vijay6b0d2a82017-06-09 04:46:32 +0530210
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530211 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx =
212 qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt));
213
214 if (wlan_cfg_ctx == NULL)
215 return NULL;
216
217 wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS;
Vivek126db5d2018-07-25 22:05:04 +0530218 wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS);
219 wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE);
220 wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING);
221 wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS);
222 wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING);
223 wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING);
224 wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS);
Manjunathappa Prakashced7ea62017-07-02 03:02:15 -0700225 wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS;
Vivek126db5d2018-07-25 22:05:04 +0530226 wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc,
227 CFG_DP_TX_EXT_DESC_POOLS);
228 wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC);
229 wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC);
230 wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE);
231 wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID);
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530232
Vivek126db5d2018-07-25 22:05:04 +0530233 wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE);
234 wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc,
235 CFG_DP_TX_COMPL_RING_SIZE);
Pamidipati, Vijaybea353e2017-07-05 03:09:20 +0530236
Vivek126db5d2018-07-25 22:05:04 +0530237 wlan_cfg_ctx->tx_comp_ring_size_nss =
238 cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE);
239 wlan_cfg_ctx->int_batch_threshold_tx =
240 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX);
241 wlan_cfg_ctx->int_timer_threshold_tx =
242 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX);
243 wlan_cfg_ctx->int_batch_threshold_rx =
244 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX);
245 wlan_cfg_ctx->int_timer_threshold_rx =
246 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX);
Pamidipati, Vijay45b1df22017-06-21 03:20:25 +0530247 wlan_cfg_ctx->int_batch_threshold_other =
Vivek126db5d2018-07-25 22:05:04 +0530248 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER);
Pamidipati, Vijay45b1df22017-06-21 03:20:25 +0530249 wlan_cfg_ctx->int_timer_threshold_other =
Vivek126db5d2018-07-25 22:05:04 +0530250 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER);
Pamidipati, Vijay45b1df22017-06-21 03:20:25 +0530251
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530252 for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) {
253 wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i];
254 wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i];
255 wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i];
Nandha Kishore Easwaran82ac62e2017-06-20 17:55:07 +0530256 wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i];
257 wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] =
258 rx_wbm_rel_ring_mask[i];
259 wlan_cfg_ctx->int_reo_status_ring_mask[i] =
260 reo_status_ring_mask[i];
Karunakar Dasineni10185472017-06-19 16:32:06 -0700261 wlan_cfg_ctx->int_rxdma2host_ring_mask[i] =
262 rxdma2host_ring_mask[i];
Karunakar Dasineni87f0c5d2017-10-29 21:54:21 -0700263 wlan_cfg_ctx->int_host2rxdma_ring_mask[i] =
264 host2rxdma_ring_mask[i];
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530265 }
266
Karunakar Dasineni10185472017-06-19 16:32:06 -0700267 /* This is default mapping and can be overridden by HW config
268 * received from FW */
269 wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1);
270 if (MAX_PDEV_CNT > 1)
271 wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3);
272 if (MAX_PDEV_CNT > 2)
273 wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2);
274
Vivek126db5d2018-07-25 22:05:04 +0530275 wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID);
Karunakar Dasineni10185472017-06-19 16:32:06 -0700276
Vivek126db5d2018-07-25 22:05:04 +0530277 wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH);
278 wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO);
Akshay Kosigia4f6e172018-09-03 21:42:27 +0530279 wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO);
280 wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG);
281 wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO);
282 wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM);
283 wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM);
284 wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE);
285 wlan_cfg_ctx->peer_flow_ctrl_enabled =
286 cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL);
Vivek126db5d2018-07-25 22:05:04 +0530287 wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI);
288 /*Enable checksum offload by default*/
289 wlan_cfg_ctx->tcp_udp_checksumoffload =
290 cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD);
291
292 wlan_cfg_ctx->defrag_timeout_check =
293 cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK);
294 wlan_cfg_ctx->rx_defrag_min_timeout =
295 cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT);
296
297 wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc,
298 CFG_DP_WBM_RELEASE_RING);
299 wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc,
300 CFG_DP_TCL_CMD_RING);
301 wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc,
302 CFG_DP_TCL_STATUS_RING);
303 wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc,
304 CFG_DP_REO_REINJECT_RING);
305 wlan_cfg_ctx->rx_release_ring = cfg_get(psoc,
306 CFG_DP_RX_RELEASE_RING);
307 wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc,
308 CFG_DP_REO_EXCEPTION_RING);
309 wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc,
310 CFG_DP_REO_CMD_RING);
311 wlan_cfg_ctx->reo_status_ring = cfg_get(psoc,
312 CFG_DP_REO_STATUS_RING);
313
314 wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc,
315 CFG_DP_RXDMA_REFILL_RING);
316
317 wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc,
318 CFG_DP_RXDMA_ERR_DST_RING);
psimhafc2f91b2018-01-10 15:30:03 -0800319
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530320 return wlan_cfg_ctx;
321}
322
323void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx)
324{
325 qdf_mem_free(wlan_cfg_ctx);
326}
327
Vivek126db5d2018-07-25 22:05:04 +0530328struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void *psoc)
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530329{
330 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx =
331 qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt));
332
333 if (wlan_cfg_ctx == NULL)
334 return NULL;
335
Vivek126db5d2018-07-25 22:05:04 +0530336 wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc,
337 CFG_DP_RXDMA_BUF_RING);
338 wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc,
339 CFG_DP_RXDMA_MONITOR_BUF_RING);
340 wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc,
341 CFG_DP_RXDMA_MONITOR_DST_RING);
342 wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc,
343 CFG_DP_RXDMA_MONITOR_STATUS_RING);
344 wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc,
345 CFG_DP_RXDMA_MONITOR_DESC_RING);
Dhanashri Atred4032ab2017-01-17 15:05:41 -0800346 wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV;
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530347
348 return wlan_cfg_ctx;
349}
350
351void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx)
352{
353 qdf_mem_free(wlan_cfg_ctx);
354}
355
356void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num)
357{
358 cfg->num_int_ctxts = num;
359}
360
Pamidipati, Vijay6b0d2a82017-06-09 04:46:32 +0530361void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val)
362{
363 cfg->max_peer_id = val;;
364}
365
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530366void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
367 int context, int mask)
368{
369 cfg->int_tx_ring_mask[context] = mask;
370}
371
372void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
373 int context, int mask)
374{
375 cfg->int_rx_ring_mask[context] = mask;
376}
377
378void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
379 int context, int mask)
380{
381 cfg->int_rx_mon_ring_mask[context] = mask;
382}
383
Karunakar Dasineni10185472017-06-19 16:32:06 -0700384void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
385 int context, int mask)
386{
387 cfg->int_rxdma2host_ring_mask[context] = mask;
388}
389
390int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
391 int context)
392{
393 return cfg->int_rxdma2host_ring_mask[context];
394}
395
Karunakar Dasineni87f0c5d2017-10-29 21:54:21 -0700396void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
397 int context, int mask)
398{
399 cfg->int_host2rxdma_ring_mask[context] = mask;
400}
401
402int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
403 int context)
404{
405 return cfg->int_host2rxdma_ring_mask[context];
406}
407
Karunakar Dasineni10185472017-06-19 16:32:06 -0700408void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx,
409 int hw_macid)
410{
411 qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
412 cfg->hw_macid[pdev_idx] = hw_macid;
413}
414
415int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
416{
417 qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
418 return cfg->hw_macid[pdev_idx];
419}
420
421int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx)
422{
423 qdf_assert_always(pdev_idx < MAX_PDEV_CNT);
424 return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid;
425}
426
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530427void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
428 int context, int mask)
429{
430 cfg->int_ce_ring_mask[context] = mask;
431}
432
433void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context,
434 int mask)
435{
436 cfg->int_rx_ring_mask[context] = mask;
437}
438
Nandha Kishore Easwaran82ac62e2017-06-20 17:55:07 +0530439int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
440 int context, int mask)
441{
442 return cfg->int_rx_err_ring_mask[context] = mask;
443}
444
445int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
446 int context, int mask)
447{
448 return cfg->int_rx_wbm_rel_ring_mask[context] = mask;
449}
450
451int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
452 int context, int mask)
453{
454 return cfg->int_reo_status_ring_mask[context] = mask;
455}
456
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530457int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg)
458{
459 return cfg->num_int_ctxts;
460}
461
462int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
463{
464 return cfg->int_tx_ring_mask[context];
465}
466
467int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
468{
469 return cfg->int_rx_ring_mask[context];
470}
471
Nandha Kishore Easwaran82ac62e2017-06-20 17:55:07 +0530472int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
473 int context)
474{
475 return cfg->int_rx_err_ring_mask[context];
476}
477
478int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
479 int context)
480{
481 return cfg->int_rx_wbm_rel_ring_mask[context];
482}
483
484int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg,
485 int context)
486{
487 return cfg->int_reo_status_ring_mask[context];
488}
489
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530490int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
491{
492 return cfg->int_rx_mon_ring_mask[context];
493}
494
495int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context)
496{
497 return cfg->int_ce_ring_mask[context];
498}
499
500uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg)
501{
502 return cfg->max_clients;
503}
504
505uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg)
506{
507 return cfg->max_alloc_size;
508}
509
510int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
511{
512 return cfg->per_pdev_tx_ring;
513}
514
Manjunathappa Prakashe23acaf2017-11-10 00:17:24 -0800515int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
516{
517 return cfg->per_pdev_lmac_ring;
518}
519
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530520int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
521{
522 return cfg->num_tcl_data_rings;
523}
524
Pamidipati, Vijaybea353e2017-07-05 03:09:20 +0530525int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
526{
527 return cfg->tx_ring_size;
528}
529
530int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
531{
532 return cfg->tx_comp_ring_size;
533}
534
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530535int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg)
536{
537 return cfg->per_pdev_rx_ring;
538}
539
540int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg)
541{
542 return cfg->num_reo_dest_rings;
543}
544
545int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg)
546{
547 return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/
548}
549
550int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
551{
552 return cfg->num_tx_desc_pool;
553}
554
Aniruddha Paul9d7dc272018-02-11 19:40:41 +0530555void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
556{
557 cfg->num_tx_desc_pool = num_pool;
558}
559
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530560int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg)
561{
562 return cfg->num_tx_ext_desc_pool;
563}
564
Aniruddha Paul9d7dc272018-02-11 19:40:41 +0530565void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool)
566{
567 cfg->num_tx_ext_desc_pool = num_pool;
568}
569
Balamurugan Mahalingam54d16a92018-06-25 17:08:08 +0530570int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
571{
572 return cfg->reo_dst_ring_size;
573}
574
575void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg,
576 int reo_dst_ring_size)
577{
578 cfg->reo_dst_ring_size = reo_dst_ring_size;
579}
580
Venkateswara Swamy Bandaru6ca41122018-08-03 16:07:06 +0530581void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg,
582 bool raw_mode_war)
583{
584 cfg->raw_mode_war = raw_mode_war;
585}
586
587bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg)
588{
589 return cfg->raw_mode_war;
590}
591
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530592int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
593{
594 return cfg->num_tx_desc;
595}
596
Aniruddha Paul9d7dc272018-02-11 19:40:41 +0530597void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc)
598{
599 cfg->num_tx_desc = num_desc;
600}
601
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530602int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg)
603{
604 return cfg->num_tx_ext_desc;
605}
606
Aniruddha Paul9d7dc272018-02-11 19:40:41 +0530607void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc)
608{
609 cfg->num_tx_ext_desc = num_ext_desc;
610}
611
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530612uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg)
613{
614 /* TODO: This should be calculated based on target capabilities */
615 return cfg->max_peer_id;
616}
617
618int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
619{
620 return cfg->dma_mon_buf_ring_size;
621}
622
623int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
624{
625 return cfg->dma_mon_dest_ring_size;
626}
627
628int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
629{
630 return cfg->dma_mon_status_ring_size;
631}
632
Vivek126db5d2018-07-25 22:05:04 +0530633int
634wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
635{
636 return cfg->rxdma_monitor_desc_ring;
637}
638
Vijay Pamidipatid41d6d62016-10-19 21:19:00 +0530639int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg)
640{
641 return cfg->rx_dma_buf_ring_size;
642}
Dhanashri Atred4032ab2017-01-17 15:05:41 -0800643
644int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg)
645{
646 return cfg->num_mac_rings;
647}
Dhanashri Atre14049172016-11-11 18:32:36 -0800648
649bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
650{
651 return cfg->lro_enabled;
652}
653
Tallapragada Kalyan4c183b82017-09-13 23:48:14 +0530654void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val)
655{
656 cfg->rx_hash = val;
657}
658
Dhanashri Atre14049172016-11-11 18:32:36 -0800659bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg)
660{
661 return cfg->rx_hash;
662}
Bharat Kumar M9a5d5372017-05-08 17:41:42 +0530663
664int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg)
665{
666 return cfg->nss_enabled;
667}
668
669void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled)
670{
671 cfg->nss_enabled = nss_enabled;
672}
673
674int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg)
675{
676 return cfg->nss_cfg;
677}
678
679void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg)
680{
681 cfg->nss_cfg = nss_cfg;
Bharat Kumar Mdd67f452017-07-17 22:37:56 +0530682 if (cfg->nss_cfg)
Vivek126db5d2018-07-25 22:05:04 +0530683 cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss;
Bharat Kumar M9a5d5372017-05-08 17:41:42 +0530684}
Pamidipati, Vijay45b1df22017-06-21 03:20:25 +0530685
686int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
687{
688 return cfg->int_batch_threshold_tx;
689}
690
691int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg)
692{
693 return cfg->int_timer_threshold_tx;
694}
695
696int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
697{
698 return cfg->int_batch_threshold_rx;
699}
700
701int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg)
702{
703 return cfg->int_timer_threshold_rx;
704}
705
706int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
707{
708 return cfg->int_batch_threshold_other;
709}
710
711int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg)
712{
713 return cfg->int_timer_threshold_other;
714}
chenguo8d0c2192017-12-01 19:35:53 +0800715
716int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg)
717{
718 return cfg->tcp_udp_checksumoffload;
719}
psimhafc2f91b2018-01-10 15:30:03 -0800720
721int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg)
722{
723 return cfg->rx_defrag_min_timeout;
724}
725
726int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg)
727{
728 return cfg->defrag_timeout_check;
729}
730
Vivek126db5d2018-07-25 22:05:04 +0530731int
732wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
733{
734 return cfg->wbm_release_ring;
735}
736
737int
738wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
739{
740 return cfg->tcl_cmd_ring;
741}
742
743int
744wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
745{
746 return cfg->tcl_status_ring;
747}
748
749int
750wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
751{
752 return cfg->reo_reinject_ring;
753}
754
755int
756wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
757{
758 return cfg->rx_release_ring;
759}
760
761int
762wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
763{
764 return cfg->reo_exception_ring;
765}
766
767int
768wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
769{
770 return cfg->reo_cmd_ring;
771}
772
773int
774wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
775{
776 return cfg->reo_status_ring;
777}
778
779int
780wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
781{
782 return cfg->rxdma_refill_ring;
783}
784
785int
786wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg)
787{
788 return cfg->rxdma_err_dst_ring;
789}
790
Akshay Kosigia4f6e172018-09-03 21:42:27 +0530791bool
792wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg,
793 enum cdp_capabilities dp_caps)
794{
795 switch (dp_caps) {
796 case CDP_CFG_DP_TSO:
797 return cfg->tso_enabled;
798 case CDP_CFG_DP_LRO:
799 return cfg->lro_enabled;
800 case CDP_CFG_DP_SG:
801 return cfg->sg_enabled;
802 case CDP_CFG_DP_GRO:
803 return cfg->gro_enabled;
804 case CDP_CFG_DP_OL_TX_CSUM:
805 return cfg->ol_tx_csum_enabled;
806 case CDP_CFG_DP_OL_RX_CSUM:
807 return cfg->ol_rx_csum_enabled;
808 case CDP_CFG_DP_RAWMODE:
809 return cfg->rawmode_enabled;
810 case CDP_CFG_DP_PEER_FLOW_CTRL:
811 return cfg->peer_flow_ctrl_enabled;
812 default:
813 return false;
814 }
815}
816
Manjunathappa Prakashced7ea62017-07-02 03:02:15 -0700817#ifdef QCA_LL_TX_FLOW_CONTROL_V2
818/**
819 * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold
820 * @cfg: config context
821 *
822 * Return: stop threshold
823 */
824int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg)
825{
Venkata Sharath Chandra Manchala3e8add82017-07-10 11:59:54 -0700826 return cfg->tx_flow_stop_queue_threshold;
Manjunathappa Prakashced7ea62017-07-02 03:02:15 -0700827}
828
829/**
830 * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset
831 * for TX to resume
832 * @cfg: config context
833 *
834 * Return: stop threshold
835 */
836int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg)
837{
Manjunathappa Prakashced7ea62017-07-02 03:02:15 -0700838 return cfg->tx_flow_start_queue_offset;
Manjunathappa Prakashced7ea62017-07-02 03:02:15 -0700839}
840#endif /* QCA_LL_TX_FLOW_CONTROL_V2 */