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