1 /* SPDX-License-Identifier: BSD-3-Clause-Clear */ 2 /* 3 * Copyright (c) 2018-2021 The Linux Foundation. All rights reserved. 4 * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved. 5 */ 6 7 #ifndef ATH12K_DP_H 8 #define ATH12K_DP_H 9 10 #include "hal_rx.h" 11 #include "hw.h" 12 13 #define MAX_RXDMA_PER_PDEV 2 14 15 struct ath12k_base; 16 struct ath12k_peer; 17 struct ath12k_dp; 18 struct ath12k_vif; 19 struct hal_tcl_status_ring; 20 struct ath12k_ext_irq_grp; 21 22 #define DP_MON_PURGE_TIMEOUT_MS 100 23 #define DP_MON_SERVICE_BUDGET 128 24 25 struct dp_srng { 26 u32 *vaddr_unaligned; 27 u32 *vaddr; 28 dma_addr_t paddr_unaligned; 29 dma_addr_t paddr; 30 int size; 31 u32 ring_id; 32 }; 33 34 struct dp_rxdma_mon_ring { 35 struct dp_srng refill_buf_ring; 36 struct idr bufs_idr; 37 /* Protects bufs_idr */ 38 spinlock_t idr_lock; 39 int bufs_max; 40 }; 41 42 struct dp_rxdma_ring { 43 struct dp_srng refill_buf_ring; 44 int bufs_max; 45 }; 46 47 #define ATH12K_TX_COMPL_NEXT(x) (((x) + 1) % DP_TX_COMP_RING_SIZE) 48 49 struct dp_tx_ring { 50 u8 tcl_data_ring_id; 51 struct dp_srng tcl_data_ring; 52 struct dp_srng tcl_comp_ring; 53 struct hal_wbm_completion_ring_tx *tx_status; 54 int tx_status_head; 55 int tx_status_tail; 56 }; 57 58 struct ath12k_pdev_mon_stats { 59 u32 status_ppdu_state; 60 u32 status_ppdu_start; 61 u32 status_ppdu_end; 62 u32 status_ppdu_compl; 63 u32 status_ppdu_start_mis; 64 u32 status_ppdu_end_mis; 65 u32 status_ppdu_done; 66 u32 dest_ppdu_done; 67 u32 dest_mpdu_done; 68 u32 dest_mpdu_drop; 69 u32 dup_mon_linkdesc_cnt; 70 u32 dup_mon_buf_cnt; 71 }; 72 73 struct dp_link_desc_bank { 74 void *vaddr_unaligned; 75 void *vaddr; 76 dma_addr_t paddr_unaligned; 77 dma_addr_t paddr; 78 u32 size; 79 }; 80 81 /* Size to enforce scatter idle list mode */ 82 #define DP_LINK_DESC_ALLOC_SIZE_THRESH 0x200000 83 #define DP_LINK_DESC_BANKS_MAX 8 84 85 #define DP_LINK_DESC_START 0x4000 86 #define DP_LINK_DESC_SHIFT 3 87 88 #define DP_LINK_DESC_COOKIE_SET(id, page) \ 89 ((((id) + DP_LINK_DESC_START) << DP_LINK_DESC_SHIFT) | (page)) 90 91 #define DP_LINK_DESC_BANK_MASK GENMASK(2, 0) 92 93 #define DP_RX_DESC_COOKIE_INDEX_MAX 0x3ffff 94 #define DP_RX_DESC_COOKIE_POOL_ID_MAX 0x1c0000 95 #define DP_RX_DESC_COOKIE_MAX \ 96 (DP_RX_DESC_COOKIE_INDEX_MAX | DP_RX_DESC_COOKIE_POOL_ID_MAX) 97 #define DP_NOT_PPDU_ID_WRAP_AROUND 20000 98 99 enum ath12k_dp_ppdu_state { 100 DP_PPDU_STATUS_START, 101 DP_PPDU_STATUS_DONE, 102 }; 103 104 struct dp_mon_mpdu { 105 struct list_head list; 106 struct sk_buff *head; 107 struct sk_buff *tail; 108 }; 109 110 #define DP_MON_MAX_STATUS_BUF 32 111 112 struct ath12k_mon_data { 113 struct dp_link_desc_bank link_desc_banks[DP_LINK_DESC_BANKS_MAX]; 114 struct hal_rx_mon_ppdu_info mon_ppdu_info; 115 116 u32 mon_ppdu_status; 117 u32 mon_last_buf_cookie; 118 u64 mon_last_linkdesc_paddr; 119 u16 chan_noise_floor; 120 121 struct ath12k_pdev_mon_stats rx_mon_stats; 122 /* lock for monitor data */ 123 spinlock_t mon_lock; 124 struct sk_buff_head rx_status_q; 125 struct dp_mon_mpdu *mon_mpdu; 126 struct list_head dp_rx_mon_mpdu_list; 127 struct sk_buff *dest_skb_q[DP_MON_MAX_STATUS_BUF]; 128 struct dp_mon_tx_ppdu_info *tx_prot_ppdu_info; 129 struct dp_mon_tx_ppdu_info *tx_data_ppdu_info; 130 }; 131 132 struct ath12k_pdev_dp { 133 u32 mac_id; 134 atomic_t num_tx_pending; 135 wait_queue_head_t tx_empty_waitq; 136 struct dp_srng rxdma_mon_dst_ring[MAX_RXDMA_PER_PDEV]; 137 struct dp_srng tx_mon_dst_ring[MAX_RXDMA_PER_PDEV]; 138 139 struct ieee80211_rx_status rx_status; 140 struct ath12k_mon_data mon_data; 141 }; 142 143 #define DP_NUM_CLIENTS_MAX 64 144 #define DP_AVG_TIDS_PER_CLIENT 2 145 #define DP_NUM_TIDS_MAX (DP_NUM_CLIENTS_MAX * DP_AVG_TIDS_PER_CLIENT) 146 #define DP_AVG_MSDUS_PER_FLOW 128 147 #define DP_AVG_FLOWS_PER_TID 2 148 #define DP_AVG_MPDUS_PER_TID_MAX 128 149 #define DP_AVG_MSDUS_PER_MPDU 4 150 151 #define DP_RX_HASH_ENABLE 1 /* Enable hash based Rx steering */ 152 153 #define DP_BA_WIN_SZ_MAX 1024 154 155 #define DP_TCL_NUM_RING_MAX 4 156 157 #define DP_IDLE_SCATTER_BUFS_MAX 16 158 159 #define DP_WBM_RELEASE_RING_SIZE 64 160 #define DP_TCL_DATA_RING_SIZE 512 161 #define DP_TX_COMP_RING_SIZE 32768 162 #define DP_TX_IDR_SIZE DP_TX_COMP_RING_SIZE 163 #define DP_TCL_CMD_RING_SIZE 32 164 #define DP_TCL_STATUS_RING_SIZE 32 165 #define DP_REO_DST_RING_MAX 8 166 #define DP_REO_DST_RING_SIZE 2048 167 #define DP_REO_REINJECT_RING_SIZE 32 168 #define DP_RX_RELEASE_RING_SIZE 1024 169 #define DP_REO_EXCEPTION_RING_SIZE 128 170 #define DP_REO_CMD_RING_SIZE 128 171 #define DP_REO_STATUS_RING_SIZE 2048 172 #define DP_RXDMA_BUF_RING_SIZE 4096 173 #define DP_RX_MAC_BUF_RING_SIZE 2048 174 #define DP_RXDMA_REFILL_RING_SIZE 2048 175 #define DP_RXDMA_ERR_DST_RING_SIZE 1024 176 #define DP_RXDMA_MON_STATUS_RING_SIZE 1024 177 #define DP_RXDMA_MONITOR_BUF_RING_SIZE 4096 178 #define DP_RXDMA_MONITOR_DST_RING_SIZE 2048 179 #define DP_RXDMA_MONITOR_DESC_RING_SIZE 4096 180 #define DP_TX_MONITOR_BUF_RING_SIZE 4096 181 #define DP_TX_MONITOR_DEST_RING_SIZE 2048 182 183 #define DP_TX_MONITOR_BUF_SIZE 2048 184 #define DP_TX_MONITOR_BUF_SIZE_MIN 48 185 #define DP_TX_MONITOR_BUF_SIZE_MAX 8192 186 187 #define DP_RX_BUFFER_SIZE 2048 188 #define DP_RX_BUFFER_SIZE_LITE 1024 189 #define DP_RX_BUFFER_ALIGN_SIZE 128 190 191 #define DP_RXDMA_BUF_COOKIE_BUF_ID GENMASK(17, 0) 192 #define DP_RXDMA_BUF_COOKIE_PDEV_ID GENMASK(19, 18) 193 194 #define DP_HW2SW_MACID(mac_id) ({ typeof(mac_id) x = (mac_id); x ? x - 1 : 0; }) 195 #define DP_SW2HW_MACID(mac_id) ((mac_id) + 1) 196 197 #define DP_TX_DESC_ID_MAC_ID GENMASK(1, 0) 198 #define DP_TX_DESC_ID_MSDU_ID GENMASK(18, 2) 199 #define DP_TX_DESC_ID_POOL_ID GENMASK(20, 19) 200 201 #define ATH12K_SHADOW_DP_TIMER_INTERVAL 20 202 #define ATH12K_SHADOW_CTRL_TIMER_INTERVAL 10 203 204 #define ATH12K_NUM_POOL_TX_DESC 32768 205 206 /* TODO: revisit this count during testing */ 207 #define ATH12K_RX_DESC_COUNT (12288) 208 209 #define ATH12K_PAGE_SIZE PAGE_SIZE 210 211 /* Total 1024 entries in PPT, i.e 4K/4 considering 4K aligned 212 * SPT pages which makes lower 12bits 0 213 */ 214 #define ATH12K_MAX_PPT_ENTRIES 1024 215 216 /* Total 512 entries in a SPT, i.e 4K Page/8 */ 217 #define ATH12K_MAX_SPT_ENTRIES 512 218 219 #define ATH12K_NUM_RX_SPT_PAGES ((ATH12K_RX_DESC_COUNT) / ATH12K_MAX_SPT_ENTRIES) 220 221 #define ATH12K_TX_SPT_PAGES_PER_POOL (ATH12K_NUM_POOL_TX_DESC / \ 222 ATH12K_MAX_SPT_ENTRIES) 223 #define ATH12K_NUM_TX_SPT_PAGES (ATH12K_TX_SPT_PAGES_PER_POOL * ATH12K_HW_MAX_QUEUES) 224 #define ATH12K_NUM_SPT_PAGES (ATH12K_NUM_RX_SPT_PAGES + ATH12K_NUM_TX_SPT_PAGES) 225 226 /* The SPT pages are divided for RX and TX, first block for RX 227 * and remaining for TX 228 */ 229 #define ATH12K_NUM_TX_SPT_PAGE_START ATH12K_NUM_RX_SPT_PAGES 230 231 #define ATH12K_DP_RX_DESC_MAGIC 0xBABABABA 232 233 /* 4K aligned address have last 12 bits set to 0, this check is done 234 * so that two spt pages address can be stored per 8bytes 235 * of CMEM (PPT) 236 */ 237 #define ATH12K_SPT_4K_ALIGN_CHECK 0xFFF 238 #define ATH12K_SPT_4K_ALIGN_OFFSET 12 239 #define ATH12K_PPT_ADDR_OFFSET(ppt_index) (4 * (ppt_index)) 240 241 /* To indicate HW of CMEM address, b0-31 are cmem base received via QMI */ 242 #define ATH12K_CMEM_ADDR_MSB 0x10 243 244 /* Of 20 bits cookie, b0-b8 is to indicate SPT offset and b9-19 for PPT */ 245 #define ATH12K_CC_SPT_MSB 8 246 #define ATH12K_CC_PPT_MSB 19 247 #define ATH12K_CC_PPT_SHIFT 9 248 #define ATH12k_DP_CC_COOKIE_SPT GENMASK(8, 0) 249 #define ATH12K_DP_CC_COOKIE_PPT GENMASK(19, 9) 250 251 #define DP_REO_QREF_NUM GENMASK(31, 16) 252 #define DP_MAX_PEER_ID 2047 253 254 /* Total size of the LUT is based on 2K peers, each having reference 255 * for 17tids, note each entry is of type ath12k_reo_queue_ref 256 * hence total size is 2048 * 17 * 8 = 278528 257 */ 258 #define DP_REOQ_LUT_SIZE 278528 259 260 /* Invalid TX Bank ID value */ 261 #define DP_INVALID_BANK_ID -1 262 263 struct ath12k_dp_tx_bank_profile { 264 u8 is_configured; 265 u32 num_users; 266 u32 bank_config; 267 }; 268 269 struct ath12k_hp_update_timer { 270 struct timer_list timer; 271 bool started; 272 bool init; 273 u32 tx_num; 274 u32 timer_tx_num; 275 u32 ring_id; 276 u32 interval; 277 struct ath12k_base *ab; 278 }; 279 280 struct ath12k_rx_desc_info { 281 struct list_head list; 282 struct sk_buff *skb; 283 u32 cookie; 284 u32 magic; 285 u8 in_use : 1, 286 reserved : 7; 287 }; 288 289 struct ath12k_tx_desc_info { 290 struct list_head list; 291 struct sk_buff *skb; 292 u32 desc_id; /* Cookie */ 293 u8 mac_id; 294 u8 pool_id; 295 }; 296 297 struct ath12k_spt_info { 298 dma_addr_t paddr; 299 u64 *vaddr; 300 struct ath12k_rx_desc_info *rxbaddr[ATH12K_NUM_RX_SPT_PAGES]; 301 struct ath12k_tx_desc_info *txbaddr[ATH12K_NUM_TX_SPT_PAGES]; 302 }; 303 304 struct ath12k_reo_queue_ref { 305 u32 info0; 306 u32 info1; 307 } __packed; 308 309 struct ath12k_reo_q_addr_lut { 310 dma_addr_t paddr; 311 u32 *vaddr; 312 }; 313 314 struct ath12k_dp { 315 struct ath12k_base *ab; 316 u8 num_bank_profiles; 317 /* protects the access and update of bank_profiles */ 318 spinlock_t tx_bank_lock; 319 struct ath12k_dp_tx_bank_profile *bank_profiles; 320 enum ath12k_htc_ep_id eid; 321 struct completion htt_tgt_version_received; 322 u8 htt_tgt_ver_major; 323 u8 htt_tgt_ver_minor; 324 struct dp_link_desc_bank link_desc_banks[DP_LINK_DESC_BANKS_MAX]; 325 struct dp_srng wbm_idle_ring; 326 struct dp_srng wbm_desc_rel_ring; 327 struct dp_srng tcl_cmd_ring; 328 struct dp_srng tcl_status_ring; 329 struct dp_srng reo_reinject_ring; 330 struct dp_srng rx_rel_ring; 331 struct dp_srng reo_except_ring; 332 struct dp_srng reo_cmd_ring; 333 struct dp_srng reo_status_ring; 334 struct dp_srng reo_dst_ring[DP_REO_DST_RING_MAX]; 335 struct dp_tx_ring tx_ring[DP_TCL_NUM_RING_MAX]; 336 struct hal_wbm_idle_scatter_list scatter_list[DP_IDLE_SCATTER_BUFS_MAX]; 337 struct list_head reo_cmd_list; 338 struct list_head reo_cmd_cache_flush_list; 339 u32 reo_cmd_cache_flush_count; 340 341 /* protects access to below fields, 342 * - reo_cmd_list 343 * - reo_cmd_cache_flush_list 344 * - reo_cmd_cache_flush_count 345 */ 346 spinlock_t reo_cmd_lock; 347 struct ath12k_hp_update_timer reo_cmd_timer; 348 struct ath12k_hp_update_timer tx_ring_timer[DP_TCL_NUM_RING_MAX]; 349 struct ath12k_spt_info *spt_info; 350 u32 num_spt_pages; 351 struct list_head rx_desc_free_list; 352 /* protects the free desc list */ 353 spinlock_t rx_desc_lock; 354 355 struct list_head tx_desc_free_list[ATH12K_HW_MAX_QUEUES]; 356 struct list_head tx_desc_used_list[ATH12K_HW_MAX_QUEUES]; 357 /* protects the free and used desc lists */ 358 spinlock_t tx_desc_lock[ATH12K_HW_MAX_QUEUES]; 359 360 struct dp_rxdma_ring rx_refill_buf_ring; 361 struct dp_srng rx_mac_buf_ring[MAX_RXDMA_PER_PDEV]; 362 struct dp_srng rxdma_err_dst_ring[MAX_RXDMA_PER_PDEV]; 363 struct dp_rxdma_mon_ring rxdma_mon_buf_ring; 364 struct dp_rxdma_mon_ring tx_mon_buf_ring; 365 struct ath12k_reo_q_addr_lut reoq_lut; 366 }; 367 368 /* HTT definitions */ 369 370 #define HTT_TCL_META_DATA_TYPE BIT(0) 371 #define HTT_TCL_META_DATA_VALID_HTT BIT(1) 372 373 /* vdev meta data */ 374 #define HTT_TCL_META_DATA_VDEV_ID GENMASK(9, 2) 375 #define HTT_TCL_META_DATA_PDEV_ID GENMASK(11, 10) 376 #define HTT_TCL_META_DATA_HOST_INSPECTED BIT(12) 377 378 /* peer meta data */ 379 #define HTT_TCL_META_DATA_PEER_ID GENMASK(15, 2) 380 381 /* HTT tx completion is overlaid in wbm_release_ring */ 382 #define HTT_TX_WBM_COMP_INFO0_STATUS GENMASK(16, 13) 383 #define HTT_TX_WBM_COMP_INFO1_REINJECT_REASON GENMASK(3, 0) 384 #define HTT_TX_WBM_COMP_INFO1_EXCEPTION_FRAME BIT(4) 385 386 #define HTT_TX_WBM_COMP_INFO2_ACK_RSSI GENMASK(31, 24) 387 388 struct htt_tx_wbm_completion { 389 __le32 rsvd0[2]; 390 __le32 info0; 391 __le32 info1; 392 __le32 info2; 393 __le32 info3; 394 __le32 info4; 395 __le32 rsvd1; 396 397 } __packed; 398 399 enum htt_h2t_msg_type { 400 HTT_H2T_MSG_TYPE_VERSION_REQ = 0, 401 HTT_H2T_MSG_TYPE_SRING_SETUP = 0xb, 402 HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG = 0xc, 403 HTT_H2T_MSG_TYPE_EXT_STATS_CFG = 0x10, 404 HTT_H2T_MSG_TYPE_PPDU_STATS_CFG = 0x11, 405 HTT_H2T_MSG_TYPE_VDEV_TXRX_STATS_CFG = 0x1a, 406 HTT_H2T_MSG_TYPE_TX_MONITOR_CFG = 0x1b, 407 }; 408 409 #define HTT_VER_REQ_INFO_MSG_ID GENMASK(7, 0) 410 411 struct htt_ver_req_cmd { 412 __le32 ver_reg_info; 413 } __packed; 414 415 enum htt_srng_ring_type { 416 HTT_HW_TO_SW_RING, 417 HTT_SW_TO_HW_RING, 418 HTT_SW_TO_SW_RING, 419 }; 420 421 enum htt_srng_ring_id { 422 HTT_RXDMA_HOST_BUF_RING, 423 HTT_RXDMA_MONITOR_STATUS_RING, 424 HTT_RXDMA_MONITOR_BUF_RING, 425 HTT_RXDMA_MONITOR_DESC_RING, 426 HTT_RXDMA_MONITOR_DEST_RING, 427 HTT_HOST1_TO_FW_RXBUF_RING, 428 HTT_HOST2_TO_FW_RXBUF_RING, 429 HTT_RXDMA_NON_MONITOR_DEST_RING, 430 HTT_TX_MON_HOST2MON_BUF_RING, 431 HTT_TX_MON_MON2HOST_DEST_RING, 432 }; 433 434 /* host -> target HTT_SRING_SETUP message 435 * 436 * After target is booted up, Host can send SRING setup message for 437 * each host facing LMAC SRING. Target setups up HW registers based 438 * on setup message and confirms back to Host if response_required is set. 439 * Host should wait for confirmation message before sending new SRING 440 * setup message 441 * 442 * The message would appear as follows: 443 * 444 * |31 24|23 20|19|18 16|15|14 8|7 0| 445 * |--------------- +-----------------+----------------+------------------| 446 * | ring_type | ring_id | pdev_id | msg_type | 447 * |----------------------------------------------------------------------| 448 * | ring_base_addr_lo | 449 * |----------------------------------------------------------------------| 450 * | ring_base_addr_hi | 451 * |----------------------------------------------------------------------| 452 * |ring_misc_cfg_flag|ring_entry_size| ring_size | 453 * |----------------------------------------------------------------------| 454 * | ring_head_offset32_remote_addr_lo | 455 * |----------------------------------------------------------------------| 456 * | ring_head_offset32_remote_addr_hi | 457 * |----------------------------------------------------------------------| 458 * | ring_tail_offset32_remote_addr_lo | 459 * |----------------------------------------------------------------------| 460 * | ring_tail_offset32_remote_addr_hi | 461 * |----------------------------------------------------------------------| 462 * | ring_msi_addr_lo | 463 * |----------------------------------------------------------------------| 464 * | ring_msi_addr_hi | 465 * |----------------------------------------------------------------------| 466 * | ring_msi_data | 467 * |----------------------------------------------------------------------| 468 * | intr_timer_th |IM| intr_batch_counter_th | 469 * |----------------------------------------------------------------------| 470 * | reserved |RR|PTCF| intr_low_threshold | 471 * |----------------------------------------------------------------------| 472 * Where 473 * IM = sw_intr_mode 474 * RR = response_required 475 * PTCF = prefetch_timer_cfg 476 * 477 * The message is interpreted as follows: 478 * dword0 - b'0:7 - msg_type: This will be set to 479 * HTT_H2T_MSG_TYPE_SRING_SETUP 480 * b'8:15 - pdev_id: 481 * 0 (for rings at SOC/UMAC level), 482 * 1/2/3 mac id (for rings at LMAC level) 483 * b'16:23 - ring_id: identify which ring is to setup, 484 * more details can be got from enum htt_srng_ring_id 485 * b'24:31 - ring_type: identify type of host rings, 486 * more details can be got from enum htt_srng_ring_type 487 * dword1 - b'0:31 - ring_base_addr_lo: Lower 32bits of ring base address 488 * dword2 - b'0:31 - ring_base_addr_hi: Upper 32bits of ring base address 489 * dword3 - b'0:15 - ring_size: size of the ring in unit of 4-bytes words 490 * b'16:23 - ring_entry_size: Size of each entry in 4-byte word units 491 * b'24:31 - ring_misc_cfg_flag: Valid only for HW_TO_SW_RING and 492 * SW_TO_HW_RING. 493 * Refer to HTT_SRING_SETUP_RING_MISC_CFG_RING defs. 494 * dword4 - b'0:31 - ring_head_off32_remote_addr_lo: 495 * Lower 32 bits of memory address of the remote variable 496 * storing the 4-byte word offset that identifies the head 497 * element within the ring. 498 * (The head offset variable has type u32.) 499 * Valid for HW_TO_SW and SW_TO_SW rings. 500 * dword5 - b'0:31 - ring_head_off32_remote_addr_hi: 501 * Upper 32 bits of memory address of the remote variable 502 * storing the 4-byte word offset that identifies the head 503 * element within the ring. 504 * (The head offset variable has type u32.) 505 * Valid for HW_TO_SW and SW_TO_SW rings. 506 * dword6 - b'0:31 - ring_tail_off32_remote_addr_lo: 507 * Lower 32 bits of memory address of the remote variable 508 * storing the 4-byte word offset that identifies the tail 509 * element within the ring. 510 * (The tail offset variable has type u32.) 511 * Valid for HW_TO_SW and SW_TO_SW rings. 512 * dword7 - b'0:31 - ring_tail_off32_remote_addr_hi: 513 * Upper 32 bits of memory address of the remote variable 514 * storing the 4-byte word offset that identifies the tail 515 * element within the ring. 516 * (The tail offset variable has type u32.) 517 * Valid for HW_TO_SW and SW_TO_SW rings. 518 * dword8 - b'0:31 - ring_msi_addr_lo: Lower 32bits of MSI cfg address 519 * valid only for HW_TO_SW_RING and SW_TO_HW_RING 520 * dword9 - b'0:31 - ring_msi_addr_hi: Upper 32bits of MSI cfg address 521 * valid only for HW_TO_SW_RING and SW_TO_HW_RING 522 * dword10 - b'0:31 - ring_msi_data: MSI data 523 * Refer to HTT_SRING_SETUP_RING_MSC_CFG_xxx defs 524 * valid only for HW_TO_SW_RING and SW_TO_HW_RING 525 * dword11 - b'0:14 - intr_batch_counter_th: 526 * batch counter threshold is in units of 4-byte words. 527 * HW internally maintains and increments batch count. 528 * (see SRING spec for detail description). 529 * When batch count reaches threshold value, an interrupt 530 * is generated by HW. 531 * b'15 - sw_intr_mode: 532 * This configuration shall be static. 533 * Only programmed at power up. 534 * 0: generate pulse style sw interrupts 535 * 1: generate level style sw interrupts 536 * b'16:31 - intr_timer_th: 537 * The timer init value when timer is idle or is 538 * initialized to start downcounting. 539 * In 8us units (to cover a range of 0 to 524 ms) 540 * dword12 - b'0:15 - intr_low_threshold: 541 * Used only by Consumer ring to generate ring_sw_int_p. 542 * Ring entries low threshold water mark, that is used 543 * in combination with the interrupt timer as well as 544 * the clearing of the level interrupt. 545 * b'16:18 - prefetch_timer_cfg: 546 * Used only by Consumer ring to set timer mode to 547 * support Application prefetch handling. 548 * The external tail offset/pointer will be updated 549 * at following intervals: 550 * 3'b000: (Prefetch feature disabled; used only for debug) 551 * 3'b001: 1 usec 552 * 3'b010: 4 usec 553 * 3'b011: 8 usec (default) 554 * 3'b100: 16 usec 555 * Others: Reserved 556 * b'19 - response_required: 557 * Host needs HTT_T2H_MSG_TYPE_SRING_SETUP_DONE as response 558 * b'20:31 - reserved: reserved for future use 559 */ 560 561 #define HTT_SRNG_SETUP_CMD_INFO0_MSG_TYPE GENMASK(7, 0) 562 #define HTT_SRNG_SETUP_CMD_INFO0_PDEV_ID GENMASK(15, 8) 563 #define HTT_SRNG_SETUP_CMD_INFO0_RING_ID GENMASK(23, 16) 564 #define HTT_SRNG_SETUP_CMD_INFO0_RING_TYPE GENMASK(31, 24) 565 566 #define HTT_SRNG_SETUP_CMD_INFO1_RING_SIZE GENMASK(15, 0) 567 #define HTT_SRNG_SETUP_CMD_INFO1_RING_ENTRY_SIZE GENMASK(23, 16) 568 #define HTT_SRNG_SETUP_CMD_INFO1_RING_LOOP_CNT_DIS BIT(25) 569 #define HTT_SRNG_SETUP_CMD_INFO1_RING_FLAGS_MSI_SWAP BIT(27) 570 #define HTT_SRNG_SETUP_CMD_INFO1_RING_FLAGS_HOST_FW_SWAP BIT(28) 571 #define HTT_SRNG_SETUP_CMD_INFO1_RING_FLAGS_TLV_SWAP BIT(29) 572 573 #define HTT_SRNG_SETUP_CMD_INTR_INFO_BATCH_COUNTER_THRESH GENMASK(14, 0) 574 #define HTT_SRNG_SETUP_CMD_INTR_INFO_SW_INTR_MODE BIT(15) 575 #define HTT_SRNG_SETUP_CMD_INTR_INFO_INTR_TIMER_THRESH GENMASK(31, 16) 576 577 #define HTT_SRNG_SETUP_CMD_INFO2_INTR_LOW_THRESH GENMASK(15, 0) 578 #define HTT_SRNG_SETUP_CMD_INFO2_PRE_FETCH_TIMER_CFG GENMASK(18, 16) 579 #define HTT_SRNG_SETUP_CMD_INFO2_RESPONSE_REQUIRED BIT(19) 580 581 struct htt_srng_setup_cmd { 582 __le32 info0; 583 __le32 ring_base_addr_lo; 584 __le32 ring_base_addr_hi; 585 __le32 info1; 586 __le32 ring_head_off32_remote_addr_lo; 587 __le32 ring_head_off32_remote_addr_hi; 588 __le32 ring_tail_off32_remote_addr_lo; 589 __le32 ring_tail_off32_remote_addr_hi; 590 __le32 ring_msi_addr_lo; 591 __le32 ring_msi_addr_hi; 592 __le32 msi_data; 593 __le32 intr_info; 594 __le32 info2; 595 } __packed; 596 597 /* host -> target FW PPDU_STATS config message 598 * 599 * @details 600 * The following field definitions describe the format of the HTT host 601 * to target FW for PPDU_STATS_CFG msg. 602 * The message allows the host to configure the PPDU_STATS_IND messages 603 * produced by the target. 604 * 605 * |31 24|23 16|15 8|7 0| 606 * |-----------------------------------------------------------| 607 * | REQ bit mask | pdev_mask | msg type | 608 * |-----------------------------------------------------------| 609 * Header fields: 610 * - MSG_TYPE 611 * Bits 7:0 612 * Purpose: identifies this is a req to configure ppdu_stats_ind from target 613 * Value: 0x11 614 * - PDEV_MASK 615 * Bits 8:15 616 * Purpose: identifies which pdevs this PPDU stats configuration applies to 617 * Value: This is a overloaded field, refer to usage and interpretation of 618 * PDEV in interface document. 619 * Bit 8 : Reserved for SOC stats 620 * Bit 9 - 15 : Indicates PDEV_MASK in DBDC 621 * Indicates MACID_MASK in DBS 622 * - REQ_TLV_BIT_MASK 623 * Bits 16:31 624 * Purpose: each set bit indicates the corresponding PPDU stats TLV type 625 * needs to be included in the target's PPDU_STATS_IND messages. 626 * Value: refer htt_ppdu_stats_tlv_tag_t <<<??? 627 * 628 */ 629 630 struct htt_ppdu_stats_cfg_cmd { 631 __le32 msg; 632 } __packed; 633 634 #define HTT_PPDU_STATS_CFG_MSG_TYPE GENMASK(7, 0) 635 #define HTT_PPDU_STATS_CFG_PDEV_ID GENMASK(15, 8) 636 #define HTT_PPDU_STATS_CFG_TLV_TYPE_BITMASK GENMASK(31, 16) 637 638 enum htt_ppdu_stats_tag_type { 639 HTT_PPDU_STATS_TAG_COMMON, 640 HTT_PPDU_STATS_TAG_USR_COMMON, 641 HTT_PPDU_STATS_TAG_USR_RATE, 642 HTT_PPDU_STATS_TAG_USR_MPDU_ENQ_BITMAP_64, 643 HTT_PPDU_STATS_TAG_USR_MPDU_ENQ_BITMAP_256, 644 HTT_PPDU_STATS_TAG_SCH_CMD_STATUS, 645 HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON, 646 HTT_PPDU_STATS_TAG_USR_COMPLTN_BA_BITMAP_64, 647 HTT_PPDU_STATS_TAG_USR_COMPLTN_BA_BITMAP_256, 648 HTT_PPDU_STATS_TAG_USR_COMPLTN_ACK_BA_STATUS, 649 HTT_PPDU_STATS_TAG_USR_COMPLTN_FLUSH, 650 HTT_PPDU_STATS_TAG_USR_COMMON_ARRAY, 651 HTT_PPDU_STATS_TAG_INFO, 652 HTT_PPDU_STATS_TAG_TX_MGMTCTRL_PAYLOAD, 653 654 /* New TLV's are added above to this line */ 655 HTT_PPDU_STATS_TAG_MAX, 656 }; 657 658 #define HTT_PPDU_STATS_TAG_DEFAULT (BIT(HTT_PPDU_STATS_TAG_COMMON) \ 659 | BIT(HTT_PPDU_STATS_TAG_USR_COMMON) \ 660 | BIT(HTT_PPDU_STATS_TAG_USR_RATE) \ 661 | BIT(HTT_PPDU_STATS_TAG_SCH_CMD_STATUS) \ 662 | BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_COMMON) \ 663 | BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_ACK_BA_STATUS) \ 664 | BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_FLUSH) \ 665 | BIT(HTT_PPDU_STATS_TAG_USR_COMMON_ARRAY)) 666 667 #define HTT_PPDU_STATS_TAG_PKTLOG (BIT(HTT_PPDU_STATS_TAG_USR_MPDU_ENQ_BITMAP_64) | \ 668 BIT(HTT_PPDU_STATS_TAG_USR_MPDU_ENQ_BITMAP_256) | \ 669 BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_BA_BITMAP_64) | \ 670 BIT(HTT_PPDU_STATS_TAG_USR_COMPLTN_BA_BITMAP_256) | \ 671 BIT(HTT_PPDU_STATS_TAG_INFO) | \ 672 BIT(HTT_PPDU_STATS_TAG_TX_MGMTCTRL_PAYLOAD) | \ 673 HTT_PPDU_STATS_TAG_DEFAULT) 674 675 enum htt_stats_internal_ppdu_frametype { 676 HTT_STATS_PPDU_FTYPE_CTRL, 677 HTT_STATS_PPDU_FTYPE_DATA, 678 HTT_STATS_PPDU_FTYPE_BAR, 679 HTT_STATS_PPDU_FTYPE_MAX 680 }; 681 682 /* HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG Message 683 * 684 * details: 685 * HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG message is sent by host to 686 * configure RXDMA rings. 687 * The configuration is per ring based and includes both packet subtypes 688 * and PPDU/MPDU TLVs. 689 * 690 * The message would appear as follows: 691 * 692 * |31 26|25|24|23 16|15 8|7 0| 693 * |-----------------+----------------+----------------+---------------| 694 * | rsvd1 |PS|SS| ring_id | pdev_id | msg_type | 695 * |-------------------------------------------------------------------| 696 * | rsvd2 | ring_buffer_size | 697 * |-------------------------------------------------------------------| 698 * | packet_type_enable_flags_0 | 699 * |-------------------------------------------------------------------| 700 * | packet_type_enable_flags_1 | 701 * |-------------------------------------------------------------------| 702 * | packet_type_enable_flags_2 | 703 * |-------------------------------------------------------------------| 704 * | packet_type_enable_flags_3 | 705 * |-------------------------------------------------------------------| 706 * | tlv_filter_in_flags | 707 * |-------------------------------------------------------------------| 708 * Where: 709 * PS = pkt_swap 710 * SS = status_swap 711 * The message is interpreted as follows: 712 * dword0 - b'0:7 - msg_type: This will be set to 713 * HTT_H2T_MSG_TYPE_RX_RING_SELECTION_CFG 714 * b'8:15 - pdev_id: 715 * 0 (for rings at SOC/UMAC level), 716 * 1/2/3 mac id (for rings at LMAC level) 717 * b'16:23 - ring_id : Identify the ring to configure. 718 * More details can be got from enum htt_srng_ring_id 719 * b'24 - status_swap: 1 is to swap status TLV 720 * b'25 - pkt_swap: 1 is to swap packet TLV 721 * b'26:31 - rsvd1: reserved for future use 722 * dword1 - b'0:16 - ring_buffer_size: size of buffers referenced by rx ring, 723 * in byte units. 724 * Valid only for HW_TO_SW_RING and SW_TO_HW_RING 725 * - b'16:31 - rsvd2: Reserved for future use 726 * dword2 - b'0:31 - packet_type_enable_flags_0: 727 * Enable MGMT packet from 0b0000 to 0b1001 728 * bits from low to high: FP, MD, MO - 3 bits 729 * FP: Filter_Pass 730 * MD: Monitor_Direct 731 * MO: Monitor_Other 732 * 10 mgmt subtypes * 3 bits -> 30 bits 733 * Refer to PKT_TYPE_ENABLE_FLAG0_xxx_MGMT_xxx defs 734 * dword3 - b'0:31 - packet_type_enable_flags_1: 735 * Enable MGMT packet from 0b1010 to 0b1111 736 * bits from low to high: FP, MD, MO - 3 bits 737 * Refer to PKT_TYPE_ENABLE_FLAG1_xxx_MGMT_xxx defs 738 * dword4 - b'0:31 - packet_type_enable_flags_2: 739 * Enable CTRL packet from 0b0000 to 0b1001 740 * bits from low to high: FP, MD, MO - 3 bits 741 * Refer to PKT_TYPE_ENABLE_FLAG2_xxx_CTRL_xxx defs 742 * dword5 - b'0:31 - packet_type_enable_flags_3: 743 * Enable CTRL packet from 0b1010 to 0b1111, 744 * MCAST_DATA, UCAST_DATA, NULL_DATA 745 * bits from low to high: FP, MD, MO - 3 bits 746 * Refer to PKT_TYPE_ENABLE_FLAG3_xxx_CTRL_xxx defs 747 * dword6 - b'0:31 - tlv_filter_in_flags: 748 * Filter in Attention/MPDU/PPDU/Header/User tlvs 749 * Refer to CFG_TLV_FILTER_IN_FLAG defs 750 */ 751 752 #define HTT_RX_RING_SELECTION_CFG_CMD_INFO0_MSG_TYPE GENMASK(7, 0) 753 #define HTT_RX_RING_SELECTION_CFG_CMD_INFO0_PDEV_ID GENMASK(15, 8) 754 #define HTT_RX_RING_SELECTION_CFG_CMD_INFO0_RING_ID GENMASK(23, 16) 755 #define HTT_RX_RING_SELECTION_CFG_CMD_INFO0_SS BIT(24) 756 #define HTT_RX_RING_SELECTION_CFG_CMD_INFO0_PS BIT(25) 757 #define HTT_RX_RING_SELECTION_CFG_CMD_INFO1_BUF_SIZE GENMASK(15, 0) 758 #define HTT_RX_RING_SELECTION_CFG_CMD_OFFSET_VALID BIT(26) 759 760 #define HTT_RX_RING_SELECTION_CFG_RX_PACKET_OFFSET GENMASK(15, 0) 761 #define HTT_RX_RING_SELECTION_CFG_RX_HEADER_OFFSET GENMASK(31, 16) 762 #define HTT_RX_RING_SELECTION_CFG_RX_MPDU_END_OFFSET GENMASK(15, 0) 763 #define HTT_RX_RING_SELECTION_CFG_RX_MPDU_START_OFFSET GENMASK(31, 16) 764 #define HTT_RX_RING_SELECTION_CFG_RX_MSDU_END_OFFSET GENMASK(15, 0) 765 #define HTT_RX_RING_SELECTION_CFG_RX_MSDU_START_OFFSET GENMASK(31, 16) 766 #define HTT_RX_RING_SELECTION_CFG_RX_ATTENTION_OFFSET GENMASK(15, 0) 767 768 #define HTT_RX_RING_SELECTION_CFG_WORD_MASK_COMPACT_SET BIT(23) 769 #define HTT_RX_RING_SELECTION_CFG_RX_MPDU_START_MASK GENMASK(15, 0) 770 #define HTT_RX_RING_SELECTION_CFG_RX_MPDU_END_MASK GENMASK(18, 16) 771 #define HTT_RX_RING_SELECTION_CFG_RX_MSDU_END_MASK GENMASK(16, 0) 772 773 enum htt_rx_filter_tlv_flags { 774 HTT_RX_FILTER_TLV_FLAGS_MPDU_START = BIT(0), 775 HTT_RX_FILTER_TLV_FLAGS_MSDU_START = BIT(1), 776 HTT_RX_FILTER_TLV_FLAGS_RX_PACKET = BIT(2), 777 HTT_RX_FILTER_TLV_FLAGS_MSDU_END = BIT(3), 778 HTT_RX_FILTER_TLV_FLAGS_MPDU_END = BIT(4), 779 HTT_RX_FILTER_TLV_FLAGS_PACKET_HEADER = BIT(5), 780 HTT_RX_FILTER_TLV_FLAGS_PER_MSDU_HEADER = BIT(6), 781 HTT_RX_FILTER_TLV_FLAGS_ATTENTION = BIT(7), 782 HTT_RX_FILTER_TLV_FLAGS_PPDU_START = BIT(8), 783 HTT_RX_FILTER_TLV_FLAGS_PPDU_END = BIT(9), 784 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS = BIT(10), 785 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS_EXT = BIT(11), 786 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE = BIT(12), 787 }; 788 789 enum htt_rx_mgmt_pkt_filter_tlv_flags0 { 790 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_REQ = BIT(0), 791 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_REQ = BIT(1), 792 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_REQ = BIT(2), 793 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_RESP = BIT(3), 794 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_RESP = BIT(4), 795 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_RESP = BIT(5), 796 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_REQ = BIT(6), 797 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_REQ = BIT(7), 798 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_REQ = BIT(8), 799 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_RESP = BIT(9), 800 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_RESP = BIT(10), 801 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_RESP = BIT(11), 802 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_REQ = BIT(12), 803 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_REQ = BIT(13), 804 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_REQ = BIT(14), 805 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_RESP = BIT(15), 806 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_RESP = BIT(16), 807 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_RESP = BIT(17), 808 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_TIMING_ADV = BIT(18), 809 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_TIMING_ADV = BIT(19), 810 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_TIMING_ADV = BIT(20), 811 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_RESERVED_7 = BIT(21), 812 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_RESERVED_7 = BIT(22), 813 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_RESERVED_7 = BIT(23), 814 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_BEACON = BIT(24), 815 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_BEACON = BIT(25), 816 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_BEACON = BIT(26), 817 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_ATIM = BIT(27), 818 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_ATIM = BIT(28), 819 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_ATIM = BIT(29), 820 }; 821 822 enum htt_rx_mgmt_pkt_filter_tlv_flags1 { 823 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_DISASSOC = BIT(0), 824 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_DISASSOC = BIT(1), 825 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_DISASSOC = BIT(2), 826 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_AUTH = BIT(3), 827 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_AUTH = BIT(4), 828 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_AUTH = BIT(5), 829 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_DEAUTH = BIT(6), 830 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_DEAUTH = BIT(7), 831 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_DEAUTH = BIT(8), 832 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION = BIT(9), 833 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION = BIT(10), 834 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION = BIT(11), 835 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION_NOACK = BIT(12), 836 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION_NOACK = BIT(13), 837 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION_NOACK = BIT(14), 838 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_RESERVED_15 = BIT(15), 839 HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_RESERVED_15 = BIT(16), 840 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_RESERVED_15 = BIT(17), 841 }; 842 843 enum htt_rx_ctrl_pkt_filter_tlv_flags2 { 844 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_1 = BIT(0), 845 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_1 = BIT(1), 846 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_1 = BIT(2), 847 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_2 = BIT(3), 848 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_2 = BIT(4), 849 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_2 = BIT(5), 850 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_TRIGGER = BIT(6), 851 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_TRIGGER = BIT(7), 852 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_TRIGGER = BIT(8), 853 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_4 = BIT(9), 854 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_4 = BIT(10), 855 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_4 = BIT(11), 856 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_BF_REP_POLL = BIT(12), 857 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_BF_REP_POLL = BIT(13), 858 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_BF_REP_POLL = BIT(14), 859 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_VHT_NDP = BIT(15), 860 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_VHT_NDP = BIT(16), 861 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_VHT_NDP = BIT(17), 862 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_FRAME_EXT = BIT(18), 863 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_FRAME_EXT = BIT(19), 864 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_FRAME_EXT = BIT(20), 865 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_WRAPPER = BIT(21), 866 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_WRAPPER = BIT(22), 867 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_WRAPPER = BIT(23), 868 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_BAR = BIT(24), 869 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_BAR = BIT(25), 870 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_BAR = BIT(26), 871 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_BA = BIT(27), 872 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_BA = BIT(28), 873 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_BA = BIT(29), 874 }; 875 876 enum htt_rx_ctrl_pkt_filter_tlv_flags3 { 877 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_PSPOLL = BIT(0), 878 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_PSPOLL = BIT(1), 879 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_PSPOLL = BIT(2), 880 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_RTS = BIT(3), 881 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_RTS = BIT(4), 882 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_RTS = BIT(5), 883 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_CTS = BIT(6), 884 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_CTS = BIT(7), 885 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_CTS = BIT(8), 886 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_ACK = BIT(9), 887 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_ACK = BIT(10), 888 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_ACK = BIT(11), 889 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND = BIT(12), 890 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND = BIT(13), 891 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND = BIT(14), 892 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND_ACK = BIT(15), 893 HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND_ACK = BIT(16), 894 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND_ACK = BIT(17), 895 }; 896 897 enum htt_rx_data_pkt_filter_tlv_flasg3 { 898 HTT_RX_FP_DATA_PKT_FILTER_TLV_FLASG3_MCAST = BIT(18), 899 HTT_RX_MD_DATA_PKT_FILTER_TLV_FLASG3_MCAST = BIT(19), 900 HTT_RX_MO_DATA_PKT_FILTER_TLV_FLASG3_MCAST = BIT(20), 901 HTT_RX_FP_DATA_PKT_FILTER_TLV_FLASG3_UCAST = BIT(21), 902 HTT_RX_MD_DATA_PKT_FILTER_TLV_FLASG3_UCAST = BIT(22), 903 HTT_RX_MO_DATA_PKT_FILTER_TLV_FLASG3_UCAST = BIT(23), 904 HTT_RX_FP_DATA_PKT_FILTER_TLV_FLASG3_NULL_DATA = BIT(24), 905 HTT_RX_MD_DATA_PKT_FILTER_TLV_FLASG3_NULL_DATA = BIT(25), 906 HTT_RX_MO_DATA_PKT_FILTER_TLV_FLASG3_NULL_DATA = BIT(26), 907 }; 908 909 #define HTT_RX_FP_MGMT_FILTER_FLAGS0 \ 910 (HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_REQ \ 911 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_RESP \ 912 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_REQ \ 913 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_RESP \ 914 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_REQ \ 915 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_RESP \ 916 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_TIMING_ADV \ 917 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_BEACON \ 918 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_ATIM) 919 920 #define HTT_RX_MD_MGMT_FILTER_FLAGS0 \ 921 (HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_REQ \ 922 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_RESP \ 923 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_REQ \ 924 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_RESP \ 925 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_REQ \ 926 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_RESP \ 927 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_TIMING_ADV \ 928 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_BEACON \ 929 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS0_ATIM) 930 931 #define HTT_RX_MO_MGMT_FILTER_FLAGS0 \ 932 (HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_REQ \ 933 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_ASSOC_RESP \ 934 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_REQ \ 935 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_REASSOC_RESP \ 936 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_REQ \ 937 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_RESP \ 938 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_PROBE_TIMING_ADV \ 939 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_BEACON \ 940 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_ATIM) 941 942 #define HTT_RX_FP_MGMT_FILTER_FLAGS1 (HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_DISASSOC \ 943 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_AUTH \ 944 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_DEAUTH \ 945 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION \ 946 | HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION_NOACK) 947 948 #define HTT_RX_MD_MGMT_FILTER_FLAGS1 (HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_DISASSOC \ 949 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_AUTH \ 950 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_DEAUTH \ 951 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION \ 952 | HTT_RX_MD_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION_NOACK) 953 954 #define HTT_RX_MO_MGMT_FILTER_FLAGS1 (HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_DISASSOC \ 955 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_AUTH \ 956 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_DEAUTH \ 957 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION \ 958 | HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_ACTION_NOACK) 959 960 #define HTT_RX_FP_CTRL_FILTER_FLASG2 (HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_WRAPPER \ 961 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_BAR \ 962 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_BA) 963 964 #define HTT_RX_MD_CTRL_FILTER_FLASG2 (HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_WRAPPER \ 965 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_BAR \ 966 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS2_BA) 967 968 #define HTT_RX_MO_CTRL_FILTER_FLASG2 (HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_WRAPPER \ 969 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_BAR \ 970 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_BA) 971 972 #define HTT_RX_FP_CTRL_FILTER_FLASG3 (HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_PSPOLL \ 973 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_RTS \ 974 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_CTS \ 975 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_ACK \ 976 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND \ 977 | HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND_ACK) 978 979 #define HTT_RX_MD_CTRL_FILTER_FLASG3 (HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_PSPOLL \ 980 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_RTS \ 981 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_CTS \ 982 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_ACK \ 983 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND \ 984 | HTT_RX_MD_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND_ACK) 985 986 #define HTT_RX_MO_CTRL_FILTER_FLASG3 (HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_PSPOLL \ 987 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_RTS \ 988 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_CTS \ 989 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_ACK \ 990 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND \ 991 | HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS3_CFEND_ACK) 992 993 #define HTT_RX_FP_DATA_FILTER_FLASG3 (HTT_RX_FP_DATA_PKT_FILTER_TLV_FLASG3_MCAST \ 994 | HTT_RX_FP_DATA_PKT_FILTER_TLV_FLASG3_UCAST \ 995 | HTT_RX_FP_DATA_PKT_FILTER_TLV_FLASG3_NULL_DATA) 996 997 #define HTT_RX_MD_DATA_FILTER_FLASG3 (HTT_RX_MD_DATA_PKT_FILTER_TLV_FLASG3_MCAST \ 998 | HTT_RX_MD_DATA_PKT_FILTER_TLV_FLASG3_UCAST \ 999 | HTT_RX_MD_DATA_PKT_FILTER_TLV_FLASG3_NULL_DATA) 1000 1001 #define HTT_RX_MO_DATA_FILTER_FLASG3 (HTT_RX_MO_DATA_PKT_FILTER_TLV_FLASG3_MCAST \ 1002 | HTT_RX_MO_DATA_PKT_FILTER_TLV_FLASG3_UCAST \ 1003 | HTT_RX_MO_DATA_PKT_FILTER_TLV_FLASG3_NULL_DATA) 1004 1005 #define HTT_RX_MON_FP_MGMT_FILTER_FLAGS0 \ 1006 (HTT_RX_FP_MGMT_FILTER_FLAGS0 | \ 1007 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS0_RESERVED_7) 1008 1009 #define HTT_RX_MON_MO_MGMT_FILTER_FLAGS0 \ 1010 (HTT_RX_MO_MGMT_FILTER_FLAGS0 | \ 1011 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS0_RESERVED_7) 1012 1013 #define HTT_RX_MON_FP_MGMT_FILTER_FLAGS1 \ 1014 (HTT_RX_FP_MGMT_FILTER_FLAGS1 | \ 1015 HTT_RX_FP_MGMT_PKT_FILTER_TLV_FLAGS1_RESERVED_15) 1016 1017 #define HTT_RX_MON_MO_MGMT_FILTER_FLAGS1 \ 1018 (HTT_RX_MO_MGMT_FILTER_FLAGS1 | \ 1019 HTT_RX_MO_MGMT_PKT_FILTER_TLV_FLAGS1_RESERVED_15) 1020 1021 #define HTT_RX_MON_FP_CTRL_FILTER_FLASG2 \ 1022 (HTT_RX_FP_CTRL_FILTER_FLASG2 | \ 1023 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_1 | \ 1024 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_2 | \ 1025 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_TRIGGER | \ 1026 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_4 | \ 1027 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_BF_REP_POLL | \ 1028 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_VHT_NDP | \ 1029 HTT_RX_FP_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_FRAME_EXT) 1030 1031 #define HTT_RX_MON_MO_CTRL_FILTER_FLASG2 \ 1032 (HTT_RX_MO_CTRL_FILTER_FLASG2 | \ 1033 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_1 | \ 1034 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_2 | \ 1035 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_TRIGGER | \ 1036 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_RESERVED_4 | \ 1037 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_BF_REP_POLL | \ 1038 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_VHT_NDP | \ 1039 HTT_RX_MO_CTRL_PKT_FILTER_TLV_FLAGS2_CTRL_FRAME_EXT) 1040 1041 #define HTT_RX_MON_FP_CTRL_FILTER_FLASG3 HTT_RX_FP_CTRL_FILTER_FLASG3 1042 1043 #define HTT_RX_MON_MO_CTRL_FILTER_FLASG3 HTT_RX_MO_CTRL_FILTER_FLASG3 1044 1045 #define HTT_RX_MON_FP_DATA_FILTER_FLASG3 HTT_RX_FP_DATA_FILTER_FLASG3 1046 1047 #define HTT_RX_MON_MO_DATA_FILTER_FLASG3 HTT_RX_MO_DATA_FILTER_FLASG3 1048 1049 #define HTT_RX_MON_FILTER_TLV_FLAGS \ 1050 (HTT_RX_FILTER_TLV_FLAGS_MPDU_START | \ 1051 HTT_RX_FILTER_TLV_FLAGS_PPDU_START | \ 1052 HTT_RX_FILTER_TLV_FLAGS_PPDU_END | \ 1053 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS | \ 1054 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS_EXT | \ 1055 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE) 1056 1057 #define HTT_RX_MON_FILTER_TLV_FLAGS_MON_STATUS_RING \ 1058 (HTT_RX_FILTER_TLV_FLAGS_MPDU_START | \ 1059 HTT_RX_FILTER_TLV_FLAGS_PPDU_START | \ 1060 HTT_RX_FILTER_TLV_FLAGS_PPDU_END | \ 1061 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS | \ 1062 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_USER_STATS_EXT | \ 1063 HTT_RX_FILTER_TLV_FLAGS_PPDU_END_STATUS_DONE) 1064 1065 #define HTT_RX_MON_FILTER_TLV_FLAGS_MON_BUF_RING \ 1066 (HTT_RX_FILTER_TLV_FLAGS_MPDU_START | \ 1067 HTT_RX_FILTER_TLV_FLAGS_MSDU_START | \ 1068 HTT_RX_FILTER_TLV_FLAGS_RX_PACKET | \ 1069 HTT_RX_FILTER_TLV_FLAGS_MSDU_END | \ 1070 HTT_RX_FILTER_TLV_FLAGS_MPDU_END | \ 1071 HTT_RX_FILTER_TLV_FLAGS_PACKET_HEADER | \ 1072 HTT_RX_FILTER_TLV_FLAGS_PER_MSDU_HEADER | \ 1073 HTT_RX_FILTER_TLV_FLAGS_ATTENTION) 1074 1075 /* msdu start. mpdu end, attention, rx hdr tlv's are not subscribed */ 1076 #define HTT_RX_TLV_FLAGS_RXDMA_RING \ 1077 (HTT_RX_FILTER_TLV_FLAGS_MPDU_START | \ 1078 HTT_RX_FILTER_TLV_FLAGS_RX_PACKET | \ 1079 HTT_RX_FILTER_TLV_FLAGS_MSDU_END) 1080 1081 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_MSG_TYPE GENMASK(7, 0) 1082 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_PDEV_ID GENMASK(15, 8) 1083 1084 struct htt_rx_ring_selection_cfg_cmd { 1085 __le32 info0; 1086 __le32 info1; 1087 __le32 pkt_type_en_flags0; 1088 __le32 pkt_type_en_flags1; 1089 __le32 pkt_type_en_flags2; 1090 __le32 pkt_type_en_flags3; 1091 __le32 rx_filter_tlv; 1092 __le32 rx_packet_offset; 1093 __le32 rx_mpdu_offset; 1094 __le32 rx_msdu_offset; 1095 __le32 rx_attn_offset; 1096 __le32 info2; 1097 __le32 reserved[2]; 1098 __le32 rx_mpdu_start_end_mask; 1099 __le32 rx_msdu_end_word_mask; 1100 __le32 info3; 1101 } __packed; 1102 1103 struct htt_rx_ring_tlv_filter { 1104 u32 rx_filter; /* see htt_rx_filter_tlv_flags */ 1105 u32 pkt_filter_flags0; /* MGMT */ 1106 u32 pkt_filter_flags1; /* MGMT */ 1107 u32 pkt_filter_flags2; /* CTRL */ 1108 u32 pkt_filter_flags3; /* DATA */ 1109 bool offset_valid; 1110 u16 rx_packet_offset; 1111 u16 rx_header_offset; 1112 u16 rx_mpdu_end_offset; 1113 u16 rx_mpdu_start_offset; 1114 u16 rx_msdu_end_offset; 1115 u16 rx_msdu_start_offset; 1116 u16 rx_attn_offset; 1117 u16 rx_mpdu_start_wmask; 1118 u16 rx_mpdu_end_wmask; 1119 u32 rx_msdu_end_wmask; 1120 }; 1121 1122 #define HTT_STATS_FRAME_CTRL_TYPE_MGMT 0x0 1123 #define HTT_STATS_FRAME_CTRL_TYPE_CTRL 0x1 1124 #define HTT_STATS_FRAME_CTRL_TYPE_DATA 0x2 1125 #define HTT_STATS_FRAME_CTRL_TYPE_RESV 0x3 1126 1127 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_MSG_TYPE GENMASK(7, 0) 1128 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_PDEV_ID GENMASK(15, 8) 1129 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_RING_ID GENMASK(23, 16) 1130 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_SS BIT(24) 1131 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO0_PS BIT(25) 1132 1133 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO1_RING_BUFF_SIZE GENMASK(15, 0) 1134 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO1_PKT_TYPE GENMASK(18, 16) 1135 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO1_CONF_LEN_MGMT GENMASK(21, 19) 1136 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO1_CONF_LEN_CTRL GENMASK(24, 22) 1137 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO1_CONF_LEN_DATA GENMASK(27, 25) 1138 1139 #define HTT_TX_RING_SELECTION_CFG_CMD_INFO2_PKT_TYPE_EN_FLAG GENMASK(2, 0) 1140 1141 struct htt_tx_ring_selection_cfg_cmd { 1142 __le32 info0; 1143 __le32 info1; 1144 __le32 info2; 1145 __le32 tlv_filter_mask_in0; 1146 __le32 tlv_filter_mask_in1; 1147 __le32 tlv_filter_mask_in2; 1148 __le32 tlv_filter_mask_in3; 1149 __le32 reserved[3]; 1150 } __packed; 1151 1152 #define HTT_TX_RING_TLV_FILTER_MGMT_DMA_LEN GENMASK(3, 0) 1153 #define HTT_TX_RING_TLV_FILTER_CTRL_DMA_LEN GENMASK(7, 4) 1154 #define HTT_TX_RING_TLV_FILTER_DATA_DMA_LEN GENMASK(11, 8) 1155 1156 #define HTT_TX_MON_FILTER_HYBRID_MODE \ 1157 (HTT_TX_FILTER_TLV_FLAGS0_RESPONSE_START_STATUS | \ 1158 HTT_TX_FILTER_TLV_FLAGS0_RESPONSE_END_STATUS | \ 1159 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_START | \ 1160 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_END | \ 1161 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_START_PPDU | \ 1162 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_USER_PPDU | \ 1163 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_ACK_OR_BA | \ 1164 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_1K_BA | \ 1165 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_START_PROT | \ 1166 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_PROT | \ 1167 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_USER_RESPONSE | \ 1168 HTT_TX_FILTER_TLV_FLAGS0_RECEIVED_RESPONSE_INFO | \ 1169 HTT_TX_FILTER_TLV_FLAGS0_RECEIVED_RESPONSE_INFO_PART2) 1170 1171 struct htt_tx_ring_tlv_filter { 1172 u32 tx_mon_downstream_tlv_flags; 1173 u32 tx_mon_upstream_tlv_flags0; 1174 u32 tx_mon_upstream_tlv_flags1; 1175 u32 tx_mon_upstream_tlv_flags2; 1176 bool tx_mon_mgmt_filter; 1177 bool tx_mon_data_filter; 1178 bool tx_mon_ctrl_filter; 1179 u16 tx_mon_pkt_dma_len; 1180 } __packed; 1181 1182 enum htt_tx_mon_upstream_tlv_flags0 { 1183 HTT_TX_FILTER_TLV_FLAGS0_RESPONSE_START_STATUS = BIT(1), 1184 HTT_TX_FILTER_TLV_FLAGS0_RESPONSE_END_STATUS = BIT(2), 1185 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_START = BIT(3), 1186 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_END = BIT(4), 1187 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_START_PPDU = BIT(5), 1188 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_USER_PPDU = BIT(6), 1189 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_ACK_OR_BA = BIT(7), 1190 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_1K_BA = BIT(8), 1191 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_START_PROT = BIT(9), 1192 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_PROT = BIT(10), 1193 HTT_TX_FILTER_TLV_FLAGS0_TX_FES_STATUS_USER_RESPONSE = BIT(11), 1194 HTT_TX_FILTER_TLV_FLAGS0_RX_FRAME_BITMAP_ACK = BIT(12), 1195 HTT_TX_FILTER_TLV_FLAGS0_RX_FRAME_1K_BITMAP_ACK = BIT(13), 1196 HTT_TX_FILTER_TLV_FLAGS0_COEX_TX_STATUS = BIT(14), 1197 HTT_TX_FILTER_TLV_FLAGS0_RECEIVED_RESPONSE_INFO = BIT(15), 1198 HTT_TX_FILTER_TLV_FLAGS0_RECEIVED_RESPONSE_INFO_PART2 = BIT(16), 1199 }; 1200 1201 #define HTT_TX_FILTER_TLV_FLAGS2_TXPCU_PHYTX_OTHER_TRANSMIT_INFO32 BIT(11) 1202 1203 /* HTT message target->host */ 1204 1205 enum htt_t2h_msg_type { 1206 HTT_T2H_MSG_TYPE_VERSION_CONF, 1207 HTT_T2H_MSG_TYPE_PEER_MAP = 0x3, 1208 HTT_T2H_MSG_TYPE_PEER_UNMAP = 0x4, 1209 HTT_T2H_MSG_TYPE_RX_ADDBA = 0x5, 1210 HTT_T2H_MSG_TYPE_PKTLOG = 0x8, 1211 HTT_T2H_MSG_TYPE_SEC_IND = 0xb, 1212 HTT_T2H_MSG_TYPE_PEER_MAP2 = 0x1e, 1213 HTT_T2H_MSG_TYPE_PEER_UNMAP2 = 0x1f, 1214 HTT_T2H_MSG_TYPE_PPDU_STATS_IND = 0x1d, 1215 HTT_T2H_MSG_TYPE_EXT_STATS_CONF = 0x1c, 1216 HTT_T2H_MSG_TYPE_BKPRESSURE_EVENT_IND = 0x24, 1217 HTT_T2H_MSG_TYPE_MLO_TIMESTAMP_OFFSET_IND = 0x28, 1218 HTT_T2H_MSG_TYPE_PEER_MAP3 = 0x2b, 1219 HTT_T2H_MSG_TYPE_VDEV_TXRX_STATS_PERIODIC_IND = 0x2c, 1220 }; 1221 1222 #define HTT_TARGET_VERSION_MAJOR 3 1223 1224 #define HTT_T2H_MSG_TYPE GENMASK(7, 0) 1225 #define HTT_T2H_VERSION_CONF_MINOR GENMASK(15, 8) 1226 #define HTT_T2H_VERSION_CONF_MAJOR GENMASK(23, 16) 1227 1228 struct htt_t2h_version_conf_msg { 1229 __le32 version; 1230 } __packed; 1231 1232 #define HTT_T2H_PEER_MAP_INFO_VDEV_ID GENMASK(15, 8) 1233 #define HTT_T2H_PEER_MAP_INFO_PEER_ID GENMASK(31, 16) 1234 #define HTT_T2H_PEER_MAP_INFO1_MAC_ADDR_H16 GENMASK(15, 0) 1235 #define HTT_T2H_PEER_MAP_INFO1_HW_PEER_ID GENMASK(31, 16) 1236 #define HTT_T2H_PEER_MAP_INFO2_AST_HASH_VAL GENMASK(15, 0) 1237 #define HTT_T2H_PEER_MAP_INFO2_NEXT_HOP_M BIT(16) 1238 #define HTT_T2H_PEER_MAP_INFO2_NEXT_HOP_S 16 1239 1240 struct htt_t2h_peer_map_event { 1241 __le32 info; 1242 __le32 mac_addr_l32; 1243 __le32 info1; 1244 __le32 info2; 1245 } __packed; 1246 1247 #define HTT_T2H_PEER_UNMAP_INFO_VDEV_ID HTT_T2H_PEER_MAP_INFO_VDEV_ID 1248 #define HTT_T2H_PEER_UNMAP_INFO_PEER_ID HTT_T2H_PEER_MAP_INFO_PEER_ID 1249 #define HTT_T2H_PEER_UNMAP_INFO1_MAC_ADDR_H16 \ 1250 HTT_T2H_PEER_MAP_INFO1_MAC_ADDR_H16 1251 #define HTT_T2H_PEER_MAP_INFO1_NEXT_HOP_M HTT_T2H_PEER_MAP_INFO2_NEXT_HOP_M 1252 #define HTT_T2H_PEER_MAP_INFO1_NEXT_HOP_S HTT_T2H_PEER_MAP_INFO2_NEXT_HOP_S 1253 1254 struct htt_t2h_peer_unmap_event { 1255 __le32 info; 1256 __le32 mac_addr_l32; 1257 __le32 info1; 1258 } __packed; 1259 1260 struct htt_resp_msg { 1261 union { 1262 struct htt_t2h_version_conf_msg version_msg; 1263 struct htt_t2h_peer_map_event peer_map_ev; 1264 struct htt_t2h_peer_unmap_event peer_unmap_ev; 1265 }; 1266 } __packed; 1267 1268 #define HTT_VDEV_GET_STATS_U64(msg_l32, msg_u32)\ 1269 (((u64)__le32_to_cpu(msg_u32) << 32) | (__le32_to_cpu(msg_l32))) 1270 #define HTT_T2H_VDEV_STATS_PERIODIC_MSG_TYPE GENMASK(7, 0) 1271 #define HTT_T2H_VDEV_STATS_PERIODIC_PDEV_ID GENMASK(15, 8) 1272 #define HTT_T2H_VDEV_STATS_PERIODIC_NUM_VDEV GENMASK(23, 16) 1273 #define HTT_T2H_VDEV_STATS_PERIODIC_PAYLOAD_BYTES GENMASK(15, 0) 1274 #define HTT_VDEV_TXRX_STATS_COMMON_TLV 0 1275 #define HTT_VDEV_TXRX_STATS_HW_STATS_TLV 1 1276 1277 struct htt_t2h_vdev_txrx_stats_ind { 1278 __le32 vdev_id; 1279 __le32 rx_msdu_byte_cnt_lo; 1280 __le32 rx_msdu_byte_cnt_hi; 1281 __le32 rx_msdu_cnt_lo; 1282 __le32 rx_msdu_cnt_hi; 1283 __le32 tx_msdu_byte_cnt_lo; 1284 __le32 tx_msdu_byte_cnt_hi; 1285 __le32 tx_msdu_cnt_lo; 1286 __le32 tx_msdu_cnt_hi; 1287 __le32 tx_retry_cnt_lo; 1288 __le32 tx_retry_cnt_hi; 1289 __le32 tx_retry_byte_cnt_lo; 1290 __le32 tx_retry_byte_cnt_hi; 1291 __le32 tx_drop_cnt_lo; 1292 __le32 tx_drop_cnt_hi; 1293 __le32 tx_drop_byte_cnt_lo; 1294 __le32 tx_drop_byte_cnt_hi; 1295 __le32 msdu_ttl_cnt_lo; 1296 __le32 msdu_ttl_cnt_hi; 1297 __le32 msdu_ttl_byte_cnt_lo; 1298 __le32 msdu_ttl_byte_cnt_hi; 1299 } __packed; 1300 1301 struct htt_t2h_vdev_common_stats_tlv { 1302 __le32 soc_drop_count_lo; 1303 __le32 soc_drop_count_hi; 1304 } __packed; 1305 1306 /* ppdu stats 1307 * 1308 * @details 1309 * The following field definitions describe the format of the HTT target 1310 * to host ppdu stats indication message. 1311 * 1312 * 1313 * |31 16|15 12|11 10|9 8|7 0 | 1314 * |----------------------------------------------------------------------| 1315 * | payload_size | rsvd |pdev_id|mac_id | msg type | 1316 * |----------------------------------------------------------------------| 1317 * | ppdu_id | 1318 * |----------------------------------------------------------------------| 1319 * | Timestamp in us | 1320 * |----------------------------------------------------------------------| 1321 * | reserved | 1322 * |----------------------------------------------------------------------| 1323 * | type-specific stats info | 1324 * | (see htt_ppdu_stats.h) | 1325 * |----------------------------------------------------------------------| 1326 * Header fields: 1327 * - MSG_TYPE 1328 * Bits 7:0 1329 * Purpose: Identifies this is a PPDU STATS indication 1330 * message. 1331 * Value: 0x1d 1332 * - mac_id 1333 * Bits 9:8 1334 * Purpose: mac_id of this ppdu_id 1335 * Value: 0-3 1336 * - pdev_id 1337 * Bits 11:10 1338 * Purpose: pdev_id of this ppdu_id 1339 * Value: 0-3 1340 * 0 (for rings at SOC level), 1341 * 1/2/3 PDEV -> 0/1/2 1342 * - payload_size 1343 * Bits 31:16 1344 * Purpose: total tlv size 1345 * Value: payload_size in bytes 1346 */ 1347 1348 #define HTT_T2H_PPDU_STATS_INFO_PDEV_ID GENMASK(11, 10) 1349 #define HTT_T2H_PPDU_STATS_INFO_PAYLOAD_SIZE GENMASK(31, 16) 1350 1351 struct ath12k_htt_ppdu_stats_msg { 1352 __le32 info; 1353 __le32 ppdu_id; 1354 __le32 timestamp; 1355 __le32 rsvd; 1356 u8 data[]; 1357 } __packed; 1358 1359 struct htt_tlv { 1360 __le32 header; 1361 u8 value[]; 1362 } __packed; 1363 1364 #define HTT_TLV_TAG GENMASK(11, 0) 1365 #define HTT_TLV_LEN GENMASK(23, 12) 1366 1367 enum HTT_PPDU_STATS_BW { 1368 HTT_PPDU_STATS_BANDWIDTH_5MHZ = 0, 1369 HTT_PPDU_STATS_BANDWIDTH_10MHZ = 1, 1370 HTT_PPDU_STATS_BANDWIDTH_20MHZ = 2, 1371 HTT_PPDU_STATS_BANDWIDTH_40MHZ = 3, 1372 HTT_PPDU_STATS_BANDWIDTH_80MHZ = 4, 1373 HTT_PPDU_STATS_BANDWIDTH_160MHZ = 5, /* includes 80+80 */ 1374 HTT_PPDU_STATS_BANDWIDTH_DYN = 6, 1375 }; 1376 1377 #define HTT_PPDU_STATS_CMN_FLAGS_FRAME_TYPE_M GENMASK(7, 0) 1378 #define HTT_PPDU_STATS_CMN_FLAGS_QUEUE_TYPE_M GENMASK(15, 8) 1379 /* bw - HTT_PPDU_STATS_BW */ 1380 #define HTT_PPDU_STATS_CMN_FLAGS_BW_M GENMASK(19, 16) 1381 1382 struct htt_ppdu_stats_common { 1383 __le32 ppdu_id; 1384 __le16 sched_cmdid; 1385 u8 ring_id; 1386 u8 num_users; 1387 __le32 flags; /* %HTT_PPDU_STATS_COMMON_FLAGS_*/ 1388 __le32 chain_mask; 1389 __le32 fes_duration_us; /* frame exchange sequence */ 1390 __le32 ppdu_sch_eval_start_tstmp_us; 1391 __le32 ppdu_sch_end_tstmp_us; 1392 __le32 ppdu_start_tstmp_us; 1393 /* BIT [15 : 0] - phy mode (WLAN_PHY_MODE) with which ppdu was transmitted 1394 * BIT [31 : 16] - bandwidth (in MHz) with which ppdu was transmitted 1395 */ 1396 __le16 phy_mode; 1397 __le16 bw_mhz; 1398 } __packed; 1399 1400 enum htt_ppdu_stats_gi { 1401 HTT_PPDU_STATS_SGI_0_8_US, 1402 HTT_PPDU_STATS_SGI_0_4_US, 1403 HTT_PPDU_STATS_SGI_1_6_US, 1404 HTT_PPDU_STATS_SGI_3_2_US, 1405 }; 1406 1407 #define HTT_PPDU_STATS_USER_RATE_INFO0_USER_POS_M GENMASK(3, 0) 1408 #define HTT_PPDU_STATS_USER_RATE_INFO0_MU_GROUP_ID_M GENMASK(11, 4) 1409 1410 enum HTT_PPDU_STATS_PPDU_TYPE { 1411 HTT_PPDU_STATS_PPDU_TYPE_SU, 1412 HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO, 1413 HTT_PPDU_STATS_PPDU_TYPE_MU_OFDMA, 1414 HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO_OFDMA, 1415 HTT_PPDU_STATS_PPDU_TYPE_UL_TRIG, 1416 HTT_PPDU_STATS_PPDU_TYPE_BURST_BCN, 1417 HTT_PPDU_STATS_PPDU_TYPE_UL_BSR_RESP, 1418 HTT_PPDU_STATS_PPDU_TYPE_UL_BSR_TRIG, 1419 HTT_PPDU_STATS_PPDU_TYPE_UL_RESP, 1420 HTT_PPDU_STATS_PPDU_TYPE_MAX 1421 }; 1422 1423 #define HTT_PPDU_STATS_USER_RATE_INFO1_RESP_TYPE_VALD_M BIT(0) 1424 #define HTT_PPDU_STATS_USER_RATE_INFO1_PPDU_TYPE_M GENMASK(5, 1) 1425 1426 #define HTT_PPDU_STATS_USER_RATE_FLAGS_LTF_SIZE_M GENMASK(1, 0) 1427 #define HTT_PPDU_STATS_USER_RATE_FLAGS_STBC_M BIT(2) 1428 #define HTT_PPDU_STATS_USER_RATE_FLAGS_HE_RE_M BIT(3) 1429 #define HTT_PPDU_STATS_USER_RATE_FLAGS_TXBF_M GENMASK(7, 4) 1430 #define HTT_PPDU_STATS_USER_RATE_FLAGS_BW_M GENMASK(11, 8) 1431 #define HTT_PPDU_STATS_USER_RATE_FLAGS_NSS_M GENMASK(15, 12) 1432 #define HTT_PPDU_STATS_USER_RATE_FLAGS_MCS_M GENMASK(19, 16) 1433 #define HTT_PPDU_STATS_USER_RATE_FLAGS_PREAMBLE_M GENMASK(23, 20) 1434 #define HTT_PPDU_STATS_USER_RATE_FLAGS_GI_M GENMASK(27, 24) 1435 #define HTT_PPDU_STATS_USER_RATE_FLAGS_DCM_M BIT(28) 1436 #define HTT_PPDU_STATS_USER_RATE_FLAGS_LDPC_M BIT(29) 1437 1438 #define HTT_USR_RATE_PREAMBLE(_val) \ 1439 le32_get_bits(_val, HTT_PPDU_STATS_USER_RATE_FLAGS_PREAMBLE_M) 1440 #define HTT_USR_RATE_BW(_val) \ 1441 le32_get_bits(_val, HTT_PPDU_STATS_USER_RATE_FLAGS_BW_M) 1442 #define HTT_USR_RATE_NSS(_val) \ 1443 le32_get_bits(_val, HTT_PPDU_STATS_USER_RATE_FLAGS_NSS_M) 1444 #define HTT_USR_RATE_MCS(_val) \ 1445 le32_get_bits(_val, HTT_PPDU_STATS_USER_RATE_FLAGS_MCS_M) 1446 #define HTT_USR_RATE_GI(_val) \ 1447 le32_get_bits(_val, HTT_PPDU_STATS_USER_RATE_FLAGS_GI_M) 1448 #define HTT_USR_RATE_DCM(_val) \ 1449 le32_get_bits(_val, HTT_PPDU_STATS_USER_RATE_FLAGS_DCM_M) 1450 1451 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_LTF_SIZE_M GENMASK(1, 0) 1452 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_STBC_M BIT(2) 1453 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_HE_RE_M BIT(3) 1454 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_TXBF_M GENMASK(7, 4) 1455 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_BW_M GENMASK(11, 8) 1456 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_NSS_M GENMASK(15, 12) 1457 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_MCS_M GENMASK(19, 16) 1458 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_PREAMBLE_M GENMASK(23, 20) 1459 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_GI_M GENMASK(27, 24) 1460 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_DCM_M BIT(28) 1461 #define HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_LDPC_M BIT(29) 1462 1463 struct htt_ppdu_stats_user_rate { 1464 u8 tid_num; 1465 u8 reserved0; 1466 __le16 sw_peer_id; 1467 __le32 info0; /* %HTT_PPDU_STATS_USER_RATE_INFO0_*/ 1468 __le16 ru_end; 1469 __le16 ru_start; 1470 __le16 resp_ru_end; 1471 __le16 resp_ru_start; 1472 __le32 info1; /* %HTT_PPDU_STATS_USER_RATE_INFO1_ */ 1473 __le32 rate_flags; /* %HTT_PPDU_STATS_USER_RATE_FLAGS_ */ 1474 /* Note: resp_rate_info is only valid for if resp_type is UL */ 1475 __le32 resp_rate_flags; /* %HTT_PPDU_STATS_USER_RATE_RESP_FLAGS_ */ 1476 } __packed; 1477 1478 #define HTT_PPDU_STATS_TX_INFO_FLAGS_RATECODE_M GENMASK(7, 0) 1479 #define HTT_PPDU_STATS_TX_INFO_FLAGS_IS_AMPDU_M BIT(8) 1480 #define HTT_PPDU_STATS_TX_INFO_FLAGS_BA_ACK_FAILED_M GENMASK(10, 9) 1481 #define HTT_PPDU_STATS_TX_INFO_FLAGS_BW_M GENMASK(13, 11) 1482 #define HTT_PPDU_STATS_TX_INFO_FLAGS_SGI_M BIT(14) 1483 #define HTT_PPDU_STATS_TX_INFO_FLAGS_PEERID_M GENMASK(31, 16) 1484 1485 #define HTT_TX_INFO_IS_AMSDU(_flags) \ 1486 u32_get_bits(_flags, HTT_PPDU_STATS_TX_INFO_FLAGS_IS_AMPDU_M) 1487 #define HTT_TX_INFO_BA_ACK_FAILED(_flags) \ 1488 u32_get_bits(_flags, HTT_PPDU_STATS_TX_INFO_FLAGS_BA_ACK_FAILED_M) 1489 #define HTT_TX_INFO_RATECODE(_flags) \ 1490 u32_get_bits(_flags, HTT_PPDU_STATS_TX_INFO_FLAGS_RATECODE_M) 1491 #define HTT_TX_INFO_PEERID(_flags) \ 1492 u32_get_bits(_flags, HTT_PPDU_STATS_TX_INFO_FLAGS_PEERID_M) 1493 1494 struct htt_tx_ppdu_stats_info { 1495 struct htt_tlv tlv_hdr; 1496 __le32 tx_success_bytes; 1497 __le32 tx_retry_bytes; 1498 __le32 tx_failed_bytes; 1499 __le32 flags; /* %HTT_PPDU_STATS_TX_INFO_FLAGS_ */ 1500 __le16 tx_success_msdus; 1501 __le16 tx_retry_msdus; 1502 __le16 tx_failed_msdus; 1503 __le16 tx_duration; /* united in us */ 1504 } __packed; 1505 1506 enum htt_ppdu_stats_usr_compln_status { 1507 HTT_PPDU_STATS_USER_STATUS_OK, 1508 HTT_PPDU_STATS_USER_STATUS_FILTERED, 1509 HTT_PPDU_STATS_USER_STATUS_RESP_TIMEOUT, 1510 HTT_PPDU_STATS_USER_STATUS_RESP_MISMATCH, 1511 HTT_PPDU_STATS_USER_STATUS_ABORT, 1512 }; 1513 1514 #define HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_LONG_RETRY_M GENMASK(3, 0) 1515 #define HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_SHORT_RETRY_M GENMASK(7, 4) 1516 #define HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_IS_AMPDU_M BIT(8) 1517 #define HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_RESP_TYPE_M GENMASK(12, 9) 1518 1519 #define HTT_USR_CMPLTN_IS_AMPDU(_val) \ 1520 le32_get_bits(_val, HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_IS_AMPDU_M) 1521 #define HTT_USR_CMPLTN_LONG_RETRY(_val) \ 1522 le32_get_bits(_val, HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_LONG_RETRY_M) 1523 #define HTT_USR_CMPLTN_SHORT_RETRY(_val) \ 1524 le32_get_bits(_val, HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_SHORT_RETRY_M) 1525 1526 struct htt_ppdu_stats_usr_cmpltn_cmn { 1527 u8 status; 1528 u8 tid_num; 1529 __le16 sw_peer_id; 1530 /* RSSI value of last ack packet (units = dB above noise floor) */ 1531 __le32 ack_rssi; 1532 __le16 mpdu_tried; 1533 __le16 mpdu_success; 1534 __le32 flags; /* %HTT_PPDU_STATS_USR_CMPLTN_CMN_FLAGS_LONG_RETRIES*/ 1535 } __packed; 1536 1537 #define HTT_PPDU_STATS_ACK_BA_INFO_NUM_MPDU_M GENMASK(8, 0) 1538 #define HTT_PPDU_STATS_ACK_BA_INFO_NUM_MSDU_M GENMASK(24, 9) 1539 #define HTT_PPDU_STATS_ACK_BA_INFO_TID_NUM GENMASK(31, 25) 1540 1541 #define HTT_PPDU_STATS_NON_QOS_TID 16 1542 1543 struct htt_ppdu_stats_usr_cmpltn_ack_ba_status { 1544 __le32 ppdu_id; 1545 __le16 sw_peer_id; 1546 __le16 reserved0; 1547 __le32 info; /* %HTT_PPDU_STATS_USR_CMPLTN_CMN_INFO_ */ 1548 __le16 current_seq; 1549 __le16 start_seq; 1550 __le32 success_bytes; 1551 } __packed; 1552 1553 struct htt_ppdu_user_stats { 1554 u16 peer_id; 1555 u16 delay_ba; 1556 u32 tlv_flags; 1557 bool is_valid_peer_id; 1558 struct htt_ppdu_stats_user_rate rate; 1559 struct htt_ppdu_stats_usr_cmpltn_cmn cmpltn_cmn; 1560 struct htt_ppdu_stats_usr_cmpltn_ack_ba_status ack_ba; 1561 }; 1562 1563 #define HTT_PPDU_STATS_MAX_USERS 8 1564 #define HTT_PPDU_DESC_MAX_DEPTH 16 1565 1566 struct htt_ppdu_stats { 1567 struct htt_ppdu_stats_common common; 1568 struct htt_ppdu_user_stats user_stats[HTT_PPDU_STATS_MAX_USERS]; 1569 }; 1570 1571 struct htt_ppdu_stats_info { 1572 u32 tlv_bitmap; 1573 u32 ppdu_id; 1574 u32 frame_type; 1575 u32 frame_ctrl; 1576 u32 delay_ba; 1577 u32 bar_num_users; 1578 struct htt_ppdu_stats ppdu_stats; 1579 struct list_head list; 1580 }; 1581 1582 /* @brief target -> host MLO offset indiciation message 1583 * 1584 * @details 1585 * The following field definitions describe the format of the HTT target 1586 * to host mlo offset indication message. 1587 * 1588 * 1589 * |31 29|28 |26|25 22|21 16|15 13|12 10 |9 8|7 0| 1590 * |---------------------------------------------------------------------| 1591 * | rsvd1 | mac_freq |chip_id |pdev_id|msgtype| 1592 * |---------------------------------------------------------------------| 1593 * | sync_timestamp_lo_us | 1594 * |---------------------------------------------------------------------| 1595 * | sync_timestamp_hi_us | 1596 * |---------------------------------------------------------------------| 1597 * | mlo_offset_lo | 1598 * |---------------------------------------------------------------------| 1599 * | mlo_offset_hi | 1600 * |---------------------------------------------------------------------| 1601 * | mlo_offset_clcks | 1602 * |---------------------------------------------------------------------| 1603 * | rsvd2 | mlo_comp_clks |mlo_comp_us | 1604 * |---------------------------------------------------------------------| 1605 * | rsvd3 |mlo_comp_timer | 1606 * |---------------------------------------------------------------------| 1607 * Header fields 1608 * - MSG_TYPE 1609 * Bits 7:0 1610 * Purpose: Identifies this is a MLO offset indication msg 1611 * - PDEV_ID 1612 * Bits 9:8 1613 * Purpose: Pdev of this MLO offset 1614 * - CHIP_ID 1615 * Bits 12:10 1616 * Purpose: chip_id of this MLO offset 1617 * - MAC_FREQ 1618 * Bits 28:13 1619 * - SYNC_TIMESTAMP_LO_US 1620 * Purpose: clock frequency of the mac HW block in MHz 1621 * Bits: 31:0 1622 * Purpose: lower 32 bits of the WLAN global time stamp at which 1623 * last sync interrupt was received 1624 * - SYNC_TIMESTAMP_HI_US 1625 * Bits: 31:0 1626 * Purpose: upper 32 bits of WLAN global time stamp at which 1627 * last sync interrupt was received 1628 * - MLO_OFFSET_LO 1629 * Bits: 31:0 1630 * Purpose: lower 32 bits of the MLO offset in us 1631 * - MLO_OFFSET_HI 1632 * Bits: 31:0 1633 * Purpose: upper 32 bits of the MLO offset in us 1634 * - MLO_COMP_US 1635 * Bits: 15:0 1636 * Purpose: MLO time stamp compensation applied in us 1637 * - MLO_COMP_CLCKS 1638 * Bits: 25:16 1639 * Purpose: MLO time stamp compensation applied in clock ticks 1640 * - MLO_COMP_TIMER 1641 * Bits: 21:0 1642 * Purpose: Periodic timer at which compensation is applied 1643 */ 1644 1645 #define HTT_T2H_MLO_OFFSET_INFO_MSG_TYPE GENMASK(7, 0) 1646 #define HTT_T2H_MLO_OFFSET_INFO_PDEV_ID GENMASK(9, 8) 1647 1648 struct ath12k_htt_mlo_offset_msg { 1649 __le32 info; 1650 __le32 sync_timestamp_lo_us; 1651 __le32 sync_timestamp_hi_us; 1652 __le32 mlo_offset_hi; 1653 __le32 mlo_offset_lo; 1654 __le32 mlo_offset_clks; 1655 __le32 mlo_comp_clks; 1656 __le32 mlo_comp_timer; 1657 } __packed; 1658 1659 /* @brief host -> target FW extended statistics retrieve 1660 * 1661 * @details 1662 * The following field definitions describe the format of the HTT host 1663 * to target FW extended stats retrieve message. 1664 * The message specifies the type of stats the host wants to retrieve. 1665 * 1666 * |31 24|23 16|15 8|7 0| 1667 * |-----------------------------------------------------------| 1668 * | reserved | stats type | pdev_mask | msg type | 1669 * |-----------------------------------------------------------| 1670 * | config param [0] | 1671 * |-----------------------------------------------------------| 1672 * | config param [1] | 1673 * |-----------------------------------------------------------| 1674 * | config param [2] | 1675 * |-----------------------------------------------------------| 1676 * | config param [3] | 1677 * |-----------------------------------------------------------| 1678 * | reserved | 1679 * |-----------------------------------------------------------| 1680 * | cookie LSBs | 1681 * |-----------------------------------------------------------| 1682 * | cookie MSBs | 1683 * |-----------------------------------------------------------| 1684 * Header fields: 1685 * - MSG_TYPE 1686 * Bits 7:0 1687 * Purpose: identifies this is a extended stats upload request message 1688 * Value: 0x10 1689 * - PDEV_MASK 1690 * Bits 8:15 1691 * Purpose: identifies the mask of PDEVs to retrieve stats from 1692 * Value: This is a overloaded field, refer to usage and interpretation of 1693 * PDEV in interface document. 1694 * Bit 8 : Reserved for SOC stats 1695 * Bit 9 - 15 : Indicates PDEV_MASK in DBDC 1696 * Indicates MACID_MASK in DBS 1697 * - STATS_TYPE 1698 * Bits 23:16 1699 * Purpose: identifies which FW statistics to upload 1700 * Value: Defined by htt_dbg_ext_stats_type (see htt_stats.h) 1701 * - Reserved 1702 * Bits 31:24 1703 * - CONFIG_PARAM [0] 1704 * Bits 31:0 1705 * Purpose: give an opaque configuration value to the specified stats type 1706 * Value: stats-type specific configuration value 1707 * Refer to htt_stats.h for interpretation for each stats sub_type 1708 * - CONFIG_PARAM [1] 1709 * Bits 31:0 1710 * Purpose: give an opaque configuration value to the specified stats type 1711 * Value: stats-type specific configuration value 1712 * Refer to htt_stats.h for interpretation for each stats sub_type 1713 * - CONFIG_PARAM [2] 1714 * Bits 31:0 1715 * Purpose: give an opaque configuration value to the specified stats type 1716 * Value: stats-type specific configuration value 1717 * Refer to htt_stats.h for interpretation for each stats sub_type 1718 * - CONFIG_PARAM [3] 1719 * Bits 31:0 1720 * Purpose: give an opaque configuration value to the specified stats type 1721 * Value: stats-type specific configuration value 1722 * Refer to htt_stats.h for interpretation for each stats sub_type 1723 * - Reserved [31:0] for future use. 1724 * - COOKIE_LSBS 1725 * Bits 31:0 1726 * Purpose: Provide a mechanism to match a target->host stats confirmation 1727 * message with its preceding host->target stats request message. 1728 * Value: LSBs of the opaque cookie specified by the host-side requestor 1729 * - COOKIE_MSBS 1730 * Bits 31:0 1731 * Purpose: Provide a mechanism to match a target->host stats confirmation 1732 * message with its preceding host->target stats request message. 1733 * Value: MSBs of the opaque cookie specified by the host-side requestor 1734 */ 1735 1736 struct htt_ext_stats_cfg_hdr { 1737 u8 msg_type; 1738 u8 pdev_mask; 1739 u8 stats_type; 1740 u8 reserved; 1741 } __packed; 1742 1743 struct htt_ext_stats_cfg_cmd { 1744 struct htt_ext_stats_cfg_hdr hdr; 1745 __le32 cfg_param0; 1746 __le32 cfg_param1; 1747 __le32 cfg_param2; 1748 __le32 cfg_param3; 1749 __le32 reserved; 1750 __le32 cookie_lsb; 1751 __le32 cookie_msb; 1752 } __packed; 1753 1754 /* htt stats config default params */ 1755 #define HTT_STAT_DEFAULT_RESET_START_OFFSET 0 1756 #define HTT_STAT_DEFAULT_CFG0_ALL_HWQS 0xffffffff 1757 #define HTT_STAT_DEFAULT_CFG0_ALL_TXQS 0xffffffff 1758 #define HTT_STAT_DEFAULT_CFG0_ALL_CMDQS 0xffff 1759 #define HTT_STAT_DEFAULT_CFG0_ALL_RINGS 0xffff 1760 #define HTT_STAT_DEFAULT_CFG0_ACTIVE_PEERS 0xff 1761 #define HTT_STAT_DEFAULT_CFG0_CCA_CUMULATIVE 0x00 1762 #define HTT_STAT_DEFAULT_CFG0_ACTIVE_VDEVS 0x00 1763 1764 /* HTT_DBG_EXT_STATS_PEER_INFO 1765 * PARAMS: 1766 * @config_param0: 1767 * [Bit0] - [0] for sw_peer_id, [1] for mac_addr based request 1768 * [Bit15 : Bit 1] htt_peer_stats_req_mode_t 1769 * [Bit31 : Bit16] sw_peer_id 1770 * @config_param1: 1771 * peer_stats_req_type_mask:32 (enum htt_peer_stats_tlv_enum) 1772 * 0 bit htt_peer_stats_cmn_tlv 1773 * 1 bit htt_peer_details_tlv 1774 * 2 bit htt_tx_peer_rate_stats_tlv 1775 * 3 bit htt_rx_peer_rate_stats_tlv 1776 * 4 bit htt_tx_tid_stats_tlv/htt_tx_tid_stats_v1_tlv 1777 * 5 bit htt_rx_tid_stats_tlv 1778 * 6 bit htt_msdu_flow_stats_tlv 1779 * @config_param2: [Bit31 : Bit0] mac_addr31to0 1780 * @config_param3: [Bit15 : Bit0] mac_addr47to32 1781 * [Bit31 : Bit16] reserved 1782 */ 1783 #define HTT_STAT_PEER_INFO_MAC_ADDR BIT(0) 1784 #define HTT_STAT_DEFAULT_PEER_REQ_TYPE 0x7f 1785 1786 /* Used to set different configs to the specified stats type.*/ 1787 struct htt_ext_stats_cfg_params { 1788 u32 cfg0; 1789 u32 cfg1; 1790 u32 cfg2; 1791 u32 cfg3; 1792 }; 1793 1794 enum vdev_stats_offload_timer_duration { 1795 ATH12K_STATS_TIMER_DUR_500MS = 1, 1796 ATH12K_STATS_TIMER_DUR_1SEC = 2, 1797 ATH12K_STATS_TIMER_DUR_2SEC = 3, 1798 }; 1799 1800 static inline void ath12k_dp_get_mac_addr(u32 addr_l32, u16 addr_h16, u8 *addr) 1801 { 1802 memcpy(addr, &addr_l32, 4); 1803 memcpy(addr + 4, &addr_h16, ETH_ALEN - 4); 1804 } 1805 1806 int ath12k_dp_service_srng(struct ath12k_base *ab, 1807 struct ath12k_ext_irq_grp *irq_grp, 1808 int budget); 1809 int ath12k_dp_htt_connect(struct ath12k_dp *dp); 1810 void ath12k_dp_vdev_tx_attach(struct ath12k *ar, struct ath12k_vif *arvif); 1811 void ath12k_dp_free(struct ath12k_base *ab); 1812 int ath12k_dp_alloc(struct ath12k_base *ab); 1813 void ath12k_dp_cc_config(struct ath12k_base *ab); 1814 int ath12k_dp_pdev_alloc(struct ath12k_base *ab); 1815 void ath12k_dp_pdev_pre_alloc(struct ath12k_base *ab); 1816 void ath12k_dp_pdev_free(struct ath12k_base *ab); 1817 int ath12k_dp_tx_htt_srng_setup(struct ath12k_base *ab, u32 ring_id, 1818 int mac_id, enum hal_ring_type ring_type); 1819 int ath12k_dp_peer_setup(struct ath12k *ar, int vdev_id, const u8 *addr); 1820 void ath12k_dp_peer_cleanup(struct ath12k *ar, int vdev_id, const u8 *addr); 1821 void ath12k_dp_srng_cleanup(struct ath12k_base *ab, struct dp_srng *ring); 1822 int ath12k_dp_srng_setup(struct ath12k_base *ab, struct dp_srng *ring, 1823 enum hal_ring_type type, int ring_num, 1824 int mac_id, int num_entries); 1825 void ath12k_dp_link_desc_cleanup(struct ath12k_base *ab, 1826 struct dp_link_desc_bank *desc_bank, 1827 u32 ring_type, struct dp_srng *ring); 1828 int ath12k_dp_link_desc_setup(struct ath12k_base *ab, 1829 struct dp_link_desc_bank *link_desc_banks, 1830 u32 ring_type, struct hal_srng *srng, 1831 u32 n_link_desc); 1832 struct ath12k_rx_desc_info *ath12k_dp_get_rx_desc(struct ath12k_base *ab, 1833 u32 cookie); 1834 struct ath12k_tx_desc_info *ath12k_dp_get_tx_desc(struct ath12k_base *ab, 1835 u32 desc_id); 1836 bool ath12k_dp_wmask_compaction_rx_tlv_supported(struct ath12k_base *ab); 1837 void ath12k_dp_hal_rx_desc_init(struct ath12k_base *ab); 1838 #endif 1839