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 0, 170 0, 171 0, 172 0, 173 WLAN_CFG_RX_RING_MASK_0, 174 WLAN_CFG_RX_RING_MASK_1, 175 WLAN_CFG_RX_RING_MASK_2, 176 WLAN_CFG_RX_RING_MASK_3}; 177 178 static const int rx_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 179 0, 180 0, 181 0, 182 WLAN_CFG_RX_MON_RING_MASK_0, 183 WLAN_CFG_RX_MON_RING_MASK_1, 184 WLAN_CFG_RX_MON_RING_MASK_2}; 185 186 static const int host2rxdma_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 187 0, 188 0, 189 0, 190 WLAN_CFG_HOST2RXDMA_RING_MASK_0, 191 WLAN_CFG_HOST2RXDMA_RING_MASK_1, 192 WLAN_CFG_HOST2RXDMA_RING_MASK_2, 193 WLAN_CFG_HOST2RXDMA_RING_MASK_3}; 194 195 static const int rxdma2host_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 196 0, 197 0, 198 0, 199 WLAN_CFG_RXDMA2HOST_RING_MASK_0, 200 WLAN_CFG_RXDMA2HOST_RING_MASK_1, 201 WLAN_CFG_RXDMA2HOST_RING_MASK_2, 202 WLAN_CFG_RXDMA2HOST_RING_MASK_3}; 203 204 static const int host2rxdma_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 205 0, 206 0, 207 0, 208 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0, 209 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1, 210 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2}; 211 212 static const int rxdma2host_mon_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 213 0, 214 0, 215 0, 216 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0, 217 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1, 218 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2}; 219 220 static const int rx_err_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 221 0, 222 0, 223 0, 224 WLAN_CFG_RX_ERR_RING_MASK_0, 225 WLAN_CFG_RX_ERR_RING_MASK_1, 226 WLAN_CFG_RX_ERR_RING_MASK_2, 227 WLAN_CFG_RX_ERR_RING_MASK_3}; 228 229 static const int rx_wbm_rel_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 230 0, 231 0, 232 0, 233 WLAN_CFG_RX_WBM_REL_RING_MASK_0, 234 WLAN_CFG_RX_WBM_REL_RING_MASK_1, 235 WLAN_CFG_RX_WBM_REL_RING_MASK_2, 236 WLAN_CFG_RX_WBM_REL_RING_MASK_3}; 237 238 static const int reo_status_ring_mask_msi[WLAN_CFG_INT_NUM_CONTEXTS] = { 239 0, 240 0, 241 0, 242 WLAN_CFG_REO_STATUS_RING_MASK_0, 243 WLAN_CFG_REO_STATUS_RING_MASK_1, 244 WLAN_CFG_REO_STATUS_RING_MASK_2, 245 WLAN_CFG_REO_STATUS_RING_MASK_3}; 246 247 static const int tx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 248 WLAN_CFG_TX_RING_MASK_0, 249 WLAN_CFG_TX_RING_MASK_1, 250 WLAN_CFG_TX_RING_MASK_2, 251 WLAN_CFG_TX_RING_MASK_3}; 252 253 static const int rx_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 254 0, 255 0, 256 0, 257 0, 258 0, 259 0, 260 0, 261 WLAN_CFG_RX_RING_MASK_0, 262 WLAN_CFG_RX_RING_MASK_1, 263 WLAN_CFG_RX_RING_MASK_2, 264 WLAN_CFG_RX_RING_MASK_3}; 265 266 static const int rx_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 267 0, 268 0, 269 0, 270 0, 271 WLAN_CFG_RX_MON_RING_MASK_0, 272 WLAN_CFG_RX_MON_RING_MASK_1, 273 WLAN_CFG_RX_MON_RING_MASK_2}; 274 275 static const int host2rxdma_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 276 WLAN_CFG_HOST2RXDMA_RING_MASK_0, 277 WLAN_CFG_HOST2RXDMA_RING_MASK_1, 278 WLAN_CFG_HOST2RXDMA_RING_MASK_2, 279 WLAN_CFG_HOST2RXDMA_RING_MASK_3}; 280 281 static const int rxdma2host_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 282 WLAN_CFG_RXDMA2HOST_RING_MASK_0, 283 WLAN_CFG_RXDMA2HOST_RING_MASK_1, 284 WLAN_CFG_RXDMA2HOST_RING_MASK_2, 285 WLAN_CFG_RXDMA2HOST_RING_MASK_3}; 286 287 static const int host2rxdma_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 288 0, 289 0, 290 0, 291 0, 292 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0, 293 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1, 294 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2}; 295 296 static const int rxdma2host_mon_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 297 0, 298 0, 299 0, 300 0, 301 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0, 302 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1, 303 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2}; 304 305 static const int rx_err_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 306 WLAN_CFG_RX_ERR_RING_MASK_0, 307 WLAN_CFG_RX_ERR_RING_MASK_1, 308 WLAN_CFG_RX_ERR_RING_MASK_2, 309 WLAN_CFG_RX_ERR_RING_MASK_3}; 310 311 static const int rx_wbm_rel_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 312 WLAN_CFG_RX_WBM_REL_RING_MASK_0, 313 WLAN_CFG_RX_WBM_REL_RING_MASK_1, 314 WLAN_CFG_RX_WBM_REL_RING_MASK_2, 315 WLAN_CFG_RX_WBM_REL_RING_MASK_3}; 316 317 static const int reo_status_ring_mask_integrated[WLAN_CFG_INT_NUM_CONTEXTS] = { 318 WLAN_CFG_REO_STATUS_RING_MASK_0, 319 WLAN_CFG_REO_STATUS_RING_MASK_1, 320 WLAN_CFG_REO_STATUS_RING_MASK_2, 321 WLAN_CFG_REO_STATUS_RING_MASK_3}; 322 #endif /* MAX_PDEV_CNT == 1 */ 323 324 /** 325 * g_wlan_srng_cfg[] - Per ring_type specific configuration 326 * 327 */ 328 struct wlan_srng_cfg g_wlan_srng_cfg[MAX_RING_TYPES]; 329 330 /* REO_DST ring configuration */ 331 struct wlan_srng_cfg wlan_srng_reo_cfg = { 332 .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_REO_RING, 333 .batch_count_threshold = 0, 334 .low_threshold = 0, 335 }; 336 337 /* WBM2SW_RELEASE ring configuration */ 338 struct wlan_srng_cfg wlan_srng_wbm_release_cfg = { 339 .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_WBM_RELEASE_RING, 340 .batch_count_threshold = 0, 341 .low_threshold = 0, 342 }; 343 344 /* RXDMA_BUF ring configuration */ 345 struct wlan_srng_cfg wlan_srng_rxdma_buf_cfg = { 346 .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX, 347 .batch_count_threshold = 0, 348 .low_threshold = WLAN_CFG_RXDMA_REFILL_RING_SIZE >> 3, 349 }; 350 351 /* RXDMA_MONITOR_BUF ring configuration */ 352 struct wlan_srng_cfg wlan_srng_rxdma_monitor_buf_cfg = { 353 .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX, 354 .batch_count_threshold = 0, 355 .low_threshold = WLAN_CFG_RXDMA_MONITOR_BUF_RING_SIZE >> 3, 356 }; 357 358 /* RXDMA_MONITOR_STATUS ring configuration */ 359 struct wlan_srng_cfg wlan_srng_rxdma_monitor_status_cfg = { 360 .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_RX, 361 .batch_count_threshold = 0, 362 .low_threshold = WLAN_CFG_RXDMA_MONITOR_STATUS_RING_SIZE >> 3, 363 }; 364 365 /* DEFAULT_CONFIG ring configuration */ 366 struct wlan_srng_cfg wlan_srng_default_cfg = { 367 .timer_threshold = WLAN_CFG_INT_TIMER_THRESHOLD_OTHER, 368 .batch_count_threshold = WLAN_CFG_INT_BATCH_THRESHOLD_OTHER, 369 .low_threshold = 0, 370 }; 371 372 void wlan_set_srng_cfg(struct wlan_srng_cfg **wlan_cfg) 373 { 374 g_wlan_srng_cfg[REO_DST] = wlan_srng_reo_cfg; 375 g_wlan_srng_cfg[WBM2SW_RELEASE] = wlan_srng_wbm_release_cfg; 376 g_wlan_srng_cfg[REO_EXCEPTION] = wlan_srng_default_cfg; 377 g_wlan_srng_cfg[REO_REINJECT] = wlan_srng_default_cfg; 378 g_wlan_srng_cfg[REO_CMD] = wlan_srng_default_cfg; 379 g_wlan_srng_cfg[REO_STATUS] = wlan_srng_default_cfg; 380 g_wlan_srng_cfg[TCL_DATA] = wlan_srng_default_cfg; 381 g_wlan_srng_cfg[TCL_CMD_CREDIT] = wlan_srng_default_cfg; 382 g_wlan_srng_cfg[TCL_STATUS] = wlan_srng_default_cfg; 383 g_wlan_srng_cfg[WBM_IDLE_LINK] = wlan_srng_default_cfg; 384 g_wlan_srng_cfg[SW2WBM_RELEASE] = wlan_srng_default_cfg; 385 g_wlan_srng_cfg[RXDMA_BUF] = wlan_srng_rxdma_buf_cfg; 386 g_wlan_srng_cfg[RXDMA_DST] = wlan_srng_default_cfg; 387 g_wlan_srng_cfg[RXDMA_MONITOR_BUF] = 388 wlan_srng_rxdma_monitor_buf_cfg; 389 g_wlan_srng_cfg[RXDMA_MONITOR_STATUS] = 390 wlan_srng_rxdma_monitor_status_cfg; 391 g_wlan_srng_cfg[RXDMA_MONITOR_DST] = wlan_srng_default_cfg; 392 g_wlan_srng_cfg[RXDMA_MONITOR_DESC] = wlan_srng_default_cfg; 393 g_wlan_srng_cfg[DIR_BUF_RX_DMA_SRC] = wlan_srng_default_cfg; 394 #ifdef WLAN_FEATURE_CIF_CFR 395 g_wlan_srng_cfg[WIFI_POS_SRC] = wlan_srng_default_cfg; 396 #endif 397 *wlan_cfg = g_wlan_srng_cfg; 398 } 399 400 static const uint8_t rx_fst_toeplitz_key[WLAN_CFG_RX_FST_TOEPLITZ_KEYLEN] = { 401 0x6d, 0x5a, 0x56, 0xda, 0x25, 0x5b, 0x0e, 0xc2, 402 0x41, 0x67, 0x25, 0x3d, 0x43, 0xa3, 0x8f, 0xb0, 403 0xd0, 0xca, 0x2b, 0xcb, 0xae, 0x7b, 0x30, 0xb4, 404 0x77, 0xcb, 0x2d, 0xa3, 0x80, 0x30, 0xf2, 0x0c, 405 0x6a, 0x42, 0xb7, 0x3b, 0xbe, 0xac, 0x01, 0xfa 406 }; 407 408 void wlan_cfg_fill_interrupt_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, 409 int interrupt_mode, 410 bool is_monitor_mode) { 411 int i = 0; 412 413 if (interrupt_mode == DP_INTR_INTEGRATED) { 414 for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { 415 wlan_cfg_ctx->int_tx_ring_mask[i] = 416 tx_ring_mask_integrated[i]; 417 wlan_cfg_ctx->int_rx_ring_mask[i] = 418 rx_ring_mask_integrated[i]; 419 wlan_cfg_ctx->int_rx_mon_ring_mask[i] = 420 rx_mon_ring_mask_integrated[i]; 421 wlan_cfg_ctx->int_rx_err_ring_mask[i] = 422 rx_err_ring_mask_integrated[i]; 423 wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] = 424 rx_wbm_rel_ring_mask_integrated[i]; 425 wlan_cfg_ctx->int_reo_status_ring_mask[i] = 426 reo_status_ring_mask_integrated[i]; 427 wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 428 rxdma2host_ring_mask_integrated[i]; 429 wlan_cfg_ctx->int_host2rxdma_ring_mask[i] = 430 host2rxdma_ring_mask_integrated[i]; 431 wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] = 432 host2rxdma_mon_ring_mask_integrated[i]; 433 wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] = 434 rxdma2host_mon_ring_mask_integrated[i]; 435 } 436 } else if (interrupt_mode == DP_INTR_MSI || interrupt_mode == 437 DP_INTR_POLL) { 438 for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { 439 wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask_msi[i]; 440 wlan_cfg_ctx->int_rx_mon_ring_mask[i] = 441 rx_mon_ring_mask_msi[i]; 442 wlan_cfg_ctx->int_rx_err_ring_mask[i] = 443 rx_err_ring_mask_msi[i]; 444 wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] = 445 rx_wbm_rel_ring_mask_msi[i]; 446 wlan_cfg_ctx->int_reo_status_ring_mask[i] = 447 reo_status_ring_mask_msi[i]; 448 if (is_monitor_mode) { 449 wlan_cfg_ctx->int_rx_ring_mask[i] = 0; 450 wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 0; 451 } else { 452 wlan_cfg_ctx->int_rx_ring_mask[i] = 453 rx_ring_mask_msi[i]; 454 wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 455 rxdma2host_ring_mask_msi[i]; 456 } 457 wlan_cfg_ctx->int_host2rxdma_ring_mask[i] = 458 host2rxdma_ring_mask_msi[i]; 459 wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] = 460 host2rxdma_mon_ring_mask_msi[i]; 461 wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] = 462 rxdma2host_mon_ring_mask_msi[i]; 463 } 464 } else { 465 qdf_err("Interrupt mode %d", interrupt_mode); 466 } 467 } 468 469 /** 470 * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration 471 * @psoc - Object manager psoc 472 * Return: wlan_cfg_ctx - Handle to Configuration context 473 */ 474 struct wlan_cfg_dp_soc_ctxt * 475 wlan_cfg_soc_attach(struct cdp_ctrl_objmgr_psoc *psoc) 476 { 477 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx = 478 qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt)); 479 480 if (!wlan_cfg_ctx) 481 return NULL; 482 483 wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE; 484 wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS; 485 wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS); 486 wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE); 487 wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING); 488 wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS); 489 wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING); 490 wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING); 491 wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS); 492 wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS; 493 wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc, 494 CFG_DP_TX_EXT_DESC_POOLS); 495 wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC); 496 wlan_cfg_ctx->min_tx_desc = WLAN_CFG_NUM_TX_DESC_MIN; 497 wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC); 498 wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE); 499 wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID); 500 501 wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE); 502 wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc, 503 CFG_DP_TX_COMPL_RING_SIZE); 504 505 wlan_cfg_ctx->tx_comp_ring_size_nss = 506 cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE); 507 508 wlan_cfg_ctx->int_batch_threshold_tx = 509 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX); 510 wlan_cfg_ctx->int_timer_threshold_tx = 511 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX); 512 wlan_cfg_ctx->int_batch_threshold_rx = 513 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX); 514 wlan_cfg_ctx->int_timer_threshold_rx = 515 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX); 516 wlan_cfg_ctx->int_batch_threshold_other = 517 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER); 518 wlan_cfg_ctx->int_timer_threshold_other = 519 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER); 520 wlan_cfg_ctx->pktlog_buffer_size = 521 cfg_get(psoc, CFG_DP_PKTLOG_BUFFER_SIZE); 522 523 /* This is default mapping and can be overridden by HW config 524 * received from FW */ 525 wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 0, 0); 526 if (MAX_PDEV_CNT > 1) 527 wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 1, 2); 528 if (MAX_PDEV_CNT > 2) 529 wlan_cfg_set_hw_mac_idx(wlan_cfg_ctx, 2, 1); 530 531 wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID); 532 533 wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH); 534 wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO); 535 wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO); 536 wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG); 537 wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO); 538 wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM); 539 wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM); 540 wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE); 541 wlan_cfg_ctx->peer_flow_ctrl_enabled = 542 cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL); 543 wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI); 544 wlan_cfg_ctx->nan_tcp_udp_checksumoffload = 545 cfg_get(psoc, CFG_DP_NAN_TCP_UDP_CKSUM_OFFLOAD); 546 wlan_cfg_ctx->tcp_udp_checksumoffload = 547 cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD); 548 wlan_cfg_ctx->per_pkt_trace = cfg_get(psoc, CFG_DP_PER_PKT_LOGGING); 549 wlan_cfg_ctx->defrag_timeout_check = 550 cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK); 551 wlan_cfg_ctx->rx_defrag_min_timeout = 552 cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT); 553 554 wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc, 555 CFG_DP_WBM_RELEASE_RING); 556 wlan_cfg_ctx->tcl_cmd_credit_ring = cfg_get(psoc, 557 CFG_DP_TCL_CMD_CREDIT_RING); 558 wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc, 559 CFG_DP_TCL_STATUS_RING); 560 wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc, 561 CFG_DP_REO_REINJECT_RING); 562 wlan_cfg_ctx->rx_release_ring = cfg_get(psoc, 563 CFG_DP_RX_RELEASE_RING); 564 wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc, 565 CFG_DP_REO_EXCEPTION_RING); 566 wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc, 567 CFG_DP_REO_CMD_RING); 568 wlan_cfg_ctx->reo_status_ring = cfg_get(psoc, 569 CFG_DP_REO_STATUS_RING); 570 wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc, 571 CFG_DP_RXDMA_REFILL_RING); 572 wlan_cfg_ctx->tx_desc_limit_0 = cfg_get(psoc, 573 CFG_DP_TX_DESC_LIMIT_0); 574 wlan_cfg_ctx->tx_desc_limit_1 = cfg_get(psoc, 575 CFG_DP_TX_DESC_LIMIT_1); 576 wlan_cfg_ctx->tx_desc_limit_2 = cfg_get(psoc, 577 CFG_DP_TX_DESC_LIMIT_2); 578 wlan_cfg_ctx->tx_device_limit = cfg_get(psoc, 579 CFG_DP_TX_DEVICE_LIMIT); 580 wlan_cfg_ctx->tx_sw_internode_queue = cfg_get(psoc, 581 CFG_DP_TX_SW_INTERNODE_QUEUE); 582 wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc, 583 CFG_DP_RXDMA_ERR_DST_RING); 584 wlan_cfg_ctx->enable_data_stall_detection = 585 cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION); 586 wlan_cfg_ctx->tx_flow_start_queue_offset = 587 cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET); 588 wlan_cfg_ctx->tx_flow_stop_queue_threshold = 589 cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH); 590 wlan_cfg_ctx->disable_intra_bss_fwd = 591 cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION); 592 wlan_cfg_ctx->rx_sw_desc_weight = cfg_get(psoc, 593 CFG_DP_RX_SW_DESC_WEIGHT); 594 wlan_cfg_ctx->rx_toeplitz_hash_key = (uint8_t *)rx_fst_toeplitz_key; 595 wlan_cfg_ctx->rx_flow_max_search = WLAN_CFG_RX_FST_MAX_SEARCH; 596 wlan_cfg_ctx->is_rx_flow_tag_enabled = 597 cfg_get(psoc, CFG_DP_RX_FLOW_TAG_ENABLE); 598 wlan_cfg_ctx->is_rx_flow_search_table_per_pdev = 599 cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_PER_PDEV); 600 wlan_cfg_ctx->rx_flow_search_table_size = 601 cfg_get(psoc, CFG_DP_RX_FLOW_SEARCH_TABLE_SIZE); 602 wlan_cfg_ctx->is_rx_mon_protocol_flow_tag_enabled = 603 cfg_get(psoc, CFG_DP_RX_MON_PROTOCOL_FLOW_TAG_ENABLE); 604 wlan_cfg_ctx->mon_drop_thresh = 605 cfg_get(psoc, CFG_DP_RXDMA_MONITOR_RX_DROP_THRESHOLD); 606 wlan_cfg_ctx->is_rx_fisa_enabled = cfg_get(psoc, CFG_DP_RX_FISA_ENABLE); 607 return wlan_cfg_ctx; 608 } 609 610 void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) 611 { 612 qdf_mem_free(wlan_cfg_ctx); 613 } 614 615 struct wlan_cfg_dp_pdev_ctxt * 616 wlan_cfg_pdev_attach(struct cdp_ctrl_objmgr_psoc *psoc) 617 { 618 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx = 619 qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt)); 620 621 if (!wlan_cfg_ctx) 622 return NULL; 623 624 wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc, 625 CFG_DP_RXDMA_BUF_RING); 626 wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc, 627 CFG_DP_RXDMA_MONITOR_BUF_RING); 628 wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc, 629 CFG_DP_RXDMA_MONITOR_DST_RING); 630 wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc, 631 CFG_DP_RXDMA_MONITOR_STATUS_RING); 632 wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc, 633 CFG_DP_RXDMA_MONITOR_DESC_RING); 634 wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV; 635 636 return wlan_cfg_ctx; 637 } 638 639 void wlan_cfg_set_mon_delayed_replenish_entries( 640 struct wlan_cfg_dp_soc_ctxt *cfg, 641 uint32_t val) 642 { 643 cfg->delayed_replenish_entries = val; 644 } 645 646 int wlan_cfg_get_mon_delayed_replenish_entries(struct wlan_cfg_dp_soc_ctxt *cfg) 647 { 648 return cfg->delayed_replenish_entries; 649 } 650 651 void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx) 652 { 653 if (wlan_cfg_ctx) 654 qdf_mem_free(wlan_cfg_ctx); 655 } 656 657 int wlan_cfg_get_mon_drop_thresh(struct wlan_cfg_dp_soc_ctxt *cfg) 658 { 659 return cfg->mon_drop_thresh; 660 } 661 662 void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num) 663 { 664 cfg->num_int_ctxts = num; 665 } 666 667 void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val) 668 { 669 cfg->max_peer_id = val; 670 } 671 672 void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val) 673 { 674 cfg->max_ast_idx = val; 675 } 676 677 int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg) 678 { 679 return cfg->max_ast_idx; 680 } 681 682 void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 683 int context, int mask) 684 { 685 cfg->int_tx_ring_mask[context] = mask; 686 } 687 688 void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 689 int context, int mask) 690 { 691 cfg->int_rx_ring_mask[context] = mask; 692 } 693 694 void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 695 int context, int mask) 696 { 697 cfg->int_rx_mon_ring_mask[context] = mask; 698 } 699 700 int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 701 int context) 702 { 703 return cfg->int_host2rxdma_mon_ring_mask[context]; 704 } 705 706 void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 707 int context, int mask) 708 { 709 cfg->int_host2rxdma_mon_ring_mask[context] = mask; 710 } 711 712 int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 713 int context) 714 { 715 return cfg->int_rxdma2host_mon_ring_mask[context]; 716 } 717 718 void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 719 int context, int mask) 720 { 721 cfg->int_rxdma2host_mon_ring_mask[context] = mask; 722 } 723 724 void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 725 int context, int mask) 726 { 727 cfg->int_rxdma2host_ring_mask[context] = mask; 728 } 729 730 int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 731 int context) 732 { 733 return cfg->int_rxdma2host_ring_mask[context]; 734 } 735 736 void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 737 int context, int mask) 738 { 739 cfg->int_host2rxdma_ring_mask[context] = mask; 740 } 741 742 int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 743 int context) 744 { 745 return cfg->int_host2rxdma_ring_mask[context]; 746 } 747 748 void wlan_cfg_set_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx, 749 int hw_macid) 750 { 751 qdf_assert_always(pdev_idx < MAX_PDEV_CNT); 752 cfg->hw_macid[pdev_idx] = hw_macid; 753 } 754 755 int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx) 756 { 757 qdf_assert_always(pdev_idx < MAX_PDEV_CNT); 758 return cfg->hw_macid[pdev_idx]; 759 } 760 761 int wlan_cfg_get_target_pdev_id(struct wlan_cfg_dp_soc_ctxt *cfg, 762 int hw_macid) 763 { 764 int idx; 765 766 for (idx = 0; idx < MAX_PDEV_CNT; idx++) { 767 if (cfg->hw_macid[idx] == hw_macid) 768 return (idx + 1); 769 } 770 qdf_assert_always(idx < MAX_PDEV_CNT); 771 return WLAN_INVALID_PDEV_ID; 772 } 773 774 void wlan_cfg_set_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx, 775 int hw_macid) 776 { 777 qdf_assert_always((pdev_idx < MAX_PDEV_CNT) || 778 (pdev_idx == INVALID_PDEV_ID)); 779 qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW); 780 cfg->hw_macid_pdev_id_map[hw_macid] = pdev_idx; 781 } 782 783 int wlan_cfg_get_pdev_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int hw_macid) 784 { 785 qdf_assert_always(hw_macid < MAX_NUM_LMAC_HW); 786 return cfg->hw_macid_pdev_id_map[hw_macid]; 787 } 788 789 void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 790 int context, int mask) 791 { 792 cfg->int_ce_ring_mask[context] = mask; 793 } 794 795 void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context, 796 int mask) 797 { 798 cfg->int_rx_ring_mask[context] = mask; 799 } 800 801 int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 802 int context, int mask) 803 { 804 return cfg->int_rx_err_ring_mask[context] = mask; 805 } 806 807 int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 808 int context, int mask) 809 { 810 return cfg->int_rx_wbm_rel_ring_mask[context] = mask; 811 } 812 813 int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 814 int context, int mask) 815 { 816 return cfg->int_reo_status_ring_mask[context] = mask; 817 } 818 819 int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg) 820 { 821 return cfg->num_int_ctxts; 822 } 823 824 int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 825 { 826 return cfg->int_tx_ring_mask[context]; 827 } 828 829 int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 830 { 831 return cfg->int_rx_ring_mask[context]; 832 } 833 834 int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 835 int context) 836 { 837 return cfg->int_rx_err_ring_mask[context]; 838 } 839 840 int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 841 int context) 842 { 843 return cfg->int_rx_wbm_rel_ring_mask[context]; 844 } 845 846 int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 847 int context) 848 { 849 return cfg->int_reo_status_ring_mask[context]; 850 } 851 852 int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 853 { 854 return cfg->int_rx_mon_ring_mask[context]; 855 } 856 857 int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 858 { 859 return cfg->int_ce_ring_mask[context]; 860 } 861 862 uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg) 863 { 864 return cfg->max_clients; 865 } 866 867 uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg) 868 { 869 return cfg->max_alloc_size; 870 } 871 872 int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) 873 { 874 return cfg->per_pdev_tx_ring; 875 } 876 877 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg) 878 { 879 return cfg->per_pdev_lmac_ring; 880 } 881 882 #ifdef DP_MEMORY_OPT 883 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) 884 { 885 return 1; 886 } 887 #else 888 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) 889 { 890 return cfg->num_tcl_data_rings; 891 } 892 #endif 893 894 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 895 { 896 return cfg->tx_ring_size; 897 } 898 899 int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 900 { 901 return cfg->tx_comp_ring_size; 902 } 903 904 int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) 905 { 906 return cfg->per_pdev_rx_ring; 907 } 908 909 int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg) 910 { 911 return cfg->num_reo_dest_rings; 912 } 913 914 int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg) 915 { 916 return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/ 917 } 918 919 int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg) 920 { 921 return cfg->num_tx_desc_pool; 922 } 923 924 void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool) 925 { 926 cfg->num_tx_desc_pool = num_pool; 927 } 928 929 int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg) 930 { 931 return cfg->num_tx_ext_desc_pool; 932 } 933 934 void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool) 935 { 936 cfg->num_tx_ext_desc_pool = num_pool; 937 } 938 939 int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 940 { 941 return cfg->reo_dst_ring_size; 942 } 943 944 void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg, 945 int reo_dst_ring_size) 946 { 947 cfg->reo_dst_ring_size = reo_dst_ring_size; 948 } 949 950 void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg, 951 bool raw_mode_war) 952 { 953 cfg->raw_mode_war = raw_mode_war; 954 } 955 956 bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg) 957 { 958 return cfg->raw_mode_war; 959 } 960 961 int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg) 962 { 963 return cfg->num_tx_desc; 964 } 965 966 void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc) 967 { 968 cfg->num_tx_desc = num_desc; 969 } 970 971 int wlan_cfg_get_min_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg) 972 { 973 return cfg->min_tx_desc; 974 } 975 976 int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg) 977 { 978 return cfg->num_tx_ext_desc; 979 } 980 981 void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc) 982 { 983 cfg->num_tx_ext_desc = num_ext_desc; 984 } 985 986 uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg) 987 { 988 /* TODO: This should be calculated based on target capabilities */ 989 return cfg->max_peer_id; 990 } 991 992 int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 993 { 994 return cfg->dma_mon_buf_ring_size; 995 } 996 997 int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 998 { 999 return cfg->dma_mon_dest_ring_size; 1000 } 1001 1002 int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 1003 { 1004 return cfg->dma_mon_status_ring_size; 1005 } 1006 1007 int 1008 wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 1009 { 1010 return cfg->rxdma_monitor_desc_ring; 1011 } 1012 1013 int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 1014 { 1015 return cfg->rx_dma_buf_ring_size; 1016 } 1017 1018 int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg) 1019 { 1020 return cfg->num_mac_rings; 1021 } 1022 1023 bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1024 { 1025 return cfg->gro_enabled; 1026 } 1027 1028 bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1029 { 1030 return cfg->lro_enabled; 1031 } 1032 1033 bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1034 { 1035 return cfg->ipa_enabled; 1036 } 1037 1038 void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val) 1039 { 1040 cfg->rx_hash = val; 1041 } 1042 1043 bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1044 { 1045 return cfg->rx_hash; 1046 } 1047 1048 int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg) 1049 { 1050 return cfg->nss_enabled; 1051 } 1052 1053 void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled) 1054 { 1055 cfg->nss_enabled = nss_enabled; 1056 } 1057 1058 int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg) 1059 { 1060 return cfg->nss_cfg; 1061 } 1062 1063 void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg) 1064 { 1065 cfg->nss_cfg = nss_cfg; 1066 if (cfg->nss_cfg) 1067 cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss; 1068 } 1069 1070 int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg) 1071 { 1072 return cfg->int_batch_threshold_tx; 1073 } 1074 1075 int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg) 1076 { 1077 return cfg->int_timer_threshold_tx; 1078 } 1079 1080 int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg) 1081 { 1082 return cfg->int_batch_threshold_rx; 1083 } 1084 1085 int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg) 1086 { 1087 return cfg->int_timer_threshold_rx; 1088 } 1089 1090 int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) 1091 { 1092 return cfg->int_batch_threshold_other; 1093 } 1094 1095 int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) 1096 { 1097 return cfg->int_timer_threshold_other; 1098 } 1099 1100 int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg) 1101 { 1102 return cfg->int_timer_threshold_mon; 1103 } 1104 1105 int wlan_cfg_get_nan_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg) 1106 { 1107 return cfg->nan_tcp_udp_checksumoffload; 1108 } 1109 1110 int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg) 1111 { 1112 return cfg->tcp_udp_checksumoffload; 1113 } 1114 1115 int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg) 1116 { 1117 return cfg->rx_defrag_min_timeout; 1118 } 1119 1120 int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg) 1121 { 1122 return cfg->defrag_timeout_check; 1123 } 1124 1125 int 1126 wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1127 { 1128 return cfg->wbm_release_ring; 1129 } 1130 1131 int 1132 wlan_cfg_get_dp_soc_tcl_cmd_credit_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1133 { 1134 return cfg->tcl_cmd_credit_ring; 1135 } 1136 1137 int 1138 wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1139 { 1140 return cfg->tcl_status_ring; 1141 } 1142 1143 int 1144 wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1145 { 1146 return cfg->reo_reinject_ring; 1147 } 1148 1149 int 1150 wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1151 { 1152 return cfg->rx_release_ring; 1153 } 1154 1155 int 1156 wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1157 { 1158 return cfg->reo_exception_ring; 1159 } 1160 1161 int 1162 wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1163 { 1164 return cfg->reo_cmd_ring; 1165 } 1166 1167 int 1168 wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1169 { 1170 return cfg->reo_status_ring; 1171 } 1172 1173 int 1174 wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1175 { 1176 return cfg->rxdma_refill_ring; 1177 } 1178 1179 int 1180 wlan_cfg_get_dp_soc_tx_desc_limit_0(struct wlan_cfg_dp_soc_ctxt *cfg) 1181 { 1182 return cfg->tx_desc_limit_0; 1183 } 1184 1185 int 1186 wlan_cfg_get_dp_soc_tx_desc_limit_1(struct wlan_cfg_dp_soc_ctxt *cfg) 1187 { 1188 return cfg->tx_desc_limit_1; 1189 } 1190 1191 int 1192 wlan_cfg_get_dp_soc_tx_desc_limit_2(struct wlan_cfg_dp_soc_ctxt *cfg) 1193 { 1194 return cfg->tx_desc_limit_2; 1195 } 1196 1197 int 1198 wlan_cfg_get_dp_soc_tx_device_limit(struct wlan_cfg_dp_soc_ctxt *cfg) 1199 { 1200 return cfg->tx_device_limit; 1201 } 1202 1203 int 1204 wlan_cfg_get_dp_soc_tx_sw_internode_queue(struct wlan_cfg_dp_soc_ctxt *cfg) 1205 { 1206 return cfg->tx_sw_internode_queue; 1207 } 1208 1209 int 1210 wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1211 { 1212 return cfg->rxdma_err_dst_ring; 1213 } 1214 1215 int 1216 wlan_cfg_get_dp_soc_rx_sw_desc_weight(struct wlan_cfg_dp_soc_ctxt *cfg) 1217 { 1218 return cfg->rx_sw_desc_weight; 1219 } 1220 1221 bool 1222 wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, 1223 enum cdp_capabilities dp_caps) 1224 { 1225 switch (dp_caps) { 1226 case CDP_CFG_DP_TSO: 1227 return cfg->tso_enabled; 1228 case CDP_CFG_DP_LRO: 1229 return cfg->lro_enabled; 1230 case CDP_CFG_DP_SG: 1231 return cfg->sg_enabled; 1232 case CDP_CFG_DP_GRO: 1233 return cfg->gro_enabled; 1234 case CDP_CFG_DP_OL_TX_CSUM: 1235 return cfg->ol_tx_csum_enabled; 1236 case CDP_CFG_DP_OL_RX_CSUM: 1237 return cfg->ol_rx_csum_enabled; 1238 case CDP_CFG_DP_RAWMODE: 1239 return cfg->rawmode_enabled; 1240 case CDP_CFG_DP_PEER_FLOW_CTRL: 1241 return cfg->peer_flow_ctrl_enabled; 1242 default: 1243 return false; 1244 } 1245 } 1246 1247 void wlan_cfg_set_tso_desc_attach_defer(struct wlan_cfg_dp_soc_ctxt *cfg, 1248 bool val) 1249 { 1250 cfg->is_tso_desc_attach_defer = val; 1251 } 1252 1253 bool wlan_cfg_is_tso_desc_attach_defer(struct wlan_cfg_dp_soc_ctxt *cfg) 1254 { 1255 return cfg->is_tso_desc_attach_defer; 1256 } 1257 1258 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 1259 /** 1260 * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold 1261 * @cfg: config context 1262 * 1263 * Return: stop threshold 1264 */ 1265 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg) 1266 { 1267 return cfg->tx_flow_stop_queue_threshold; 1268 } 1269 1270 /** 1271 * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset 1272 * for TX to resume 1273 * @cfg: config context 1274 * 1275 * Return: stop threshold 1276 */ 1277 int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg) 1278 { 1279 return cfg->tx_flow_start_queue_offset; 1280 } 1281 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ 1282 1283 void wlan_cfg_set_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg, 1284 bool val) 1285 { 1286 cfg->is_rx_flow_tag_enabled = val; 1287 } 1288 1289 uint8_t *wlan_cfg_rx_fst_get_hash_key(struct wlan_cfg_dp_soc_ctxt *cfg) 1290 { 1291 return cfg->rx_toeplitz_hash_key; 1292 } 1293 1294 uint8_t wlan_cfg_rx_fst_get_max_search(struct wlan_cfg_dp_soc_ctxt *cfg) 1295 { 1296 return cfg->rx_flow_max_search; 1297 } 1298 1299 bool wlan_cfg_is_rx_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1300 { 1301 return cfg->is_rx_flow_tag_enabled; 1302 } 1303 1304 #ifdef WLAN_SUPPORT_RX_FISA 1305 bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1306 { 1307 return (bool)(cfg->is_rx_fisa_enabled); 1308 } 1309 #else 1310 bool wlan_cfg_is_rx_fisa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1311 { 1312 return false; 1313 } 1314 #endif 1315 1316 void 1317 wlan_cfg_set_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg, 1318 bool val) 1319 { 1320 cfg->is_rx_flow_search_table_per_pdev = val; 1321 } 1322 1323 bool wlan_cfg_is_rx_flow_search_table_per_pdev(struct wlan_cfg_dp_soc_ctxt *cfg) 1324 { 1325 return cfg->is_rx_flow_search_table_per_pdev; 1326 } 1327 1328 void wlan_cfg_set_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg, 1329 uint16_t val) 1330 { 1331 cfg->rx_flow_search_table_size = val; 1332 } 1333 1334 uint16_t 1335 wlan_cfg_get_rx_flow_search_table_size(struct wlan_cfg_dp_soc_ctxt *cfg) 1336 { 1337 return cfg->rx_flow_search_table_size; 1338 } 1339 1340 void 1341 wlan_cfg_set_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg, 1342 bool val) 1343 { 1344 cfg->is_rx_mon_protocol_flow_tag_enabled = val; 1345 } 1346 1347 bool 1348 wlan_cfg_is_rx_mon_protocol_flow_tag_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 1349 { 1350 return cfg->is_rx_mon_protocol_flow_tag_enabled; 1351 } 1352