1 /* 2 * Copyright (c) 2016-2018 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 31 /* 32 * FIX THIS - 33 * For now, all these configuration parameters are hardcoded. 34 * Many of these should actually be coming from dts file/ini file 35 */ 36 37 /* 38 * The max allowed size for tx comp ring is 8191. 39 * This is limitted by h/w ring max size. 40 * As this is not a power of 2 it does not work with nss offload so the 41 * nearest available size which is power of 2 is 4096 chosen for nss 42 */ 43 44 #define WLAN_CFG_TX_RING_MASK_0 0x1 45 #define WLAN_CFG_TX_RING_MASK_1 0x2 46 #define WLAN_CFG_TX_RING_MASK_2 0x4 47 #define WLAN_CFG_TX_RING_MASK_3 0x0 48 49 #define WLAN_CFG_RX_RING_MASK_0 0x1 50 #define WLAN_CFG_RX_RING_MASK_1 0x2 51 #define WLAN_CFG_RX_RING_MASK_2 0x4 52 #define WLAN_CFG_RX_RING_MASK_3 0x8 53 54 #define WLAN_CFG_RX_MON_RING_MASK_0 0x1 55 #define WLAN_CFG_RX_MON_RING_MASK_1 0x2 56 #define WLAN_CFG_RX_MON_RING_MASK_2 0x4 57 #define WLAN_CFG_RX_MON_RING_MASK_3 0x0 58 59 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0 0x1 60 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1 0x2 61 #define WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2 0x4 62 63 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0 0x1 64 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1 0x2 65 #define WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2 0x4 66 67 #define WLAN_CFG_RX_ERR_RING_MASK_0 0x1 68 #define WLAN_CFG_RX_ERR_RING_MASK_1 0x0 69 #define WLAN_CFG_RX_ERR_RING_MASK_2 0x0 70 #define WLAN_CFG_RX_ERR_RING_MASK_3 0x0 71 72 #define WLAN_CFG_RX_WBM_REL_RING_MASK_0 0x1 73 #define WLAN_CFG_RX_WBM_REL_RING_MASK_1 0x0 74 #define WLAN_CFG_RX_WBM_REL_RING_MASK_2 0x0 75 #define WLAN_CFG_RX_WBM_REL_RING_MASK_3 0x0 76 77 #define WLAN_CFG_REO_STATUS_RING_MASK_0 0x1 78 #define WLAN_CFG_REO_STATUS_RING_MASK_1 0x0 79 #define WLAN_CFG_REO_STATUS_RING_MASK_2 0x0 80 #define WLAN_CFG_REO_STATUS_RING_MASK_3 0x0 81 82 #define WLAN_CFG_RXDMA2HOST_RING_MASK_0 0x1 83 #define WLAN_CFG_RXDMA2HOST_RING_MASK_1 0x2 84 #define WLAN_CFG_RXDMA2HOST_RING_MASK_2 0x4 85 #define WLAN_CFG_RXDMA2HOST_RING_MASK_3 0x0 86 87 #define WLAN_CFG_HOST2RXDMA_RING_MASK_0 0x1 88 #define WLAN_CFG_HOST2RXDMA_RING_MASK_1 0x2 89 #define WLAN_CFG_HOST2RXDMA_RING_MASK_2 0x4 90 #define WLAN_CFG_HOST2RXDMA_RING_MASK_3 0x0 91 92 #ifdef CONFIG_MCL 93 static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 94 0, 95 WLAN_CFG_TX_RING_MASK_0, 96 0, 97 0, 98 0, 99 0, 100 0}; 101 102 #ifndef IPA_OFFLOAD 103 static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 104 0, 105 0, 106 WLAN_CFG_RX_RING_MASK_0, 107 0, 108 WLAN_CFG_RX_RING_MASK_1, 109 WLAN_CFG_RX_RING_MASK_2, 110 WLAN_CFG_RX_RING_MASK_3}; 111 #else 112 static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 113 0, 114 0, 115 WLAN_CFG_RX_RING_MASK_0, 116 0, 117 WLAN_CFG_RX_RING_MASK_1, 118 WLAN_CFG_RX_RING_MASK_2, 119 0}; 120 #endif 121 122 static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 123 0, 124 0, 125 0, 126 WLAN_CFG_RX_MON_RING_MASK_0, 127 WLAN_CFG_RX_MON_RING_MASK_1, 128 WLAN_CFG_RX_MON_RING_MASK_2, 129 WLAN_CFG_RX_MON_RING_MASK_3}; 130 131 static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 132 WLAN_CFG_HOST2RXDMA_RING_MASK_0, 133 0, 134 0, 135 0, 136 0, 137 0, 138 0}; 139 140 static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 141 WLAN_CFG_RXDMA2HOST_RING_MASK_0, 142 WLAN_CFG_RXDMA2HOST_RING_MASK_1, 143 WLAN_CFG_RXDMA2HOST_RING_MASK_2, 144 WLAN_CFG_RXDMA2HOST_RING_MASK_3, 145 0, 146 0, 147 0}; 148 149 static const int host2rxdma_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 150 0, 151 0, 152 0, 153 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0, 154 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1, 155 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2}; 156 157 static const int rxdma2host_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 158 0, 159 0, 160 0, 161 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0, 162 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1, 163 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2}; 164 #else 165 static const int tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 166 WLAN_CFG_TX_RING_MASK_0, 167 WLAN_CFG_TX_RING_MASK_1, 168 WLAN_CFG_TX_RING_MASK_2, 169 WLAN_CFG_TX_RING_MASK_3}; 170 171 static const int rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 172 0, 173 0, 174 0, 175 0, 176 0, 177 0, 178 0, 179 WLAN_CFG_RX_RING_MASK_0, 180 WLAN_CFG_RX_RING_MASK_1, 181 WLAN_CFG_RX_RING_MASK_2, 182 WLAN_CFG_RX_RING_MASK_3}; 183 184 static const int rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 185 0, 186 0, 187 0, 188 0, 189 WLAN_CFG_RX_MON_RING_MASK_0, 190 WLAN_CFG_RX_MON_RING_MASK_1, 191 WLAN_CFG_RX_MON_RING_MASK_2}; 192 193 static const int host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 194 WLAN_CFG_HOST2RXDMA_RING_MASK_0, 195 WLAN_CFG_HOST2RXDMA_RING_MASK_1, 196 WLAN_CFG_HOST2RXDMA_RING_MASK_2, 197 WLAN_CFG_HOST2RXDMA_RING_MASK_3}; 198 199 static const int rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 200 WLAN_CFG_RXDMA2HOST_RING_MASK_0, 201 WLAN_CFG_RXDMA2HOST_RING_MASK_1, 202 WLAN_CFG_RXDMA2HOST_RING_MASK_2, 203 WLAN_CFG_RXDMA2HOST_RING_MASK_3}; 204 205 static const int host2rxdma_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 206 0, 207 0, 208 0, 209 0, 210 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_0, 211 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_1, 212 WLAN_CFG_HOST2RXDMA_MON_RING_MASK_2}; 213 214 static const int rxdma2host_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 215 0, 216 0, 217 0, 218 0, 219 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_0, 220 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_1, 221 WLAN_CFG_RXDMA2HOST_MON_RING_MASK_2}; 222 #endif 223 224 static const int rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 225 WLAN_CFG_RX_ERR_RING_MASK_0, 226 WLAN_CFG_RX_ERR_RING_MASK_1, 227 WLAN_CFG_RX_ERR_RING_MASK_2, 228 WLAN_CFG_RX_ERR_RING_MASK_3}; 229 230 static const int rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 231 WLAN_CFG_RX_WBM_REL_RING_MASK_0, 232 WLAN_CFG_RX_WBM_REL_RING_MASK_1, 233 WLAN_CFG_RX_WBM_REL_RING_MASK_2, 234 WLAN_CFG_RX_WBM_REL_RING_MASK_3}; 235 236 static const int reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS] = { 237 WLAN_CFG_REO_STATUS_RING_MASK_0, 238 WLAN_CFG_REO_STATUS_RING_MASK_1, 239 WLAN_CFG_REO_STATUS_RING_MASK_2, 240 WLAN_CFG_REO_STATUS_RING_MASK_3}; 241 242 /** 243 * wlan_cfg_soc_attach() - Allocate and prepare SoC configuration 244 * @psoc - Object manager psoc 245 * Return: wlan_cfg_ctx - Handle to Configuration context 246 */ 247 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *psoc) 248 { 249 int i = 0; 250 251 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx = 252 qdf_mem_malloc(sizeof(struct wlan_cfg_dp_soc_ctxt)); 253 254 if (wlan_cfg_ctx == NULL) 255 return NULL; 256 257 wlan_cfg_ctx->rxdma1_enable = WLAN_CFG_RXDMA1_ENABLE; 258 wlan_cfg_ctx->num_int_ctxts = WLAN_CFG_INT_NUM_CONTEXTS; 259 wlan_cfg_ctx->max_clients = cfg_get(psoc, CFG_DP_MAX_CLIENTS); 260 wlan_cfg_ctx->max_alloc_size = cfg_get(psoc, CFG_DP_MAX_ALLOC_SIZE); 261 wlan_cfg_ctx->per_pdev_tx_ring = cfg_get(psoc, CFG_DP_PDEV_TX_RING); 262 wlan_cfg_ctx->num_tcl_data_rings = cfg_get(psoc, CFG_DP_TCL_DATA_RINGS); 263 wlan_cfg_ctx->per_pdev_rx_ring = cfg_get(psoc, CFG_DP_PDEV_RX_RING); 264 wlan_cfg_ctx->per_pdev_lmac_ring = cfg_get(psoc, CFG_DP_PDEV_LMAC_RING); 265 wlan_cfg_ctx->num_reo_dest_rings = cfg_get(psoc, CFG_DP_REO_DEST_RINGS); 266 wlan_cfg_ctx->num_tx_desc_pool = MAX_TXDESC_POOLS; 267 wlan_cfg_ctx->num_tx_ext_desc_pool = cfg_get(psoc, 268 CFG_DP_TX_EXT_DESC_POOLS); 269 wlan_cfg_ctx->num_tx_desc = cfg_get(psoc, CFG_DP_TX_DESC); 270 wlan_cfg_ctx->num_tx_ext_desc = cfg_get(psoc, CFG_DP_TX_EXT_DESC); 271 wlan_cfg_ctx->htt_packet_type = cfg_get(psoc, CFG_DP_HTT_PACKET_TYPE); 272 wlan_cfg_ctx->max_peer_id = cfg_get(psoc, CFG_DP_MAX_PEER_ID); 273 274 wlan_cfg_ctx->tx_ring_size = cfg_get(psoc, CFG_DP_TX_RING_SIZE); 275 wlan_cfg_ctx->tx_comp_ring_size = cfg_get(psoc, 276 CFG_DP_TX_COMPL_RING_SIZE); 277 278 wlan_cfg_ctx->tx_comp_ring_size_nss = 279 cfg_get(psoc, CFG_DP_NSS_COMP_RING_SIZE); 280 wlan_cfg_ctx->int_batch_threshold_tx = 281 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_TX); 282 wlan_cfg_ctx->int_timer_threshold_tx = 283 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_TX); 284 wlan_cfg_ctx->int_batch_threshold_rx = 285 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_RX); 286 wlan_cfg_ctx->int_timer_threshold_rx = 287 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_RX); 288 wlan_cfg_ctx->int_batch_threshold_other = 289 cfg_get(psoc, CFG_DP_INT_BATCH_THRESHOLD_OTHER); 290 wlan_cfg_ctx->int_timer_threshold_other = 291 cfg_get(psoc, CFG_DP_INT_TIMER_THRESHOLD_OTHER); 292 293 for (i = 0; i < WLAN_CFG_INT_NUM_CONTEXTS; i++) { 294 wlan_cfg_ctx->int_tx_ring_mask[i] = tx_ring_mask[i]; 295 wlan_cfg_ctx->int_rx_ring_mask[i] = rx_ring_mask[i]; 296 wlan_cfg_ctx->int_rx_mon_ring_mask[i] = rx_mon_ring_mask[i]; 297 wlan_cfg_ctx->int_rx_err_ring_mask[i] = rx_err_ring_mask[i]; 298 wlan_cfg_ctx->int_rx_wbm_rel_ring_mask[i] = 299 rx_wbm_rel_ring_mask[i]; 300 wlan_cfg_ctx->int_reo_status_ring_mask[i] = 301 reo_status_ring_mask[i]; 302 wlan_cfg_ctx->int_rxdma2host_ring_mask[i] = 303 rxdma2host_ring_mask[i]; 304 wlan_cfg_ctx->int_host2rxdma_ring_mask[i] = 305 host2rxdma_ring_mask[i]; 306 wlan_cfg_ctx->int_host2rxdma_mon_ring_mask[i] = 307 host2rxdma_mon_ring_mask[i]; 308 wlan_cfg_ctx->int_rxdma2host_mon_ring_mask[i] = 309 rxdma2host_mon_ring_mask[i]; 310 } 311 312 /* This is default mapping and can be overridden by HW config 313 * received from FW */ 314 wlan_cfg_set_hw_macid(wlan_cfg_ctx, 0, 1); 315 if (MAX_PDEV_CNT > 1) 316 wlan_cfg_set_hw_macid(wlan_cfg_ctx, 1, 3); 317 if (MAX_PDEV_CNT > 2) 318 wlan_cfg_set_hw_macid(wlan_cfg_ctx, 2, 2); 319 320 wlan_cfg_ctx->base_hw_macid = cfg_get(psoc, CFG_DP_BASE_HW_MAC_ID); 321 322 wlan_cfg_ctx->rx_hash = cfg_get(psoc, CFG_DP_RX_HASH); 323 wlan_cfg_ctx->tso_enabled = cfg_get(psoc, CFG_DP_TSO); 324 wlan_cfg_ctx->lro_enabled = cfg_get(psoc, CFG_DP_LRO); 325 wlan_cfg_ctx->sg_enabled = cfg_get(psoc, CFG_DP_SG); 326 wlan_cfg_ctx->gro_enabled = cfg_get(psoc, CFG_DP_GRO); 327 wlan_cfg_ctx->ol_tx_csum_enabled = cfg_get(psoc, CFG_DP_OL_TX_CSUM); 328 wlan_cfg_ctx->ol_rx_csum_enabled = cfg_get(psoc, CFG_DP_OL_RX_CSUM); 329 wlan_cfg_ctx->rawmode_enabled = cfg_get(psoc, CFG_DP_RAWMODE); 330 wlan_cfg_ctx->peer_flow_ctrl_enabled = 331 cfg_get(psoc, CFG_DP_PEER_FLOW_CTRL); 332 wlan_cfg_ctx->napi_enabled = cfg_get(psoc, CFG_DP_NAPI); 333 /*Enable checksum offload by default*/ 334 wlan_cfg_ctx->tcp_udp_checksumoffload = 335 cfg_get(psoc, CFG_DP_TCP_UDP_CKSUM_OFFLOAD); 336 337 wlan_cfg_ctx->defrag_timeout_check = 338 cfg_get(psoc, CFG_DP_DEFRAG_TIMEOUT_CHECK); 339 wlan_cfg_ctx->rx_defrag_min_timeout = 340 cfg_get(psoc, CFG_DP_RX_DEFRAG_TIMEOUT); 341 342 wlan_cfg_ctx->wbm_release_ring = cfg_get(psoc, 343 CFG_DP_WBM_RELEASE_RING); 344 wlan_cfg_ctx->tcl_cmd_ring = cfg_get(psoc, 345 CFG_DP_TCL_CMD_RING); 346 wlan_cfg_ctx->tcl_status_ring = cfg_get(psoc, 347 CFG_DP_TCL_STATUS_RING); 348 wlan_cfg_ctx->reo_reinject_ring = cfg_get(psoc, 349 CFG_DP_REO_REINJECT_RING); 350 wlan_cfg_ctx->rx_release_ring = cfg_get(psoc, 351 CFG_DP_RX_RELEASE_RING); 352 wlan_cfg_ctx->reo_exception_ring = cfg_get(psoc, 353 CFG_DP_REO_EXCEPTION_RING); 354 wlan_cfg_ctx->reo_cmd_ring = cfg_get(psoc, 355 CFG_DP_REO_CMD_RING); 356 wlan_cfg_ctx->reo_status_ring = cfg_get(psoc, 357 CFG_DP_REO_STATUS_RING); 358 wlan_cfg_ctx->rxdma_refill_ring = cfg_get(psoc, 359 CFG_DP_RXDMA_REFILL_RING); 360 wlan_cfg_ctx->rxdma_err_dst_ring = cfg_get(psoc, 361 CFG_DP_RXDMA_ERR_DST_RING); 362 wlan_cfg_ctx->enable_data_stall_detection = 363 cfg_get(psoc, CFG_DP_ENABLE_DATA_STALL_DETECTION); 364 wlan_cfg_ctx->tx_flow_start_queue_offset = 365 cfg_get(psoc, CFG_DP_TX_FLOW_START_QUEUE_OFFSET); 366 wlan_cfg_ctx->tx_flow_stop_queue_threshold = 367 cfg_get(psoc, CFG_DP_TX_FLOW_STOP_QUEUE_TH); 368 wlan_cfg_ctx->disable_intra_bss_fwd = 369 cfg_get(psoc, CFG_DP_AP_STA_SECURITY_SEPERATION); 370 371 return wlan_cfg_ctx; 372 } 373 374 void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx) 375 { 376 qdf_mem_free(wlan_cfg_ctx); 377 } 378 379 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void *psoc) 380 { 381 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx = 382 qdf_mem_malloc(sizeof(struct wlan_cfg_dp_pdev_ctxt)); 383 384 if (wlan_cfg_ctx == NULL) 385 return NULL; 386 387 wlan_cfg_ctx->rx_dma_buf_ring_size = cfg_get(psoc, 388 CFG_DP_RXDMA_BUF_RING); 389 wlan_cfg_ctx->dma_mon_buf_ring_size = cfg_get(psoc, 390 CFG_DP_RXDMA_MONITOR_BUF_RING); 391 wlan_cfg_ctx->dma_mon_dest_ring_size = cfg_get(psoc, 392 CFG_DP_RXDMA_MONITOR_DST_RING); 393 wlan_cfg_ctx->dma_mon_status_ring_size = cfg_get(psoc, 394 CFG_DP_RXDMA_MONITOR_STATUS_RING); 395 wlan_cfg_ctx->rxdma_monitor_desc_ring = cfg_get(psoc, 396 CFG_DP_RXDMA_MONITOR_DESC_RING); 397 wlan_cfg_ctx->num_mac_rings = NUM_RXDMA_RINGS_PER_PDEV; 398 399 return wlan_cfg_ctx; 400 } 401 402 void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx) 403 { 404 qdf_mem_free(wlan_cfg_ctx); 405 } 406 407 void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num) 408 { 409 cfg->num_int_ctxts = num; 410 } 411 412 void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val) 413 { 414 cfg->max_peer_id = val;; 415 } 416 417 void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 418 int context, int mask) 419 { 420 cfg->int_tx_ring_mask[context] = mask; 421 } 422 423 void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 424 int context, int mask) 425 { 426 cfg->int_rx_ring_mask[context] = mask; 427 } 428 429 void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 430 int context, int mask) 431 { 432 cfg->int_rx_mon_ring_mask[context] = mask; 433 } 434 435 int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 436 int context) 437 { 438 return cfg->int_host2rxdma_mon_ring_mask[context]; 439 } 440 441 void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 442 int context, int mask) 443 { 444 cfg->int_host2rxdma_mon_ring_mask[context] = mask; 445 } 446 447 int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 448 int context) 449 { 450 return cfg->int_rxdma2host_mon_ring_mask[context]; 451 } 452 453 void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 454 int context, int mask) 455 { 456 cfg->int_rxdma2host_mon_ring_mask[context] = mask; 457 } 458 459 void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 460 int context, int mask) 461 { 462 cfg->int_rxdma2host_ring_mask[context] = mask; 463 } 464 465 int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 466 int context) 467 { 468 return cfg->int_rxdma2host_ring_mask[context]; 469 } 470 471 void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 472 int context, int mask) 473 { 474 cfg->int_host2rxdma_ring_mask[context] = mask; 475 } 476 477 int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 478 int context) 479 { 480 return cfg->int_host2rxdma_ring_mask[context]; 481 } 482 483 void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx, 484 int hw_macid) 485 { 486 qdf_assert_always(pdev_idx < MAX_PDEV_CNT); 487 cfg->hw_macid[pdev_idx] = hw_macid; 488 } 489 490 int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx) 491 { 492 qdf_assert_always(pdev_idx < MAX_PDEV_CNT); 493 return cfg->hw_macid[pdev_idx]; 494 } 495 496 int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx) 497 { 498 qdf_assert_always(pdev_idx < MAX_PDEV_CNT); 499 return cfg->hw_macid[pdev_idx] - cfg->base_hw_macid; 500 } 501 502 void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 503 int context, int mask) 504 { 505 cfg->int_ce_ring_mask[context] = mask; 506 } 507 508 void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context, 509 int mask) 510 { 511 cfg->int_rx_ring_mask[context] = mask; 512 } 513 514 int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 515 int context, int mask) 516 { 517 return cfg->int_rx_err_ring_mask[context] = mask; 518 } 519 520 int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 521 int context, int mask) 522 { 523 return cfg->int_rx_wbm_rel_ring_mask[context] = mask; 524 } 525 526 int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 527 int context, int mask) 528 { 529 return cfg->int_reo_status_ring_mask[context] = mask; 530 } 531 532 int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg) 533 { 534 return cfg->num_int_ctxts; 535 } 536 537 int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 538 { 539 return cfg->int_tx_ring_mask[context]; 540 } 541 542 int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 543 { 544 return cfg->int_rx_ring_mask[context]; 545 } 546 547 int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 548 int context) 549 { 550 return cfg->int_rx_err_ring_mask[context]; 551 } 552 553 int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 554 int context) 555 { 556 return cfg->int_rx_wbm_rel_ring_mask[context]; 557 } 558 559 int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 560 int context) 561 { 562 return cfg->int_reo_status_ring_mask[context]; 563 } 564 565 int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 566 { 567 return cfg->int_rx_mon_ring_mask[context]; 568 } 569 570 int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context) 571 { 572 return cfg->int_ce_ring_mask[context]; 573 } 574 575 uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *cfg) 576 { 577 return cfg->max_clients; 578 } 579 580 uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *cfg) 581 { 582 return cfg->max_alloc_size; 583 } 584 585 int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) 586 { 587 return cfg->per_pdev_tx_ring; 588 } 589 590 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *cfg) 591 { 592 return cfg->per_pdev_lmac_ring; 593 } 594 595 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *cfg) 596 { 597 return cfg->num_tcl_data_rings; 598 } 599 600 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 601 { 602 return cfg->tx_ring_size; 603 } 604 605 int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 606 { 607 return cfg->tx_comp_ring_size; 608 } 609 610 int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *cfg) 611 { 612 return cfg->per_pdev_rx_ring; 613 } 614 615 int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *cfg) 616 { 617 return cfg->num_reo_dest_rings; 618 } 619 620 int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *cfg) 621 { 622 return cfg->htt_packet_type; /*htt_pkt_type_ethernet*/ 623 } 624 625 int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg) 626 { 627 return cfg->num_tx_desc_pool; 628 } 629 630 void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool) 631 { 632 cfg->num_tx_desc_pool = num_pool; 633 } 634 635 int wlan_cfg_get_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg) 636 { 637 return cfg->num_tx_ext_desc_pool; 638 } 639 640 void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool) 641 { 642 cfg->num_tx_ext_desc_pool = num_pool; 643 } 644 645 int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 646 { 647 return cfg->reo_dst_ring_size; 648 } 649 650 void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg, 651 int reo_dst_ring_size) 652 { 653 cfg->reo_dst_ring_size = reo_dst_ring_size; 654 } 655 656 void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg, 657 bool raw_mode_war) 658 { 659 cfg->raw_mode_war = raw_mode_war; 660 } 661 662 bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg) 663 { 664 return cfg->raw_mode_war; 665 } 666 667 int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg) 668 { 669 return cfg->num_tx_desc; 670 } 671 672 void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc) 673 { 674 cfg->num_tx_desc = num_desc; 675 } 676 677 int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg) 678 { 679 return cfg->num_tx_ext_desc; 680 } 681 682 void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc) 683 { 684 cfg->num_tx_ext_desc = num_ext_desc; 685 } 686 687 uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg) 688 { 689 /* TODO: This should be calculated based on target capabilities */ 690 return cfg->max_peer_id; 691 } 692 693 int wlan_cfg_get_dma_mon_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 694 { 695 return cfg->dma_mon_buf_ring_size; 696 } 697 698 int wlan_cfg_get_dma_mon_dest_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 699 { 700 return cfg->dma_mon_dest_ring_size; 701 } 702 703 int wlan_cfg_get_dma_mon_stat_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 704 { 705 return cfg->dma_mon_status_ring_size; 706 } 707 708 int 709 wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 710 { 711 return cfg->rxdma_monitor_desc_ring; 712 } 713 714 int wlan_cfg_get_rx_dma_buf_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg) 715 { 716 return cfg->rx_dma_buf_ring_size; 717 } 718 719 int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg) 720 { 721 return cfg->num_mac_rings; 722 } 723 724 bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 725 { 726 return cfg->gro_enabled; 727 } 728 729 bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 730 { 731 return cfg->lro_enabled; 732 } 733 734 bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 735 { 736 return cfg->ipa_enabled; 737 } 738 739 void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool val) 740 { 741 cfg->rx_hash = val; 742 } 743 744 bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg) 745 { 746 return cfg->rx_hash; 747 } 748 749 int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg) 750 { 751 return cfg->nss_enabled; 752 } 753 754 void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled) 755 { 756 cfg->nss_enabled = nss_enabled; 757 } 758 759 int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg) 760 { 761 return cfg->nss_cfg; 762 } 763 764 void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg) 765 { 766 cfg->nss_cfg = nss_cfg; 767 if (cfg->nss_cfg) 768 cfg->tx_comp_ring_size = cfg->tx_comp_ring_size_nss; 769 } 770 771 int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg) 772 { 773 return cfg->int_batch_threshold_tx; 774 } 775 776 int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg) 777 { 778 return cfg->int_timer_threshold_tx; 779 } 780 781 int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg) 782 { 783 return cfg->int_batch_threshold_rx; 784 } 785 786 int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg) 787 { 788 return cfg->int_timer_threshold_rx; 789 } 790 791 int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) 792 { 793 return cfg->int_batch_threshold_other; 794 } 795 796 int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg) 797 { 798 return cfg->int_timer_threshold_other; 799 } 800 801 int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg) 802 { 803 return cfg->int_timer_threshold_mon; 804 } 805 806 int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg) 807 { 808 return cfg->tcp_udp_checksumoffload; 809 } 810 811 int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg) 812 { 813 return cfg->rx_defrag_min_timeout; 814 } 815 816 int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg) 817 { 818 return cfg->defrag_timeout_check; 819 } 820 821 int 822 wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 823 { 824 return cfg->wbm_release_ring; 825 } 826 827 int 828 wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 829 { 830 return cfg->tcl_cmd_ring; 831 } 832 833 int 834 wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 835 { 836 return cfg->tcl_status_ring; 837 } 838 839 int 840 wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 841 { 842 return cfg->reo_reinject_ring; 843 } 844 845 int 846 wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 847 { 848 return cfg->rx_release_ring; 849 } 850 851 int 852 wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 853 { 854 return cfg->reo_exception_ring; 855 } 856 857 int 858 wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 859 { 860 return cfg->reo_cmd_ring; 861 } 862 863 int 864 wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 865 { 866 return cfg->reo_status_ring; 867 } 868 869 int 870 wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 871 { 872 return cfg->rxdma_refill_ring; 873 } 874 875 int 876 wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg) 877 { 878 return cfg->rxdma_err_dst_ring; 879 } 880 881 bool 882 wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, 883 enum cdp_capabilities dp_caps) 884 { 885 switch (dp_caps) { 886 case CDP_CFG_DP_TSO: 887 return cfg->tso_enabled; 888 case CDP_CFG_DP_LRO: 889 return cfg->lro_enabled; 890 case CDP_CFG_DP_SG: 891 return cfg->sg_enabled; 892 case CDP_CFG_DP_GRO: 893 return cfg->gro_enabled; 894 case CDP_CFG_DP_OL_TX_CSUM: 895 return cfg->ol_tx_csum_enabled; 896 case CDP_CFG_DP_OL_RX_CSUM: 897 return cfg->ol_rx_csum_enabled; 898 case CDP_CFG_DP_RAWMODE: 899 return cfg->rawmode_enabled; 900 case CDP_CFG_DP_PEER_FLOW_CTRL: 901 return cfg->peer_flow_ctrl_enabled; 902 default: 903 return false; 904 } 905 } 906 907 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 908 /** 909 * wlan_cfg_get_tx_flow_stop_queue_th() - Get flow control stop threshold 910 * @cfg: config context 911 * 912 * Return: stop threshold 913 */ 914 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg) 915 { 916 return cfg->tx_flow_stop_queue_threshold; 917 } 918 919 /** 920 * wlan_cfg_get_tx_flow_start_queue_offset() - Get flow control start offset 921 * for TX to resume 922 * @cfg: config context 923 * 924 * Return: stop threshold 925 */ 926 int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg) 927 { 928 return cfg->tx_flow_start_queue_offset; 929 } 930 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ 931