1 /* 2 * Copyright (c) 2016-2019 The Linux Foundation. All rights reserved. 3 * 4 * Permission to use, copy, modify, and/or distribute this software for 5 * any purpose with or without fee is hereby granted, provided that the 6 * above copyright notice and this permission notice appear in all 7 * copies. 8 * 9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL 10 * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED 11 * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE 12 * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL 13 * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR 14 * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER 15 * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 16 * PERFORMANCE OF THIS SOFTWARE. 17 */ 18 19 #ifndef _DP_TYPES_H_ 20 #define _DP_TYPES_H_ 21 22 #include <qdf_types.h> 23 #include <qdf_nbuf.h> 24 #include <qdf_lock.h> 25 #include <qdf_atomic.h> 26 #include <qdf_util.h> 27 #include <qdf_list.h> 28 #include <qdf_lro.h> 29 #include <queue.h> 30 #include <htt_common.h> 31 32 #include <cdp_txrx_cmn.h> 33 #ifdef CONFIG_MCL 34 #include <cds_ieee80211_common.h> 35 #else 36 #include <linux/ieee80211.h> 37 #endif 38 39 #ifndef CONFIG_WIN 40 #include <wdi_event_api.h> /* WDI subscriber event list */ 41 #endif 42 43 #include "hal_hw_headers.h" 44 #include <hal_tx.h> 45 #include <hal_reo.h> 46 #include "wlan_cfg.h" 47 #include "hal_rx.h" 48 #include <hal_api.h> 49 #include <hal_api_mon.h> 50 #include "hal_rx.h" 51 52 #define MAX_BW 7 53 #define MAX_RETRIES 4 54 #define MAX_RECEPTION_TYPES 4 55 56 #ifndef REMOVE_PKT_LOG 57 #include <pktlog.h> 58 #endif 59 60 #define REPT_MU_MIMO 1 61 #define REPT_MU_OFDMA_MIMO 3 62 #define DP_VO_TID 6 63 64 #define DP_MAX_TID_MAPS 16 /* MAX TID MAPS AVAILABLE PER PDEV*/ 65 #define DSCP_TID_MAP_MAX (64) 66 #define DP_IP_DSCP_SHIFT 2 67 #define DP_IP_DSCP_MASK 0x3f 68 #define DP_FC0_SUBTYPE_QOS 0x80 69 #define DP_QOS_TID 0x0f 70 #define DP_IPV6_PRIORITY_SHIFT 20 71 #define MAX_MON_LINK_DESC_BANKS 2 72 #define DP_VDEV_ALL 0xff 73 74 #if defined(CONFIG_MCL) 75 #define MAX_PDEV_CNT 1 76 #else 77 #define MAX_PDEV_CNT 3 78 #endif 79 80 #define MAX_LINK_DESC_BANKS 8 81 #define MAX_TXDESC_POOLS 4 82 #define MAX_RXDESC_POOLS 4 83 #define MAX_REO_DEST_RINGS 4 84 #define MAX_TCL_DATA_RINGS 4 85 #define MAX_IDLE_SCATTER_BUFS 16 86 #define DP_MAX_IRQ_PER_CONTEXT 12 87 #define DEFAULT_HW_PEER_ID 0xffff 88 89 #define MAX_TX_HW_QUEUES MAX_TCL_DATA_RINGS 90 91 92 /* Maximum retries for Delba per tid per peer */ 93 #define DP_MAX_DELBA_RETRY 3 94 95 #ifndef REMOVE_PKT_LOG 96 enum rx_pktlog_mode { 97 DP_RX_PKTLOG_DISABLED = 0, 98 DP_RX_PKTLOG_FULL, 99 DP_RX_PKTLOG_LITE, 100 }; 101 #endif 102 103 struct dp_soc_cmn; 104 struct dp_pdev; 105 struct dp_vdev; 106 struct dp_tx_desc_s; 107 struct dp_soc; 108 union dp_rx_desc_list_elem_t; 109 110 #define DP_PDEV_ITERATE_VDEV_LIST(_pdev, _vdev) \ 111 TAILQ_FOREACH((_vdev), &(_pdev)->vdev_list, vdev_list_elem) 112 113 #define DP_VDEV_ITERATE_PEER_LIST(_vdev, _peer) \ 114 TAILQ_FOREACH((_peer), &(_vdev)->peer_list, peer_list_elem) 115 116 #define DP_PEER_ITERATE_ASE_LIST(_peer, _ase, _temp_ase) \ 117 TAILQ_FOREACH_SAFE((_ase), &peer->ast_entry_list, ase_list_elem, (_temp_ase)) 118 119 #define DP_MUTEX_TYPE qdf_spinlock_t 120 121 #define DP_FRAME_IS_MULTICAST(_a) (*(_a) & 0x01) 122 #define DP_FRAME_IS_IPV4_MULTICAST(_a) (*(_a) == 0x01) 123 124 #define DP_FRAME_IS_IPV6_MULTICAST(_a) \ 125 ((_a)[0] == 0x33 && \ 126 (_a)[1] == 0x33) 127 128 #define DP_FRAME_IS_BROADCAST(_a) \ 129 ((_a)[0] == 0xff && \ 130 (_a)[1] == 0xff && \ 131 (_a)[2] == 0xff && \ 132 (_a)[3] == 0xff && \ 133 (_a)[4] == 0xff && \ 134 (_a)[5] == 0xff) 135 #define DP_FRAME_IS_SNAP(_llc) ((_llc)->llc_dsap == 0xaa && \ 136 (_llc)->llc_ssap == 0xaa && \ 137 (_llc)->llc_un.type_snap.control == 0x3) 138 #define DP_FRAME_IS_LLC(typeorlen) ((typeorlen) >= 0x600) 139 #define DP_FRAME_FC0_TYPE_MASK 0x0c 140 #define DP_FRAME_FC0_TYPE_DATA 0x08 141 #define DP_FRAME_IS_DATA(_frame) \ 142 (((_frame)->i_fc[0] & DP_FRAME_FC0_TYPE_MASK) == DP_FRAME_FC0_TYPE_DATA) 143 144 /** 145 * macros to convert hw mac id to sw mac id: 146 * mac ids used by hardware start from a value of 1 while 147 * those in host software start from a value of 0. Use the 148 * macros below to convert between mac ids used by software and 149 * hardware 150 */ 151 #define DP_SW2HW_MACID(id) ((id) + 1) 152 #define DP_HW2SW_MACID(id) ((id) > 0 ? ((id) - 1) : 0) 153 #define DP_MAC_ADDR_LEN 6 154 155 /** 156 * Number of Tx Queues 157 * enum and macro to define how many threshold levels is used 158 * for the AC based flow control 159 */ 160 #ifdef QCA_AC_BASED_FLOW_CONTROL 161 enum dp_fl_ctrl_threshold { 162 DP_TH_BE_BK = 0, 163 DP_TH_VI, 164 DP_TH_VO, 165 DP_TH_HI, 166 }; 167 168 #define FL_TH_MAX (4) 169 #define FL_TH_VI_PERCENTAGE (80) 170 #define FL_TH_VO_PERCENTAGE (60) 171 #define FL_TH_HI_PERCENTAGE (40) 172 #endif 173 174 /** 175 * enum dp_intr_mode 176 * @DP_INTR_LEGACY: Legacy/Line interrupts, for WIN 177 * @DP_INTR_MSI: MSI interrupts, for MCL 178 * @DP_INTR_POLL: Polling 179 */ 180 enum dp_intr_mode { 181 DP_INTR_LEGACY = 0, 182 DP_INTR_MSI, 183 DP_INTR_POLL, 184 }; 185 186 /** 187 * enum dp_tx_frm_type 188 * @dp_tx_frm_std: Regular frame, no added header fragments 189 * @dp_tx_frm_tso: TSO segment, with a modified IP header added 190 * @dp_tx_frm_sg: SG segment 191 * @dp_tx_frm_audio: Audio frames, a custom LLC/SNAP header added 192 * @dp_tx_frm_me: Multicast to Unicast Converted frame 193 * @dp_tx_frm_raw: Raw Frame 194 */ 195 enum dp_tx_frm_type { 196 dp_tx_frm_std = 0, 197 dp_tx_frm_tso, 198 dp_tx_frm_sg, 199 dp_tx_frm_audio, 200 dp_tx_frm_me, 201 dp_tx_frm_raw, 202 }; 203 204 /** 205 * enum dp_ast_type 206 * @dp_ast_type_wds: WDS peer AST type 207 * @dp_ast_type_static: static ast entry type 208 * @dp_ast_type_mec: Multicast echo ast entry type 209 */ 210 enum dp_ast_type { 211 dp_ast_type_wds = 0, 212 dp_ast_type_static, 213 dp_ast_type_mec, 214 }; 215 216 /** 217 * enum dp_nss_cfg 218 * @dp_nss_cfg_default: No radios are offloaded 219 * @dp_nss_cfg_first_radio: First radio offloaded 220 * @dp_nss_cfg_second_radio: Second radio offloaded 221 * @dp_nss_cfg_dbdc: Dual radios offloaded 222 * @dp_nss_cfg_dbtc: Three radios offloaded 223 */ 224 enum dp_nss_cfg { 225 dp_nss_cfg_default = 0x0, 226 dp_nss_cfg_first_radio = 0x1, 227 dp_nss_cfg_second_radio = 0x2, 228 dp_nss_cfg_dbdc = 0x3, 229 dp_nss_cfg_dbtc = 0x7, 230 dp_nss_cfg_max 231 }; 232 233 /** 234 * struct rx_desc_pool 235 * @pool_size: number of RX descriptor in the pool 236 * @array: pointer to array of RX descriptor 237 * @freelist: pointer to free RX descriptor link list 238 * @lock: Protection for the RX descriptor pool 239 * @owner: owner for nbuf 240 */ 241 struct rx_desc_pool { 242 uint32_t pool_size; 243 union dp_rx_desc_list_elem_t *array; 244 union dp_rx_desc_list_elem_t *freelist; 245 qdf_spinlock_t lock; 246 uint8_t owner; 247 }; 248 249 /** 250 * struct dp_tx_ext_desc_elem_s 251 * @next: next extension descriptor pointer 252 * @vaddr: hlos virtual address pointer 253 * @paddr: physical address pointer for descriptor 254 */ 255 struct dp_tx_ext_desc_elem_s { 256 struct dp_tx_ext_desc_elem_s *next; 257 void *vaddr; 258 qdf_dma_addr_t paddr; 259 }; 260 261 /** 262 * struct dp_tx_ext_desc_s - Tx Extension Descriptor Pool 263 * @elem_count: Number of descriptors in the pool 264 * @elem_size: Size of each descriptor 265 * @num_free: Number of free descriptors 266 * @msdu_ext_desc: MSDU extension descriptor 267 * @desc_pages: multiple page allocation information for actual descriptors 268 * @link_elem_size: size of the link descriptor in cacheable memory used for 269 * chaining the extension descriptors 270 * @desc_link_pages: multiple page allocation information for link descriptors 271 */ 272 struct dp_tx_ext_desc_pool_s { 273 uint16_t elem_count; 274 int elem_size; 275 uint16_t num_free; 276 struct qdf_mem_multi_page_t desc_pages; 277 int link_elem_size; 278 struct qdf_mem_multi_page_t desc_link_pages; 279 struct dp_tx_ext_desc_elem_s *freelist; 280 qdf_spinlock_t lock; 281 qdf_dma_mem_context(memctx); 282 }; 283 284 /** 285 * struct dp_tx_desc_s - Tx Descriptor 286 * @next: Next in the chain of descriptors in freelist or in the completion list 287 * @nbuf: Buffer Address 288 * @msdu_ext_desc: MSDU extension descriptor 289 * @id: Descriptor ID 290 * @vdev: vdev over which the packet was transmitted 291 * @pdev: Handle to pdev 292 * @pool_id: Pool ID - used when releasing the descriptor 293 * @flags: Flags to track the state of descriptor and special frame handling 294 * @comp: Pool ID - used when releasing the descriptor 295 * @tx_encap_type: Transmit encap type (i.e. Raw, Native Wi-Fi, Ethernet). 296 * This is maintained in descriptor to allow more efficient 297 * processing in completion event processing code. 298 * This field is filled in with the htt_pkt_type enum. 299 * @frm_type: Frame Type - ToDo check if this is redundant 300 * @pkt_offset: Offset from which the actual packet data starts 301 * @me_buffer: Pointer to ME buffer - store this so that it can be freed on 302 * Tx completion of ME packet 303 * @pool: handle to flow_pool this descriptor belongs to. 304 */ 305 struct dp_tx_desc_s { 306 struct dp_tx_desc_s *next; 307 qdf_nbuf_t nbuf; 308 struct dp_tx_ext_desc_elem_s *msdu_ext_desc; 309 uint32_t id; 310 struct dp_vdev *vdev; 311 struct dp_pdev *pdev; 312 uint8_t pool_id; 313 uint16_t flags; 314 struct hal_tx_desc_comp_s comp; 315 uint16_t tx_encap_type; 316 uint8_t frm_type; 317 uint8_t pkt_offset; 318 void *me_buffer; 319 void *tso_desc; 320 void *tso_num_desc; 321 uint64_t timestamp; 322 }; 323 324 /** 325 * enum flow_pool_status - flow pool status 326 * @FLOW_POOL_ACTIVE_UNPAUSED : pool is active (can take/put descriptors) 327 * and network queues are unpaused 328 * @FLOW_POOL_ACTIVE_PAUSED: pool is active (can take/put descriptors) 329 * and network queues are paused 330 * @FLOW_POOL_INVALID: pool is invalid (put descriptor) 331 * @FLOW_POOL_INACTIVE: pool is inactive (pool is free) 332 */ 333 enum flow_pool_status { 334 FLOW_POOL_ACTIVE_UNPAUSED = 0, 335 FLOW_POOL_ACTIVE_PAUSED = 1, 336 FLOW_POOL_BE_BK_PAUSED = 2, 337 FLOW_POOL_VI_PAUSED = 3, 338 FLOW_POOL_VO_PAUSED = 4, 339 FLOW_POOL_INVALID = 5, 340 FLOW_POOL_INACTIVE = 6, 341 }; 342 343 /** 344 * struct dp_tx_tso_seg_pool_s 345 * @pool_size: total number of pool elements 346 * @num_free: free element count 347 * @freelist: first free element pointer 348 * @desc_pages: multiple page allocation information for actual descriptors 349 * @lock: lock for accessing the pool 350 */ 351 struct dp_tx_tso_seg_pool_s { 352 uint16_t pool_size; 353 uint16_t num_free; 354 struct qdf_tso_seg_elem_t *freelist; 355 struct qdf_mem_multi_page_t desc_pages; 356 qdf_spinlock_t lock; 357 }; 358 359 /** 360 * struct dp_tx_tso_num_seg_pool_s { 361 * @num_seg_pool_size: total number of pool elements 362 * @num_free: free element count 363 * @freelist: first free element pointer 364 * @desc_pages: multiple page allocation information for actual descriptors 365 * @lock: lock for accessing the pool 366 */ 367 368 struct dp_tx_tso_num_seg_pool_s { 369 uint16_t num_seg_pool_size; 370 uint16_t num_free; 371 struct qdf_tso_num_seg_elem_t *freelist; 372 struct qdf_mem_multi_page_t desc_pages; 373 /*tso mutex */ 374 qdf_spinlock_t lock; 375 }; 376 377 /** 378 * struct dp_tx_desc_pool_s - Tx Descriptor pool information 379 * @elem_size: Size of each descriptor in the pool 380 * @pool_size: Total number of descriptors in the pool 381 * @num_free: Number of free descriptors 382 * @num_allocated: Number of used descriptors 383 * @freelist: Chain of free descriptors 384 * @desc_pages: multiple page allocation information for actual descriptors 385 * @num_invalid_bin: Deleted pool with pending Tx completions. 386 * @flow_pool_array_lock: Lock when operating on flow_pool_array. 387 * @flow_pool_array: List of allocated flow pools 388 * @lock- Lock for descriptor allocation/free from/to the pool 389 */ 390 struct dp_tx_desc_pool_s { 391 uint16_t elem_size; 392 uint32_t num_allocated; 393 struct dp_tx_desc_s *freelist; 394 struct qdf_mem_multi_page_t desc_pages; 395 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 396 uint16_t pool_size; 397 uint8_t flow_pool_id; 398 uint8_t num_invalid_bin; 399 uint16_t avail_desc; 400 enum flow_pool_status status; 401 enum htt_flow_type flow_type; 402 #ifdef QCA_AC_BASED_FLOW_CONTROL 403 uint16_t stop_th[FL_TH_MAX]; 404 uint16_t start_th[FL_TH_MAX]; 405 qdf_time_t max_pause_time[FL_TH_MAX]; 406 qdf_time_t latest_pause_time[FL_TH_MAX]; 407 #else 408 uint16_t stop_th; 409 uint16_t start_th; 410 #endif 411 uint16_t pkt_drop_no_desc; 412 qdf_spinlock_t flow_pool_lock; 413 uint8_t pool_create_cnt; 414 void *pool_owner_ctx; 415 #else 416 uint16_t elem_count; 417 uint32_t num_free; 418 qdf_spinlock_t lock; 419 #endif 420 }; 421 422 /** 423 * struct dp_txrx_pool_stats - flow pool related statistics 424 * @pool_map_count: flow pool map received 425 * @pool_unmap_count: flow pool unmap received 426 * @pkt_drop_no_pool: packets dropped due to unavailablity of pool 427 */ 428 struct dp_txrx_pool_stats { 429 uint16_t pool_map_count; 430 uint16_t pool_unmap_count; 431 uint16_t pkt_drop_no_pool; 432 }; 433 434 struct dp_srng { 435 void *hal_srng; 436 void *base_vaddr_unaligned; 437 qdf_dma_addr_t base_paddr_unaligned; 438 uint32_t alloc_size; 439 int irq; 440 uint32_t num_entries; 441 }; 442 443 struct dp_rx_reorder_array_elem { 444 qdf_nbuf_t head; 445 qdf_nbuf_t tail; 446 }; 447 448 #define DP_RX_BA_INACTIVE 0 449 #define DP_RX_BA_ACTIVE 1 450 #define DP_RX_BA_IN_PROGRESS 2 451 struct dp_reo_cmd_info { 452 uint16_t cmd; 453 enum hal_reo_cmd_type cmd_type; 454 void *data; 455 void (*handler)(struct dp_soc *, void *, union hal_reo_status *); 456 TAILQ_ENTRY(dp_reo_cmd_info) reo_cmd_list_elem; 457 }; 458 459 /* Rx TID */ 460 struct dp_rx_tid { 461 /* TID */ 462 int tid; 463 464 /* Num of addba requests */ 465 uint32_t num_of_addba_req; 466 467 /* Num of addba responses */ 468 uint32_t num_of_addba_resp; 469 470 /* Num of delba requests */ 471 uint32_t num_of_delba_req; 472 473 /* Num of addba responses successful */ 474 uint32_t num_addba_rsp_success; 475 476 /* Num of addba responses failed */ 477 uint32_t num_addba_rsp_failed; 478 479 /* pn size */ 480 uint8_t pn_size; 481 /* REO TID queue descriptors */ 482 void *hw_qdesc_vaddr_unaligned; 483 qdf_dma_addr_t hw_qdesc_paddr_unaligned; 484 qdf_dma_addr_t hw_qdesc_paddr; 485 uint32_t hw_qdesc_alloc_size; 486 487 /* RX ADDBA session state */ 488 int ba_status; 489 490 /* RX BA window size */ 491 uint16_t ba_win_size; 492 493 /* Starting sequence number in Addba request */ 494 uint16_t startseqnum; 495 496 /* TODO: Check the following while adding defragmentation support */ 497 struct dp_rx_reorder_array_elem *array; 498 /* base - single rx reorder element used for non-aggr cases */ 499 struct dp_rx_reorder_array_elem base; 500 501 /* only used for defrag right now */ 502 TAILQ_ENTRY(dp_rx_tid) defrag_waitlist_elem; 503 504 /* Store dst desc for reinjection */ 505 void *dst_ring_desc; 506 struct dp_rx_desc *head_frag_desc; 507 508 /* rx_tid lock */ 509 qdf_spinlock_t tid_lock; 510 511 /* Sequence and fragments that are being processed currently */ 512 uint32_t curr_seq_num; 513 uint32_t curr_frag_num; 514 515 uint32_t defrag_timeout_ms; 516 uint16_t dialogtoken; 517 uint16_t statuscode; 518 /* user defined ADDBA response status code */ 519 uint16_t userstatuscode; 520 521 /* Store ppdu_id when 2k exception is received */ 522 uint32_t ppdu_id_2k; 523 524 /* Delba Tx completion status */ 525 uint8_t delba_tx_status; 526 527 /* Delba Tx retry count */ 528 uint8_t delba_tx_retry; 529 530 /* Delba stats */ 531 uint32_t delba_tx_success_cnt; 532 uint32_t delba_tx_fail_cnt; 533 534 /* Delba reason code for retries */ 535 uint8_t delba_rcode; 536 537 }; 538 539 /* per interrupt context */ 540 struct dp_intr { 541 uint8_t tx_ring_mask; /* WBM Tx completion rings (0-2) 542 associated with this napi context */ 543 uint8_t rx_ring_mask; /* Rx REO rings (0-3) associated 544 with this interrupt context */ 545 uint8_t rx_mon_ring_mask; /* Rx monitor ring mask (0-2) */ 546 uint8_t rx_err_ring_mask; /* REO Exception Ring */ 547 uint8_t rx_wbm_rel_ring_mask; /* WBM2SW Rx Release Ring */ 548 uint8_t reo_status_ring_mask; /* REO command response ring */ 549 uint8_t rxdma2host_ring_mask; /* RXDMA to host destination ring */ 550 uint8_t host2rxdma_ring_mask; /* Host to RXDMA buffer ring */ 551 /* Host to RXDMA monitor buffer ring */ 552 uint8_t host2rxdma_mon_ring_mask; 553 struct dp_soc *soc; /* Reference to SoC structure , 554 to get DMA ring handles */ 555 qdf_lro_ctx_t lro_ctx; 556 uint8_t dp_intr_id; 557 }; 558 559 #define REO_DESC_FREELIST_SIZE 64 560 #define REO_DESC_FREE_DEFER_MS 1000 561 struct reo_desc_list_node { 562 qdf_list_node_t node; 563 unsigned long free_ts; 564 struct dp_rx_tid rx_tid; 565 }; 566 567 /* SoC level data path statistics */ 568 struct dp_soc_stats { 569 struct { 570 uint32_t added; 571 uint32_t deleted; 572 uint32_t aged_out; 573 } ast; 574 575 /* SOC level TX stats */ 576 struct { 577 /* packets dropped on tx because of no peer */ 578 struct cdp_pkt_info tx_invalid_peer; 579 /* descriptors in each tcl ring */ 580 uint32_t tcl_ring_full[MAX_TCL_DATA_RINGS]; 581 /* Descriptors in use at soc */ 582 uint32_t desc_in_use; 583 /* tqm_release_reason == FW removed */ 584 uint32_t dropped_fw_removed; 585 586 } tx; 587 588 /* SOC level RX stats */ 589 struct { 590 /* Rx errors */ 591 /* Total Packets in Rx Error ring */ 592 uint32_t err_ring_pkts; 593 /* No of Fragments */ 594 uint32_t rx_frags; 595 /* No of incomplete fragments in waitlist */ 596 uint32_t rx_frag_wait; 597 /* Fragments dropped due to errors */ 598 uint32_t rx_frag_err; 599 /* No of reinjected packets */ 600 uint32_t reo_reinject; 601 /* Head pointer Out of sync */ 602 uint32_t hp_oos; 603 struct { 604 /* Invalid RBM error count */ 605 uint32_t invalid_rbm; 606 /* Invalid VDEV Error count */ 607 uint32_t invalid_vdev; 608 /* Invalid PDEV error count */ 609 uint32_t invalid_pdev; 610 /* Invalid PEER Error count */ 611 struct cdp_pkt_info rx_invalid_peer; 612 /* HAL ring access Fail error count */ 613 uint32_t hal_ring_access_fail; 614 /* RX DMA error count */ 615 uint32_t rxdma_error[HAL_RXDMA_ERR_MAX]; 616 /* REO Error count */ 617 uint32_t reo_error[HAL_REO_ERR_MAX]; 618 /* HAL REO ERR Count */ 619 uint32_t hal_reo_error[MAX_REO_DEST_RINGS]; 620 /* HAL REO DEST Duplicate count */ 621 uint32_t hal_reo_dest_dup; 622 /* HAL WBM RELEASE Duplicate count */ 623 uint32_t hal_wbm_rel_dup; 624 } err; 625 626 /* packet count per core - per ring */ 627 uint64_t ring_packets[NR_CPUS][MAX_REO_DEST_RINGS]; 628 } rx; 629 }; 630 631 #define DP_MAC_ADDR_LEN 6 632 union dp_align_mac_addr { 633 uint8_t raw[DP_MAC_ADDR_LEN]; 634 struct { 635 uint16_t bytes_ab; 636 uint16_t bytes_cd; 637 uint16_t bytes_ef; 638 } align2; 639 struct { 640 uint32_t bytes_abcd; 641 uint16_t bytes_ef; 642 } align4; 643 struct __attribute__((__packed__)) { 644 uint16_t bytes_ab; 645 uint32_t bytes_cdef; 646 } align4_2; 647 }; 648 649 /** 650 * struct dp_ast_free_cb_params - HMWDS free callback cookie 651 * @mac_addr: ast mac address 652 * @peer_mac_addr: mac address of peer 653 * @type: ast entry type 654 * @vdev_id: vdev_id 655 * @flags: ast flags 656 */ 657 struct dp_ast_free_cb_params { 658 union dp_align_mac_addr mac_addr; 659 union dp_align_mac_addr peer_mac_addr; 660 enum cdp_txrx_ast_entry_type type; 661 uint8_t vdev_id; 662 uint32_t flags; 663 }; 664 665 /* 666 * dp_ast_entry 667 * 668 * @ast_idx: Hardware AST Index 669 * @mac_addr: MAC Address for this AST entry 670 * @peer: Next Hop peer (for non-WDS nodes, this will be point to 671 * associated peer with this MAC address) 672 * @next_hop: Set to 1 if this is for a WDS node 673 * @is_active: flag to indicate active data traffic on this node 674 * (used for aging out/expiry) 675 * @ase_list_elem: node in peer AST list 676 * @is_bss: flag to indicate if entry corresponds to bss peer 677 * @is_mapped: flag to indicate that we have mapped the AST entry 678 * in ast_table 679 * @pdev_id: pdev ID 680 * @vdev_id: vdev ID 681 * @ast_hash_value: hast value in HW 682 * @ref_cnt: reference count 683 * @type: flag to indicate type of the entry(static/WDS/MEC) 684 * @delete_in_progress: Flag to indicate that delete commands send to FW 685 * and host is waiting for response from FW 686 * @callback: ast free/unmap callback 687 * @cookie: argument to callback 688 * @hash_list_elem: node in soc AST hash list (mac address used as hash) 689 */ 690 struct dp_ast_entry { 691 uint16_t ast_idx; 692 union dp_align_mac_addr mac_addr; 693 struct dp_peer *peer; 694 bool next_hop; 695 bool is_active; 696 bool is_bss; 697 bool is_mapped; 698 uint8_t pdev_id; 699 uint8_t vdev_id; 700 uint16_t ast_hash_value; 701 qdf_atomic_t ref_cnt; 702 enum cdp_txrx_ast_entry_type type; 703 bool delete_in_progress; 704 txrx_ast_free_cb callback; 705 void *cookie; 706 TAILQ_ENTRY(dp_ast_entry) ase_list_elem; 707 TAILQ_ENTRY(dp_ast_entry) hash_list_elem; 708 }; 709 710 /* SOC level htt stats */ 711 struct htt_t2h_stats { 712 /* lock to protect htt_stats_msg update */ 713 qdf_spinlock_t lock; 714 715 /* work queue to process htt stats */ 716 qdf_work_t work; 717 718 /* T2H Ext stats message queue */ 719 qdf_nbuf_queue_t msg; 720 721 /* number of completed stats in htt_stats_msg */ 722 uint32_t num_stats; 723 }; 724 725 /* SOC level structure for data path */ 726 struct dp_soc { 727 /** 728 * re-use memory section starts 729 */ 730 731 /* Common base structure - Should be the first member */ 732 struct cdp_soc_t cdp_soc; 733 734 /* SoC Obj */ 735 void *ctrl_psoc; 736 737 /* OS device abstraction */ 738 qdf_device_t osdev; 739 740 /* WLAN config context */ 741 struct wlan_cfg_dp_soc_ctxt *wlan_cfg_ctx; 742 743 /* HTT handle for host-fw interaction */ 744 void *htt_handle; 745 746 /* Commint init done */ 747 qdf_atomic_t cmn_init_done; 748 749 /* Opaque hif handle */ 750 struct hif_opaque_softc *hif_handle; 751 752 /* PDEVs on this SOC */ 753 struct dp_pdev *pdev_list[MAX_PDEV_CNT]; 754 755 /* Number of PDEVs */ 756 uint8_t pdev_count; 757 758 /*cce disable*/ 759 bool cce_disable; 760 761 /*ast override support in HW*/ 762 bool ast_override_support; 763 764 /*number of hw dscp tid map*/ 765 uint8_t num_hw_dscp_tid_map; 766 767 /* HAL SOC handle */ 768 void *hal_soc; 769 770 /* Device ID coming from Bus sub-system */ 771 uint32_t device_id; 772 773 /* Link descriptor memory banks */ 774 struct { 775 void *base_vaddr_unaligned; 776 void *base_vaddr; 777 qdf_dma_addr_t base_paddr_unaligned; 778 qdf_dma_addr_t base_paddr; 779 uint32_t size; 780 } link_desc_banks[MAX_LINK_DESC_BANKS]; 781 782 /* Link descriptor Idle list for HW internal use (SRNG mode) */ 783 struct dp_srng wbm_idle_link_ring; 784 785 /* Link descriptor Idle list for HW internal use (scatter buffer mode) 786 */ 787 qdf_dma_addr_t wbm_idle_scatter_buf_base_paddr[MAX_IDLE_SCATTER_BUFS]; 788 void *wbm_idle_scatter_buf_base_vaddr[MAX_IDLE_SCATTER_BUFS]; 789 790 /* Tx SW descriptor pool */ 791 struct dp_tx_desc_pool_s tx_desc[MAX_TXDESC_POOLS]; 792 793 /* Tx MSDU Extension descriptor pool */ 794 struct dp_tx_ext_desc_pool_s tx_ext_desc[MAX_TXDESC_POOLS]; 795 796 /* Tx TSO descriptor pool */ 797 struct dp_tx_tso_seg_pool_s tx_tso_desc[MAX_TXDESC_POOLS]; 798 799 /* Tx TSO Num of segments pool */ 800 struct dp_tx_tso_num_seg_pool_s tx_tso_num_seg[MAX_TXDESC_POOLS]; 801 802 /* REO destination rings */ 803 struct dp_srng reo_dest_ring[MAX_REO_DEST_RINGS]; 804 805 /* REO exception ring - See if should combine this with reo_dest_ring */ 806 struct dp_srng reo_exception_ring; 807 808 /* REO reinjection ring */ 809 struct dp_srng reo_reinject_ring; 810 811 /* REO command ring */ 812 struct dp_srng reo_cmd_ring; 813 814 /* REO command status ring */ 815 struct dp_srng reo_status_ring; 816 817 /* WBM Rx release ring */ 818 struct dp_srng rx_rel_ring; 819 820 /* TCL data ring */ 821 struct dp_srng tcl_data_ring[MAX_TCL_DATA_RINGS]; 822 823 /* Number of TCL data rings */ 824 uint8_t num_tcl_data_rings; 825 826 /* TCL command ring */ 827 struct dp_srng tcl_cmd_ring; 828 829 /* TCL command status ring */ 830 struct dp_srng tcl_status_ring; 831 832 /* WBM Tx completion rings */ 833 struct dp_srng tx_comp_ring[MAX_TCL_DATA_RINGS]; 834 835 /* Common WBM link descriptor release ring (SW to WBM) */ 836 struct dp_srng wbm_desc_rel_ring; 837 838 /* DP Interrupts */ 839 struct dp_intr intr_ctx[WLAN_CFG_INT_NUM_CONTEXTS]; 840 841 /* Rx SW descriptor pool for RXDMA monitor buffer */ 842 struct rx_desc_pool rx_desc_mon[MAX_RXDESC_POOLS]; 843 844 /* Rx SW descriptor pool for RXDMA status buffer */ 845 struct rx_desc_pool rx_desc_status[MAX_RXDESC_POOLS]; 846 847 /* Rx SW descriptor pool for RXDMA buffer */ 848 struct rx_desc_pool rx_desc_buf[MAX_RXDESC_POOLS]; 849 850 /* Number of REO destination rings */ 851 uint8_t num_reo_dest_rings; 852 853 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 854 /* lock to control access to soc TX descriptors */ 855 qdf_spinlock_t flow_pool_array_lock; 856 857 /* pause callback to pause TX queues as per flow control */ 858 tx_pause_callback pause_cb; 859 860 /* flow pool related statistics */ 861 struct dp_txrx_pool_stats pool_stats; 862 #endif /* !QCA_LL_TX_FLOW_CONTROL_V2 */ 863 864 /* 865 * Re-use memory section ends. reuse memory indicator. 866 * Everything above this variable "dp_soc_reinit" is retained across 867 * WiFi up/down for AP use-cases. 868 * Everything below this variable "dp_soc_reinit" is reset during 869 * dp_soc_deinit. 870 */ 871 bool dp_soc_reinit; 872 873 uint32_t wbm_idle_scatter_buf_size; 874 875 /* Tx H/W queues lock */ 876 qdf_spinlock_t tx_queue_lock[MAX_TX_HW_QUEUES]; 877 878 /* Tx ring map for interrupt processing */ 879 uint8_t tx_ring_map[WLAN_CFG_INT_NUM_CONTEXTS]; 880 881 /* Rx ring map for interrupt processing */ 882 uint8_t rx_ring_map[WLAN_CFG_INT_NUM_CONTEXTS]; 883 884 /* peer ID to peer object map (array of pointers to peer objects) */ 885 struct dp_peer **peer_id_to_obj_map; 886 887 struct { 888 unsigned mask; 889 unsigned idx_bits; 890 TAILQ_HEAD(, dp_peer) * bins; 891 } peer_hash; 892 893 /* rx defrag state – TBD: do we need this per radio? */ 894 struct { 895 struct { 896 TAILQ_HEAD(, dp_rx_tid) waitlist; 897 uint32_t timeout_ms; 898 qdf_spinlock_t defrag_lock; 899 } defrag; 900 struct { 901 int defrag_timeout_check; 902 int dup_check; 903 } flags; 904 TAILQ_HEAD(, dp_reo_cmd_info) reo_cmd_list; 905 qdf_spinlock_t reo_cmd_lock; 906 } rx; 907 908 /* optional rx processing function */ 909 void (*rx_opt_proc)( 910 struct dp_vdev *vdev, 911 struct dp_peer *peer, 912 unsigned tid, 913 qdf_nbuf_t msdu_list); 914 915 /* pool addr for mcast enhance buff */ 916 struct { 917 int size; 918 uint32_t paddr; 919 uint32_t *vaddr; 920 struct dp_tx_me_buf_t *freelist; 921 int buf_in_use; 922 qdf_dma_mem_context(memctx); 923 } me_buf; 924 925 /** 926 * peer ref mutex: 927 * 1. Protect peer object lookups until the returned peer object's 928 * reference count is incremented. 929 * 2. Provide mutex when accessing peer object lookup structures. 930 */ 931 DP_MUTEX_TYPE peer_ref_mutex; 932 933 /* maximum value for peer_id */ 934 uint32_t max_peers; 935 936 /* SoC level data path statistics */ 937 struct dp_soc_stats stats; 938 939 /* Enable processing of Tx completion status words */ 940 bool process_tx_status; 941 bool process_rx_status; 942 struct dp_ast_entry *ast_table[WLAN_UMAC_PSOC_MAX_PEERS * 2]; 943 struct { 944 unsigned mask; 945 unsigned idx_bits; 946 TAILQ_HEAD(, dp_ast_entry) * bins; 947 } ast_hash; 948 949 qdf_spinlock_t ast_lock; 950 /*Timer for AST entry ageout maintainance */ 951 qdf_timer_t ast_aging_timer; 952 953 /*Timer counter for WDS AST entry ageout*/ 954 uint8_t wds_ast_aging_timer_cnt; 955 956 /*interrupt timer*/ 957 qdf_timer_t mon_reap_timer; 958 uint8_t reap_timer_init; 959 qdf_timer_t int_timer; 960 uint8_t intr_mode; 961 962 qdf_list_t reo_desc_freelist; 963 qdf_spinlock_t reo_desc_freelist_lock; 964 965 /* htt stats */ 966 struct htt_t2h_stats htt_stats; 967 968 void *external_txrx_handle; /* External data path handle */ 969 #ifdef IPA_OFFLOAD 970 /* IPA uC datapath offload Wlan Tx resources */ 971 struct { 972 /* Resource info to be passed to IPA */ 973 qdf_dma_addr_t ipa_tcl_ring_base_paddr; 974 void *ipa_tcl_ring_base_vaddr; 975 uint32_t ipa_tcl_ring_size; 976 qdf_dma_addr_t ipa_tcl_hp_paddr; 977 uint32_t alloc_tx_buf_cnt; 978 979 qdf_dma_addr_t ipa_wbm_ring_base_paddr; 980 void *ipa_wbm_ring_base_vaddr; 981 uint32_t ipa_wbm_ring_size; 982 qdf_dma_addr_t ipa_wbm_tp_paddr; 983 984 /* TX buffers populated into the WBM ring */ 985 void **tx_buf_pool_vaddr_unaligned; 986 qdf_dma_addr_t *tx_buf_pool_paddr_unaligned; 987 } ipa_uc_tx_rsc; 988 989 /* IPA uC datapath offload Wlan Rx resources */ 990 struct { 991 /* Resource info to be passed to IPA */ 992 qdf_dma_addr_t ipa_reo_ring_base_paddr; 993 void *ipa_reo_ring_base_vaddr; 994 uint32_t ipa_reo_ring_size; 995 qdf_dma_addr_t ipa_reo_tp_paddr; 996 997 /* Resource info to be passed to firmware and IPA */ 998 qdf_dma_addr_t ipa_rx_refill_buf_ring_base_paddr; 999 void *ipa_rx_refill_buf_ring_base_vaddr; 1000 uint32_t ipa_rx_refill_buf_ring_size; 1001 qdf_dma_addr_t ipa_rx_refill_buf_hp_paddr; 1002 } ipa_uc_rx_rsc; 1003 #endif 1004 1005 /* Smart monitor capability for HKv2 */ 1006 uint8_t hw_nac_monitor_support; 1007 /* Flag to indicate if HTT v2 is enabled*/ 1008 bool is_peer_map_unmap_v2; 1009 /* Per peer per Tid ba window size support */ 1010 uint8_t per_tid_basize_max_tid; 1011 /* Soc level flag to enable da_war */ 1012 uint8_t da_war_enabled; 1013 }; 1014 1015 #ifdef IPA_OFFLOAD 1016 /** 1017 * dp_ipa_resources - Resources needed for IPA 1018 */ 1019 struct dp_ipa_resources { 1020 qdf_dma_addr_t tx_ring_base_paddr; 1021 uint32_t tx_ring_size; 1022 uint32_t tx_num_alloc_buffer; 1023 1024 qdf_dma_addr_t tx_comp_ring_base_paddr; 1025 uint32_t tx_comp_ring_size; 1026 1027 qdf_dma_addr_t rx_rdy_ring_base_paddr; 1028 uint32_t rx_rdy_ring_size; 1029 1030 qdf_dma_addr_t rx_refill_ring_base_paddr; 1031 uint32_t rx_refill_ring_size; 1032 1033 /* IPA UC doorbell registers paddr */ 1034 qdf_dma_addr_t tx_comp_doorbell_paddr; 1035 uint32_t *tx_comp_doorbell_vaddr; 1036 qdf_dma_addr_t rx_ready_doorbell_paddr; 1037 }; 1038 #endif 1039 1040 #define MAX_RX_MAC_RINGS 2 1041 /* Same as NAC_MAX_CLENT */ 1042 #define DP_NAC_MAX_CLIENT 24 1043 1044 /* 1045 * Macros to setup link descriptor cookies - for link descriptors, we just 1046 * need first 3 bits to store bank ID. The remaining bytes will be used set a 1047 * unique ID, which will be useful in debugging 1048 */ 1049 #define LINK_DESC_BANK_ID_MASK 0x7 1050 #define LINK_DESC_ID_SHIFT 3 1051 #define LINK_DESC_ID_START 0x8000 1052 1053 #define LINK_DESC_COOKIE(_desc_id, _bank_id) \ 1054 ((((_desc_id) + LINK_DESC_ID_START) << LINK_DESC_ID_SHIFT) | (_bank_id)) 1055 1056 #define LINK_DESC_COOKIE_BANK_ID(_cookie) \ 1057 ((_cookie) & LINK_DESC_BANK_ID_MASK) 1058 1059 /* same as ieee80211_nac_param */ 1060 enum dp_nac_param_cmd { 1061 /* IEEE80211_NAC_PARAM_ADD */ 1062 DP_NAC_PARAM_ADD = 1, 1063 /* IEEE80211_NAC_PARAM_DEL */ 1064 DP_NAC_PARAM_DEL, 1065 /* IEEE80211_NAC_PARAM_LIST */ 1066 DP_NAC_PARAM_LIST, 1067 }; 1068 1069 /** 1070 * struct dp_neighbour_peer - neighbour peer list type for smart mesh 1071 * @neighbour_peers_macaddr: neighbour peer's mac address 1072 * @neighbour_peer_list_elem: neighbour peer list TAILQ element 1073 * @ast_entry: ast_entry for neighbour peer 1074 * @rssi: rssi value 1075 */ 1076 struct dp_neighbour_peer { 1077 /* MAC address of neighbour's peer */ 1078 union dp_align_mac_addr neighbour_peers_macaddr; 1079 struct dp_vdev *vdev; 1080 struct dp_ast_entry *ast_entry; 1081 uint8_t rssi; 1082 /* node in the list of neighbour's peer */ 1083 TAILQ_ENTRY(dp_neighbour_peer) neighbour_peer_list_elem; 1084 }; 1085 1086 /** 1087 * struct ppdu_info - PPDU Status info descriptor 1088 * @ppdu_id - Unique ppduid assigned by firmware for every tx packet 1089 * @max_ppdu_id - wrap around for ppdu id 1090 * @last_tlv_cnt - Keep track for missing ppdu tlvs 1091 * @last_user - last ppdu processed for user 1092 * @is_ampdu - set if Ampdu aggregate 1093 * @nbuf - ppdu descriptor payload 1094 * @ppdu_desc - ppdu descriptor 1095 * @ppdu_info_list_elem - linked list of ppdu tlvs 1096 */ 1097 struct ppdu_info { 1098 uint32_t ppdu_id; 1099 uint32_t max_ppdu_id; 1100 uint16_t tlv_bitmap; 1101 uint16_t last_tlv_cnt; 1102 uint16_t last_user:8, 1103 is_ampdu:1; 1104 qdf_nbuf_t nbuf; 1105 struct cdp_tx_completion_ppdu *ppdu_desc; 1106 TAILQ_ENTRY(ppdu_info) ppdu_info_list_elem; 1107 }; 1108 1109 /* PDEV level structure for data path */ 1110 struct dp_pdev { 1111 /** 1112 * Re-use Memory Section Starts 1113 */ 1114 /* PDEV handle from OSIF layer TBD: see if we really need osif_pdev */ 1115 struct cdp_ctrl_objmgr_pdev *ctrl_pdev; 1116 1117 /* PDEV Id */ 1118 int pdev_id; 1119 1120 /* LMAC Id */ 1121 int lmac_id; 1122 1123 /* TXRX SOC handle */ 1124 struct dp_soc *soc; 1125 1126 /* Ring used to replenish rx buffers (maybe to the firmware of MAC) */ 1127 struct dp_srng rx_refill_buf_ring; 1128 1129 /* RXDMA error destination ring */ 1130 struct dp_srng rxdma_err_dst_ring[NUM_RXDMA_RINGS_PER_PDEV]; 1131 1132 /* Link descriptor memory banks */ 1133 struct { 1134 void *base_vaddr_unaligned; 1135 void *base_vaddr; 1136 qdf_dma_addr_t base_paddr_unaligned; 1137 qdf_dma_addr_t base_paddr; 1138 uint32_t size; 1139 } link_desc_banks[NUM_RXDMA_RINGS_PER_PDEV][MAX_MON_LINK_DESC_BANKS]; 1140 1141 /* RXDMA monitor buffer replenish ring */ 1142 struct dp_srng rxdma_mon_buf_ring[NUM_RXDMA_RINGS_PER_PDEV]; 1143 1144 /* RXDMA monitor destination ring */ 1145 struct dp_srng rxdma_mon_dst_ring[NUM_RXDMA_RINGS_PER_PDEV]; 1146 1147 /* RXDMA monitor status ring. TBD: Check format of this ring */ 1148 struct dp_srng rxdma_mon_status_ring[NUM_RXDMA_RINGS_PER_PDEV]; 1149 1150 struct dp_srng rxdma_mon_desc_ring[NUM_RXDMA_RINGS_PER_PDEV]; 1151 1152 /* 1153 * re-use memory section ends 1154 * reuse memory/deinit indicator 1155 * 1156 * DO NOT CHANGE NAME OR MOVE THIS VARIABLE 1157 */ 1158 bool pdev_deinit; 1159 1160 /* Second ring used to replenish rx buffers */ 1161 struct dp_srng rx_refill_buf_ring2; 1162 1163 /* Empty ring used by firmware to post rx buffers to the MAC */ 1164 struct dp_srng rx_mac_buf_ring[MAX_RX_MAC_RINGS]; 1165 1166 /* wlan_cfg pdev ctxt*/ 1167 struct wlan_cfg_dp_pdev_ctxt *wlan_cfg_ctx; 1168 1169 /** 1170 * TODO: See if we need a ring map here for LMAC rings. 1171 * 1. Monitor rings are currently planning to be processed on receiving 1172 * PPDU end interrupts and hence wont need ring based interrupts. 1173 * 2. Rx buffer rings will be replenished during REO destination 1174 * processing and doesn't require regular interrupt handling - we will 1175 * only handle low water mark interrupts which is not expected 1176 * frequently 1177 */ 1178 1179 /* VDEV list */ 1180 TAILQ_HEAD(, dp_vdev) vdev_list; 1181 1182 /* vdev list lock */ 1183 qdf_spinlock_t vdev_list_lock; 1184 1185 /* Number of vdevs this device have */ 1186 uint16_t vdev_count; 1187 1188 /* PDEV transmit lock */ 1189 qdf_spinlock_t tx_lock; 1190 1191 #ifndef REMOVE_PKT_LOG 1192 bool pkt_log_init; 1193 /* Pktlog pdev */ 1194 struct pktlog_dev_t *pl_dev; 1195 #endif /* #ifndef REMOVE_PKT_LOG */ 1196 1197 /* Monitor mode interface and status storage */ 1198 struct dp_vdev *monitor_vdev; 1199 1200 /* monitor mode lock */ 1201 qdf_spinlock_t mon_lock; 1202 1203 /*tx_mutex for me*/ 1204 DP_MUTEX_TYPE tx_mutex; 1205 1206 /* monitor */ 1207 bool monitor_configured; 1208 1209 /* Smart Mesh */ 1210 bool filter_neighbour_peers; 1211 1212 /*flag to indicate neighbour_peers_list not empty */ 1213 bool neighbour_peers_added; 1214 /* smart mesh mutex */ 1215 qdf_spinlock_t neighbour_peer_mutex; 1216 /* Neighnour peer list */ 1217 TAILQ_HEAD(, dp_neighbour_peer) neighbour_peers_list; 1218 /* msdu chain head & tail */ 1219 qdf_nbuf_t invalid_peer_head_msdu; 1220 qdf_nbuf_t invalid_peer_tail_msdu; 1221 1222 /* Band steering */ 1223 /* TBD */ 1224 1225 /* PDEV level data path statistics */ 1226 struct cdp_pdev_stats stats; 1227 1228 /* Global RX decap mode for the device */ 1229 enum htt_pkt_type rx_decap_mode; 1230 1231 /* Enhanced Stats is enabled */ 1232 bool enhanced_stats_en; 1233 1234 /* advance filter mode and type*/ 1235 uint8_t mon_filter_mode; 1236 uint16_t fp_mgmt_filter; 1237 uint16_t fp_ctrl_filter; 1238 uint16_t fp_data_filter; 1239 uint16_t mo_mgmt_filter; 1240 uint16_t mo_ctrl_filter; 1241 uint16_t mo_data_filter; 1242 uint16_t md_data_filter; 1243 1244 qdf_atomic_t num_tx_outstanding; 1245 1246 qdf_atomic_t num_tx_exception; 1247 1248 /* MCL specific local peer handle */ 1249 struct { 1250 uint8_t pool[OL_TXRX_NUM_LOCAL_PEER_IDS + 1]; 1251 uint8_t freelist; 1252 qdf_spinlock_t lock; 1253 struct dp_peer *map[OL_TXRX_NUM_LOCAL_PEER_IDS]; 1254 } local_peer_ids; 1255 1256 /* dscp_tid_map_*/ 1257 uint8_t dscp_tid_map[DP_MAX_TID_MAPS][DSCP_TID_MAP_MAX]; 1258 1259 struct hal_rx_ppdu_info ppdu_info; 1260 1261 /* operating channel */ 1262 uint8_t operating_channel; 1263 1264 qdf_nbuf_queue_t rx_status_q; 1265 uint32_t mon_ppdu_status; 1266 struct cdp_mon_status rx_mon_recv_status; 1267 /* monitor mode status/destination ring PPDU and MPDU count */ 1268 struct cdp_pdev_mon_stats rx_mon_stats; 1269 /* to track duplicate link descriptor indications by HW for a WAR */ 1270 uint64_t mon_last_linkdesc_paddr; 1271 /* to track duplicate buffer indications by HW for a WAR */ 1272 uint32_t mon_last_buf_cookie; 1273 1274 /* pool addr for mcast enhance buff */ 1275 struct { 1276 int size; 1277 uint32_t paddr; 1278 char *vaddr; 1279 struct dp_tx_me_buf_t *freelist; 1280 int buf_in_use; 1281 qdf_dma_mem_context(memctx); 1282 } me_buf; 1283 1284 bool hmmc_tid_override_en; 1285 uint8_t hmmc_tid; 1286 1287 /* Number of VAPs with mcast enhancement enabled */ 1288 qdf_atomic_t mc_num_vap_attached; 1289 1290 qdf_atomic_t stats_cmd_complete; 1291 1292 #ifdef IPA_OFFLOAD 1293 ipa_uc_op_cb_type ipa_uc_op_cb; 1294 void *usr_ctxt; 1295 struct dp_ipa_resources ipa_resource; 1296 #endif 1297 1298 /* TBD */ 1299 1300 /* map this pdev to a particular Reo Destination ring */ 1301 enum cdp_host_reo_dest_ring reo_dest; 1302 1303 #ifndef REMOVE_PKT_LOG 1304 /* Packet log mode */ 1305 uint8_t rx_pktlog_mode; 1306 #endif 1307 1308 /* WDI event handlers */ 1309 struct wdi_event_subscribe_t **wdi_event_list; 1310 1311 /* ppdu_id of last received HTT TX stats */ 1312 uint32_t last_ppdu_id; 1313 struct { 1314 uint8_t last_user; 1315 qdf_nbuf_t buf; 1316 } tx_ppdu_info; 1317 1318 bool tx_sniffer_enable; 1319 /* mirror copy mode */ 1320 bool mcopy_mode; 1321 bool bpr_enable; 1322 struct { 1323 uint16_t tx_ppdu_id; 1324 uint16_t tx_peer_id; 1325 uint16_t rx_ppdu_id; 1326 } m_copy_id; 1327 1328 /* To check if PPDU Tx stats are enabled for Pktlog */ 1329 bool pktlog_ppdu_stats; 1330 1331 void *dp_txrx_handle; /* Advanced data path handle */ 1332 1333 #ifdef ATH_SUPPORT_NAC_RSSI 1334 bool nac_rssi_filtering; 1335 #endif 1336 /* list of ppdu tlvs */ 1337 TAILQ_HEAD(, ppdu_info) ppdu_info_list; 1338 uint32_t tlv_count; 1339 uint32_t list_depth; 1340 uint32_t ppdu_id; 1341 bool first_nbuf; 1342 struct { 1343 uint8_t *mgmt_buf; /* Ptr to mgmt. payload in HTT ppdu stats */ 1344 uint32_t mgmt_buf_len; /* Len of mgmt. payload in ppdu stats */ 1345 uint32_t ppdu_id; 1346 } mgmtctrl_frm_info; 1347 1348 /* Current noise-floor reading for the pdev channel */ 1349 int16_t chan_noise_floor; 1350 1351 /* 1352 * For multiradio device, this flag indicates if 1353 * this radio is primary or secondary. 1354 * 1355 * For HK 1.0, this is used for WAR for the AST issue. 1356 * HK 1.x mandates creation of only 1 AST entry with same MAC address 1357 * across 2 radios. is_primary indicates the radio on which DP should 1358 * install HW AST entry if there is a request to add 2 AST entries 1359 * with same MAC address across 2 radios 1360 */ 1361 uint8_t is_primary; 1362 /* Context of cal client timer */ 1363 void *cal_client_ctx; 1364 struct cdp_tx_sojourn_stats sojourn_stats; 1365 qdf_nbuf_t sojourn_buf; 1366 1367 /* peer pointer for collecting invalid peer stats */ 1368 struct dp_peer *invalid_peer; 1369 1370 union dp_rx_desc_list_elem_t *free_list_head; 1371 union dp_rx_desc_list_elem_t *free_list_tail; 1372 /* Pdev level flag to check peer based pktlog enabled or 1373 * disabled 1374 */ 1375 uint8_t dp_peer_based_pktlog; 1376 }; 1377 1378 struct dp_peer; 1379 1380 /* VDEV structure for data path state */ 1381 struct dp_vdev { 1382 /* OS device abstraction */ 1383 qdf_device_t osdev; 1384 /* physical device that is the parent of this virtual device */ 1385 struct dp_pdev *pdev; 1386 1387 /* Handle to the OS shim SW's virtual device */ 1388 ol_osif_vdev_handle osif_vdev; 1389 1390 /* Handle to the UMAC handle */ 1391 struct cdp_ctrl_objmgr_vdev *ctrl_vdev; 1392 /* vdev_id - ID used to specify a particular vdev to the target */ 1393 uint8_t vdev_id; 1394 1395 /* MAC address */ 1396 union dp_align_mac_addr mac_addr; 1397 1398 /* node in the pdev's list of vdevs */ 1399 TAILQ_ENTRY(dp_vdev) vdev_list_elem; 1400 1401 /* dp_peer list */ 1402 TAILQ_HEAD(, dp_peer) peer_list; 1403 1404 /* default RX call back function called by dp */ 1405 ol_txrx_rx_fp osif_rx; 1406 /* callback to deliver rx frames to the OS */ 1407 ol_txrx_rx_fp osif_rx_stack; 1408 ol_txrx_rsim_rx_decap_fp osif_rsim_rx_decap; 1409 ol_txrx_get_key_fp osif_get_key; 1410 ol_txrx_tx_free_ext_fp osif_tx_free_ext; 1411 1412 #ifdef notyet 1413 /* callback to check if the msdu is an WAI (WAPI) frame */ 1414 ol_rx_check_wai_fp osif_check_wai; 1415 #endif 1416 1417 /* proxy arp function */ 1418 ol_txrx_proxy_arp_fp osif_proxy_arp; 1419 1420 /* callback to hand rx monitor 802.11 MPDU to the OS shim */ 1421 ol_txrx_rx_mon_fp osif_rx_mon; 1422 1423 ol_txrx_mcast_me_fp me_convert; 1424 1425 /* completion function used by this vdev*/ 1426 ol_txrx_completion_fp tx_comp; 1427 1428 /* deferred vdev deletion state */ 1429 struct { 1430 /* VDEV delete pending */ 1431 int pending; 1432 /* 1433 * callback and a context argument to provide a 1434 * notification for when the vdev is deleted. 1435 */ 1436 ol_txrx_vdev_delete_cb callback; 1437 void *context; 1438 } delete; 1439 1440 /* tx data delivery notification callback function */ 1441 struct { 1442 ol_txrx_data_tx_cb func; 1443 void *ctxt; 1444 } tx_non_std_data_callback; 1445 1446 1447 /* safe mode control to bypass the encrypt and decipher process*/ 1448 uint32_t safemode; 1449 1450 /* rx filter related */ 1451 uint32_t drop_unenc; 1452 #ifdef notyet 1453 privacy_exemption privacy_filters[MAX_PRIVACY_FILTERS]; 1454 uint32_t filters_num; 1455 #endif 1456 /* TDLS Link status */ 1457 bool tdls_link_connected; 1458 bool is_tdls_frame; 1459 1460 1461 /* VDEV operating mode */ 1462 enum wlan_op_mode opmode; 1463 1464 /* Tx encapsulation type for this VAP */ 1465 enum htt_cmn_pkt_type tx_encap_type; 1466 /* Rx Decapsulation type for this VAP */ 1467 enum htt_cmn_pkt_type rx_decap_type; 1468 1469 /* BSS peer */ 1470 struct dp_peer *vap_bss_peer; 1471 1472 /* WDS enabled */ 1473 bool wds_enabled; 1474 1475 /* MEC enabled */ 1476 bool mec_enabled; 1477 1478 /* WDS Aging timer period */ 1479 uint32_t wds_aging_timer_val; 1480 1481 /* NAWDS enabled */ 1482 bool nawds_enabled; 1483 1484 /* Default HTT meta data for this VDEV */ 1485 /* TBD: check alignment constraints */ 1486 uint16_t htt_tcl_metadata; 1487 1488 /* Mesh mode vdev */ 1489 uint32_t mesh_vdev; 1490 1491 /* Mesh mode rx filter setting */ 1492 uint32_t mesh_rx_filter; 1493 1494 /* DSCP-TID mapping table ID */ 1495 uint8_t dscp_tid_map_id; 1496 1497 /* Multicast enhancement enabled */ 1498 uint8_t mcast_enhancement_en; 1499 1500 /* per vdev rx nbuf queue */ 1501 qdf_nbuf_queue_t rxq; 1502 1503 uint8_t tx_ring_id; 1504 struct dp_tx_desc_pool_s *tx_desc; 1505 struct dp_tx_ext_desc_pool_s *tx_ext_desc; 1506 1507 /* VDEV Stats */ 1508 struct cdp_vdev_stats stats; 1509 1510 /* Is this a proxySTA VAP */ 1511 bool proxysta_vdev; 1512 /* Is isolation mode enabled */ 1513 bool isolation_vdev; 1514 1515 /* Address search flags to be configured in HAL descriptor */ 1516 uint8_t hal_desc_addr_search_flags; 1517 #ifdef QCA_LL_TX_FLOW_CONTROL_V2 1518 struct dp_tx_desc_pool_s *pool; 1519 #endif 1520 /* AP BRIDGE enabled */ 1521 uint32_t ap_bridge_enabled; 1522 1523 enum cdp_sec_type sec_type; 1524 1525 /* SWAR for HW: Enable WEP bit in the AMSDU frames for RAW mode */ 1526 bool raw_mode_war; 1527 1528 /* Address search type to be set in TX descriptor */ 1529 uint8_t search_type; 1530 1531 /* AST hash value for BSS peer in HW valid for STA VAP*/ 1532 uint16_t bss_ast_hash; 1533 }; 1534 1535 1536 enum { 1537 dp_sec_mcast = 0, 1538 dp_sec_ucast 1539 }; 1540 1541 #ifdef WDS_VENDOR_EXTENSION 1542 typedef struct { 1543 uint8_t wds_tx_mcast_4addr:1, 1544 wds_tx_ucast_4addr:1, 1545 wds_rx_filter:1, /* enforce rx filter */ 1546 wds_rx_ucast_4addr:1, /* when set, accept 4addr unicast frames */ 1547 wds_rx_mcast_4addr:1; /* when set, accept 4addr multicast frames */ 1548 1549 } dp_ecm_policy; 1550 #endif 1551 1552 /* Peer structure for data path state */ 1553 struct dp_peer { 1554 /* VDEV to which this peer is associated */ 1555 struct dp_vdev *vdev; 1556 1557 struct cdp_ctrl_objmgr_peer *ctrl_peer; 1558 1559 struct dp_ast_entry *self_ast_entry; 1560 1561 qdf_atomic_t ref_cnt; 1562 1563 /* TODO: See if multiple peer IDs are required in wifi3.0 */ 1564 /* peer ID(s) for this peer */ 1565 uint16_t peer_ids[MAX_NUM_PEER_ID_PER_PEER]; 1566 1567 union dp_align_mac_addr mac_addr; 1568 1569 /* node in the vdev's list of peers */ 1570 TAILQ_ENTRY(dp_peer) peer_list_elem; 1571 /* node in the hash table bin's list of peers */ 1572 TAILQ_ENTRY(dp_peer) hash_list_elem; 1573 1574 /* TID structures */ 1575 struct dp_rx_tid rx_tid[DP_MAX_TIDS]; 1576 1577 /* TBD: No transmit TID state required? */ 1578 1579 struct { 1580 enum cdp_sec_type sec_type; 1581 u_int32_t michael_key[2]; /* relevant for TKIP */ 1582 } security[2]; /* 0 -> multicast, 1 -> unicast */ 1583 1584 /* 1585 * rx proc function: this either is a copy of pdev's rx_opt_proc for 1586 * regular rx processing, or has been redirected to a /dev/null discard 1587 * function when peer deletion is in progress. 1588 */ 1589 void (*rx_opt_proc)(struct dp_vdev *vdev, struct dp_peer *peer, 1590 unsigned tid, qdf_nbuf_t msdu_list); 1591 1592 /* set when node is authorized */ 1593 uint8_t authorize:1; 1594 1595 u_int8_t nac; 1596 1597 /* Band steering: Set when node is inactive */ 1598 uint8_t peer_bs_inact_flag:1; 1599 u_int16_t peer_bs_inact; /* inactivity mark count */ 1600 1601 /* NAWDS Flag and Bss Peer bit */ 1602 uint8_t nawds_enabled:1, 1603 bss_peer:1, 1604 wapi:1, 1605 wds_enabled:1; 1606 1607 /* MCL specific peer local id */ 1608 uint16_t local_id; 1609 enum ol_txrx_peer_state state; 1610 qdf_spinlock_t peer_info_lock; 1611 1612 qdf_time_t last_assoc_rcvd; 1613 qdf_time_t last_disassoc_rcvd; 1614 qdf_time_t last_deauth_rcvd; 1615 /* Peer Stats */ 1616 struct cdp_peer_stats stats; 1617 1618 TAILQ_HEAD(, dp_ast_entry) ast_entry_list; 1619 /* TBD */ 1620 1621 #ifdef WDS_VENDOR_EXTENSION 1622 dp_ecm_policy wds_ecm; 1623 #endif 1624 bool delete_in_progress; 1625 1626 /* Active Block ack sessions */ 1627 uint16_t active_ba_session_cnt; 1628 1629 /* Current HW buffersize setting */ 1630 uint16_t hw_buffer_size; 1631 1632 /* 1633 * Flag to check if sessions with 256 buffersize 1634 * should be terminated. 1635 */ 1636 uint8_t kill_256_sessions; 1637 qdf_atomic_t is_default_route_set; 1638 /* Peer level flag to check peer based pktlog enabled or 1639 * disabled 1640 */ 1641 uint8_t peer_based_pktlog_filter; 1642 }; 1643 1644 #ifdef CONFIG_WIN 1645 /* 1646 * dp_invalid_peer_msg 1647 * @nbuf: data buffer 1648 * @wh: 802.11 header 1649 * @vdev_id: id of vdev 1650 */ 1651 struct dp_invalid_peer_msg { 1652 qdf_nbuf_t nbuf; 1653 struct ieee80211_frame *wh; 1654 uint8_t vdev_id; 1655 }; 1656 #endif 1657 1658 /* 1659 * dp_tx_me_buf_t: ME buffer 1660 * next: pointer to next buffer 1661 * data: Destination Mac address 1662 */ 1663 struct dp_tx_me_buf_t { 1664 /* Note: ME buf pool initialization logic expects next pointer to 1665 * be the first element. Dont add anything before next */ 1666 struct dp_tx_me_buf_t *next; 1667 uint8_t data[DP_MAC_ADDR_LEN]; 1668 }; 1669 1670 #endif /* _DP_TYPES_H_ */ 1671