1 /* 2 * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved. 3 * Copyright (c) 2021-2023 Qualcomm Innovation Center, Inc. All rights reserved. 4 * 5 * Permission to use, copy, modify, and/or distribute this software for 6 * any purpose with or without fee is hereby granted, provided that the 7 * above copyright notice and this permission notice appear in all 8 * copies. 9 * 10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 11 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 12 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 13 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 14 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 15 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 16 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 17 * PERFORMANCE OF THIS SOFTWARE. 18 */ 19 20 #ifndef _DP_TYPES_H_ 21 #define _DP_TYPES_H_ 22 23 #include <qdf_types.h> 24 #include <qdf_nbuf.h> 25 #include <qdf_lock.h> 26 #include <qdf_atomic.h> 27 #include <qdf_util.h> 28 #include <qdf_list.h> 29 #include <qdf_lro.h> 30 #include <queue.h> 31 #include <htt_common.h> 32 #include <htt.h> 33 #include <htt_stats.h> 34 #include <cdp_txrx_cmn.h> 35 #ifdef DP_MOB_DEFS 36 #include <cds_ieee80211_common.h> 37 #endif 38 #include <wdi_event_api.h> /* WDI subscriber event list */ 39 40 #include "hal_hw_headers.h" 41 #include <hal_tx.h> 42 #include <hal_reo.h> 43 #include "wlan_cfg.h" 44 #include "hal_rx.h" 45 #include <hal_api.h> 46 #include <hal_api_mon.h> 47 #include "hal_rx.h" 48 49 #define dp_init_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_INIT, params) 50 #define dp_init_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_INIT, params) 51 #define dp_init_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_INIT, params) 52 #define dp_init_info(params...) \ 53 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_INIT, ## params) 54 #define dp_init_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_INIT, params) 55 56 #define dp_vdev_alert(params...) QDF_TRACE_FATAL(QDF_MODULE_ID_DP_VDEV, params) 57 #define dp_vdev_err(params...) QDF_TRACE_ERROR(QDF_MODULE_ID_DP_VDEV, params) 58 #define dp_vdev_warn(params...) QDF_TRACE_WARN(QDF_MODULE_ID_DP_VDEV, params) 59 #define dp_vdev_info(params...) \ 60 __QDF_TRACE_FL(QDF_TRACE_LEVEL_INFO_HIGH, QDF_MODULE_ID_DP_VDEV, ## params) 61 #define dp_vdev_debug(params...) QDF_TRACE_DEBUG(QDF_MODULE_ID_DP_VDEV, params) 62 63 #define MAX_BW 8 64 #define MAX_RETRIES 4 65 #define MAX_RECEPTION_TYPES 4 66 67 #define MINIDUMP_STR_SIZE 25 68 #include <dp_umac_reset.h> 69 70 #define REPT_MU_MIMO 1 71 #define REPT_MU_OFDMA_MIMO 3 72 #define DP_VO_TID 6 73 /** MAX TID MAPS AVAILABLE PER PDEV */ 74 #define DP_MAX_TID_MAPS 16 75 /** pad DSCP_TID_MAP_MAX with 6 to fix oob issue */ 76 #define DSCP_TID_MAP_MAX (64 + 6) 77 #define DP_IP_DSCP_SHIFT 2 78 #define DP_IP_DSCP_MASK 0x3f 79 #define DP_FC0_SUBTYPE_QOS 0x80 80 #define DP_QOS_TID 0x0f 81 #define DP_IPV6_PRIORITY_SHIFT 20 82 #define MAX_MON_LINK_DESC_BANKS 2 83 #define DP_VDEV_ALL CDP_VDEV_ALL 84 85 #if defined(WLAN_MAX_PDEVS) && (WLAN_MAX_PDEVS == 1) 86 #define WLAN_DP_RESET_MON_BUF_RING_FILTER 87 #define MAX_TXDESC_POOLS 6 88 #else 89 #define MAX_TXDESC_POOLS 4 90 #endif 91 92 /* Max no of descriptors to handle special frames like EAPOL */ 93 #define MAX_TX_SPL_DESC 1024 94 95 #define MAX_RXDESC_POOLS 4 96 #define MAX_PPE_TXDESC_POOLS 1 97 98 /* Max no. of VDEV per PSOC */ 99 #ifdef WLAN_PSOC_MAX_VDEVS 100 #define MAX_VDEV_CNT WLAN_PSOC_MAX_VDEVS 101 #else 102 #define MAX_VDEV_CNT 51 103 #endif 104 105 /* Max no. of VDEVs, a PDEV can support */ 106 #ifdef WLAN_PDEV_MAX_VDEVS 107 #define DP_PDEV_MAX_VDEVS WLAN_PDEV_MAX_VDEVS 108 #else 109 #define DP_PDEV_MAX_VDEVS 17 110 #endif 111 112 #define EXCEPTION_DEST_RING_ID 0 113 #define MAX_IDLE_SCATTER_BUFS 16 114 #define DP_MAX_IRQ_PER_CONTEXT 12 115 #define DEFAULT_HW_PEER_ID 0xffff 116 117 #define MAX_AST_AGEOUT_COUNT 128 118 119 #ifdef TX_ADDR_INDEX_SEARCH 120 #define DP_TX_ADDR_SEARCH_ADDR_POLICY HAL_TX_ADDR_INDEX_SEARCH 121 #else 122 #define DP_TX_ADDR_SEARCH_ADDR_POLICY HAL_TX_ADDR_SEARCH_DEFAULT 123 #endif 124 125 #define WBM_INT_ERROR_ALL 0 126 #define WBM_INT_ERROR_REO_NULL_BUFFER 1 127 #define WBM_INT_ERROR_REO_NULL_LINK_DESC 2 128 #define WBM_INT_ERROR_REO_NULL_MSDU_BUFF 3 129 #define WBM_INT_ERROR_REO_BUFF_REAPED 4 130 #define MAX_WBM_INT_ERROR_REASONS 5 131 132 #define MAX_TX_HW_QUEUES MAX_TCL_DATA_RINGS 133 /* Maximum retries for Delba per tid per peer */ 134 #define DP_MAX_DELBA_RETRY 3 135 136 #ifdef AST_OFFLOAD_ENABLE 137 #define AST_OFFLOAD_ENABLE_STATUS 1 138 #else 139 #define AST_OFFLOAD_ENABLE_STATUS 0 140 #endif 141 142 #ifdef FEATURE_MEC_OFFLOAD 143 #define FW_MEC_FW_OFFLOAD_ENABLED 1 144 #else 145 #define FW_MEC_FW_OFFLOAD_ENABLED 0 146 #endif 147 148 #define PCP_TID_MAP_MAX 8 149 #define MAX_MU_USERS 37 150 151 #define REO_CMD_EVENT_HIST_MAX 64 152 153 #define DP_MAX_SRNGS 64 154 155 /* 2G PHYB */ 156 #define PHYB_2G_LMAC_ID 2 157 #define PHYB_2G_TARGET_PDEV_ID 2 158 159 /* Flags for skippig s/w tid classification */ 160 #define DP_TX_HW_DSCP_TID_MAP_VALID 0x1 161 #define DP_TXRX_HLOS_TID_OVERRIDE_ENABLED 0x2 162 #define DP_TX_MESH_ENABLED 0x4 163 #define DP_TX_INVALID_QOS_TAG 0xf 164 165 #ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL 166 #define DP_RX_REFILL_BUFF_POOL_BURST 64 167 #endif 168 169 #ifdef WLAN_SUPPORT_RX_FLOW_TAG 170 #define DP_RX_FSE_FLOW_MATCH_SFE 0xAAAA 171 #endif 172 173 #ifdef WLAN_VENDOR_SPECIFIC_BAR_UPDATE 174 #define DP_SKIP_BAR_UPDATE_TIMEOUT 5000 175 #endif 176 177 #define DP_TX_MAGIC_PATTERN_INUSE 0xABCD1234 178 #define DP_TX_MAGIC_PATTERN_FREE 0xDEADBEEF 179 180 #define DP_INTR_POLL_TIMER_MS 5 181 182 #ifdef IPA_OFFLOAD 183 #define DP_PEER_REO_STATS_TID_SHIFT 16 184 #define DP_PEER_REO_STATS_TID_MASK 0xFFFF0000 185 #define DP_PEER_REO_STATS_PEER_ID_MASK 0x0000FFFF 186 #define DP_PEER_GET_REO_STATS_TID(comb_peer_id_tid) \ 187 ((comb_peer_id_tid & DP_PEER_REO_STATS_TID_MASK) >> \ 188 DP_PEER_REO_STATS_TID_SHIFT) 189 #define DP_PEER_GET_REO_STATS_PEER_ID(comb_peer_id_tid) \ 190 (comb_peer_id_tid & DP_PEER_REO_STATS_PEER_ID_MASK) 191 #endif 192 193 typedef void dp_ptnr_soc_iter_func(struct dp_soc *ptnr_soc, void *arg, 194 int chip_id); 195 196 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP) 197 #define DP_MLD_MODE_UNIFIED_NONBOND 0 198 #define DP_MLD_MODE_UNIFIED_BOND 1 199 #define DP_MLD_MODE_HYBRID_NONBOND 2 200 #define DP_MLD_MODE_MAX DP_MLD_MODE_HYBRID_NONBOND 201 202 #define DP_LINK_VDEV_ITER 1 203 #define DP_BRIDGE_VDEV_ITER 2 204 #define DP_ALL_VDEV_ITER 3 205 #define IS_LINK_VDEV_ITER_REQUIRED(type) (type & DP_LINK_VDEV_ITER) 206 #define IS_BRIDGE_VDEV_ITER_REQUIRED(type) (type & DP_BRIDGE_VDEV_ITER) 207 #define DP_VDEV_ITERATE_ALL 1 208 #define DP_VDEV_ITERATE_SKIP_SELF 0 209 #endif 210 211 /** 212 * enum dp_pkt_xmit_type - The type of ingress stats are being referred 213 * 214 * @DP_XMIT_LINK: Packet ingress-ed on Link 215 * @DP_XMIT_MLD: Packet ingress-ed on MLD 216 * @DP_XMIT_TOTAL: Packets ingress-ed on MLD and LINK 217 */ 218 enum dp_pkt_xmit_type { 219 DP_XMIT_LINK, 220 DP_XMIT_MLD, 221 DP_XMIT_TOTAL, 222 }; 223 224 enum rx_pktlog_mode { 225 DP_RX_PKTLOG_DISABLED = 0, 226 DP_RX_PKTLOG_FULL, 227 DP_RX_PKTLOG_LITE, 228 }; 229 230 /* enum m_copy_mode - Available mcopy mode 231 * 232 */ 233 enum m_copy_mode { 234 M_COPY_DISABLED = 0, 235 M_COPY = 2, 236 M_COPY_EXTENDED = 4, 237 }; 238 239 struct msdu_list { 240 qdf_nbuf_t head; 241 qdf_nbuf_t tail; 242 uint32_t sum_len; 243 }; 244 245 struct dp_soc_cmn; 246 struct dp_pdev; 247 struct dp_vdev; 248 struct dp_tx_desc_s; 249 struct dp_soc; 250 union dp_rx_desc_list_elem_t; 251 struct cdp_peer_rate_stats_ctx; 252 struct cdp_soc_rate_stats_ctx; 253 struct dp_rx_fst; 254 struct dp_mon_filter; 255 struct dp_mon_mpdu; 256 #ifdef BE_PKTLOG_SUPPORT 257 struct dp_mon_filter_be; 258 #endif 259 struct dp_peer; 260 struct dp_txrx_peer; 261 262 /** 263 * enum dp_peer_state - DP peer states 264 * @DP_PEER_STATE_NONE: 265 * @DP_PEER_STATE_INIT: 266 * @DP_PEER_STATE_ACTIVE: 267 * @DP_PEER_STATE_LOGICAL_DELETE: 268 * @DP_PEER_STATE_INACTIVE: 269 * @DP_PEER_STATE_FREED: 270 * @DP_PEER_STATE_INVALID: 271 */ 272 enum dp_peer_state { 273 DP_PEER_STATE_NONE, 274 DP_PEER_STATE_INIT, 275 DP_PEER_STATE_ACTIVE, 276 DP_PEER_STATE_LOGICAL_DELETE, 277 DP_PEER_STATE_INACTIVE, 278 DP_PEER_STATE_FREED, 279 DP_PEER_STATE_INVALID, 280 }; 281 282 /** 283 * enum dp_mod_id - DP module IDs 284 * @DP_MOD_ID_TX_RX: 285 * @DP_MOD_ID_TX_COMP: 286 * @DP_MOD_ID_RX: 287 * @DP_MOD_ID_HTT_COMP: 288 * @DP_MOD_ID_RX_ERR: 289 * @DP_MOD_ID_TX_PPDU_STATS: 290 * @DP_MOD_ID_RX_PPDU_STATS: 291 * @DP_MOD_ID_CDP: 292 * @DP_MOD_ID_GENERIC_STATS: 293 * @DP_MOD_ID_TX_MULTIPASS: 294 * @DP_MOD_ID_TX_CAPTURE: 295 * @DP_MOD_ID_NSS_OFFLOAD: 296 * @DP_MOD_ID_CONFIG: 297 * @DP_MOD_ID_HTT: 298 * @DP_MOD_ID_IPA: 299 * @DP_MOD_ID_AST: 300 * @DP_MOD_ID_MCAST2UCAST: 301 * @DP_MOD_ID_CHILD: 302 * @DP_MOD_ID_MESH: 303 * @DP_MOD_ID_TX_EXCEPTION: 304 * @DP_MOD_ID_TDLS: 305 * @DP_MOD_ID_MISC: 306 * @DP_MOD_ID_MSCS: 307 * @DP_MOD_ID_TX: 308 * @DP_MOD_ID_SAWF: 309 * @DP_MOD_ID_REINJECT: 310 * @DP_MOD_ID_SCS: 311 * @DP_MOD_ID_UMAC_RESET: 312 * @DP_MOD_ID_TX_MCAST: 313 * @DP_MOD_ID_DS: 314 * @DP_MOD_ID_MLO_DEV: 315 * @DP_MOD_ID_MAX: 316 */ 317 enum dp_mod_id { 318 DP_MOD_ID_TX_RX, 319 DP_MOD_ID_TX_COMP, 320 DP_MOD_ID_RX, 321 DP_MOD_ID_HTT_COMP, 322 DP_MOD_ID_RX_ERR, 323 DP_MOD_ID_TX_PPDU_STATS, 324 DP_MOD_ID_RX_PPDU_STATS, 325 DP_MOD_ID_CDP, 326 DP_MOD_ID_GENERIC_STATS, 327 DP_MOD_ID_TX_MULTIPASS, 328 DP_MOD_ID_TX_CAPTURE, 329 DP_MOD_ID_NSS_OFFLOAD, 330 DP_MOD_ID_CONFIG, 331 DP_MOD_ID_HTT, 332 DP_MOD_ID_IPA, 333 DP_MOD_ID_AST, 334 DP_MOD_ID_MCAST2UCAST, 335 DP_MOD_ID_CHILD, 336 DP_MOD_ID_MESH, 337 DP_MOD_ID_TX_EXCEPTION, 338 DP_MOD_ID_TDLS, 339 DP_MOD_ID_MISC, 340 DP_MOD_ID_MSCS, 341 DP_MOD_ID_TX, 342 DP_MOD_ID_SAWF, 343 DP_MOD_ID_REINJECT, 344 DP_MOD_ID_SCS, 345 DP_MOD_ID_UMAC_RESET, 346 DP_MOD_ID_TX_MCAST, 347 DP_MOD_ID_DS, 348 DP_MOD_ID_MLO_DEV, 349 DP_MOD_ID_MAX, 350 }; 351 352 /** 353 * enum dp_peer_type - DP peer type 354 * @DP_PEER_TYPE_LEGACY: 355 * @DP_PEER_TYPE_MLO_LINK: 356 * @DP_PEER_TYPE_MLO: 357 */ 358 enum dp_peer_type { 359 DP_PEER_TYPE_LEGACY, 360 DP_PEER_TYPE_MLO_LINK, 361 DP_PEER_TYPE_MLO, 362 }; 363 364 #define DP_PDEV_ITERATE_VDEV_LIST(_pdev, _vdev) \ 365 TAILQ_FOREACH((_vdev), &(_pdev)->vdev_list, vdev_list_elem) 366 367 #define DP_VDEV_ITERATE_PEER_LIST(_vdev, _peer) \ 368 TAILQ_FOREACH((_peer), &(_vdev)->peer_list, peer_list_elem) 369 370 #define DP_PEER_ITERATE_ASE_LIST(_peer, _ase, _temp_ase) \ 371 TAILQ_FOREACH_SAFE((_ase), &_peer->ast_entry_list, ase_list_elem, (_temp_ase)) 372 373 #define DP_MUTEX_TYPE qdf_spinlock_t 374 375 #define DP_FRAME_IS_MULTICAST(_a) (*(_a) & 0x01) 376 #define DP_FRAME_IS_IPV4_MULTICAST(_a) (*(_a) == 0x01) 377 378 #define DP_FRAME_IS_IPV6_MULTICAST(_a) \ 379 ((_a)[0] == 0x33 && \ 380 (_a)[1] == 0x33) 381 382 #define DP_FRAME_IS_BROADCAST(_a) \ 383 ((_a)[0] == 0xff && \ 384 (_a)[1] == 0xff && \ 385 (_a)[2] == 0xff && \ 386 (_a)[3] == 0xff && \ 387 (_a)[4] == 0xff && \ 388 (_a)[5] == 0xff) 389 #define DP_FRAME_IS_SNAP(_llc) ((_llc)->llc_dsap == 0xaa && \ 390 (_llc)->llc_ssap == 0xaa && \ 391 (_llc)->llc_un.type_snap.control == 0x3) 392 #define DP_FRAME_IS_LLC(typeorlen) ((typeorlen) >= 0x600) 393 #define DP_FRAME_FC0_TYPE_MASK 0x0c 394 #define DP_FRAME_FC0_TYPE_DATA 0x08 395 #define DP_FRAME_IS_DATA(_frame) \ 396 (((_frame)->i_fc[0] & DP_FRAME_FC0_TYPE_MASK) == DP_FRAME_FC0_TYPE_DATA) 397 398 /* 399 * macros to convert hw mac id to sw mac id: 400 * mac ids used by hardware start from a value of 1 while 401 * those in host software start from a value of 0. Use the 402 * macros below to convert between mac ids used by software and 403 * hardware 404 */ 405 #define DP_SW2HW_MACID(id) ((id) + 1) 406 #define DP_HW2SW_MACID(id) ((id) > 0 ? ((id) - 1) : 0) 407 408 /* 409 * Number of Tx Queues 410 * enum and macro to define how many threshold levels is used 411 * for the AC based flow control 412 */ 413 #ifdef QCA_AC_BASED_FLOW_CONTROL 414 enum dp_fl_ctrl_threshold { 415 DP_TH_BE_BK = 0, 416 DP_TH_VI, 417 DP_TH_VO, 418 DP_TH_HI, 419 }; 420 421 #define FL_TH_MAX (4) 422 #define FL_TH_VI_PERCENTAGE (80) 423 #define FL_TH_VO_PERCENTAGE (60) 424 #define FL_TH_HI_PERCENTAGE (40) 425 #endif 426 427 /** 428 * enum dp_intr_mode 429 * @DP_INTR_INTEGRATED: Line interrupts 430 * @DP_INTR_MSI: MSI interrupts 431 * @DP_INTR_POLL: Polling 432 * @DP_INTR_LEGACY_VIRTUAL_IRQ: 433 */ 434 enum dp_intr_mode { 435 DP_INTR_INTEGRATED = 0, 436 DP_INTR_MSI, 437 DP_INTR_POLL, 438 DP_INTR_LEGACY_VIRTUAL_IRQ, 439 }; 440 441 /** 442 * enum dp_tx_frm_type 443 * @dp_tx_frm_std: Regular frame, no added header fragments 444 * @dp_tx_frm_tso: TSO segment, with a modified IP header added 445 * @dp_tx_frm_sg: SG segment 446 * @dp_tx_frm_audio: Audio frames, a custom LLC/SNAP header added 447 * @dp_tx_frm_me: Multicast to Unicast Converted frame 448 * @dp_tx_frm_raw: Raw Frame 449 * @dp_tx_frm_rmnet: 450 */ 451 enum dp_tx_frm_type { 452 dp_tx_frm_std = 0, 453 dp_tx_frm_tso, 454 dp_tx_frm_sg, 455 dp_tx_frm_audio, 456 dp_tx_frm_me, 457 dp_tx_frm_raw, 458 dp_tx_frm_rmnet, 459 }; 460 461 /** 462 * enum dp_ast_type 463 * @dp_ast_type_wds: WDS peer AST type 464 * @dp_ast_type_static: static ast entry type 465 * @dp_ast_type_mec: Multicast echo ast entry type 466 */ 467 enum dp_ast_type { 468 dp_ast_type_wds = 0, 469 dp_ast_type_static, 470 dp_ast_type_mec, 471 }; 472 473 /** 474 * enum dp_nss_cfg 475 * @dp_nss_cfg_default: No radios are offloaded 476 * @dp_nss_cfg_first_radio: First radio offloaded 477 * @dp_nss_cfg_second_radio: Second radio offloaded 478 * @dp_nss_cfg_dbdc: Dual radios offloaded 479 * @dp_nss_cfg_dbtc: Three radios offloaded 480 * @dp_nss_cfg_max: max value 481 */ 482 enum dp_nss_cfg { 483 dp_nss_cfg_default = 0x0, 484 dp_nss_cfg_first_radio = 0x1, 485 dp_nss_cfg_second_radio = 0x2, 486 dp_nss_cfg_dbdc = 0x3, 487 dp_nss_cfg_dbtc = 0x7, 488 dp_nss_cfg_max 489 }; 490 491 #ifdef WLAN_TX_PKT_CAPTURE_ENH 492 #define DP_CPU_RING_MAP_1 1 493 #endif 494 495 /** 496 * enum dp_cpu_ring_map_types - dp tx cpu ring map 497 * @DP_NSS_DEFAULT_MAP: Default mode with no NSS offloaded 498 * @DP_NSS_FIRST_RADIO_OFFLOADED_MAP: Only First Radio is offloaded 499 * @DP_NSS_SECOND_RADIO_OFFLOADED_MAP: Only second radio is offloaded 500 * @DP_NSS_DBDC_OFFLOADED_MAP: Both radios are offloaded 501 * @DP_NSS_DBTC_OFFLOADED_MAP: All three radios are offloaded 502 * @DP_SINGLE_TX_RING_MAP: to avoid out of order all cpu mapped to single ring 503 * @DP_NSS_CPU_RING_MAP_MAX: Max cpu ring map val 504 */ 505 enum dp_cpu_ring_map_types { 506 DP_NSS_DEFAULT_MAP, 507 DP_NSS_FIRST_RADIO_OFFLOADED_MAP, 508 DP_NSS_SECOND_RADIO_OFFLOADED_MAP, 509 DP_NSS_DBDC_OFFLOADED_MAP, 510 DP_NSS_DBTC_OFFLOADED_MAP, 511 #ifdef WLAN_TX_PKT_CAPTURE_ENH 512 DP_SINGLE_TX_RING_MAP, 513 #endif 514 DP_NSS_CPU_RING_MAP_MAX 515 }; 516 517 /** 518 * struct dp_rx_nbuf_frag_info - Hold vaddr and paddr for a buffer 519 * 520 * @paddr: Physical address of buffer allocated. 521 * @virt_addr: union of virtual address representations 522 * @nbuf: Allocated nbuf in case of nbuf approach. 523 * @vaddr: Virtual address of frag allocated in case of frag approach. 524 */ 525 struct dp_rx_nbuf_frag_info { 526 qdf_dma_addr_t paddr; 527 union { 528 qdf_nbuf_t nbuf; 529 qdf_frag_t vaddr; 530 } virt_addr; 531 }; 532 533 /** 534 * enum dp_ctxt_type - context type 535 * @DP_PDEV_TYPE: PDEV context 536 * @DP_RX_RING_HIST_TYPE: Datapath rx ring history 537 * @DP_RX_ERR_RING_HIST_TYPE: Datapath rx error ring history 538 * @DP_RX_REINJECT_RING_HIST_TYPE: Datapath reinject ring history 539 * @DP_TX_TCL_HIST_TYPE: 540 * @DP_TX_COMP_HIST_TYPE: 541 * @DP_FISA_RX_FT_TYPE: 542 * @DP_RX_REFILL_RING_HIST_TYPE: Datapath rx refill ring history 543 * @DP_TX_HW_DESC_HIST_TYPE: Datapath TX HW descriptor history 544 * @DP_MON_SOC_TYPE: Datapath monitor soc context 545 * @DP_MON_PDEV_TYPE: Datapath monitor pdev context 546 * @DP_MON_STATUS_BUF_HIST_TYPE: DP monitor status buffer history 547 * @DP_CFG_EVENT_HIST_TYPE: DP config events history 548 * @DP_MON_TX_DESC_POOL_TYPE: DP TX desc pool buffer 549 * @DP_MON_RX_DESC_POOL_TYPE: DP RX desc pool buffer 550 */ 551 enum dp_ctxt_type { 552 DP_PDEV_TYPE, 553 DP_RX_RING_HIST_TYPE, 554 DP_RX_ERR_RING_HIST_TYPE, 555 DP_RX_REINJECT_RING_HIST_TYPE, 556 DP_TX_TCL_HIST_TYPE, 557 DP_TX_COMP_HIST_TYPE, 558 DP_FISA_RX_FT_TYPE, 559 DP_RX_REFILL_RING_HIST_TYPE, 560 DP_TX_HW_DESC_HIST_TYPE, 561 DP_MON_SOC_TYPE, 562 DP_MON_PDEV_TYPE, 563 DP_MON_STATUS_BUF_HIST_TYPE, 564 DP_CFG_EVENT_HIST_TYPE, 565 DP_MON_TX_DESC_POOL_TYPE, 566 DP_MON_RX_DESC_POOL_TYPE, 567 }; 568 569 /** 570 * struct rx_desc_pool 571 * @pool_size: number of RX descriptor in the pool 572 * @elem_size: Element size 573 * @desc_pages: Multi page descriptors 574 * @array: pointer to array of RX descriptor 575 * @freelist: pointer to free RX descriptor link list 576 * @lock: Protection for the RX descriptor pool 577 * @owner: owner for nbuf 578 * @buf_size: Buffer size 579 * @buf_alignment: Buffer alignment 580 * @rx_mon_dest_frag_enable: Enable frag processing for mon dest buffer 581 * @pf_cache: page frag cache 582 * @desc_type: type of desc this pool serves 583 */ 584 struct rx_desc_pool { 585 uint32_t pool_size; 586 #ifdef RX_DESC_MULTI_PAGE_ALLOC 587 uint16_t elem_size; 588 struct qdf_mem_multi_page_t desc_pages; 589 #else 590 union dp_rx_desc_list_elem_t *array; 591 #endif 592 union dp_rx_desc_list_elem_t *freelist; 593 qdf_spinlock_t lock; 594 uint8_t owner; 595 uint16_t buf_size; 596 uint8_t buf_alignment; 597 bool rx_mon_dest_frag_enable; 598 qdf_frag_cache_t pf_cache; 599 enum qdf_dp_desc_type desc_type; 600 }; 601 602 /** 603 * struct dp_tx_ext_desc_elem_s 604 * @next: next extension descriptor pointer 605 * @vaddr: hlos virtual address pointer 606 * @paddr: physical address pointer for descriptor 607 * @flags: mark features for extension descriptor 608 * @me_buffer: Pointer to ME buffer - store this so that it can be freed on 609 * Tx completion of ME packet 610 * @tso_desc: Pointer to Tso desc 611 * @tso_num_desc: Pointer to tso_num_desc 612 */ 613 struct dp_tx_ext_desc_elem_s { 614 struct dp_tx_ext_desc_elem_s *next; 615 void *vaddr; 616 qdf_dma_addr_t paddr; 617 uint16_t flags; 618 struct dp_tx_me_buf_t *me_buffer; 619 struct qdf_tso_seg_elem_t *tso_desc; 620 struct qdf_tso_num_seg_elem_t *tso_num_desc; 621 }; 622 623 /* 624 * NB: intentionally not using kernel-doc comment because the kernel-doc 625 * script does not handle the qdf_dma_mem_context macro 626 * struct dp_tx_ext_desc_pool_s - Tx Extension Descriptor Pool 627 * @elem_count: Number of descriptors in the pool 628 * @elem_size: Size of each descriptor 629 * @num_free: Number of free descriptors 630 * @desc_pages: multiple page allocation information for actual descriptors 631 * @link_elem_size: size of the link descriptor in cacheable memory used for 632 * chaining the extension descriptors 633 * @desc_link_pages: multiple page allocation information for link descriptors 634 * @freelist: 635 * @lock: 636 * @memctx: 637 */ 638 struct dp_tx_ext_desc_pool_s { 639 uint16_t elem_count; 640 int elem_size; 641 uint16_t num_free; 642 struct qdf_mem_multi_page_t desc_pages; 643 int link_elem_size; 644 struct qdf_mem_multi_page_t desc_link_pages; 645 struct dp_tx_ext_desc_elem_s *freelist; 646 qdf_spinlock_t lock; 647 qdf_dma_mem_context(memctx); 648 }; 649 650 /** 651 * struct dp_tx_desc_s - Tx Descriptor 652 * @next: Next in the chain of descriptors in freelist or in the completion list 653 * @nbuf: Buffer Address 654 * @length: 655 * @magic: 656 * @timestamp_tick: 657 * @flags: Flags to track the state of descriptor and special frame handling 658 * @id: Descriptor ID 659 * @dma_addr: 660 * @vdev_id: vdev_id of vdev over which the packet was transmitted 661 * @tx_status: 662 * @peer_id: 663 * @pdev: Handle to pdev 664 * @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet). 665 * This is maintained in descriptor to allow more efficient 666 * processing in completion event processing code. 667 * This field is filled in with the htt_pkt_type enum. 668 * @buffer_src: buffer source TQM, REO, FW etc. 669 * @reserved: 670 * @frm_type: Frame Type - ToDo check if this is redundant 671 * @pkt_offset: Offset from which the actual packet data starts 672 * @pool_id: Pool ID - used when releasing the descriptor 673 * @msdu_ext_desc: MSDU extension descriptor 674 * @timestamp: 675 * @driver_egress_ts: driver egress timestamp 676 * @driver_ingress_ts: driver ingress timestamp 677 * @comp: 678 * @tcl_cmd_vaddr: VADDR of the TCL descriptor, valid for soft-umac arch 679 * @tcl_cmd_paddr: PADDR of the TCL descriptor, valid for soft-umac arch 680 */ 681 struct dp_tx_desc_s { 682 struct dp_tx_desc_s *next; 683 qdf_nbuf_t nbuf; 684 uint16_t length; 685 #ifdef DP_TX_TRACKING 686 uint32_t magic; 687 uint64_t timestamp_tick; 688 #endif 689 uint32_t flags; 690 uint32_t id; 691 qdf_dma_addr_t dma_addr; 692 uint8_t vdev_id; 693 uint8_t tx_status; 694 uint16_t peer_id; 695 struct dp_pdev *pdev; 696 uint8_t tx_encap_type:2, 697 buffer_src:3, 698 reserved:3; 699 uint8_t frm_type; 700 uint8_t pkt_offset; 701 uint8_t pool_id; 702 struct dp_tx_ext_desc_elem_s *msdu_ext_desc; 703 qdf_ktime_t timestamp; 704 #ifdef WLAN_FEATURE_TX_LATENCY_STATS 705 qdf_ktime_t driver_egress_ts; 706 qdf_ktime_t driver_ingress_ts; 707 #endif 708 struct hal_tx_desc_comp_s comp; 709 #ifdef WLAN_SOFTUMAC_SUPPORT 710 void *tcl_cmd_vaddr; 711 qdf_dma_addr_t tcl_cmd_paddr; 712 #endif 713 }; 714 715 #ifdef QCA_AC_BASED_FLOW_CONTROL 716 /** 717 * enum flow_pool_status - flow pool status 718 * @FLOW_POOL_ACTIVE_UNPAUSED : pool is active (can take/put descriptors) 719 * and network queues are unpaused 720 * @FLOW_POOL_ACTIVE_PAUSED: pool is active (can take/put descriptors) 721 * and network queues are paused 722 * @FLOW_POOL_BE_BK_PAUSED: 723 * @FLOW_POOL_VI_PAUSED: 724 * @FLOW_POOL_VO_PAUSED: 725 * @FLOW_POOL_INVALID: pool is invalid (put descriptor) 726 * @FLOW_POOL_INACTIVE: pool is inactive (pool is free) 727 * @FLOW_POOL_ACTIVE_UNPAUSED_REATTACH: pool is reattached but network 728 * queues are not paused 729 */ 730 enum flow_pool_status { 731 FLOW_POOL_ACTIVE_UNPAUSED = 0, 732 FLOW_POOL_ACTIVE_PAUSED = 1, 733 FLOW_POOL_BE_BK_PAUSED = 2, 734 FLOW_POOL_VI_PAUSED = 3, 735 FLOW_POOL_VO_PAUSED = 4, 736 FLOW_POOL_INVALID = 5, 737 FLOW_POOL_INACTIVE = 6, 738 FLOW_POOL_ACTIVE_UNPAUSED_REATTACH = 7, 739 }; 740 741 #else 742 /** 743 * enum flow_pool_status - flow pool status 744 * @FLOW_POOL_ACTIVE_UNPAUSED : pool is active (can take/put descriptors) 745 * and network queues are unpaused 746 * @FLOW_POOL_ACTIVE_PAUSED: pool is active (can take/put descriptors) 747 * and network queues are paused 748 * @FLOW_POOL_BE_BK_PAUSED: 749 * @FLOW_POOL_VI_PAUSED: 750 * @FLOW_POOL_VO_PAUSED: 751 * @FLOW_POOL_INVALID: pool is invalid (put descriptor) 752 * @FLOW_POOL_INACTIVE: pool is inactive (pool is free) 753 */ 754 enum flow_pool_status { 755 FLOW_POOL_ACTIVE_UNPAUSED = 0, 756 FLOW_POOL_ACTIVE_PAUSED = 1, 757 FLOW_POOL_BE_BK_PAUSED = 2, 758 FLOW_POOL_VI_PAUSED = 3, 759 FLOW_POOL_VO_PAUSED = 4, 760 FLOW_POOL_INVALID = 5, 761 FLOW_POOL_INACTIVE = 6, 762 }; 763 764 #endif 765 766 /** 767 * struct dp_tx_tso_seg_pool_s 768 * @pool_size: total number of pool elements 769 * @num_free: free element count 770 * @freelist: first free element pointer 771 * @desc_pages: multiple page allocation information for actual descriptors 772 * @lock: lock for accessing the pool 773 */ 774 struct dp_tx_tso_seg_pool_s { 775 uint16_t pool_size; 776 uint16_t num_free; 777 struct qdf_tso_seg_elem_t *freelist; 778 struct qdf_mem_multi_page_t desc_pages; 779 qdf_spinlock_t lock; 780 }; 781 782 /** 783 * struct dp_tx_tso_num_seg_pool_s - TSO Num seg pool 784 * @num_seg_pool_size: total number of pool elements 785 * @num_free: free element count 786 * @freelist: first free element pointer 787 * @desc_pages: multiple page allocation information for actual descriptors 788 * @lock: lock for accessing the pool 789 */ 790 791 struct dp_tx_tso_num_seg_pool_s { 792 uint16_t num_seg_pool_size; 793 uint16_t num_free; 794 struct qdf_tso_num_seg_elem_t *freelist; 795 struct qdf_mem_multi_page_t desc_pages; 796 /*tso mutex */ 797 qdf_spinlock_t lock; 798 }; 799 800 /** 801 * struct dp_tx_desc_pool_s - Tx Descriptor pool information 802 * @elem_size: Size of each descriptor in the pool 803 * @num_allocated: Number of used descriptors 804 * @freelist: Chain of free descriptors 805 * @desc_pages: multiple page allocation information for actual descriptors 806 * @pool_size: Total number of descriptors in the pool 807 * @flow_pool_id: 808 * @num_invalid_bin: Deleted pool with pending Tx completions. 809 * @avail_desc: 810 * @status: 811 * @flow_type: 812 * @stop_th: 813 * @start_th: 814 * @max_pause_time: 815 * @latest_pause_time: 816 * @pkt_drop_no_desc: 817 * @flow_pool_lock: 818 * @pool_create_cnt: 819 * @pool_owner_ctx: 820 * @elem_count: 821 * @num_free: Number of free descriptors 822 * @lock: Lock for descriptor allocation/free from/to the pool 823 */ 824 struct dp_tx_desc_pool_s { 825 uint16_t elem_size; 826 uint32_t num_allocated; 827 struct dp_tx_desc_s *freelist; 828 struct qdf_mem_multi_page_t desc_pages; 829 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 830 uint16_t pool_size; 831 uint8_t flow_pool_id; 832 uint8_t num_invalid_bin; 833 uint16_t avail_desc; 834 enum flow_pool_status status; 835 enum htt_flow_type flow_type; 836 #ifdef QCA_AC_BASED_FLOW_CONTROL 837 uint16_t stop_th[FL_TH_MAX]; 838 uint16_t start_th[FL_TH_MAX]; 839 qdf_time_t max_pause_time[FL_TH_MAX]; 840 qdf_time_t latest_pause_time[FL_TH_MAX]; 841 #else 842 uint16_t stop_th; 843 uint16_t start_th; 844 #endif 845 uint16_t pkt_drop_no_desc; 846 qdf_spinlock_t flow_pool_lock; 847 uint8_t pool_create_cnt; 848 void *pool_owner_ctx; 849 #else 850 uint16_t elem_count; 851 uint32_t num_free; 852 qdf_spinlock_t lock; 853 #endif 854 }; 855 856 /** 857 * struct dp_txrx_pool_stats - flow pool related statistics 858 * @pool_map_count: flow pool map received 859 * @pool_unmap_count: flow pool unmap received 860 * @pkt_drop_no_pool: packets dropped due to unavailablity of pool 861 */ 862 struct dp_txrx_pool_stats { 863 uint16_t pool_map_count; 864 uint16_t pool_unmap_count; 865 uint16_t pkt_drop_no_pool; 866 }; 867 868 /** 869 * struct dp_srng - DP srng structure 870 * @hal_srng: hal_srng handle 871 * @base_vaddr_unaligned: un-aligned virtual base address of the srng ring 872 * @base_vaddr_aligned: aligned virtual base address of the srng ring 873 * @base_paddr_unaligned: un-aligned physical base address of the srng ring 874 * @base_paddr_aligned: aligned physical base address of the srng ring 875 * @alloc_size: size of the srng ring 876 * @cached: is the srng ring memory cached or un-cached memory 877 * @irq: irq number of the srng ring 878 * @num_entries: number of entries in the srng ring 879 * @stats: Structure to track the ring utilization stats 880 * @is_mem_prealloc: Is this srng memory pre-allocated 881 * @crit_thresh: Critical threshold for near-full processing of this srng 882 * @safe_thresh: Safe threshold for near-full processing of this srng 883 * @near_full: Flag to indicate srng is near-full 884 */ 885 struct dp_srng { 886 hal_ring_handle_t hal_srng; 887 void *base_vaddr_unaligned; 888 void *base_vaddr_aligned; 889 qdf_dma_addr_t base_paddr_unaligned; 890 qdf_dma_addr_t base_paddr_aligned; 891 uint32_t alloc_size; 892 uint8_t cached; 893 int irq; 894 uint32_t num_entries; 895 struct ring_util_stats stats; 896 #ifdef DP_MEM_PRE_ALLOC 897 uint8_t is_mem_prealloc; 898 #endif 899 #ifdef WLAN_FEATURE_NEAR_FULL_IRQ 900 uint16_t crit_thresh; 901 uint16_t safe_thresh; 902 qdf_atomic_t near_full; 903 #endif 904 }; 905 906 struct dp_rx_reorder_array_elem { 907 qdf_nbuf_t head; 908 qdf_nbuf_t tail; 909 }; 910 911 #define DP_RX_BA_INACTIVE 0 912 #define DP_RX_BA_ACTIVE 1 913 #define DP_RX_BA_IN_PROGRESS 2 914 struct dp_reo_cmd_info { 915 uint16_t cmd; 916 enum hal_reo_cmd_type cmd_type; 917 void *data; 918 void (*handler)(struct dp_soc *, void *, union hal_reo_status *); 919 TAILQ_ENTRY(dp_reo_cmd_info) reo_cmd_list_elem; 920 }; 921 922 struct dp_peer_delay_stats { 923 struct cdp_delay_tid_stats delay_tid_stats[CDP_MAX_DATA_TIDS] 924 [CDP_MAX_TXRX_CTX]; 925 }; 926 927 /* Rx TID defrag*/ 928 struct dp_rx_tid_defrag { 929 /* TID */ 930 int tid; 931 932 /* only used for defrag right now */ 933 TAILQ_ENTRY(dp_rx_tid_defrag) defrag_waitlist_elem; 934 935 /* Store dst desc for reinjection */ 936 hal_ring_desc_t dst_ring_desc; 937 struct dp_rx_desc *head_frag_desc; 938 939 /* Sequence and fragments that are being processed currently */ 940 uint32_t curr_seq_num; 941 uint32_t curr_frag_num; 942 943 /* TODO: Check the following while adding defragmentation support */ 944 struct dp_rx_reorder_array_elem *array; 945 /* base - single rx reorder element used for non-aggr cases */ 946 struct dp_rx_reorder_array_elem base; 947 /* rx_tid lock */ 948 qdf_spinlock_t defrag_tid_lock; 949 950 /* head PN number */ 951 uint64_t pn128[2]; 952 953 uint32_t defrag_timeout_ms; 954 955 /* defrag usage only, dp_peer pointer related with this tid */ 956 struct dp_txrx_peer *defrag_peer; 957 }; 958 959 /* Rx TID */ 960 struct dp_rx_tid { 961 /* TID */ 962 int tid; 963 964 /* Num of addba requests */ 965 uint32_t num_of_addba_req; 966 967 /* Num of addba responses */ 968 uint32_t num_of_addba_resp; 969 970 /* Num of delba requests */ 971 uint32_t num_of_delba_req; 972 973 /* Num of addba responses successful */ 974 uint32_t num_addba_rsp_success; 975 976 /* Num of addba responses failed */ 977 uint32_t num_addba_rsp_failed; 978 979 /* pn size */ 980 uint8_t pn_size; 981 /* REO TID queue descriptors */ 982 void *hw_qdesc_vaddr_unaligned; 983 void *hw_qdesc_vaddr_aligned; 984 qdf_dma_addr_t hw_qdesc_paddr_unaligned; 985 qdf_dma_addr_t hw_qdesc_paddr; 986 uint32_t hw_qdesc_alloc_size; 987 988 /* RX ADDBA session state */ 989 int ba_status; 990 991 /* RX BA window size */ 992 uint16_t ba_win_size; 993 994 /* Starting sequence number in Addba request */ 995 uint16_t startseqnum; 996 uint16_t dialogtoken; 997 uint16_t statuscode; 998 /* user defined ADDBA response status code */ 999 uint16_t userstatuscode; 1000 1001 /* rx_tid lock */ 1002 qdf_spinlock_t tid_lock; 1003 1004 /* Store ppdu_id when 2k exception is received */ 1005 uint32_t ppdu_id_2k; 1006 1007 /* Delba Tx completion status */ 1008 uint8_t delba_tx_status; 1009 1010 /* Delba Tx retry count */ 1011 uint8_t delba_tx_retry; 1012 1013 /* Delba stats */ 1014 uint32_t delba_tx_success_cnt; 1015 uint32_t delba_tx_fail_cnt; 1016 1017 /* Delba reason code for retries */ 1018 uint8_t delba_rcode; 1019 1020 /* Coex Override preserved windows size 1 based */ 1021 uint16_t rx_ba_win_size_override; 1022 #ifdef IPA_OFFLOAD 1023 /* rx msdu count per tid */ 1024 struct cdp_pkt_info rx_msdu_cnt; 1025 #endif 1026 1027 }; 1028 1029 /** 1030 * struct dp_intr_stats - DP Interrupt Stats for an interrupt context 1031 * @num_tx_ring_masks: interrupts with tx_ring_mask set 1032 * @num_rx_ring_masks: interrupts with rx_ring_mask set 1033 * @num_rx_mon_ring_masks: interrupts with rx_mon_ring_mask set 1034 * @num_rx_err_ring_masks: interrupts with rx_err_ring_mask set 1035 * @num_rx_wbm_rel_ring_masks: interrupts with rx_wbm_rel_ring_mask set 1036 * @num_reo_status_ring_masks: interrupts with reo_status_ring_mask set 1037 * @num_rxdma2host_ring_masks: interrupts with rxdma2host_ring_mask set 1038 * @num_host2rxdma_ring_masks: interrupts with host2rxdma_ring_mask set 1039 * @num_host2rxdma_mon_ring_masks: interrupts with host2rxdma_ring_mask set 1040 * @num_rx_ring_near_full_masks: Near-full interrupts for REO DST ring 1041 * @num_tx_comp_ring_near_full_masks: Near-full interrupts for TX completion 1042 * @num_rx_wbm_rel_ring_near_full_masks: total number of times the wbm rel ring 1043 * near full interrupt was received 1044 * @num_reo_status_ring_near_full_masks: total number of times the reo status 1045 * near full interrupt was received 1046 * @num_near_full_masks: total number of times the near full interrupt 1047 * was received 1048 * @num_masks: total number of times the interrupt was received 1049 * @num_host2txmon_ring__masks: interrupts with host2txmon_ring_mask set 1050 * @num_near_full_masks: total number of times the interrupt was received 1051 * @num_masks: total number of times the near full interrupt was received 1052 * @num_tx_mon_ring_masks: interrupts with num_tx_mon_ring_masks set 1053 * 1054 * Counter for individual masks are incremented only if there are any packets 1055 * on that ring. 1056 */ 1057 struct dp_intr_stats { 1058 uint32_t num_tx_ring_masks[MAX_TCL_DATA_RINGS]; 1059 uint32_t num_rx_ring_masks[MAX_REO_DEST_RINGS]; 1060 uint32_t num_rx_mon_ring_masks; 1061 uint32_t num_rx_err_ring_masks; 1062 uint32_t num_rx_wbm_rel_ring_masks; 1063 uint32_t num_reo_status_ring_masks; 1064 uint32_t num_rxdma2host_ring_masks; 1065 uint32_t num_host2rxdma_ring_masks; 1066 uint32_t num_host2rxdma_mon_ring_masks; 1067 uint32_t num_rx_ring_near_full_masks[MAX_REO_DEST_RINGS]; 1068 uint32_t num_tx_comp_ring_near_full_masks[MAX_TCL_DATA_RINGS]; 1069 uint32_t num_rx_wbm_rel_ring_near_full_masks; 1070 uint32_t num_reo_status_ring_near_full_masks; 1071 uint32_t num_host2txmon_ring__masks; 1072 uint32_t num_near_full_masks; 1073 uint32_t num_masks; 1074 uint32_t num_tx_mon_ring_masks; 1075 }; 1076 1077 #ifdef DP_UMAC_HW_RESET_SUPPORT 1078 /** 1079 * struct dp_intr_bkp - DP per interrupt context ring masks old state 1080 * @tx_ring_mask: WBM Tx completion rings (0-2) associated with this napi ctxt 1081 * @rx_ring_mask: Rx REO rings (0-3) associated with this interrupt context 1082 * @rx_mon_ring_mask: Rx monitor ring mask (0-2) 1083 * @rx_err_ring_mask: REO Exception Ring 1084 * @rx_wbm_rel_ring_mask: WBM2SW Rx Release Ring 1085 * @reo_status_ring_mask: REO command response ring 1086 * @rxdma2host_ring_mask: RXDMA to host destination ring 1087 * @host2rxdma_ring_mask: Host to RXDMA buffer ring 1088 * @host2rxdma_mon_ring_mask: Host to RXDMA monitor buffer ring 1089 * @host2txmon_ring_mask: Tx monitor buffer ring 1090 * @tx_mon_ring_mask: Tx monitor ring mask (0-2) 1091 * 1092 */ 1093 struct dp_intr_bkp { 1094 uint8_t tx_ring_mask; 1095 uint8_t rx_ring_mask; 1096 uint8_t rx_mon_ring_mask; 1097 uint8_t rx_err_ring_mask; 1098 uint8_t rx_wbm_rel_ring_mask; 1099 uint8_t reo_status_ring_mask; 1100 uint8_t rxdma2host_ring_mask; 1101 uint8_t host2rxdma_ring_mask; 1102 uint8_t host2rxdma_mon_ring_mask; 1103 uint8_t host2txmon_ring_mask; 1104 uint8_t tx_mon_ring_mask; 1105 }; 1106 #endif 1107 1108 /* per interrupt context */ 1109 struct dp_intr { 1110 uint8_t tx_ring_mask; /* WBM Tx completion rings (0-2) 1111 associated with this napi context */ 1112 uint8_t rx_ring_mask; /* Rx REO rings (0-3) associated 1113 with this interrupt context */ 1114 uint8_t rx_mon_ring_mask; /* Rx monitor ring mask (0-2) */ 1115 uint8_t rx_err_ring_mask; /* REO Exception Ring */ 1116 uint8_t rx_wbm_rel_ring_mask; /* WBM2SW Rx Release Ring */ 1117 uint8_t reo_status_ring_mask; /* REO command response ring */ 1118 uint8_t rxdma2host_ring_mask; /* RXDMA to host destination ring */ 1119 uint8_t host2rxdma_ring_mask; /* Host to RXDMA buffer ring */ 1120 /* Host to RXDMA monitor buffer ring */ 1121 uint8_t host2rxdma_mon_ring_mask; 1122 /* RX REO rings near full interrupt mask */ 1123 uint8_t rx_near_full_grp_1_mask; 1124 /* RX REO rings near full interrupt mask */ 1125 uint8_t rx_near_full_grp_2_mask; 1126 /* WBM TX completion rings near full interrupt mask */ 1127 uint8_t tx_ring_near_full_mask; 1128 uint8_t host2txmon_ring_mask; /* Tx monitor buffer ring */ 1129 uint8_t tx_mon_ring_mask; /* Tx monitor ring mask (0-2) */ 1130 struct dp_soc *soc; /* Reference to SoC structure , 1131 to get DMA ring handles */ 1132 qdf_lro_ctx_t lro_ctx; 1133 uint8_t dp_intr_id; 1134 1135 /* Interrupt Stats for individual masks */ 1136 struct dp_intr_stats intr_stats; 1137 uint8_t umac_reset_intr_mask; /* UMAC reset interrupt mask */ 1138 }; 1139 1140 #define REO_DESC_FREELIST_SIZE 64 1141 #define REO_DESC_FREE_DEFER_MS 1000 1142 struct reo_desc_list_node { 1143 qdf_list_node_t node; 1144 unsigned long free_ts; 1145 struct dp_rx_tid rx_tid; 1146 bool resend_update_reo_cmd; 1147 uint32_t pending_ext_desc_size; 1148 #ifdef REO_QDESC_HISTORY 1149 uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; 1150 #endif 1151 }; 1152 1153 #ifdef WLAN_DP_FEATURE_DEFERRED_REO_QDESC_DESTROY 1154 #define REO_DESC_DEFERRED_FREELIST_SIZE 256 1155 #define REO_DESC_DEFERRED_FREE_MS 30000 1156 1157 struct reo_desc_deferred_freelist_node { 1158 qdf_list_node_t node; 1159 unsigned long free_ts; 1160 void *hw_qdesc_vaddr_unaligned; 1161 qdf_dma_addr_t hw_qdesc_paddr; 1162 uint32_t hw_qdesc_alloc_size; 1163 #ifdef REO_QDESC_HISTORY 1164 uint8_t peer_mac[QDF_MAC_ADDR_SIZE]; 1165 #endif /* REO_QDESC_HISTORY */ 1166 }; 1167 #endif /* WLAN_DP_FEATURE_DEFERRED_REO_QDESC_DESTROY */ 1168 1169 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY 1170 /** 1171 * struct reo_cmd_event_record: Elements to record for each reo command 1172 * @cmd_type: reo command type 1173 * @cmd_return_status: reo command post status 1174 * @timestamp: record timestamp for the reo command 1175 */ 1176 struct reo_cmd_event_record { 1177 enum hal_reo_cmd_type cmd_type; 1178 uint8_t cmd_return_status; 1179 uint64_t timestamp; 1180 }; 1181 1182 /** 1183 * struct reo_cmd_event_history: Account for reo cmd events 1184 * @index: record number 1185 * @cmd_record: list of records 1186 */ 1187 struct reo_cmd_event_history { 1188 qdf_atomic_t index; 1189 struct reo_cmd_event_record cmd_record[REO_CMD_EVENT_HIST_MAX]; 1190 }; 1191 #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */ 1192 1193 /* SoC level data path statistics */ 1194 struct dp_soc_stats { 1195 struct { 1196 uint32_t added; 1197 uint32_t deleted; 1198 uint32_t aged_out; 1199 uint32_t map_err; 1200 uint32_t ast_mismatch; 1201 } ast; 1202 1203 struct { 1204 uint32_t added; 1205 uint32_t deleted; 1206 } mec; 1207 1208 /* SOC level TX stats */ 1209 struct { 1210 /* Total packets transmitted */ 1211 struct cdp_pkt_info egress[MAX_TCL_DATA_RINGS]; 1212 /* Enqueues per tcl ring */ 1213 uint32_t tcl_enq[MAX_TCL_DATA_RINGS]; 1214 /* packets dropped on tx because of no peer */ 1215 struct cdp_pkt_info tx_invalid_peer; 1216 /* descriptors in each tcl ring */ 1217 uint32_t tcl_ring_full[MAX_TCL_DATA_RINGS]; 1218 /* Descriptors in use at soc */ 1219 uint32_t desc_in_use; 1220 /* tqm_release_reason == FW removed */ 1221 uint32_t dropped_fw_removed; 1222 /* tx completion release_src != TQM or FW */ 1223 uint32_t invalid_release_source; 1224 /* TX descriptor from completion ring Desc is not valid */ 1225 uint32_t invalid_tx_comp_desc; 1226 /* tx completion wbm_internal_error */ 1227 uint32_t wbm_internal_error[MAX_WBM_INT_ERROR_REASONS]; 1228 /* tx completion non_wbm_internal_error */ 1229 uint32_t non_wbm_internal_err; 1230 /* TX Comp loop packet limit hit */ 1231 uint32_t tx_comp_loop_pkt_limit_hit; 1232 /* Head pointer Out of sync at the end of dp_tx_comp_handler */ 1233 uint32_t hp_oos2; 1234 /* tx desc freed as part of vdev detach */ 1235 uint32_t tx_comp_exception; 1236 /* TQM drops after/during peer delete */ 1237 uint64_t tqm_drop_no_peer; 1238 /* Number of tx completions reaped per WBM2SW release ring */ 1239 uint32_t tx_comp[MAX_TCL_DATA_RINGS]; 1240 /* Number of tx completions force freed */ 1241 uint32_t tx_comp_force_freed; 1242 /* Tx completion ring near full */ 1243 uint32_t near_full; 1244 /* Tx drops with buffer src as HAL_TX_COMP_RELEASE_SOURCE_FW */ 1245 uint32_t fw2wbm_tx_drop; 1246 } tx; 1247 1248 /* SOC level RX stats */ 1249 struct { 1250 /* Total rx packets count */ 1251 struct cdp_pkt_info ingress; 1252 /* Rx errors */ 1253 /* Total Packets in Rx Error ring */ 1254 uint32_t err_ring_pkts; 1255 /* No of Fragments */ 1256 uint32_t rx_frags; 1257 /* No of incomplete fragments in waitlist */ 1258 uint32_t rx_frag_wait; 1259 /* Fragments dropped due to errors */ 1260 uint32_t rx_frag_err; 1261 /* Fragments received OOR causing sequence num mismatch */ 1262 uint32_t rx_frag_oor; 1263 /* Fragments dropped due to len errors in skb */ 1264 uint32_t rx_frag_err_len_error; 1265 /* Fragments dropped due to no peer found */ 1266 uint32_t rx_frag_err_no_peer; 1267 /* No of reinjected packets */ 1268 uint32_t reo_reinject; 1269 /* Reap loop packet limit hit */ 1270 uint32_t reap_loop_pkt_limit_hit; 1271 /* Head pointer Out of sync at the end of dp_rx_process */ 1272 uint32_t hp_oos2; 1273 /* Rx ring near full */ 1274 uint32_t near_full; 1275 /* Break ring reaping as not all scattered msdu received */ 1276 uint32_t msdu_scatter_wait_break; 1277 /* Number of bar frames received */ 1278 uint32_t bar_frame; 1279 /* Number of frames routed from rxdma */ 1280 uint32_t rxdma2rel_route_drop; 1281 /* Number of frames routed from reo*/ 1282 uint32_t reo2rel_route_drop; 1283 uint64_t fast_recycled; 1284 /* Number of hw stats requested */ 1285 uint32_t rx_hw_stats_requested; 1286 /* Number of hw stats request timeout */ 1287 uint32_t rx_hw_stats_timeout; 1288 1289 struct { 1290 /* Invalid RBM error count */ 1291 uint32_t invalid_rbm; 1292 /* Invalid VDEV Error count */ 1293 uint32_t invalid_vdev; 1294 /* Invalid PDEV error count */ 1295 uint32_t invalid_pdev; 1296 1297 /* Packets delivered to stack that no related peer */ 1298 uint32_t pkt_delivered_no_peer; 1299 /* Defrag peer uninit error count */ 1300 uint32_t defrag_peer_uninit; 1301 /* Invalid sa_idx or da_idx*/ 1302 uint32_t invalid_sa_da_idx; 1303 /* MSDU DONE failures */ 1304 uint32_t msdu_done_fail; 1305 /* Invalid PEER Error count */ 1306 struct cdp_pkt_info rx_invalid_peer; 1307 /* Invalid PEER ID count */ 1308 struct cdp_pkt_info rx_invalid_peer_id; 1309 /* Invalid packet length */ 1310 struct cdp_pkt_info rx_invalid_pkt_len; 1311 /* HAL ring access Fail error count */ 1312 uint32_t hal_ring_access_fail; 1313 /* HAL ring access full Fail error count */ 1314 uint32_t hal_ring_access_full_fail; 1315 /* RX DMA error count */ 1316 uint32_t rxdma_error[HAL_RXDMA_ERR_MAX]; 1317 /* RX REO DEST Desc Invalid Magic count */ 1318 uint32_t rx_desc_invalid_magic; 1319 /* REO Error count */ 1320 uint32_t reo_error[HAL_REO_ERR_MAX]; 1321 /* HAL REO ERR Count */ 1322 uint32_t hal_reo_error[MAX_REO_DEST_RINGS]; 1323 /* HAL REO DEST Duplicate count */ 1324 uint32_t hal_reo_dest_dup; 1325 /* HAL WBM RELEASE Duplicate count */ 1326 uint32_t hal_wbm_rel_dup; 1327 /* HAL RXDMA error Duplicate count */ 1328 uint32_t hal_rxdma_err_dup; 1329 /* ipa smmu map duplicate count */ 1330 uint32_t ipa_smmu_map_dup; 1331 /* ipa smmu unmap duplicate count */ 1332 uint32_t ipa_smmu_unmap_dup; 1333 /* ipa smmu unmap while ipa pipes is disabled */ 1334 uint32_t ipa_unmap_no_pipe; 1335 /* REO cmd send fail/requeue count */ 1336 uint32_t reo_cmd_send_fail; 1337 /* REO cmd send drain count */ 1338 uint32_t reo_cmd_send_drain; 1339 /* RX msdu drop count due to scatter */ 1340 uint32_t scatter_msdu; 1341 /* RX msdu drop count due to invalid cookie */ 1342 uint32_t invalid_cookie; 1343 /* Count of stale cookie read in RX path */ 1344 uint32_t stale_cookie; 1345 /* Delba sent count due to RX 2k jump */ 1346 uint32_t rx_2k_jump_delba_sent; 1347 /* RX 2k jump msdu indicated to stack count */ 1348 uint32_t rx_2k_jump_to_stack; 1349 /* RX 2k jump msdu dropped count */ 1350 uint32_t rx_2k_jump_drop; 1351 /* REO ERR msdu buffer received */ 1352 uint32_t reo_err_msdu_buf_rcved; 1353 /* REO ERR msdu buffer with invalid coookie received */ 1354 uint32_t reo_err_msdu_buf_invalid_cookie; 1355 /* REO OOR msdu drop count */ 1356 uint32_t reo_err_oor_drop; 1357 /* REO OOR msdu indicated to stack count */ 1358 uint32_t reo_err_oor_to_stack; 1359 /* REO OOR scattered msdu count */ 1360 uint32_t reo_err_oor_sg_count; 1361 /* RX msdu rejected count on delivery to vdev stack_fn*/ 1362 uint32_t rejected; 1363 /* Incorrect msdu count in MPDU desc info */ 1364 uint32_t msdu_count_mismatch; 1365 /* RX raw frame dropped count */ 1366 uint32_t raw_frm_drop; 1367 /* Stale link desc cookie count*/ 1368 uint32_t invalid_link_cookie; 1369 /* Nbuf sanity failure */ 1370 uint32_t nbuf_sanity_fail; 1371 /* Duplicate link desc refilled */ 1372 uint32_t dup_refill_link_desc; 1373 /* Incorrect msdu continuation bit in MSDU desc */ 1374 uint32_t msdu_continuation_err; 1375 /* count of start sequence (ssn) updates */ 1376 uint32_t ssn_update_count; 1377 /* count of bar handling fail */ 1378 uint32_t bar_handle_fail_count; 1379 /* EAPOL drop count in intrabss scenario */ 1380 uint32_t intrabss_eapol_drop; 1381 /* PN check failed for 2K-jump or OOR error */ 1382 uint32_t pn_in_dest_check_fail; 1383 /* MSDU len err count */ 1384 uint32_t msdu_len_err; 1385 /* Rx flush count */ 1386 uint32_t rx_flush_count; 1387 /* Rx invalid tid count */ 1388 uint32_t rx_invalid_tid_err; 1389 /* Invalid address1 in defrag path*/ 1390 uint32_t defrag_ad1_invalid; 1391 /* decrypt error drop */ 1392 uint32_t decrypt_err_drop; 1393 #ifdef GLOBAL_ASSERT_AVOIDANCE 1394 /* rx_desc NULL war count*/ 1395 uint32_t rx_desc_null; 1396 /* wbm err invalid release buffer type */ 1397 uint32_t wbm_err_buf_rel_type; 1398 /* Reo entry rx desc null */ 1399 uint32_t reo_err_rx_desc_null; 1400 /* Invalid chip id received in intrabss path */ 1401 uint64_t intra_bss_bad_chipid; 1402 #endif 1403 } err; 1404 1405 /* packet count per core - per ring */ 1406 uint64_t ring_packets[NR_CPUS][MAX_REO_DEST_RINGS]; 1407 } rx; 1408 1409 #ifdef WLAN_FEATURE_DP_EVENT_HISTORY 1410 struct reo_cmd_event_history cmd_event_history; 1411 #endif /* WLAN_FEATURE_DP_EVENT_HISTORY */ 1412 }; 1413 1414 union dp_align_mac_addr { 1415 uint8_t raw[QDF_MAC_ADDR_SIZE]; 1416 struct { 1417 uint16_t bytes_ab; 1418 uint16_t bytes_cd; 1419 uint16_t bytes_ef; 1420 } align2; 1421 struct { 1422 uint32_t bytes_abcd; 1423 uint16_t bytes_ef; 1424 } align4; 1425 struct __attribute__((__packed__)) { 1426 uint16_t bytes_ab; 1427 uint32_t bytes_cdef; 1428 } align4_2; 1429 }; 1430 1431 /** 1432 * struct dp_ast_free_cb_params - HMWDS free callback cookie 1433 * @mac_addr: ast mac address 1434 * @peer_mac_addr: mac address of peer 1435 * @type: ast entry type 1436 * @vdev_id: vdev_id 1437 * @flags: ast flags 1438 */ 1439 struct dp_ast_free_cb_params { 1440 union dp_align_mac_addr mac_addr; 1441 union dp_align_mac_addr peer_mac_addr; 1442 enum cdp_txrx_ast_entry_type type; 1443 uint8_t vdev_id; 1444 uint32_t flags; 1445 }; 1446 1447 /** 1448 * struct dp_ast_entry - AST entry 1449 * 1450 * @ast_idx: Hardware AST Index 1451 * @peer_id: Next Hop peer_id (for non-WDS nodes, this will be point to 1452 * associated peer with this MAC address) 1453 * @mac_addr: MAC Address for this AST entry 1454 * @next_hop: Set to 1 if this is for a WDS node 1455 * @is_active: flag to indicate active data traffic on this node 1456 * (used for aging out/expiry) 1457 * @ase_list_elem: node in peer AST list 1458 * @is_bss: flag to indicate if entry corresponds to bss peer 1459 * @is_mapped: flag to indicate that we have mapped the AST entry 1460 * in ast_table 1461 * @pdev_id: pdev ID 1462 * @vdev_id: vdev ID 1463 * @ast_hash_value: hast value in HW 1464 * @ref_cnt: reference count 1465 * @type: flag to indicate type of the entry(static/WDS/MEC) 1466 * @delete_in_progress: Flag to indicate that delete commands send to FW 1467 * and host is waiting for response from FW 1468 * @callback: ast free/unmap callback 1469 * @cookie: argument to callback 1470 * @hash_list_elem: node in soc AST hash list (mac address used as hash) 1471 */ 1472 struct dp_ast_entry { 1473 uint16_t ast_idx; 1474 uint16_t peer_id; 1475 union dp_align_mac_addr mac_addr; 1476 bool next_hop; 1477 bool is_active; 1478 bool is_mapped; 1479 uint8_t pdev_id; 1480 uint8_t vdev_id; 1481 uint16_t ast_hash_value; 1482 qdf_atomic_t ref_cnt; 1483 enum cdp_txrx_ast_entry_type type; 1484 bool delete_in_progress; 1485 txrx_ast_free_cb callback; 1486 void *cookie; 1487 TAILQ_ENTRY(dp_ast_entry) ase_list_elem; 1488 TAILQ_ENTRY(dp_ast_entry) hash_list_elem; 1489 }; 1490 1491 /** 1492 * struct dp_mec_entry - MEC entry 1493 * 1494 * @mac_addr: MAC Address for this MEC entry 1495 * @is_active: flag to indicate active data traffic on this node 1496 * (used for aging out/expiry) 1497 * @pdev_id: pdev ID 1498 * @vdev_id: vdev ID 1499 * @hash_list_elem: node in soc MEC hash list (mac address used as hash) 1500 */ 1501 struct dp_mec_entry { 1502 union dp_align_mac_addr mac_addr; 1503 bool is_active; 1504 uint8_t pdev_id; 1505 uint8_t vdev_id; 1506 1507 TAILQ_ENTRY(dp_mec_entry) hash_list_elem; 1508 }; 1509 1510 /* SOC level htt stats */ 1511 struct htt_t2h_stats { 1512 /* lock to protect htt_stats_msg update */ 1513 qdf_spinlock_t lock; 1514 1515 /* work queue to process htt stats */ 1516 qdf_work_t work; 1517 1518 /* T2H Ext stats message queue */ 1519 qdf_nbuf_queue_t msg; 1520 1521 /* number of completed stats in htt_stats_msg */ 1522 uint32_t num_stats; 1523 }; 1524 1525 struct link_desc_bank { 1526 void *base_vaddr_unaligned; 1527 void *base_vaddr; 1528 qdf_dma_addr_t base_paddr_unaligned; 1529 qdf_dma_addr_t base_paddr; 1530 uint32_t size; 1531 }; 1532 1533 struct rx_buff_pool { 1534 qdf_nbuf_queue_head_t emerg_nbuf_q; 1535 uint32_t nbuf_fail_cnt; 1536 bool is_initialized; 1537 }; 1538 1539 struct rx_refill_buff_pool { 1540 bool is_initialized; 1541 uint16_t head; 1542 uint16_t tail; 1543 struct dp_pdev *dp_pdev; 1544 uint16_t max_bufq_len; 1545 qdf_nbuf_t buf_elem[2048]; 1546 }; 1547 1548 #ifdef DP_TX_HW_DESC_HISTORY 1549 #define DP_TX_HW_DESC_HIST_MAX 6144 1550 #define DP_TX_HW_DESC_HIST_PER_SLOT_MAX 2048 1551 #define DP_TX_HW_DESC_HIST_MAX_SLOTS 3 1552 #define DP_TX_HW_DESC_HIST_SLOT_SHIFT 11 1553 1554 struct dp_tx_hw_desc_evt { 1555 uint8_t tcl_desc[HAL_TX_DESC_LEN_BYTES]; 1556 uint8_t tcl_ring_id; 1557 uint64_t posted; 1558 uint32_t hp; 1559 uint32_t tp; 1560 }; 1561 1562 /* struct dp_tx_hw_desc_history - TX HW desc hisotry 1563 * @index: Index where the last entry is written 1564 * @entry: history entries 1565 */ 1566 struct dp_tx_hw_desc_history { 1567 qdf_atomic_t index; 1568 uint16_t num_entries_per_slot; 1569 uint16_t allocated; 1570 struct dp_tx_hw_desc_evt *entry[DP_TX_HW_DESC_HIST_MAX_SLOTS]; 1571 }; 1572 #endif 1573 1574 /** 1575 * enum dp_mon_status_process_event - Events for monitor status buffer record 1576 * @DP_MON_STATUS_BUF_REAP: Monitor status buffer is reaped from ring 1577 * @DP_MON_STATUS_BUF_ENQUEUE: Status buffer is enqueued to local queue 1578 * @DP_MON_STATUS_BUF_DEQUEUE: Status buffer is dequeued from local queue 1579 */ 1580 enum dp_mon_status_process_event { 1581 DP_MON_STATUS_BUF_REAP, 1582 DP_MON_STATUS_BUF_ENQUEUE, 1583 DP_MON_STATUS_BUF_DEQUEUE, 1584 }; 1585 1586 #ifdef WLAN_FEATURE_DP_MON_STATUS_RING_HISTORY 1587 #define DP_MON_STATUS_HIST_MAX 2048 1588 1589 /** 1590 * struct dp_mon_stat_info_record - monitor stat ring buffer info 1591 * @hbi: HW ring buffer info 1592 * @timestamp: timestamp when this entry was recorded 1593 * @event: event 1594 * @rx_desc: RX descriptor corresponding to the received buffer 1595 * @nbuf: buffer attached to rx_desc, if event is REAP, else the buffer 1596 * which was enqueued or dequeued. 1597 * @rx_desc_nbuf_data: nbuf data pointer. 1598 */ 1599 struct dp_mon_stat_info_record { 1600 struct hal_buf_info hbi; 1601 uint64_t timestamp; 1602 enum dp_mon_status_process_event event; 1603 void *rx_desc; 1604 qdf_nbuf_t nbuf; 1605 uint8_t *rx_desc_nbuf_data; 1606 }; 1607 1608 /* struct dp_rx_history - rx ring hisotry 1609 * @index: Index where the last entry is written 1610 * @entry: history entries 1611 */ 1612 struct dp_mon_status_ring_history { 1613 qdf_atomic_t index; 1614 struct dp_mon_stat_info_record entry[DP_MON_STATUS_HIST_MAX]; 1615 }; 1616 #endif 1617 1618 #ifdef WLAN_FEATURE_DP_RX_RING_HISTORY 1619 /* 1620 * The logic for get current index of these history is dependent on this 1621 * value being power of 2. 1622 */ 1623 #define DP_RX_HIST_MAX 2048 1624 #define DP_RX_ERR_HIST_MAX 2048 1625 #define DP_RX_REINJECT_HIST_MAX 1024 1626 #define DP_RX_REFILL_HIST_MAX 2048 1627 1628 QDF_COMPILE_TIME_ASSERT(rx_history_size, 1629 (DP_RX_HIST_MAX & 1630 (DP_RX_HIST_MAX - 1)) == 0); 1631 QDF_COMPILE_TIME_ASSERT(rx_err_history_size, 1632 (DP_RX_ERR_HIST_MAX & 1633 (DP_RX_ERR_HIST_MAX - 1)) == 0); 1634 QDF_COMPILE_TIME_ASSERT(rx_reinject_history_size, 1635 (DP_RX_REINJECT_HIST_MAX & 1636 (DP_RX_REINJECT_HIST_MAX - 1)) == 0); 1637 QDF_COMPILE_TIME_ASSERT(rx_refill_history_size, 1638 (DP_RX_REFILL_HIST_MAX & 1639 (DP_RX_REFILL_HIST_MAX - 1)) == 0); 1640 1641 1642 /** 1643 * struct dp_buf_info_record - ring buffer info 1644 * @hbi: HW ring buffer info 1645 * @timestamp: timestamp when this entry was recorded 1646 */ 1647 struct dp_buf_info_record { 1648 struct hal_buf_info hbi; 1649 uint64_t timestamp; 1650 }; 1651 1652 /** 1653 * struct dp_refill_info_record - ring refill buffer info 1654 * @hp: HP value after refill 1655 * @tp: cached tail value during refill 1656 * @num_req: number of buffers requested to refill 1657 * @num_refill: number of buffers refilled to ring 1658 * @timestamp: timestamp when this entry was recorded 1659 */ 1660 struct dp_refill_info_record { 1661 uint32_t hp; 1662 uint32_t tp; 1663 uint32_t num_req; 1664 uint32_t num_refill; 1665 uint64_t timestamp; 1666 }; 1667 1668 /** 1669 * struct dp_rx_history - rx ring hisotry 1670 * @index: Index where the last entry is written 1671 * @entry: history entries 1672 */ 1673 struct dp_rx_history { 1674 qdf_atomic_t index; 1675 struct dp_buf_info_record entry[DP_RX_HIST_MAX]; 1676 }; 1677 1678 /** 1679 * struct dp_rx_err_history - rx err ring hisotry 1680 * @index: Index where the last entry is written 1681 * @entry: history entries 1682 */ 1683 struct dp_rx_err_history { 1684 qdf_atomic_t index; 1685 struct dp_buf_info_record entry[DP_RX_ERR_HIST_MAX]; 1686 }; 1687 1688 /** 1689 * struct dp_rx_reinject_history - rx reinject ring hisotry 1690 * @index: Index where the last entry is written 1691 * @entry: history entries 1692 */ 1693 struct dp_rx_reinject_history { 1694 qdf_atomic_t index; 1695 struct dp_buf_info_record entry[DP_RX_REINJECT_HIST_MAX]; 1696 }; 1697 1698 /** 1699 * struct dp_rx_refill_history - rx buf refill hisotry 1700 * @index: Index where the last entry is written 1701 * @entry: history entries 1702 */ 1703 struct dp_rx_refill_history { 1704 qdf_atomic_t index; 1705 struct dp_refill_info_record entry[DP_RX_REFILL_HIST_MAX]; 1706 }; 1707 1708 #endif 1709 1710 /** 1711 * enum dp_cfg_event_type - Datapath config events type 1712 * @DP_CFG_EVENT_VDEV_ATTACH: vdev attach 1713 * @DP_CFG_EVENT_VDEV_DETACH: vdev detach 1714 * @DP_CFG_EVENT_VDEV_UNREF_DEL: vdev memory free after last ref is released 1715 * @DP_CFG_EVENT_PEER_CREATE: peer create 1716 * @DP_CFG_EVENT_PEER_DELETE: peer delete 1717 * @DP_CFG_EVENT_PEER_UNREF_DEL: peer memory free after last ref is released 1718 * @DP_CFG_EVENT_PEER_SETUP: peer setup 1719 * @DP_CFG_EVENT_MLO_ADD_LINK: add link peer to mld peer 1720 * @DP_CFG_EVENT_MLO_DEL_LINK: delete link peer from mld peer 1721 * @DP_CFG_EVENT_MLO_SETUP: MLO peer setup 1722 * @DP_CFG_EVENT_MLO_SETUP_VDEV_UPDATE: MLD peer vdev update 1723 * @DP_CFG_EVENT_PEER_MAP: peer map 1724 * @DP_CFG_EVENT_PEER_UNMAP: peer unmap 1725 * @DP_CFG_EVENT_MLO_PEER_MAP: MLD peer map 1726 * @DP_CFG_EVENT_MLO_PEER_UNMAP: MLD peer unmap 1727 */ 1728 enum dp_cfg_event_type { 1729 DP_CFG_EVENT_VDEV_ATTACH, 1730 DP_CFG_EVENT_VDEV_DETACH, 1731 DP_CFG_EVENT_VDEV_UNREF_DEL, 1732 DP_CFG_EVENT_PEER_CREATE, 1733 DP_CFG_EVENT_PEER_DELETE, 1734 DP_CFG_EVENT_PEER_UNREF_DEL, 1735 DP_CFG_EVENT_PEER_SETUP, 1736 DP_CFG_EVENT_MLO_ADD_LINK, 1737 DP_CFG_EVENT_MLO_DEL_LINK, 1738 DP_CFG_EVENT_MLO_SETUP, 1739 DP_CFG_EVENT_MLO_SETUP_VDEV_UPDATE, 1740 DP_CFG_EVENT_PEER_MAP, 1741 DP_CFG_EVENT_PEER_UNMAP, 1742 DP_CFG_EVENT_MLO_PEER_MAP, 1743 DP_CFG_EVENT_MLO_PEER_UNMAP, 1744 }; 1745 1746 #ifdef WLAN_FEATURE_DP_CFG_EVENT_HISTORY 1747 /* Size must be in 2 power, for bitwise index rotation */ 1748 #define DP_CFG_EVT_HISTORY_SIZE 0x800 1749 #define DP_CFG_EVT_HIST_PER_SLOT_MAX 256 1750 #define DP_CFG_EVT_HIST_MAX_SLOTS 8 1751 #define DP_CFG_EVT_HIST_SLOT_SHIFT 8 1752 1753 /** 1754 * struct dp_vdev_attach_detach_desc - vdev ops descriptor 1755 * @vdev: DP vdev handle 1756 * @mac_addr: vdev mac address 1757 * @vdev_id: vdev id 1758 * @ref_count: vdev ref count 1759 */ 1760 struct dp_vdev_attach_detach_desc { 1761 struct dp_vdev *vdev; 1762 union dp_align_mac_addr mac_addr; 1763 uint8_t vdev_id; 1764 int32_t ref_count; 1765 }; 1766 1767 /** 1768 * struct dp_peer_cmn_ops_desc - peer events descriptor 1769 * @vdev_id: vdev_id of the vdev on which peer exists 1770 * @is_reuse: indicates if its a peer reuse case, during peer create 1771 * @peer: DP peer handle 1772 * @vdev: DP vdev handle on which peer exists 1773 * @mac_addr: peer mac address 1774 * @vdev_mac_addr: vdev mac address 1775 * @vdev_ref_count: vdev ref count 1776 * @peer_ref_count: peer ref count 1777 */ 1778 struct dp_peer_cmn_ops_desc { 1779 uint8_t vdev_id : 5, 1780 is_reuse : 1; 1781 struct dp_peer *peer; 1782 struct dp_vdev *vdev; 1783 union dp_align_mac_addr mac_addr; 1784 union dp_align_mac_addr vdev_mac_addr; 1785 int32_t vdev_ref_count; 1786 int32_t peer_ref_count; 1787 }; 1788 1789 /** 1790 * struct dp_mlo_add_del_link_desc - MLO add/del link event descriptor 1791 * @idx: index at which link peer got added in MLD peer's list 1792 * @num_links: num links added in the MLD peer's list 1793 * @action_result: add/del was success or not 1794 * @reserved: reserved bit 1795 * @link_peer: link peer handle 1796 * @mld_peer: MLD peer handle 1797 * @link_mac_addr: link peer mac address 1798 * @mld_mac_addr: MLD peer mac address 1799 */ 1800 struct dp_mlo_add_del_link_desc { 1801 uint8_t idx : 3, 1802 num_links : 3, 1803 action_result : 1, 1804 reserved : 1; 1805 struct dp_peer *link_peer; 1806 struct dp_peer *mld_peer; 1807 union dp_align_mac_addr link_mac_addr; 1808 union dp_align_mac_addr mld_mac_addr; 1809 }; 1810 1811 /** 1812 * struct dp_mlo_setup_vdev_update_desc - MLD peer vdev update event desc 1813 * @mld_peer: MLD peer handle 1814 * @prev_vdev: previous vdev handle 1815 * @new_vdev: new vdev handle 1816 */ 1817 struct dp_mlo_setup_vdev_update_desc { 1818 struct dp_peer *mld_peer; 1819 struct dp_vdev *prev_vdev; 1820 struct dp_vdev *new_vdev; 1821 }; 1822 1823 /** 1824 * struct dp_rx_peer_map_unmap_desc - peer map/unmap event descriptor 1825 * @peer_id: peer id 1826 * @ml_peer_id: ML peer id, if its an MLD peer 1827 * @hw_peer_id: hw peer id 1828 * @vdev_id: vdev id of the peer 1829 * @is_ml_peer: is this MLD peer 1830 * @mac_addr: mac address of the peer 1831 * @peer: peer handle 1832 */ 1833 struct dp_rx_peer_map_unmap_desc { 1834 uint16_t peer_id; 1835 uint16_t ml_peer_id; 1836 uint16_t hw_peer_id; 1837 uint8_t vdev_id; 1838 uint8_t is_ml_peer; 1839 union dp_align_mac_addr mac_addr; 1840 struct dp_peer *peer; 1841 }; 1842 1843 /** 1844 * struct dp_peer_setup_desc - peer setup event descriptor 1845 * @peer: DP peer handle 1846 * @vdev: vdev handle on which peer exists 1847 * @vdev_ref_count: vdev ref count 1848 * @mac_addr: peer mac address 1849 * @mld_mac_addr: MLD mac address 1850 * @is_first_link: is the current link the first link created 1851 * @is_primary_link: is the current link primary link 1852 * @vdev_id: vdev id of the vdev on which the current link peer exists 1853 * @reserved: reserved bit 1854 */ 1855 struct dp_peer_setup_desc { 1856 struct dp_peer *peer; 1857 struct dp_vdev *vdev; 1858 int32_t vdev_ref_count; 1859 union dp_align_mac_addr mac_addr; 1860 union dp_align_mac_addr mld_mac_addr; 1861 uint8_t is_first_link : 1, 1862 is_primary_link : 1, 1863 vdev_id : 5, 1864 reserved : 1; 1865 }; 1866 1867 /** 1868 * union dp_cfg_event_desc - DP config event descriptor 1869 * @vdev_evt: vdev events desc 1870 * @peer_cmn_evt: common peer events desc 1871 * @peer_setup_evt: peer setup event desc 1872 * @mlo_link_delink_evt: MLO link/delink event desc 1873 * @mlo_setup_vdev_update: MLD peer vdev update event desc 1874 * @peer_map_unmap_evt: peer map/unmap event desc 1875 */ 1876 union dp_cfg_event_desc { 1877 struct dp_vdev_attach_detach_desc vdev_evt; 1878 struct dp_peer_cmn_ops_desc peer_cmn_evt; 1879 struct dp_peer_setup_desc peer_setup_evt; 1880 struct dp_mlo_add_del_link_desc mlo_link_delink_evt; 1881 struct dp_mlo_setup_vdev_update_desc mlo_setup_vdev_update; 1882 struct dp_rx_peer_map_unmap_desc peer_map_unmap_evt; 1883 }; 1884 1885 /** 1886 * struct dp_cfg_event - DP config event descriptor 1887 * @timestamp: timestamp at which event was recorded 1888 * @type: event type 1889 * @event_desc: event descriptor 1890 */ 1891 struct dp_cfg_event { 1892 uint64_t timestamp; 1893 enum dp_cfg_event_type type; 1894 union dp_cfg_event_desc event_desc; 1895 }; 1896 1897 /** 1898 * struct dp_cfg_event_history - DP config event history 1899 * @index: current index 1900 * @num_entries_per_slot: number of entries per slot 1901 * @allocated: Is the history allocated or not 1902 * @entry: event history descriptors 1903 */ 1904 struct dp_cfg_event_history { 1905 qdf_atomic_t index; 1906 uint16_t num_entries_per_slot; 1907 uint16_t allocated; 1908 struct dp_cfg_event *entry[DP_CFG_EVT_HIST_MAX_SLOTS]; 1909 }; 1910 #endif 1911 1912 enum dp_tx_event_type { 1913 DP_TX_DESC_INVAL_EVT = 0, 1914 DP_TX_DESC_MAP, 1915 DP_TX_DESC_COOKIE, 1916 DP_TX_DESC_FLUSH, 1917 DP_TX_DESC_UNMAP, 1918 DP_TX_COMP_UNMAP, 1919 DP_TX_COMP_UNMAP_ERR, 1920 DP_TX_COMP_MSDU_EXT, 1921 }; 1922 1923 #ifdef WLAN_FEATURE_DP_TX_DESC_HISTORY 1924 /* Size must be in 2 power, for bitwise index rotation */ 1925 #define DP_TX_TCL_HISTORY_SIZE 0x4000 1926 #define DP_TX_TCL_HIST_PER_SLOT_MAX 2048 1927 #define DP_TX_TCL_HIST_MAX_SLOTS 8 1928 #define DP_TX_TCL_HIST_SLOT_SHIFT 11 1929 1930 /* Size must be in 2 power, for bitwise index rotation */ 1931 #define DP_TX_COMP_HISTORY_SIZE 0x4000 1932 #define DP_TX_COMP_HIST_PER_SLOT_MAX 2048 1933 #define DP_TX_COMP_HIST_MAX_SLOTS 8 1934 #define DP_TX_COMP_HIST_SLOT_SHIFT 11 1935 1936 struct dp_tx_desc_event { 1937 qdf_nbuf_t skb; 1938 dma_addr_t paddr; 1939 uint32_t sw_cookie; 1940 enum dp_tx_event_type type; 1941 uint64_t ts; 1942 }; 1943 1944 struct dp_tx_tcl_history { 1945 qdf_atomic_t index; 1946 uint16_t num_entries_per_slot; 1947 uint16_t allocated; 1948 struct dp_tx_desc_event *entry[DP_TX_TCL_HIST_MAX_SLOTS]; 1949 }; 1950 1951 struct dp_tx_comp_history { 1952 qdf_atomic_t index; 1953 uint16_t num_entries_per_slot; 1954 uint16_t allocated; 1955 struct dp_tx_desc_event *entry[DP_TX_COMP_HIST_MAX_SLOTS]; 1956 }; 1957 #endif /* WLAN_FEATURE_DP_TX_DESC_HISTORY */ 1958 1959 /* structure to record recent operation related variable */ 1960 struct dp_last_op_info { 1961 /* last link desc buf info through WBM release ring */ 1962 struct hal_buf_info wbm_rel_link_desc; 1963 /* last link desc buf info through REO reinject ring */ 1964 struct hal_buf_info reo_reinject_link_desc; 1965 }; 1966 1967 #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR 1968 1969 /** 1970 * struct dp_swlm_tcl_data - params for tcl register write coalescing 1971 * decision making 1972 * @nbuf: TX packet 1973 * @tid: tid for transmitting the current packet 1974 * @num_ll_connections: Number of low latency connections on this vdev 1975 * @ring_id: TCL ring id 1976 * @pkt_len: Packet length 1977 * 1978 * This structure contains the information required by the software 1979 * latency manager to decide on whether to coalesce the current TCL 1980 * register write or not. 1981 */ 1982 struct dp_swlm_tcl_data { 1983 qdf_nbuf_t nbuf; 1984 uint8_t tid; 1985 uint8_t num_ll_connections; 1986 uint8_t ring_id; 1987 uint32_t pkt_len; 1988 }; 1989 1990 /** 1991 * union swlm_data - SWLM query data 1992 * @tcl_data: data for TCL query in SWLM 1993 */ 1994 union swlm_data { 1995 struct dp_swlm_tcl_data *tcl_data; 1996 }; 1997 1998 /** 1999 * struct dp_swlm_ops - SWLM ops 2000 * @tcl_wr_coalesce_check: handler to check if the current TCL register 2001 * write can be coalesced or not 2002 */ 2003 struct dp_swlm_ops { 2004 int (*tcl_wr_coalesce_check)(struct dp_soc *soc, 2005 struct dp_swlm_tcl_data *tcl_data); 2006 }; 2007 2008 /** 2009 * struct dp_swlm_stats - Stats for Software Latency manager. 2010 * @tcl: TCL stats 2011 * @tcl.timer_flush_success: Num TCL HP writes success from timer context 2012 * @tcl.timer_flush_fail: Num TCL HP writes failure from timer context 2013 * @tcl.tid_fail: Num TCL register write coalescing skips, since the pkt 2014 * was being transmitted on a TID above coalescing threshold 2015 * @tcl.sp_frames: Num TCL register write coalescing skips, since the pkt 2016 * being transmitted was a special frame 2017 * @tcl.ll_connection: Num TCL register write coalescing skips, since the 2018 * vdev has low latency connections 2019 * @tcl.bytes_thresh_reached: Num TCL HP writes flush after the coalescing 2020 * bytes threshold was reached 2021 * @tcl.time_thresh_reached: Num TCL HP writes flush after the coalescing 2022 * session time expired 2023 * @tcl.tput_criteria_fail: Num TCL HP writes coalescing fails, since the 2024 * throughput did not meet session threshold 2025 * @tcl.coalesce_success: Num of TCL HP writes coalesced successfully. 2026 * @tcl.coalesce_fail: Num of TCL HP writes coalesces failed 2027 */ 2028 struct dp_swlm_stats { 2029 struct { 2030 uint32_t timer_flush_success; 2031 uint32_t timer_flush_fail; 2032 uint32_t tid_fail; 2033 uint32_t sp_frames; 2034 uint32_t ll_connection; 2035 uint32_t bytes_thresh_reached; 2036 uint32_t time_thresh_reached; 2037 uint32_t tput_criteria_fail; 2038 uint32_t coalesce_success; 2039 uint32_t coalesce_fail; 2040 } tcl[MAX_TCL_DATA_RINGS]; 2041 }; 2042 2043 /** 2044 * struct dp_swlm_tcl_params: Parameters based on TCL for different modules 2045 * in the Software latency manager. 2046 * @soc: DP soc reference 2047 * @ring_id: TCL ring id 2048 * @flush_timer: Timer for flushing the coalesced TCL HP writes 2049 * @sampling_session_tx_bytes: Num bytes transmitted in the sampling time 2050 * @bytes_flush_thresh: Bytes threshold to flush the TCL HP register write 2051 * @coalesce_end_time: End timestamp for current coalescing session 2052 * @bytes_coalesced: Num bytes coalesced in the current session 2053 * @prev_tx_packets: Previous TX packets accounted 2054 * @prev_tx_bytes: Previous TX bytes accounted 2055 * @prev_rx_bytes: Previous RX bytes accounted 2056 * @expire_time: expiry time for sample 2057 * @tput_pass_cnt: threshold throughput pass counter 2058 */ 2059 struct dp_swlm_tcl_params { 2060 struct dp_soc *soc; 2061 uint32_t ring_id; 2062 qdf_timer_t flush_timer; 2063 uint32_t sampling_session_tx_bytes; 2064 uint32_t bytes_flush_thresh; 2065 uint64_t coalesce_end_time; 2066 uint32_t bytes_coalesced; 2067 uint32_t prev_tx_packets; 2068 uint32_t prev_tx_bytes; 2069 uint32_t prev_rx_bytes; 2070 uint64_t expire_time; 2071 uint32_t tput_pass_cnt; 2072 }; 2073 2074 /** 2075 * struct dp_swlm_params: Parameters for different modules in the 2076 * Software latency manager. 2077 * @rx_traffic_thresh: Threshold for RX traffic, to begin TCL register 2078 * write coalescing 2079 * @tx_traffic_thresh: Threshold for TX traffic, to begin TCL register 2080 * write coalescing 2081 * @sampling_time: Sampling time to test the throughput threshold 2082 * @time_flush_thresh: Time threshold to flush the TCL HP register write 2083 * @tx_thresh_multiplier: Multiplier to deduce the bytes threshold after 2084 * which the TCL HP register is written, thereby 2085 * ending the coalescing. 2086 * @tx_pkt_thresh: Threshold for TX packet count, to begin TCL register 2087 * write coalescing 2088 * @tcl: TCL ring specific params 2089 */ 2090 2091 struct dp_swlm_params { 2092 uint32_t rx_traffic_thresh; 2093 uint32_t tx_traffic_thresh; 2094 uint32_t sampling_time; 2095 uint32_t time_flush_thresh; 2096 uint32_t tx_thresh_multiplier; 2097 uint32_t tx_pkt_thresh; 2098 struct dp_swlm_tcl_params tcl[MAX_TCL_DATA_RINGS]; 2099 }; 2100 2101 /** 2102 * struct dp_swlm - Software latency manager context 2103 * @ops: SWLM ops pointers 2104 * @is_enabled: SWLM enabled/disabled 2105 * @is_init: SWLM module initialized 2106 * @stats: SWLM stats 2107 * @params: SWLM SRNG params 2108 * @tcl_flush_timer: flush timer for TCL register writes 2109 */ 2110 struct dp_swlm { 2111 struct dp_swlm_ops *ops; 2112 uint8_t is_enabled:1, 2113 is_init:1; 2114 struct dp_swlm_stats stats; 2115 struct dp_swlm_params params; 2116 }; 2117 #endif 2118 2119 #ifdef IPA_OFFLOAD 2120 /* IPA uC datapath offload Wlan Tx resources */ 2121 struct ipa_dp_tx_rsc { 2122 /* Resource info to be passed to IPA */ 2123 qdf_dma_addr_t ipa_tcl_ring_base_paddr; 2124 void *ipa_tcl_ring_base_vaddr; 2125 uint32_t ipa_tcl_ring_size; 2126 qdf_dma_addr_t ipa_tcl_hp_paddr; 2127 uint32_t alloc_tx_buf_cnt; 2128 2129 qdf_dma_addr_t ipa_wbm_ring_base_paddr; 2130 void *ipa_wbm_ring_base_vaddr; 2131 uint32_t ipa_wbm_ring_size; 2132 qdf_dma_addr_t ipa_wbm_tp_paddr; 2133 /* WBM2SW HP shadow paddr */ 2134 qdf_dma_addr_t ipa_wbm_hp_shadow_paddr; 2135 2136 /* TX buffers populated into the WBM ring */ 2137 void **tx_buf_pool_vaddr_unaligned; 2138 qdf_dma_addr_t *tx_buf_pool_paddr_unaligned; 2139 }; 2140 2141 /* IPA uC datapath offload Wlan Rx resources */ 2142 struct ipa_dp_rx_rsc { 2143 /* Resource info to be passed to IPA */ 2144 qdf_dma_addr_t ipa_reo_ring_base_paddr; 2145 void *ipa_reo_ring_base_vaddr; 2146 uint32_t ipa_reo_ring_size; 2147 qdf_dma_addr_t ipa_reo_tp_paddr; 2148 2149 /* Resource info to be passed to firmware and IPA */ 2150 qdf_dma_addr_t ipa_rx_refill_buf_ring_base_paddr; 2151 void *ipa_rx_refill_buf_ring_base_vaddr; 2152 uint32_t ipa_rx_refill_buf_ring_size; 2153 qdf_dma_addr_t ipa_rx_refill_buf_hp_paddr; 2154 }; 2155 #endif 2156 2157 struct dp_tx_msdu_info_s; 2158 /** 2159 * enum dp_context_type- DP Context Type 2160 * @DP_CONTEXT_TYPE_SOC: Context type DP SOC 2161 * @DP_CONTEXT_TYPE_PDEV: Context type DP PDEV 2162 * @DP_CONTEXT_TYPE_VDEV: Context type DP VDEV 2163 * @DP_CONTEXT_TYPE_PEER: Context type DP PEER 2164 * @DP_CONTEXT_TYPE_MON_SOC: Context type DP MON SOC 2165 * @DP_CONTEXT_TYPE_MON_PDEV: Context type DP MON PDEV 2166 * 2167 * Helper enums to be used to retrieve the size of the corresponding 2168 * data structure by passing the type. 2169 */ 2170 enum dp_context_type { 2171 DP_CONTEXT_TYPE_SOC, 2172 DP_CONTEXT_TYPE_PDEV, 2173 DP_CONTEXT_TYPE_VDEV, 2174 DP_CONTEXT_TYPE_PEER, 2175 DP_CONTEXT_TYPE_MON_SOC, 2176 DP_CONTEXT_TYPE_MON_PDEV 2177 }; 2178 2179 /** 2180 * struct dp_arch_ops - DP target specific arch ops 2181 * @txrx_soc_attach: 2182 * @txrx_soc_detach: 2183 * @txrx_soc_init: 2184 * @txrx_soc_deinit: 2185 * @txrx_soc_srng_alloc: 2186 * @txrx_soc_srng_init: 2187 * @txrx_soc_srng_deinit: 2188 * @txrx_soc_srng_free: 2189 * @txrx_pdev_attach: 2190 * @txrx_pdev_detach: 2191 * @txrx_vdev_attach: 2192 * @txrx_vdev_detach: 2193 * @txrx_peer_map_attach: 2194 * @txrx_peer_map_detach: 2195 * @dp_rxdma_ring_sel_cfg: 2196 * @soc_cfg_attach: 2197 * @txrx_peer_setup: 2198 * @peer_get_reo_hash: 2199 * @reo_remap_config: 2200 * @tx_hw_enqueue: enqueue TX data to HW 2201 * @tx_comp_get_params_from_hal_desc: get software tx descriptor and release 2202 * source from HAL desc for wbm release ring 2203 * @dp_tx_mlo_mcast_send: Tx send handler for MLO multicast enhance 2204 * @dp_tx_process_htt_completion: 2205 * @dp_rx_process: 2206 * @dp_tx_send_fast: 2207 * @dp_tx_desc_pool_init: 2208 * @dp_tx_desc_pool_deinit: 2209 * @dp_rx_desc_pool_init: 2210 * @dp_rx_desc_pool_deinit: 2211 * @dp_wbm_get_rx_desc_from_hal_desc: 2212 * @dp_rx_intrabss_mcast_handler: 2213 * @dp_rx_word_mask_subscribe: 2214 * @dp_rx_desc_cookie_2_va: 2215 * @dp_service_near_full_srngs: Handler for servicing the near full IRQ 2216 * @tx_implicit_rbm_set: 2217 * @dp_rx_peer_metadata_peer_id_get: 2218 * @dp_rx_chain_msdus: 2219 * @txrx_set_vdev_param: target specific ops while setting vdev params 2220 * @txrx_get_vdev_mcast_param: target specific ops for getting vdev 2221 * params related to multicast 2222 * @txrx_get_context_size: 2223 * @txrx_get_mon_context_size: 2224 * @dp_srng_test_and_update_nf_params: Check if the srng is in near full state 2225 * and set the near-full params. 2226 * @dp_tx_mcast_handler: 2227 * @dp_rx_mcast_handler: 2228 * @dp_tx_is_mcast_primary: 2229 * @dp_soc_get_by_idle_bm_id: 2230 * @mlo_peer_find_hash_detach: 2231 * @mlo_peer_find_hash_attach: 2232 * @mlo_peer_find_hash_add: 2233 * @mlo_peer_find_hash_remove: 2234 * @mlo_peer_find_hash_find: 2235 * @mlo_get_chip_id: get the MLO chip id 2236 * @mlo_link_peer_find_hash_find_by_chip_id: return the link peer on the chip 2237 * @get_hw_link_id: 2238 * @dp_rx_peer_set_link_id: set link id in nbuf cb 2239 * @get_reo_qdesc_addr: 2240 * @get_rx_hash_key: 2241 * @dp_set_rx_fst: 2242 * @dp_get_rx_fst: 2243 * @dp_rx_fst_deref: 2244 * @dp_rx_fst_ref: 2245 * @txrx_print_peer_stats: 2246 * @dp_peer_rx_reorder_queue_setup: Dp peer reorder queue setup 2247 * @dp_bank_reconfig: 2248 * @dp_get_soc_by_chip_id: Get soc by chip id 2249 * @dp_soc_get_num_soc: 2250 * @dp_reconfig_tx_vdev_mcast_ctrl: 2251 * @dp_cc_reg_cfg_init: 2252 * @dp_tx_compute_hw_delay: 2253 * @print_mlo_ast_stats: 2254 * @dp_partner_chips_map: 2255 * @dp_partner_chips_unmap: 2256 * @ipa_get_bank_id: Get TCL bank id used by IPA 2257 * @ipa_get_wdi_ver: Get WDI version 2258 * @dp_txrx_ppeds_rings_status: 2259 * @dp_tx_ppeds_inuse_desc: 2260 * @dp_ppeds_clear_stats: Clear ppeds related stats 2261 * @dp_tx_ppeds_cfg_astidx_cache_mapping: 2262 * @dp_txrx_ppeds_rings_stats: Printing the util stats of ring 2263 * @dp_txrx_ppeds_clear_rings_stats: Clearing the ring util stats 2264 * @txrx_soc_ppeds_start: 2265 * @txrx_soc_ppeds_stop: 2266 * @dp_register_ppeds_interrupts: 2267 * @dp_free_ppeds_interrupts: 2268 * @dp_rx_wbm_err_reap_desc: Reap WBM Error Ring Descriptor 2269 * @dp_rx_null_q_desc_handle: Handle Null Queue Exception Error 2270 * @dp_tx_desc_pool_alloc: Allocate arch specific TX descriptor pool 2271 * @dp_tx_desc_pool_free: Free arch specific TX descriptor pool 2272 * @txrx_srng_init: Init txrx srng 2273 * @dp_get_vdev_stats_for_unmap_peer: Get vdev stats pointer for unmap peer 2274 * @dp_get_interface_stats: Get interface stats 2275 * @ppeds_handle_attached: 2276 * @txrx_soc_ppeds_interrupt_stop: 2277 * @txrx_soc_ppeds_interrupt_start: 2278 * @txrx_soc_ppeds_service_status_update: 2279 * @txrx_soc_ppeds_enabled_check: 2280 * @txrx_soc_ppeds_txdesc_pool_reset: 2281 * @dp_update_ring_hptp: Update rings hptp during suspend/resume 2282 * @dp_get_fst_cmem_base: Get CMEM base address for FISA 2283 * @dp_flush_tx_ring: Flush TCL ring HP 2284 * @dp_mlo_print_ptnr_info: print partner vdev info 2285 * @dp_soc_interrupt_attach: DP interrupt attach 2286 * @dp_soc_attach_poll: DP poll attach 2287 * @dp_soc_interrupt_detach: DP interrupt detach 2288 * @dp_service_srngs: Service DP interrupts 2289 */ 2290 struct dp_arch_ops { 2291 /* INIT/DEINIT Arch Ops */ 2292 QDF_STATUS (*txrx_soc_attach)(struct dp_soc *soc, 2293 struct cdp_soc_attach_params *params); 2294 QDF_STATUS (*txrx_soc_detach)(struct dp_soc *soc); 2295 void* (*txrx_soc_init)(struct dp_soc *soc, HTC_HANDLE htc_handle, 2296 struct hif_opaque_softc *hif_handle); 2297 QDF_STATUS (*txrx_soc_deinit)(struct dp_soc *soc); 2298 QDF_STATUS (*txrx_soc_srng_alloc)(struct dp_soc *soc); 2299 QDF_STATUS (*txrx_soc_srng_init)(struct dp_soc *soc); 2300 void (*txrx_soc_srng_deinit)(struct dp_soc *soc); 2301 void (*txrx_soc_srng_free)(struct dp_soc *soc); 2302 QDF_STATUS (*txrx_pdev_attach)(struct dp_pdev *pdev, 2303 struct cdp_pdev_attach_params *params); 2304 QDF_STATUS (*txrx_pdev_detach)(struct dp_pdev *pdev); 2305 QDF_STATUS (*txrx_vdev_attach)(struct dp_soc *soc, 2306 struct dp_vdev *vdev); 2307 QDF_STATUS (*txrx_vdev_detach)(struct dp_soc *soc, 2308 struct dp_vdev *vdev); 2309 QDF_STATUS (*txrx_peer_map_attach)(struct dp_soc *soc); 2310 void (*txrx_peer_map_detach)(struct dp_soc *soc); 2311 QDF_STATUS (*dp_rxdma_ring_sel_cfg)(struct dp_soc *soc); 2312 void (*soc_cfg_attach)(struct dp_soc *soc); 2313 QDF_STATUS (*txrx_peer_setup)(struct cdp_soc_t *soc_hdl, 2314 uint8_t vdev_id, uint8_t *peer_mac, 2315 struct cdp_peer_setup_info *setup_info); 2316 void (*peer_get_reo_hash)(struct dp_vdev *vdev, 2317 struct cdp_peer_setup_info *setup_info, 2318 enum cdp_host_reo_dest_ring *reo_dest, 2319 bool *hash_based, 2320 uint8_t *lmac_peer_id_msb); 2321 bool (*reo_remap_config)(struct dp_soc *soc, uint32_t *remap0, 2322 uint32_t *remap1, uint32_t *remap2); 2323 2324 /* TX RX Arch Ops */ 2325 QDF_STATUS (*tx_hw_enqueue)(struct dp_soc *soc, struct dp_vdev *vdev, 2326 struct dp_tx_desc_s *tx_desc, 2327 uint16_t fw_metadata, 2328 struct cdp_tx_exception_metadata *metadata, 2329 struct dp_tx_msdu_info_s *msdu_info); 2330 2331 QDF_STATUS (*tx_comp_get_params_from_hal_desc)( 2332 struct dp_soc *soc, void *tx_comp_hal_desc, 2333 struct dp_tx_desc_s **desc); 2334 2335 qdf_nbuf_t (*dp_tx_mlo_mcast_send)(struct dp_soc *soc, 2336 struct dp_vdev *vdev, 2337 qdf_nbuf_t nbuf, 2338 struct cdp_tx_exception_metadata 2339 *tx_exc_metadata); 2340 2341 void (*dp_tx_process_htt_completion)(struct dp_soc *soc, 2342 struct dp_tx_desc_s *tx_desc, 2343 uint8_t *status, 2344 uint8_t ring_id); 2345 2346 uint32_t (*dp_rx_process)(struct dp_intr *int_ctx, 2347 hal_ring_handle_t hal_ring_hdl, 2348 uint8_t reo_ring_num, uint32_t quota); 2349 2350 qdf_nbuf_t (*dp_tx_send_fast)(struct cdp_soc_t *soc_hdl, 2351 uint8_t vdev_id, 2352 qdf_nbuf_t nbuf); 2353 2354 QDF_STATUS (*dp_tx_desc_pool_init)(struct dp_soc *soc, 2355 uint32_t num_elem, 2356 uint8_t pool_id, 2357 bool spcl_tx_desc); 2358 void (*dp_tx_desc_pool_deinit)( 2359 struct dp_soc *soc, 2360 struct dp_tx_desc_pool_s *tx_desc_pool, 2361 uint8_t pool_id, 2362 bool spcl_tx_desc); 2363 2364 QDF_STATUS (*dp_rx_desc_pool_init)(struct dp_soc *soc, 2365 struct rx_desc_pool *rx_desc_pool, 2366 uint32_t pool_id); 2367 void (*dp_rx_desc_pool_deinit)(struct dp_soc *soc, 2368 struct rx_desc_pool *rx_desc_pool, 2369 uint32_t pool_id); 2370 2371 QDF_STATUS (*dp_wbm_get_rx_desc_from_hal_desc)( 2372 struct dp_soc *soc, 2373 void *ring_desc, 2374 struct dp_rx_desc **r_rx_desc); 2375 2376 bool 2377 (*dp_rx_intrabss_mcast_handler)(struct dp_soc *soc, 2378 struct dp_txrx_peer *ta_txrx_peer, 2379 qdf_nbuf_t nbuf_copy, 2380 struct cdp_tid_rx_stats *tid_stats, 2381 uint8_t link_id); 2382 2383 void (*dp_rx_word_mask_subscribe)( 2384 struct dp_soc *soc, 2385 uint32_t *msg_word, 2386 void *rx_filter); 2387 2388 struct dp_rx_desc *(*dp_rx_desc_cookie_2_va)(struct dp_soc *soc, 2389 uint32_t cookie); 2390 uint32_t (*dp_service_near_full_srngs)(struct dp_soc *soc, 2391 struct dp_intr *int_ctx, 2392 uint32_t dp_budget); 2393 void (*tx_implicit_rbm_set)(struct dp_soc *soc, uint8_t tx_ring_id, 2394 uint8_t bm_id); 2395 uint16_t (*dp_rx_peer_metadata_peer_id_get)(struct dp_soc *soc, 2396 uint32_t peer_metadata); 2397 bool (*dp_rx_chain_msdus)(struct dp_soc *soc, qdf_nbuf_t nbuf, 2398 uint8_t *rx_tlv_hdr, uint8_t mac_id); 2399 /* Control Arch Ops */ 2400 QDF_STATUS (*txrx_set_vdev_param)(struct dp_soc *soc, 2401 struct dp_vdev *vdev, 2402 enum cdp_vdev_param_type param, 2403 cdp_config_param_type val); 2404 2405 QDF_STATUS (*txrx_get_vdev_mcast_param)(struct dp_soc *soc, 2406 struct dp_vdev *vdev, 2407 cdp_config_param_type *val); 2408 2409 /* Misc Arch Ops */ 2410 qdf_size_t (*txrx_get_context_size)(enum dp_context_type); 2411 #ifdef WIFI_MONITOR_SUPPORT 2412 qdf_size_t (*txrx_get_mon_context_size)(enum dp_context_type); 2413 #endif 2414 int (*dp_srng_test_and_update_nf_params)(struct dp_soc *soc, 2415 struct dp_srng *dp_srng, 2416 int *max_reap_limit); 2417 2418 /* MLO ops */ 2419 #ifdef WLAN_FEATURE_11BE_MLO 2420 #ifdef WLAN_MCAST_MLO 2421 void (*dp_tx_mcast_handler)(struct dp_soc *soc, struct dp_vdev *vdev, 2422 qdf_nbuf_t nbuf); 2423 bool (*dp_rx_mcast_handler)(struct dp_soc *soc, struct dp_vdev *vdev, 2424 struct dp_txrx_peer *peer, qdf_nbuf_t nbuf, 2425 uint8_t link_id); 2426 bool (*dp_tx_is_mcast_primary)(struct dp_soc *soc, 2427 struct dp_vdev *vdev); 2428 #endif 2429 struct dp_soc * (*dp_soc_get_by_idle_bm_id)(struct dp_soc *soc, 2430 uint8_t bm_id); 2431 2432 void (*mlo_peer_find_hash_detach)(struct dp_soc *soc); 2433 QDF_STATUS (*mlo_peer_find_hash_attach)(struct dp_soc *soc); 2434 void (*mlo_peer_find_hash_add)(struct dp_soc *soc, 2435 struct dp_peer *peer); 2436 void (*mlo_peer_find_hash_remove)(struct dp_soc *soc, 2437 struct dp_peer *peer); 2438 2439 struct dp_peer *(*mlo_peer_find_hash_find)(struct dp_soc *soc, 2440 uint8_t *peer_mac_addr, 2441 int mac_addr_is_aligned, 2442 enum dp_mod_id mod_id, 2443 uint8_t vdev_id); 2444 #ifdef WLAN_MLO_MULTI_CHIP 2445 uint8_t (*mlo_get_chip_id)(struct dp_soc *soc); 2446 struct dp_peer *(*mlo_link_peer_find_hash_find_by_chip_id) 2447 (struct dp_soc *soc, 2448 uint8_t *peer_mac_addr, 2449 int mac_addr_is_aligned, 2450 uint8_t vdev_id, 2451 uint8_t chip_id, 2452 enum dp_mod_id mod_id); 2453 #endif 2454 #endif 2455 uint8_t (*get_hw_link_id)(struct dp_pdev *pdev); 2456 void (*dp_rx_peer_set_link_id)(qdf_nbuf_t nbuf, uint32_t peer_mdata); 2457 uint64_t (*get_reo_qdesc_addr)(hal_soc_handle_t hal_soc_hdl, 2458 uint8_t *dst_ring_desc, 2459 uint8_t *buf, 2460 struct dp_txrx_peer *peer, 2461 unsigned int tid); 2462 void (*get_rx_hash_key)(struct dp_soc *soc, 2463 struct cdp_lro_hash_config *lro_hash); 2464 void (*dp_set_rx_fst)(struct dp_rx_fst *fst); 2465 struct dp_rx_fst *(*dp_get_rx_fst)(void); 2466 uint32_t (*dp_rx_fst_deref)(void); 2467 void (*dp_rx_fst_ref)(void); 2468 void (*txrx_print_peer_stats)(struct cdp_peer_stats *peer_stats, 2469 enum peer_stats_type stats_type); 2470 QDF_STATUS (*dp_peer_rx_reorder_queue_setup)(struct dp_soc *soc, 2471 struct dp_peer *peer, 2472 int tid, 2473 uint32_t ba_window_size); 2474 void (*dp_bank_reconfig)(struct dp_soc *soc, struct dp_vdev *vdev); 2475 2476 struct dp_soc * (*dp_get_soc_by_chip_id)(struct dp_soc *soc, 2477 uint8_t chip_id); 2478 2479 uint8_t (*dp_soc_get_num_soc)(struct dp_soc *soc); 2480 void (*dp_reconfig_tx_vdev_mcast_ctrl)(struct dp_soc *soc, 2481 struct dp_vdev *vdev); 2482 2483 void (*dp_cc_reg_cfg_init)(struct dp_soc *soc, bool is_4k_align); 2484 2485 QDF_STATUS 2486 (*dp_tx_compute_hw_delay)(struct dp_soc *soc, 2487 struct dp_vdev *vdev, 2488 struct hal_tx_completion_status *ts, 2489 uint32_t *delay_us); 2490 void (*print_mlo_ast_stats)(struct dp_soc *soc); 2491 void (*dp_partner_chips_map)(struct dp_soc *soc, 2492 struct dp_peer *peer, 2493 uint16_t peer_id); 2494 void (*dp_partner_chips_unmap)(struct dp_soc *soc, 2495 uint16_t peer_id); 2496 2497 #ifdef IPA_OFFLOAD 2498 int8_t (*ipa_get_bank_id)(struct dp_soc *soc); 2499 void (*ipa_get_wdi_ver)(uint8_t *wdi_ver); 2500 #endif 2501 #ifdef WLAN_SUPPORT_PPEDS 2502 void (*dp_txrx_ppeds_rings_status)(struct dp_soc *soc); 2503 void (*dp_tx_ppeds_inuse_desc)(struct dp_soc *soc); 2504 void (*dp_ppeds_clear_stats)(struct dp_soc *soc); 2505 void (*dp_tx_ppeds_cfg_astidx_cache_mapping)(struct dp_soc *soc, 2506 struct dp_vdev *vdev, 2507 bool peer_map); 2508 void (*dp_txrx_ppeds_rings_stats)(struct dp_soc *soc); 2509 void (*dp_txrx_ppeds_clear_rings_stats)(struct dp_soc *soc); 2510 #endif 2511 bool (*ppeds_handle_attached)(struct dp_soc *soc); 2512 QDF_STATUS (*txrx_soc_ppeds_start)(struct dp_soc *soc); 2513 void (*txrx_soc_ppeds_stop)(struct dp_soc *soc); 2514 int (*dp_register_ppeds_interrupts)(struct dp_soc *soc, 2515 struct dp_srng *srng, int vector, 2516 int ring_type, int ring_num); 2517 void (*dp_free_ppeds_interrupts)(struct dp_soc *soc, 2518 struct dp_srng *srng, int ring_type, 2519 int ring_num); 2520 qdf_nbuf_t (*dp_rx_wbm_err_reap_desc)(struct dp_intr *int_ctx, 2521 struct dp_soc *soc, 2522 hal_ring_handle_t hal_ring_hdl, 2523 uint32_t quota, 2524 uint32_t *rx_bufs_used); 2525 QDF_STATUS (*dp_rx_null_q_desc_handle)(struct dp_soc *soc, 2526 qdf_nbuf_t nbuf, 2527 uint8_t *rx_tlv_hdr, 2528 uint8_t pool_id, 2529 struct dp_txrx_peer *txrx_peer, 2530 bool is_reo_exception, 2531 uint8_t link_id); 2532 2533 QDF_STATUS (*dp_tx_desc_pool_alloc)(struct dp_soc *soc, 2534 uint32_t num_elem, 2535 uint8_t pool_id); 2536 void (*dp_tx_desc_pool_free)(struct dp_soc *soc, uint8_t pool_id); 2537 2538 QDF_STATUS (*txrx_srng_init)(struct dp_soc *soc, struct dp_srng *srng, 2539 int ring_type, int ring_num, int mac_id); 2540 2541 void (*dp_get_vdev_stats_for_unmap_peer)( 2542 struct dp_vdev *vdev, 2543 struct dp_peer *peer); 2544 QDF_STATUS (*dp_get_interface_stats)(struct cdp_soc_t *soc_hdl, 2545 uint8_t vdev_id, 2546 void *buf, 2547 bool is_aggregate); 2548 #ifdef WLAN_SUPPORT_PPEDS 2549 void (*txrx_soc_ppeds_interrupt_stop)(struct dp_soc *soc); 2550 void (*txrx_soc_ppeds_interrupt_start)(struct dp_soc *soc); 2551 void (*txrx_soc_ppeds_service_status_update)(struct dp_soc *soc, 2552 bool enable); 2553 bool (*txrx_soc_ppeds_enabled_check)(struct dp_soc *soc); 2554 void (*txrx_soc_ppeds_txdesc_pool_reset)(struct dp_soc *soc, 2555 qdf_nbuf_t *nbuf_list); 2556 #endif 2557 void (*dp_update_ring_hptp)(struct dp_soc *soc, bool force_flush_tx); 2558 uint64_t (*dp_get_fst_cmem_base)(struct dp_soc *soc, uint64_t size); 2559 int (*dp_flush_tx_ring)(struct dp_pdev *pdev, int ring_id); 2560 void (*dp_mlo_print_ptnr_info)(struct dp_vdev *vdev); 2561 QDF_STATUS (*dp_soc_interrupt_attach)(struct cdp_soc_t *txrx_soc); 2562 QDF_STATUS (*dp_soc_attach_poll)(struct cdp_soc_t *txrx_soc); 2563 void (*dp_soc_interrupt_detach)(struct cdp_soc_t *txrx_soc); 2564 uint32_t (*dp_service_srngs)(void *dp_ctx, uint32_t dp_budget, int cpu); 2565 }; 2566 2567 /** 2568 * struct dp_soc_features: Data structure holding the SOC level feature flags. 2569 * @pn_in_reo_dest: PN provided by hardware in the REO destination ring. 2570 * @dmac_cmn_src_rxbuf_ring_enabled: Flag to indicate DMAC mode common Rx 2571 * buffer source rings 2572 * @rssi_dbm_conv_support: Rssi dbm conversion support param. 2573 * @umac_hw_reset_support: UMAC HW reset support 2574 * @wds_ext_ast_override_enable: 2575 */ 2576 struct dp_soc_features { 2577 uint8_t pn_in_reo_dest:1, 2578 dmac_cmn_src_rxbuf_ring_enabled:1; 2579 bool rssi_dbm_conv_support; 2580 bool umac_hw_reset_support; 2581 bool wds_ext_ast_override_enable; 2582 }; 2583 2584 enum sysfs_printing_mode { 2585 PRINTING_MODE_DISABLED = 0, 2586 PRINTING_MODE_ENABLED 2587 }; 2588 2589 /** 2590 * typedef notify_pre_reset_fw_callback() - pre-reset callback 2591 * @soc: DP SoC 2592 */ 2593 typedef void (*notify_pre_reset_fw_callback)(struct dp_soc *soc); 2594 2595 #ifdef WLAN_SYSFS_DP_STATS 2596 /** 2597 * struct sysfs_stats_config: Data structure holding stats sysfs config. 2598 * @rw_stats_lock: Lock to read and write to stat_type and pdev_id. 2599 * @sysfs_read_lock: Lock held while another stat req is being executed. 2600 * @sysfs_write_user_buffer: Lock to change buff len, max buf len 2601 * and *buf. 2602 * @sysfs_txrx_fw_request_done: Event to wait for firmware response. 2603 * @stat_type_requested: stat type requested. 2604 * @mac_id: mac id for which stat type are requested. 2605 * @printing_mode: Should a print go through. 2606 * @process_id: Process allowed to write to buffer. 2607 * @curr_buffer_length: Curr length of buffer written 2608 * @max_buffer_length: Max buffer length. 2609 * @buf: Sysfs buffer. 2610 */ 2611 struct sysfs_stats_config { 2612 /* lock held to read stats */ 2613 qdf_spinlock_t rw_stats_lock; 2614 qdf_mutex_t sysfs_read_lock; 2615 qdf_spinlock_t sysfs_write_user_buffer; 2616 qdf_event_t sysfs_txrx_fw_request_done; 2617 uint32_t stat_type_requested; 2618 uint32_t mac_id; 2619 enum sysfs_printing_mode printing_mode; 2620 int process_id; 2621 uint16_t curr_buffer_length; 2622 uint16_t max_buffer_length; 2623 char *buf; 2624 }; 2625 #endif 2626 2627 struct test_mem_free { 2628 unsigned long ts_qdesc_mem_hdl; 2629 qdf_dma_addr_t hw_qdesc_paddr; 2630 void *hw_qdesc_vaddr_align; 2631 void *hw_qdesc_vaddr_unalign; 2632 uint32_t peer_id; 2633 uint32_t tid; 2634 uint8_t chip_id; 2635 unsigned long ts_hw_flush_back; 2636 }; 2637 2638 struct test_qaddr_del { 2639 unsigned long ts_qaddr_del; 2640 uint32_t peer_id; 2641 uint32_t paddr; 2642 uint32_t tid; 2643 uint8_t chip_id; 2644 }; 2645 2646 /* SOC level structure for data path */ 2647 struct dp_soc { 2648 /** 2649 * re-use memory section starts 2650 */ 2651 2652 /* Common base structure - Should be the first member */ 2653 struct cdp_soc_t cdp_soc; 2654 2655 /* SoC Obj */ 2656 struct cdp_ctrl_objmgr_psoc *ctrl_psoc; 2657 2658 /* OS device abstraction */ 2659 qdf_device_t osdev; 2660 2661 /*cce disable*/ 2662 bool cce_disable; 2663 2664 /* WLAN config context */ 2665 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx; 2666 2667 /* HTT handle for host-fw interaction */ 2668 struct htt_soc *htt_handle; 2669 2670 /* Commint init done */ 2671 qdf_atomic_t cmn_init_done; 2672 2673 /* Opaque hif handle */ 2674 struct hif_opaque_softc *hif_handle; 2675 2676 /* PDEVs on this SOC */ 2677 struct dp_pdev *pdev_list[MAX_PDEV_CNT]; 2678 2679 /* Ring used to replenish rx buffers (maybe to the firmware of MAC) */ 2680 struct dp_srng rx_refill_buf_ring[MAX_PDEV_CNT]; 2681 2682 struct dp_srng rxdma_mon_desc_ring[MAX_NUM_LMAC_HW]; 2683 2684 /* RXDMA error destination ring */ 2685 struct dp_srng rxdma_err_dst_ring[MAX_NUM_LMAC_HW]; 2686 2687 /* RXDMA monitor buffer replenish ring */ 2688 struct dp_srng rxdma_mon_buf_ring[MAX_NUM_LMAC_HW]; 2689 2690 /* RXDMA monitor destination ring */ 2691 struct dp_srng rxdma_mon_dst_ring[MAX_NUM_LMAC_HW]; 2692 2693 /* RXDMA monitor status ring. TBD: Check format of this ring */ 2694 struct dp_srng rxdma_mon_status_ring[MAX_NUM_LMAC_HW]; 2695 2696 /* Ring to handover links to hw in monitor mode for SOFTUMAC arch */ 2697 struct dp_srng sw2rxdma_link_ring[MAX_NUM_LMAC_HW]; 2698 2699 /* Number of PDEVs */ 2700 uint8_t pdev_count; 2701 2702 /*ast override support in HW*/ 2703 bool ast_override_support; 2704 2705 /*number of hw dscp tid map*/ 2706 uint8_t num_hw_dscp_tid_map; 2707 2708 /* HAL SOC handle */ 2709 hal_soc_handle_t hal_soc; 2710 2711 /* rx monitor pkt tlv size */ 2712 uint16_t rx_mon_pkt_tlv_size; 2713 /* rx pkt tlv size */ 2714 uint16_t rx_pkt_tlv_size; 2715 /* rx pkt tlv size in current operation mode */ 2716 uint16_t curr_rx_pkt_tlv_size; 2717 2718 /* enable/disable dp debug logs */ 2719 bool dp_debug_log_en; 2720 2721 struct dp_arch_ops arch_ops; 2722 2723 /* Device ID coming from Bus sub-system */ 2724 uint32_t device_id; 2725 2726 /* Link descriptor pages */ 2727 struct qdf_mem_multi_page_t link_desc_pages; 2728 2729 /* total link descriptors for regular RX and TX */ 2730 uint32_t total_link_descs; 2731 2732 /* Link descriptor Idle list for HW internal use (SRNG mode) */ 2733 struct dp_srng wbm_idle_link_ring; 2734 2735 /* Link descriptor Idle list for HW internal use (scatter buffer mode) 2736 */ 2737 qdf_dma_addr_t wbm_idle_scatter_buf_base_paddr[MAX_IDLE_SCATTER_BUFS]; 2738 void *wbm_idle_scatter_buf_base_vaddr[MAX_IDLE_SCATTER_BUFS]; 2739 uint32_t num_scatter_bufs; 2740 2741 /* Tx SW descriptor pool */ 2742 struct dp_tx_desc_pool_s tx_desc[MAX_TXDESC_POOLS]; 2743 2744 /* Tx MSDU Extension descriptor pool */ 2745 struct dp_tx_ext_desc_pool_s tx_ext_desc[MAX_TXDESC_POOLS]; 2746 2747 /* Tx TSO descriptor pool */ 2748 struct dp_tx_tso_seg_pool_s tx_tso_desc[MAX_TXDESC_POOLS]; 2749 2750 /* Tx TSO Num of segments pool */ 2751 struct dp_tx_tso_num_seg_pool_s tx_tso_num_seg[MAX_TXDESC_POOLS]; 2752 2753 /* REO destination rings */ 2754 struct dp_srng reo_dest_ring[MAX_REO_DEST_RINGS]; 2755 2756 /* REO exception ring - See if should combine this with reo_dest_ring */ 2757 struct dp_srng reo_exception_ring; 2758 2759 /* REO reinjection ring */ 2760 struct dp_srng reo_reinject_ring; 2761 2762 /* REO command ring */ 2763 struct dp_srng reo_cmd_ring; 2764 2765 /* REO command status ring */ 2766 struct dp_srng reo_status_ring; 2767 2768 /* WBM Rx release ring */ 2769 struct dp_srng rx_rel_ring; 2770 2771 /* TCL data ring */ 2772 struct dp_srng tcl_data_ring[MAX_TCL_DATA_RINGS]; 2773 2774 /* Number of Tx comp rings */ 2775 uint8_t num_tx_comp_rings; 2776 2777 /* Number of TCL data rings */ 2778 uint8_t num_tcl_data_rings; 2779 2780 /* TCL CMD_CREDIT ring */ 2781 bool init_tcl_cmd_cred_ring; 2782 2783 /* It is used as credit based ring on QCN9000 else command ring */ 2784 struct dp_srng tcl_cmd_credit_ring; 2785 2786 /* TCL command status ring */ 2787 struct dp_srng tcl_status_ring; 2788 2789 /* WBM Tx completion rings */ 2790 struct dp_srng tx_comp_ring[MAX_TCL_DATA_RINGS]; 2791 2792 /* Common WBM link descriptor release ring (SW to WBM) */ 2793 struct dp_srng wbm_desc_rel_ring; 2794 2795 /* DP Interrupts */ 2796 struct dp_intr intr_ctx[WLAN_CFG_INT_NUM_CONTEXTS]; 2797 2798 /* Monitor mode mac id to dp_intr_id map */ 2799 int mon_intr_id_lmac_map[MAX_NUM_LMAC_HW]; 2800 /* Rx SW descriptor pool for RXDMA monitor buffer */ 2801 struct rx_desc_pool rx_desc_mon[MAX_RXDESC_POOLS]; 2802 2803 /* Rx SW descriptor pool for RXDMA status buffer */ 2804 struct rx_desc_pool rx_desc_status[MAX_RXDESC_POOLS]; 2805 2806 /* Rx SW descriptor pool for RXDMA buffer */ 2807 struct rx_desc_pool rx_desc_buf[MAX_RXDESC_POOLS]; 2808 2809 /* Number of REO destination rings */ 2810 uint8_t num_reo_dest_rings; 2811 2812 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 2813 /* lock to control access to soc TX descriptors */ 2814 qdf_spinlock_t flow_pool_array_lock; 2815 2816 /* pause callback to pause TX queues as per flow control */ 2817 tx_pause_callback pause_cb; 2818 2819 /* flow pool related statistics */ 2820 struct dp_txrx_pool_stats pool_stats; 2821 #endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */ 2822 2823 notify_pre_reset_fw_callback notify_fw_callback; 2824 2825 unsigned long service_rings_running; 2826 2827 uint32_t wbm_idle_scatter_buf_size; 2828 2829 /* VDEVs on this SOC */ 2830 struct dp_vdev *vdev_id_map[MAX_VDEV_CNT]; 2831 2832 uint8_t hw_txrx_stats_en:1; 2833 2834 /* Tx H/W queues lock */ 2835 qdf_spinlock_t tx_queue_lock[MAX_TX_HW_QUEUES]; 2836 2837 /* Tx ring map for interrupt processing */ 2838 uint8_t tx_ring_map[WLAN_CFG_INT_NUM_CONTEXTS]; 2839 2840 /* Rx ring map for interrupt processing */ 2841 uint8_t rx_ring_map[WLAN_CFG_INT_NUM_CONTEXTS]; 2842 2843 /* peer ID to peer object map (array of pointers to peer objects) */ 2844 struct dp_peer **peer_id_to_obj_map; 2845 2846 struct { 2847 unsigned mask; 2848 unsigned idx_bits; 2849 TAILQ_HEAD(, dp_peer) * bins; 2850 } peer_hash; 2851 2852 /* rx defrag state – TBD: do we need this per radio? */ 2853 struct { 2854 struct { 2855 TAILQ_HEAD(, dp_rx_tid_defrag) waitlist; 2856 uint32_t timeout_ms; 2857 uint32_t next_flush_ms; 2858 qdf_spinlock_t defrag_lock; 2859 } defrag; 2860 struct { 2861 int defrag_timeout_check; 2862 int dup_check; 2863 } flags; 2864 TAILQ_HEAD(, dp_reo_cmd_info) reo_cmd_list; 2865 qdf_spinlock_t reo_cmd_lock; 2866 } rx; 2867 2868 /* optional rx processing function */ 2869 void (*rx_opt_proc)( 2870 struct dp_vdev *vdev, 2871 struct dp_peer *peer, 2872 unsigned tid, 2873 qdf_nbuf_t msdu_list); 2874 2875 /* pool addr for mcast enhance buff */ 2876 struct { 2877 int size; 2878 uint32_t paddr; 2879 uint32_t *vaddr; 2880 struct dp_tx_me_buf_t *freelist; 2881 int buf_in_use; 2882 qdf_dma_mem_context(memctx); 2883 } me_buf; 2884 2885 /* Protect peer hash table */ 2886 DP_MUTEX_TYPE peer_hash_lock; 2887 /* Protect peer_id_to_objmap */ 2888 DP_MUTEX_TYPE peer_map_lock; 2889 2890 /* maximum number of suppoerted peers */ 2891 uint32_t max_peers; 2892 /* maximum value for peer_id */ 2893 uint32_t max_peer_id; 2894 2895 #ifdef DP_USE_REDUCED_PEER_ID_FIELD_WIDTH 2896 uint32_t peer_id_shift; 2897 uint32_t peer_id_mask; 2898 #endif 2899 2900 /* rx peer metadata field shift and mask configuration */ 2901 uint8_t htt_peer_id_s; 2902 uint32_t htt_peer_id_m; 2903 uint8_t htt_vdev_id_s; 2904 uint32_t htt_vdev_id_m; 2905 uint8_t htt_mld_peer_valid_s; 2906 uint32_t htt_mld_peer_valid_m; 2907 /* rx peer metadata version */ 2908 uint8_t rx_peer_metadata_ver; 2909 2910 /* SoC level data path statistics */ 2911 struct dp_soc_stats stats; 2912 #ifdef WLAN_SYSFS_DP_STATS 2913 /* sysfs config for DP stats */ 2914 struct sysfs_stats_config *sysfs_config; 2915 #endif 2916 /* timestamp to keep track of msdu buffers received on reo err ring */ 2917 uint64_t rx_route_err_start_pkt_ts; 2918 2919 /* Num RX Route err in a given window to keep track of rate of errors */ 2920 uint32_t rx_route_err_in_window; 2921 2922 /* Enable processing of Tx completion status words */ 2923 bool process_tx_status; 2924 bool process_rx_status; 2925 struct dp_ast_entry **ast_table; 2926 struct { 2927 unsigned mask; 2928 unsigned idx_bits; 2929 TAILQ_HEAD(, dp_ast_entry) * bins; 2930 } ast_hash; 2931 2932 #ifdef DP_TX_HW_DESC_HISTORY 2933 struct dp_tx_hw_desc_history tx_hw_desc_history; 2934 #endif 2935 2936 #ifdef WLAN_FEATURE_DP_RX_RING_HISTORY 2937 struct dp_rx_history *rx_ring_history[MAX_REO_DEST_RINGS]; 2938 struct dp_rx_refill_history *rx_refill_ring_history[MAX_PDEV_CNT]; 2939 struct dp_rx_err_history *rx_err_ring_history; 2940 struct dp_rx_reinject_history *rx_reinject_ring_history; 2941 #endif 2942 2943 #ifdef WLAN_FEATURE_DP_MON_STATUS_RING_HISTORY 2944 struct dp_mon_status_ring_history *mon_status_ring_history; 2945 #endif 2946 2947 #ifdef WLAN_FEATURE_DP_TX_DESC_HISTORY 2948 struct dp_tx_tcl_history tx_tcl_history; 2949 struct dp_tx_comp_history tx_comp_history; 2950 #endif 2951 2952 #ifdef WLAN_FEATURE_DP_CFG_EVENT_HISTORY 2953 struct dp_cfg_event_history cfg_event_history; 2954 #endif 2955 2956 qdf_spinlock_t ast_lock; 2957 /*Timer for AST entry ageout maintenance */ 2958 qdf_timer_t ast_aging_timer; 2959 2960 /*Timer counter for WDS AST entry ageout*/ 2961 uint8_t wds_ast_aging_timer_cnt; 2962 bool pending_ageout; 2963 bool ast_offload_support; 2964 bool host_ast_db_enable; 2965 uint32_t max_ast_ageout_count; 2966 uint8_t eapol_over_control_port; 2967 2968 uint8_t sta_mode_search_policy; 2969 qdf_timer_t lmac_reap_timer; 2970 uint8_t lmac_timer_init; 2971 qdf_timer_t int_timer; 2972 uint8_t intr_mode; 2973 uint8_t lmac_polled_mode; 2974 2975 qdf_list_t reo_desc_freelist; 2976 qdf_spinlock_t reo_desc_freelist_lock; 2977 2978 /* htt stats */ 2979 struct htt_t2h_stats htt_stats; 2980 2981 void *external_txrx_handle; /* External data path handle */ 2982 qdf_atomic_t ipa_map_allowed; 2983 #ifdef IPA_OFFLOAD 2984 struct ipa_dp_tx_rsc ipa_uc_tx_rsc; 2985 #ifdef IPA_WDI3_TX_TWO_PIPES 2986 /* Resources for the alternative IPA TX pipe */ 2987 struct ipa_dp_tx_rsc ipa_uc_tx_rsc_alt; 2988 #endif 2989 2990 struct ipa_dp_rx_rsc ipa_uc_rx_rsc; 2991 #ifdef IPA_WDI3_VLAN_SUPPORT 2992 struct ipa_dp_rx_rsc ipa_uc_rx_rsc_alt; 2993 #endif 2994 qdf_atomic_t ipa_pipes_enabled; 2995 bool ipa_first_tx_db_access; 2996 qdf_spinlock_t ipa_rx_buf_map_lock; 2997 bool ipa_rx_buf_map_lock_initialized; 2998 uint8_t ipa_reo_ctx_lock_required[MAX_REO_DEST_RINGS]; 2999 #endif 3000 3001 #ifdef WLAN_FEATURE_STATS_EXT 3002 struct { 3003 uint32_t rx_mpdu_received; 3004 uint32_t rx_mpdu_missed; 3005 } ext_stats; 3006 qdf_event_t rx_hw_stats_event; 3007 qdf_spinlock_t rx_hw_stats_lock; 3008 bool is_last_stats_ctx_init; 3009 struct dp_req_rx_hw_stats_t *rx_hw_stats; 3010 #endif /* WLAN_FEATURE_STATS_EXT */ 3011 3012 /* Indicates HTT map/unmap versions*/ 3013 uint8_t peer_map_unmap_versions; 3014 /* Per peer per Tid ba window size support */ 3015 uint8_t per_tid_basize_max_tid; 3016 /* Soc level flag to enable da_war */ 3017 uint8_t da_war_enabled; 3018 /* number of active ast entries */ 3019 uint32_t num_ast_entries; 3020 /* peer extended rate statistics context at soc level*/ 3021 struct cdp_soc_rate_stats_ctx *rate_stats_ctx; 3022 /* peer extended rate statistics control flag */ 3023 bool peerstats_enabled; 3024 3025 /* 8021p PCP-TID map values */ 3026 uint8_t pcp_tid_map[PCP_TID_MAP_MAX]; 3027 /* TID map priority value */ 3028 uint8_t tidmap_prty; 3029 /* Pointer to global per ring type specific configuration table */ 3030 struct wlan_srng_cfg *wlan_srng_cfg; 3031 /* Num Tx outstanding on device */ 3032 qdf_atomic_t num_tx_outstanding; 3033 /* Num Tx exception on device */ 3034 qdf_atomic_t num_tx_exception; 3035 /* Num Tx allowed */ 3036 uint32_t num_tx_allowed; 3037 /* Num Regular Tx allowed */ 3038 uint32_t num_reg_tx_allowed; 3039 /* Num Tx allowed for special frames*/ 3040 uint32_t num_tx_spl_allowed; 3041 /* Preferred HW mode */ 3042 uint8_t preferred_hw_mode; 3043 3044 /** 3045 * Flag to indicate whether WAR to address single cache entry 3046 * invalidation bug is enabled or not 3047 */ 3048 bool is_rx_fse_full_cache_invalidate_war_enabled; 3049 #if defined(WLAN_SUPPORT_RX_FLOW_TAG) 3050 /** 3051 * Pointer to DP RX Flow FST at SOC level if 3052 * is_rx_flow_search_table_per_pdev is false 3053 * TBD: rx_fst[num_macs] if we decide to have per mac FST 3054 */ 3055 struct dp_rx_fst *rx_fst; 3056 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ 3057 /* SG supported for msdu continued packets from wbm release ring */ 3058 bool wbm_release_desc_rx_sg_support; 3059 bool peer_map_attach_success; 3060 /* Flag to disable mac1 ring interrupts */ 3061 bool disable_mac1_intr; 3062 /* Flag to disable mac2 ring interrupts */ 3063 bool disable_mac2_intr; 3064 3065 struct { 3066 /* 1st msdu in sg for msdu continued packets in wbm rel ring */ 3067 bool wbm_is_first_msdu_in_sg; 3068 /* Wbm sg list head */ 3069 qdf_nbuf_t wbm_sg_nbuf_head; 3070 /* Wbm sg list tail */ 3071 qdf_nbuf_t wbm_sg_nbuf_tail; 3072 uint32_t wbm_sg_desc_msdu_len; 3073 } wbm_sg_param; 3074 /* Number of msdu exception descriptors */ 3075 uint32_t num_msdu_exception_desc; 3076 3077 /* RX buffer params */ 3078 struct rx_buff_pool rx_buff_pool[MAX_PDEV_CNT]; 3079 struct rx_refill_buff_pool rx_refill_buff_pool; 3080 /* Save recent operation related variable */ 3081 struct dp_last_op_info last_op_info; 3082 TAILQ_HEAD(, dp_peer) inactive_peer_list; 3083 qdf_spinlock_t inactive_peer_list_lock; 3084 TAILQ_HEAD(, dp_vdev) inactive_vdev_list; 3085 qdf_spinlock_t inactive_vdev_list_lock; 3086 /* lock to protect vdev_id_map table*/ 3087 qdf_spinlock_t vdev_map_lock; 3088 3089 /* Flow Search Table is in CMEM */ 3090 bool fst_in_cmem; 3091 3092 #ifdef WLAN_DP_FEATURE_SW_LATENCY_MGR 3093 struct dp_swlm swlm; 3094 #endif 3095 3096 #ifdef FEATURE_RUNTIME_PM 3097 /* DP Rx timestamp */ 3098 qdf_time_t rx_last_busy; 3099 /* Dp runtime refcount */ 3100 qdf_atomic_t dp_runtime_refcount; 3101 /* Dp tx pending count in RTPM */ 3102 qdf_atomic_t tx_pending_rtpm; 3103 #endif 3104 /* Invalid buffer that allocated for RX buffer */ 3105 qdf_nbuf_queue_t invalid_buf_queue; 3106 3107 #ifdef FEATURE_MEC 3108 /** @mec_lock: spinlock for MEC table */ 3109 qdf_spinlock_t mec_lock; 3110 /** @mec_cnt: number of active mec entries */ 3111 qdf_atomic_t mec_cnt; 3112 struct { 3113 /** @mask: mask bits */ 3114 uint32_t mask; 3115 /** @idx_bits: index to shift bits */ 3116 uint32_t idx_bits; 3117 /** @bins: MEC table */ 3118 TAILQ_HEAD(, dp_mec_entry) * bins; 3119 } mec_hash; 3120 #endif 3121 3122 #ifdef WLAN_DP_FEATURE_DEFERRED_REO_QDESC_DESTROY 3123 qdf_list_t reo_desc_deferred_freelist; 3124 qdf_spinlock_t reo_desc_deferred_freelist_lock; 3125 bool reo_desc_deferred_freelist_init; 3126 #endif 3127 /* BM id for first WBM2SW ring */ 3128 uint32_t wbm_sw0_bm_id; 3129 3130 /* Store arch_id from device_id */ 3131 uint16_t arch_id; 3132 3133 /* link desc ID start per device type */ 3134 uint32_t link_desc_id_start; 3135 3136 /* CMEM buffer target reserved for host usage */ 3137 uint64_t cmem_base; 3138 /* CMEM size in bytes */ 3139 uint64_t cmem_total_size; 3140 /* CMEM free size in bytes */ 3141 uint64_t cmem_avail_size; 3142 3143 /* SOC level feature flags */ 3144 struct dp_soc_features features; 3145 3146 #ifdef WIFI_MONITOR_SUPPORT 3147 struct dp_mon_soc *monitor_soc; 3148 #endif 3149 uint8_t rxdma2sw_rings_not_supported:1, 3150 wbm_sg_last_msdu_war:1, 3151 mec_fw_offload:1, 3152 multi_peer_grp_cmd_supported:1, 3153 umac_reset_supported:1; 3154 3155 /* Number of Rx refill rings */ 3156 uint8_t num_rx_refill_buf_rings; 3157 #ifdef FEATURE_RUNTIME_PM 3158 /* flag to indicate vote for runtime_pm for high tput castt*/ 3159 qdf_atomic_t rtpm_high_tput_flag; 3160 #endif 3161 /* Buffer manager ID for idle link descs */ 3162 uint8_t idle_link_bm_id; 3163 qdf_atomic_t ref_count; 3164 3165 unsigned long vdev_stats_id_map; 3166 bool txmon_hw_support; 3167 3168 #ifdef DP_UMAC_HW_RESET_SUPPORT 3169 struct dp_soc_umac_reset_ctx umac_reset_ctx; 3170 #endif 3171 /* PPDU to link_id mapping parameters */ 3172 uint8_t link_id_offset; 3173 uint8_t link_id_bits; 3174 #ifdef FEATURE_RX_LINKSPEED_ROAM_TRIGGER 3175 /* A flag using to decide the switch of rx link speed */ 3176 bool high_throughput; 3177 #endif 3178 bool is_tx_pause; 3179 3180 #ifdef WLAN_SUPPORT_RX_FLOW_TAG 3181 /* number of IPv4 flows inserted */ 3182 qdf_atomic_t ipv4_fse_cnt; 3183 /* number of IPv6 flows inserted */ 3184 qdf_atomic_t ipv6_fse_cnt; 3185 #endif 3186 /* Reo queue ref table items */ 3187 struct reo_queue_ref_table reo_qref; 3188 #ifdef DP_TX_PACKET_INSPECT_FOR_ILP 3189 /* Flag to show if TX ILP is enabled */ 3190 bool tx_ilp_enable; 3191 #endif 3192 #if defined(WLAN_FEATURE_11BE_MLO) && defined(WLAN_MLO_MULTI_CHIP) 3193 uint8_t mld_mode_ap; 3194 #endif 3195 struct test_qaddr_del *list_shared_qaddr_del; 3196 struct test_qaddr_del *reo_write_list; 3197 struct test_mem_free *list_qdesc_addr_free; 3198 struct test_mem_free *list_qdesc_addr_alloc; 3199 uint64_t free_addr_list_idx; 3200 uint64_t alloc_addr_list_idx; 3201 uint64_t shared_qaddr_del_idx; 3202 uint64_t write_paddr_list_idx; 3203 3204 #ifdef WLAN_FEATURE_TX_LATENCY_STATS 3205 /* callback function for tx latency stats */ 3206 cdp_tx_latency_cb tx_latency_cb; 3207 #endif 3208 3209 #ifdef DP_TX_COMP_RING_DESC_SANITY_CHECK 3210 struct { 3211 uint32_t detected; 3212 uint64_t start_time; 3213 } stale_entry[MAX_TCL_DATA_RINGS]; 3214 #endif 3215 }; 3216 3217 #ifdef IPA_OFFLOAD 3218 /** 3219 * struct dp_ipa_resources - Resources needed for IPA 3220 * @tx_ring: 3221 * @tx_num_alloc_buffer: 3222 * @tx_comp_ring: 3223 * @rx_rdy_ring: 3224 * @rx_refill_ring: 3225 * @tx_comp_doorbell_paddr: IPA UC doorbell registers paddr 3226 * @tx_comp_doorbell_vaddr: 3227 * @rx_ready_doorbell_paddr: 3228 * @is_db_ddr_mapped: 3229 * @tx_alt_ring: 3230 * @tx_alt_ring_num_alloc_buffer: 3231 * @tx_alt_comp_ring: 3232 * @tx_alt_comp_doorbell_paddr: IPA UC doorbell registers paddr 3233 * @tx_alt_comp_doorbell_vaddr: 3234 * @rx_alt_rdy_ring: 3235 * @rx_alt_refill_ring: 3236 * @rx_alt_ready_doorbell_paddr: 3237 */ 3238 struct dp_ipa_resources { 3239 qdf_shared_mem_t tx_ring; 3240 uint32_t tx_num_alloc_buffer; 3241 3242 qdf_shared_mem_t tx_comp_ring; 3243 qdf_shared_mem_t rx_rdy_ring; 3244 qdf_shared_mem_t rx_refill_ring; 3245 3246 /* IPA UC doorbell registers paddr */ 3247 qdf_dma_addr_t tx_comp_doorbell_paddr; 3248 uint32_t *tx_comp_doorbell_vaddr; 3249 qdf_dma_addr_t rx_ready_doorbell_paddr; 3250 3251 bool is_db_ddr_mapped; 3252 3253 #ifdef IPA_WDI3_TX_TWO_PIPES 3254 qdf_shared_mem_t tx_alt_ring; 3255 uint32_t tx_alt_ring_num_alloc_buffer; 3256 qdf_shared_mem_t tx_alt_comp_ring; 3257 3258 /* IPA UC doorbell registers paddr */ 3259 qdf_dma_addr_t tx_alt_comp_doorbell_paddr; 3260 uint32_t *tx_alt_comp_doorbell_vaddr; 3261 #endif 3262 #ifdef IPA_WDI3_VLAN_SUPPORT 3263 qdf_shared_mem_t rx_alt_rdy_ring; 3264 qdf_shared_mem_t rx_alt_refill_ring; 3265 qdf_dma_addr_t rx_alt_ready_doorbell_paddr; 3266 #endif 3267 }; 3268 #endif 3269 3270 #define MAX_RX_MAC_RINGS 2 3271 /* Same as NAC_MAX_CLENT */ 3272 #define DP_NAC_MAX_CLIENT 24 3273 3274 /* 3275 * 24 bits cookie size 3276 * 10 bits page id 0 ~ 1023 for MCL 3277 * 3 bits page id 0 ~ 7 for WIN 3278 * WBM Idle List Desc size = 128, 3279 * Num descs per page = 4096/128 = 32 for MCL 3280 * Num descs per page = 2MB/128 = 16384 for WIN 3281 */ 3282 /* 3283 * Macros to setup link descriptor cookies - for link descriptors, we just 3284 * need first 3 bits to store bank/page ID for WIN. The 3285 * remaining bytes will be used to set a unique ID, which will 3286 * be useful in debugging 3287 */ 3288 #ifdef MAX_ALLOC_PAGE_SIZE 3289 #if PAGE_SIZE == 4096 3290 #define LINK_DESC_PAGE_ID_MASK 0x007FE0 3291 #define LINK_DESC_ID_SHIFT 5 3292 #define LINK_DESC_ID_START_21_BITS_COOKIE 0x8000 3293 #elif PAGE_SIZE == 65536 3294 #define LINK_DESC_PAGE_ID_MASK 0x007E00 3295 #define LINK_DESC_ID_SHIFT 9 3296 #define LINK_DESC_ID_START_21_BITS_COOKIE 0x800 3297 #else 3298 #error "Unsupported kernel PAGE_SIZE" 3299 #endif 3300 #define LINK_DESC_COOKIE(_desc_id, _page_id, _desc_id_start) \ 3301 ((((_page_id) + (_desc_id_start)) << LINK_DESC_ID_SHIFT) | (_desc_id)) 3302 #define LINK_DESC_COOKIE_PAGE_ID(_cookie) \ 3303 (((_cookie) & LINK_DESC_PAGE_ID_MASK) >> LINK_DESC_ID_SHIFT) 3304 #else 3305 #define LINK_DESC_PAGE_ID_MASK 0x7 3306 #define LINK_DESC_ID_SHIFT 3 3307 #define LINK_DESC_COOKIE(_desc_id, _page_id, _desc_id_start) \ 3308 ((((_desc_id) + (_desc_id_start)) << LINK_DESC_ID_SHIFT) | (_page_id)) 3309 #define LINK_DESC_COOKIE_PAGE_ID(_cookie) \ 3310 ((_cookie) & LINK_DESC_PAGE_ID_MASK) 3311 #define LINK_DESC_ID_START_21_BITS_COOKIE 0x8000 3312 #endif 3313 #define LINK_DESC_ID_START_20_BITS_COOKIE 0x4000 3314 3315 /* same as ieee80211_nac_param */ 3316 enum dp_nac_param_cmd { 3317 /* IEEE80211_NAC_PARAM_ADD */ 3318 DP_NAC_PARAM_ADD = 1, 3319 /* IEEE80211_NAC_PARAM_DEL */ 3320 DP_NAC_PARAM_DEL, 3321 /* IEEE80211_NAC_PARAM_LIST */ 3322 DP_NAC_PARAM_LIST, 3323 }; 3324 3325 /** 3326 * struct dp_neighbour_peer - neighbour peer list type for smart mesh 3327 * @neighbour_peers_macaddr: neighbour peer's mac address 3328 * @vdev: associated vdev 3329 * @ast_entry: ast_entry for neighbour peer 3330 * @rssi: rssi value 3331 * @neighbour_peer_list_elem: neighbour peer list TAILQ element 3332 */ 3333 struct dp_neighbour_peer { 3334 union dp_align_mac_addr neighbour_peers_macaddr; 3335 struct dp_vdev *vdev; 3336 struct dp_ast_entry *ast_entry; 3337 uint8_t rssi; 3338 TAILQ_ENTRY(dp_neighbour_peer) neighbour_peer_list_elem; 3339 }; 3340 3341 #ifdef WLAN_TX_PKT_CAPTURE_ENH 3342 #define WLAN_TX_PKT_CAPTURE_ENH 1 3343 #define DP_TX_PPDU_PROC_THRESHOLD 8 3344 #define DP_TX_PPDU_PROC_TIMEOUT 10 3345 #endif 3346 3347 /** 3348 * struct ppdu_info - PPDU Status info descriptor 3349 * @ppdu_id: Unique ppduid assigned by firmware for every tx packet 3350 * @sched_cmdid: schedule command id, which will be same in a burst 3351 * @max_ppdu_id: wrap around for ppdu id 3352 * @tsf_l32: 3353 * @tlv_bitmap: 3354 * @last_tlv_cnt: Keep track for missing ppdu tlvs 3355 * @last_user: last ppdu processed for user 3356 * @is_ampdu: set if Ampdu aggregate 3357 * @nbuf: ppdu descriptor payload 3358 * @ppdu_desc: ppdu descriptor 3359 * @ulist: Union of lists 3360 * @ppdu_info_dlist_elem: linked list of ppdu tlvs 3361 * @ppdu_info_slist_elem: Singly linked list (queue) of ppdu tlvs 3362 * @ppdu_info_list_elem: linked list of ppdu tlvs 3363 * @ppdu_info_queue_elem: Singly linked list (queue) of ppdu tlvs 3364 * @compltn_common_tlv: Successful tlv counter from COMPLTN COMMON tlv 3365 * @ack_ba_tlv: Successful tlv counter from ACK BA tlv 3366 * @done: 3367 */ 3368 struct ppdu_info { 3369 uint32_t ppdu_id; 3370 uint32_t sched_cmdid; 3371 uint32_t max_ppdu_id; 3372 uint32_t tsf_l32; 3373 uint16_t tlv_bitmap; 3374 uint16_t last_tlv_cnt; 3375 uint16_t last_user:8, 3376 is_ampdu:1; 3377 qdf_nbuf_t nbuf; 3378 struct cdp_tx_completion_ppdu *ppdu_desc; 3379 #ifdef WLAN_TX_PKT_CAPTURE_ENH 3380 union { 3381 TAILQ_ENTRY(ppdu_info) ppdu_info_dlist_elem; 3382 STAILQ_ENTRY(ppdu_info) ppdu_info_slist_elem; 3383 } ulist; 3384 #define ppdu_info_list_elem ulist.ppdu_info_dlist_elem 3385 #define ppdu_info_queue_elem ulist.ppdu_info_slist_elem 3386 #else 3387 TAILQ_ENTRY(ppdu_info) ppdu_info_list_elem; 3388 #endif 3389 uint8_t compltn_common_tlv; 3390 uint8_t ack_ba_tlv; 3391 bool done; 3392 }; 3393 3394 /** 3395 * struct msdu_completion_info - wbm msdu completion info 3396 * @ppdu_id: Unique ppduid assigned by firmware for every tx packet 3397 * @peer_id: peer_id 3398 * @tid: tid which used during transmit 3399 * @first_msdu: first msdu indication 3400 * @last_msdu: last msdu indication 3401 * @msdu_part_of_amsdu: msdu part of amsdu 3402 * @transmit_cnt: retried count 3403 * @status: transmit status 3404 * @tsf: timestamp which it transmitted 3405 */ 3406 struct msdu_completion_info { 3407 uint32_t ppdu_id; 3408 uint16_t peer_id; 3409 uint8_t tid; 3410 uint8_t first_msdu:1, 3411 last_msdu:1, 3412 msdu_part_of_amsdu:1; 3413 uint8_t transmit_cnt; 3414 uint8_t status; 3415 uint32_t tsf; 3416 }; 3417 3418 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG 3419 struct rx_protocol_tag_map { 3420 /* This is the user configured tag for the said protocol type */ 3421 uint16_t tag; 3422 }; 3423 3424 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS 3425 /** 3426 * struct rx_protocol_tag_stats - protocol statistics 3427 * @tag_ctr: number of rx msdus matching this tag 3428 */ 3429 struct rx_protocol_tag_stats { 3430 uint32_t tag_ctr; 3431 }; 3432 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */ 3433 3434 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ 3435 3436 #ifdef WLAN_RX_PKT_CAPTURE_ENH 3437 /* Template data to be set for Enhanced RX Monitor packets */ 3438 #define RX_MON_CAP_ENH_TRAILER 0xdeadc0dedeadda7a 3439 3440 /** 3441 * struct dp_rx_mon_enh_trailer_data - Data structure to set a known pattern 3442 * at end of each MSDU in monitor-lite mode 3443 * @reserved1: reserved for future use 3444 * @reserved2: reserved for future use 3445 * @flow_tag: flow tag value read from skb->cb 3446 * @protocol_tag: protocol tag value read from skb->cb 3447 */ 3448 struct dp_rx_mon_enh_trailer_data { 3449 uint16_t reserved1; 3450 uint16_t reserved2; 3451 uint16_t flow_tag; 3452 uint16_t protocol_tag; 3453 }; 3454 #endif /* WLAN_RX_PKT_CAPTURE_ENH */ 3455 3456 #ifdef HTT_STATS_DEBUGFS_SUPPORT 3457 /* Number of debugfs entries created for HTT stats */ 3458 #define PDEV_HTT_STATS_DBGFS_SIZE HTT_DBG_NUM_EXT_STATS 3459 3460 /** 3461 * struct pdev_htt_stats_dbgfs_priv - Structure to maintain debugfs information 3462 * of HTT stats 3463 * @pdev: dp pdev of debugfs entry 3464 * @stats_id: stats id of debugfs entry 3465 */ 3466 struct pdev_htt_stats_dbgfs_priv { 3467 struct dp_pdev *pdev; 3468 uint16_t stats_id; 3469 }; 3470 3471 /** 3472 * struct pdev_htt_stats_dbgfs_cfg - PDEV level data structure for debugfs 3473 * support for HTT stats 3474 * @debugfs_entry: qdf_debugfs directory entry 3475 * @m: qdf debugfs file handler 3476 * @pdev_htt_stats_dbgfs_ops: File operations of entry created 3477 * @priv: HTT stats debugfs private object 3478 * @htt_stats_dbgfs_event: HTT stats event for debugfs support 3479 * @lock: HTT stats debugfs lock 3480 * @htt_stats_dbgfs_msg_process: Function callback to print HTT stats 3481 */ 3482 struct pdev_htt_stats_dbgfs_cfg { 3483 qdf_dentry_t debugfs_entry[PDEV_HTT_STATS_DBGFS_SIZE]; 3484 qdf_debugfs_file_t m; 3485 struct qdf_debugfs_fops 3486 pdev_htt_stats_dbgfs_ops[PDEV_HTT_STATS_DBGFS_SIZE - 1]; 3487 struct pdev_htt_stats_dbgfs_priv priv[PDEV_HTT_STATS_DBGFS_SIZE - 1]; 3488 qdf_event_t htt_stats_dbgfs_event; 3489 qdf_mutex_t lock; 3490 void (*htt_stats_dbgfs_msg_process)(void *data, A_INT32 len); 3491 }; 3492 #endif /* HTT_STATS_DEBUGFS_SUPPORT */ 3493 3494 struct dp_srng_ring_state { 3495 enum hal_ring_type ring_type; 3496 uint32_t sw_head; 3497 uint32_t sw_tail; 3498 uint32_t hw_head; 3499 uint32_t hw_tail; 3500 3501 }; 3502 3503 struct dp_soc_srngs_state { 3504 uint32_t seq_num; 3505 uint32_t max_ring_id; 3506 struct dp_srng_ring_state ring_state[DP_MAX_SRNGS]; 3507 TAILQ_ENTRY(dp_soc_srngs_state) list_elem; 3508 }; 3509 3510 #ifdef WLAN_FEATURE_11BE_MLO 3511 /* struct dp_mlo_sync_timestamp - PDEV level data structure for storing 3512 * MLO timestamp received via HTT msg. 3513 * msg_type: This would be set to HTT_T2H_MSG_TYPE_MLO_TIMESTAMP_OFFSET_IND 3514 * pdev_id: pdev_id 3515 * chip_id: chip_id 3516 * mac_clk_freq: mac clock frequency of the mac HW block in MHz 3517 * sync_tstmp_lo_us: lower 32 bits of the WLAN global time stamp (in us) at 3518 * which last sync interrupt was received 3519 * sync_tstmp_hi_us: upper 32 bits of the WLAN global time stamp (in us) at 3520 * which last sync interrupt was received 3521 * mlo_offset_lo_us: lower 32 bits of the MLO time stamp offset in us 3522 * mlo_offset_hi_us: upper 32 bits of the MLO time stamp offset in us 3523 * mlo_offset_clks: MLO time stamp offset in clock ticks for sub us 3524 * mlo_comp_us: MLO time stamp compensation applied in us 3525 * mlo_comp_clks: MLO time stamp compensation applied in clock ticks 3526 * for sub us resolution 3527 * mlo_comp_timer: period of MLO compensation timer at which compensation 3528 * is applied, in us 3529 */ 3530 struct dp_mlo_sync_timestamp { 3531 uint32_t msg_type:8, 3532 pdev_id:2, 3533 chip_id:2, 3534 rsvd1:4, 3535 mac_clk_freq:16; 3536 uint32_t sync_tstmp_lo_us; 3537 uint32_t sync_tstmp_hi_us; 3538 uint32_t mlo_offset_lo_us; 3539 uint32_t mlo_offset_hi_us; 3540 uint32_t mlo_offset_clks; 3541 uint32_t mlo_comp_us:16, 3542 mlo_comp_clks:10, 3543 rsvd2:6; 3544 uint32_t mlo_comp_timer:22, 3545 rsvd3:10; 3546 }; 3547 #endif 3548 3549 /* PDEV level structure for data path */ 3550 struct dp_pdev { 3551 /** 3552 * Re-use Memory Section Starts 3553 */ 3554 3555 /* PDEV Id */ 3556 uint8_t pdev_id; 3557 3558 /* LMAC Id */ 3559 uint8_t lmac_id; 3560 3561 /* Target pdev Id */ 3562 uint8_t target_pdev_id; 3563 3564 bool pdev_deinit; 3565 3566 /* TXRX SOC handle */ 3567 struct dp_soc *soc; 3568 3569 /* pdev status down or up required to handle dynamic hw 3570 * mode switch between DBS and DBS_SBS. 3571 * 1 = down 3572 * 0 = up 3573 */ 3574 bool is_pdev_down; 3575 3576 /* Enhanced Stats is enabled */ 3577 uint8_t enhanced_stats_en:1, 3578 link_peer_stats:1; 3579 3580 /* Flag to indicate fast path Tx flags */ 3581 uint32_t tx_fast_flag; 3582 3583 /* Flag to indicate fast RX */ 3584 bool rx_fast_flag; 3585 3586 /* Second ring used to replenish rx buffers */ 3587 struct dp_srng rx_refill_buf_ring2; 3588 #ifdef IPA_WDI3_VLAN_SUPPORT 3589 /* Third ring used to replenish rx buffers */ 3590 struct dp_srng rx_refill_buf_ring3; 3591 #endif 3592 3593 #ifdef FEATURE_DIRECT_LINK 3594 /* Fourth ring used to replenish rx buffers */ 3595 struct dp_srng rx_refill_buf_ring4; 3596 #endif 3597 3598 /* Empty ring used by firmware to post rx buffers to the MAC */ 3599 struct dp_srng rx_mac_buf_ring[MAX_RX_MAC_RINGS]; 3600 3601 int ch_band_lmac_id_mapping[REG_BAND_UNKNOWN]; 3602 3603 /* wlan_cfg pdev ctxt*/ 3604 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx; 3605 3606 /** 3607 * TODO: See if we need a ring map here for LMAC rings. 3608 * 1. Monitor rings are currently planning to be processed on receiving 3609 * PPDU end interrupts and hence won't need ring based interrupts. 3610 * 2. Rx buffer rings will be replenished during REO destination 3611 * processing and doesn't require regular interrupt handling - we will 3612 * only handle low water mark interrupts which is not expected 3613 * frequently 3614 */ 3615 3616 /* VDEV list */ 3617 TAILQ_HEAD(, dp_vdev) vdev_list; 3618 3619 /* vdev list lock */ 3620 qdf_spinlock_t vdev_list_lock; 3621 3622 /* Number of vdevs this device have */ 3623 uint16_t vdev_count; 3624 3625 /* PDEV transmit lock */ 3626 qdf_spinlock_t tx_lock; 3627 3628 /*tx_mutex for me*/ 3629 DP_MUTEX_TYPE tx_mutex; 3630 3631 /* msdu chain head & tail */ 3632 qdf_nbuf_t invalid_peer_head_msdu; 3633 qdf_nbuf_t invalid_peer_tail_msdu; 3634 3635 /* Band steering */ 3636 /* TBD */ 3637 3638 /* PDEV level data path statistics */ 3639 struct cdp_pdev_stats stats; 3640 3641 /* Global RX decap mode for the device */ 3642 enum htt_pkt_type rx_decap_mode; 3643 3644 qdf_atomic_t num_tx_outstanding; 3645 int32_t tx_descs_max; 3646 3647 qdf_atomic_t num_tx_exception; 3648 3649 /* MCL specific local peer handle */ 3650 struct { 3651 uint8_t pool[OL_TXRX_NUM_LOCAL_PEER_IDS + 1]; 3652 uint8_t freelist; 3653 qdf_spinlock_t lock; 3654 struct dp_peer *map[OL_TXRX_NUM_LOCAL_PEER_IDS]; 3655 } local_peer_ids; 3656 3657 /* dscp_tid_map_*/ 3658 uint8_t dscp_tid_map[DP_MAX_TID_MAPS][DSCP_TID_MAP_MAX]; 3659 3660 /* operating channel */ 3661 struct { 3662 uint8_t num; 3663 uint8_t band; 3664 uint16_t freq; 3665 } operating_channel; 3666 3667 /* pool addr for mcast enhance buff */ 3668 struct { 3669 int size; 3670 uint32_t paddr; 3671 char *vaddr; 3672 struct dp_tx_me_buf_t *freelist; 3673 int buf_in_use; 3674 qdf_dma_mem_context(memctx); 3675 } me_buf; 3676 3677 bool hmmc_tid_override_en; 3678 uint8_t hmmc_tid; 3679 3680 /* Number of VAPs with mcast enhancement enabled */ 3681 qdf_atomic_t mc_num_vap_attached; 3682 3683 qdf_atomic_t stats_cmd_complete; 3684 3685 #ifdef IPA_OFFLOAD 3686 ipa_uc_op_cb_type ipa_uc_op_cb; 3687 void *usr_ctxt; 3688 struct dp_ipa_resources ipa_resource; 3689 #endif 3690 3691 /* TBD */ 3692 3693 /* map this pdev to a particular Reo Destination ring */ 3694 enum cdp_host_reo_dest_ring reo_dest; 3695 3696 /* WDI event handlers */ 3697 struct wdi_event_subscribe_t **wdi_event_list; 3698 3699 bool cfr_rcc_mode; 3700 3701 /* enable time latency check for tx completion */ 3702 bool latency_capture_enable; 3703 3704 /* enable calculation of delay stats*/ 3705 bool delay_stats_flag; 3706 /* vow stats */ 3707 bool vow_stats; 3708 void *dp_txrx_handle; /* Advanced data path handle */ 3709 uint32_t ppdu_id; 3710 bool first_nbuf; 3711 /* Current noise-floor reading for the pdev channel */ 3712 int16_t chan_noise_floor; 3713 3714 /* 3715 * For multiradio device, this flag indicates if 3716 * this radio is primary or secondary. 3717 * 3718 * For HK 1.0, this is used for WAR for the AST issue. 3719 * HK 1.x mandates creation of only 1 AST entry with same MAC address 3720 * across 2 radios. is_primary indicates the radio on which DP should 3721 * install HW AST entry if there is a request to add 2 AST entries 3722 * with same MAC address across 2 radios 3723 */ 3724 uint8_t is_primary; 3725 struct cdp_tx_sojourn_stats sojourn_stats; 3726 qdf_nbuf_t sojourn_buf; 3727 3728 union dp_rx_desc_list_elem_t *free_list_head; 3729 union dp_rx_desc_list_elem_t *free_list_tail; 3730 /* Cached peer_id from htt_peer_details_tlv */ 3731 uint16_t fw_stats_peer_id; 3732 3733 /* qdf_event for fw_peer_stats */ 3734 qdf_event_t fw_peer_stats_event; 3735 3736 /* qdf_event for fw_stats */ 3737 qdf_event_t fw_stats_event; 3738 3739 /* qdf_event for fw__obss_stats */ 3740 qdf_event_t fw_obss_stats_event; 3741 3742 /* To check if request is already sent for obss stats */ 3743 bool pending_fw_obss_stats_response; 3744 3745 /* User configured max number of tx buffers */ 3746 uint32_t num_tx_allowed; 3747 3748 /* 3749 * User configured max num of tx buffers excluding the 3750 * number of buffers reserved for handling special frames 3751 */ 3752 uint32_t num_reg_tx_allowed; 3753 3754 /* User configured max number of tx buffers for the special frames*/ 3755 uint32_t num_tx_spl_allowed; 3756 3757 /* unique cookie required for peer session */ 3758 uint32_t next_peer_cookie; 3759 3760 /* 3761 * Run time enabled when the first protocol tag is added, 3762 * run time disabled when the last protocol tag is deleted 3763 */ 3764 bool is_rx_protocol_tagging_enabled; 3765 3766 #ifdef WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG 3767 /* 3768 * The protocol type is used as array index to save 3769 * user provided tag info 3770 */ 3771 struct rx_protocol_tag_map rx_proto_tag_map[RX_PROTOCOL_TAG_MAX]; 3772 3773 #ifdef WLAN_SUPPORT_RX_TAG_STATISTICS 3774 /* 3775 * Track msdus received from each reo ring separately to avoid 3776 * simultaneous writes from different core 3777 */ 3778 struct rx_protocol_tag_stats 3779 reo_proto_tag_stats[MAX_REO_DEST_RINGS][RX_PROTOCOL_TAG_MAX]; 3780 /* Track msdus received from exception ring separately */ 3781 struct rx_protocol_tag_stats 3782 rx_err_proto_tag_stats[RX_PROTOCOL_TAG_MAX]; 3783 struct rx_protocol_tag_stats 3784 mon_proto_tag_stats[RX_PROTOCOL_TAG_MAX]; 3785 #endif /* WLAN_SUPPORT_RX_TAG_STATISTICS */ 3786 #endif /* WLAN_SUPPORT_RX_PROTOCOL_TYPE_TAG */ 3787 3788 #ifdef WLAN_SUPPORT_RX_FLOW_TAG 3789 /** 3790 * Pointer to DP Flow FST at SOC level if 3791 * is_rx_flow_search_table_per_pdev is true 3792 */ 3793 struct dp_rx_fst *rx_fst; 3794 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ 3795 3796 #ifdef FEATURE_TSO_STATS 3797 /* TSO Id to index into TSO packet information */ 3798 qdf_atomic_t tso_idx; 3799 #endif /* FEATURE_TSO_STATS */ 3800 3801 #ifdef WLAN_SUPPORT_DATA_STALL 3802 data_stall_detect_cb data_stall_detect_callback; 3803 #endif /* WLAN_SUPPORT_DATA_STALL */ 3804 3805 /* flag to indicate whether LRO hash command has been sent to FW */ 3806 uint8_t is_lro_hash_configured; 3807 3808 #ifdef HTT_STATS_DEBUGFS_SUPPORT 3809 /* HTT stats debugfs params */ 3810 struct pdev_htt_stats_dbgfs_cfg *dbgfs_cfg; 3811 #endif 3812 struct { 3813 qdf_work_t work; 3814 qdf_workqueue_t *work_queue; 3815 uint32_t seq_num; 3816 uint8_t queue_depth; 3817 qdf_spinlock_t list_lock; 3818 3819 TAILQ_HEAD(, dp_soc_srngs_state) list; 3820 } bkp_stats; 3821 #ifdef WIFI_MONITOR_SUPPORT 3822 struct dp_mon_pdev *monitor_pdev; 3823 #endif 3824 #ifdef WLAN_FEATURE_11BE_MLO 3825 struct dp_mlo_sync_timestamp timestamp; 3826 #endif 3827 /* Is isolation mode enabled */ 3828 bool isolation; 3829 #ifdef WLAN_FEATURE_MARK_FIRST_WAKEUP_PACKET 3830 uint8_t is_first_wakeup_packet; 3831 #endif 3832 #ifdef CONNECTIVITY_PKTLOG 3833 /* packetdump callback functions */ 3834 ol_txrx_pktdump_cb dp_tx_packetdump_cb; 3835 ol_txrx_pktdump_cb dp_rx_packetdump_cb; 3836 #endif 3837 3838 /* Firmware Stats for TLV received from Firmware */ 3839 uint64_t fw_stats_tlv_bitmap_rcvd; 3840 3841 /* For Checking Pending Firmware Response */ 3842 bool pending_fw_stats_response; 3843 }; 3844 3845 struct dp_peer; 3846 3847 #ifdef DP_RX_UDP_OVER_PEER_ROAM 3848 #define WLAN_ROAM_PEER_AUTH_STATUS_NONE 0x0 3849 /* 3850 * This macro is equivalent to macro ROAM_AUTH_STATUS_AUTHENTICATED used 3851 * in connection mgr 3852 */ 3853 #define WLAN_ROAM_PEER_AUTH_STATUS_AUTHENTICATED 0x2 3854 #endif 3855 3856 #ifdef WLAN_FEATURE_TX_LATENCY_STATS 3857 /** 3858 * struct dp_tx_latency_config - configuration for per-link transmit latency 3859 * statistics 3860 * @enabled: the feature is enabled or not 3861 * @report: async report is enabled or not 3862 * @granularity: granularity(in microseconds) of the distribution for the types 3863 */ 3864 struct dp_tx_latency_config { 3865 qdf_atomic_t enabled; 3866 qdf_atomic_t report; 3867 qdf_atomic_t granularity[CDP_TX_LATENCY_TYPE_MAX]; 3868 }; 3869 3870 /** 3871 * struct dp_tx_latency_stats - transmit latency distribution for a type 3872 * @latency_accum: accumulated latencies 3873 * @msdus_accum: accumulated number of msdus 3874 * @distribution: distribution of latencies 3875 */ 3876 struct dp_tx_latency_stats { 3877 qdf_atomic_t latency_accum; 3878 qdf_atomic_t msdus_accum; 3879 qdf_atomic_t distribution[CDP_TX_LATENCY_DISTR_LV_MAX]; 3880 }; 3881 3882 /** 3883 * struct dp_tx_latency - transmit latency statistics for remote link peer 3884 * @cur_idx: current row index of the 2D stats array 3885 * @stats: two-dimensional array, to store the transmit latency statistics. 3886 * one row is used to store the stats of the current cycle, it's indicated 3887 * by cur_idx, the other is for the last cycle. 3888 */ 3889 struct dp_tx_latency { 3890 uint8_t cur_idx; 3891 struct dp_tx_latency_stats stats[2][CDP_TX_LATENCY_TYPE_MAX]; 3892 }; 3893 #endif 3894 3895 /** 3896 * struct dp_vdev_stats - vdev stats structure for dp vdev 3897 * @tx_i: ingress tx stats, contains legacy and MLO ingress tx stats 3898 * @rx_i: ingress rx stats 3899 * @tx: cdp tx stats 3900 * @rx: cdp rx stats 3901 * @tso_stats: tso stats 3902 * @tid_tx_stats: tid tx stats 3903 */ 3904 struct dp_vdev_stats { 3905 struct cdp_tx_ingress_stats tx_i[DP_INGRESS_STATS_MAX_SIZE]; 3906 struct cdp_rx_ingress_stats rx_i; 3907 struct cdp_tx_stats tx; 3908 struct cdp_rx_stats rx; 3909 struct cdp_tso_stats tso_stats; 3910 #ifdef HW_TX_DELAY_STATS_ENABLE 3911 struct cdp_tid_tx_stats tid_tx_stats[CDP_MAX_TX_COMP_RINGS] 3912 [CDP_MAX_DATA_TIDS]; 3913 #endif 3914 }; 3915 3916 /* VDEV structure for data path state */ 3917 struct dp_vdev { 3918 /* OS device abstraction */ 3919 qdf_device_t osdev; 3920 3921 /* physical device that is the parent of this virtual device */ 3922 struct dp_pdev *pdev; 3923 3924 /* VDEV operating mode */ 3925 enum wlan_op_mode opmode; 3926 3927 /* VDEV subtype */ 3928 enum wlan_op_subtype subtype; 3929 3930 /* Tx encapsulation type for this VAP */ 3931 enum htt_cmn_pkt_type tx_encap_type; 3932 3933 /* Rx Decapsulation type for this VAP */ 3934 enum htt_cmn_pkt_type rx_decap_type; 3935 3936 /* WDS enabled */ 3937 bool wds_enabled; 3938 3939 /* MEC enabled */ 3940 bool mec_enabled; 3941 3942 #ifdef QCA_SUPPORT_WDS_EXTENDED 3943 bool wds_ext_enabled; 3944 bool drop_tx_mcast; 3945 #endif /* QCA_SUPPORT_WDS_EXTENDED */ 3946 bool drop_3addr_mcast; 3947 #ifdef WLAN_VENDOR_SPECIFIC_BAR_UPDATE 3948 bool skip_bar_update; 3949 unsigned long skip_bar_update_last_ts; 3950 #endif 3951 /* WDS Aging timer period */ 3952 uint32_t wds_aging_timer_val; 3953 3954 /* NAWDS enabled */ 3955 bool nawds_enabled; 3956 3957 /* Multicast enhancement enabled */ 3958 uint8_t mcast_enhancement_en; 3959 3960 /* IGMP multicast enhancement enabled */ 3961 uint8_t igmp_mcast_enhanc_en; 3962 3963 /* vdev_id - ID used to specify a particular vdev to the target */ 3964 uint8_t vdev_id; 3965 3966 /* Default HTT meta data for this VDEV */ 3967 /* TBD: check alignment constraints */ 3968 uint16_t htt_tcl_metadata; 3969 3970 /* vdev lmac_id */ 3971 uint8_t lmac_id; 3972 3973 /* vdev bank_id */ 3974 uint8_t bank_id; 3975 3976 /* Mesh mode vdev */ 3977 uint32_t mesh_vdev; 3978 3979 /* Mesh mode rx filter setting */ 3980 uint32_t mesh_rx_filter; 3981 3982 /* DSCP-TID mapping table ID */ 3983 uint8_t dscp_tid_map_id; 3984 3985 /* Address search type to be set in TX descriptor */ 3986 uint8_t search_type; 3987 3988 /* 3989 * Flag to indicate if s/w tid classification should be 3990 * skipped 3991 */ 3992 uint8_t skip_sw_tid_classification; 3993 3994 /* Flag to enable peer authorization */ 3995 uint8_t peer_authorize; 3996 3997 /* AST hash value for BSS peer in HW valid for STA VAP*/ 3998 uint16_t bss_ast_hash; 3999 4000 /* AST hash index for BSS peer in HW valid for STA VAP*/ 4001 uint16_t bss_ast_idx; 4002 4003 bool multipass_en; 4004 4005 /* Address search flags to be configured in HAL descriptor */ 4006 uint8_t hal_desc_addr_search_flags; 4007 4008 /* Handle to the OS shim SW's virtual device */ 4009 ol_osif_vdev_handle osif_vdev; 4010 4011 /* MAC address */ 4012 union dp_align_mac_addr mac_addr; 4013 4014 #ifdef WLAN_FEATURE_11BE_MLO 4015 /* MLO MAC address corresponding to vdev */ 4016 union dp_align_mac_addr mld_mac_addr; 4017 #if defined(WLAN_MLO_MULTI_CHIP) && defined(WLAN_MCAST_MLO) 4018 uint8_t mlo_vdev:1, 4019 is_bridge_vdev:1, 4020 reserved_1:6; 4021 #endif 4022 #endif 4023 4024 /* node in the pdev's list of vdevs */ 4025 TAILQ_ENTRY(dp_vdev) vdev_list_elem; 4026 4027 /* dp_peer list */ 4028 TAILQ_HEAD(, dp_peer) peer_list; 4029 /* to protect peer_list */ 4030 DP_MUTEX_TYPE peer_list_lock; 4031 4032 /* RX call back function to flush GRO packets*/ 4033 ol_txrx_rx_gro_flush_ind_fp osif_gro_flush; 4034 /* default RX call back function called by dp */ 4035 ol_txrx_rx_fp osif_rx; 4036 #ifdef QCA_SUPPORT_EAPOL_OVER_CONTROL_PORT 4037 /* callback to receive eapol frames */ 4038 ol_txrx_rx_fp osif_rx_eapol; 4039 #endif 4040 /* callback to deliver rx frames to the OS */ 4041 ol_txrx_rx_fp osif_rx_stack; 4042 /* Callback to handle rx fisa frames */ 4043 ol_txrx_fisa_rx_fp osif_fisa_rx; 4044 ol_txrx_fisa_flush_fp osif_fisa_flush; 4045 4046 /* call back function to flush out queued rx packets*/ 4047 ol_txrx_rx_flush_fp osif_rx_flush; 4048 ol_txrx_rsim_rx_decap_fp osif_rsim_rx_decap; 4049 ol_txrx_get_key_fp osif_get_key; 4050 ol_txrx_tx_free_ext_fp osif_tx_free_ext; 4051 4052 #ifdef notyet 4053 /* callback to check if the msdu is an WAI (WAPI) frame */ 4054 ol_rx_check_wai_fp osif_check_wai; 4055 #endif 4056 4057 /* proxy arp function */ 4058 ol_txrx_proxy_arp_fp osif_proxy_arp; 4059 4060 ol_txrx_mcast_me_fp me_convert; 4061 4062 /* completion function used by this vdev*/ 4063 ol_txrx_completion_fp tx_comp; 4064 4065 ol_txrx_get_tsf_time get_tsf_time; 4066 4067 /* callback to classify critical packets */ 4068 ol_txrx_classify_critical_pkt_fp tx_classify_critical_pkt_cb; 4069 4070 /* deferred vdev deletion state */ 4071 struct { 4072 /* VDEV delete pending */ 4073 int pending; 4074 /* 4075 * callback and a context argument to provide a 4076 * notification for when the vdev is deleted. 4077 */ 4078 ol_txrx_vdev_delete_cb callback; 4079 void *context; 4080 } delete; 4081 4082 /* tx data delivery notification callback function */ 4083 struct { 4084 ol_txrx_data_tx_cb func; 4085 void *ctxt; 4086 } tx_non_std_data_callback; 4087 4088 4089 /* safe mode control to bypass the encrypt and decipher process*/ 4090 uint32_t safemode; 4091 4092 /* rx filter related */ 4093 uint32_t drop_unenc; 4094 #ifdef notyet 4095 privacy_exemption privacy_filters[MAX_PRIVACY_FILTERS]; 4096 uint32_t filters_num; 4097 #endif 4098 /* TDLS Link status */ 4099 bool tdls_link_connected; 4100 bool is_tdls_frame; 4101 4102 /* per vdev rx nbuf queue */ 4103 qdf_nbuf_queue_t rxq; 4104 4105 uint8_t tx_ring_id; 4106 struct dp_tx_desc_pool_s *tx_desc; 4107 struct dp_tx_ext_desc_pool_s *tx_ext_desc; 4108 4109 /* Capture timestamp of previous tx packet enqueued */ 4110 uint64_t prev_tx_enq_tstamp; 4111 4112 /* Capture timestamp of previous rx packet delivered */ 4113 uint64_t prev_rx_deliver_tstamp; 4114 4115 /* VDEV Stats */ 4116 struct dp_vdev_stats stats; 4117 4118 /* Is this a proxySTA VAP */ 4119 uint8_t proxysta_vdev : 1, /* Is this a proxySTA VAP */ 4120 wrap_vdev : 1, /* Is this a QWRAP AP VAP */ 4121 isolation_vdev : 1, /* Is this a QWRAP AP VAP */ 4122 reserved : 5; /* Reserved */ 4123 4124 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 4125 struct dp_tx_desc_pool_s *pool; 4126 #endif 4127 /* AP BRIDGE enabled */ 4128 bool ap_bridge_enabled; 4129 4130 enum cdp_sec_type sec_type; 4131 4132 /* SWAR for HW: Enable WEP bit in the AMSDU frames for RAW mode */ 4133 bool raw_mode_war; 4134 4135 4136 /* 8021p PCP-TID mapping table ID */ 4137 uint8_t tidmap_tbl_id; 4138 4139 /* 8021p PCP-TID map values */ 4140 uint8_t pcp_tid_map[PCP_TID_MAP_MAX]; 4141 4142 /* TIDmap priority */ 4143 uint8_t tidmap_prty; 4144 4145 #ifdef QCA_MULTIPASS_SUPPORT 4146 uint16_t *iv_vlan_map; 4147 4148 /* dp_peer special list */ 4149 TAILQ_HEAD(, dp_txrx_peer) mpass_peer_list; 4150 DP_MUTEX_TYPE mpass_peer_mutex; 4151 #endif 4152 /* Extended data path handle */ 4153 struct cdp_ext_vdev *vdev_dp_ext_handle; 4154 #ifdef VDEV_PEER_PROTOCOL_COUNT 4155 /* 4156 * Rx-Ingress and Tx-Egress are in the lower level DP layer 4157 * Rx-Egress and Tx-ingress are handled in osif layer for DP 4158 * So 4159 * Rx-Egress and Tx-ingress mask definitions are in OSIF layer 4160 * Rx-Ingress and Tx-Egress definitions are here below 4161 */ 4162 #define VDEV_PEER_PROTOCOL_RX_INGRESS_MASK 1 4163 #define VDEV_PEER_PROTOCOL_TX_INGRESS_MASK 2 4164 #define VDEV_PEER_PROTOCOL_RX_EGRESS_MASK 4 4165 #define VDEV_PEER_PROTOCOL_TX_EGRESS_MASK 8 4166 bool peer_protocol_count_track; 4167 int peer_protocol_count_dropmask; 4168 #endif 4169 /* callback to collect connectivity stats */ 4170 ol_txrx_stats_rx_fp stats_cb; 4171 uint32_t num_peers; 4172 /* entry to inactive_list*/ 4173 TAILQ_ENTRY(dp_vdev) inactive_list_elem; 4174 4175 #ifdef WLAN_SUPPORT_RX_FISA 4176 /** 4177 * Params used for controlling the fisa aggregation dynamically 4178 */ 4179 uint8_t fisa_disallowed[MAX_REO_DEST_RINGS]; 4180 uint8_t fisa_force_flushed[MAX_REO_DEST_RINGS]; 4181 #endif 4182 /* 4183 * Refcount for VDEV currently incremented when 4184 * peer is created for VDEV 4185 */ 4186 qdf_atomic_t ref_cnt; 4187 qdf_atomic_t mod_refs[DP_MOD_ID_MAX]; 4188 uint8_t num_latency_critical_conn; 4189 #ifdef WLAN_SUPPORT_MESH_LATENCY 4190 uint8_t peer_tid_latency_enabled; 4191 /* tid latency configuration parameters */ 4192 struct { 4193 uint32_t service_interval; 4194 uint32_t burst_size; 4195 uint8_t latency_tid; 4196 } mesh_tid_latency_config; 4197 #endif 4198 #ifdef WIFI_MONITOR_SUPPORT 4199 struct dp_mon_vdev *monitor_vdev; 4200 #endif 4201 #if defined(WLAN_FEATURE_TSF_AUTO_REPORT) || defined(WLAN_CONFIG_TX_DELAY) 4202 /* Delta between TQM clock and TSF clock */ 4203 uint32_t delta_tsf; 4204 #endif 4205 #ifdef WLAN_FEATURE_TSF_UPLINK_DELAY 4206 /* Indicate if uplink delay report is enabled or not */ 4207 qdf_atomic_t ul_delay_report; 4208 /* accumulative delay for every TX completion */ 4209 qdf_atomic_t ul_delay_accum; 4210 /* accumulative number of packets delay has accumulated */ 4211 qdf_atomic_t ul_pkts_accum; 4212 #endif /* WLAN_FEATURE_TSF_UPLINK_DELAY */ 4213 4214 /* vdev_stats_id - ID used for stats collection by FW from HW*/ 4215 uint8_t vdev_stats_id; 4216 #ifdef HW_TX_DELAY_STATS_ENABLE 4217 /* hw tx delay stats enable */ 4218 uint8_t hw_tx_delay_stats_enabled; 4219 #endif 4220 #ifdef DP_RX_UDP_OVER_PEER_ROAM 4221 uint32_t roaming_peer_status; 4222 union dp_align_mac_addr roaming_peer_mac; 4223 #endif 4224 #ifdef DP_TRAFFIC_END_INDICATION 4225 /* per vdev feature enable/disable status */ 4226 bool traffic_end_ind_en; 4227 /* per vdev nbuf queue for traffic end indication packets */ 4228 qdf_nbuf_queue_t end_ind_pkt_q; 4229 #endif 4230 #ifdef FEATURE_DIRECT_LINK 4231 /* Flag to indicate if to_fw should be set for tx pkts on this vdev */ 4232 bool to_fw; 4233 #endif 4234 /* QDF VDEV operating mode */ 4235 enum QDF_OPMODE qdf_opmode; 4236 4237 #ifdef WLAN_TX_PKT_CAPTURE_ENH 4238 /* TX capture feature to over ride return buffer manager */ 4239 bool is_override_rbm_id; 4240 /* Return buffer manager ID */ 4241 uint8_t rbm_id; 4242 #endif 4243 4244 #ifdef WLAN_FEATURE_TX_LATENCY_STATS 4245 /* configuration for tx latency stats */ 4246 struct dp_tx_latency_config tx_latency_cfg; 4247 #endif 4248 }; 4249 4250 enum { 4251 dp_sec_mcast = 0, 4252 dp_sec_ucast 4253 }; 4254 4255 #ifdef WDS_VENDOR_EXTENSION 4256 typedef struct { 4257 uint8_t wds_tx_mcast_4addr:1, 4258 wds_tx_ucast_4addr:1, 4259 wds_rx_filter:1, /* enforce rx filter */ 4260 wds_rx_ucast_4addr:1, /* when set, accept 4addr unicast frames */ 4261 wds_rx_mcast_4addr:1; /* when set, accept 4addr multicast frames */ 4262 4263 } dp_ecm_policy; 4264 #endif 4265 4266 /** 4267 * struct dp_peer_cached_bufq - cached_bufq to enqueue rx packets 4268 * @cached_bufq: nbuff list to enqueue rx packets 4269 * @bufq_lock: spinlock for nbuff list access 4270 * @thresh: maximum threshold for number of rx buff to enqueue 4271 * @entries: number of entries 4272 * @dropped: number of packets dropped 4273 */ 4274 struct dp_peer_cached_bufq { 4275 qdf_list_t cached_bufq; 4276 qdf_spinlock_t bufq_lock; 4277 uint32_t thresh; 4278 uint32_t entries; 4279 uint32_t dropped; 4280 }; 4281 4282 /** 4283 * enum dp_peer_ast_flowq 4284 * @DP_PEER_AST_FLOWQ_HI_PRIO: Hi Priority flow queue 4285 * @DP_PEER_AST_FLOWQ_LOW_PRIO: Low priority flow queue 4286 * @DP_PEER_AST_FLOWQ_UDP: flow queue type is UDP 4287 * @DP_PEER_AST_FLOWQ_NON_UDP: flow queue type is Non UDP 4288 * @DP_PEER_AST_FLOWQ_MAX: max value 4289 */ 4290 enum dp_peer_ast_flowq { 4291 DP_PEER_AST_FLOWQ_HI_PRIO, 4292 DP_PEER_AST_FLOWQ_LOW_PRIO, 4293 DP_PEER_AST_FLOWQ_UDP, 4294 DP_PEER_AST_FLOWQ_NON_UDP, 4295 DP_PEER_AST_FLOWQ_MAX, 4296 }; 4297 4298 /** 4299 * struct dp_ast_flow_override_info - ast override info 4300 * @ast_idx: ast indexes in peer map message 4301 * @ast_valid_mask: ast valid mask for each ast index 4302 * @ast_flow_mask: ast flow mask for each ast index 4303 * @tid_valid_low_pri_mask: per tid mask for low priority flow 4304 * @tid_valid_hi_pri_mask: per tid mask for hi priority flow 4305 */ 4306 struct dp_ast_flow_override_info { 4307 uint16_t ast_idx[DP_PEER_AST_FLOWQ_MAX]; 4308 uint8_t ast_valid_mask; 4309 uint8_t ast_flow_mask[DP_PEER_AST_FLOWQ_MAX]; 4310 uint8_t tid_valid_low_pri_mask; 4311 uint8_t tid_valid_hi_pri_mask; 4312 }; 4313 4314 #if defined(WLAN_FEATURE_11BE_MLO) && defined(DP_MLO_LINK_STATS_SUPPORT) 4315 /** 4316 * struct dp_peer_ext_evt_info - peer extended event info 4317 * @peer_id: peer_id from firmware 4318 * @vdev_id: vdev ID 4319 * @link_id: Link ID 4320 * @link_id_valid: link_id_valid 4321 * @peer_mac_addr: mac address of the peer 4322 */ 4323 struct dp_peer_ext_evt_info { 4324 uint16_t peer_id; 4325 uint8_t vdev_id; 4326 uint8_t link_id; 4327 bool link_id_valid; 4328 uint8_t *peer_mac_addr; 4329 }; 4330 #endif 4331 4332 /** 4333 * struct dp_peer_ast_params - ast parameters for a msdu flow-queue 4334 * @ast_idx: ast index populated by FW 4335 * @is_valid: ast flow valid mask 4336 * @valid_tid_mask: per tid mask for this ast index 4337 * @flowQ: flow queue id associated with this ast index 4338 */ 4339 struct dp_peer_ast_params { 4340 uint16_t ast_idx; 4341 uint8_t is_valid; 4342 uint8_t valid_tid_mask; 4343 uint8_t flowQ; 4344 }; 4345 4346 #define DP_MLO_FLOW_INFO_MAX 3 4347 4348 /** 4349 * struct dp_mlo_flow_override_info - Flow override info 4350 * @ast_idx: Primary TCL AST Index 4351 * @ast_idx_valid: Is AST index valid 4352 * @chip_id: CHIP ID 4353 * @tidmask: tidmask 4354 * @cache_set_num: Cache set number 4355 */ 4356 struct dp_mlo_flow_override_info { 4357 uint16_t ast_idx; 4358 uint8_t ast_idx_valid; 4359 uint8_t chip_id; 4360 uint8_t tidmask; 4361 uint8_t cache_set_num; 4362 }; 4363 4364 /** 4365 * struct dp_mlo_link_info - Link info 4366 * @peer_chip_id: Peer Chip ID 4367 * @vdev_id: Vdev ID 4368 */ 4369 struct dp_mlo_link_info { 4370 uint8_t peer_chip_id; 4371 uint8_t vdev_id; 4372 }; 4373 4374 #ifdef WLAN_SUPPORT_MSCS 4375 /*MSCS Procedure based macros */ 4376 #define IEEE80211_MSCS_MAX_ELEM_SIZE 5 4377 #define IEEE80211_TCLAS_MASK_CLA_TYPE_4 4 4378 /** 4379 * struct dp_peer_mscs_parameter - MSCS database obtained from 4380 * MSCS Request and Response in the control path. This data is used 4381 * by the AP to find out what priority to set based on the tuple 4382 * classification during packet processing. 4383 * @user_priority_bitmap: User priority bitmap obtained during 4384 * handshake 4385 * @user_priority_limit: User priority limit obtained during 4386 * handshake 4387 * @classifier_mask: params to be compared during processing 4388 */ 4389 struct dp_peer_mscs_parameter { 4390 uint8_t user_priority_bitmap; 4391 uint8_t user_priority_limit; 4392 uint8_t classifier_mask; 4393 }; 4394 #endif 4395 4396 #ifdef QCA_SUPPORT_WDS_EXTENDED 4397 #define WDS_EXT_PEER_INIT_BIT 0 4398 4399 /** 4400 * struct dp_wds_ext_peer - wds ext peer structure 4401 * This is used when wds extended feature is enabled 4402 * both compile time and run time. It is created 4403 * when 1st 4 address frame is received from 4404 * wds backhaul. 4405 * @osif_peer: Handle to the OS shim SW's virtual device 4406 * @init: wds ext netdev state 4407 */ 4408 struct dp_wds_ext_peer { 4409 ol_osif_peer_handle osif_peer; 4410 unsigned long init; 4411 }; 4412 #endif /* QCA_SUPPORT_WDS_EXTENDED */ 4413 4414 #ifdef WLAN_SUPPORT_MESH_LATENCY 4415 /*Advanced Mesh latency feature based macros */ 4416 4417 /** 4418 * struct dp_peer_mesh_latency_parameter - Mesh latency related 4419 * parameters. This data is updated per peer per TID based on 4420 * the flow tuple classification in external rule database 4421 * during packet processing. 4422 * @service_interval_dl: Service interval associated with TID in DL 4423 * @burst_size_dl: Burst size additive over multiple flows in DL 4424 * @service_interval_ul: Service interval associated with TID in UL 4425 * @burst_size_ul: Burst size additive over multiple flows in UL 4426 * @ac: custom ac derived from service interval 4427 * @msduq: MSDU queue number within TID 4428 */ 4429 struct dp_peer_mesh_latency_parameter { 4430 uint32_t service_interval_dl; 4431 uint32_t burst_size_dl; 4432 uint32_t service_interval_ul; 4433 uint32_t burst_size_ul; 4434 uint8_t ac; 4435 uint8_t msduq; 4436 }; 4437 #endif 4438 4439 #ifdef WLAN_FEATURE_11BE_MLO 4440 /* Max number of links for MLO connection */ 4441 #define DP_MAX_MLO_LINKS 4 4442 4443 /** 4444 * struct dp_peer_link_info - link peer information for MLO 4445 * @mac_addr: Mac address 4446 * @vdev_id: Vdev ID for current link peer 4447 * @is_valid: flag for link peer info valid or not 4448 * @chip_id: chip id 4449 * @is_bridge_peer: flag to indicate if peer is bridge peer 4450 */ 4451 struct dp_peer_link_info { 4452 union dp_align_mac_addr mac_addr; 4453 uint8_t vdev_id; 4454 uint8_t is_valid; 4455 uint8_t chip_id; 4456 uint8_t is_bridge_peer; 4457 }; 4458 4459 /** 4460 * struct dp_mld_link_peers - this structure is used to get link peers 4461 * pointer from mld peer 4462 * @link_peers: link peers pointer array 4463 * @num_links: number of link peers fetched 4464 */ 4465 struct dp_mld_link_peers { 4466 struct dp_peer *link_peers[DP_MAX_MLO_LINKS]; 4467 uint8_t num_links; 4468 }; 4469 #else 4470 #define DP_MAX_MLO_LINKS 0 4471 #endif 4472 4473 typedef void *dp_txrx_ref_handle; 4474 4475 /** 4476 * struct dp_peer_per_pkt_tx_stats- Peer Tx stats updated in per pkt 4477 * Tx completion path 4478 * @ucast: Unicast Packet Count 4479 * @mcast: Multicast Packet Count 4480 * @bcast: Broadcast Packet Count 4481 * @nawds_mcast: NAWDS Multicast Packet Count 4482 * @tx_success: Successful Tx Packets 4483 * @nawds_mcast_drop: NAWDS Multicast Drop Count 4484 * @ofdma: Total Packets as ofdma 4485 * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation 4486 * @amsdu_cnt: Number of MSDUs part of AMSDU 4487 * @dropped: Dropped packet statistics 4488 * @dropped.fw_rem: Discarded by firmware 4489 * @dropped.fw_rem_notx: firmware_discard_untransmitted 4490 * @dropped.fw_rem_tx: firmware_discard_transmitted 4491 * @dropped.age_out: aged out in mpdu/msdu queues 4492 * @dropped.fw_reason1: discarded by firmware reason 1 4493 * @dropped.fw_reason2: discarded by firmware reason 2 4494 * @dropped.fw_reason3: discarded by firmware reason 3 4495 * @dropped.fw_rem_no_match: dropped due to fw no match command 4496 * @dropped.drop_threshold: dropped due to HW threshold 4497 * @dropped.drop_link_desc_na: dropped due resource not available in HW 4498 * @dropped.invalid_drop: Invalid msdu drop 4499 * @dropped.mcast_vdev_drop: MCAST drop configured for VDEV in HW 4500 * @dropped.invalid_rr: Invalid TQM release reason 4501 * @failed_retry_count: packets failed due to retry above 802.11 retry limit 4502 * @retry_count: packets successfully send after one or more retry 4503 * @multiple_retry_count: packets successfully sent after more than one retry 4504 * @no_ack_count: no ack pkt count for different protocols 4505 * @tx_success_twt: Successful Tx Packets in TWT session 4506 * @last_tx_ts: last timestamp in jiffies when tx comp occurred 4507 * @avg_sojourn_msdu: Avg sojourn msdu stat 4508 * @protocol_trace_cnt: per-peer protocol counter 4509 * @release_src_not_tqm: Counter to keep track of release source is not TQM 4510 * in TX completion status processing 4511 * @inval_link_id_pkt_cnt: Counter to capture Invalid Link Id 4512 */ 4513 struct dp_peer_per_pkt_tx_stats { 4514 struct cdp_pkt_info ucast; 4515 struct cdp_pkt_info mcast; 4516 struct cdp_pkt_info bcast; 4517 struct cdp_pkt_info nawds_mcast; 4518 struct cdp_pkt_info tx_success; 4519 uint32_t nawds_mcast_drop; 4520 uint32_t ofdma; 4521 uint32_t non_amsdu_cnt; 4522 uint32_t amsdu_cnt; 4523 struct { 4524 struct cdp_pkt_info fw_rem; 4525 uint32_t fw_rem_notx; 4526 uint32_t fw_rem_tx; 4527 uint32_t age_out; 4528 uint32_t fw_reason1; 4529 uint32_t fw_reason2; 4530 uint32_t fw_reason3; 4531 uint32_t fw_rem_queue_disable; 4532 uint32_t fw_rem_no_match; 4533 uint32_t drop_threshold; 4534 uint32_t drop_link_desc_na; 4535 uint32_t invalid_drop; 4536 uint32_t mcast_vdev_drop; 4537 uint32_t invalid_rr; 4538 } dropped; 4539 uint32_t failed_retry_count; 4540 uint32_t retry_count; 4541 uint32_t multiple_retry_count; 4542 uint32_t no_ack_count[QDF_PROTO_SUBTYPE_MAX]; 4543 struct cdp_pkt_info tx_success_twt; 4544 unsigned long last_tx_ts; 4545 qdf_ewma_tx_lag avg_sojourn_msdu[CDP_DATA_TID_MAX]; 4546 #ifdef VDEV_PEER_PROTOCOL_COUNT 4547 struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX]; 4548 #endif 4549 uint32_t release_src_not_tqm; 4550 uint32_t inval_link_id_pkt_cnt; 4551 }; 4552 4553 /** 4554 * struct dp_peer_extd_tx_stats - Peer Tx stats updated in either 4555 * per pkt Tx completion path when macro QCA_ENHANCED_STATS_SUPPORT is 4556 * disabled or in HTT Tx PPDU completion path when macro is enabled 4557 * @stbc: Packets in STBC 4558 * @ldpc: Packets in LDPC 4559 * @retries: Packet retries 4560 * @pkt_type: pkt count for different .11 modes 4561 * @wme_ac_type: Wireless Multimedia type Count 4562 * @excess_retries_per_ac: Wireless Multimedia type Count 4563 * @ampdu_cnt: completion of aggregation 4564 * @non_ampdu_cnt: tx completion not aggregated 4565 * @num_ppdu_cookie_valid: no. of valid ppdu cookies rcvd from FW 4566 * @tx_ppdus: ppdus in tx 4567 * @tx_mpdus_success: mpdus successful in tx 4568 * @tx_mpdus_tried: mpdus tried in tx 4569 * @tx_rate: Tx Rate in kbps 4570 * @last_tx_rate: Last tx rate for unicast packets 4571 * @last_tx_rate_mcs: Tx rate mcs for unicast packets 4572 * @mcast_last_tx_rate: Last tx rate for multicast packets 4573 * @mcast_last_tx_rate_mcs: Last tx rate mcs for multicast 4574 * @rnd_avg_tx_rate: Rounded average tx rate 4575 * @avg_tx_rate: Average TX rate 4576 * @tx_ratecode: Tx rate code of last frame 4577 * @pream_punct_cnt: Preamble Punctured count 4578 * @sgi_count: SGI count 4579 * @nss: Packet count for different num_spatial_stream values 4580 * @bw: Packet Count for different bandwidths 4581 * @ru_start: RU start index 4582 * @ru_tones: RU tones size 4583 * @ru_loc: pkt info for RU location 26/ 52/ 106/ 242/ 484 counter 4584 * @transmit_type: pkt info for tx transmit type 4585 * @mu_group_id: mumimo mu group id 4586 * @last_ack_rssi: RSSI of last acked packet 4587 * @nss_info: NSS 1,2, ...8 4588 * @mcs_info: MCS index 4589 * @bw_info: Bandwidth 4590 * <enum 0 bw_20_MHz> 4591 * <enum 1 bw_40_MHz> 4592 * <enum 2 bw_80_MHz> 4593 * <enum 3 bw_160_MHz> 4594 * @gi_info: <enum 0 0_8_us_sgi > Legacy normal GI 4595 * <enum 1 0_4_us_sgi > Legacy short GI 4596 * <enum 2 1_6_us_sgi > HE related GI 4597 * <enum 3 3_2_us_sgi > HE 4598 * @preamble_info: preamble 4599 * @tx_ucast_total: total ucast count 4600 * @tx_ucast_success: total ucast success count 4601 * @retries_mpdu: mpdu number of successfully transmitted after retries 4602 * @mpdu_success_with_retries: mpdu retry count in case of successful tx 4603 * @su_be_ppdu_cnt: SU Tx packet count for 11BE 4604 * @mu_be_ppdu_cnt: MU Tx packet count for 11BE 4605 * @punc_bw: MSDU count for punctured bw 4606 * @rts_success: RTS success count 4607 * @rts_failure: RTS failure count 4608 * @bar_cnt: Block ACK Request frame count 4609 * @ndpa_cnt: NDP announcement frame count 4610 * @rssi_chain: rssi chain 4611 * @wme_ac_type_bytes: Wireless Multimedia bytes Count 4612 */ 4613 struct dp_peer_extd_tx_stats { 4614 uint32_t stbc; 4615 uint32_t ldpc; 4616 uint32_t retries; 4617 struct cdp_pkt_type pkt_type[DOT11_MAX]; 4618 uint32_t wme_ac_type[WME_AC_MAX]; 4619 uint32_t excess_retries_per_ac[WME_AC_MAX]; 4620 uint32_t ampdu_cnt; 4621 uint32_t non_ampdu_cnt; 4622 uint32_t num_ppdu_cookie_valid; 4623 uint32_t tx_ppdus; 4624 uint32_t tx_mpdus_success; 4625 uint32_t tx_mpdus_tried; 4626 4627 uint32_t tx_rate; 4628 uint32_t last_tx_rate; 4629 uint32_t last_tx_rate_mcs; 4630 uint32_t mcast_last_tx_rate; 4631 uint32_t mcast_last_tx_rate_mcs; 4632 uint64_t rnd_avg_tx_rate; 4633 uint64_t avg_tx_rate; 4634 uint16_t tx_ratecode; 4635 4636 uint32_t sgi_count[MAX_GI]; 4637 uint32_t pream_punct_cnt; 4638 uint32_t nss[SS_COUNT]; 4639 uint32_t bw[MAX_BW]; 4640 uint32_t ru_start; 4641 uint32_t ru_tones; 4642 struct cdp_tx_pkt_info ru_loc[MAX_RU_LOCATIONS]; 4643 4644 struct cdp_tx_pkt_info transmit_type[MAX_TRANSMIT_TYPES]; 4645 uint32_t mu_group_id[MAX_MU_GROUP_ID]; 4646 4647 uint32_t last_ack_rssi; 4648 4649 uint32_t nss_info:4, 4650 mcs_info:4, 4651 bw_info:4, 4652 gi_info:4, 4653 preamble_info:4; 4654 4655 uint32_t retries_mpdu; 4656 uint32_t mpdu_success_with_retries; 4657 struct cdp_pkt_info tx_ucast_total; 4658 struct cdp_pkt_info tx_ucast_success; 4659 #ifdef WLAN_FEATURE_11BE 4660 struct cdp_pkt_type su_be_ppdu_cnt; 4661 struct cdp_pkt_type mu_be_ppdu_cnt[TXRX_TYPE_MU_MAX]; 4662 uint32_t punc_bw[MAX_PUNCTURED_MODE]; 4663 #endif 4664 uint32_t rts_success; 4665 uint32_t rts_failure; 4666 uint32_t bar_cnt; 4667 uint32_t ndpa_cnt; 4668 int32_t rssi_chain[CDP_RSSI_CHAIN_LEN]; 4669 uint64_t wme_ac_type_bytes[WME_AC_MAX]; 4670 }; 4671 4672 /** 4673 * struct dp_peer_per_pkt_rx_stats - Peer Rx stats updated in per pkt Rx path 4674 * @rcvd_reo: Packets received on the reo ring 4675 * @rx_lmac: Packets received on each lmac 4676 * @unicast: Total unicast packets 4677 * @multicast: Total multicast packets 4678 * @bcast: Broadcast Packet Count 4679 * @raw: Raw Pakets received 4680 * @nawds_mcast_drop: Total NAWDS multicast packets dropped 4681 * @mec_drop: Total MEC packets dropped 4682 * @ppeds_drop: Total DS packets dropped 4683 * @last_rx_ts: last timestamp in jiffies when RX happened 4684 * @intra_bss: Intra BSS statistics 4685 * @intra_bss.pkts: Intra BSS packets received 4686 * @intra_bss.fail: Intra BSS packets failed 4687 * @intra_bss.mdns_no_fws: Intra BSS MDNS packets not forwarded 4688 * @err: error counters 4689 * @err.mic_err: Rx MIC errors CCMP 4690 * @err.decrypt_err: Rx Decryption Errors CRC 4691 * @err.fcserr: rx MIC check failed (CCMP) 4692 * @err.pn_err: pn check failed 4693 * @err.oor_err: Rx OOR errors 4694 * @err.jump_2k_err: 2k jump errors 4695 * @err.rxdma_wifi_parse_err: rxdma wifi parse errors 4696 * @non_amsdu_cnt: Number of MSDUs with no MSDU level aggregation 4697 * @amsdu_cnt: Number of MSDUs part of AMSDU 4698 * @rx_retries: retries of packet in rx 4699 * @multipass_rx_pkt_drop: Dropped multipass rx pkt 4700 * @peer_unauth_rx_pkt_drop: Unauth rx packet drops 4701 * @policy_check_drop: policy check drops 4702 * @to_stack_twt: Total packets sent up the stack in TWT session 4703 * @rx_success: Total RX success count 4704 * @protocol_trace_cnt: per-peer protocol counters 4705 * @mcast_3addr_drop: 4706 * @rx_total: total rx count 4707 * @inval_link_id_pkt_cnt: Counter to capture Invalid Link Id 4708 */ 4709 struct dp_peer_per_pkt_rx_stats { 4710 struct cdp_pkt_info rcvd_reo[CDP_MAX_RX_RINGS]; 4711 struct cdp_pkt_info rx_lmac[CDP_MAX_LMACS]; 4712 struct cdp_pkt_info unicast; 4713 struct cdp_pkt_info multicast; 4714 struct cdp_pkt_info bcast; 4715 struct cdp_pkt_info raw; 4716 uint32_t nawds_mcast_drop; 4717 struct cdp_pkt_info mec_drop; 4718 struct cdp_pkt_info ppeds_drop; 4719 unsigned long last_rx_ts; 4720 struct { 4721 struct cdp_pkt_info pkts; 4722 struct cdp_pkt_info fail; 4723 uint32_t mdns_no_fwd; 4724 } intra_bss; 4725 struct { 4726 uint32_t mic_err; 4727 uint32_t decrypt_err; 4728 uint32_t fcserr; 4729 uint32_t pn_err; 4730 uint32_t oor_err; 4731 uint32_t jump_2k_err; 4732 uint32_t rxdma_wifi_parse_err; 4733 } err; 4734 uint32_t non_amsdu_cnt; 4735 uint32_t amsdu_cnt; 4736 uint32_t rx_retries; 4737 uint32_t multipass_rx_pkt_drop; 4738 uint32_t peer_unauth_rx_pkt_drop; 4739 uint32_t policy_check_drop; 4740 struct cdp_pkt_info to_stack_twt; 4741 struct cdp_pkt_info rx_success; 4742 #ifdef VDEV_PEER_PROTOCOL_COUNT 4743 struct protocol_trace_count protocol_trace_cnt[CDP_TRACE_MAX]; 4744 #endif 4745 uint32_t mcast_3addr_drop; 4746 #ifdef IPA_OFFLOAD 4747 struct cdp_pkt_info rx_total; 4748 #endif 4749 uint32_t inval_link_id_pkt_cnt; 4750 }; 4751 4752 /** 4753 * struct dp_peer_extd_rx_stats - Peer Rx stats updated in either 4754 * per pkt Rx path when macro QCA_ENHANCED_STATS_SUPPORT is disabled or in 4755 * Rx monitor patch when macro is enabled 4756 * @pkt_type: pkt counter for different .11 modes 4757 * @wme_ac_type: Wireless Multimedia type Count 4758 * @mpdu_cnt_fcs_ok: SU Rx success mpdu count 4759 * @mpdu_cnt_fcs_err: SU Rx fail mpdu count 4760 * @non_ampdu_cnt: Number of MSDUs with no MPDU level aggregation 4761 * @ampdu_cnt: Number of MSDUs part of AMSPU 4762 * @rx_mpdus: mpdu in rx 4763 * @rx_ppdus: ppdu in rx 4764 * @su_ax_ppdu_cnt: SU Rx packet count for .11ax 4765 * @rx_mu: Rx MU stats 4766 * @reception_type: Reception type of packets 4767 * @ppdu_cnt: PPDU packet count in reception type 4768 * @sgi_count: sgi count 4769 * @nss: packet count in spatiel Streams 4770 * @ppdu_nss: PPDU packet count in spatial streams 4771 * @bw: Packet Count in different bandwidths 4772 * @rx_mpdu_cnt: rx mpdu count per MCS rate 4773 * @rx_rate: Rx rate 4774 * @last_rx_rate: Previous rx rate 4775 * @rnd_avg_rx_rate: Rounded average rx rate 4776 * @avg_rx_rate: Average Rx rate 4777 * @rx_ratecode: Rx rate code of last frame 4778 * @avg_snr: Average snr 4779 * @rx_snr_measured_time: Time at which snr is measured 4780 * @snr: SNR of received signal 4781 * @last_snr: Previous snr 4782 * @nss_info: NSS 1,2, ...8 4783 * @mcs_info: MCS index 4784 * @bw_info: Bandwidth 4785 * <enum 0 bw_20_MHz> 4786 * <enum 1 bw_40_MHz> 4787 * <enum 2 bw_80_MHz> 4788 * <enum 3 bw_160_MHz> 4789 * @gi_info: <enum 0 0_8_us_sgi > Legacy normal GI 4790 * <enum 1 0_4_us_sgi > Legacy short GI 4791 * <enum 2 1_6_us_sgi > HE related GI 4792 * <enum 3 3_2_us_sgi > HE 4793 * @preamble_info: preamble 4794 * @mpdu_retry_cnt: retries of mpdu in rx 4795 * @su_be_ppdu_cnt: SU Rx packet count for BE 4796 * @mu_be_ppdu_cnt: MU rx packet count for BE 4797 * @punc_bw: MSDU count for punctured bw 4798 * @bar_cnt: Block ACK Request frame count 4799 * @ndpa_cnt: NDP announcement frame count 4800 * @wme_ac_type_bytes: Wireless Multimedia type Bytes Count 4801 */ 4802 struct dp_peer_extd_rx_stats { 4803 struct cdp_pkt_type pkt_type[DOT11_MAX]; 4804 uint32_t wme_ac_type[WME_AC_MAX]; 4805 uint32_t mpdu_cnt_fcs_ok; 4806 uint32_t mpdu_cnt_fcs_err; 4807 uint32_t non_ampdu_cnt; 4808 uint32_t ampdu_cnt; 4809 uint32_t rx_mpdus; 4810 uint32_t rx_ppdus; 4811 4812 struct cdp_pkt_type su_ax_ppdu_cnt; 4813 struct cdp_rx_mu rx_mu[TXRX_TYPE_MU_MAX]; 4814 uint32_t reception_type[MAX_RECEPTION_TYPES]; 4815 uint32_t ppdu_cnt[MAX_RECEPTION_TYPES]; 4816 4817 uint32_t sgi_count[MAX_GI]; 4818 uint32_t nss[SS_COUNT]; 4819 uint32_t ppdu_nss[SS_COUNT]; 4820 uint32_t bw[MAX_BW]; 4821 uint32_t rx_mpdu_cnt[MAX_MCS]; 4822 4823 uint32_t rx_rate; 4824 uint32_t last_rx_rate; 4825 uint32_t rnd_avg_rx_rate; 4826 uint32_t avg_rx_rate; 4827 uint32_t rx_ratecode; 4828 4829 uint32_t avg_snr; 4830 unsigned long rx_snr_measured_time; 4831 uint8_t snr; 4832 uint8_t last_snr; 4833 4834 uint32_t nss_info:4, 4835 mcs_info:4, 4836 bw_info:4, 4837 gi_info:4, 4838 preamble_info:4; 4839 4840 uint32_t mpdu_retry_cnt; 4841 #ifdef WLAN_FEATURE_11BE 4842 struct cdp_pkt_type su_be_ppdu_cnt; 4843 struct cdp_pkt_type mu_be_ppdu_cnt[TXRX_TYPE_MU_MAX]; 4844 uint32_t punc_bw[MAX_PUNCTURED_MODE]; 4845 #endif 4846 uint32_t bar_cnt; 4847 uint32_t ndpa_cnt; 4848 uint64_t wme_ac_type_bytes[WME_AC_MAX]; 4849 }; 4850 4851 /** 4852 * struct dp_peer_per_pkt_stats - Per pkt stats for peer 4853 * @tx: Per pkt Tx stats 4854 * @rx: Per pkt Rx stats 4855 */ 4856 struct dp_peer_per_pkt_stats { 4857 struct dp_peer_per_pkt_tx_stats tx; 4858 struct dp_peer_per_pkt_rx_stats rx; 4859 }; 4860 4861 /** 4862 * struct dp_peer_extd_stats - Stats from extended path for peer 4863 * @tx: Extended path tx stats 4864 * @rx: Extended path rx stats 4865 */ 4866 struct dp_peer_extd_stats { 4867 struct dp_peer_extd_tx_stats tx; 4868 struct dp_peer_extd_rx_stats rx; 4869 }; 4870 4871 /** 4872 * struct dp_peer_stats - Peer stats 4873 * @per_pkt_stats: Per packet path stats 4874 * @extd_stats: Extended path stats 4875 * @tx_latency: transmit latency stats 4876 */ 4877 struct dp_peer_stats { 4878 struct dp_peer_per_pkt_stats per_pkt_stats; 4879 #ifndef QCA_ENHANCED_STATS_SUPPORT 4880 struct dp_peer_extd_stats extd_stats; 4881 #endif 4882 #ifdef WLAN_FEATURE_TX_LATENCY_STATS 4883 struct dp_tx_latency tx_latency; 4884 #endif 4885 }; 4886 4887 /** 4888 * struct dp_local_link_id_peer_map - Mapping table entry for link peer mac 4889 * address to local_link_id 4890 * @in_use: set if this entry is having valid mapping between local_link_id 4891 * and the link peer mac address. 4892 * @local_link_id: local_link_id assigned to the link peer 4893 * @mac_addr: link peer mac address 4894 */ 4895 struct dp_local_link_id_peer_map { 4896 uint8_t in_use; 4897 uint8_t local_link_id; 4898 union dp_align_mac_addr mac_addr; 4899 }; 4900 4901 /** 4902 * struct dp_txrx_peer: DP txrx_peer structure used in per pkt path 4903 * @vdev: VDEV to which this peer is associated 4904 * @peer_id: peer ID for this peer 4905 * @authorize: Set when authorized 4906 * @in_twt: in TWT session 4907 * @hw_txrx_stats_en: Indicate HW offload vdev stats 4908 * @is_mld_peer:1: MLD peer 4909 * @tx_failed: Total Tx failure 4910 * @comp_pkt: Pkt Info for which completions were received 4911 * @to_stack: Total packets sent up the stack 4912 * @delay_stats: Peer delay stats 4913 * @jitter_stats: Peer jitter stats 4914 * @security: Security credentials 4915 * @nawds_enabled: NAWDS flag 4916 * @bss_peer: set for bss peer 4917 * @isolation: enable peer isolation for this peer 4918 * @wds_enabled: WDS peer 4919 * @wds_ecm: 4920 * @flush_in_progress: 4921 * @bufq_info: 4922 * @mpass_peer_list_elem: node in the special peer list element 4923 * @vlan_id: vlan id for key 4924 * @wds_ext: 4925 * @osif_rx: 4926 * @rx_tid: 4927 * @sawf_stats: 4928 * @bw: bandwidth of peer connection 4929 * @mpdu_retry_threshold: MPDU retry threshold to increment tx bad count 4930 * @band: Link ID to band mapping 4931 * @ll_id_peer_map: Mapping table for link peer mac address to local_link_id 4932 * @ll_band: Local link id band mapping 4933 * @stats_arr_size: peer stats array size 4934 * @stats: Peer link and mld statistics 4935 */ 4936 struct dp_txrx_peer { 4937 struct dp_vdev *vdev; 4938 uint16_t peer_id; 4939 uint8_t authorize:1, 4940 in_twt:1, 4941 hw_txrx_stats_en:1, 4942 is_mld_peer:1; 4943 uint32_t tx_failed; 4944 struct cdp_pkt_info comp_pkt; 4945 struct cdp_pkt_info to_stack; 4946 4947 struct dp_peer_delay_stats *delay_stats; 4948 4949 struct cdp_peer_tid_stats *jitter_stats; 4950 4951 struct { 4952 enum cdp_sec_type sec_type; 4953 u_int32_t michael_key[2]; /* relevant for TKIP */ 4954 } security[2]; /* 0 -> multicast, 1 -> unicast */ 4955 4956 uint16_t nawds_enabled:1, 4957 bss_peer:1, 4958 isolation:1, 4959 wds_enabled:1; 4960 #ifdef WDS_VENDOR_EXTENSION 4961 dp_ecm_policy wds_ecm; 4962 #endif 4963 #ifdef PEER_CACHE_RX_PKTS 4964 qdf_atomic_t flush_in_progress; 4965 struct dp_peer_cached_bufq bufq_info; 4966 #endif 4967 #ifdef QCA_MULTIPASS_SUPPORT 4968 TAILQ_ENTRY(dp_txrx_peer) mpass_peer_list_elem; 4969 uint16_t vlan_id; 4970 #endif 4971 #ifdef QCA_SUPPORT_WDS_EXTENDED 4972 struct dp_wds_ext_peer wds_ext; 4973 ol_txrx_rx_fp osif_rx; 4974 #endif 4975 struct dp_rx_tid_defrag rx_tid[DP_MAX_TIDS]; 4976 #ifdef CONFIG_SAWF 4977 struct dp_peer_sawf_stats *sawf_stats; 4978 #endif 4979 #ifdef DP_PEER_EXTENDED_API 4980 enum cdp_peer_bw bw; 4981 uint8_t mpdu_retry_threshold; 4982 #endif 4983 #if defined WLAN_FEATURE_11BE_MLO && defined DP_MLO_LINK_STATS_SUPPORT 4984 /* Link ID to band mapping, (1 MLD + DP_MAX_MLO_LINKS) */ 4985 uint8_t band[DP_MAX_MLO_LINKS + 1]; 4986 4987 struct dp_local_link_id_peer_map ll_id_peer_map[DP_MAX_MLO_LINKS]; 4988 uint8_t ll_band[DP_MAX_MLO_LINKS + 1]; 4989 #endif 4990 uint8_t stats_arr_size; 4991 4992 /* dp_peer_stats should be the last member in the structure */ 4993 struct dp_peer_stats stats[]; 4994 }; 4995 4996 /* Peer structure for data path state */ 4997 struct dp_peer { 4998 struct dp_txrx_peer *txrx_peer; 4999 #ifdef WIFI_MONITOR_SUPPORT 5000 struct dp_mon_peer *monitor_peer; 5001 #endif 5002 /* peer ID for this peer */ 5003 uint16_t peer_id; 5004 5005 /* VDEV to which this peer is associated */ 5006 struct dp_vdev *vdev; 5007 5008 struct dp_ast_entry *self_ast_entry; 5009 5010 qdf_atomic_t ref_cnt; 5011 5012 union dp_align_mac_addr mac_addr; 5013 5014 /* node in the vdev's list of peers */ 5015 TAILQ_ENTRY(dp_peer) peer_list_elem; 5016 /* node in the hash table bin's list of peers */ 5017 TAILQ_ENTRY(dp_peer) hash_list_elem; 5018 5019 /* TID structures pointer */ 5020 struct dp_rx_tid *rx_tid; 5021 5022 /* TBD: No transmit TID state required? */ 5023 5024 struct { 5025 enum cdp_sec_type sec_type; 5026 u_int32_t michael_key[2]; /* relevant for TKIP */ 5027 } security[2]; /* 0 -> multicast, 1 -> unicast */ 5028 5029 /* NAWDS Flag and Bss Peer bit */ 5030 uint16_t bss_peer:1, /* set for bss peer */ 5031 authorize:1, /* Set when authorized */ 5032 valid:1, /* valid bit */ 5033 delete_in_progress:1, /* Indicate kickout sent */ 5034 sta_self_peer:1, /* Indicate STA self peer */ 5035 is_tdls_peer:1; /* Indicate TDLS peer */ 5036 5037 #ifdef WLAN_FEATURE_11BE_MLO 5038 uint8_t first_link:1, /* first link peer for MLO */ 5039 primary_link:1; /* primary link for MLO */ 5040 #endif 5041 5042 /* MCL specific peer local id */ 5043 uint16_t local_id; 5044 enum ol_txrx_peer_state state; 5045 qdf_spinlock_t peer_info_lock; 5046 5047 /* Peer calibrated stats */ 5048 struct cdp_calibr_stats stats; 5049 5050 TAILQ_HEAD(, dp_ast_entry) ast_entry_list; 5051 /* TBD */ 5052 5053 /* Active Block ack sessions */ 5054 uint16_t active_ba_session_cnt; 5055 5056 /* Current HW buffersize setting */ 5057 uint16_t hw_buffer_size; 5058 5059 /* 5060 * Flag to check if sessions with 256 buffersize 5061 * should be terminated. 5062 */ 5063 uint8_t kill_256_sessions; 5064 qdf_atomic_t is_default_route_set; 5065 5066 #ifdef QCA_PEER_MULTIQ_SUPPORT 5067 struct dp_peer_ast_params peer_ast_flowq_idx[DP_PEER_AST_FLOWQ_MAX]; 5068 #endif 5069 /* entry to inactive_list*/ 5070 TAILQ_ENTRY(dp_peer) inactive_list_elem; 5071 5072 qdf_atomic_t mod_refs[DP_MOD_ID_MAX]; 5073 5074 uint8_t peer_state; 5075 qdf_spinlock_t peer_state_lock; 5076 #ifdef WLAN_SUPPORT_MSCS 5077 struct dp_peer_mscs_parameter mscs_ipv4_parameter, mscs_ipv6_parameter; 5078 bool mscs_active; 5079 #endif 5080 #ifdef WLAN_SUPPORT_MESH_LATENCY 5081 struct dp_peer_mesh_latency_parameter mesh_latency_params[DP_MAX_TIDS]; 5082 #endif 5083 #ifdef WLAN_FEATURE_11BE_MLO 5084 /* peer type */ 5085 enum cdp_peer_type peer_type; 5086 /*---------for link peer---------*/ 5087 struct dp_peer *mld_peer; 5088 5089 /*Link ID of link peer*/ 5090 uint8_t link_id; 5091 bool link_id_valid; 5092 uint8_t local_link_id; 5093 5094 /*---------for mld peer----------*/ 5095 struct dp_peer_link_info link_peers[DP_MAX_MLO_LINKS]; 5096 uint8_t num_links; 5097 DP_MUTEX_TYPE link_peers_info_lock; 5098 #ifdef WLAN_FEATURE_11BE_MLO_3_LINK_TX 5099 uint32_t flow_cnt[CDP_DATA_TID_MAX]; 5100 #endif 5101 #endif 5102 #ifdef CONFIG_SAWF_DEF_QUEUES 5103 struct dp_peer_sawf *sawf; 5104 #endif 5105 /* AST hash index for peer in HW */ 5106 uint16_t ast_idx; 5107 5108 /* AST hash value for peer in HW */ 5109 uint16_t ast_hash; 5110 5111 /* Peer Frequency */ 5112 uint32_t freq; 5113 }; 5114 5115 /** 5116 * struct dp_invalid_peer_msg - Invalid peer message 5117 * @nbuf: data buffer 5118 * @wh: 802.11 header 5119 * @vdev_id: id of vdev 5120 */ 5121 struct dp_invalid_peer_msg { 5122 qdf_nbuf_t nbuf; 5123 struct ieee80211_frame *wh; 5124 uint8_t vdev_id; 5125 }; 5126 5127 /** 5128 * struct dp_tx_me_buf_t - ME buffer 5129 * @next: pointer to next buffer 5130 * @data: Destination Mac address 5131 * @paddr_macbuf: physical address for dest_mac 5132 */ 5133 struct dp_tx_me_buf_t { 5134 /* Note: ME buf pool initialization logic expects next pointer to 5135 * be the first element. Dont add anything before next */ 5136 struct dp_tx_me_buf_t *next; 5137 uint8_t data[QDF_MAC_ADDR_SIZE]; 5138 qdf_dma_addr_t paddr_macbuf; 5139 }; 5140 5141 #if defined(WLAN_SUPPORT_RX_FLOW_TAG) || defined(WLAN_SUPPORT_RX_FISA) 5142 struct hal_rx_fst; 5143 #endif /* WLAN_SUPPORT_RX_FLOW_TAG || WLAN_SUPPORT_RX_FISA */ 5144 5145 #ifdef WLAN_SUPPORT_RX_FLOW_TAG 5146 struct dp_rx_fse { 5147 /* HAL Rx Flow Search Entry which matches HW definition */ 5148 void *hal_rx_fse; 5149 /* Toeplitz hash value */ 5150 uint32_t flow_hash; 5151 /* Flow index, equivalent to hash value truncated to FST size */ 5152 uint32_t flow_id; 5153 /* Stats tracking for this flow */ 5154 struct cdp_flow_stats stats; 5155 /* Flag indicating whether flow is IPv4 address tuple */ 5156 uint8_t is_ipv4_addr_entry; 5157 /* Flag indicating whether flow is valid */ 5158 uint8_t is_valid; 5159 }; 5160 5161 struct dp_rx_fst { 5162 /* Software (DP) FST */ 5163 uint8_t *base; 5164 /* Pointer to HAL FST */ 5165 struct hal_rx_fst *hal_rx_fst; 5166 /* Base physical address of HAL RX HW FST */ 5167 uint64_t hal_rx_fst_base_paddr; 5168 /* Maximum number of flows FSE supports */ 5169 uint16_t max_entries; 5170 /* Num entries in flow table */ 5171 uint16_t num_entries; 5172 /* SKID Length */ 5173 uint16_t max_skid_length; 5174 /* Hash mask to obtain legitimate hash entry */ 5175 uint32_t hash_mask; 5176 /* Timer for bundling of flows */ 5177 qdf_timer_t cache_invalidate_timer; 5178 /** 5179 * Flag which tracks whether cache update 5180 * is needed on timer expiry 5181 */ 5182 qdf_atomic_t is_cache_update_pending; 5183 /* Flag to indicate completion of FSE setup in HW/FW */ 5184 bool fse_setup_done; 5185 /* Last ring id used to add a flow */ 5186 uint8_t ring_id; 5187 }; 5188 5189 #define DP_RX_GET_SW_FT_ENTRY_SIZE sizeof(struct dp_rx_fse) 5190 5191 #endif /* WLAN_SUPPORT_RX_FLOW_TAG */ 5192 5193 #ifdef WLAN_FEATURE_STATS_EXT 5194 /** 5195 * struct dp_req_rx_hw_stats_t - RX peer HW stats query structure 5196 * @pending_tid_stats_cnt: pending tid stats count which waits for REO status 5197 * @is_query_timeout: flag to show is stats query timeout 5198 */ 5199 struct dp_req_rx_hw_stats_t { 5200 qdf_atomic_t pending_tid_stats_cnt; 5201 bool is_query_timeout; 5202 }; 5203 #endif 5204 /* soc level structure to declare arch specific ops for DP */ 5205 5206 #ifndef WLAN_SOFTUMAC_SUPPORT 5207 /** 5208 * dp_hw_link_desc_pool_banks_free() - Free h/w link desc pool banks 5209 * @soc: DP SOC handle 5210 * @mac_id: mac id 5211 * 5212 * Return: none 5213 */ 5214 void dp_hw_link_desc_pool_banks_free(struct dp_soc *soc, uint32_t mac_id); 5215 5216 /** 5217 * dp_hw_link_desc_pool_banks_alloc() - Allocate h/w link desc pool banks 5218 * @soc: DP SOC handle 5219 * @mac_id: mac id 5220 * 5221 * Allocates memory pages for link descriptors, the page size is 4K for 5222 * MCL and 2MB for WIN. if the mac_id is invalid link descriptor pages are 5223 * allocated for regular RX/TX and if the there is a proper mac_id link 5224 * descriptors are allocated for RX monitor mode. 5225 * 5226 * Return: QDF_STATUS_SUCCESS: Success 5227 * QDF_STATUS_E_FAILURE: Failure 5228 */ 5229 QDF_STATUS dp_hw_link_desc_pool_banks_alloc(struct dp_soc *soc, 5230 uint32_t mac_id); 5231 #else 5232 static inline void dp_hw_link_desc_pool_banks_free(struct dp_soc *soc, 5233 uint32_t mac_id) 5234 { 5235 } 5236 5237 static inline QDF_STATUS dp_hw_link_desc_pool_banks_alloc(struct dp_soc *soc, 5238 uint32_t mac_id) 5239 { 5240 return QDF_STATUS_SUCCESS; 5241 } 5242 #endif 5243 5244 /** 5245 * dp_link_desc_ring_replenish() - Replenish hw link desc rings 5246 * @soc: DP SOC handle 5247 * @mac_id: mac id 5248 * 5249 * Return: None 5250 */ 5251 void dp_link_desc_ring_replenish(struct dp_soc *soc, uint32_t mac_id); 5252 5253 #ifdef WLAN_FEATURE_RX_PREALLOC_BUFFER_POOL 5254 void dp_rx_refill_buff_pool_enqueue(struct dp_soc *soc); 5255 #else 5256 static inline void dp_rx_refill_buff_pool_enqueue(struct dp_soc *soc) {} 5257 #endif 5258 5259 /** 5260 * dp_srng_alloc() - Allocate memory for SRNG 5261 * @soc : Data path soc handle 5262 * @srng : SRNG pointer 5263 * @ring_type : Ring Type 5264 * @num_entries: Number of entries 5265 * @cached: cached flag variable 5266 * 5267 * Return: QDF_STATUS 5268 */ 5269 QDF_STATUS dp_srng_alloc(struct dp_soc *soc, struct dp_srng *srng, 5270 int ring_type, uint32_t num_entries, 5271 bool cached); 5272 5273 /** 5274 * dp_srng_free() - Free SRNG memory 5275 * @soc: Data path soc handle 5276 * @srng: SRNG pointer 5277 * 5278 * Return: None 5279 */ 5280 void dp_srng_free(struct dp_soc *soc, struct dp_srng *srng); 5281 5282 /** 5283 * dp_srng_init() - Initialize SRNG 5284 * @soc : Data path soc handle 5285 * @srng : SRNG pointer 5286 * @ring_type : Ring Type 5287 * @ring_num: Ring number 5288 * @mac_id: mac_id 5289 * 5290 * Return: QDF_STATUS 5291 */ 5292 QDF_STATUS dp_srng_init(struct dp_soc *soc, struct dp_srng *srng, 5293 int ring_type, int ring_num, int mac_id); 5294 5295 /** 5296 * dp_srng_init_idx() - Initialize SRNG 5297 * @soc : Data path soc handle 5298 * @srng : SRNG pointer 5299 * @ring_type : Ring Type 5300 * @ring_num: Ring number 5301 * @mac_id: mac_id 5302 * @idx: ring index 5303 * 5304 * Return: QDF_STATUS 5305 */ 5306 QDF_STATUS dp_srng_init_idx(struct dp_soc *soc, struct dp_srng *srng, 5307 int ring_type, int ring_num, int mac_id, 5308 uint32_t idx); 5309 5310 /** 5311 * dp_srng_deinit() - Internal function to deinit SRNG rings used by data path 5312 * @soc: DP SOC handle 5313 * @srng: source ring structure 5314 * @ring_type: type of ring 5315 * @ring_num: ring number 5316 * 5317 * Return: None 5318 */ 5319 void dp_srng_deinit(struct dp_soc *soc, struct dp_srng *srng, 5320 int ring_type, int ring_num); 5321 5322 void dp_print_peer_txrx_stats_be(struct cdp_peer_stats *peer_stats, 5323 enum peer_stats_type stats_type); 5324 void dp_print_peer_txrx_stats_li(struct cdp_peer_stats *peer_stats, 5325 enum peer_stats_type stats_type); 5326 5327 void dp_print_peer_txrx_stats_rh(struct cdp_peer_stats *peer_stats, 5328 enum peer_stats_type stats_type); 5329 5330 /** 5331 * dp_should_timer_irq_yield() - Decide if the bottom half should yield 5332 * @soc: DP soc handle 5333 * @work_done: work done in softirq context 5334 * @start_time: start time for the softirq 5335 * 5336 * Return: enum with yield code 5337 */ 5338 enum timer_yield_status 5339 dp_should_timer_irq_yield(struct dp_soc *soc, uint32_t work_done, 5340 uint64_t start_time); 5341 5342 /** 5343 * dp_vdev_get_default_reo_hash() - get reo dest ring and hash values for a vdev 5344 * @vdev: Datapath VDEV handle 5345 * @reo_dest: pointer to default reo_dest ring for vdev to be populated 5346 * @hash_based: pointer to hash value (enabled/disabled) to be populated 5347 * 5348 * Return: None 5349 */ 5350 void dp_vdev_get_default_reo_hash(struct dp_vdev *vdev, 5351 enum cdp_host_reo_dest_ring *reo_dest, 5352 bool *hash_based); 5353 5354 /** 5355 * dp_reo_remap_config() - configure reo remap register value based 5356 * nss configuration. 5357 * @soc: DP soc handle 5358 * @remap0: output parameter indicates reo remap 0 register value 5359 * @remap1: output parameter indicates reo remap 1 register value 5360 * @remap2: output parameter indicates reo remap 2 register value 5361 * 5362 * based on offload_radio value below remap configuration 5363 * get applied. 5364 * 0 - both Radios handled by host (remap rings 1, 2, 3 & 4) 5365 * 1 - 1st Radio handled by NSS (remap rings 2, 3 & 4) 5366 * 2 - 2nd Radio handled by NSS (remap rings 1, 2 & 4) 5367 * 3 - both Radios handled by NSS (remap not required) 5368 * 4 - IPA OFFLOAD enabled (remap rings 1,2 & 3) 5369 * 5370 * Return: bool type, true if remap is configured else false. 5371 */ 5372 5373 bool dp_reo_remap_config(struct dp_soc *soc, uint32_t *remap0, 5374 uint32_t *remap1, uint32_t *remap2); 5375 5376 #ifdef QCA_DP_TX_HW_SW_NBUF_DESC_PREFETCH 5377 /** 5378 * dp_tx_comp_get_prefetched_params_from_hal_desc() - Get prefetched TX desc 5379 * @soc: DP soc handle 5380 * @tx_comp_hal_desc: HAL TX Comp Descriptor 5381 * @r_tx_desc: SW Tx Descriptor retrieved from HAL desc. 5382 * 5383 * Return: None 5384 */ 5385 void dp_tx_comp_get_prefetched_params_from_hal_desc( 5386 struct dp_soc *soc, 5387 void *tx_comp_hal_desc, 5388 struct dp_tx_desc_s **r_tx_desc); 5389 #endif 5390 #endif /* _DP_TYPES_H_ */ 5391