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