18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: ISC */ 28c2ecf20Sopenharmony_ci/* 38c2ecf20Sopenharmony_ci * Copyright (c) 2005-2011 Atheros Communications Inc. 48c2ecf20Sopenharmony_ci * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. 58c2ecf20Sopenharmony_ci * Copyright (c) 2018, The Linux Foundation. All rights reserved. 68c2ecf20Sopenharmony_ci */ 78c2ecf20Sopenharmony_ci 88c2ecf20Sopenharmony_ci#ifndef _HTT_H_ 98c2ecf20Sopenharmony_ci#define _HTT_H_ 108c2ecf20Sopenharmony_ci 118c2ecf20Sopenharmony_ci#include <linux/bug.h> 128c2ecf20Sopenharmony_ci#include <linux/interrupt.h> 138c2ecf20Sopenharmony_ci#include <linux/dmapool.h> 148c2ecf20Sopenharmony_ci#include <linux/hashtable.h> 158c2ecf20Sopenharmony_ci#include <linux/kfifo.h> 168c2ecf20Sopenharmony_ci#include <net/mac80211.h> 178c2ecf20Sopenharmony_ci 188c2ecf20Sopenharmony_ci#include "htc.h" 198c2ecf20Sopenharmony_ci#include "hw.h" 208c2ecf20Sopenharmony_ci#include "rx_desc.h" 218c2ecf20Sopenharmony_ci 228c2ecf20Sopenharmony_cienum htt_dbg_stats_type { 238c2ecf20Sopenharmony_ci HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0, 248c2ecf20Sopenharmony_ci HTT_DBG_STATS_RX_REORDER = 1 << 1, 258c2ecf20Sopenharmony_ci HTT_DBG_STATS_RX_RATE_INFO = 1 << 2, 268c2ecf20Sopenharmony_ci HTT_DBG_STATS_TX_PPDU_LOG = 1 << 3, 278c2ecf20Sopenharmony_ci HTT_DBG_STATS_TX_RATE_INFO = 1 << 4, 288c2ecf20Sopenharmony_ci /* bits 5-23 currently reserved */ 298c2ecf20Sopenharmony_ci 308c2ecf20Sopenharmony_ci HTT_DBG_NUM_STATS /* keep this last */ 318c2ecf20Sopenharmony_ci}; 328c2ecf20Sopenharmony_ci 338c2ecf20Sopenharmony_cienum htt_h2t_msg_type { /* host-to-target */ 348c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_VERSION_REQ = 0, 358c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_TX_FRM = 1, 368c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_RX_RING_CFG = 2, 378c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_STATS_REQ = 3, 388c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_SYNC = 4, 398c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_AGGR_CFG = 5, 408c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG = 6, 418c2ecf20Sopenharmony_ci 428c2ecf20Sopenharmony_ci /* This command is used for sending management frames in HTT < 3.0. 438c2ecf20Sopenharmony_ci * HTT >= 3.0 uses TX_FRM for everything. 448c2ecf20Sopenharmony_ci */ 458c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_MGMT_TX = 7, 468c2ecf20Sopenharmony_ci HTT_H2T_MSG_TYPE_TX_FETCH_RESP = 11, 478c2ecf20Sopenharmony_ci 488c2ecf20Sopenharmony_ci HTT_H2T_NUM_MSGS /* keep this last */ 498c2ecf20Sopenharmony_ci}; 508c2ecf20Sopenharmony_ci 518c2ecf20Sopenharmony_cistruct htt_cmd_hdr { 528c2ecf20Sopenharmony_ci u8 msg_type; 538c2ecf20Sopenharmony_ci} __packed; 548c2ecf20Sopenharmony_ci 558c2ecf20Sopenharmony_cistruct htt_ver_req { 568c2ecf20Sopenharmony_ci u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)]; 578c2ecf20Sopenharmony_ci} __packed; 588c2ecf20Sopenharmony_ci 598c2ecf20Sopenharmony_ci/* 608c2ecf20Sopenharmony_ci * HTT tx MSDU descriptor 618c2ecf20Sopenharmony_ci * 628c2ecf20Sopenharmony_ci * The HTT tx MSDU descriptor is created by the host HTT SW for each 638c2ecf20Sopenharmony_ci * tx MSDU. The HTT tx MSDU descriptor contains the information that 648c2ecf20Sopenharmony_ci * the target firmware needs for the FW's tx processing, particularly 658c2ecf20Sopenharmony_ci * for creating the HW msdu descriptor. 668c2ecf20Sopenharmony_ci * The same HTT tx descriptor is used for HL and LL systems, though 678c2ecf20Sopenharmony_ci * a few fields within the tx descriptor are used only by LL or 688c2ecf20Sopenharmony_ci * only by HL. 698c2ecf20Sopenharmony_ci * The HTT tx descriptor is defined in two manners: by a struct with 708c2ecf20Sopenharmony_ci * bitfields, and by a series of [dword offset, bit mask, bit shift] 718c2ecf20Sopenharmony_ci * definitions. 728c2ecf20Sopenharmony_ci * The target should use the struct def, for simplicitly and clarity, 738c2ecf20Sopenharmony_ci * but the host shall use the bit-mast + bit-shift defs, to be endian- 748c2ecf20Sopenharmony_ci * neutral. Specifically, the host shall use the get/set macros built 758c2ecf20Sopenharmony_ci * around the mask + shift defs. 768c2ecf20Sopenharmony_ci */ 778c2ecf20Sopenharmony_cistruct htt_data_tx_desc_frag { 788c2ecf20Sopenharmony_ci union { 798c2ecf20Sopenharmony_ci struct double_word_addr { 808c2ecf20Sopenharmony_ci __le32 paddr; 818c2ecf20Sopenharmony_ci __le32 len; 828c2ecf20Sopenharmony_ci } __packed dword_addr; 838c2ecf20Sopenharmony_ci struct triple_word_addr { 848c2ecf20Sopenharmony_ci __le32 paddr_lo; 858c2ecf20Sopenharmony_ci __le16 paddr_hi; 868c2ecf20Sopenharmony_ci __le16 len_16; 878c2ecf20Sopenharmony_ci } __packed tword_addr; 888c2ecf20Sopenharmony_ci } __packed; 898c2ecf20Sopenharmony_ci} __packed; 908c2ecf20Sopenharmony_ci 918c2ecf20Sopenharmony_cistruct htt_msdu_ext_desc { 928c2ecf20Sopenharmony_ci __le32 tso_flag[3]; 938c2ecf20Sopenharmony_ci __le16 ip_identification; 948c2ecf20Sopenharmony_ci u8 flags; 958c2ecf20Sopenharmony_ci u8 reserved; 968c2ecf20Sopenharmony_ci struct htt_data_tx_desc_frag frags[6]; 978c2ecf20Sopenharmony_ci}; 988c2ecf20Sopenharmony_ci 998c2ecf20Sopenharmony_cistruct htt_msdu_ext_desc_64 { 1008c2ecf20Sopenharmony_ci __le32 tso_flag[5]; 1018c2ecf20Sopenharmony_ci __le16 ip_identification; 1028c2ecf20Sopenharmony_ci u8 flags; 1038c2ecf20Sopenharmony_ci u8 reserved; 1048c2ecf20Sopenharmony_ci struct htt_data_tx_desc_frag frags[6]; 1058c2ecf20Sopenharmony_ci}; 1068c2ecf20Sopenharmony_ci 1078c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE BIT(0) 1088c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE BIT(1) 1098c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE BIT(2) 1108c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE BIT(3) 1118c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE BIT(4) 1128c2ecf20Sopenharmony_ci 1138c2ecf20Sopenharmony_ci#define HTT_MSDU_CHECKSUM_ENABLE (HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE \ 1148c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE \ 1158c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE \ 1168c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE \ 1178c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE) 1188c2ecf20Sopenharmony_ci 1198c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE_64 BIT(16) 1208c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE_64 BIT(17) 1218c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE_64 BIT(18) 1228c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE_64 BIT(19) 1238c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE_64 BIT(20) 1248c2ecf20Sopenharmony_ci#define HTT_MSDU_EXT_DESC_FLAG_PARTIAL_CSUM_ENABLE_64 BIT(21) 1258c2ecf20Sopenharmony_ci 1268c2ecf20Sopenharmony_ci#define HTT_MSDU_CHECKSUM_ENABLE_64 (HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE_64 \ 1278c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE_64 \ 1288c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE_64 \ 1298c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE_64 \ 1308c2ecf20Sopenharmony_ci | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE_64) 1318c2ecf20Sopenharmony_ci 1328c2ecf20Sopenharmony_cienum htt_data_tx_desc_flags0 { 1338c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1 << 0, 1348c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1 << 1, 1358c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT = 1 << 2, 1368c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS0_NO_CLASSIFY = 1 << 3, 1378c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS0_RSVD0 = 1 << 4 1388c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_MASK 0xE0 1398c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_LSB 5 1408c2ecf20Sopenharmony_ci}; 1418c2ecf20Sopenharmony_ci 1428c2ecf20Sopenharmony_cienum htt_data_tx_desc_flags1 { 1438c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_BITS 6 1448c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_MASK 0x003F 1458c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_LSB 0 1468c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_BITS 5 1478c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_MASK 0x07C0 1488c2ecf20Sopenharmony_ci#define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_LSB 6 1498c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS1_POSTPONED = 1 << 11, 1508c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS1_MORE_IN_BATCH = 1 << 12, 1518c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD = 1 << 13, 1528c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD = 1 << 14, 1538c2ecf20Sopenharmony_ci HTT_DATA_TX_DESC_FLAGS1_TX_COMPLETE = 1 << 15 1548c2ecf20Sopenharmony_ci}; 1558c2ecf20Sopenharmony_ci 1568c2ecf20Sopenharmony_ci#define HTT_TX_CREDIT_DELTA_ABS_M 0xffff0000 1578c2ecf20Sopenharmony_ci#define HTT_TX_CREDIT_DELTA_ABS_S 16 1588c2ecf20Sopenharmony_ci#define HTT_TX_CREDIT_DELTA_ABS_GET(word) \ 1598c2ecf20Sopenharmony_ci (((word) & HTT_TX_CREDIT_DELTA_ABS_M) >> HTT_TX_CREDIT_DELTA_ABS_S) 1608c2ecf20Sopenharmony_ci 1618c2ecf20Sopenharmony_ci#define HTT_TX_CREDIT_SIGN_BIT_M 0x00000100 1628c2ecf20Sopenharmony_ci#define HTT_TX_CREDIT_SIGN_BIT_S 8 1638c2ecf20Sopenharmony_ci#define HTT_TX_CREDIT_SIGN_BIT_GET(word) \ 1648c2ecf20Sopenharmony_ci (((word) & HTT_TX_CREDIT_SIGN_BIT_M) >> HTT_TX_CREDIT_SIGN_BIT_S) 1658c2ecf20Sopenharmony_ci 1668c2ecf20Sopenharmony_cienum htt_data_tx_ext_tid { 1678c2ecf20Sopenharmony_ci HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST = 16, 1688c2ecf20Sopenharmony_ci HTT_DATA_TX_EXT_TID_MGMT = 17, 1698c2ecf20Sopenharmony_ci HTT_DATA_TX_EXT_TID_INVALID = 31 1708c2ecf20Sopenharmony_ci}; 1718c2ecf20Sopenharmony_ci 1728c2ecf20Sopenharmony_ci#define HTT_INVALID_PEERID 0xFFFF 1738c2ecf20Sopenharmony_ci 1748c2ecf20Sopenharmony_ci/* 1758c2ecf20Sopenharmony_ci * htt_data_tx_desc - used for data tx path 1768c2ecf20Sopenharmony_ci * 1778c2ecf20Sopenharmony_ci * Note: vdev_id irrelevant for pkt_type == raw and no_classify == 1. 1788c2ecf20Sopenharmony_ci * ext_tid: for qos-data frames (0-15), see %HTT_DATA_TX_EXT_TID_ 1798c2ecf20Sopenharmony_ci * for special kinds of tids 1808c2ecf20Sopenharmony_ci * postponed: only for HL hosts. indicates if this is a resend 1818c2ecf20Sopenharmony_ci * (HL hosts manage queues on the host ) 1828c2ecf20Sopenharmony_ci * more_in_batch: only for HL hosts. indicates if more packets are 1838c2ecf20Sopenharmony_ci * pending. this allows target to wait and aggregate 1848c2ecf20Sopenharmony_ci * freq: 0 means home channel of given vdev. intended for offchannel 1858c2ecf20Sopenharmony_ci */ 1868c2ecf20Sopenharmony_cistruct htt_data_tx_desc { 1878c2ecf20Sopenharmony_ci u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */ 1888c2ecf20Sopenharmony_ci __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */ 1898c2ecf20Sopenharmony_ci __le16 len; 1908c2ecf20Sopenharmony_ci __le16 id; 1918c2ecf20Sopenharmony_ci __le32 frags_paddr; 1928c2ecf20Sopenharmony_ci union { 1938c2ecf20Sopenharmony_ci __le32 peerid; 1948c2ecf20Sopenharmony_ci struct { 1958c2ecf20Sopenharmony_ci __le16 peerid; 1968c2ecf20Sopenharmony_ci __le16 freq; 1978c2ecf20Sopenharmony_ci } __packed offchan_tx; 1988c2ecf20Sopenharmony_ci } __packed; 1998c2ecf20Sopenharmony_ci u8 prefetch[0]; /* start of frame, for FW classification engine */ 2008c2ecf20Sopenharmony_ci} __packed; 2018c2ecf20Sopenharmony_ci 2028c2ecf20Sopenharmony_cistruct htt_data_tx_desc_64 { 2038c2ecf20Sopenharmony_ci u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */ 2048c2ecf20Sopenharmony_ci __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */ 2058c2ecf20Sopenharmony_ci __le16 len; 2068c2ecf20Sopenharmony_ci __le16 id; 2078c2ecf20Sopenharmony_ci __le64 frags_paddr; 2088c2ecf20Sopenharmony_ci union { 2098c2ecf20Sopenharmony_ci __le32 peerid; 2108c2ecf20Sopenharmony_ci struct { 2118c2ecf20Sopenharmony_ci __le16 peerid; 2128c2ecf20Sopenharmony_ci __le16 freq; 2138c2ecf20Sopenharmony_ci } __packed offchan_tx; 2148c2ecf20Sopenharmony_ci } __packed; 2158c2ecf20Sopenharmony_ci u8 prefetch[0]; /* start of frame, for FW classification engine */ 2168c2ecf20Sopenharmony_ci} __packed; 2178c2ecf20Sopenharmony_ci 2188c2ecf20Sopenharmony_cienum htt_rx_ring_flags { 2198c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MAC80211_HDR = 1 << 0, 2208c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MSDU_PAYLOAD = 1 << 1, 2218c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_PPDU_START = 1 << 2, 2228c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_PPDU_END = 1 << 3, 2238c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MPDU_START = 1 << 4, 2248c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MPDU_END = 1 << 5, 2258c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MSDU_START = 1 << 6, 2268c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MSDU_END = 1 << 7, 2278c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_RX_ATTENTION = 1 << 8, 2288c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_FRAG_INFO = 1 << 9, 2298c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_UNICAST_RX = 1 << 10, 2308c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MULTICAST_RX = 1 << 11, 2318c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_CTRL_RX = 1 << 12, 2328c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_MGMT_RX = 1 << 13, 2338c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_NULL_RX = 1 << 14, 2348c2ecf20Sopenharmony_ci HTT_RX_RING_FLAGS_PHY_DATA_RX = 1 << 15 2358c2ecf20Sopenharmony_ci}; 2368c2ecf20Sopenharmony_ci 2378c2ecf20Sopenharmony_ci#define HTT_RX_RING_SIZE_MIN 128 2388c2ecf20Sopenharmony_ci#define HTT_RX_RING_SIZE_MAX 2048 2398c2ecf20Sopenharmony_ci#define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX 2408c2ecf20Sopenharmony_ci#define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1) 2418c2ecf20Sopenharmony_ci#define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1) 2428c2ecf20Sopenharmony_ci 2438c2ecf20Sopenharmony_cistruct htt_rx_ring_setup_ring32 { 2448c2ecf20Sopenharmony_ci __le32 fw_idx_shadow_reg_paddr; 2458c2ecf20Sopenharmony_ci __le32 rx_ring_base_paddr; 2468c2ecf20Sopenharmony_ci __le16 rx_ring_len; /* in 4-byte words */ 2478c2ecf20Sopenharmony_ci __le16 rx_ring_bufsize; /* rx skb size - in bytes */ 2488c2ecf20Sopenharmony_ci __le16 flags; /* %HTT_RX_RING_FLAGS_ */ 2498c2ecf20Sopenharmony_ci __le16 fw_idx_init_val; 2508c2ecf20Sopenharmony_ci 2518c2ecf20Sopenharmony_ci /* the following offsets are in 4-byte units */ 2528c2ecf20Sopenharmony_ci __le16 mac80211_hdr_offset; 2538c2ecf20Sopenharmony_ci __le16 msdu_payload_offset; 2548c2ecf20Sopenharmony_ci __le16 ppdu_start_offset; 2558c2ecf20Sopenharmony_ci __le16 ppdu_end_offset; 2568c2ecf20Sopenharmony_ci __le16 mpdu_start_offset; 2578c2ecf20Sopenharmony_ci __le16 mpdu_end_offset; 2588c2ecf20Sopenharmony_ci __le16 msdu_start_offset; 2598c2ecf20Sopenharmony_ci __le16 msdu_end_offset; 2608c2ecf20Sopenharmony_ci __le16 rx_attention_offset; 2618c2ecf20Sopenharmony_ci __le16 frag_info_offset; 2628c2ecf20Sopenharmony_ci} __packed; 2638c2ecf20Sopenharmony_ci 2648c2ecf20Sopenharmony_cistruct htt_rx_ring_setup_ring64 { 2658c2ecf20Sopenharmony_ci __le64 fw_idx_shadow_reg_paddr; 2668c2ecf20Sopenharmony_ci __le64 rx_ring_base_paddr; 2678c2ecf20Sopenharmony_ci __le16 rx_ring_len; /* in 4-byte words */ 2688c2ecf20Sopenharmony_ci __le16 rx_ring_bufsize; /* rx skb size - in bytes */ 2698c2ecf20Sopenharmony_ci __le16 flags; /* %HTT_RX_RING_FLAGS_ */ 2708c2ecf20Sopenharmony_ci __le16 fw_idx_init_val; 2718c2ecf20Sopenharmony_ci 2728c2ecf20Sopenharmony_ci /* the following offsets are in 4-byte units */ 2738c2ecf20Sopenharmony_ci __le16 mac80211_hdr_offset; 2748c2ecf20Sopenharmony_ci __le16 msdu_payload_offset; 2758c2ecf20Sopenharmony_ci __le16 ppdu_start_offset; 2768c2ecf20Sopenharmony_ci __le16 ppdu_end_offset; 2778c2ecf20Sopenharmony_ci __le16 mpdu_start_offset; 2788c2ecf20Sopenharmony_ci __le16 mpdu_end_offset; 2798c2ecf20Sopenharmony_ci __le16 msdu_start_offset; 2808c2ecf20Sopenharmony_ci __le16 msdu_end_offset; 2818c2ecf20Sopenharmony_ci __le16 rx_attention_offset; 2828c2ecf20Sopenharmony_ci __le16 frag_info_offset; 2838c2ecf20Sopenharmony_ci} __packed; 2848c2ecf20Sopenharmony_ci 2858c2ecf20Sopenharmony_cistruct htt_rx_ring_setup_hdr { 2868c2ecf20Sopenharmony_ci u8 num_rings; /* supported values: 1, 2 */ 2878c2ecf20Sopenharmony_ci __le16 rsvd0; 2888c2ecf20Sopenharmony_ci} __packed; 2898c2ecf20Sopenharmony_ci 2908c2ecf20Sopenharmony_cistruct htt_rx_ring_setup_32 { 2918c2ecf20Sopenharmony_ci struct htt_rx_ring_setup_hdr hdr; 2928c2ecf20Sopenharmony_ci struct htt_rx_ring_setup_ring32 rings[]; 2938c2ecf20Sopenharmony_ci} __packed; 2948c2ecf20Sopenharmony_ci 2958c2ecf20Sopenharmony_cistruct htt_rx_ring_setup_64 { 2968c2ecf20Sopenharmony_ci struct htt_rx_ring_setup_hdr hdr; 2978c2ecf20Sopenharmony_ci struct htt_rx_ring_setup_ring64 rings[]; 2988c2ecf20Sopenharmony_ci} __packed; 2998c2ecf20Sopenharmony_ci 3008c2ecf20Sopenharmony_ci/* 3018c2ecf20Sopenharmony_ci * htt_stats_req - request target to send specified statistics 3028c2ecf20Sopenharmony_ci * 3038c2ecf20Sopenharmony_ci * @msg_type: hardcoded %HTT_H2T_MSG_TYPE_STATS_REQ 3048c2ecf20Sopenharmony_ci * @upload_types: see %htt_dbg_stats_type. this is 24bit field actually 3058c2ecf20Sopenharmony_ci * so make sure its little-endian. 3068c2ecf20Sopenharmony_ci * @reset_types: see %htt_dbg_stats_type. this is 24bit field actually 3078c2ecf20Sopenharmony_ci * so make sure its little-endian. 3088c2ecf20Sopenharmony_ci * @cfg_val: stat_type specific configuration 3098c2ecf20Sopenharmony_ci * @stat_type: see %htt_dbg_stats_type 3108c2ecf20Sopenharmony_ci * @cookie_lsb: used for confirmation message from target->host 3118c2ecf20Sopenharmony_ci * @cookie_msb: ditto as %cookie 3128c2ecf20Sopenharmony_ci */ 3138c2ecf20Sopenharmony_cistruct htt_stats_req { 3148c2ecf20Sopenharmony_ci u8 upload_types[3]; 3158c2ecf20Sopenharmony_ci u8 rsvd0; 3168c2ecf20Sopenharmony_ci u8 reset_types[3]; 3178c2ecf20Sopenharmony_ci struct { 3188c2ecf20Sopenharmony_ci u8 mpdu_bytes; 3198c2ecf20Sopenharmony_ci u8 mpdu_num_msdus; 3208c2ecf20Sopenharmony_ci u8 msdu_bytes; 3218c2ecf20Sopenharmony_ci } __packed; 3228c2ecf20Sopenharmony_ci u8 stat_type; 3238c2ecf20Sopenharmony_ci __le32 cookie_lsb; 3248c2ecf20Sopenharmony_ci __le32 cookie_msb; 3258c2ecf20Sopenharmony_ci} __packed; 3268c2ecf20Sopenharmony_ci 3278c2ecf20Sopenharmony_ci#define HTT_STATS_REQ_CFG_STAT_TYPE_INVALID 0xff 3288c2ecf20Sopenharmony_ci#define HTT_STATS_BIT_MASK GENMASK(16, 0) 3298c2ecf20Sopenharmony_ci 3308c2ecf20Sopenharmony_ci/* 3318c2ecf20Sopenharmony_ci * htt_oob_sync_req - request out-of-band sync 3328c2ecf20Sopenharmony_ci * 3338c2ecf20Sopenharmony_ci * The HTT SYNC tells the target to suspend processing of subsequent 3348c2ecf20Sopenharmony_ci * HTT host-to-target messages until some other target agent locally 3358c2ecf20Sopenharmony_ci * informs the target HTT FW that the current sync counter is equal to 3368c2ecf20Sopenharmony_ci * or greater than (in a modulo sense) the sync counter specified in 3378c2ecf20Sopenharmony_ci * the SYNC message. 3388c2ecf20Sopenharmony_ci * 3398c2ecf20Sopenharmony_ci * This allows other host-target components to synchronize their operation 3408c2ecf20Sopenharmony_ci * with HTT, e.g. to ensure that tx frames don't get transmitted until a 3418c2ecf20Sopenharmony_ci * security key has been downloaded to and activated by the target. 3428c2ecf20Sopenharmony_ci * In the absence of any explicit synchronization counter value 3438c2ecf20Sopenharmony_ci * specification, the target HTT FW will use zero as the default current 3448c2ecf20Sopenharmony_ci * sync value. 3458c2ecf20Sopenharmony_ci * 3468c2ecf20Sopenharmony_ci * The HTT target FW will suspend its host->target message processing as long 3478c2ecf20Sopenharmony_ci * as 0 < (in-band sync counter - out-of-band sync counter) & 0xff < 128. 3488c2ecf20Sopenharmony_ci */ 3498c2ecf20Sopenharmony_cistruct htt_oob_sync_req { 3508c2ecf20Sopenharmony_ci u8 sync_count; 3518c2ecf20Sopenharmony_ci __le16 rsvd0; 3528c2ecf20Sopenharmony_ci} __packed; 3538c2ecf20Sopenharmony_ci 3548c2ecf20Sopenharmony_cistruct htt_aggr_conf { 3558c2ecf20Sopenharmony_ci u8 max_num_ampdu_subframes; 3568c2ecf20Sopenharmony_ci /* amsdu_subframes is limited by 0x1F mask */ 3578c2ecf20Sopenharmony_ci u8 max_num_amsdu_subframes; 3588c2ecf20Sopenharmony_ci} __packed; 3598c2ecf20Sopenharmony_ci 3608c2ecf20Sopenharmony_cistruct htt_aggr_conf_v2 { 3618c2ecf20Sopenharmony_ci u8 max_num_ampdu_subframes; 3628c2ecf20Sopenharmony_ci /* amsdu_subframes is limited by 0x1F mask */ 3638c2ecf20Sopenharmony_ci u8 max_num_amsdu_subframes; 3648c2ecf20Sopenharmony_ci u8 reserved; 3658c2ecf20Sopenharmony_ci} __packed; 3668c2ecf20Sopenharmony_ci 3678c2ecf20Sopenharmony_ci#define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32 3688c2ecf20Sopenharmony_cistruct htt_mgmt_tx_desc_qca99x0 { 3698c2ecf20Sopenharmony_ci __le32 rate; 3708c2ecf20Sopenharmony_ci} __packed; 3718c2ecf20Sopenharmony_ci 3728c2ecf20Sopenharmony_cistruct htt_mgmt_tx_desc { 3738c2ecf20Sopenharmony_ci u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)]; 3748c2ecf20Sopenharmony_ci __le32 msdu_paddr; 3758c2ecf20Sopenharmony_ci __le32 desc_id; 3768c2ecf20Sopenharmony_ci __le32 len; 3778c2ecf20Sopenharmony_ci __le32 vdev_id; 3788c2ecf20Sopenharmony_ci u8 hdr[HTT_MGMT_FRM_HDR_DOWNLOAD_LEN]; 3798c2ecf20Sopenharmony_ci union { 3808c2ecf20Sopenharmony_ci struct htt_mgmt_tx_desc_qca99x0 qca99x0; 3818c2ecf20Sopenharmony_ci } __packed; 3828c2ecf20Sopenharmony_ci} __packed; 3838c2ecf20Sopenharmony_ci 3848c2ecf20Sopenharmony_cienum htt_mgmt_tx_status { 3858c2ecf20Sopenharmony_ci HTT_MGMT_TX_STATUS_OK = 0, 3868c2ecf20Sopenharmony_ci HTT_MGMT_TX_STATUS_RETRY = 1, 3878c2ecf20Sopenharmony_ci HTT_MGMT_TX_STATUS_DROP = 2 3888c2ecf20Sopenharmony_ci}; 3898c2ecf20Sopenharmony_ci 3908c2ecf20Sopenharmony_ci/*=== target -> host messages ===============================================*/ 3918c2ecf20Sopenharmony_ci 3928c2ecf20Sopenharmony_cienum htt_main_t2h_msg_type { 3938c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF = 0x0, 3948c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_IND = 0x1, 3958c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH = 0x2, 3968c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_PEER_MAP = 0x3, 3978c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP = 0x4, 3988c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA = 0x5, 3998c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_DELBA = 0x6, 4008c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, 4018c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_PKTLOG = 0x8, 4028c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_STATS_CONF = 0x9, 4038c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, 4048c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_SEC_IND = 0xb, 4058c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, 4068c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, 4078c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, 4088c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND = 0x10, 4098c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, 4108c2ecf20Sopenharmony_ci HTT_MAIN_T2H_MSG_TYPE_TEST, 4118c2ecf20Sopenharmony_ci /* keep this last */ 4128c2ecf20Sopenharmony_ci HTT_MAIN_T2H_NUM_MSGS 4138c2ecf20Sopenharmony_ci}; 4148c2ecf20Sopenharmony_ci 4158c2ecf20Sopenharmony_cienum htt_10x_t2h_msg_type { 4168c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_VERSION_CONF = 0x0, 4178c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_RX_IND = 0x1, 4188c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_RX_FLUSH = 0x2, 4198c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_PEER_MAP = 0x3, 4208c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_PEER_UNMAP = 0x4, 4218c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_RX_ADDBA = 0x5, 4228c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_RX_DELBA = 0x6, 4238c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, 4248c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_PKTLOG = 0x8, 4258c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_STATS_CONF = 0x9, 4268c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, 4278c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_SEC_IND = 0xb, 4288c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, 4298c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, 4308c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_TEST = 0xe, 4318c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE = 0xf, 4328c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_AGGR_CONF = 0x11, 4338c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x12, 4348c2ecf20Sopenharmony_ci HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0x13, 4358c2ecf20Sopenharmony_ci /* keep this last */ 4368c2ecf20Sopenharmony_ci HTT_10X_T2H_NUM_MSGS 4378c2ecf20Sopenharmony_ci}; 4388c2ecf20Sopenharmony_ci 4398c2ecf20Sopenharmony_cienum htt_tlv_t2h_msg_type { 4408c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_VERSION_CONF = 0x0, 4418c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_IND = 0x1, 4428c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_FLUSH = 0x2, 4438c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_PEER_MAP = 0x3, 4448c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP = 0x4, 4458c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_ADDBA = 0x5, 4468c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_DELBA = 0x6, 4478c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, 4488c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_PKTLOG = 0x8, 4498c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_STATS_CONF = 0x9, 4508c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, 4518c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_SEC_IND = 0xb, 4528c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, /* deprecated */ 4538c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, 4548c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, 4558c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, 4568c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_PN_IND = 0x10, 4578c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, 4588c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12, 4598c2ecf20Sopenharmony_ci /* 0x13 reservd */ 4608c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14, 4618c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE = 0x15, 4628c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR = 0x16, 4638c2ecf20Sopenharmony_ci HTT_TLV_T2H_MSG_TYPE_TEST, 4648c2ecf20Sopenharmony_ci /* keep this last */ 4658c2ecf20Sopenharmony_ci HTT_TLV_T2H_NUM_MSGS 4668c2ecf20Sopenharmony_ci}; 4678c2ecf20Sopenharmony_ci 4688c2ecf20Sopenharmony_cienum htt_10_4_t2h_msg_type { 4698c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_VERSION_CONF = 0x0, 4708c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_IND = 0x1, 4718c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_FLUSH = 0x2, 4728c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_PEER_MAP = 0x3, 4738c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_PEER_UNMAP = 0x4, 4748c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_ADDBA = 0x5, 4758c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_DELBA = 0x6, 4768c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, 4778c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_PKTLOG = 0x8, 4788c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_STATS_CONF = 0x9, 4798c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, 4808c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_SEC_IND = 0xb, 4818c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, 4828c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, 4838c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, 4848c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_CHAN_CHANGE = 0xf, 4858c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0x10, 4868c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_PN_IND = 0x11, 4878c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x12, 4888c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TEST = 0x13, 4898c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_EN_STATS = 0x14, 4908c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_AGGR_CONF = 0x15, 4918c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TX_FETCH_IND = 0x16, 4928c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TX_FETCH_CONFIRM = 0x17, 4938c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x18, 4948c2ecf20Sopenharmony_ci /* 0x19 to 0x2f are reserved */ 4958c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_TX_MODE_SWITCH_IND = 0x30, 4968c2ecf20Sopenharmony_ci HTT_10_4_T2H_MSG_TYPE_PEER_STATS = 0x31, 4978c2ecf20Sopenharmony_ci /* keep this last */ 4988c2ecf20Sopenharmony_ci HTT_10_4_T2H_NUM_MSGS 4998c2ecf20Sopenharmony_ci}; 5008c2ecf20Sopenharmony_ci 5018c2ecf20Sopenharmony_cienum htt_t2h_msg_type { 5028c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_VERSION_CONF, 5038c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_IND, 5048c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_FLUSH, 5058c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_PEER_MAP, 5068c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_PEER_UNMAP, 5078c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_ADDBA, 5088c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_DELBA, 5098c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TX_COMPL_IND, 5108c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_PKTLOG, 5118c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_STATS_CONF, 5128c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_FRAG_IND, 5138c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_SEC_IND, 5148c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RC_UPDATE_IND, 5158c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TX_INSPECT_IND, 5168c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION, 5178c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND, 5188c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_PN_IND, 5198c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND, 5208c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND, 5218c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE, 5228c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_CHAN_CHANGE, 5238c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR, 5248c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_AGGR_CONF, 5258c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_STATS_NOUPLOAD, 5268c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TEST, 5278c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_EN_STATS, 5288c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TX_FETCH_IND, 5298c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM, 5308c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_TX_MODE_SWITCH_IND, 5318c2ecf20Sopenharmony_ci HTT_T2H_MSG_TYPE_PEER_STATS, 5328c2ecf20Sopenharmony_ci /* keep this last */ 5338c2ecf20Sopenharmony_ci HTT_T2H_NUM_MSGS 5348c2ecf20Sopenharmony_ci}; 5358c2ecf20Sopenharmony_ci 5368c2ecf20Sopenharmony_ci/* 5378c2ecf20Sopenharmony_ci * htt_resp_hdr - header for target-to-host messages 5388c2ecf20Sopenharmony_ci * 5398c2ecf20Sopenharmony_ci * msg_type: see htt_t2h_msg_type 5408c2ecf20Sopenharmony_ci */ 5418c2ecf20Sopenharmony_cistruct htt_resp_hdr { 5428c2ecf20Sopenharmony_ci u8 msg_type; 5438c2ecf20Sopenharmony_ci} __packed; 5448c2ecf20Sopenharmony_ci 5458c2ecf20Sopenharmony_ci#define HTT_RESP_HDR_MSG_TYPE_OFFSET 0 5468c2ecf20Sopenharmony_ci#define HTT_RESP_HDR_MSG_TYPE_MASK 0xff 5478c2ecf20Sopenharmony_ci#define HTT_RESP_HDR_MSG_TYPE_LSB 0 5488c2ecf20Sopenharmony_ci 5498c2ecf20Sopenharmony_ci/* htt_ver_resp - response sent for htt_ver_req */ 5508c2ecf20Sopenharmony_cistruct htt_ver_resp { 5518c2ecf20Sopenharmony_ci u8 minor; 5528c2ecf20Sopenharmony_ci u8 major; 5538c2ecf20Sopenharmony_ci u8 rsvd0; 5548c2ecf20Sopenharmony_ci} __packed; 5558c2ecf20Sopenharmony_ci 5568c2ecf20Sopenharmony_ci#define HTT_MGMT_TX_CMPL_FLAG_ACK_RSSI BIT(0) 5578c2ecf20Sopenharmony_ci 5588c2ecf20Sopenharmony_ci#define HTT_MGMT_TX_CMPL_INFO_ACK_RSSI_MASK GENMASK(7, 0) 5598c2ecf20Sopenharmony_ci 5608c2ecf20Sopenharmony_cistruct htt_mgmt_tx_completion { 5618c2ecf20Sopenharmony_ci u8 rsvd0; 5628c2ecf20Sopenharmony_ci u8 rsvd1; 5638c2ecf20Sopenharmony_ci u8 flags; 5648c2ecf20Sopenharmony_ci __le32 desc_id; 5658c2ecf20Sopenharmony_ci __le32 status; 5668c2ecf20Sopenharmony_ci __le32 ppdu_id; 5678c2ecf20Sopenharmony_ci __le32 info; 5688c2ecf20Sopenharmony_ci} __packed; 5698c2ecf20Sopenharmony_ci 5708c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_EXT_TID_MASK (0x1F) 5718c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0) 5728c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 5) 5738c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 6) 5748c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_PPDU_DURATION BIT(7) 5758c2ecf20Sopenharmony_ci 5768c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F 5778c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0 5788c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_MASK 0x00000FC0 5798c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_LSB 6 5808c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_MASK 0x0003F000 5818c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_LSB 12 5828c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_MASK 0x00FC0000 5838c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_LSB 18 5848c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000 5858c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24 5868c2ecf20Sopenharmony_ci 5878c2ecf20Sopenharmony_ci#define HTT_TX_CMPL_FLAG_DATA_RSSI BIT(0) 5888c2ecf20Sopenharmony_ci#define HTT_TX_CMPL_FLAG_PPID_PRESENT BIT(1) 5898c2ecf20Sopenharmony_ci#define HTT_TX_CMPL_FLAG_PA_PRESENT BIT(2) 5908c2ecf20Sopenharmony_ci#define HTT_TX_CMPL_FLAG_PPDU_DURATION_PRESENT BIT(3) 5918c2ecf20Sopenharmony_ci 5928c2ecf20Sopenharmony_ci#define HTT_TX_DATA_RSSI_ENABLE_WCN3990 BIT(3) 5938c2ecf20Sopenharmony_ci#define HTT_TX_DATA_APPEND_RETRIES BIT(0) 5948c2ecf20Sopenharmony_ci#define HTT_TX_DATA_APPEND_TIMESTAMP BIT(1) 5958c2ecf20Sopenharmony_ci 5968c2ecf20Sopenharmony_cistruct htt_rx_indication_hdr { 5978c2ecf20Sopenharmony_ci u8 info0; /* %HTT_RX_INDICATION_INFO0_ */ 5988c2ecf20Sopenharmony_ci __le16 peer_id; 5998c2ecf20Sopenharmony_ci __le32 info1; /* %HTT_RX_INDICATION_INFO1_ */ 6008c2ecf20Sopenharmony_ci} __packed; 6018c2ecf20Sopenharmony_ci 6028c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_PHY_ERR_VALID (1 << 0) 6038c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_LEGACY_RATE_MASK (0x1E) 6048c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_LEGACY_RATE_LSB (1) 6058c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK (1 << 5) 6068c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_END_VALID (1 << 6) 6078c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO0_START_VALID (1 << 7) 6088c2ecf20Sopenharmony_ci 6098c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_MASK 0x00FFFFFF 6108c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_LSB 0 6118c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_MASK 0xFF000000 6128c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_LSB 24 6138c2ecf20Sopenharmony_ci 6148c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_MASK 0x00FFFFFF 6158c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_LSB 0 6168c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO2_SERVICE_MASK 0xFF000000 6178c2ecf20Sopenharmony_ci#define HTT_RX_INDICATION_INFO2_SERVICE_LSB 24 6188c2ecf20Sopenharmony_ci 6198c2ecf20Sopenharmony_cienum htt_rx_legacy_rate { 6208c2ecf20Sopenharmony_ci HTT_RX_OFDM_48 = 0, 6218c2ecf20Sopenharmony_ci HTT_RX_OFDM_24 = 1, 6228c2ecf20Sopenharmony_ci HTT_RX_OFDM_12, 6238c2ecf20Sopenharmony_ci HTT_RX_OFDM_6, 6248c2ecf20Sopenharmony_ci HTT_RX_OFDM_54, 6258c2ecf20Sopenharmony_ci HTT_RX_OFDM_36, 6268c2ecf20Sopenharmony_ci HTT_RX_OFDM_18, 6278c2ecf20Sopenharmony_ci HTT_RX_OFDM_9, 6288c2ecf20Sopenharmony_ci 6298c2ecf20Sopenharmony_ci /* long preamble */ 6308c2ecf20Sopenharmony_ci HTT_RX_CCK_11_LP = 0, 6318c2ecf20Sopenharmony_ci HTT_RX_CCK_5_5_LP = 1, 6328c2ecf20Sopenharmony_ci HTT_RX_CCK_2_LP, 6338c2ecf20Sopenharmony_ci HTT_RX_CCK_1_LP, 6348c2ecf20Sopenharmony_ci /* short preamble */ 6358c2ecf20Sopenharmony_ci HTT_RX_CCK_11_SP, 6368c2ecf20Sopenharmony_ci HTT_RX_CCK_5_5_SP, 6378c2ecf20Sopenharmony_ci HTT_RX_CCK_2_SP 6388c2ecf20Sopenharmony_ci}; 6398c2ecf20Sopenharmony_ci 6408c2ecf20Sopenharmony_cienum htt_rx_legacy_rate_type { 6418c2ecf20Sopenharmony_ci HTT_RX_LEGACY_RATE_OFDM = 0, 6428c2ecf20Sopenharmony_ci HTT_RX_LEGACY_RATE_CCK 6438c2ecf20Sopenharmony_ci}; 6448c2ecf20Sopenharmony_ci 6458c2ecf20Sopenharmony_cienum htt_rx_preamble_type { 6468c2ecf20Sopenharmony_ci HTT_RX_LEGACY = 0x4, 6478c2ecf20Sopenharmony_ci HTT_RX_HT = 0x8, 6488c2ecf20Sopenharmony_ci HTT_RX_HT_WITH_TXBF = 0x9, 6498c2ecf20Sopenharmony_ci HTT_RX_VHT = 0xC, 6508c2ecf20Sopenharmony_ci HTT_RX_VHT_WITH_TXBF = 0xD, 6518c2ecf20Sopenharmony_ci}; 6528c2ecf20Sopenharmony_ci 6538c2ecf20Sopenharmony_ci/* 6548c2ecf20Sopenharmony_ci * Fields: phy_err_valid, phy_err_code, tsf, 6558c2ecf20Sopenharmony_ci * usec_timestamp, sub_usec_timestamp 6568c2ecf20Sopenharmony_ci * ..are valid only if end_valid == 1. 6578c2ecf20Sopenharmony_ci * 6588c2ecf20Sopenharmony_ci * Fields: rssi_chains, legacy_rate_type, 6598c2ecf20Sopenharmony_ci * legacy_rate_cck, preamble_type, service, 6608c2ecf20Sopenharmony_ci * vht_sig_* 6618c2ecf20Sopenharmony_ci * ..are valid only if start_valid == 1; 6628c2ecf20Sopenharmony_ci */ 6638c2ecf20Sopenharmony_cistruct htt_rx_indication_ppdu { 6648c2ecf20Sopenharmony_ci u8 combined_rssi; 6658c2ecf20Sopenharmony_ci u8 sub_usec_timestamp; 6668c2ecf20Sopenharmony_ci u8 phy_err_code; 6678c2ecf20Sopenharmony_ci u8 info0; /* HTT_RX_INDICATION_INFO0_ */ 6688c2ecf20Sopenharmony_ci struct { 6698c2ecf20Sopenharmony_ci u8 pri20_db; 6708c2ecf20Sopenharmony_ci u8 ext20_db; 6718c2ecf20Sopenharmony_ci u8 ext40_db; 6728c2ecf20Sopenharmony_ci u8 ext80_db; 6738c2ecf20Sopenharmony_ci } __packed rssi_chains[4]; 6748c2ecf20Sopenharmony_ci __le32 tsf; 6758c2ecf20Sopenharmony_ci __le32 usec_timestamp; 6768c2ecf20Sopenharmony_ci __le32 info1; /* HTT_RX_INDICATION_INFO1_ */ 6778c2ecf20Sopenharmony_ci __le32 info2; /* HTT_RX_INDICATION_INFO2_ */ 6788c2ecf20Sopenharmony_ci} __packed; 6798c2ecf20Sopenharmony_ci 6808c2ecf20Sopenharmony_cienum htt_rx_mpdu_status { 6818c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_UNKNOWN = 0x0, 6828c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_OK, 6838c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_ERR_FCS, 6848c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_ERR_DUP, 6858c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_ERR_REPLAY, 6868c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER, 6878c2ecf20Sopenharmony_ci /* only accept EAPOL frames */ 6888c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_UNAUTH_PEER, 6898c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_OUT_OF_SYNC, 6908c2ecf20Sopenharmony_ci /* Non-data in promiscuous mode */ 6918c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_MGMT_CTRL, 6928c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR, 6938c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_DECRYPT_ERR, 6948c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_MPDU_LENGTH_ERR, 6958c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_ENCRYPT_REQUIRED_ERR, 6968c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_PRIVACY_ERR, 6978c2ecf20Sopenharmony_ci 6988c2ecf20Sopenharmony_ci /* 6998c2ecf20Sopenharmony_ci * MISC: discard for unspecified reasons. 7008c2ecf20Sopenharmony_ci * Leave this enum value last. 7018c2ecf20Sopenharmony_ci */ 7028c2ecf20Sopenharmony_ci HTT_RX_IND_MPDU_STATUS_ERR_MISC = 0xFF 7038c2ecf20Sopenharmony_ci}; 7048c2ecf20Sopenharmony_ci 7058c2ecf20Sopenharmony_cistruct htt_rx_indication_mpdu_range { 7068c2ecf20Sopenharmony_ci u8 mpdu_count; 7078c2ecf20Sopenharmony_ci u8 mpdu_range_status; /* %htt_rx_mpdu_status */ 7088c2ecf20Sopenharmony_ci u8 pad0; 7098c2ecf20Sopenharmony_ci u8 pad1; 7108c2ecf20Sopenharmony_ci} __packed; 7118c2ecf20Sopenharmony_ci 7128c2ecf20Sopenharmony_cistruct htt_rx_indication_prefix { 7138c2ecf20Sopenharmony_ci __le16 fw_rx_desc_bytes; 7148c2ecf20Sopenharmony_ci u8 pad0; 7158c2ecf20Sopenharmony_ci u8 pad1; 7168c2ecf20Sopenharmony_ci}; 7178c2ecf20Sopenharmony_ci 7188c2ecf20Sopenharmony_cistruct htt_rx_indication { 7198c2ecf20Sopenharmony_ci struct htt_rx_indication_hdr hdr; 7208c2ecf20Sopenharmony_ci struct htt_rx_indication_ppdu ppdu; 7218c2ecf20Sopenharmony_ci struct htt_rx_indication_prefix prefix; 7228c2ecf20Sopenharmony_ci 7238c2ecf20Sopenharmony_ci /* 7248c2ecf20Sopenharmony_ci * the following fields are both dynamically sized, so 7258c2ecf20Sopenharmony_ci * take care addressing them 7268c2ecf20Sopenharmony_ci */ 7278c2ecf20Sopenharmony_ci 7288c2ecf20Sopenharmony_ci /* the size of this is %fw_rx_desc_bytes */ 7298c2ecf20Sopenharmony_ci struct fw_rx_desc_base fw_desc; 7308c2ecf20Sopenharmony_ci 7318c2ecf20Sopenharmony_ci /* 7328c2ecf20Sopenharmony_ci * %mpdu_ranges starts after &%prefix + roundup(%fw_rx_desc_bytes, 4) 7338c2ecf20Sopenharmony_ci * and has %num_mpdu_ranges elements. 7348c2ecf20Sopenharmony_ci */ 7358c2ecf20Sopenharmony_ci struct htt_rx_indication_mpdu_range mpdu_ranges[]; 7368c2ecf20Sopenharmony_ci} __packed; 7378c2ecf20Sopenharmony_ci 7388c2ecf20Sopenharmony_ci/* High latency version of the RX indication */ 7398c2ecf20Sopenharmony_cistruct htt_rx_indication_hl { 7408c2ecf20Sopenharmony_ci struct htt_rx_indication_hdr hdr; 7418c2ecf20Sopenharmony_ci struct htt_rx_indication_ppdu ppdu; 7428c2ecf20Sopenharmony_ci struct htt_rx_indication_prefix prefix; 7438c2ecf20Sopenharmony_ci struct fw_rx_desc_hl fw_desc; 7448c2ecf20Sopenharmony_ci struct htt_rx_indication_mpdu_range mpdu_ranges[]; 7458c2ecf20Sopenharmony_ci} __packed; 7468c2ecf20Sopenharmony_ci 7478c2ecf20Sopenharmony_cistruct htt_hl_rx_desc { 7488c2ecf20Sopenharmony_ci __le32 info; 7498c2ecf20Sopenharmony_ci __le32 pn_31_0; 7508c2ecf20Sopenharmony_ci union { 7518c2ecf20Sopenharmony_ci struct { 7528c2ecf20Sopenharmony_ci __le16 pn_47_32; 7538c2ecf20Sopenharmony_ci __le16 pn_63_48; 7548c2ecf20Sopenharmony_ci } pn16; 7558c2ecf20Sopenharmony_ci __le32 pn_63_32; 7568c2ecf20Sopenharmony_ci } u0; 7578c2ecf20Sopenharmony_ci __le32 pn_95_64; 7588c2ecf20Sopenharmony_ci __le32 pn_127_96; 7598c2ecf20Sopenharmony_ci} __packed; 7608c2ecf20Sopenharmony_ci 7618c2ecf20Sopenharmony_cistatic inline struct htt_rx_indication_mpdu_range * 7628c2ecf20Sopenharmony_ci htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind) 7638c2ecf20Sopenharmony_ci{ 7648c2ecf20Sopenharmony_ci void *ptr = rx_ind; 7658c2ecf20Sopenharmony_ci 7668c2ecf20Sopenharmony_ci ptr += sizeof(rx_ind->hdr) 7678c2ecf20Sopenharmony_ci + sizeof(rx_ind->ppdu) 7688c2ecf20Sopenharmony_ci + sizeof(rx_ind->prefix) 7698c2ecf20Sopenharmony_ci + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4); 7708c2ecf20Sopenharmony_ci return ptr; 7718c2ecf20Sopenharmony_ci} 7728c2ecf20Sopenharmony_ci 7738c2ecf20Sopenharmony_cistatic inline struct htt_rx_indication_mpdu_range * 7748c2ecf20Sopenharmony_ci htt_rx_ind_get_mpdu_ranges_hl(struct htt_rx_indication_hl *rx_ind) 7758c2ecf20Sopenharmony_ci{ 7768c2ecf20Sopenharmony_ci void *ptr = rx_ind; 7778c2ecf20Sopenharmony_ci 7788c2ecf20Sopenharmony_ci ptr += sizeof(rx_ind->hdr) 7798c2ecf20Sopenharmony_ci + sizeof(rx_ind->ppdu) 7808c2ecf20Sopenharmony_ci + sizeof(rx_ind->prefix) 7818c2ecf20Sopenharmony_ci + sizeof(rx_ind->fw_desc); 7828c2ecf20Sopenharmony_ci return ptr; 7838c2ecf20Sopenharmony_ci} 7848c2ecf20Sopenharmony_ci 7858c2ecf20Sopenharmony_cienum htt_rx_flush_mpdu_status { 7868c2ecf20Sopenharmony_ci HTT_RX_FLUSH_MPDU_DISCARD = 0, 7878c2ecf20Sopenharmony_ci HTT_RX_FLUSH_MPDU_REORDER = 1, 7888c2ecf20Sopenharmony_ci}; 7898c2ecf20Sopenharmony_ci 7908c2ecf20Sopenharmony_ci/* 7918c2ecf20Sopenharmony_ci * htt_rx_flush - discard or reorder given range of mpdus 7928c2ecf20Sopenharmony_ci * 7938c2ecf20Sopenharmony_ci * Note: host must check if all sequence numbers between 7948c2ecf20Sopenharmony_ci * [seq_num_start, seq_num_end-1] are valid. 7958c2ecf20Sopenharmony_ci */ 7968c2ecf20Sopenharmony_cistruct htt_rx_flush { 7978c2ecf20Sopenharmony_ci __le16 peer_id; 7988c2ecf20Sopenharmony_ci u8 tid; 7998c2ecf20Sopenharmony_ci u8 rsvd0; 8008c2ecf20Sopenharmony_ci u8 mpdu_status; /* %htt_rx_flush_mpdu_status */ 8018c2ecf20Sopenharmony_ci u8 seq_num_start; /* it is 6 LSBs of 802.11 seq no */ 8028c2ecf20Sopenharmony_ci u8 seq_num_end; /* it is 6 LSBs of 802.11 seq no */ 8038c2ecf20Sopenharmony_ci}; 8048c2ecf20Sopenharmony_ci 8058c2ecf20Sopenharmony_cistruct htt_rx_peer_map { 8068c2ecf20Sopenharmony_ci u8 vdev_id; 8078c2ecf20Sopenharmony_ci __le16 peer_id; 8088c2ecf20Sopenharmony_ci u8 addr[6]; 8098c2ecf20Sopenharmony_ci u8 rsvd0; 8108c2ecf20Sopenharmony_ci u8 rsvd1; 8118c2ecf20Sopenharmony_ci} __packed; 8128c2ecf20Sopenharmony_ci 8138c2ecf20Sopenharmony_cistruct htt_rx_peer_unmap { 8148c2ecf20Sopenharmony_ci u8 rsvd0; 8158c2ecf20Sopenharmony_ci __le16 peer_id; 8168c2ecf20Sopenharmony_ci} __packed; 8178c2ecf20Sopenharmony_ci 8188c2ecf20Sopenharmony_cienum htt_txrx_sec_cast_type { 8198c2ecf20Sopenharmony_ci HTT_TXRX_SEC_MCAST = 0, 8208c2ecf20Sopenharmony_ci HTT_TXRX_SEC_UCAST 8218c2ecf20Sopenharmony_ci}; 8228c2ecf20Sopenharmony_ci 8238c2ecf20Sopenharmony_cienum htt_rx_pn_check_type { 8248c2ecf20Sopenharmony_ci HTT_RX_NON_PN_CHECK = 0, 8258c2ecf20Sopenharmony_ci HTT_RX_PN_CHECK 8268c2ecf20Sopenharmony_ci}; 8278c2ecf20Sopenharmony_ci 8288c2ecf20Sopenharmony_cienum htt_rx_tkip_demic_type { 8298c2ecf20Sopenharmony_ci HTT_RX_NON_TKIP_MIC = 0, 8308c2ecf20Sopenharmony_ci HTT_RX_TKIP_MIC 8318c2ecf20Sopenharmony_ci}; 8328c2ecf20Sopenharmony_ci 8338c2ecf20Sopenharmony_cienum htt_security_types { 8348c2ecf20Sopenharmony_ci HTT_SECURITY_NONE, 8358c2ecf20Sopenharmony_ci HTT_SECURITY_WEP128, 8368c2ecf20Sopenharmony_ci HTT_SECURITY_WEP104, 8378c2ecf20Sopenharmony_ci HTT_SECURITY_WEP40, 8388c2ecf20Sopenharmony_ci HTT_SECURITY_TKIP, 8398c2ecf20Sopenharmony_ci HTT_SECURITY_TKIP_NOMIC, 8408c2ecf20Sopenharmony_ci HTT_SECURITY_AES_CCMP, 8418c2ecf20Sopenharmony_ci HTT_SECURITY_WAPI, 8428c2ecf20Sopenharmony_ci 8438c2ecf20Sopenharmony_ci HTT_NUM_SECURITY_TYPES /* keep this last! */ 8448c2ecf20Sopenharmony_ci}; 8458c2ecf20Sopenharmony_ci 8468c2ecf20Sopenharmony_ci#define ATH10K_HTT_TXRX_PEER_SECURITY_MAX 2 8478c2ecf20Sopenharmony_ci#define ATH10K_TXRX_NUM_EXT_TIDS 19 8488c2ecf20Sopenharmony_ci#define ATH10K_TXRX_NON_QOS_TID 16 8498c2ecf20Sopenharmony_ci 8508c2ecf20Sopenharmony_cienum htt_security_flags { 8518c2ecf20Sopenharmony_ci#define HTT_SECURITY_TYPE_MASK 0x7F 8528c2ecf20Sopenharmony_ci#define HTT_SECURITY_TYPE_LSB 0 8538c2ecf20Sopenharmony_ci HTT_SECURITY_IS_UNICAST = 1 << 7 8548c2ecf20Sopenharmony_ci}; 8558c2ecf20Sopenharmony_ci 8568c2ecf20Sopenharmony_cistruct htt_security_indication { 8578c2ecf20Sopenharmony_ci union { 8588c2ecf20Sopenharmony_ci /* dont use bitfields; undefined behaviour */ 8598c2ecf20Sopenharmony_ci u8 flags; /* %htt_security_flags */ 8608c2ecf20Sopenharmony_ci struct { 8618c2ecf20Sopenharmony_ci u8 security_type:7, /* %htt_security_types */ 8628c2ecf20Sopenharmony_ci is_unicast:1; 8638c2ecf20Sopenharmony_ci } __packed; 8648c2ecf20Sopenharmony_ci } __packed; 8658c2ecf20Sopenharmony_ci __le16 peer_id; 8668c2ecf20Sopenharmony_ci u8 michael_key[8]; 8678c2ecf20Sopenharmony_ci u8 wapi_rsc[16]; 8688c2ecf20Sopenharmony_ci} __packed; 8698c2ecf20Sopenharmony_ci 8708c2ecf20Sopenharmony_ci#define HTT_RX_BA_INFO0_TID_MASK 0x000F 8718c2ecf20Sopenharmony_ci#define HTT_RX_BA_INFO0_TID_LSB 0 8728c2ecf20Sopenharmony_ci#define HTT_RX_BA_INFO0_PEER_ID_MASK 0xFFF0 8738c2ecf20Sopenharmony_ci#define HTT_RX_BA_INFO0_PEER_ID_LSB 4 8748c2ecf20Sopenharmony_ci 8758c2ecf20Sopenharmony_cistruct htt_rx_addba { 8768c2ecf20Sopenharmony_ci u8 window_size; 8778c2ecf20Sopenharmony_ci __le16 info0; /* %HTT_RX_BA_INFO0_ */ 8788c2ecf20Sopenharmony_ci} __packed; 8798c2ecf20Sopenharmony_ci 8808c2ecf20Sopenharmony_cistruct htt_rx_delba { 8818c2ecf20Sopenharmony_ci u8 rsvd0; 8828c2ecf20Sopenharmony_ci __le16 info0; /* %HTT_RX_BA_INFO0_ */ 8838c2ecf20Sopenharmony_ci} __packed; 8848c2ecf20Sopenharmony_ci 8858c2ecf20Sopenharmony_cienum htt_data_tx_status { 8868c2ecf20Sopenharmony_ci HTT_DATA_TX_STATUS_OK = 0, 8878c2ecf20Sopenharmony_ci HTT_DATA_TX_STATUS_DISCARD = 1, 8888c2ecf20Sopenharmony_ci HTT_DATA_TX_STATUS_NO_ACK = 2, 8898c2ecf20Sopenharmony_ci HTT_DATA_TX_STATUS_POSTPONE = 3, /* HL only */ 8908c2ecf20Sopenharmony_ci HTT_DATA_TX_STATUS_DOWNLOAD_FAIL = 128 8918c2ecf20Sopenharmony_ci}; 8928c2ecf20Sopenharmony_ci 8938c2ecf20Sopenharmony_cienum htt_data_tx_flags { 8948c2ecf20Sopenharmony_ci#define HTT_DATA_TX_STATUS_MASK 0x07 8958c2ecf20Sopenharmony_ci#define HTT_DATA_TX_STATUS_LSB 0 8968c2ecf20Sopenharmony_ci#define HTT_DATA_TX_TID_MASK 0x78 8978c2ecf20Sopenharmony_ci#define HTT_DATA_TX_TID_LSB 3 8988c2ecf20Sopenharmony_ci HTT_DATA_TX_TID_INVALID = 1 << 7 8998c2ecf20Sopenharmony_ci}; 9008c2ecf20Sopenharmony_ci 9018c2ecf20Sopenharmony_ci#define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF 9028c2ecf20Sopenharmony_ci 9038c2ecf20Sopenharmony_cistruct htt_append_retries { 9048c2ecf20Sopenharmony_ci __le16 msdu_id; 9058c2ecf20Sopenharmony_ci u8 tx_retries; 9068c2ecf20Sopenharmony_ci u8 flag; 9078c2ecf20Sopenharmony_ci} __packed; 9088c2ecf20Sopenharmony_ci 9098c2ecf20Sopenharmony_cistruct htt_data_tx_completion_ext { 9108c2ecf20Sopenharmony_ci struct htt_append_retries a_retries; 9118c2ecf20Sopenharmony_ci __le32 t_stamp; 9128c2ecf20Sopenharmony_ci __le16 msdus_rssi[]; 9138c2ecf20Sopenharmony_ci} __packed; 9148c2ecf20Sopenharmony_ci 9158c2ecf20Sopenharmony_ci/** 9168c2ecf20Sopenharmony_ci * @brief target -> host TX completion indication message definition 9178c2ecf20Sopenharmony_ci * 9188c2ecf20Sopenharmony_ci * @details 9198c2ecf20Sopenharmony_ci * The following diagram shows the format of the TX completion indication sent 9208c2ecf20Sopenharmony_ci * from the target to the host 9218c2ecf20Sopenharmony_ci * 9228c2ecf20Sopenharmony_ci * |31 28|27|26|25|24|23 16| 15 |14 11|10 8|7 0| 9238c2ecf20Sopenharmony_ci * |-------------------------------------------------------------| 9248c2ecf20Sopenharmony_ci * header: |rsvd |A2|TP|A1|A0| num | t_i| tid |status| msg_type | 9258c2ecf20Sopenharmony_ci * |-------------------------------------------------------------| 9268c2ecf20Sopenharmony_ci * payload: | MSDU1 ID | MSDU0 ID | 9278c2ecf20Sopenharmony_ci * |-------------------------------------------------------------| 9288c2ecf20Sopenharmony_ci * : MSDU3 ID : MSDU2 ID : 9298c2ecf20Sopenharmony_ci * |-------------------------------------------------------------| 9308c2ecf20Sopenharmony_ci * | struct htt_tx_compl_ind_append_retries | 9318c2ecf20Sopenharmony_ci * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -| 9328c2ecf20Sopenharmony_ci * | struct htt_tx_compl_ind_append_tx_tstamp | 9338c2ecf20Sopenharmony_ci * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -| 9348c2ecf20Sopenharmony_ci * | MSDU1 ACK RSSI | MSDU0 ACK RSSI | 9358c2ecf20Sopenharmony_ci * |-------------------------------------------------------------| 9368c2ecf20Sopenharmony_ci * : MSDU3 ACK RSSI : MSDU2 ACK RSSI : 9378c2ecf20Sopenharmony_ci * |- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -| 9388c2ecf20Sopenharmony_ci * -msg_type 9398c2ecf20Sopenharmony_ci * Bits 7:0 9408c2ecf20Sopenharmony_ci * Purpose: identifies this as HTT TX completion indication 9418c2ecf20Sopenharmony_ci * -status 9428c2ecf20Sopenharmony_ci * Bits 10:8 9438c2ecf20Sopenharmony_ci * Purpose: the TX completion status of payload fragmentations descriptors 9448c2ecf20Sopenharmony_ci * Value: could be HTT_TX_COMPL_IND_STAT_OK or HTT_TX_COMPL_IND_STAT_DISCARD 9458c2ecf20Sopenharmony_ci * -tid 9468c2ecf20Sopenharmony_ci * Bits 14:11 9478c2ecf20Sopenharmony_ci * Purpose: the tid associated with those fragmentation descriptors. It is 9488c2ecf20Sopenharmony_ci * valid or not, depending on the tid_invalid bit. 9498c2ecf20Sopenharmony_ci * Value: 0 to 15 9508c2ecf20Sopenharmony_ci * -tid_invalid 9518c2ecf20Sopenharmony_ci * Bits 15:15 9528c2ecf20Sopenharmony_ci * Purpose: this bit indicates whether the tid field is valid or not 9538c2ecf20Sopenharmony_ci * Value: 0 indicates valid, 1 indicates invalid 9548c2ecf20Sopenharmony_ci * -num 9558c2ecf20Sopenharmony_ci * Bits 23:16 9568c2ecf20Sopenharmony_ci * Purpose: the number of payload in this indication 9578c2ecf20Sopenharmony_ci * Value: 1 to 255 9588c2ecf20Sopenharmony_ci * -A0 = append 9598c2ecf20Sopenharmony_ci * Bits 24:24 9608c2ecf20Sopenharmony_ci * Purpose: append the struct htt_tx_compl_ind_append_retries which contains 9618c2ecf20Sopenharmony_ci * the number of tx retries for one MSDU at the end of this message 9628c2ecf20Sopenharmony_ci * Value: 0 indicates no appending, 1 indicates appending 9638c2ecf20Sopenharmony_ci * -A1 = append1 9648c2ecf20Sopenharmony_ci * Bits 25:25 9658c2ecf20Sopenharmony_ci * Purpose: Append the struct htt_tx_compl_ind_append_tx_tstamp which 9668c2ecf20Sopenharmony_ci * contains the timestamp info for each TX msdu id in payload. 9678c2ecf20Sopenharmony_ci * Value: 0 indicates no appending, 1 indicates appending 9688c2ecf20Sopenharmony_ci * -TP = MSDU tx power presence 9698c2ecf20Sopenharmony_ci * Bits 26:26 9708c2ecf20Sopenharmony_ci * Purpose: Indicate whether the TX_COMPL_IND includes a tx power report 9718c2ecf20Sopenharmony_ci * for each MSDU referenced by the TX_COMPL_IND message. 9728c2ecf20Sopenharmony_ci * The order of the per-MSDU tx power reports matches the order 9738c2ecf20Sopenharmony_ci * of the MSDU IDs. 9748c2ecf20Sopenharmony_ci * Value: 0 indicates not appending, 1 indicates appending 9758c2ecf20Sopenharmony_ci * -A2 = append2 9768c2ecf20Sopenharmony_ci * Bits 27:27 9778c2ecf20Sopenharmony_ci * Purpose: Indicate whether data ACK RSSI is appended for each MSDU in 9788c2ecf20Sopenharmony_ci * TX_COMP_IND message. The order of the per-MSDU ACK RSSI report 9798c2ecf20Sopenharmony_ci * matches the order of the MSDU IDs. 9808c2ecf20Sopenharmony_ci * The ACK RSSI values are valid when status is COMPLETE_OK (and 9818c2ecf20Sopenharmony_ci * this append2 bit is set). 9828c2ecf20Sopenharmony_ci * Value: 0 indicates not appending, 1 indicates appending 9838c2ecf20Sopenharmony_ci */ 9848c2ecf20Sopenharmony_ci 9858c2ecf20Sopenharmony_cistruct htt_data_tx_completion { 9868c2ecf20Sopenharmony_ci union { 9878c2ecf20Sopenharmony_ci u8 flags; 9888c2ecf20Sopenharmony_ci struct { 9898c2ecf20Sopenharmony_ci u8 status:3, 9908c2ecf20Sopenharmony_ci tid:4, 9918c2ecf20Sopenharmony_ci tid_invalid:1; 9928c2ecf20Sopenharmony_ci } __packed; 9938c2ecf20Sopenharmony_ci } __packed; 9948c2ecf20Sopenharmony_ci u8 num_msdus; 9958c2ecf20Sopenharmony_ci u8 flags2; /* HTT_TX_CMPL_FLAG_DATA_RSSI */ 9968c2ecf20Sopenharmony_ci __le16 msdus[]; /* variable length based on %num_msdus */ 9978c2ecf20Sopenharmony_ci} __packed; 9988c2ecf20Sopenharmony_ci 9998c2ecf20Sopenharmony_ci#define HTT_TX_PPDU_DUR_INFO0_PEER_ID_MASK GENMASK(15, 0) 10008c2ecf20Sopenharmony_ci#define HTT_TX_PPDU_DUR_INFO0_TID_MASK GENMASK(20, 16) 10018c2ecf20Sopenharmony_ci 10028c2ecf20Sopenharmony_cistruct htt_data_tx_ppdu_dur { 10038c2ecf20Sopenharmony_ci __le32 info0; /* HTT_TX_PPDU_DUR_INFO0_ */ 10048c2ecf20Sopenharmony_ci __le32 tx_duration; /* in usecs */ 10058c2ecf20Sopenharmony_ci} __packed; 10068c2ecf20Sopenharmony_ci 10078c2ecf20Sopenharmony_ci#define HTT_TX_COMPL_PPDU_DUR_INFO0_NUM_ENTRIES_MASK GENMASK(7, 0) 10088c2ecf20Sopenharmony_ci 10098c2ecf20Sopenharmony_cistruct htt_data_tx_compl_ppdu_dur { 10108c2ecf20Sopenharmony_ci __le32 info0; /* HTT_TX_COMPL_PPDU_DUR_INFO0_ */ 10118c2ecf20Sopenharmony_ci struct htt_data_tx_ppdu_dur ppdu_dur[]; 10128c2ecf20Sopenharmony_ci} __packed; 10138c2ecf20Sopenharmony_ci 10148c2ecf20Sopenharmony_cistruct htt_tx_compl_ind_base { 10158c2ecf20Sopenharmony_ci u32 hdr; 10168c2ecf20Sopenharmony_ci u16 payload[1/*or more*/]; 10178c2ecf20Sopenharmony_ci} __packed; 10188c2ecf20Sopenharmony_ci 10198c2ecf20Sopenharmony_cistruct htt_rc_tx_done_params { 10208c2ecf20Sopenharmony_ci u32 rate_code; 10218c2ecf20Sopenharmony_ci u32 rate_code_flags; 10228c2ecf20Sopenharmony_ci u32 flags; 10238c2ecf20Sopenharmony_ci u32 num_enqued; /* 1 for non-AMPDU */ 10248c2ecf20Sopenharmony_ci u32 num_retries; 10258c2ecf20Sopenharmony_ci u32 num_failed; /* for AMPDU */ 10268c2ecf20Sopenharmony_ci u32 ack_rssi; 10278c2ecf20Sopenharmony_ci u32 time_stamp; 10288c2ecf20Sopenharmony_ci u32 is_probe; 10298c2ecf20Sopenharmony_ci}; 10308c2ecf20Sopenharmony_ci 10318c2ecf20Sopenharmony_cistruct htt_rc_update { 10328c2ecf20Sopenharmony_ci u8 vdev_id; 10338c2ecf20Sopenharmony_ci __le16 peer_id; 10348c2ecf20Sopenharmony_ci u8 addr[6]; 10358c2ecf20Sopenharmony_ci u8 num_elems; 10368c2ecf20Sopenharmony_ci u8 rsvd0; 10378c2ecf20Sopenharmony_ci struct htt_rc_tx_done_params params[]; /* variable length %num_elems */ 10388c2ecf20Sopenharmony_ci} __packed; 10398c2ecf20Sopenharmony_ci 10408c2ecf20Sopenharmony_ci/* see htt_rx_indication for similar fields and descriptions */ 10418c2ecf20Sopenharmony_cistruct htt_rx_fragment_indication { 10428c2ecf20Sopenharmony_ci union { 10438c2ecf20Sopenharmony_ci u8 info0; /* %HTT_RX_FRAG_IND_INFO0_ */ 10448c2ecf20Sopenharmony_ci struct { 10458c2ecf20Sopenharmony_ci u8 ext_tid:5, 10468c2ecf20Sopenharmony_ci flush_valid:1; 10478c2ecf20Sopenharmony_ci } __packed; 10488c2ecf20Sopenharmony_ci } __packed; 10498c2ecf20Sopenharmony_ci __le16 peer_id; 10508c2ecf20Sopenharmony_ci __le32 info1; /* %HTT_RX_FRAG_IND_INFO1_ */ 10518c2ecf20Sopenharmony_ci __le16 fw_rx_desc_bytes; 10528c2ecf20Sopenharmony_ci __le16 rsvd0; 10538c2ecf20Sopenharmony_ci 10548c2ecf20Sopenharmony_ci u8 fw_msdu_rx_desc[]; 10558c2ecf20Sopenharmony_ci} __packed; 10568c2ecf20Sopenharmony_ci 10578c2ecf20Sopenharmony_ci#define ATH10K_IEEE80211_EXTIV BIT(5) 10588c2ecf20Sopenharmony_ci#define ATH10K_IEEE80211_TKIP_MICLEN 8 /* trailing MIC */ 10598c2ecf20Sopenharmony_ci 10608c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO0_HEADER_LEN 16 10618c2ecf20Sopenharmony_ci 10628c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO0_EXT_TID_MASK 0x1F 10638c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO0_EXT_TID_LSB 0 10648c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_MASK 0x20 10658c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_LSB 5 10668c2ecf20Sopenharmony_ci 10678c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_MASK 0x0000003F 10688c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_LSB 0 10698c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_MASK 0x00000FC0 10708c2ecf20Sopenharmony_ci#define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_LSB 6 10718c2ecf20Sopenharmony_ci 10728c2ecf20Sopenharmony_cistruct htt_rx_pn_ind { 10738c2ecf20Sopenharmony_ci __le16 peer_id; 10748c2ecf20Sopenharmony_ci u8 tid; 10758c2ecf20Sopenharmony_ci u8 seqno_start; 10768c2ecf20Sopenharmony_ci u8 seqno_end; 10778c2ecf20Sopenharmony_ci u8 pn_ie_count; 10788c2ecf20Sopenharmony_ci u8 reserved; 10798c2ecf20Sopenharmony_ci u8 pn_ies[]; 10808c2ecf20Sopenharmony_ci} __packed; 10818c2ecf20Sopenharmony_ci 10828c2ecf20Sopenharmony_cistruct htt_rx_offload_msdu { 10838c2ecf20Sopenharmony_ci __le16 msdu_len; 10848c2ecf20Sopenharmony_ci __le16 peer_id; 10858c2ecf20Sopenharmony_ci u8 vdev_id; 10868c2ecf20Sopenharmony_ci u8 tid; 10878c2ecf20Sopenharmony_ci u8 fw_desc; 10888c2ecf20Sopenharmony_ci u8 payload[]; 10898c2ecf20Sopenharmony_ci} __packed; 10908c2ecf20Sopenharmony_ci 10918c2ecf20Sopenharmony_cistruct htt_rx_offload_ind { 10928c2ecf20Sopenharmony_ci u8 reserved; 10938c2ecf20Sopenharmony_ci __le16 msdu_count; 10948c2ecf20Sopenharmony_ci} __packed; 10958c2ecf20Sopenharmony_ci 10968c2ecf20Sopenharmony_cistruct htt_rx_in_ord_msdu_desc { 10978c2ecf20Sopenharmony_ci __le32 msdu_paddr; 10988c2ecf20Sopenharmony_ci __le16 msdu_len; 10998c2ecf20Sopenharmony_ci u8 fw_desc; 11008c2ecf20Sopenharmony_ci u8 reserved; 11018c2ecf20Sopenharmony_ci} __packed; 11028c2ecf20Sopenharmony_ci 11038c2ecf20Sopenharmony_cistruct htt_rx_in_ord_msdu_desc_ext { 11048c2ecf20Sopenharmony_ci __le64 msdu_paddr; 11058c2ecf20Sopenharmony_ci __le16 msdu_len; 11068c2ecf20Sopenharmony_ci u8 fw_desc; 11078c2ecf20Sopenharmony_ci u8 reserved; 11088c2ecf20Sopenharmony_ci} __packed; 11098c2ecf20Sopenharmony_ci 11108c2ecf20Sopenharmony_cistruct htt_rx_in_ord_ind { 11118c2ecf20Sopenharmony_ci u8 info; 11128c2ecf20Sopenharmony_ci __le16 peer_id; 11138c2ecf20Sopenharmony_ci u8 vdev_id; 11148c2ecf20Sopenharmony_ci u8 reserved; 11158c2ecf20Sopenharmony_ci __le16 msdu_count; 11168c2ecf20Sopenharmony_ci union { 11178c2ecf20Sopenharmony_ci struct htt_rx_in_ord_msdu_desc msdu_descs32[0]; 11188c2ecf20Sopenharmony_ci struct htt_rx_in_ord_msdu_desc_ext msdu_descs64[0]; 11198c2ecf20Sopenharmony_ci } __packed; 11208c2ecf20Sopenharmony_ci} __packed; 11218c2ecf20Sopenharmony_ci 11228c2ecf20Sopenharmony_ci#define HTT_RX_IN_ORD_IND_INFO_TID_MASK 0x0000001f 11238c2ecf20Sopenharmony_ci#define HTT_RX_IN_ORD_IND_INFO_TID_LSB 0 11248c2ecf20Sopenharmony_ci#define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_MASK 0x00000020 11258c2ecf20Sopenharmony_ci#define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_LSB 5 11268c2ecf20Sopenharmony_ci#define HTT_RX_IN_ORD_IND_INFO_FRAG_MASK 0x00000040 11278c2ecf20Sopenharmony_ci#define HTT_RX_IN_ORD_IND_INFO_FRAG_LSB 6 11288c2ecf20Sopenharmony_ci 11298c2ecf20Sopenharmony_ci/* 11308c2ecf20Sopenharmony_ci * target -> host test message definition 11318c2ecf20Sopenharmony_ci * 11328c2ecf20Sopenharmony_ci * The following field definitions describe the format of the test 11338c2ecf20Sopenharmony_ci * message sent from the target to the host. 11348c2ecf20Sopenharmony_ci * The message consists of a 4-octet header, followed by a variable 11358c2ecf20Sopenharmony_ci * number of 32-bit integer values, followed by a variable number 11368c2ecf20Sopenharmony_ci * of 8-bit character values. 11378c2ecf20Sopenharmony_ci * 11388c2ecf20Sopenharmony_ci * |31 16|15 8|7 0| 11398c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11408c2ecf20Sopenharmony_ci * | num chars | num ints | msg type | 11418c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11428c2ecf20Sopenharmony_ci * | int 0 | 11438c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11448c2ecf20Sopenharmony_ci * | int 1 | 11458c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11468c2ecf20Sopenharmony_ci * | ... | 11478c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11488c2ecf20Sopenharmony_ci * | char 3 | char 2 | char 1 | char 0 | 11498c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11508c2ecf20Sopenharmony_ci * | | | ... | char 4 | 11518c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11528c2ecf20Sopenharmony_ci * - MSG_TYPE 11538c2ecf20Sopenharmony_ci * Bits 7:0 11548c2ecf20Sopenharmony_ci * Purpose: identifies this as a test message 11558c2ecf20Sopenharmony_ci * Value: HTT_MSG_TYPE_TEST 11568c2ecf20Sopenharmony_ci * - NUM_INTS 11578c2ecf20Sopenharmony_ci * Bits 15:8 11588c2ecf20Sopenharmony_ci * Purpose: indicate how many 32-bit integers follow the message header 11598c2ecf20Sopenharmony_ci * - NUM_CHARS 11608c2ecf20Sopenharmony_ci * Bits 31:16 11618c2ecf20Sopenharmony_ci * Purpose: indicate how many 8-bit characters follow the series of integers 11628c2ecf20Sopenharmony_ci */ 11638c2ecf20Sopenharmony_cistruct htt_rx_test { 11648c2ecf20Sopenharmony_ci u8 num_ints; 11658c2ecf20Sopenharmony_ci __le16 num_chars; 11668c2ecf20Sopenharmony_ci 11678c2ecf20Sopenharmony_ci /* payload consists of 2 lists: 11688c2ecf20Sopenharmony_ci * a) num_ints * sizeof(__le32) 11698c2ecf20Sopenharmony_ci * b) num_chars * sizeof(u8) aligned to 4bytes 11708c2ecf20Sopenharmony_ci */ 11718c2ecf20Sopenharmony_ci u8 payload[]; 11728c2ecf20Sopenharmony_ci} __packed; 11738c2ecf20Sopenharmony_ci 11748c2ecf20Sopenharmony_cistatic inline __le32 *htt_rx_test_get_ints(struct htt_rx_test *rx_test) 11758c2ecf20Sopenharmony_ci{ 11768c2ecf20Sopenharmony_ci return (__le32 *)rx_test->payload; 11778c2ecf20Sopenharmony_ci} 11788c2ecf20Sopenharmony_ci 11798c2ecf20Sopenharmony_cistatic inline u8 *htt_rx_test_get_chars(struct htt_rx_test *rx_test) 11808c2ecf20Sopenharmony_ci{ 11818c2ecf20Sopenharmony_ci return rx_test->payload + (rx_test->num_ints * sizeof(__le32)); 11828c2ecf20Sopenharmony_ci} 11838c2ecf20Sopenharmony_ci 11848c2ecf20Sopenharmony_ci/* 11858c2ecf20Sopenharmony_ci * target -> host packet log message 11868c2ecf20Sopenharmony_ci * 11878c2ecf20Sopenharmony_ci * The following field definitions describe the format of the packet log 11888c2ecf20Sopenharmony_ci * message sent from the target to the host. 11898c2ecf20Sopenharmony_ci * The message consists of a 4-octet header,followed by a variable number 11908c2ecf20Sopenharmony_ci * of 32-bit character values. 11918c2ecf20Sopenharmony_ci * 11928c2ecf20Sopenharmony_ci * |31 24|23 16|15 8|7 0| 11938c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11948c2ecf20Sopenharmony_ci * | | | | msg type | 11958c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11968c2ecf20Sopenharmony_ci * | payload | 11978c2ecf20Sopenharmony_ci * |-----------------------------------------------------------| 11988c2ecf20Sopenharmony_ci * - MSG_TYPE 11998c2ecf20Sopenharmony_ci * Bits 7:0 12008c2ecf20Sopenharmony_ci * Purpose: identifies this as a test message 12018c2ecf20Sopenharmony_ci * Value: HTT_MSG_TYPE_PACKETLOG 12028c2ecf20Sopenharmony_ci */ 12038c2ecf20Sopenharmony_cistruct htt_pktlog_msg { 12048c2ecf20Sopenharmony_ci u8 pad[3]; 12058c2ecf20Sopenharmony_ci u8 payload[]; 12068c2ecf20Sopenharmony_ci} __packed; 12078c2ecf20Sopenharmony_ci 12088c2ecf20Sopenharmony_cistruct htt_dbg_stats_rx_reorder_stats { 12098c2ecf20Sopenharmony_ci /* Non QoS MPDUs received */ 12108c2ecf20Sopenharmony_ci __le32 deliver_non_qos; 12118c2ecf20Sopenharmony_ci 12128c2ecf20Sopenharmony_ci /* MPDUs received in-order */ 12138c2ecf20Sopenharmony_ci __le32 deliver_in_order; 12148c2ecf20Sopenharmony_ci 12158c2ecf20Sopenharmony_ci /* Flush due to reorder timer expired */ 12168c2ecf20Sopenharmony_ci __le32 deliver_flush_timeout; 12178c2ecf20Sopenharmony_ci 12188c2ecf20Sopenharmony_ci /* Flush due to move out of window */ 12198c2ecf20Sopenharmony_ci __le32 deliver_flush_oow; 12208c2ecf20Sopenharmony_ci 12218c2ecf20Sopenharmony_ci /* Flush due to DELBA */ 12228c2ecf20Sopenharmony_ci __le32 deliver_flush_delba; 12238c2ecf20Sopenharmony_ci 12248c2ecf20Sopenharmony_ci /* MPDUs dropped due to FCS error */ 12258c2ecf20Sopenharmony_ci __le32 fcs_error; 12268c2ecf20Sopenharmony_ci 12278c2ecf20Sopenharmony_ci /* MPDUs dropped due to monitor mode non-data packet */ 12288c2ecf20Sopenharmony_ci __le32 mgmt_ctrl; 12298c2ecf20Sopenharmony_ci 12308c2ecf20Sopenharmony_ci /* MPDUs dropped due to invalid peer */ 12318c2ecf20Sopenharmony_ci __le32 invalid_peer; 12328c2ecf20Sopenharmony_ci 12338c2ecf20Sopenharmony_ci /* MPDUs dropped due to duplication (non aggregation) */ 12348c2ecf20Sopenharmony_ci __le32 dup_non_aggr; 12358c2ecf20Sopenharmony_ci 12368c2ecf20Sopenharmony_ci /* MPDUs dropped due to processed before */ 12378c2ecf20Sopenharmony_ci __le32 dup_past; 12388c2ecf20Sopenharmony_ci 12398c2ecf20Sopenharmony_ci /* MPDUs dropped due to duplicate in reorder queue */ 12408c2ecf20Sopenharmony_ci __le32 dup_in_reorder; 12418c2ecf20Sopenharmony_ci 12428c2ecf20Sopenharmony_ci /* Reorder timeout happened */ 12438c2ecf20Sopenharmony_ci __le32 reorder_timeout; 12448c2ecf20Sopenharmony_ci 12458c2ecf20Sopenharmony_ci /* invalid bar ssn */ 12468c2ecf20Sopenharmony_ci __le32 invalid_bar_ssn; 12478c2ecf20Sopenharmony_ci 12488c2ecf20Sopenharmony_ci /* reorder reset due to bar ssn */ 12498c2ecf20Sopenharmony_ci __le32 ssn_reset; 12508c2ecf20Sopenharmony_ci}; 12518c2ecf20Sopenharmony_ci 12528c2ecf20Sopenharmony_cistruct htt_dbg_stats_wal_tx_stats { 12538c2ecf20Sopenharmony_ci /* Num HTT cookies queued to dispatch list */ 12548c2ecf20Sopenharmony_ci __le32 comp_queued; 12558c2ecf20Sopenharmony_ci 12568c2ecf20Sopenharmony_ci /* Num HTT cookies dispatched */ 12578c2ecf20Sopenharmony_ci __le32 comp_delivered; 12588c2ecf20Sopenharmony_ci 12598c2ecf20Sopenharmony_ci /* Num MSDU queued to WAL */ 12608c2ecf20Sopenharmony_ci __le32 msdu_enqued; 12618c2ecf20Sopenharmony_ci 12628c2ecf20Sopenharmony_ci /* Num MPDU queue to WAL */ 12638c2ecf20Sopenharmony_ci __le32 mpdu_enqued; 12648c2ecf20Sopenharmony_ci 12658c2ecf20Sopenharmony_ci /* Num MSDUs dropped by WMM limit */ 12668c2ecf20Sopenharmony_ci __le32 wmm_drop; 12678c2ecf20Sopenharmony_ci 12688c2ecf20Sopenharmony_ci /* Num Local frames queued */ 12698c2ecf20Sopenharmony_ci __le32 local_enqued; 12708c2ecf20Sopenharmony_ci 12718c2ecf20Sopenharmony_ci /* Num Local frames done */ 12728c2ecf20Sopenharmony_ci __le32 local_freed; 12738c2ecf20Sopenharmony_ci 12748c2ecf20Sopenharmony_ci /* Num queued to HW */ 12758c2ecf20Sopenharmony_ci __le32 hw_queued; 12768c2ecf20Sopenharmony_ci 12778c2ecf20Sopenharmony_ci /* Num PPDU reaped from HW */ 12788c2ecf20Sopenharmony_ci __le32 hw_reaped; 12798c2ecf20Sopenharmony_ci 12808c2ecf20Sopenharmony_ci /* Num underruns */ 12818c2ecf20Sopenharmony_ci __le32 underrun; 12828c2ecf20Sopenharmony_ci 12838c2ecf20Sopenharmony_ci /* Num PPDUs cleaned up in TX abort */ 12848c2ecf20Sopenharmony_ci __le32 tx_abort; 12858c2ecf20Sopenharmony_ci 12868c2ecf20Sopenharmony_ci /* Num MPDUs requed by SW */ 12878c2ecf20Sopenharmony_ci __le32 mpdus_requed; 12888c2ecf20Sopenharmony_ci 12898c2ecf20Sopenharmony_ci /* excessive retries */ 12908c2ecf20Sopenharmony_ci __le32 tx_ko; 12918c2ecf20Sopenharmony_ci 12928c2ecf20Sopenharmony_ci /* data hw rate code */ 12938c2ecf20Sopenharmony_ci __le32 data_rc; 12948c2ecf20Sopenharmony_ci 12958c2ecf20Sopenharmony_ci /* Scheduler self triggers */ 12968c2ecf20Sopenharmony_ci __le32 self_triggers; 12978c2ecf20Sopenharmony_ci 12988c2ecf20Sopenharmony_ci /* frames dropped due to excessive sw retries */ 12998c2ecf20Sopenharmony_ci __le32 sw_retry_failure; 13008c2ecf20Sopenharmony_ci 13018c2ecf20Sopenharmony_ci /* illegal rate phy errors */ 13028c2ecf20Sopenharmony_ci __le32 illgl_rate_phy_err; 13038c2ecf20Sopenharmony_ci 13048c2ecf20Sopenharmony_ci /* wal pdev continuous xretry */ 13058c2ecf20Sopenharmony_ci __le32 pdev_cont_xretry; 13068c2ecf20Sopenharmony_ci 13078c2ecf20Sopenharmony_ci /* wal pdev continuous xretry */ 13088c2ecf20Sopenharmony_ci __le32 pdev_tx_timeout; 13098c2ecf20Sopenharmony_ci 13108c2ecf20Sopenharmony_ci /* wal pdev resets */ 13118c2ecf20Sopenharmony_ci __le32 pdev_resets; 13128c2ecf20Sopenharmony_ci 13138c2ecf20Sopenharmony_ci __le32 phy_underrun; 13148c2ecf20Sopenharmony_ci 13158c2ecf20Sopenharmony_ci /* MPDU is more than txop limit */ 13168c2ecf20Sopenharmony_ci __le32 txop_ovf; 13178c2ecf20Sopenharmony_ci} __packed; 13188c2ecf20Sopenharmony_ci 13198c2ecf20Sopenharmony_cistruct htt_dbg_stats_wal_rx_stats { 13208c2ecf20Sopenharmony_ci /* Cnts any change in ring routing mid-ppdu */ 13218c2ecf20Sopenharmony_ci __le32 mid_ppdu_route_change; 13228c2ecf20Sopenharmony_ci 13238c2ecf20Sopenharmony_ci /* Total number of statuses processed */ 13248c2ecf20Sopenharmony_ci __le32 status_rcvd; 13258c2ecf20Sopenharmony_ci 13268c2ecf20Sopenharmony_ci /* Extra frags on rings 0-3 */ 13278c2ecf20Sopenharmony_ci __le32 r0_frags; 13288c2ecf20Sopenharmony_ci __le32 r1_frags; 13298c2ecf20Sopenharmony_ci __le32 r2_frags; 13308c2ecf20Sopenharmony_ci __le32 r3_frags; 13318c2ecf20Sopenharmony_ci 13328c2ecf20Sopenharmony_ci /* MSDUs / MPDUs delivered to HTT */ 13338c2ecf20Sopenharmony_ci __le32 htt_msdus; 13348c2ecf20Sopenharmony_ci __le32 htt_mpdus; 13358c2ecf20Sopenharmony_ci 13368c2ecf20Sopenharmony_ci /* MSDUs / MPDUs delivered to local stack */ 13378c2ecf20Sopenharmony_ci __le32 loc_msdus; 13388c2ecf20Sopenharmony_ci __le32 loc_mpdus; 13398c2ecf20Sopenharmony_ci 13408c2ecf20Sopenharmony_ci /* AMSDUs that have more MSDUs than the status ring size */ 13418c2ecf20Sopenharmony_ci __le32 oversize_amsdu; 13428c2ecf20Sopenharmony_ci 13438c2ecf20Sopenharmony_ci /* Number of PHY errors */ 13448c2ecf20Sopenharmony_ci __le32 phy_errs; 13458c2ecf20Sopenharmony_ci 13468c2ecf20Sopenharmony_ci /* Number of PHY errors drops */ 13478c2ecf20Sopenharmony_ci __le32 phy_err_drop; 13488c2ecf20Sopenharmony_ci 13498c2ecf20Sopenharmony_ci /* Number of mpdu errors - FCS, MIC, ENC etc. */ 13508c2ecf20Sopenharmony_ci __le32 mpdu_errs; 13518c2ecf20Sopenharmony_ci} __packed; 13528c2ecf20Sopenharmony_ci 13538c2ecf20Sopenharmony_cistruct htt_dbg_stats_wal_peer_stats { 13548c2ecf20Sopenharmony_ci __le32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */ 13558c2ecf20Sopenharmony_ci} __packed; 13568c2ecf20Sopenharmony_ci 13578c2ecf20Sopenharmony_cistruct htt_dbg_stats_wal_pdev_txrx { 13588c2ecf20Sopenharmony_ci struct htt_dbg_stats_wal_tx_stats tx_stats; 13598c2ecf20Sopenharmony_ci struct htt_dbg_stats_wal_rx_stats rx_stats; 13608c2ecf20Sopenharmony_ci struct htt_dbg_stats_wal_peer_stats peer_stats; 13618c2ecf20Sopenharmony_ci} __packed; 13628c2ecf20Sopenharmony_ci 13638c2ecf20Sopenharmony_cistruct htt_dbg_stats_rx_rate_info { 13648c2ecf20Sopenharmony_ci __le32 mcs[10]; 13658c2ecf20Sopenharmony_ci __le32 sgi[10]; 13668c2ecf20Sopenharmony_ci __le32 nss[4]; 13678c2ecf20Sopenharmony_ci __le32 stbc[10]; 13688c2ecf20Sopenharmony_ci __le32 bw[3]; 13698c2ecf20Sopenharmony_ci __le32 pream[6]; 13708c2ecf20Sopenharmony_ci __le32 ldpc; 13718c2ecf20Sopenharmony_ci __le32 txbf; 13728c2ecf20Sopenharmony_ci}; 13738c2ecf20Sopenharmony_ci 13748c2ecf20Sopenharmony_ci/* 13758c2ecf20Sopenharmony_ci * htt_dbg_stats_status - 13768c2ecf20Sopenharmony_ci * present - The requested stats have been delivered in full. 13778c2ecf20Sopenharmony_ci * This indicates that either the stats information was contained 13788c2ecf20Sopenharmony_ci * in its entirety within this message, or else this message 13798c2ecf20Sopenharmony_ci * completes the delivery of the requested stats info that was 13808c2ecf20Sopenharmony_ci * partially delivered through earlier STATS_CONF messages. 13818c2ecf20Sopenharmony_ci * partial - The requested stats have been delivered in part. 13828c2ecf20Sopenharmony_ci * One or more subsequent STATS_CONF messages with the same 13838c2ecf20Sopenharmony_ci * cookie value will be sent to deliver the remainder of the 13848c2ecf20Sopenharmony_ci * information. 13858c2ecf20Sopenharmony_ci * error - The requested stats could not be delivered, for example due 13868c2ecf20Sopenharmony_ci * to a shortage of memory to construct a message holding the 13878c2ecf20Sopenharmony_ci * requested stats. 13888c2ecf20Sopenharmony_ci * invalid - The requested stat type is either not recognized, or the 13898c2ecf20Sopenharmony_ci * target is configured to not gather the stats type in question. 13908c2ecf20Sopenharmony_ci * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 13918c2ecf20Sopenharmony_ci * series_done - This special value indicates that no further stats info 13928c2ecf20Sopenharmony_ci * elements are present within a series of stats info elems 13938c2ecf20Sopenharmony_ci * (within a stats upload confirmation message). 13948c2ecf20Sopenharmony_ci */ 13958c2ecf20Sopenharmony_cienum htt_dbg_stats_status { 13968c2ecf20Sopenharmony_ci HTT_DBG_STATS_STATUS_PRESENT = 0, 13978c2ecf20Sopenharmony_ci HTT_DBG_STATS_STATUS_PARTIAL = 1, 13988c2ecf20Sopenharmony_ci HTT_DBG_STATS_STATUS_ERROR = 2, 13998c2ecf20Sopenharmony_ci HTT_DBG_STATS_STATUS_INVALID = 3, 14008c2ecf20Sopenharmony_ci HTT_DBG_STATS_STATUS_SERIES_DONE = 7 14018c2ecf20Sopenharmony_ci}; 14028c2ecf20Sopenharmony_ci 14038c2ecf20Sopenharmony_ci/* 14048c2ecf20Sopenharmony_ci * target -> host statistics upload 14058c2ecf20Sopenharmony_ci * 14068c2ecf20Sopenharmony_ci * The following field definitions describe the format of the HTT target 14078c2ecf20Sopenharmony_ci * to host stats upload confirmation message. 14088c2ecf20Sopenharmony_ci * The message contains a cookie echoed from the HTT host->target stats 14098c2ecf20Sopenharmony_ci * upload request, which identifies which request the confirmation is 14108c2ecf20Sopenharmony_ci * for, and a series of tag-length-value stats information elements. 14118c2ecf20Sopenharmony_ci * The tag-length header for each stats info element also includes a 14128c2ecf20Sopenharmony_ci * status field, to indicate whether the request for the stat type in 14138c2ecf20Sopenharmony_ci * question was fully met, partially met, unable to be met, or invalid 14148c2ecf20Sopenharmony_ci * (if the stat type in question is disabled in the target). 14158c2ecf20Sopenharmony_ci * A special value of all 1's in this status field is used to indicate 14168c2ecf20Sopenharmony_ci * the end of the series of stats info elements. 14178c2ecf20Sopenharmony_ci * 14188c2ecf20Sopenharmony_ci * 14198c2ecf20Sopenharmony_ci * |31 16|15 8|7 5|4 0| 14208c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14218c2ecf20Sopenharmony_ci * | reserved | msg type | 14228c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14238c2ecf20Sopenharmony_ci * | cookie LSBs | 14248c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14258c2ecf20Sopenharmony_ci * | cookie MSBs | 14268c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14278c2ecf20Sopenharmony_ci * | stats entry length | reserved | S |stat type| 14288c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14298c2ecf20Sopenharmony_ci * | | 14308c2ecf20Sopenharmony_ci * | type-specific stats info | 14318c2ecf20Sopenharmony_ci * | | 14328c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14338c2ecf20Sopenharmony_ci * | stats entry length | reserved | S |stat type| 14348c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14358c2ecf20Sopenharmony_ci * | | 14368c2ecf20Sopenharmony_ci * | type-specific stats info | 14378c2ecf20Sopenharmony_ci * | | 14388c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14398c2ecf20Sopenharmony_ci * | n/a | reserved | 111 | n/a | 14408c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 14418c2ecf20Sopenharmony_ci * Header fields: 14428c2ecf20Sopenharmony_ci * - MSG_TYPE 14438c2ecf20Sopenharmony_ci * Bits 7:0 14448c2ecf20Sopenharmony_ci * Purpose: identifies this is a statistics upload confirmation message 14458c2ecf20Sopenharmony_ci * Value: 0x9 14468c2ecf20Sopenharmony_ci * - COOKIE_LSBS 14478c2ecf20Sopenharmony_ci * Bits 31:0 14488c2ecf20Sopenharmony_ci * Purpose: Provide a mechanism to match a target->host stats confirmation 14498c2ecf20Sopenharmony_ci * message with its preceding host->target stats request message. 14508c2ecf20Sopenharmony_ci * Value: LSBs of the opaque cookie specified by the host-side requestor 14518c2ecf20Sopenharmony_ci * - COOKIE_MSBS 14528c2ecf20Sopenharmony_ci * Bits 31:0 14538c2ecf20Sopenharmony_ci * Purpose: Provide a mechanism to match a target->host stats confirmation 14548c2ecf20Sopenharmony_ci * message with its preceding host->target stats request message. 14558c2ecf20Sopenharmony_ci * Value: MSBs of the opaque cookie specified by the host-side requestor 14568c2ecf20Sopenharmony_ci * 14578c2ecf20Sopenharmony_ci * Stats Information Element tag-length header fields: 14588c2ecf20Sopenharmony_ci * - STAT_TYPE 14598c2ecf20Sopenharmony_ci * Bits 4:0 14608c2ecf20Sopenharmony_ci * Purpose: identifies the type of statistics info held in the 14618c2ecf20Sopenharmony_ci * following information element 14628c2ecf20Sopenharmony_ci * Value: htt_dbg_stats_type 14638c2ecf20Sopenharmony_ci * - STATUS 14648c2ecf20Sopenharmony_ci * Bits 7:5 14658c2ecf20Sopenharmony_ci * Purpose: indicate whether the requested stats are present 14668c2ecf20Sopenharmony_ci * Value: htt_dbg_stats_status, including a special value (0x7) to mark 14678c2ecf20Sopenharmony_ci * the completion of the stats entry series 14688c2ecf20Sopenharmony_ci * - LENGTH 14698c2ecf20Sopenharmony_ci * Bits 31:16 14708c2ecf20Sopenharmony_ci * Purpose: indicate the stats information size 14718c2ecf20Sopenharmony_ci * Value: This field specifies the number of bytes of stats information 14728c2ecf20Sopenharmony_ci * that follows the element tag-length header. 14738c2ecf20Sopenharmony_ci * It is expected but not required that this length is a multiple of 14748c2ecf20Sopenharmony_ci * 4 bytes. Even if the length is not an integer multiple of 4, the 14758c2ecf20Sopenharmony_ci * subsequent stats entry header will begin on a 4-byte aligned 14768c2ecf20Sopenharmony_ci * boundary. 14778c2ecf20Sopenharmony_ci */ 14788c2ecf20Sopenharmony_ci 14798c2ecf20Sopenharmony_ci#define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_MASK 0x1F 14808c2ecf20Sopenharmony_ci#define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_LSB 0 14818c2ecf20Sopenharmony_ci#define HTT_STATS_CONF_ITEM_INFO_STATUS_MASK 0xE0 14828c2ecf20Sopenharmony_ci#define HTT_STATS_CONF_ITEM_INFO_STATUS_LSB 5 14838c2ecf20Sopenharmony_ci 14848c2ecf20Sopenharmony_cistruct htt_stats_conf_item { 14858c2ecf20Sopenharmony_ci union { 14868c2ecf20Sopenharmony_ci u8 info; 14878c2ecf20Sopenharmony_ci struct { 14888c2ecf20Sopenharmony_ci u8 stat_type:5; /* %HTT_DBG_STATS_ */ 14898c2ecf20Sopenharmony_ci u8 status:3; /* %HTT_DBG_STATS_STATUS_ */ 14908c2ecf20Sopenharmony_ci } __packed; 14918c2ecf20Sopenharmony_ci } __packed; 14928c2ecf20Sopenharmony_ci u8 pad; 14938c2ecf20Sopenharmony_ci __le16 length; 14948c2ecf20Sopenharmony_ci u8 payload[]; /* roundup(length, 4) long */ 14958c2ecf20Sopenharmony_ci} __packed; 14968c2ecf20Sopenharmony_ci 14978c2ecf20Sopenharmony_cistruct htt_stats_conf { 14988c2ecf20Sopenharmony_ci u8 pad[3]; 14998c2ecf20Sopenharmony_ci __le32 cookie_lsb; 15008c2ecf20Sopenharmony_ci __le32 cookie_msb; 15018c2ecf20Sopenharmony_ci 15028c2ecf20Sopenharmony_ci /* each item has variable length! */ 15038c2ecf20Sopenharmony_ci struct htt_stats_conf_item items[]; 15048c2ecf20Sopenharmony_ci} __packed; 15058c2ecf20Sopenharmony_ci 15068c2ecf20Sopenharmony_cistatic inline struct htt_stats_conf_item *htt_stats_conf_next_item( 15078c2ecf20Sopenharmony_ci const struct htt_stats_conf_item *item) 15088c2ecf20Sopenharmony_ci{ 15098c2ecf20Sopenharmony_ci return (void *)item + sizeof(*item) + roundup(item->length, 4); 15108c2ecf20Sopenharmony_ci} 15118c2ecf20Sopenharmony_ci 15128c2ecf20Sopenharmony_ci/* 15138c2ecf20Sopenharmony_ci * host -> target FRAG DESCRIPTOR/MSDU_EXT DESC bank 15148c2ecf20Sopenharmony_ci * 15158c2ecf20Sopenharmony_ci * The following field definitions describe the format of the HTT host 15168c2ecf20Sopenharmony_ci * to target frag_desc/msdu_ext bank configuration message. 15178c2ecf20Sopenharmony_ci * The message contains the based address and the min and max id of the 15188c2ecf20Sopenharmony_ci * MSDU_EXT/FRAG_DESC that will be used by the HTT to map MSDU DESC and 15198c2ecf20Sopenharmony_ci * MSDU_EXT/FRAG_DESC. 15208c2ecf20Sopenharmony_ci * HTT will use id in HTT descriptor instead sending the frag_desc_ptr. 15218c2ecf20Sopenharmony_ci * For QCA988X HW the firmware will use fragment_desc_ptr but in WIFI2.0 15228c2ecf20Sopenharmony_ci * the hardware does the mapping/translation. 15238c2ecf20Sopenharmony_ci * 15248c2ecf20Sopenharmony_ci * Total banks that can be configured is configured to 16. 15258c2ecf20Sopenharmony_ci * 15268c2ecf20Sopenharmony_ci * This should be called before any TX has be initiated by the HTT 15278c2ecf20Sopenharmony_ci * 15288c2ecf20Sopenharmony_ci * |31 16|15 8|7 5|4 0| 15298c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15308c2ecf20Sopenharmony_ci * | DESC_SIZE | NUM_BANKS | RES |SWP|pdev| msg type | 15318c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15328c2ecf20Sopenharmony_ci * | BANK0_BASE_ADDRESS | 15338c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15348c2ecf20Sopenharmony_ci * | ... | 15358c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15368c2ecf20Sopenharmony_ci * | BANK15_BASE_ADDRESS | 15378c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15388c2ecf20Sopenharmony_ci * | BANK0_MAX_ID | BANK0_MIN_ID | 15398c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15408c2ecf20Sopenharmony_ci * | ... | 15418c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15428c2ecf20Sopenharmony_ci * | BANK15_MAX_ID | BANK15_MIN_ID | 15438c2ecf20Sopenharmony_ci * |------------------------------------------------------------| 15448c2ecf20Sopenharmony_ci * Header fields: 15458c2ecf20Sopenharmony_ci * - MSG_TYPE 15468c2ecf20Sopenharmony_ci * Bits 7:0 15478c2ecf20Sopenharmony_ci * Value: 0x6 15488c2ecf20Sopenharmony_ci * - BANKx_BASE_ADDRESS 15498c2ecf20Sopenharmony_ci * Bits 31:0 15508c2ecf20Sopenharmony_ci * Purpose: Provide a mechanism to specify the base address of the MSDU_EXT 15518c2ecf20Sopenharmony_ci * bank physical/bus address. 15528c2ecf20Sopenharmony_ci * - BANKx_MIN_ID 15538c2ecf20Sopenharmony_ci * Bits 15:0 15548c2ecf20Sopenharmony_ci * Purpose: Provide a mechanism to specify the min index that needs to 15558c2ecf20Sopenharmony_ci * mapped. 15568c2ecf20Sopenharmony_ci * - BANKx_MAX_ID 15578c2ecf20Sopenharmony_ci * Bits 31:16 15588c2ecf20Sopenharmony_ci * Purpose: Provide a mechanism to specify the max index that needs to 15598c2ecf20Sopenharmony_ci * 15608c2ecf20Sopenharmony_ci */ 15618c2ecf20Sopenharmony_cistruct htt_frag_desc_bank_id { 15628c2ecf20Sopenharmony_ci __le16 bank_min_id; 15638c2ecf20Sopenharmony_ci __le16 bank_max_id; 15648c2ecf20Sopenharmony_ci} __packed; 15658c2ecf20Sopenharmony_ci 15668c2ecf20Sopenharmony_ci/* real is 16 but it wouldn't fit in the max htt message size 15678c2ecf20Sopenharmony_ci * so we use a conservatively safe value for now 15688c2ecf20Sopenharmony_ci */ 15698c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_MAX 4 15708c2ecf20Sopenharmony_ci 15718c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_MASK 0x03 15728c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_LSB 0 15738c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_CFG_INFO_SWAP BIT(2) 15748c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_VALID BIT(3) 15758c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE_MASK BIT(4) 15768c2ecf20Sopenharmony_ci#define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE_LSB 4 15778c2ecf20Sopenharmony_ci 15788c2ecf20Sopenharmony_cienum htt_q_depth_type { 15798c2ecf20Sopenharmony_ci HTT_Q_DEPTH_TYPE_BYTES = 0, 15808c2ecf20Sopenharmony_ci HTT_Q_DEPTH_TYPE_MSDUS = 1, 15818c2ecf20Sopenharmony_ci}; 15828c2ecf20Sopenharmony_ci 15838c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_NUM_PEERS (TARGET_10_4_NUM_QCACHE_PEERS_MAX + \ 15848c2ecf20Sopenharmony_ci TARGET_10_4_NUM_VDEVS) 15858c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_NUM_TIDS 8 15868c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_SIZE 1 15878c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_MULTIPLIER 0 15888c2ecf20Sopenharmony_ci 15898c2ecf20Sopenharmony_ci/** 15908c2ecf20Sopenharmony_ci * htt_q_state_conf - part of htt_frag_desc_bank_cfg for host q state config 15918c2ecf20Sopenharmony_ci * 15928c2ecf20Sopenharmony_ci * Defines host q state format and behavior. See htt_q_state. 15938c2ecf20Sopenharmony_ci * 15948c2ecf20Sopenharmony_ci * @record_size: Defines the size of each host q entry in bytes. In practice 15958c2ecf20Sopenharmony_ci * however firmware (at least 10.4.3-00191) ignores this host 15968c2ecf20Sopenharmony_ci * configuration value and uses hardcoded value of 1. 15978c2ecf20Sopenharmony_ci * @record_multiplier: This is valid only when q depth type is MSDUs. It 15988c2ecf20Sopenharmony_ci * defines the exponent for the power of 2 multiplication. 15998c2ecf20Sopenharmony_ci */ 16008c2ecf20Sopenharmony_cistruct htt_q_state_conf { 16018c2ecf20Sopenharmony_ci __le32 paddr; 16028c2ecf20Sopenharmony_ci __le16 num_peers; 16038c2ecf20Sopenharmony_ci __le16 num_tids; 16048c2ecf20Sopenharmony_ci u8 record_size; 16058c2ecf20Sopenharmony_ci u8 record_multiplier; 16068c2ecf20Sopenharmony_ci u8 pad[2]; 16078c2ecf20Sopenharmony_ci} __packed; 16088c2ecf20Sopenharmony_ci 16098c2ecf20Sopenharmony_cistruct htt_frag_desc_bank_cfg32 { 16108c2ecf20Sopenharmony_ci u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */ 16118c2ecf20Sopenharmony_ci u8 num_banks; 16128c2ecf20Sopenharmony_ci u8 desc_size; 16138c2ecf20Sopenharmony_ci __le32 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX]; 16148c2ecf20Sopenharmony_ci struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX]; 16158c2ecf20Sopenharmony_ci struct htt_q_state_conf q_state; 16168c2ecf20Sopenharmony_ci} __packed; 16178c2ecf20Sopenharmony_ci 16188c2ecf20Sopenharmony_cistruct htt_frag_desc_bank_cfg64 { 16198c2ecf20Sopenharmony_ci u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */ 16208c2ecf20Sopenharmony_ci u8 num_banks; 16218c2ecf20Sopenharmony_ci u8 desc_size; 16228c2ecf20Sopenharmony_ci __le64 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX]; 16238c2ecf20Sopenharmony_ci struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX]; 16248c2ecf20Sopenharmony_ci struct htt_q_state_conf q_state; 16258c2ecf20Sopenharmony_ci} __packed; 16268c2ecf20Sopenharmony_ci 16278c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_COEFFICIENT 128 16288c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_FACTOR_MASK 0x3f 16298c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_FACTOR_LSB 0 16308c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_EXP_MASK 0xc0 16318c2ecf20Sopenharmony_ci#define HTT_TX_Q_STATE_ENTRY_EXP_LSB 6 16328c2ecf20Sopenharmony_ci 16338c2ecf20Sopenharmony_ci/** 16348c2ecf20Sopenharmony_ci * htt_q_state - shared between host and firmware via DMA 16358c2ecf20Sopenharmony_ci * 16368c2ecf20Sopenharmony_ci * This structure is used for the host to expose it's software queue state to 16378c2ecf20Sopenharmony_ci * firmware so that its rate control can schedule fetch requests for optimized 16388c2ecf20Sopenharmony_ci * performance. This is most notably used for MU-MIMO aggregation when multiple 16398c2ecf20Sopenharmony_ci * MU clients are connected. 16408c2ecf20Sopenharmony_ci * 16418c2ecf20Sopenharmony_ci * @count: Each element defines the host queue depth. When q depth type was 16428c2ecf20Sopenharmony_ci * configured as HTT_Q_DEPTH_TYPE_BYTES then each entry is defined as: 16438c2ecf20Sopenharmony_ci * FACTOR * 128 * 8^EXP (see HTT_TX_Q_STATE_ENTRY_FACTOR_MASK and 16448c2ecf20Sopenharmony_ci * HTT_TX_Q_STATE_ENTRY_EXP_MASK). When q depth type was configured as 16458c2ecf20Sopenharmony_ci * HTT_Q_DEPTH_TYPE_MSDUS the number of packets is scaled by 2 ** 16468c2ecf20Sopenharmony_ci * record_multiplier (see htt_q_state_conf). 16478c2ecf20Sopenharmony_ci * @map: Used by firmware to quickly check which host queues are not empty. It 16488c2ecf20Sopenharmony_ci * is a bitmap simply saying. 16498c2ecf20Sopenharmony_ci * @seq: Used by firmware to quickly check if the host queues were updated 16508c2ecf20Sopenharmony_ci * since it last checked. 16518c2ecf20Sopenharmony_ci * 16528c2ecf20Sopenharmony_ci * FIXME: Is the q_state map[] size calculation really correct? 16538c2ecf20Sopenharmony_ci */ 16548c2ecf20Sopenharmony_cistruct htt_q_state { 16558c2ecf20Sopenharmony_ci u8 count[HTT_TX_Q_STATE_NUM_TIDS][HTT_TX_Q_STATE_NUM_PEERS]; 16568c2ecf20Sopenharmony_ci u32 map[HTT_TX_Q_STATE_NUM_TIDS][(HTT_TX_Q_STATE_NUM_PEERS + 31) / 32]; 16578c2ecf20Sopenharmony_ci __le32 seq; 16588c2ecf20Sopenharmony_ci} __packed; 16598c2ecf20Sopenharmony_ci 16608c2ecf20Sopenharmony_ci#define HTT_TX_FETCH_RECORD_INFO_PEER_ID_MASK 0x0fff 16618c2ecf20Sopenharmony_ci#define HTT_TX_FETCH_RECORD_INFO_PEER_ID_LSB 0 16628c2ecf20Sopenharmony_ci#define HTT_TX_FETCH_RECORD_INFO_TID_MASK 0xf000 16638c2ecf20Sopenharmony_ci#define HTT_TX_FETCH_RECORD_INFO_TID_LSB 12 16648c2ecf20Sopenharmony_ci 16658c2ecf20Sopenharmony_cistruct htt_tx_fetch_record { 16668c2ecf20Sopenharmony_ci __le16 info; /* HTT_TX_FETCH_IND_RECORD_INFO_ */ 16678c2ecf20Sopenharmony_ci __le16 num_msdus; 16688c2ecf20Sopenharmony_ci __le32 num_bytes; 16698c2ecf20Sopenharmony_ci} __packed; 16708c2ecf20Sopenharmony_ci 16718c2ecf20Sopenharmony_cistruct htt_tx_fetch_ind { 16728c2ecf20Sopenharmony_ci u8 pad0; 16738c2ecf20Sopenharmony_ci __le16 fetch_seq_num; 16748c2ecf20Sopenharmony_ci __le32 token; 16758c2ecf20Sopenharmony_ci __le16 num_resp_ids; 16768c2ecf20Sopenharmony_ci __le16 num_records; 16778c2ecf20Sopenharmony_ci __le32 resp_ids[0]; /* ath10k_htt_get_tx_fetch_ind_resp_ids() */ 16788c2ecf20Sopenharmony_ci struct htt_tx_fetch_record records[]; 16798c2ecf20Sopenharmony_ci} __packed; 16808c2ecf20Sopenharmony_ci 16818c2ecf20Sopenharmony_cistatic inline void * 16828c2ecf20Sopenharmony_ciath10k_htt_get_tx_fetch_ind_resp_ids(struct htt_tx_fetch_ind *ind) 16838c2ecf20Sopenharmony_ci{ 16848c2ecf20Sopenharmony_ci return (void *)&ind->records[le16_to_cpu(ind->num_records)]; 16858c2ecf20Sopenharmony_ci} 16868c2ecf20Sopenharmony_ci 16878c2ecf20Sopenharmony_cistruct htt_tx_fetch_resp { 16888c2ecf20Sopenharmony_ci u8 pad0; 16898c2ecf20Sopenharmony_ci __le16 resp_id; 16908c2ecf20Sopenharmony_ci __le16 fetch_seq_num; 16918c2ecf20Sopenharmony_ci __le16 num_records; 16928c2ecf20Sopenharmony_ci __le32 token; 16938c2ecf20Sopenharmony_ci struct htt_tx_fetch_record records[]; 16948c2ecf20Sopenharmony_ci} __packed; 16958c2ecf20Sopenharmony_ci 16968c2ecf20Sopenharmony_cistruct htt_tx_fetch_confirm { 16978c2ecf20Sopenharmony_ci u8 pad0; 16988c2ecf20Sopenharmony_ci __le16 num_resp_ids; 16998c2ecf20Sopenharmony_ci __le32 resp_ids[]; 17008c2ecf20Sopenharmony_ci} __packed; 17018c2ecf20Sopenharmony_ci 17028c2ecf20Sopenharmony_cienum htt_tx_mode_switch_mode { 17038c2ecf20Sopenharmony_ci HTT_TX_MODE_SWITCH_PUSH = 0, 17048c2ecf20Sopenharmony_ci HTT_TX_MODE_SWITCH_PUSH_PULL = 1, 17058c2ecf20Sopenharmony_ci}; 17068c2ecf20Sopenharmony_ci 17078c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO0_ENABLE BIT(0) 17088c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO0_NUM_RECORDS_MASK 0xfffe 17098c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO0_NUM_RECORDS_LSB 1 17108c2ecf20Sopenharmony_ci 17118c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO1_MODE_MASK 0x0003 17128c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO1_MODE_LSB 0 17138c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD_MASK 0xfffc 17148c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD_LSB 2 17158c2ecf20Sopenharmony_ci 17168c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_RECORD_INFO0_PEER_ID_MASK 0x0fff 17178c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_RECORD_INFO0_PEER_ID_LSB 0 17188c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_RECORD_INFO0_TID_MASK 0xf000 17198c2ecf20Sopenharmony_ci#define HTT_TX_MODE_SWITCH_RECORD_INFO0_TID_LSB 12 17208c2ecf20Sopenharmony_ci 17218c2ecf20Sopenharmony_cistruct htt_tx_mode_switch_record { 17228c2ecf20Sopenharmony_ci __le16 info0; /* HTT_TX_MODE_SWITCH_RECORD_INFO0_ */ 17238c2ecf20Sopenharmony_ci __le16 num_max_msdus; 17248c2ecf20Sopenharmony_ci} __packed; 17258c2ecf20Sopenharmony_ci 17268c2ecf20Sopenharmony_cistruct htt_tx_mode_switch_ind { 17278c2ecf20Sopenharmony_ci u8 pad0; 17288c2ecf20Sopenharmony_ci __le16 info0; /* HTT_TX_MODE_SWITCH_IND_INFO0_ */ 17298c2ecf20Sopenharmony_ci __le16 info1; /* HTT_TX_MODE_SWITCH_IND_INFO1_ */ 17308c2ecf20Sopenharmony_ci u8 pad1[2]; 17318c2ecf20Sopenharmony_ci struct htt_tx_mode_switch_record records[]; 17328c2ecf20Sopenharmony_ci} __packed; 17338c2ecf20Sopenharmony_ci 17348c2ecf20Sopenharmony_cistruct htt_channel_change { 17358c2ecf20Sopenharmony_ci u8 pad[3]; 17368c2ecf20Sopenharmony_ci __le32 freq; 17378c2ecf20Sopenharmony_ci __le32 center_freq1; 17388c2ecf20Sopenharmony_ci __le32 center_freq2; 17398c2ecf20Sopenharmony_ci __le32 phymode; 17408c2ecf20Sopenharmony_ci} __packed; 17418c2ecf20Sopenharmony_ci 17428c2ecf20Sopenharmony_cistruct htt_per_peer_tx_stats_ind { 17438c2ecf20Sopenharmony_ci __le32 succ_bytes; 17448c2ecf20Sopenharmony_ci __le32 retry_bytes; 17458c2ecf20Sopenharmony_ci __le32 failed_bytes; 17468c2ecf20Sopenharmony_ci u8 ratecode; 17478c2ecf20Sopenharmony_ci u8 flags; 17488c2ecf20Sopenharmony_ci __le16 peer_id; 17498c2ecf20Sopenharmony_ci __le16 succ_pkts; 17508c2ecf20Sopenharmony_ci __le16 retry_pkts; 17518c2ecf20Sopenharmony_ci __le16 failed_pkts; 17528c2ecf20Sopenharmony_ci __le16 tx_duration; 17538c2ecf20Sopenharmony_ci __le32 reserved1; 17548c2ecf20Sopenharmony_ci __le32 reserved2; 17558c2ecf20Sopenharmony_ci} __packed; 17568c2ecf20Sopenharmony_ci 17578c2ecf20Sopenharmony_cistruct htt_peer_tx_stats { 17588c2ecf20Sopenharmony_ci u8 num_ppdu; 17598c2ecf20Sopenharmony_ci u8 ppdu_len; 17608c2ecf20Sopenharmony_ci u8 version; 17618c2ecf20Sopenharmony_ci u8 payload[]; 17628c2ecf20Sopenharmony_ci} __packed; 17638c2ecf20Sopenharmony_ci 17648c2ecf20Sopenharmony_ci#define ATH10K_10_2_TX_STATS_OFFSET 136 17658c2ecf20Sopenharmony_ci#define PEER_STATS_FOR_NO_OF_PPDUS 4 17668c2ecf20Sopenharmony_ci 17678c2ecf20Sopenharmony_cistruct ath10k_10_2_peer_tx_stats { 17688c2ecf20Sopenharmony_ci u8 ratecode[PEER_STATS_FOR_NO_OF_PPDUS]; 17698c2ecf20Sopenharmony_ci u8 success_pkts[PEER_STATS_FOR_NO_OF_PPDUS]; 17708c2ecf20Sopenharmony_ci __le16 success_bytes[PEER_STATS_FOR_NO_OF_PPDUS]; 17718c2ecf20Sopenharmony_ci u8 retry_pkts[PEER_STATS_FOR_NO_OF_PPDUS]; 17728c2ecf20Sopenharmony_ci __le16 retry_bytes[PEER_STATS_FOR_NO_OF_PPDUS]; 17738c2ecf20Sopenharmony_ci u8 failed_pkts[PEER_STATS_FOR_NO_OF_PPDUS]; 17748c2ecf20Sopenharmony_ci __le16 failed_bytes[PEER_STATS_FOR_NO_OF_PPDUS]; 17758c2ecf20Sopenharmony_ci u8 flags[PEER_STATS_FOR_NO_OF_PPDUS]; 17768c2ecf20Sopenharmony_ci __le32 tx_duration; 17778c2ecf20Sopenharmony_ci u8 tx_ppdu_cnt; 17788c2ecf20Sopenharmony_ci u8 peer_id; 17798c2ecf20Sopenharmony_ci} __packed; 17808c2ecf20Sopenharmony_ci 17818c2ecf20Sopenharmony_ciunion htt_rx_pn_t { 17828c2ecf20Sopenharmony_ci /* WEP: 24-bit PN */ 17838c2ecf20Sopenharmony_ci u32 pn24; 17848c2ecf20Sopenharmony_ci 17858c2ecf20Sopenharmony_ci /* TKIP or CCMP: 48-bit PN */ 17868c2ecf20Sopenharmony_ci u64 pn48; 17878c2ecf20Sopenharmony_ci 17888c2ecf20Sopenharmony_ci /* WAPI: 128-bit PN */ 17898c2ecf20Sopenharmony_ci u64 pn128[2]; 17908c2ecf20Sopenharmony_ci}; 17918c2ecf20Sopenharmony_ci 17928c2ecf20Sopenharmony_cistruct htt_cmd { 17938c2ecf20Sopenharmony_ci struct htt_cmd_hdr hdr; 17948c2ecf20Sopenharmony_ci union { 17958c2ecf20Sopenharmony_ci struct htt_ver_req ver_req; 17968c2ecf20Sopenharmony_ci struct htt_mgmt_tx_desc mgmt_tx; 17978c2ecf20Sopenharmony_ci struct htt_data_tx_desc data_tx; 17988c2ecf20Sopenharmony_ci struct htt_rx_ring_setup_32 rx_setup_32; 17998c2ecf20Sopenharmony_ci struct htt_rx_ring_setup_64 rx_setup_64; 18008c2ecf20Sopenharmony_ci struct htt_stats_req stats_req; 18018c2ecf20Sopenharmony_ci struct htt_oob_sync_req oob_sync_req; 18028c2ecf20Sopenharmony_ci struct htt_aggr_conf aggr_conf; 18038c2ecf20Sopenharmony_ci struct htt_aggr_conf_v2 aggr_conf_v2; 18048c2ecf20Sopenharmony_ci struct htt_frag_desc_bank_cfg32 frag_desc_bank_cfg32; 18058c2ecf20Sopenharmony_ci struct htt_frag_desc_bank_cfg64 frag_desc_bank_cfg64; 18068c2ecf20Sopenharmony_ci struct htt_tx_fetch_resp tx_fetch_resp; 18078c2ecf20Sopenharmony_ci }; 18088c2ecf20Sopenharmony_ci} __packed; 18098c2ecf20Sopenharmony_ci 18108c2ecf20Sopenharmony_cistruct htt_resp { 18118c2ecf20Sopenharmony_ci struct htt_resp_hdr hdr; 18128c2ecf20Sopenharmony_ci union { 18138c2ecf20Sopenharmony_ci struct htt_ver_resp ver_resp; 18148c2ecf20Sopenharmony_ci struct htt_mgmt_tx_completion mgmt_tx_completion; 18158c2ecf20Sopenharmony_ci struct htt_data_tx_completion data_tx_completion; 18168c2ecf20Sopenharmony_ci struct htt_rx_indication rx_ind; 18178c2ecf20Sopenharmony_ci struct htt_rx_indication_hl rx_ind_hl; 18188c2ecf20Sopenharmony_ci struct htt_rx_fragment_indication rx_frag_ind; 18198c2ecf20Sopenharmony_ci struct htt_rx_peer_map peer_map; 18208c2ecf20Sopenharmony_ci struct htt_rx_peer_unmap peer_unmap; 18218c2ecf20Sopenharmony_ci struct htt_rx_flush rx_flush; 18228c2ecf20Sopenharmony_ci struct htt_rx_addba rx_addba; 18238c2ecf20Sopenharmony_ci struct htt_rx_delba rx_delba; 18248c2ecf20Sopenharmony_ci struct htt_security_indication security_indication; 18258c2ecf20Sopenharmony_ci struct htt_rc_update rc_update; 18268c2ecf20Sopenharmony_ci struct htt_rx_test rx_test; 18278c2ecf20Sopenharmony_ci struct htt_pktlog_msg pktlog_msg; 18288c2ecf20Sopenharmony_ci struct htt_stats_conf stats_conf; 18298c2ecf20Sopenharmony_ci struct htt_rx_pn_ind rx_pn_ind; 18308c2ecf20Sopenharmony_ci struct htt_rx_offload_ind rx_offload_ind; 18318c2ecf20Sopenharmony_ci struct htt_rx_in_ord_ind rx_in_ord_ind; 18328c2ecf20Sopenharmony_ci struct htt_tx_fetch_ind tx_fetch_ind; 18338c2ecf20Sopenharmony_ci struct htt_tx_fetch_confirm tx_fetch_confirm; 18348c2ecf20Sopenharmony_ci struct htt_tx_mode_switch_ind tx_mode_switch_ind; 18358c2ecf20Sopenharmony_ci struct htt_channel_change chan_change; 18368c2ecf20Sopenharmony_ci struct htt_peer_tx_stats peer_tx_stats; 18378c2ecf20Sopenharmony_ci }; 18388c2ecf20Sopenharmony_ci} __packed; 18398c2ecf20Sopenharmony_ci 18408c2ecf20Sopenharmony_ci/*** host side structures follow ***/ 18418c2ecf20Sopenharmony_ci 18428c2ecf20Sopenharmony_cistruct htt_tx_done { 18438c2ecf20Sopenharmony_ci u16 msdu_id; 18448c2ecf20Sopenharmony_ci u16 status; 18458c2ecf20Sopenharmony_ci u8 ack_rssi; 18468c2ecf20Sopenharmony_ci}; 18478c2ecf20Sopenharmony_ci 18488c2ecf20Sopenharmony_cienum htt_tx_compl_state { 18498c2ecf20Sopenharmony_ci HTT_TX_COMPL_STATE_NONE, 18508c2ecf20Sopenharmony_ci HTT_TX_COMPL_STATE_ACK, 18518c2ecf20Sopenharmony_ci HTT_TX_COMPL_STATE_NOACK, 18528c2ecf20Sopenharmony_ci HTT_TX_COMPL_STATE_DISCARD, 18538c2ecf20Sopenharmony_ci}; 18548c2ecf20Sopenharmony_ci 18558c2ecf20Sopenharmony_cistruct htt_peer_map_event { 18568c2ecf20Sopenharmony_ci u8 vdev_id; 18578c2ecf20Sopenharmony_ci u16 peer_id; 18588c2ecf20Sopenharmony_ci u8 addr[ETH_ALEN]; 18598c2ecf20Sopenharmony_ci}; 18608c2ecf20Sopenharmony_ci 18618c2ecf20Sopenharmony_cistruct htt_peer_unmap_event { 18628c2ecf20Sopenharmony_ci u16 peer_id; 18638c2ecf20Sopenharmony_ci}; 18648c2ecf20Sopenharmony_ci 18658c2ecf20Sopenharmony_cistruct ath10k_htt_txbuf_32 { 18668c2ecf20Sopenharmony_ci struct htt_data_tx_desc_frag frags[2]; 18678c2ecf20Sopenharmony_ci struct ath10k_htc_hdr htc_hdr; 18688c2ecf20Sopenharmony_ci struct htt_cmd_hdr cmd_hdr; 18698c2ecf20Sopenharmony_ci struct htt_data_tx_desc cmd_tx; 18708c2ecf20Sopenharmony_ci} __packed __aligned(4); 18718c2ecf20Sopenharmony_ci 18728c2ecf20Sopenharmony_cistruct ath10k_htt_txbuf_64 { 18738c2ecf20Sopenharmony_ci struct htt_data_tx_desc_frag frags[2]; 18748c2ecf20Sopenharmony_ci struct ath10k_htc_hdr htc_hdr; 18758c2ecf20Sopenharmony_ci struct htt_cmd_hdr cmd_hdr; 18768c2ecf20Sopenharmony_ci struct htt_data_tx_desc_64 cmd_tx; 18778c2ecf20Sopenharmony_ci} __packed __aligned(4); 18788c2ecf20Sopenharmony_ci 18798c2ecf20Sopenharmony_cistruct ath10k_htt { 18808c2ecf20Sopenharmony_ci struct ath10k *ar; 18818c2ecf20Sopenharmony_ci enum ath10k_htc_ep_id eid; 18828c2ecf20Sopenharmony_ci 18838c2ecf20Sopenharmony_ci struct sk_buff_head rx_indication_head; 18848c2ecf20Sopenharmony_ci 18858c2ecf20Sopenharmony_ci u8 target_version_major; 18868c2ecf20Sopenharmony_ci u8 target_version_minor; 18878c2ecf20Sopenharmony_ci struct completion target_version_received; 18888c2ecf20Sopenharmony_ci u8 max_num_amsdu; 18898c2ecf20Sopenharmony_ci u8 max_num_ampdu; 18908c2ecf20Sopenharmony_ci 18918c2ecf20Sopenharmony_ci const enum htt_t2h_msg_type *t2h_msg_types; 18928c2ecf20Sopenharmony_ci u32 t2h_msg_types_max; 18938c2ecf20Sopenharmony_ci 18948c2ecf20Sopenharmony_ci struct { 18958c2ecf20Sopenharmony_ci /* 18968c2ecf20Sopenharmony_ci * Ring of network buffer objects - This ring is 18978c2ecf20Sopenharmony_ci * used exclusively by the host SW. This ring 18988c2ecf20Sopenharmony_ci * mirrors the dev_addrs_ring that is shared 18998c2ecf20Sopenharmony_ci * between the host SW and the MAC HW. The host SW 19008c2ecf20Sopenharmony_ci * uses this netbufs ring to locate the network 19018c2ecf20Sopenharmony_ci * buffer objects whose data buffers the HW has 19028c2ecf20Sopenharmony_ci * filled. 19038c2ecf20Sopenharmony_ci */ 19048c2ecf20Sopenharmony_ci struct sk_buff **netbufs_ring; 19058c2ecf20Sopenharmony_ci 19068c2ecf20Sopenharmony_ci /* This is used only with firmware supporting IN_ORD_IND. 19078c2ecf20Sopenharmony_ci * 19088c2ecf20Sopenharmony_ci * With Full Rx Reorder the HTT Rx Ring is more of a temporary 19098c2ecf20Sopenharmony_ci * buffer ring from which buffer addresses are copied by the 19108c2ecf20Sopenharmony_ci * firmware to MAC Rx ring. Firmware then delivers IN_ORD_IND 19118c2ecf20Sopenharmony_ci * pointing to specific (re-ordered) buffers. 19128c2ecf20Sopenharmony_ci * 19138c2ecf20Sopenharmony_ci * FIXME: With kernel generic hashing functions there's a lot 19148c2ecf20Sopenharmony_ci * of hash collisions for sk_buffs. 19158c2ecf20Sopenharmony_ci */ 19168c2ecf20Sopenharmony_ci bool in_ord_rx; 19178c2ecf20Sopenharmony_ci DECLARE_HASHTABLE(skb_table, 4); 19188c2ecf20Sopenharmony_ci 19198c2ecf20Sopenharmony_ci /* 19208c2ecf20Sopenharmony_ci * Ring of buffer addresses - 19218c2ecf20Sopenharmony_ci * This ring holds the "physical" device address of the 19228c2ecf20Sopenharmony_ci * rx buffers the host SW provides for the MAC HW to 19238c2ecf20Sopenharmony_ci * fill. 19248c2ecf20Sopenharmony_ci */ 19258c2ecf20Sopenharmony_ci union { 19268c2ecf20Sopenharmony_ci __le64 *paddrs_ring_64; 19278c2ecf20Sopenharmony_ci __le32 *paddrs_ring_32; 19288c2ecf20Sopenharmony_ci }; 19298c2ecf20Sopenharmony_ci 19308c2ecf20Sopenharmony_ci /* 19318c2ecf20Sopenharmony_ci * Base address of ring, as a "physical" device address 19328c2ecf20Sopenharmony_ci * rather than a CPU address. 19338c2ecf20Sopenharmony_ci */ 19348c2ecf20Sopenharmony_ci dma_addr_t base_paddr; 19358c2ecf20Sopenharmony_ci 19368c2ecf20Sopenharmony_ci /* how many elems in the ring (power of 2) */ 19378c2ecf20Sopenharmony_ci int size; 19388c2ecf20Sopenharmony_ci 19398c2ecf20Sopenharmony_ci /* size - 1 */ 19408c2ecf20Sopenharmony_ci unsigned int size_mask; 19418c2ecf20Sopenharmony_ci 19428c2ecf20Sopenharmony_ci /* how many rx buffers to keep in the ring */ 19438c2ecf20Sopenharmony_ci int fill_level; 19448c2ecf20Sopenharmony_ci 19458c2ecf20Sopenharmony_ci /* how many rx buffers (full+empty) are in the ring */ 19468c2ecf20Sopenharmony_ci int fill_cnt; 19478c2ecf20Sopenharmony_ci 19488c2ecf20Sopenharmony_ci /* 19498c2ecf20Sopenharmony_ci * alloc_idx - where HTT SW has deposited empty buffers 19508c2ecf20Sopenharmony_ci * This is allocated in consistent mem, so that the FW can 19518c2ecf20Sopenharmony_ci * read this variable, and program the HW's FW_IDX reg with 19528c2ecf20Sopenharmony_ci * the value of this shadow register. 19538c2ecf20Sopenharmony_ci */ 19548c2ecf20Sopenharmony_ci struct { 19558c2ecf20Sopenharmony_ci __le32 *vaddr; 19568c2ecf20Sopenharmony_ci dma_addr_t paddr; 19578c2ecf20Sopenharmony_ci } alloc_idx; 19588c2ecf20Sopenharmony_ci 19598c2ecf20Sopenharmony_ci /* where HTT SW has processed bufs filled by rx MAC DMA */ 19608c2ecf20Sopenharmony_ci struct { 19618c2ecf20Sopenharmony_ci unsigned int msdu_payld; 19628c2ecf20Sopenharmony_ci } sw_rd_idx; 19638c2ecf20Sopenharmony_ci 19648c2ecf20Sopenharmony_ci /* 19658c2ecf20Sopenharmony_ci * refill_retry_timer - timer triggered when the ring is 19668c2ecf20Sopenharmony_ci * not refilled to the level expected 19678c2ecf20Sopenharmony_ci */ 19688c2ecf20Sopenharmony_ci struct timer_list refill_retry_timer; 19698c2ecf20Sopenharmony_ci 19708c2ecf20Sopenharmony_ci /* Protects access to all rx ring buffer state variables */ 19718c2ecf20Sopenharmony_ci spinlock_t lock; 19728c2ecf20Sopenharmony_ci } rx_ring; 19738c2ecf20Sopenharmony_ci 19748c2ecf20Sopenharmony_ci unsigned int prefetch_len; 19758c2ecf20Sopenharmony_ci 19768c2ecf20Sopenharmony_ci /* Protects access to pending_tx, num_pending_tx */ 19778c2ecf20Sopenharmony_ci spinlock_t tx_lock; 19788c2ecf20Sopenharmony_ci int max_num_pending_tx; 19798c2ecf20Sopenharmony_ci int num_pending_tx; 19808c2ecf20Sopenharmony_ci int num_pending_mgmt_tx; 19818c2ecf20Sopenharmony_ci struct idr pending_tx; 19828c2ecf20Sopenharmony_ci wait_queue_head_t empty_tx_wq; 19838c2ecf20Sopenharmony_ci 19848c2ecf20Sopenharmony_ci /* FIFO for storing tx done status {ack, no-ack, discard} and msdu id */ 19858c2ecf20Sopenharmony_ci DECLARE_KFIFO_PTR(txdone_fifo, struct htt_tx_done); 19868c2ecf20Sopenharmony_ci 19878c2ecf20Sopenharmony_ci /* set if host-fw communication goes haywire 19888c2ecf20Sopenharmony_ci * used to avoid further failures 19898c2ecf20Sopenharmony_ci */ 19908c2ecf20Sopenharmony_ci bool rx_confused; 19918c2ecf20Sopenharmony_ci atomic_t num_mpdus_ready; 19928c2ecf20Sopenharmony_ci 19938c2ecf20Sopenharmony_ci /* This is used to group tx/rx completions separately and process them 19948c2ecf20Sopenharmony_ci * in batches to reduce cache stalls 19958c2ecf20Sopenharmony_ci */ 19968c2ecf20Sopenharmony_ci struct sk_buff_head rx_msdus_q; 19978c2ecf20Sopenharmony_ci struct sk_buff_head rx_in_ord_compl_q; 19988c2ecf20Sopenharmony_ci struct sk_buff_head tx_fetch_ind_q; 19998c2ecf20Sopenharmony_ci 20008c2ecf20Sopenharmony_ci /* rx_status template */ 20018c2ecf20Sopenharmony_ci struct ieee80211_rx_status rx_status; 20028c2ecf20Sopenharmony_ci 20038c2ecf20Sopenharmony_ci struct { 20048c2ecf20Sopenharmony_ci dma_addr_t paddr; 20058c2ecf20Sopenharmony_ci union { 20068c2ecf20Sopenharmony_ci struct htt_msdu_ext_desc *vaddr_desc_32; 20078c2ecf20Sopenharmony_ci struct htt_msdu_ext_desc_64 *vaddr_desc_64; 20088c2ecf20Sopenharmony_ci }; 20098c2ecf20Sopenharmony_ci size_t size; 20108c2ecf20Sopenharmony_ci } frag_desc; 20118c2ecf20Sopenharmony_ci 20128c2ecf20Sopenharmony_ci struct { 20138c2ecf20Sopenharmony_ci dma_addr_t paddr; 20148c2ecf20Sopenharmony_ci union { 20158c2ecf20Sopenharmony_ci struct ath10k_htt_txbuf_32 *vaddr_txbuff_32; 20168c2ecf20Sopenharmony_ci struct ath10k_htt_txbuf_64 *vaddr_txbuff_64; 20178c2ecf20Sopenharmony_ci }; 20188c2ecf20Sopenharmony_ci size_t size; 20198c2ecf20Sopenharmony_ci } txbuf; 20208c2ecf20Sopenharmony_ci 20218c2ecf20Sopenharmony_ci struct { 20228c2ecf20Sopenharmony_ci bool enabled; 20238c2ecf20Sopenharmony_ci struct htt_q_state *vaddr; 20248c2ecf20Sopenharmony_ci dma_addr_t paddr; 20258c2ecf20Sopenharmony_ci u16 num_push_allowed; 20268c2ecf20Sopenharmony_ci u16 num_peers; 20278c2ecf20Sopenharmony_ci u16 num_tids; 20288c2ecf20Sopenharmony_ci enum htt_tx_mode_switch_mode mode; 20298c2ecf20Sopenharmony_ci enum htt_q_depth_type type; 20308c2ecf20Sopenharmony_ci } tx_q_state; 20318c2ecf20Sopenharmony_ci 20328c2ecf20Sopenharmony_ci bool tx_mem_allocated; 20338c2ecf20Sopenharmony_ci const struct ath10k_htt_tx_ops *tx_ops; 20348c2ecf20Sopenharmony_ci const struct ath10k_htt_rx_ops *rx_ops; 20358c2ecf20Sopenharmony_ci bool disable_tx_comp; 20368c2ecf20Sopenharmony_ci bool bundle_tx; 20378c2ecf20Sopenharmony_ci struct sk_buff_head tx_req_head; 20388c2ecf20Sopenharmony_ci struct sk_buff_head tx_complete_head; 20398c2ecf20Sopenharmony_ci}; 20408c2ecf20Sopenharmony_ci 20418c2ecf20Sopenharmony_cistruct ath10k_htt_tx_ops { 20428c2ecf20Sopenharmony_ci int (*htt_send_rx_ring_cfg)(struct ath10k_htt *htt); 20438c2ecf20Sopenharmony_ci int (*htt_send_frag_desc_bank_cfg)(struct ath10k_htt *htt); 20448c2ecf20Sopenharmony_ci int (*htt_alloc_frag_desc)(struct ath10k_htt *htt); 20458c2ecf20Sopenharmony_ci void (*htt_free_frag_desc)(struct ath10k_htt *htt); 20468c2ecf20Sopenharmony_ci int (*htt_tx)(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode, 20478c2ecf20Sopenharmony_ci struct sk_buff *msdu); 20488c2ecf20Sopenharmony_ci int (*htt_alloc_txbuff)(struct ath10k_htt *htt); 20498c2ecf20Sopenharmony_ci void (*htt_free_txbuff)(struct ath10k_htt *htt); 20508c2ecf20Sopenharmony_ci int (*htt_h2t_aggr_cfg_msg)(struct ath10k_htt *htt, 20518c2ecf20Sopenharmony_ci u8 max_subfrms_ampdu, 20528c2ecf20Sopenharmony_ci u8 max_subfrms_amsdu); 20538c2ecf20Sopenharmony_ci void (*htt_flush_tx)(struct ath10k_htt *htt); 20548c2ecf20Sopenharmony_ci}; 20558c2ecf20Sopenharmony_ci 20568c2ecf20Sopenharmony_cistatic inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt) 20578c2ecf20Sopenharmony_ci{ 20588c2ecf20Sopenharmony_ci if (!htt->tx_ops->htt_send_rx_ring_cfg) 20598c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 20608c2ecf20Sopenharmony_ci 20618c2ecf20Sopenharmony_ci return htt->tx_ops->htt_send_rx_ring_cfg(htt); 20628c2ecf20Sopenharmony_ci} 20638c2ecf20Sopenharmony_ci 20648c2ecf20Sopenharmony_cistatic inline int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt) 20658c2ecf20Sopenharmony_ci{ 20668c2ecf20Sopenharmony_ci if (!htt->tx_ops->htt_send_frag_desc_bank_cfg) 20678c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 20688c2ecf20Sopenharmony_ci 20698c2ecf20Sopenharmony_ci return htt->tx_ops->htt_send_frag_desc_bank_cfg(htt); 20708c2ecf20Sopenharmony_ci} 20718c2ecf20Sopenharmony_ci 20728c2ecf20Sopenharmony_cistatic inline int ath10k_htt_alloc_frag_desc(struct ath10k_htt *htt) 20738c2ecf20Sopenharmony_ci{ 20748c2ecf20Sopenharmony_ci if (!htt->tx_ops->htt_alloc_frag_desc) 20758c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 20768c2ecf20Sopenharmony_ci 20778c2ecf20Sopenharmony_ci return htt->tx_ops->htt_alloc_frag_desc(htt); 20788c2ecf20Sopenharmony_ci} 20798c2ecf20Sopenharmony_ci 20808c2ecf20Sopenharmony_cistatic inline void ath10k_htt_free_frag_desc(struct ath10k_htt *htt) 20818c2ecf20Sopenharmony_ci{ 20828c2ecf20Sopenharmony_ci if (htt->tx_ops->htt_free_frag_desc) 20838c2ecf20Sopenharmony_ci htt->tx_ops->htt_free_frag_desc(htt); 20848c2ecf20Sopenharmony_ci} 20858c2ecf20Sopenharmony_ci 20868c2ecf20Sopenharmony_cistatic inline int ath10k_htt_tx(struct ath10k_htt *htt, 20878c2ecf20Sopenharmony_ci enum ath10k_hw_txrx_mode txmode, 20888c2ecf20Sopenharmony_ci struct sk_buff *msdu) 20898c2ecf20Sopenharmony_ci{ 20908c2ecf20Sopenharmony_ci return htt->tx_ops->htt_tx(htt, txmode, msdu); 20918c2ecf20Sopenharmony_ci} 20928c2ecf20Sopenharmony_ci 20938c2ecf20Sopenharmony_cistatic inline void ath10k_htt_flush_tx(struct ath10k_htt *htt) 20948c2ecf20Sopenharmony_ci{ 20958c2ecf20Sopenharmony_ci if (htt->tx_ops->htt_flush_tx) 20968c2ecf20Sopenharmony_ci htt->tx_ops->htt_flush_tx(htt); 20978c2ecf20Sopenharmony_ci} 20988c2ecf20Sopenharmony_ci 20998c2ecf20Sopenharmony_cistatic inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt) 21008c2ecf20Sopenharmony_ci{ 21018c2ecf20Sopenharmony_ci if (!htt->tx_ops->htt_alloc_txbuff) 21028c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 21038c2ecf20Sopenharmony_ci 21048c2ecf20Sopenharmony_ci return htt->tx_ops->htt_alloc_txbuff(htt); 21058c2ecf20Sopenharmony_ci} 21068c2ecf20Sopenharmony_ci 21078c2ecf20Sopenharmony_cistatic inline void ath10k_htt_free_txbuff(struct ath10k_htt *htt) 21088c2ecf20Sopenharmony_ci{ 21098c2ecf20Sopenharmony_ci if (htt->tx_ops->htt_free_txbuff) 21108c2ecf20Sopenharmony_ci htt->tx_ops->htt_free_txbuff(htt); 21118c2ecf20Sopenharmony_ci} 21128c2ecf20Sopenharmony_ci 21138c2ecf20Sopenharmony_cistatic inline int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt, 21148c2ecf20Sopenharmony_ci u8 max_subfrms_ampdu, 21158c2ecf20Sopenharmony_ci u8 max_subfrms_amsdu) 21168c2ecf20Sopenharmony_ci 21178c2ecf20Sopenharmony_ci{ 21188c2ecf20Sopenharmony_ci if (!htt->tx_ops->htt_h2t_aggr_cfg_msg) 21198c2ecf20Sopenharmony_ci return -EOPNOTSUPP; 21208c2ecf20Sopenharmony_ci 21218c2ecf20Sopenharmony_ci return htt->tx_ops->htt_h2t_aggr_cfg_msg(htt, 21228c2ecf20Sopenharmony_ci max_subfrms_ampdu, 21238c2ecf20Sopenharmony_ci max_subfrms_amsdu); 21248c2ecf20Sopenharmony_ci} 21258c2ecf20Sopenharmony_ci 21268c2ecf20Sopenharmony_cistruct ath10k_htt_rx_ops { 21278c2ecf20Sopenharmony_ci size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt); 21288c2ecf20Sopenharmony_ci void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr); 21298c2ecf20Sopenharmony_ci void (*htt_set_paddrs_ring)(struct ath10k_htt *htt, dma_addr_t paddr, 21308c2ecf20Sopenharmony_ci int idx); 21318c2ecf20Sopenharmony_ci void* (*htt_get_vaddr_ring)(struct ath10k_htt *htt); 21328c2ecf20Sopenharmony_ci void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx); 21338c2ecf20Sopenharmony_ci bool (*htt_rx_proc_rx_frag_ind)(struct ath10k_htt *htt, 21348c2ecf20Sopenharmony_ci struct htt_rx_fragment_indication *rx, 21358c2ecf20Sopenharmony_ci struct sk_buff *skb); 21368c2ecf20Sopenharmony_ci}; 21378c2ecf20Sopenharmony_ci 21388c2ecf20Sopenharmony_cistatic inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt) 21398c2ecf20Sopenharmony_ci{ 21408c2ecf20Sopenharmony_ci if (!htt->rx_ops->htt_get_rx_ring_size) 21418c2ecf20Sopenharmony_ci return 0; 21428c2ecf20Sopenharmony_ci 21438c2ecf20Sopenharmony_ci return htt->rx_ops->htt_get_rx_ring_size(htt); 21448c2ecf20Sopenharmony_ci} 21458c2ecf20Sopenharmony_ci 21468c2ecf20Sopenharmony_cistatic inline void ath10k_htt_config_paddrs_ring(struct ath10k_htt *htt, 21478c2ecf20Sopenharmony_ci void *vaddr) 21488c2ecf20Sopenharmony_ci{ 21498c2ecf20Sopenharmony_ci if (htt->rx_ops->htt_config_paddrs_ring) 21508c2ecf20Sopenharmony_ci htt->rx_ops->htt_config_paddrs_ring(htt, vaddr); 21518c2ecf20Sopenharmony_ci} 21528c2ecf20Sopenharmony_ci 21538c2ecf20Sopenharmony_cistatic inline void ath10k_htt_set_paddrs_ring(struct ath10k_htt *htt, 21548c2ecf20Sopenharmony_ci dma_addr_t paddr, 21558c2ecf20Sopenharmony_ci int idx) 21568c2ecf20Sopenharmony_ci{ 21578c2ecf20Sopenharmony_ci if (htt->rx_ops->htt_set_paddrs_ring) 21588c2ecf20Sopenharmony_ci htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx); 21598c2ecf20Sopenharmony_ci} 21608c2ecf20Sopenharmony_ci 21618c2ecf20Sopenharmony_cistatic inline void *ath10k_htt_get_vaddr_ring(struct ath10k_htt *htt) 21628c2ecf20Sopenharmony_ci{ 21638c2ecf20Sopenharmony_ci if (!htt->rx_ops->htt_get_vaddr_ring) 21648c2ecf20Sopenharmony_ci return NULL; 21658c2ecf20Sopenharmony_ci 21668c2ecf20Sopenharmony_ci return htt->rx_ops->htt_get_vaddr_ring(htt); 21678c2ecf20Sopenharmony_ci} 21688c2ecf20Sopenharmony_ci 21698c2ecf20Sopenharmony_cistatic inline void ath10k_htt_reset_paddrs_ring(struct ath10k_htt *htt, int idx) 21708c2ecf20Sopenharmony_ci{ 21718c2ecf20Sopenharmony_ci if (htt->rx_ops->htt_reset_paddrs_ring) 21728c2ecf20Sopenharmony_ci htt->rx_ops->htt_reset_paddrs_ring(htt, idx); 21738c2ecf20Sopenharmony_ci} 21748c2ecf20Sopenharmony_ci 21758c2ecf20Sopenharmony_cistatic inline bool ath10k_htt_rx_proc_rx_frag_ind(struct ath10k_htt *htt, 21768c2ecf20Sopenharmony_ci struct htt_rx_fragment_indication *rx, 21778c2ecf20Sopenharmony_ci struct sk_buff *skb) 21788c2ecf20Sopenharmony_ci{ 21798c2ecf20Sopenharmony_ci if (!htt->rx_ops->htt_rx_proc_rx_frag_ind) 21808c2ecf20Sopenharmony_ci return true; 21818c2ecf20Sopenharmony_ci 21828c2ecf20Sopenharmony_ci return htt->rx_ops->htt_rx_proc_rx_frag_ind(htt, rx, skb); 21838c2ecf20Sopenharmony_ci} 21848c2ecf20Sopenharmony_ci 21858c2ecf20Sopenharmony_ci#define RX_HTT_HDR_STATUS_LEN 64 21868c2ecf20Sopenharmony_ci 21878c2ecf20Sopenharmony_ci/* This structure layout is programmed via rx ring setup 21888c2ecf20Sopenharmony_ci * so that FW knows how to transfer the rx descriptor to the host. 21898c2ecf20Sopenharmony_ci * Buffers like this are placed on the rx ring. 21908c2ecf20Sopenharmony_ci */ 21918c2ecf20Sopenharmony_cistruct htt_rx_desc { 21928c2ecf20Sopenharmony_ci union { 21938c2ecf20Sopenharmony_ci /* This field is filled on the host using the msdu buffer 21948c2ecf20Sopenharmony_ci * from htt_rx_indication 21958c2ecf20Sopenharmony_ci */ 21968c2ecf20Sopenharmony_ci struct fw_rx_desc_base fw_desc; 21978c2ecf20Sopenharmony_ci u32 pad; 21988c2ecf20Sopenharmony_ci } __packed; 21998c2ecf20Sopenharmony_ci struct { 22008c2ecf20Sopenharmony_ci struct rx_attention attention; 22018c2ecf20Sopenharmony_ci struct rx_frag_info frag_info; 22028c2ecf20Sopenharmony_ci struct rx_mpdu_start mpdu_start; 22038c2ecf20Sopenharmony_ci struct rx_msdu_start msdu_start; 22048c2ecf20Sopenharmony_ci struct rx_msdu_end msdu_end; 22058c2ecf20Sopenharmony_ci struct rx_mpdu_end mpdu_end; 22068c2ecf20Sopenharmony_ci struct rx_ppdu_start ppdu_start; 22078c2ecf20Sopenharmony_ci struct rx_ppdu_end ppdu_end; 22088c2ecf20Sopenharmony_ci } __packed; 22098c2ecf20Sopenharmony_ci u8 rx_hdr_status[RX_HTT_HDR_STATUS_LEN]; 22108c2ecf20Sopenharmony_ci u8 msdu_payload[]; 22118c2ecf20Sopenharmony_ci}; 22128c2ecf20Sopenharmony_ci 22138c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_SEQ_NUM_MASK 0x00000fff 22148c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_SEQ_NUM_LSB 0 22158c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_ENCRYPTED_MASK 0x00001000 22168c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_ENCRYPTED_LSB 12 22178c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_CHAN_INFO_PRESENT_MASK 0x00002000 22188c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_CHAN_INFO_PRESENT_LSB 13 22198c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_MCAST_BCAST_MASK 0x00010000 22208c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_MCAST_BCAST_LSB 16 22218c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_KEY_ID_OCT_MASK 0x01fe0000 22228c2ecf20Sopenharmony_ci#define HTT_RX_DESC_HL_INFO_KEY_ID_OCT_LSB 17 22238c2ecf20Sopenharmony_ci 22248c2ecf20Sopenharmony_cistruct htt_rx_desc_base_hl { 22258c2ecf20Sopenharmony_ci __le32 info; /* HTT_RX_DESC_HL_INFO_ */ 22268c2ecf20Sopenharmony_ci}; 22278c2ecf20Sopenharmony_ci 22288c2ecf20Sopenharmony_cistruct htt_rx_chan_info { 22298c2ecf20Sopenharmony_ci __le16 primary_chan_center_freq_mhz; 22308c2ecf20Sopenharmony_ci __le16 contig_chan1_center_freq_mhz; 22318c2ecf20Sopenharmony_ci __le16 contig_chan2_center_freq_mhz; 22328c2ecf20Sopenharmony_ci u8 phy_mode; 22338c2ecf20Sopenharmony_ci u8 reserved; 22348c2ecf20Sopenharmony_ci} __packed; 22358c2ecf20Sopenharmony_ci 22368c2ecf20Sopenharmony_ci#define HTT_RX_DESC_ALIGN 8 22378c2ecf20Sopenharmony_ci 22388c2ecf20Sopenharmony_ci#define HTT_MAC_ADDR_LEN 6 22398c2ecf20Sopenharmony_ci 22408c2ecf20Sopenharmony_ci/* 22418c2ecf20Sopenharmony_ci * FIX THIS 22428c2ecf20Sopenharmony_ci * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, 22438c2ecf20Sopenharmony_ci * rounded up to a cache line size. 22448c2ecf20Sopenharmony_ci */ 22458c2ecf20Sopenharmony_ci#define HTT_RX_BUF_SIZE 1920 22468c2ecf20Sopenharmony_ci#define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc)) 22478c2ecf20Sopenharmony_ci 22488c2ecf20Sopenharmony_ci/* Refill a bunch of RX buffers for each refill round so that FW/HW can handle 22498c2ecf20Sopenharmony_ci * aggregated traffic more nicely. 22508c2ecf20Sopenharmony_ci */ 22518c2ecf20Sopenharmony_ci#define ATH10K_HTT_MAX_NUM_REFILL 100 22528c2ecf20Sopenharmony_ci 22538c2ecf20Sopenharmony_ci/* 22548c2ecf20Sopenharmony_ci * DMA_MAP expects the buffer to be an integral number of cache lines. 22558c2ecf20Sopenharmony_ci * Rather than checking the actual cache line size, this code makes a 22568c2ecf20Sopenharmony_ci * conservative estimate of what the cache line size could be. 22578c2ecf20Sopenharmony_ci */ 22588c2ecf20Sopenharmony_ci#define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */ 22598c2ecf20Sopenharmony_ci#define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) 22608c2ecf20Sopenharmony_ci 22618c2ecf20Sopenharmony_ci/* These values are default in most firmware revisions and apparently are a 22628c2ecf20Sopenharmony_ci * sweet spot performance wise. 22638c2ecf20Sopenharmony_ci */ 22648c2ecf20Sopenharmony_ci#define ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT 3 22658c2ecf20Sopenharmony_ci#define ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT 64 22668c2ecf20Sopenharmony_ci 22678c2ecf20Sopenharmony_ciint ath10k_htt_connect(struct ath10k_htt *htt); 22688c2ecf20Sopenharmony_ciint ath10k_htt_init(struct ath10k *ar); 22698c2ecf20Sopenharmony_ciint ath10k_htt_setup(struct ath10k_htt *htt); 22708c2ecf20Sopenharmony_ci 22718c2ecf20Sopenharmony_ciint ath10k_htt_tx_start(struct ath10k_htt *htt); 22728c2ecf20Sopenharmony_civoid ath10k_htt_tx_stop(struct ath10k_htt *htt); 22738c2ecf20Sopenharmony_civoid ath10k_htt_tx_destroy(struct ath10k_htt *htt); 22748c2ecf20Sopenharmony_civoid ath10k_htt_tx_free(struct ath10k_htt *htt); 22758c2ecf20Sopenharmony_ci 22768c2ecf20Sopenharmony_ciint ath10k_htt_rx_alloc(struct ath10k_htt *htt); 22778c2ecf20Sopenharmony_ciint ath10k_htt_rx_ring_refill(struct ath10k *ar); 22788c2ecf20Sopenharmony_civoid ath10k_htt_rx_free(struct ath10k_htt *htt); 22798c2ecf20Sopenharmony_ci 22808c2ecf20Sopenharmony_civoid ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb); 22818c2ecf20Sopenharmony_civoid ath10k_htt_htc_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); 22828c2ecf20Sopenharmony_cibool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); 22838c2ecf20Sopenharmony_ciint ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); 22848c2ecf20Sopenharmony_ciint ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u32 mask, u32 reset_mask, 22858c2ecf20Sopenharmony_ci u64 cookie); 22868c2ecf20Sopenharmony_civoid ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb); 22878c2ecf20Sopenharmony_ciint ath10k_htt_tx_fetch_resp(struct ath10k *ar, 22888c2ecf20Sopenharmony_ci __le32 token, 22898c2ecf20Sopenharmony_ci __le16 fetch_seq_num, 22908c2ecf20Sopenharmony_ci struct htt_tx_fetch_record *records, 22918c2ecf20Sopenharmony_ci size_t num_records); 22928c2ecf20Sopenharmony_civoid ath10k_htt_op_ep_tx_credits(struct ath10k *ar); 22938c2ecf20Sopenharmony_ci 22948c2ecf20Sopenharmony_civoid ath10k_htt_tx_txq_update(struct ieee80211_hw *hw, 22958c2ecf20Sopenharmony_ci struct ieee80211_txq *txq); 22968c2ecf20Sopenharmony_civoid ath10k_htt_tx_txq_recalc(struct ieee80211_hw *hw, 22978c2ecf20Sopenharmony_ci struct ieee80211_txq *txq); 22988c2ecf20Sopenharmony_civoid ath10k_htt_tx_txq_sync(struct ath10k *ar); 22998c2ecf20Sopenharmony_civoid ath10k_htt_tx_dec_pending(struct ath10k_htt *htt); 23008c2ecf20Sopenharmony_ciint ath10k_htt_tx_inc_pending(struct ath10k_htt *htt); 23018c2ecf20Sopenharmony_civoid ath10k_htt_tx_mgmt_dec_pending(struct ath10k_htt *htt); 23028c2ecf20Sopenharmony_ciint ath10k_htt_tx_mgmt_inc_pending(struct ath10k_htt *htt, bool is_mgmt, 23038c2ecf20Sopenharmony_ci bool is_presp); 23048c2ecf20Sopenharmony_ci 23058c2ecf20Sopenharmony_ciint ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb); 23068c2ecf20Sopenharmony_civoid ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id); 23078c2ecf20Sopenharmony_ciint ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu); 23088c2ecf20Sopenharmony_civoid ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar, 23098c2ecf20Sopenharmony_ci struct sk_buff *skb); 23108c2ecf20Sopenharmony_ciint ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget); 23118c2ecf20Sopenharmony_ciint ath10k_htt_rx_hl_indication(struct ath10k *ar, int budget); 23128c2ecf20Sopenharmony_civoid ath10k_htt_set_tx_ops(struct ath10k_htt *htt); 23138c2ecf20Sopenharmony_civoid ath10k_htt_set_rx_ops(struct ath10k_htt *htt); 23148c2ecf20Sopenharmony_ci#endif 2315