1 /* 2 * * Copyright (c) 2013-2019 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 #ifndef __WLAN_CFG_H 20 #define __WLAN_CFG_H 21 22 /* 23 * Temporary place holders. These should come either from target config 24 * or platform configuration 25 */ 26 #if defined(CONFIG_MCL) 27 #define MAX_PDEV_CNT 1 28 #define WLAN_CFG_INT_NUM_CONTEXTS 7 29 #define WLAN_CFG_RXDMA1_ENABLE 1 30 /* 31 * This mask defines how many transmit frames account for 1 NAPI work unit 32 * 0 means each tx completion is 1 unit 33 */ 34 #define DP_TX_NAPI_BUDGET_DIV_MASK 0 35 36 /* PPDU Stats Configuration - Configure bitmask for enabling tx ppdu tlv's */ 37 #define DP_PPDU_TXLITE_STATS_BITMASK_CFG 0x1FFF 38 39 #define NUM_RXDMA_RINGS_PER_PDEV 2 40 #else 41 #define MAX_PDEV_CNT 3 42 #define WLAN_CFG_INT_NUM_CONTEXTS 11 43 #define WLAN_CFG_RXDMA1_ENABLE 1 44 /* 45 * This mask defines how many transmit frames account for 1 NAPI work unit 46 * 0xFFFF means each 64K tx frame completions account for 1 unit of NAPI budget 47 */ 48 #define DP_TX_NAPI_BUDGET_DIV_MASK 0xFFFF 49 50 /* PPDU Stats Configuration - Configure bitmask for enabling tx ppdu tlv's */ 51 #define DP_PPDU_TXLITE_STATS_BITMASK_CFG 0xFFFF 52 53 #define NUM_RXDMA_RINGS_PER_PDEV 1 54 #endif 55 56 /* Tx configuration */ 57 #define MAX_LINK_DESC_BANKS 8 58 #define MAX_TXDESC_POOLS 4 59 #define MAX_TCL_DATA_RINGS 4 60 61 /* Rx configuration */ 62 #define MAX_RXDESC_POOLS 4 63 #define MAX_REO_DEST_RINGS 4 64 #define MAX_RX_MAC_RINGS 2 65 66 /* DP process status */ 67 #ifdef CONFIG_MCL 68 #define CONFIG_PROCESS_RX_STATUS 1 69 #define CONFIG_PROCESS_TX_STATUS 1 70 #else 71 #define CONFIG_PROCESS_RX_STATUS 0 72 #define CONFIG_PROCESS_TX_STATUS 0 73 #endif 74 75 /* Miscellaneous configuration */ 76 #define MAX_IDLE_SCATTER_BUFS 16 77 #define DP_MAX_IRQ_PER_CONTEXT 12 78 #define MAX_HTT_METADATA_LEN 32 79 #define MAX_NUM_PEER_ID_PER_PEER 8 80 #define DP_MAX_TIDS 17 81 #define DP_NON_QOS_TID 16 82 83 struct wlan_cfg_dp_pdev_ctxt; 84 85 /** 86 * struct wlan_cfg_dp_soc_ctxt - Configuration parameters for SoC (core TxRx) 87 * @num_int_ctxts: Number of NAPI/Interrupt contexts to be registered for DP 88 * @max_clients: Maximum number of peers/stations supported by device 89 * @max_alloc_size: Maximum allocation size for any dynamic memory 90 * allocation request for this device 91 * @per_pdev_tx_ring: 0: TCL ring is not mapped per radio 92 * 1: Each TCL ring is mapped to one radio/pdev 93 * @num_tcl_data_rings: Number of TCL Data rings supported by device 94 * @per_pdev_rx_ring: 0: REO ring is not mapped per radio 95 * 1: Each REO ring is mapped to one radio/pdev 96 * @num_tx_desc_pool: Number of Tx Descriptor pools 97 * @num_tx_ext_desc_pool: Number of Tx MSDU extension Descriptor pools 98 * @num_tx_desc: Number of Tx Descriptors per pool 99 * @num_tx_ext_desc: Number of Tx MSDU extension Descriptors per pool 100 * @max_peer_id: Maximum value of peer id that FW can assign for a client 101 * @htt_packet_type: Default 802.11 encapsulation type for any VAP created 102 * @int_tx_ring_mask: Bitmap of Tx interrupts mapped to each NAPI/Intr context 103 * @int_rx_ring_mask: Bitmap of Rx interrupts mapped to each NAPI/Intr context 104 * @int_rx_mon_ring_mask: Bitmap of Rx monitor ring interrupts mapped to each 105 * NAPI/Intr context 106 * @int_rx_err_ring_mask: Bitmap of Rx err ring interrupts mapped to each 107 * NAPI/Intr context 108 * @int_wbm_rel_ring_mask: Bitmap of wbm rel ring interrupts mapped to each 109 * NAPI/Intr context 110 * @int_reo_status_ring_mask: Bitmap of reo status ring interrupts mapped to 111 * each NAPI/Intr context 112 * @int_ce_ring_mask: Bitmap of CE interrupts mapped to each NAPI/Intr context 113 * @lro_enabled: enable/disable lro feature 114 * @rx_hash: Enable hash based steering of rx packets 115 * @tso_enabled: enable/disable tso feature 116 * @lro_enabled: enable/disable LRO feature 117 * @sg_enabled: enable disable scatter gather feature 118 * @gro_enabled: enable disable GRO feature 119 * @ipa_enabled: Flag indicating if IPA is enabled 120 * @ol_tx_csum_enabled: Flag indicating if TX csum is enabled 121 * @ol_rx_csum_enabled: Flag indicating if Rx csum is enabled 122 * @rawmode_enabled: Flag indicating if RAW mode is enabled 123 * @peer_flow_ctrl_enabled: Flag indicating if peer flow control is enabled 124 * @napi_enabled: enable/disable interrupt mode for reaping tx and rx packets 125 * @tcp_udp_checksumoffload: enable/disable checksum offload 126 * @nss_cfg: nss configuration 127 * @rx_defrag_min_timeout: rx defrag minimum timeout 128 * @wbm_release_ring: wbm release ring size 129 * @tcl_cmd_ring: tcl cmd ring size 130 * @tcl_status_ring: tcl status ring size 131 * @reo_reinject_ring: reo reinject ring 132 * @rx_release_ring: rx release ring size 133 * @reo_exception_ring: reo exception ring size 134 * @reo_cmd_ring: reo cmd ring size 135 * @reo_status_ring: reo status ting size 136 * @rxdma_refill_ring: rxdma refill ring size 137 * @rxdma_err_dst_ring: rxdma error detination ring size 138 * @raw_mode_war: enable/disable raw mode war 139 */ 140 struct wlan_cfg_dp_soc_ctxt { 141 int num_int_ctxts; 142 int max_clients; 143 int max_alloc_size; 144 int per_pdev_tx_ring; 145 int num_tcl_data_rings; 146 int per_pdev_rx_ring; 147 int per_pdev_lmac_ring; 148 int num_reo_dest_rings; 149 int num_tx_desc_pool; 150 int num_tx_ext_desc_pool; 151 int num_tx_desc; 152 int num_tx_ext_desc; 153 int max_peer_id; 154 int htt_packet_type; 155 int int_batch_threshold_tx; 156 int int_timer_threshold_tx; 157 int int_batch_threshold_rx; 158 int int_timer_threshold_rx; 159 int int_batch_threshold_other; 160 int int_timer_threshold_other; 161 int int_timer_threshold_mon; 162 int tx_ring_size; 163 int tx_comp_ring_size; 164 int tx_comp_ring_size_nss; 165 int int_tx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 166 int int_rx_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 167 int int_rx_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 168 int int_host2rxdma_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 169 int int_rxdma2host_mon_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 170 int int_ce_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 171 int int_rx_err_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 172 int int_rx_wbm_rel_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 173 int int_reo_status_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 174 int int_rxdma2host_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 175 int int_host2rxdma_ring_mask[WLAN_CFG_INT_NUM_CONTEXTS]; 176 int hw_macid[MAX_PDEV_CNT]; 177 int base_hw_macid; 178 bool rx_hash; 179 bool tso_enabled; 180 bool lro_enabled; 181 bool sg_enabled; 182 bool gro_enabled; 183 bool ipa_enabled; 184 bool ol_tx_csum_enabled; 185 bool ol_rx_csum_enabled; 186 bool rawmode_enabled; 187 bool peer_flow_ctrl_enabled; 188 bool napi_enabled; 189 bool tcp_udp_checksumoffload; 190 bool defrag_timeout_check; 191 int nss_cfg; 192 uint32_t tx_flow_stop_queue_threshold; 193 uint32_t tx_flow_start_queue_offset; 194 int rx_defrag_min_timeout; 195 int reo_dst_ring_size; 196 int wbm_release_ring; 197 int tcl_cmd_ring; 198 int tcl_status_ring; 199 int reo_reinject_ring; 200 int rx_release_ring; 201 int reo_exception_ring; 202 int reo_cmd_ring; 203 int reo_status_ring; 204 int rxdma_refill_ring; 205 int rxdma_err_dst_ring; 206 bool raw_mode_war; 207 bool enable_data_stall_detection; 208 bool disable_intra_bss_fwd; 209 bool rxdma1_enable; 210 int max_ast_idx; 211 }; 212 213 /** 214 * struct wlan_cfg_dp_pdev_ctxt - Configuration parameters for pdev (radio) 215 * @rx_dma_buf_ring_size - Size of RxDMA buffer ring 216 * @dma_mon_buf_ring_size - Size of RxDMA Monitor buffer ring 217 * @dma_mon_dest_ring_size - Size of RxDMA Monitor Destination ring 218 * @dma_mon_status_ring_size - Size of RxDMA Monitor Status ring 219 * @rxdma_monitor_desc_ring - rxdma monitor desc ring size 220 */ 221 struct wlan_cfg_dp_pdev_ctxt { 222 int rx_dma_buf_ring_size; 223 int dma_mon_buf_ring_size; 224 int dma_mon_dest_ring_size; 225 int dma_mon_status_ring_size; 226 int rxdma_monitor_desc_ring; 227 int num_mac_rings; 228 int nss_enabled; 229 }; 230 231 /** 232 * wlan_cfg_soc_attach() - Attach configuration interface for SoC 233 * @ctrl_obj - PSOC object 234 * 235 * Allocates context for Soc configuration parameters, 236 * Read configuration information from device tree/ini file and 237 * returns back handle 238 * 239 * Return: Handle to configuration context 240 */ 241 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_soc_attach(void *ctrl_obj); 242 243 /** 244 * wlan_cfg_soc_detach() - Detach soc configuration handle 245 * @wlan_cfg_ctx: soc configuration handle 246 * 247 * De-allocates memory allocated for SoC configuration 248 * 249 * Return:none 250 */ 251 void wlan_cfg_soc_detach(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 252 253 /** 254 * wlan_cfg_pdev_attach() Attach configuration interface for pdev 255 * @ctrl_obj - PSOC object 256 * 257 * Allocates context for pdev configuration parameters, 258 * Read configuration information from device tree/ini file and 259 * returns back handle 260 * 261 * Return: Handle to configuration context 262 */ 263 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_attach(void *ctrl_obj); 264 265 /** 266 * wlan_cfg_pdev_detach() Detach and free pdev configuration handle 267 * @wlan_cfg_pdev_ctx - PDEV Configuration Handle 268 * 269 * Return: void 270 */ 271 void wlan_cfg_pdev_detach(struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx); 272 273 void wlan_cfg_set_num_contexts(struct wlan_cfg_dp_soc_ctxt *cfg, int num); 274 void wlan_cfg_set_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 275 int context, int mask); 276 void wlan_cfg_set_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 277 int context, int mask); 278 void wlan_cfg_set_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 279 int context, int mask); 280 void wlan_cfg_set_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 281 int context, int mask); 282 void wlan_cfg_set_rxbuf_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int context, 283 int mask); 284 void wlan_cfg_set_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val); 285 void wlan_cfg_set_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg, uint32_t val); 286 int wlan_cfg_get_max_ast_idx(struct wlan_cfg_dp_soc_ctxt *cfg); 287 int wlan_cfg_set_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 288 int context, int mask); 289 int wlan_cfg_set_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 290 int context, int mask); 291 int wlan_cfg_set_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 292 int context, int mask); 293 /** 294 * wlan_cfg_get_num_contexts() - Number of interrupt contexts to be registered 295 * @wlan_cfg_ctx - Configuration Handle 296 * 297 * For WIN, DP_NUM_INTERRUPT_CONTEXTS will be equal to number of CPU cores. 298 * Each context (for linux it is a NAPI context) will have a tx_ring_mask, 299 * rx_ring_mask ,and rx_monitor_ring mask to indicate the rings 300 * that are processed by the handler. 301 * 302 * Return: num_contexts 303 */ 304 int wlan_cfg_get_num_contexts(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 305 306 /** 307 * wlan_cfg_get_tx_ring_mask() - Return Tx interrupt mask mapped to an 308 * interrupt context 309 * @wlan_cfg_ctx - Configuration Handle 310 * @context - Numerical ID identifying the Interrupt/NAPI context 311 * 312 * Return: int_tx_ring_mask[context] 313 */ 314 int wlan_cfg_get_tx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, 315 int context); 316 317 /** 318 * wlan_cfg_get_rx_ring_mask() - Return Rx interrupt mask mapped to an 319 * interrupt context 320 * @wlan_cfg_ctx - Configuration Handle 321 * @context - Numerical ID identifying the Interrupt/NAPI context 322 * 323 * Return: int_rx_ring_mask[context] 324 */ 325 int wlan_cfg_get_rx_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, 326 int context); 327 328 /** 329 * wlan_cfg_get_rx_mon_ring_mask() - Return Rx monitor ring interrupt mask 330 * mapped to an interrupt context 331 * @wlan_cfg_ctx - Configuration Handle 332 * @context - Numerical ID identifying the Interrupt/NAPI context 333 * 334 * Return: int_rx_mon_ring_mask[context] 335 */ 336 int wlan_cfg_get_rx_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, 337 int context); 338 339 /** 340 * wlan_cfg_set_rxdma2host_ring_mask() - Set rxdma2host ring interrupt mask 341 * for the given interrupt context 342 * @wlan_cfg_ctx - Configuration Handle 343 * @context - Numerical ID identifying the Interrupt/NAPI context 344 * 345 */ 346 void wlan_cfg_set_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 347 int context, int mask); 348 349 /** 350 * wlan_cfg_get_rxdma2host_ring_mask() - Return rxdma2host ring interrupt mask 351 * mapped to an interrupt context 352 * @wlan_cfg_ctx - Configuration Handle 353 * @context - Numerical ID identifying the Interrupt/NAPI context 354 * 355 * Return: int_rxdma2host_ring_mask[context] 356 */ 357 int wlan_cfg_get_rxdma2host_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 358 int context); 359 360 /** 361 * wlan_cfg_set_host2rxdma_ring_mask() - Set host2rxdma ring interrupt mask 362 * for the given interrupt context 363 * @wlan_cfg_ctx - Configuration Handle 364 * @context - Numerical ID identifying the Interrupt/NAPI context 365 * 366 */ 367 void wlan_cfg_set_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 368 int context, int mask); 369 370 /** 371 * wlan_cfg_get_host2rxdma_ring_mask() - Return host2rxdma ring interrupt mask 372 * mapped to an interrupt context 373 * @wlan_cfg_ctx - Configuration Handle 374 * @context - Numerical ID identifying the Interrupt/NAPI context 375 * 376 * Return: int_host2rxdma_ring_mask[context] 377 */ 378 int wlan_cfg_get_host2rxdma_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 379 int context); 380 381 /** 382 * wlan_cfg_set_host2rxdma_mon_ring_mask() - Set host2rxdma monitor ring 383 * interrupt mask for the given interrupt context 384 * @wlan_cfg_ctx - Configuration Handle 385 * @context - Numerical ID identifying the Interrupt/NAPI context 386 * 387 */ 388 void wlan_cfg_set_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 389 int context, int mask); 390 391 /** 392 * wlan_cfg_get_host2rxdma_mon_ring_mask() - Return host2rxdma monitoe ring 393 * interrupt mask mapped to an interrupt context 394 * @wlan_cfg_ctx - Configuration Handle 395 * @context - Numerical ID identifying the Interrupt/NAPI context 396 * 397 * Return: int_host2rxdma_mon_ring_mask[context] 398 */ 399 int wlan_cfg_get_host2rxdma_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 400 int context); 401 402 /** 403 * wlan_cfg_set_rxdma2host_mon_ring_mask() - Set rxdma2host monitor 404 * destination ring interrupt mask 405 * for the given interrupt context 406 * @wlan_cfg_ctx - Configuration Handle 407 * @context - Numerical ID identifying the Interrupt/NAPI context 408 * 409 */ 410 void wlan_cfg_set_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 411 int context, int mask); 412 413 /** 414 * wlan_cfg_get_rxdma2host_mon_ring_mask() - Return rxdma2host monitor 415 * destination ring interrupt mask 416 * mapped to an interrupt context 417 * @wlan_cfg_ctx - Configuration Handle 418 * @context - Numerical ID identifying the Interrupt/NAPI context 419 * 420 * Return: int_rxdma2host_mon_ring_mask[context] 421 */ 422 int wlan_cfg_get_rxdma2host_mon_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, 423 int context); 424 425 /** 426 * wlan_cfg_set_hw_macid() - Set HW MAC Id for the given PDEV index 427 * 428 * @wlan_cfg_ctx - Configuration Handle 429 * @pdev_idx - Index of SW PDEV 430 * @hw_macid - HW MAC Id 431 * 432 */ 433 void wlan_cfg_set_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx, 434 int hw_macid); 435 436 /** 437 * wlan_cfg_get_hw_macid() - Get HW MAC Id for the given PDEV index 438 * 439 * @wlan_cfg_ctx - Configuration Handle 440 * @pdev_idx - Index of SW PDEV 441 * 442 * Return: HW MAC Id 443 */ 444 int wlan_cfg_get_hw_macid(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx); 445 446 /** 447 * wlan_cfg_get_hw_mac_idx() - Get 0 based HW MAC index for the given 448 * PDEV index 449 * 450 * @wlan_cfg_ctx - Configuration Handle 451 * @pdev_idx - Index of SW PDEV 452 * 453 * Return: HW MAC index 454 */ 455 int wlan_cfg_get_hw_mac_idx(struct wlan_cfg_dp_soc_ctxt *cfg, int pdev_idx); 456 457 /** 458 * wlan_cfg_get_rx_err_ring_mask() - Return Rx monitor ring interrupt mask 459 * mapped to an interrupt context 460 * @wlan_cfg_ctx - Configuration Handle 461 * @context - Numerical ID identifying the Interrupt/NAPI context 462 * 463 * Return: int_rx_err_ring_mask[context] 464 */ 465 int wlan_cfg_get_rx_err_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int 466 context); 467 468 /** 469 * wlan_cfg_get_rx_wbm_rel_ring_mask() - Return Rx monitor ring interrupt mask 470 * mapped to an interrupt context 471 * @wlan_cfg_ctx - Configuration Handle 472 * @context - Numerical ID identifying the Interrupt/NAPI context 473 * 474 * Return: int_wbm_rel_ring_mask[context] 475 */ 476 int wlan_cfg_get_rx_wbm_rel_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int 477 context); 478 479 /** 480 * wlan_cfg_get_reo_status_ring_mask() - Return Rx monitor ring interrupt mask 481 * mapped to an interrupt context 482 * @wlan_cfg_ctx - Configuration Handle 483 * @context - Numerical ID identifying the Interrupt/NAPI context 484 * 485 * Return: int_reo_status_ring_mask[context] 486 */ 487 int wlan_cfg_get_reo_status_ring_mask(struct wlan_cfg_dp_soc_ctxt *cfg, int 488 context); 489 490 /** 491 * wlan_cfg_get_ce_ring_mask() - Return CE ring interrupt mask 492 * mapped to an interrupt context 493 * @wlan_cfg_ctx - Configuration Handle 494 * @context - Numerical ID identifying the Interrupt/NAPI context 495 * 496 * Return: int_ce_ring_mask[context] 497 */ 498 int wlan_cfg_get_ce_ring_mask(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx, 499 int context); 500 501 /** 502 * wlan_cfg_get_max_clients() - Return maximum number of peers/stations 503 * supported by device 504 * @wlan_cfg_ctx - Configuration Handle 505 * 506 * Return: max_clients 507 */ 508 uint32_t wlan_cfg_get_max_clients(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 509 510 /** 511 * wlan_cfg_max_alloc_size() - Return Maximum allocation size for any dynamic 512 * memory allocation request for this device 513 * @wlan_cfg_ctx - Configuration Handle 514 * 515 * Return: max_alloc_size 516 */ 517 uint32_t wlan_cfg_max_alloc_size(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 518 519 /* 520 * wlan_cfg_per_pdev_tx_ring() - Return true if Tx rings are mapped as 521 * one per radio 522 * @wlan_cfg_ctx - Configuration Handle 523 * 524 * Return: per_pdev_tx_ring 525 */ 526 int wlan_cfg_per_pdev_tx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 527 528 /* 529 * wlan_cfg_num_tcl_data_rings() - Number of TCL Data rings supported by device 530 * @wlan_cfg_ctx 531 * 532 * Return: num_tcl_data_rings 533 */ 534 int wlan_cfg_num_tcl_data_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 535 536 /* 537 * wlan_cfg_per_pdev_rx_ring() - Return true if Rx rings are mapped as 538 * one per radio 539 * @wlan_cfg_ctx 540 * 541 * Return: per_pdev_rx_ring 542 */ 543 int wlan_cfg_per_pdev_rx_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 544 545 /* 546 * wlan_cfg_per_pdev_lmac_ring() - Return true if error rings are mapped as 547 * one per radio 548 * @wlan_cfg_ctx 549 * 550 * Return: return 1 if per pdev error ring else 0 551 */ 552 int wlan_cfg_per_pdev_lmac_ring(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 553 554 /* 555 * wlan_cfg_num_reo_dest_rings() - Number of REO Data rings supported by device 556 * @wlan_cfg_ctx - Configuration Handle 557 * 558 * Return: num_reo_dest_rings 559 */ 560 int wlan_cfg_num_reo_dest_rings(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 561 562 /* 563 * wlan_cfg_pkt_type() - Default 802.11 encapsulation type 564 * @wlan_cfg_ctx - Configuration Handle 565 * 566 * Return: htt_pkt_type_ethernet 567 */ 568 int wlan_cfg_pkt_type(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 569 570 /* 571 * wlan_cfg_get_num_tx_desc_pool() - Number of Tx Descriptor pools for the 572 * device 573 * @wlan_cfg_ctx - Configuration Handle 574 * 575 * Return: num_tx_desc_pool 576 */ 577 int wlan_cfg_get_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 578 579 /* 580 * wlan_cfg_set_num_tx_desc_pool() - Set the number of Tx Descriptor pools for the 581 * device 582 * @wlan_cfg_ctx - Configuration Handle 583 * @num_pool - Number of pool 584 */ 585 void wlan_cfg_set_num_tx_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool); 586 587 /* 588 * wlan_cfg_get_num_tx_ext_desc_pool() - Number of Tx MSDU ext Descriptor 589 * pools 590 * @wlan_cfg_ctx - Configuration Handle 591 * 592 * Return: num_tx_ext_desc_pool 593 */ 594 int wlan_cfg_get_num_tx_ext_desc_pool( 595 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 596 597 /* 598 * wlan_cfg_get_reo_dst_ring_size() - Get REO destination ring size 599 * 600 * @wlan_cfg_ctx - Configuration Handle 601 * 602 * Return: reo_dst_ring_size 603 */ 604 int wlan_cfg_get_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 605 606 /* 607 * wlan_cfg_set_num_tx_desc_pool() - Set the REO Destination ring size 608 * 609 * @wlan_cfg_ctx - Configuration Handle 610 * @reo_dst_ring_size - REO Destination ring size 611 */ 612 void wlan_cfg_set_reo_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg, 613 int reo_dst_ring_size); 614 615 /* 616 * wlan_cfg_set_raw_mode_war() - Set raw mode war configuration 617 * 618 * @wlan_cfg_ctx - Configuration Handle 619 * @raw_mode_war - raw mode war configuration 620 */ 621 void wlan_cfg_set_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg, 622 bool raw_mode_war); 623 624 /* 625 * wlan_cfg_get_raw_mode_war() - Get raw mode war configuration 626 * 627 * @wlan_cfg_ctx - Configuration Handle 628 * 629 * Return: reo_dst_ring_size 630 */ 631 bool wlan_cfg_get_raw_mode_war(struct wlan_cfg_dp_soc_ctxt *cfg); 632 633 /* 634 * wlan_cfg_set_num_tx_ext_desc_pool() - Set the number of Tx MSDU ext Descriptor 635 * pools 636 * @wlan_cfg_ctx - Configuration Handle 637 * @num_pool - Number of pool 638 */ 639 void wlan_cfg_set_num_tx_ext_desc_pool(struct wlan_cfg_dp_soc_ctxt *cfg, int num_pool); 640 641 /* 642 * wlan_cfg_get_num_tx_desc() - Number of Tx Descriptors per pool 643 * @wlan_cfg_ctx - Configuration Handle 644 * 645 * Return: num_tx_desc 646 */ 647 int wlan_cfg_get_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 648 649 /* 650 * wlan_cfg_set_num_tx_desc() - Set the number of Tx Descriptors per pool 651 * 652 * @wlan_cfg_ctx - Configuration Handle 653 * @num_desc: Number of descriptor 654 */ 655 void wlan_cfg_set_num_tx_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_desc); 656 657 /* 658 * wlan_cfg_get_num_tx_ext_desc() - Number of Tx MSDU extension Descriptors 659 * per pool 660 * @wlan_cfg_ctx - Configuration Handle 661 * 662 * Return: num_tx_ext_desc 663 */ 664 int wlan_cfg_get_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx); 665 666 /* 667 * wlan_cfg_set_num_tx_ext_desc() - Set the number of Tx MSDU extension Descriptors 668 * per pool 669 * @wlan_cfg_ctx - Configuration Handle 670 * @num_desc: Number of descriptor 671 */ 672 void wlan_cfg_set_num_tx_ext_desc(struct wlan_cfg_dp_soc_ctxt *cfg, int num_ext_desc); 673 674 /* 675 * wlan_cfg_max_peer_id() - Get maximum peer ID 676 * @cfg: Configuration Handle 677 * 678 * Return: maximum peer ID 679 */ 680 uint32_t wlan_cfg_max_peer_id(struct wlan_cfg_dp_soc_ctxt *cfg); 681 682 /* 683 * wlan_cfg_get_dma_mon_buf_ring_size() - Return Size of monitor buffer ring 684 * @wlan_cfg_pdev_ctx 685 * 686 * Return: dma_mon_buf_ring_size 687 */ 688 int wlan_cfg_get_dma_mon_buf_ring_size( 689 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx); 690 691 /* 692 * wlan_cfg_get_dma_mon_dest_ring_size() - Return Size of RxDMA Monitor 693 * Destination ring 694 * @wlan_cfg_pdev_ctx 695 * 696 * Return: dma_mon_dest_size 697 */ 698 int wlan_cfg_get_dma_mon_dest_ring_size( 699 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx); 700 701 /* 702 * wlan_cfg_get_dma_mon_stat_ring_size() - Return size of Monitor Status ring 703 * @wlan_cfg_pdev_ctx 704 * 705 * Return: dma_mon_stat_ring_size 706 */ 707 int wlan_cfg_get_dma_mon_stat_ring_size( 708 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx); 709 710 /* 711 * wlan_cfg_get_dma_mon_desc_ring_size - Get rxdma monitor size 712 * @wlan_cfg_soc_ctx 713 * 714 * Return: rxdma monitor desc ring size 715 */ 716 int 717 wlan_cfg_get_dma_mon_desc_ring_size(struct wlan_cfg_dp_pdev_ctxt *cfg); 718 719 /* 720 * wlan_cfg_get_rx_dma_buf_ring_size() - Return Size of RxDMA buffer ring 721 * @wlan_cfg_pdev_ctx 722 * 723 * Return: rx_dma_buf_ring_size 724 */ 725 int wlan_cfg_get_rx_dma_buf_ring_size( 726 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_pdev_ctx); 727 728 /* 729 * wlan_cfg_get_num_mac_rings() - Return the number of MAC RX DMA rings 730 * per pdev 731 * @wlan_cfg_pdev_ctx 732 * 733 * Return: number of mac DMA rings per pdev 734 */ 735 int wlan_cfg_get_num_mac_rings(struct wlan_cfg_dp_pdev_ctxt *cfg); 736 737 /* 738 * wlan_cfg_is_lro_enabled - Return LRO enabled/disabled 739 * @wlan_cfg_dp_soc_ctxt 740 * 741 * Return: true - LRO enabled false - LRO disabled 742 */ 743 bool wlan_cfg_is_lro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg); 744 745 /* 746 * wlan_cfg_is_gro_enabled - Return GRO enabled/disabled 747 * @wlan_cfg_dp_soc_ctxt 748 * 749 * Return: true - GRO enabled false - GRO disabled 750 */ 751 bool wlan_cfg_is_gro_enabled(struct wlan_cfg_dp_soc_ctxt *cfg); 752 753 /* 754 * wlan_cfg_is_rx_hash_enabled - Return RX hash enabled/disabled 755 * @wlan_cfg_dp_soc_ctxt 756 * 757 * Return: true - enabled false - disabled 758 */ 759 bool wlan_cfg_is_rx_hash_enabled(struct wlan_cfg_dp_soc_ctxt *cfg); 760 761 /* 762 * wlan_cfg_is_ipa_enabled - Return IPA enabled/disabled 763 * @wlan_cfg_dp_soc_ctxt 764 * 765 * Return: true - enabled false - disabled 766 */ 767 bool wlan_cfg_is_ipa_enabled(struct wlan_cfg_dp_soc_ctxt *cfg); 768 769 /* 770 * wlan_cfg_set_rx_hash - set rx hash enabled/disabled 771 * @wlan_cfg_soc_ctx 772 * @rx_hash 773 */ 774 void wlan_cfg_set_rx_hash(struct wlan_cfg_dp_soc_ctxt *cfg, bool rx_hash); 775 776 /* 777 * wlan_cfg_get_dp_pdev_nss_enabled - Return pdev nss enabled/disabled 778 * @wlan_cfg_pdev_ctx 779 * 780 * Return: 1 - enabled 0 - disabled 781 */ 782 int wlan_cfg_get_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg); 783 784 /* 785 * wlan_cfg_set_dp_pdev_nss_enabled - set pdev nss enabled/disabled 786 * @wlan_cfg_pdev_ctx 787 */ 788 void wlan_cfg_set_dp_pdev_nss_enabled(struct wlan_cfg_dp_pdev_ctxt *cfg, int nss_enabled); 789 790 /* 791 * wlan_cfg_get_dp_soc_nss_cfg - Return soc nss config 792 * @wlan_cfg_pdev_ctx 793 * 794 * Return: nss_cfg 795 */ 796 int wlan_cfg_get_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg); 797 798 /* 799 * wlan_cfg_set_dp_soc_nss_cfg - set soc nss config 800 * @wlan_cfg_pdev_ctx 801 * 802 */ 803 void wlan_cfg_set_dp_soc_nss_cfg(struct wlan_cfg_dp_soc_ctxt *cfg, int nss_cfg); 804 805 /* 806 * wlan_cfg_get_int_batch_threshold_tx - Get interrupt mitigation cfg for Tx 807 * @wlan_cfg_soc_ctx 808 * 809 * Return: Batch threshold 810 */ 811 int wlan_cfg_get_int_batch_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg); 812 813 /* 814 * wlan_cfg_get_int_timer_threshold_tx - Get interrupt mitigation cfg for Tx 815 * @wlan_cfg_soc_ctx 816 * 817 * Return: Timer threshold 818 */ 819 int wlan_cfg_get_int_timer_threshold_tx(struct wlan_cfg_dp_soc_ctxt *cfg); 820 821 /* 822 * wlan_cfg_get_int_batch_threshold_rx - Get interrupt mitigation cfg for Rx 823 * @wlan_cfg_soc_ctx 824 * 825 * Return: Batch threshold 826 */ 827 int wlan_cfg_get_int_batch_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg); 828 829 /* 830 * wlan_cfg_get_int_batch_threshold_rx - Get interrupt mitigation cfg for Rx 831 * @wlan_cfg_soc_ctx 832 * 833 * Return: Timer threshold 834 */ 835 int wlan_cfg_get_int_timer_threshold_rx(struct wlan_cfg_dp_soc_ctxt *cfg); 836 837 /* 838 * wlan_cfg_get_int_batch_threshold_tx - Get interrupt mitigation cfg for other srngs 839 * @wlan_cfg_soc_ctx 840 * 841 * Return: Batch threshold 842 */ 843 int wlan_cfg_get_int_batch_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg); 844 845 /* 846 * wlan_cfg_get_int_batch_threshold_tx - Get interrupt mitigation cfg for other srngs 847 * @wlan_cfg_soc_ctx 848 * 849 * Return: Timer threshold 850 */ 851 int wlan_cfg_get_int_timer_threshold_other(struct wlan_cfg_dp_soc_ctxt *cfg); 852 853 /* 854 * wlan_cfg_get_int_timer_threshold_mon - Get int mitigation cfg for mon srngs 855 * @wlan_cfg_soc_ctx 856 * 857 * Return: Timer threshold 858 */ 859 int wlan_cfg_get_int_timer_threshold_mon(struct wlan_cfg_dp_soc_ctxt *cfg); 860 861 /* 862 * wlan_cfg_get_checksum_offload - Get checksum offload enable or disable status 863 * @wlan_cfg_soc_ctx 864 * 865 * Return: Checksum offload enable or disable 866 */ 867 int wlan_cfg_get_checksum_offload(struct wlan_cfg_dp_soc_ctxt *cfg); 868 869 /* 870 * wlan_cfg_tx_ring_size - Get Tx DMA ring size (TCL Data Ring) 871 * @wlan_cfg_soc_ctx 872 * 873 * Return: Tx Ring Size 874 */ 875 int wlan_cfg_tx_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 876 877 /* 878 * wlan_cfg_tx_comp_ring_size - Get Tx completion ring size (WBM Ring) 879 * @wlan_cfg_soc_ctx 880 * 881 * Return: Tx Completion ring size 882 */ 883 int wlan_cfg_tx_comp_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 884 885 /* 886 * wlan_cfg_get_dp_soc_wbm_release_ring_size - Get wbm_release_ring size 887 * @wlan_cfg_soc_ctx 888 * 889 * Return: wbm_release_ring size 890 */ 891 int 892 wlan_cfg_get_dp_soc_wbm_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 893 894 /* 895 * wlan_cfg_get_dp_soc_tcl_cmd_ring_size - Get tcl_cmd_ring size 896 * @wlan_cfg_soc_ctx 897 * 898 * Return: tcl_cmd_ring size 899 */ 900 int 901 wlan_cfg_get_dp_soc_tcl_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 902 903 /* 904 * wlan_cfg_get_dp_soc_tcl_status_ring_size - Get tcl_status_ring size 905 * @wlan_cfg_soc_ctx 906 * 907 * Return: tcl_status_ring size 908 */ 909 int 910 wlan_cfg_get_dp_soc_tcl_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 911 912 /* 913 * wlan_cfg_get_dp_soc_reo_reinject_ring_size - Get reo_reinject_ring size 914 * @wlan_cfg_soc_ctx 915 * 916 * Return: reo_reinject_ring size 917 */ 918 int 919 wlan_cfg_get_dp_soc_reo_reinject_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 920 921 /* 922 * wlan_cfg_get_dp_soc_rx_release_ring_size - Get rx_release_ring size 923 * @wlan_cfg_soc_ctx 924 * 925 * Return: rx_release_ring size 926 */ 927 int 928 wlan_cfg_get_dp_soc_rx_release_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 929 930 /* 931 * wlan_cfg_get_dp_soc_reo_exception_ring_size - Get reo_exception_ring size 932 * @wlan_cfg_soc_ctx 933 * 934 * Return: reo_exception_ring size 935 */ 936 int 937 wlan_cfg_get_dp_soc_reo_exception_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 938 939 /* 940 * wlan_cfg_get_dp_soc_reo_cmd_ring_size - Get reo_cmd_ring size 941 * @wlan_cfg_soc_ctx 942 * 943 * Return: reo_cmd_ring size 944 */ 945 int 946 wlan_cfg_get_dp_soc_reo_cmd_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 947 948 /* 949 * wlan_cfg_get_dp_soc_reo_status_ring_size - Get reo_status_ring size 950 * @wlan_cfg_soc_ctx 951 * 952 * Return: reo_status_ring size 953 */ 954 int 955 wlan_cfg_get_dp_soc_reo_status_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 956 957 /* 958 * wlan_cfg_get_dp_soc_rxdma_refill_ring_size - Get rxdma refill ring size 959 * @wlan_cfg_soc_ctx 960 * 961 * Return: rxdma refill ring size 962 */ 963 int 964 wlan_cfg_get_dp_soc_rxdma_refill_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 965 966 /* 967 * wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size - Get rxdma dst ring size 968 * @wlan_cfg_soc_ctx 969 * 970 * Return: rxdma error dst ring size 971 */ 972 int 973 wlan_cfg_get_dp_soc_rxdma_err_dst_ring_size(struct wlan_cfg_dp_soc_ctxt *cfg); 974 975 /* 976 * wlan_cfg_get_dp_caps - Get dp capablities 977 * @wlan_cfg_soc_ctx 978 * @dp_caps: enum for dp capablities 979 * 980 * Return: bool if a dp capabilities is enabled 981 */ 982 bool 983 wlan_cfg_get_dp_caps(struct wlan_cfg_dp_soc_ctxt *cfg, 984 enum cdp_capabilities dp_caps); 985 986 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 987 int wlan_cfg_get_tx_flow_stop_queue_th(struct wlan_cfg_dp_soc_ctxt *cfg); 988 989 int wlan_cfg_get_tx_flow_start_queue_offset(struct wlan_cfg_dp_soc_ctxt *cfg); 990 #endif /* QCA_LL_TX_FLOW_CONTROL_V2 */ 991 int wlan_cfg_get_rx_defrag_min_timeout(struct wlan_cfg_dp_soc_ctxt *cfg); 992 993 int wlan_cfg_get_defrag_timeout_check(struct wlan_cfg_dp_soc_ctxt *cfg); 994 #endif 995