Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (c) 2005-2011 Atheros Communications Inc. |
| 3 | * Copyright (c) 2011-2013 Qualcomm Atheros, Inc. |
| 4 | * |
| 5 | * Permission to use, copy, modify, and/or distribute this software for any |
| 6 | * purpose with or without fee is hereby granted, provided that the above |
| 7 | * copyright notice and this permission notice appear in all copies. |
| 8 | * |
| 9 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES |
| 10 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF |
| 11 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR |
| 12 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES |
| 13 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN |
| 14 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF |
| 15 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. |
| 16 | */ |
| 17 | |
| 18 | #ifndef _HTT_H_ |
| 19 | #define _HTT_H_ |
| 20 | |
| 21 | #include <linux/bug.h> |
Michal Kazior | 6e712d4 | 2013-09-24 10:18:36 +0200 | [diff] [blame] | 22 | #include <linux/interrupt.h> |
Michal Kazior | a16942e | 2014-02-27 18:50:04 +0200 | [diff] [blame] | 23 | #include <linux/dmapool.h> |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 24 | #include <linux/hashtable.h> |
Janusz Dziedzic | 8f739db | 2014-03-24 21:23:17 +0100 | [diff] [blame] | 25 | #include <net/mac80211.h> |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 26 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 27 | #include "htc.h" |
| 28 | #include "rx_desc.h" |
Rajkumar Manoharan | 8348db2 | 2015-03-25 13:12:27 +0200 | [diff] [blame^] | 29 | #include "hw.h" |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 30 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 31 | enum htt_dbg_stats_type { |
| 32 | HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0, |
| 33 | HTT_DBG_STATS_RX_REORDER = 1 << 1, |
| 34 | HTT_DBG_STATS_RX_RATE_INFO = 1 << 2, |
| 35 | HTT_DBG_STATS_TX_PPDU_LOG = 1 << 3, |
| 36 | HTT_DBG_STATS_TX_RATE_INFO = 1 << 4, |
| 37 | /* bits 5-23 currently reserved */ |
| 38 | |
| 39 | HTT_DBG_NUM_STATS /* keep this last */ |
| 40 | }; |
| 41 | |
| 42 | enum htt_h2t_msg_type { /* host-to-target */ |
| 43 | HTT_H2T_MSG_TYPE_VERSION_REQ = 0, |
| 44 | HTT_H2T_MSG_TYPE_TX_FRM = 1, |
| 45 | HTT_H2T_MSG_TYPE_RX_RING_CFG = 2, |
| 46 | HTT_H2T_MSG_TYPE_STATS_REQ = 3, |
| 47 | HTT_H2T_MSG_TYPE_SYNC = 4, |
| 48 | HTT_H2T_MSG_TYPE_AGGR_CFG = 5, |
| 49 | HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG = 6, |
Michal Kazior | 961d4c3 | 2013-08-09 10:13:34 +0200 | [diff] [blame] | 50 | |
| 51 | /* This command is used for sending management frames in HTT < 3.0. |
| 52 | * HTT >= 3.0 uses TX_FRM for everything. */ |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 53 | HTT_H2T_MSG_TYPE_MGMT_TX = 7, |
| 54 | |
| 55 | HTT_H2T_NUM_MSGS /* keep this last */ |
| 56 | }; |
| 57 | |
| 58 | struct htt_cmd_hdr { |
| 59 | u8 msg_type; |
| 60 | } __packed; |
| 61 | |
| 62 | struct htt_ver_req { |
| 63 | u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)]; |
| 64 | } __packed; |
| 65 | |
| 66 | /* |
| 67 | * HTT tx MSDU descriptor |
| 68 | * |
| 69 | * The HTT tx MSDU descriptor is created by the host HTT SW for each |
| 70 | * tx MSDU. The HTT tx MSDU descriptor contains the information that |
| 71 | * the target firmware needs for the FW's tx processing, particularly |
| 72 | * for creating the HW msdu descriptor. |
| 73 | * The same HTT tx descriptor is used for HL and LL systems, though |
| 74 | * a few fields within the tx descriptor are used only by LL or |
| 75 | * only by HL. |
| 76 | * The HTT tx descriptor is defined in two manners: by a struct with |
| 77 | * bitfields, and by a series of [dword offset, bit mask, bit shift] |
| 78 | * definitions. |
| 79 | * The target should use the struct def, for simplicitly and clarity, |
| 80 | * but the host shall use the bit-mast + bit-shift defs, to be endian- |
| 81 | * neutral. Specifically, the host shall use the get/set macros built |
| 82 | * around the mask + shift defs. |
| 83 | */ |
| 84 | struct htt_data_tx_desc_frag { |
| 85 | __le32 paddr; |
| 86 | __le32 len; |
| 87 | } __packed; |
| 88 | |
| 89 | enum htt_data_tx_desc_flags0 { |
| 90 | HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1 << 0, |
| 91 | HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1 << 1, |
| 92 | HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT = 1 << 2, |
| 93 | HTT_DATA_TX_DESC_FLAGS0_NO_CLASSIFY = 1 << 3, |
| 94 | HTT_DATA_TX_DESC_FLAGS0_RSVD0 = 1 << 4 |
| 95 | #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_MASK 0xE0 |
| 96 | #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_LSB 5 |
| 97 | }; |
| 98 | |
| 99 | enum htt_data_tx_desc_flags1 { |
| 100 | #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_BITS 6 |
| 101 | #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_MASK 0x003F |
| 102 | #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_LSB 0 |
| 103 | #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_BITS 5 |
| 104 | #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_MASK 0x07C0 |
| 105 | #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_LSB 6 |
| 106 | HTT_DATA_TX_DESC_FLAGS1_POSTPONED = 1 << 11, |
| 107 | HTT_DATA_TX_DESC_FLAGS1_MORE_IN_BATCH = 1 << 12, |
| 108 | HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD = 1 << 13, |
| 109 | HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD = 1 << 14, |
| 110 | HTT_DATA_TX_DESC_FLAGS1_RSVD1 = 1 << 15 |
| 111 | }; |
| 112 | |
| 113 | enum htt_data_tx_ext_tid { |
| 114 | HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST = 16, |
| 115 | HTT_DATA_TX_EXT_TID_MGMT = 17, |
| 116 | HTT_DATA_TX_EXT_TID_INVALID = 31 |
| 117 | }; |
| 118 | |
| 119 | #define HTT_INVALID_PEERID 0xFFFF |
| 120 | |
| 121 | /* |
| 122 | * htt_data_tx_desc - used for data tx path |
| 123 | * |
| 124 | * Note: vdev_id irrelevant for pkt_type == raw and no_classify == 1. |
| 125 | * ext_tid: for qos-data frames (0-15), see %HTT_DATA_TX_EXT_TID_ |
| 126 | * for special kinds of tids |
| 127 | * postponed: only for HL hosts. indicates if this is a resend |
| 128 | * (HL hosts manage queues on the host ) |
| 129 | * more_in_batch: only for HL hosts. indicates if more packets are |
| 130 | * pending. this allows target to wait and aggregate |
Michal Kazior | 8d6d362 | 2014-11-24 14:58:31 +0100 | [diff] [blame] | 131 | * freq: 0 means home channel of given vdev. intended for offchannel |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 132 | */ |
| 133 | struct htt_data_tx_desc { |
| 134 | u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */ |
| 135 | __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */ |
| 136 | __le16 len; |
| 137 | __le16 id; |
| 138 | __le32 frags_paddr; |
Michal Kazior | 8d6d362 | 2014-11-24 14:58:31 +0100 | [diff] [blame] | 139 | __le16 peerid; |
| 140 | __le16 freq; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 141 | u8 prefetch[0]; /* start of frame, for FW classification engine */ |
| 142 | } __packed; |
| 143 | |
| 144 | enum htt_rx_ring_flags { |
| 145 | HTT_RX_RING_FLAGS_MAC80211_HDR = 1 << 0, |
| 146 | HTT_RX_RING_FLAGS_MSDU_PAYLOAD = 1 << 1, |
| 147 | HTT_RX_RING_FLAGS_PPDU_START = 1 << 2, |
| 148 | HTT_RX_RING_FLAGS_PPDU_END = 1 << 3, |
| 149 | HTT_RX_RING_FLAGS_MPDU_START = 1 << 4, |
| 150 | HTT_RX_RING_FLAGS_MPDU_END = 1 << 5, |
| 151 | HTT_RX_RING_FLAGS_MSDU_START = 1 << 6, |
| 152 | HTT_RX_RING_FLAGS_MSDU_END = 1 << 7, |
| 153 | HTT_RX_RING_FLAGS_RX_ATTENTION = 1 << 8, |
| 154 | HTT_RX_RING_FLAGS_FRAG_INFO = 1 << 9, |
| 155 | HTT_RX_RING_FLAGS_UNICAST_RX = 1 << 10, |
| 156 | HTT_RX_RING_FLAGS_MULTICAST_RX = 1 << 11, |
| 157 | HTT_RX_RING_FLAGS_CTRL_RX = 1 << 12, |
| 158 | HTT_RX_RING_FLAGS_MGMT_RX = 1 << 13, |
| 159 | HTT_RX_RING_FLAGS_NULL_RX = 1 << 14, |
| 160 | HTT_RX_RING_FLAGS_PHY_DATA_RX = 1 << 15 |
| 161 | }; |
| 162 | |
Michal Kazior | fe2407a | 2014-11-27 11:12:43 +0100 | [diff] [blame] | 163 | #define HTT_RX_RING_SIZE_MIN 128 |
| 164 | #define HTT_RX_RING_SIZE_MAX 2048 |
| 165 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 166 | struct htt_rx_ring_setup_ring { |
| 167 | __le32 fw_idx_shadow_reg_paddr; |
| 168 | __le32 rx_ring_base_paddr; |
| 169 | __le16 rx_ring_len; /* in 4-byte words */ |
| 170 | __le16 rx_ring_bufsize; /* rx skb size - in bytes */ |
| 171 | __le16 flags; /* %HTT_RX_RING_FLAGS_ */ |
| 172 | __le16 fw_idx_init_val; |
| 173 | |
| 174 | /* the following offsets are in 4-byte units */ |
| 175 | __le16 mac80211_hdr_offset; |
| 176 | __le16 msdu_payload_offset; |
| 177 | __le16 ppdu_start_offset; |
| 178 | __le16 ppdu_end_offset; |
| 179 | __le16 mpdu_start_offset; |
| 180 | __le16 mpdu_end_offset; |
| 181 | __le16 msdu_start_offset; |
| 182 | __le16 msdu_end_offset; |
| 183 | __le16 rx_attention_offset; |
| 184 | __le16 frag_info_offset; |
| 185 | } __packed; |
| 186 | |
| 187 | struct htt_rx_ring_setup_hdr { |
| 188 | u8 num_rings; /* supported values: 1, 2 */ |
| 189 | __le16 rsvd0; |
| 190 | } __packed; |
| 191 | |
| 192 | struct htt_rx_ring_setup { |
| 193 | struct htt_rx_ring_setup_hdr hdr; |
| 194 | struct htt_rx_ring_setup_ring rings[0]; |
| 195 | } __packed; |
| 196 | |
| 197 | /* |
| 198 | * htt_stats_req - request target to send specified statistics |
| 199 | * |
| 200 | * @msg_type: hardcoded %HTT_H2T_MSG_TYPE_STATS_REQ |
| 201 | * @upload_types: see %htt_dbg_stats_type. this is 24bit field actually |
| 202 | * so make sure its little-endian. |
| 203 | * @reset_types: see %htt_dbg_stats_type. this is 24bit field actually |
| 204 | * so make sure its little-endian. |
| 205 | * @cfg_val: stat_type specific configuration |
| 206 | * @stat_type: see %htt_dbg_stats_type |
| 207 | * @cookie_lsb: used for confirmation message from target->host |
| 208 | * @cookie_msb: ditto as %cookie |
| 209 | */ |
| 210 | struct htt_stats_req { |
| 211 | u8 upload_types[3]; |
| 212 | u8 rsvd0; |
| 213 | u8 reset_types[3]; |
| 214 | struct { |
| 215 | u8 mpdu_bytes; |
| 216 | u8 mpdu_num_msdus; |
| 217 | u8 msdu_bytes; |
| 218 | } __packed; |
| 219 | u8 stat_type; |
| 220 | __le32 cookie_lsb; |
| 221 | __le32 cookie_msb; |
| 222 | } __packed; |
| 223 | |
| 224 | #define HTT_STATS_REQ_CFG_STAT_TYPE_INVALID 0xff |
| 225 | |
| 226 | /* |
| 227 | * htt_oob_sync_req - request out-of-band sync |
| 228 | * |
| 229 | * The HTT SYNC tells the target to suspend processing of subsequent |
| 230 | * HTT host-to-target messages until some other target agent locally |
| 231 | * informs the target HTT FW that the current sync counter is equal to |
| 232 | * or greater than (in a modulo sense) the sync counter specified in |
| 233 | * the SYNC message. |
| 234 | * |
| 235 | * This allows other host-target components to synchronize their operation |
| 236 | * with HTT, e.g. to ensure that tx frames don't get transmitted until a |
| 237 | * security key has been downloaded to and activated by the target. |
| 238 | * In the absence of any explicit synchronization counter value |
| 239 | * specification, the target HTT FW will use zero as the default current |
| 240 | * sync value. |
| 241 | * |
| 242 | * The HTT target FW will suspend its host->target message processing as long |
| 243 | * as 0 < (in-band sync counter - out-of-band sync counter) & 0xff < 128. |
| 244 | */ |
| 245 | struct htt_oob_sync_req { |
| 246 | u8 sync_count; |
| 247 | __le16 rsvd0; |
| 248 | } __packed; |
| 249 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 250 | struct htt_aggr_conf { |
| 251 | u8 max_num_ampdu_subframes; |
Janusz Dziedzic | d385623 | 2014-06-02 21:19:46 +0300 | [diff] [blame] | 252 | /* amsdu_subframes is limited by 0x1F mask */ |
| 253 | u8 max_num_amsdu_subframes; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 254 | } __packed; |
| 255 | |
| 256 | #define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32 |
| 257 | |
| 258 | struct htt_mgmt_tx_desc { |
| 259 | u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)]; |
| 260 | __le32 msdu_paddr; |
| 261 | __le32 desc_id; |
| 262 | __le32 len; |
| 263 | __le32 vdev_id; |
| 264 | u8 hdr[HTT_MGMT_FRM_HDR_DOWNLOAD_LEN]; |
| 265 | } __packed; |
| 266 | |
| 267 | enum htt_mgmt_tx_status { |
| 268 | HTT_MGMT_TX_STATUS_OK = 0, |
| 269 | HTT_MGMT_TX_STATUS_RETRY = 1, |
| 270 | HTT_MGMT_TX_STATUS_DROP = 2 |
| 271 | }; |
| 272 | |
| 273 | /*=== target -> host messages ===============================================*/ |
| 274 | |
Rajkumar Manoharan | 8348db2 | 2015-03-25 13:12:27 +0200 | [diff] [blame^] | 275 | enum htt_main_t2h_msg_type { |
| 276 | HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF = 0x0, |
| 277 | HTT_MAIN_T2H_MSG_TYPE_RX_IND = 0x1, |
| 278 | HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH = 0x2, |
| 279 | HTT_MAIN_T2H_MSG_TYPE_PEER_MAP = 0x3, |
| 280 | HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP = 0x4, |
| 281 | HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA = 0x5, |
| 282 | HTT_MAIN_T2H_MSG_TYPE_RX_DELBA = 0x6, |
| 283 | HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, |
| 284 | HTT_MAIN_T2H_MSG_TYPE_PKTLOG = 0x8, |
| 285 | HTT_MAIN_T2H_MSG_TYPE_STATS_CONF = 0x9, |
| 286 | HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, |
| 287 | HTT_MAIN_T2H_MSG_TYPE_SEC_IND = 0xb, |
| 288 | HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, |
| 289 | HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, |
| 290 | HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, |
| 291 | HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND = 0x10, |
| 292 | HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, |
| 293 | HTT_MAIN_T2H_MSG_TYPE_TEST, |
| 294 | /* keep this last */ |
| 295 | HTT_MAIN_T2H_NUM_MSGS |
| 296 | }; |
| 297 | |
| 298 | enum htt_10x_t2h_msg_type { |
| 299 | HTT_10X_T2H_MSG_TYPE_VERSION_CONF = 0x0, |
| 300 | HTT_10X_T2H_MSG_TYPE_RX_IND = 0x1, |
| 301 | HTT_10X_T2H_MSG_TYPE_RX_FLUSH = 0x2, |
| 302 | HTT_10X_T2H_MSG_TYPE_PEER_MAP = 0x3, |
| 303 | HTT_10X_T2H_MSG_TYPE_PEER_UNMAP = 0x4, |
| 304 | HTT_10X_T2H_MSG_TYPE_RX_ADDBA = 0x5, |
| 305 | HTT_10X_T2H_MSG_TYPE_RX_DELBA = 0x6, |
| 306 | HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, |
| 307 | HTT_10X_T2H_MSG_TYPE_PKTLOG = 0x8, |
| 308 | HTT_10X_T2H_MSG_TYPE_STATS_CONF = 0x9, |
| 309 | HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, |
| 310 | HTT_10X_T2H_MSG_TYPE_SEC_IND = 0xb, |
| 311 | HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, |
| 312 | HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, |
| 313 | HTT_10X_T2H_MSG_TYPE_TEST = 0xe, |
| 314 | HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE = 0xf, |
| 315 | HTT_10X_T2H_MSG_TYPE_AGGR_CONF = 0x11, |
| 316 | HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x12, |
| 317 | HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0x13, |
| 318 | /* keep this last */ |
| 319 | HTT_10X_T2H_NUM_MSGS |
| 320 | }; |
| 321 | |
| 322 | enum htt_tlv_t2h_msg_type { |
| 323 | HTT_TLV_T2H_MSG_TYPE_VERSION_CONF = 0x0, |
| 324 | HTT_TLV_T2H_MSG_TYPE_RX_IND = 0x1, |
| 325 | HTT_TLV_T2H_MSG_TYPE_RX_FLUSH = 0x2, |
| 326 | HTT_TLV_T2H_MSG_TYPE_PEER_MAP = 0x3, |
| 327 | HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP = 0x4, |
| 328 | HTT_TLV_T2H_MSG_TYPE_RX_ADDBA = 0x5, |
| 329 | HTT_TLV_T2H_MSG_TYPE_RX_DELBA = 0x6, |
| 330 | HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND = 0x7, |
| 331 | HTT_TLV_T2H_MSG_TYPE_PKTLOG = 0x8, |
| 332 | HTT_TLV_T2H_MSG_TYPE_STATS_CONF = 0x9, |
| 333 | HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND = 0xa, |
| 334 | HTT_TLV_T2H_MSG_TYPE_SEC_IND = 0xb, |
| 335 | HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, /* deprecated */ |
| 336 | HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd, |
| 337 | HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe, |
| 338 | HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf, |
| 339 | HTT_TLV_T2H_MSG_TYPE_RX_PN_IND = 0x10, |
| 340 | HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11, |
| 341 | HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12, |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 342 | /* 0x13 reservd */ |
Rajkumar Manoharan | 8348db2 | 2015-03-25 13:12:27 +0200 | [diff] [blame^] | 343 | HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14, |
| 344 | HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE = 0x15, |
| 345 | HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR = 0x16, |
| 346 | HTT_TLV_T2H_MSG_TYPE_TEST, |
| 347 | /* keep this last */ |
| 348 | HTT_TLV_T2H_NUM_MSGS |
| 349 | }; |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 350 | |
Rajkumar Manoharan | 8348db2 | 2015-03-25 13:12:27 +0200 | [diff] [blame^] | 351 | enum htt_t2h_msg_type { |
| 352 | HTT_T2H_MSG_TYPE_VERSION_CONF, |
| 353 | HTT_T2H_MSG_TYPE_RX_IND, |
| 354 | HTT_T2H_MSG_TYPE_RX_FLUSH, |
| 355 | HTT_T2H_MSG_TYPE_PEER_MAP, |
| 356 | HTT_T2H_MSG_TYPE_PEER_UNMAP, |
| 357 | HTT_T2H_MSG_TYPE_RX_ADDBA, |
| 358 | HTT_T2H_MSG_TYPE_RX_DELBA, |
| 359 | HTT_T2H_MSG_TYPE_TX_COMPL_IND, |
| 360 | HTT_T2H_MSG_TYPE_PKTLOG, |
| 361 | HTT_T2H_MSG_TYPE_STATS_CONF, |
| 362 | HTT_T2H_MSG_TYPE_RX_FRAG_IND, |
| 363 | HTT_T2H_MSG_TYPE_SEC_IND, |
| 364 | HTT_T2H_MSG_TYPE_RC_UPDATE_IND, |
| 365 | HTT_T2H_MSG_TYPE_TX_INSPECT_IND, |
| 366 | HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION, |
| 367 | HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND, |
| 368 | HTT_T2H_MSG_TYPE_RX_PN_IND, |
| 369 | HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND, |
| 370 | HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND, |
| 371 | HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE, |
| 372 | HTT_T2H_MSG_TYPE_CHAN_CHANGE, |
| 373 | HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR, |
| 374 | HTT_T2H_MSG_TYPE_AGGR_CONF, |
| 375 | HTT_T2H_MSG_TYPE_STATS_NOUPLOAD, |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 376 | HTT_T2H_MSG_TYPE_TEST, |
| 377 | /* keep this last */ |
| 378 | HTT_T2H_NUM_MSGS |
| 379 | }; |
| 380 | |
| 381 | /* |
| 382 | * htt_resp_hdr - header for target-to-host messages |
| 383 | * |
| 384 | * msg_type: see htt_t2h_msg_type |
| 385 | */ |
| 386 | struct htt_resp_hdr { |
| 387 | u8 msg_type; |
| 388 | } __packed; |
| 389 | |
| 390 | #define HTT_RESP_HDR_MSG_TYPE_OFFSET 0 |
| 391 | #define HTT_RESP_HDR_MSG_TYPE_MASK 0xff |
| 392 | #define HTT_RESP_HDR_MSG_TYPE_LSB 0 |
| 393 | |
| 394 | /* htt_ver_resp - response sent for htt_ver_req */ |
| 395 | struct htt_ver_resp { |
| 396 | u8 minor; |
| 397 | u8 major; |
| 398 | u8 rsvd0; |
| 399 | } __packed; |
| 400 | |
| 401 | struct htt_mgmt_tx_completion { |
| 402 | u8 rsvd0; |
| 403 | u8 rsvd1; |
| 404 | u8 rsvd2; |
| 405 | __le32 desc_id; |
| 406 | __le32 status; |
| 407 | } __packed; |
| 408 | |
| 409 | #define HTT_RX_INDICATION_INFO0_EXT_TID_MASK (0x3F) |
| 410 | #define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0) |
| 411 | #define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 6) |
| 412 | #define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 7) |
| 413 | |
| 414 | #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F |
| 415 | #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0 |
| 416 | #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_MASK 0x00000FC0 |
| 417 | #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_LSB 6 |
| 418 | #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_MASK 0x0003F000 |
| 419 | #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_LSB 12 |
| 420 | #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_MASK 0x00FC0000 |
| 421 | #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_LSB 18 |
| 422 | #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000 |
| 423 | #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24 |
| 424 | |
| 425 | struct htt_rx_indication_hdr { |
| 426 | u8 info0; /* %HTT_RX_INDICATION_INFO0_ */ |
| 427 | __le16 peer_id; |
| 428 | __le32 info1; /* %HTT_RX_INDICATION_INFO1_ */ |
| 429 | } __packed; |
| 430 | |
| 431 | #define HTT_RX_INDICATION_INFO0_PHY_ERR_VALID (1 << 0) |
| 432 | #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_MASK (0x1E) |
| 433 | #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_LSB (1) |
| 434 | #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK (1 << 5) |
| 435 | #define HTT_RX_INDICATION_INFO0_END_VALID (1 << 6) |
| 436 | #define HTT_RX_INDICATION_INFO0_START_VALID (1 << 7) |
| 437 | |
| 438 | #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_MASK 0x00FFFFFF |
| 439 | #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_LSB 0 |
| 440 | #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_MASK 0xFF000000 |
| 441 | #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_LSB 24 |
| 442 | |
| 443 | #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_MASK 0x00FFFFFF |
| 444 | #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_LSB 0 |
| 445 | #define HTT_RX_INDICATION_INFO2_SERVICE_MASK 0xFF000000 |
| 446 | #define HTT_RX_INDICATION_INFO2_SERVICE_LSB 24 |
| 447 | |
| 448 | enum htt_rx_legacy_rate { |
| 449 | HTT_RX_OFDM_48 = 0, |
| 450 | HTT_RX_OFDM_24 = 1, |
| 451 | HTT_RX_OFDM_12, |
| 452 | HTT_RX_OFDM_6, |
| 453 | HTT_RX_OFDM_54, |
| 454 | HTT_RX_OFDM_36, |
| 455 | HTT_RX_OFDM_18, |
| 456 | HTT_RX_OFDM_9, |
| 457 | |
| 458 | /* long preamble */ |
| 459 | HTT_RX_CCK_11_LP = 0, |
| 460 | HTT_RX_CCK_5_5_LP = 1, |
| 461 | HTT_RX_CCK_2_LP, |
| 462 | HTT_RX_CCK_1_LP, |
| 463 | /* short preamble */ |
| 464 | HTT_RX_CCK_11_SP, |
| 465 | HTT_RX_CCK_5_5_SP, |
| 466 | HTT_RX_CCK_2_SP |
| 467 | }; |
| 468 | |
| 469 | enum htt_rx_legacy_rate_type { |
| 470 | HTT_RX_LEGACY_RATE_OFDM = 0, |
| 471 | HTT_RX_LEGACY_RATE_CCK |
| 472 | }; |
| 473 | |
| 474 | enum htt_rx_preamble_type { |
| 475 | HTT_RX_LEGACY = 0x4, |
| 476 | HTT_RX_HT = 0x8, |
| 477 | HTT_RX_HT_WITH_TXBF = 0x9, |
| 478 | HTT_RX_VHT = 0xC, |
| 479 | HTT_RX_VHT_WITH_TXBF = 0xD, |
| 480 | }; |
| 481 | |
| 482 | /* |
| 483 | * Fields: phy_err_valid, phy_err_code, tsf, |
| 484 | * usec_timestamp, sub_usec_timestamp |
| 485 | * ..are valid only if end_valid == 1. |
| 486 | * |
| 487 | * Fields: rssi_chains, legacy_rate_type, |
| 488 | * legacy_rate_cck, preamble_type, service, |
| 489 | * vht_sig_* |
| 490 | * ..are valid only if start_valid == 1; |
| 491 | */ |
| 492 | struct htt_rx_indication_ppdu { |
| 493 | u8 combined_rssi; |
| 494 | u8 sub_usec_timestamp; |
| 495 | u8 phy_err_code; |
| 496 | u8 info0; /* HTT_RX_INDICATION_INFO0_ */ |
| 497 | struct { |
| 498 | u8 pri20_db; |
| 499 | u8 ext20_db; |
| 500 | u8 ext40_db; |
| 501 | u8 ext80_db; |
| 502 | } __packed rssi_chains[4]; |
| 503 | __le32 tsf; |
| 504 | __le32 usec_timestamp; |
| 505 | __le32 info1; /* HTT_RX_INDICATION_INFO1_ */ |
| 506 | __le32 info2; /* HTT_RX_INDICATION_INFO2_ */ |
| 507 | } __packed; |
| 508 | |
| 509 | enum htt_rx_mpdu_status { |
| 510 | HTT_RX_IND_MPDU_STATUS_UNKNOWN = 0x0, |
| 511 | HTT_RX_IND_MPDU_STATUS_OK, |
| 512 | HTT_RX_IND_MPDU_STATUS_ERR_FCS, |
| 513 | HTT_RX_IND_MPDU_STATUS_ERR_DUP, |
| 514 | HTT_RX_IND_MPDU_STATUS_ERR_REPLAY, |
| 515 | HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER, |
| 516 | /* only accept EAPOL frames */ |
| 517 | HTT_RX_IND_MPDU_STATUS_UNAUTH_PEER, |
| 518 | HTT_RX_IND_MPDU_STATUS_OUT_OF_SYNC, |
| 519 | /* Non-data in promiscous mode */ |
| 520 | HTT_RX_IND_MPDU_STATUS_MGMT_CTRL, |
| 521 | HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR, |
| 522 | HTT_RX_IND_MPDU_STATUS_DECRYPT_ERR, |
| 523 | HTT_RX_IND_MPDU_STATUS_MPDU_LENGTH_ERR, |
| 524 | HTT_RX_IND_MPDU_STATUS_ENCRYPT_REQUIRED_ERR, |
| 525 | HTT_RX_IND_MPDU_STATUS_PRIVACY_ERR, |
| 526 | |
| 527 | /* |
| 528 | * MISC: discard for unspecified reasons. |
| 529 | * Leave this enum value last. |
| 530 | */ |
| 531 | HTT_RX_IND_MPDU_STATUS_ERR_MISC = 0xFF |
| 532 | }; |
| 533 | |
| 534 | struct htt_rx_indication_mpdu_range { |
| 535 | u8 mpdu_count; |
| 536 | u8 mpdu_range_status; /* %htt_rx_mpdu_status */ |
| 537 | u8 pad0; |
| 538 | u8 pad1; |
| 539 | } __packed; |
| 540 | |
| 541 | struct htt_rx_indication_prefix { |
| 542 | __le16 fw_rx_desc_bytes; |
| 543 | u8 pad0; |
| 544 | u8 pad1; |
| 545 | }; |
| 546 | |
| 547 | struct htt_rx_indication { |
| 548 | struct htt_rx_indication_hdr hdr; |
| 549 | struct htt_rx_indication_ppdu ppdu; |
| 550 | struct htt_rx_indication_prefix prefix; |
| 551 | |
| 552 | /* |
| 553 | * the following fields are both dynamically sized, so |
| 554 | * take care addressing them |
| 555 | */ |
| 556 | |
| 557 | /* the size of this is %fw_rx_desc_bytes */ |
| 558 | struct fw_rx_desc_base fw_desc; |
| 559 | |
| 560 | /* |
| 561 | * %mpdu_ranges starts after &%prefix + roundup(%fw_rx_desc_bytes, 4) |
| 562 | * and has %num_mpdu_ranges elements. |
| 563 | */ |
| 564 | struct htt_rx_indication_mpdu_range mpdu_ranges[0]; |
| 565 | } __packed; |
| 566 | |
| 567 | static inline struct htt_rx_indication_mpdu_range * |
| 568 | htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind) |
| 569 | { |
| 570 | void *ptr = rx_ind; |
| 571 | |
| 572 | ptr += sizeof(rx_ind->hdr) |
| 573 | + sizeof(rx_ind->ppdu) |
| 574 | + sizeof(rx_ind->prefix) |
| 575 | + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4); |
| 576 | return ptr; |
| 577 | } |
| 578 | |
| 579 | enum htt_rx_flush_mpdu_status { |
| 580 | HTT_RX_FLUSH_MPDU_DISCARD = 0, |
| 581 | HTT_RX_FLUSH_MPDU_REORDER = 1, |
| 582 | }; |
| 583 | |
| 584 | /* |
| 585 | * htt_rx_flush - discard or reorder given range of mpdus |
| 586 | * |
| 587 | * Note: host must check if all sequence numbers between |
| 588 | * [seq_num_start, seq_num_end-1] are valid. |
| 589 | */ |
| 590 | struct htt_rx_flush { |
| 591 | __le16 peer_id; |
| 592 | u8 tid; |
| 593 | u8 rsvd0; |
| 594 | u8 mpdu_status; /* %htt_rx_flush_mpdu_status */ |
| 595 | u8 seq_num_start; /* it is 6 LSBs of 802.11 seq no */ |
| 596 | u8 seq_num_end; /* it is 6 LSBs of 802.11 seq no */ |
| 597 | }; |
| 598 | |
| 599 | struct htt_rx_peer_map { |
| 600 | u8 vdev_id; |
| 601 | __le16 peer_id; |
| 602 | u8 addr[6]; |
| 603 | u8 rsvd0; |
| 604 | u8 rsvd1; |
| 605 | } __packed; |
| 606 | |
| 607 | struct htt_rx_peer_unmap { |
| 608 | u8 rsvd0; |
| 609 | __le16 peer_id; |
| 610 | } __packed; |
| 611 | |
| 612 | enum htt_security_types { |
| 613 | HTT_SECURITY_NONE, |
| 614 | HTT_SECURITY_WEP128, |
| 615 | HTT_SECURITY_WEP104, |
| 616 | HTT_SECURITY_WEP40, |
| 617 | HTT_SECURITY_TKIP, |
| 618 | HTT_SECURITY_TKIP_NOMIC, |
| 619 | HTT_SECURITY_AES_CCMP, |
| 620 | HTT_SECURITY_WAPI, |
| 621 | |
| 622 | HTT_NUM_SECURITY_TYPES /* keep this last! */ |
| 623 | }; |
| 624 | |
| 625 | enum htt_security_flags { |
| 626 | #define HTT_SECURITY_TYPE_MASK 0x7F |
| 627 | #define HTT_SECURITY_TYPE_LSB 0 |
| 628 | HTT_SECURITY_IS_UNICAST = 1 << 7 |
| 629 | }; |
| 630 | |
| 631 | struct htt_security_indication { |
| 632 | union { |
| 633 | /* dont use bitfields; undefined behaviour */ |
| 634 | u8 flags; /* %htt_security_flags */ |
| 635 | struct { |
| 636 | u8 security_type:7, /* %htt_security_types */ |
| 637 | is_unicast:1; |
| 638 | } __packed; |
| 639 | } __packed; |
| 640 | __le16 peer_id; |
| 641 | u8 michael_key[8]; |
| 642 | u8 wapi_rsc[16]; |
| 643 | } __packed; |
| 644 | |
| 645 | #define HTT_RX_BA_INFO0_TID_MASK 0x000F |
| 646 | #define HTT_RX_BA_INFO0_TID_LSB 0 |
| 647 | #define HTT_RX_BA_INFO0_PEER_ID_MASK 0xFFF0 |
| 648 | #define HTT_RX_BA_INFO0_PEER_ID_LSB 4 |
| 649 | |
| 650 | struct htt_rx_addba { |
| 651 | u8 window_size; |
| 652 | __le16 info0; /* %HTT_RX_BA_INFO0_ */ |
| 653 | } __packed; |
| 654 | |
| 655 | struct htt_rx_delba { |
| 656 | u8 rsvd0; |
| 657 | __le16 info0; /* %HTT_RX_BA_INFO0_ */ |
| 658 | } __packed; |
| 659 | |
| 660 | enum htt_data_tx_status { |
| 661 | HTT_DATA_TX_STATUS_OK = 0, |
| 662 | HTT_DATA_TX_STATUS_DISCARD = 1, |
| 663 | HTT_DATA_TX_STATUS_NO_ACK = 2, |
| 664 | HTT_DATA_TX_STATUS_POSTPONE = 3, /* HL only */ |
| 665 | HTT_DATA_TX_STATUS_DOWNLOAD_FAIL = 128 |
| 666 | }; |
| 667 | |
| 668 | enum htt_data_tx_flags { |
| 669 | #define HTT_DATA_TX_STATUS_MASK 0x07 |
| 670 | #define HTT_DATA_TX_STATUS_LSB 0 |
| 671 | #define HTT_DATA_TX_TID_MASK 0x78 |
| 672 | #define HTT_DATA_TX_TID_LSB 3 |
| 673 | HTT_DATA_TX_TID_INVALID = 1 << 7 |
| 674 | }; |
| 675 | |
| 676 | #define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF |
| 677 | |
| 678 | struct htt_data_tx_completion { |
| 679 | union { |
| 680 | u8 flags; |
| 681 | struct { |
| 682 | u8 status:3, |
| 683 | tid:4, |
| 684 | tid_invalid:1; |
| 685 | } __packed; |
| 686 | } __packed; |
| 687 | u8 num_msdus; |
| 688 | u8 rsvd0; |
| 689 | __le16 msdus[0]; /* variable length based on %num_msdus */ |
| 690 | } __packed; |
| 691 | |
| 692 | struct htt_tx_compl_ind_base { |
| 693 | u32 hdr; |
| 694 | u16 payload[1/*or more*/]; |
| 695 | } __packed; |
| 696 | |
| 697 | struct htt_rc_tx_done_params { |
| 698 | u32 rate_code; |
| 699 | u32 rate_code_flags; |
| 700 | u32 flags; |
| 701 | u32 num_enqued; /* 1 for non-AMPDU */ |
| 702 | u32 num_retries; |
| 703 | u32 num_failed; /* for AMPDU */ |
| 704 | u32 ack_rssi; |
| 705 | u32 time_stamp; |
| 706 | u32 is_probe; |
| 707 | }; |
| 708 | |
| 709 | struct htt_rc_update { |
| 710 | u8 vdev_id; |
| 711 | __le16 peer_id; |
| 712 | u8 addr[6]; |
| 713 | u8 num_elems; |
| 714 | u8 rsvd0; |
| 715 | struct htt_rc_tx_done_params params[0]; /* variable length %num_elems */ |
| 716 | } __packed; |
| 717 | |
| 718 | /* see htt_rx_indication for similar fields and descriptions */ |
| 719 | struct htt_rx_fragment_indication { |
| 720 | union { |
| 721 | u8 info0; /* %HTT_RX_FRAG_IND_INFO0_ */ |
| 722 | struct { |
| 723 | u8 ext_tid:5, |
| 724 | flush_valid:1; |
| 725 | } __packed; |
| 726 | } __packed; |
| 727 | __le16 peer_id; |
| 728 | __le32 info1; /* %HTT_RX_FRAG_IND_INFO1_ */ |
| 729 | __le16 fw_rx_desc_bytes; |
| 730 | __le16 rsvd0; |
| 731 | |
| 732 | u8 fw_msdu_rx_desc[0]; |
| 733 | } __packed; |
| 734 | |
| 735 | #define HTT_RX_FRAG_IND_INFO0_EXT_TID_MASK 0x1F |
| 736 | #define HTT_RX_FRAG_IND_INFO0_EXT_TID_LSB 0 |
| 737 | #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_MASK 0x20 |
| 738 | #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_LSB 5 |
| 739 | |
| 740 | #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_MASK 0x0000003F |
| 741 | #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_LSB 0 |
| 742 | #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_MASK 0x00000FC0 |
| 743 | #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_LSB 6 |
| 744 | |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 745 | struct htt_rx_pn_ind { |
| 746 | __le16 peer_id; |
| 747 | u8 tid; |
| 748 | u8 seqno_start; |
| 749 | u8 seqno_end; |
| 750 | u8 pn_ie_count; |
| 751 | u8 reserved; |
| 752 | u8 pn_ies[0]; |
| 753 | } __packed; |
| 754 | |
| 755 | struct htt_rx_offload_msdu { |
| 756 | __le16 msdu_len; |
| 757 | __le16 peer_id; |
| 758 | u8 vdev_id; |
| 759 | u8 tid; |
| 760 | u8 fw_desc; |
| 761 | u8 payload[0]; |
| 762 | } __packed; |
| 763 | |
| 764 | struct htt_rx_offload_ind { |
| 765 | u8 reserved; |
| 766 | __le16 msdu_count; |
| 767 | } __packed; |
| 768 | |
| 769 | struct htt_rx_in_ord_msdu_desc { |
| 770 | __le32 msdu_paddr; |
| 771 | __le16 msdu_len; |
| 772 | u8 fw_desc; |
| 773 | u8 reserved; |
| 774 | } __packed; |
| 775 | |
| 776 | struct htt_rx_in_ord_ind { |
| 777 | u8 info; |
| 778 | __le16 peer_id; |
| 779 | u8 vdev_id; |
| 780 | u8 reserved; |
| 781 | __le16 msdu_count; |
| 782 | struct htt_rx_in_ord_msdu_desc msdu_descs[0]; |
| 783 | } __packed; |
| 784 | |
| 785 | #define HTT_RX_IN_ORD_IND_INFO_TID_MASK 0x0000001f |
| 786 | #define HTT_RX_IN_ORD_IND_INFO_TID_LSB 0 |
| 787 | #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_MASK 0x00000020 |
| 788 | #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_LSB 5 |
| 789 | #define HTT_RX_IN_ORD_IND_INFO_FRAG_MASK 0x00000040 |
| 790 | #define HTT_RX_IN_ORD_IND_INFO_FRAG_LSB 6 |
| 791 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 792 | /* |
| 793 | * target -> host test message definition |
| 794 | * |
| 795 | * The following field definitions describe the format of the test |
| 796 | * message sent from the target to the host. |
| 797 | * The message consists of a 4-octet header, followed by a variable |
| 798 | * number of 32-bit integer values, followed by a variable number |
| 799 | * of 8-bit character values. |
| 800 | * |
| 801 | * |31 16|15 8|7 0| |
| 802 | * |-----------------------------------------------------------| |
| 803 | * | num chars | num ints | msg type | |
| 804 | * |-----------------------------------------------------------| |
| 805 | * | int 0 | |
| 806 | * |-----------------------------------------------------------| |
| 807 | * | int 1 | |
| 808 | * |-----------------------------------------------------------| |
| 809 | * | ... | |
| 810 | * |-----------------------------------------------------------| |
| 811 | * | char 3 | char 2 | char 1 | char 0 | |
| 812 | * |-----------------------------------------------------------| |
| 813 | * | | | ... | char 4 | |
| 814 | * |-----------------------------------------------------------| |
| 815 | * - MSG_TYPE |
| 816 | * Bits 7:0 |
| 817 | * Purpose: identifies this as a test message |
| 818 | * Value: HTT_MSG_TYPE_TEST |
| 819 | * - NUM_INTS |
| 820 | * Bits 15:8 |
| 821 | * Purpose: indicate how many 32-bit integers follow the message header |
| 822 | * - NUM_CHARS |
| 823 | * Bits 31:16 |
| 824 | * Purpose: indicate how many 8-bit charaters follow the series of integers |
| 825 | */ |
| 826 | struct htt_rx_test { |
| 827 | u8 num_ints; |
| 828 | __le16 num_chars; |
| 829 | |
| 830 | /* payload consists of 2 lists: |
| 831 | * a) num_ints * sizeof(__le32) |
| 832 | * b) num_chars * sizeof(u8) aligned to 4bytes */ |
| 833 | u8 payload[0]; |
| 834 | } __packed; |
| 835 | |
| 836 | static inline __le32 *htt_rx_test_get_ints(struct htt_rx_test *rx_test) |
| 837 | { |
| 838 | return (__le32 *)rx_test->payload; |
| 839 | } |
| 840 | |
| 841 | static inline u8 *htt_rx_test_get_chars(struct htt_rx_test *rx_test) |
| 842 | { |
| 843 | return rx_test->payload + (rx_test->num_ints * sizeof(__le32)); |
| 844 | } |
| 845 | |
| 846 | /* |
| 847 | * target -> host packet log message |
| 848 | * |
| 849 | * The following field definitions describe the format of the packet log |
| 850 | * message sent from the target to the host. |
| 851 | * The message consists of a 4-octet header,followed by a variable number |
| 852 | * of 32-bit character values. |
| 853 | * |
| 854 | * |31 24|23 16|15 8|7 0| |
| 855 | * |-----------------------------------------------------------| |
| 856 | * | | | | msg type | |
| 857 | * |-----------------------------------------------------------| |
| 858 | * | payload | |
| 859 | * |-----------------------------------------------------------| |
| 860 | * - MSG_TYPE |
| 861 | * Bits 7:0 |
| 862 | * Purpose: identifies this as a test message |
| 863 | * Value: HTT_MSG_TYPE_PACKETLOG |
| 864 | */ |
| 865 | struct htt_pktlog_msg { |
| 866 | u8 pad[3]; |
Rajkumar Manoharan | bfdd793 | 2014-10-03 08:02:40 +0300 | [diff] [blame] | 867 | u8 payload[0]; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 868 | } __packed; |
| 869 | |
| 870 | struct htt_dbg_stats_rx_reorder_stats { |
| 871 | /* Non QoS MPDUs received */ |
| 872 | __le32 deliver_non_qos; |
| 873 | |
| 874 | /* MPDUs received in-order */ |
| 875 | __le32 deliver_in_order; |
| 876 | |
| 877 | /* Flush due to reorder timer expired */ |
| 878 | __le32 deliver_flush_timeout; |
| 879 | |
| 880 | /* Flush due to move out of window */ |
| 881 | __le32 deliver_flush_oow; |
| 882 | |
| 883 | /* Flush due to DELBA */ |
| 884 | __le32 deliver_flush_delba; |
| 885 | |
| 886 | /* MPDUs dropped due to FCS error */ |
| 887 | __le32 fcs_error; |
| 888 | |
| 889 | /* MPDUs dropped due to monitor mode non-data packet */ |
| 890 | __le32 mgmt_ctrl; |
| 891 | |
| 892 | /* MPDUs dropped due to invalid peer */ |
| 893 | __le32 invalid_peer; |
| 894 | |
| 895 | /* MPDUs dropped due to duplication (non aggregation) */ |
| 896 | __le32 dup_non_aggr; |
| 897 | |
| 898 | /* MPDUs dropped due to processed before */ |
| 899 | __le32 dup_past; |
| 900 | |
| 901 | /* MPDUs dropped due to duplicate in reorder queue */ |
| 902 | __le32 dup_in_reorder; |
| 903 | |
| 904 | /* Reorder timeout happened */ |
| 905 | __le32 reorder_timeout; |
| 906 | |
| 907 | /* invalid bar ssn */ |
| 908 | __le32 invalid_bar_ssn; |
| 909 | |
| 910 | /* reorder reset due to bar ssn */ |
| 911 | __le32 ssn_reset; |
| 912 | }; |
| 913 | |
| 914 | struct htt_dbg_stats_wal_tx_stats { |
| 915 | /* Num HTT cookies queued to dispatch list */ |
| 916 | __le32 comp_queued; |
| 917 | |
| 918 | /* Num HTT cookies dispatched */ |
| 919 | __le32 comp_delivered; |
| 920 | |
| 921 | /* Num MSDU queued to WAL */ |
| 922 | __le32 msdu_enqued; |
| 923 | |
| 924 | /* Num MPDU queue to WAL */ |
| 925 | __le32 mpdu_enqued; |
| 926 | |
| 927 | /* Num MSDUs dropped by WMM limit */ |
| 928 | __le32 wmm_drop; |
| 929 | |
| 930 | /* Num Local frames queued */ |
| 931 | __le32 local_enqued; |
| 932 | |
| 933 | /* Num Local frames done */ |
| 934 | __le32 local_freed; |
| 935 | |
| 936 | /* Num queued to HW */ |
| 937 | __le32 hw_queued; |
| 938 | |
| 939 | /* Num PPDU reaped from HW */ |
| 940 | __le32 hw_reaped; |
| 941 | |
| 942 | /* Num underruns */ |
| 943 | __le32 underrun; |
| 944 | |
| 945 | /* Num PPDUs cleaned up in TX abort */ |
| 946 | __le32 tx_abort; |
| 947 | |
| 948 | /* Num MPDUs requed by SW */ |
| 949 | __le32 mpdus_requed; |
| 950 | |
| 951 | /* excessive retries */ |
| 952 | __le32 tx_ko; |
| 953 | |
| 954 | /* data hw rate code */ |
| 955 | __le32 data_rc; |
| 956 | |
| 957 | /* Scheduler self triggers */ |
| 958 | __le32 self_triggers; |
| 959 | |
| 960 | /* frames dropped due to excessive sw retries */ |
| 961 | __le32 sw_retry_failure; |
| 962 | |
| 963 | /* illegal rate phy errors */ |
| 964 | __le32 illgl_rate_phy_err; |
| 965 | |
| 966 | /* wal pdev continous xretry */ |
| 967 | __le32 pdev_cont_xretry; |
| 968 | |
| 969 | /* wal pdev continous xretry */ |
| 970 | __le32 pdev_tx_timeout; |
| 971 | |
| 972 | /* wal pdev resets */ |
| 973 | __le32 pdev_resets; |
| 974 | |
| 975 | __le32 phy_underrun; |
| 976 | |
| 977 | /* MPDU is more than txop limit */ |
| 978 | __le32 txop_ovf; |
| 979 | } __packed; |
| 980 | |
| 981 | struct htt_dbg_stats_wal_rx_stats { |
| 982 | /* Cnts any change in ring routing mid-ppdu */ |
| 983 | __le32 mid_ppdu_route_change; |
| 984 | |
| 985 | /* Total number of statuses processed */ |
| 986 | __le32 status_rcvd; |
| 987 | |
| 988 | /* Extra frags on rings 0-3 */ |
| 989 | __le32 r0_frags; |
| 990 | __le32 r1_frags; |
| 991 | __le32 r2_frags; |
| 992 | __le32 r3_frags; |
| 993 | |
| 994 | /* MSDUs / MPDUs delivered to HTT */ |
| 995 | __le32 htt_msdus; |
| 996 | __le32 htt_mpdus; |
| 997 | |
| 998 | /* MSDUs / MPDUs delivered to local stack */ |
| 999 | __le32 loc_msdus; |
| 1000 | __le32 loc_mpdus; |
| 1001 | |
| 1002 | /* AMSDUs that have more MSDUs than the status ring size */ |
| 1003 | __le32 oversize_amsdu; |
| 1004 | |
| 1005 | /* Number of PHY errors */ |
| 1006 | __le32 phy_errs; |
| 1007 | |
| 1008 | /* Number of PHY errors drops */ |
| 1009 | __le32 phy_err_drop; |
| 1010 | |
| 1011 | /* Number of mpdu errors - FCS, MIC, ENC etc. */ |
| 1012 | __le32 mpdu_errs; |
| 1013 | } __packed; |
| 1014 | |
| 1015 | struct htt_dbg_stats_wal_peer_stats { |
| 1016 | __le32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */ |
| 1017 | } __packed; |
| 1018 | |
| 1019 | struct htt_dbg_stats_wal_pdev_txrx { |
| 1020 | struct htt_dbg_stats_wal_tx_stats tx_stats; |
| 1021 | struct htt_dbg_stats_wal_rx_stats rx_stats; |
| 1022 | struct htt_dbg_stats_wal_peer_stats peer_stats; |
| 1023 | } __packed; |
| 1024 | |
| 1025 | struct htt_dbg_stats_rx_rate_info { |
| 1026 | __le32 mcs[10]; |
| 1027 | __le32 sgi[10]; |
| 1028 | __le32 nss[4]; |
| 1029 | __le32 stbc[10]; |
| 1030 | __le32 bw[3]; |
| 1031 | __le32 pream[6]; |
| 1032 | __le32 ldpc; |
| 1033 | __le32 txbf; |
| 1034 | }; |
| 1035 | |
| 1036 | /* |
| 1037 | * htt_dbg_stats_status - |
| 1038 | * present - The requested stats have been delivered in full. |
| 1039 | * This indicates that either the stats information was contained |
| 1040 | * in its entirety within this message, or else this message |
| 1041 | * completes the delivery of the requested stats info that was |
| 1042 | * partially delivered through earlier STATS_CONF messages. |
| 1043 | * partial - The requested stats have been delivered in part. |
| 1044 | * One or more subsequent STATS_CONF messages with the same |
| 1045 | * cookie value will be sent to deliver the remainder of the |
| 1046 | * information. |
| 1047 | * error - The requested stats could not be delivered, for example due |
| 1048 | * to a shortage of memory to construct a message holding the |
| 1049 | * requested stats. |
| 1050 | * invalid - The requested stat type is either not recognized, or the |
| 1051 | * target is configured to not gather the stats type in question. |
| 1052 | * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - |
| 1053 | * series_done - This special value indicates that no further stats info |
| 1054 | * elements are present within a series of stats info elems |
| 1055 | * (within a stats upload confirmation message). |
| 1056 | */ |
| 1057 | enum htt_dbg_stats_status { |
| 1058 | HTT_DBG_STATS_STATUS_PRESENT = 0, |
| 1059 | HTT_DBG_STATS_STATUS_PARTIAL = 1, |
| 1060 | HTT_DBG_STATS_STATUS_ERROR = 2, |
| 1061 | HTT_DBG_STATS_STATUS_INVALID = 3, |
| 1062 | HTT_DBG_STATS_STATUS_SERIES_DONE = 7 |
| 1063 | }; |
| 1064 | |
| 1065 | /* |
| 1066 | * target -> host statistics upload |
| 1067 | * |
| 1068 | * The following field definitions describe the format of the HTT target |
| 1069 | * to host stats upload confirmation message. |
| 1070 | * The message contains a cookie echoed from the HTT host->target stats |
| 1071 | * upload request, which identifies which request the confirmation is |
| 1072 | * for, and a series of tag-length-value stats information elements. |
| 1073 | * The tag-length header for each stats info element also includes a |
| 1074 | * status field, to indicate whether the request for the stat type in |
| 1075 | * question was fully met, partially met, unable to be met, or invalid |
| 1076 | * (if the stat type in question is disabled in the target). |
| 1077 | * A special value of all 1's in this status field is used to indicate |
| 1078 | * the end of the series of stats info elements. |
| 1079 | * |
| 1080 | * |
| 1081 | * |31 16|15 8|7 5|4 0| |
| 1082 | * |------------------------------------------------------------| |
| 1083 | * | reserved | msg type | |
| 1084 | * |------------------------------------------------------------| |
| 1085 | * | cookie LSBs | |
| 1086 | * |------------------------------------------------------------| |
| 1087 | * | cookie MSBs | |
| 1088 | * |------------------------------------------------------------| |
| 1089 | * | stats entry length | reserved | S |stat type| |
| 1090 | * |------------------------------------------------------------| |
| 1091 | * | | |
| 1092 | * | type-specific stats info | |
| 1093 | * | | |
| 1094 | * |------------------------------------------------------------| |
| 1095 | * | stats entry length | reserved | S |stat type| |
| 1096 | * |------------------------------------------------------------| |
| 1097 | * | | |
| 1098 | * | type-specific stats info | |
| 1099 | * | | |
| 1100 | * |------------------------------------------------------------| |
| 1101 | * | n/a | reserved | 111 | n/a | |
| 1102 | * |------------------------------------------------------------| |
| 1103 | * Header fields: |
| 1104 | * - MSG_TYPE |
| 1105 | * Bits 7:0 |
| 1106 | * Purpose: identifies this is a statistics upload confirmation message |
| 1107 | * Value: 0x9 |
| 1108 | * - COOKIE_LSBS |
| 1109 | * Bits 31:0 |
| 1110 | * Purpose: Provide a mechanism to match a target->host stats confirmation |
| 1111 | * message with its preceding host->target stats request message. |
| 1112 | * Value: LSBs of the opaque cookie specified by the host-side requestor |
| 1113 | * - COOKIE_MSBS |
| 1114 | * Bits 31:0 |
| 1115 | * Purpose: Provide a mechanism to match a target->host stats confirmation |
| 1116 | * message with its preceding host->target stats request message. |
| 1117 | * Value: MSBs of the opaque cookie specified by the host-side requestor |
| 1118 | * |
| 1119 | * Stats Information Element tag-length header fields: |
| 1120 | * - STAT_TYPE |
| 1121 | * Bits 4:0 |
| 1122 | * Purpose: identifies the type of statistics info held in the |
| 1123 | * following information element |
| 1124 | * Value: htt_dbg_stats_type |
| 1125 | * - STATUS |
| 1126 | * Bits 7:5 |
| 1127 | * Purpose: indicate whether the requested stats are present |
| 1128 | * Value: htt_dbg_stats_status, including a special value (0x7) to mark |
| 1129 | * the completion of the stats entry series |
| 1130 | * - LENGTH |
| 1131 | * Bits 31:16 |
| 1132 | * Purpose: indicate the stats information size |
| 1133 | * Value: This field specifies the number of bytes of stats information |
| 1134 | * that follows the element tag-length header. |
| 1135 | * It is expected but not required that this length is a multiple of |
| 1136 | * 4 bytes. Even if the length is not an integer multiple of 4, the |
| 1137 | * subsequent stats entry header will begin on a 4-byte aligned |
| 1138 | * boundary. |
| 1139 | */ |
| 1140 | |
| 1141 | #define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_MASK 0x1F |
| 1142 | #define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_LSB 0 |
| 1143 | #define HTT_STATS_CONF_ITEM_INFO_STATUS_MASK 0xE0 |
| 1144 | #define HTT_STATS_CONF_ITEM_INFO_STATUS_LSB 5 |
| 1145 | |
| 1146 | struct htt_stats_conf_item { |
| 1147 | union { |
| 1148 | u8 info; |
| 1149 | struct { |
| 1150 | u8 stat_type:5; /* %HTT_DBG_STATS_ */ |
| 1151 | u8 status:3; /* %HTT_DBG_STATS_STATUS_ */ |
| 1152 | } __packed; |
| 1153 | } __packed; |
| 1154 | u8 pad; |
| 1155 | __le16 length; |
| 1156 | u8 payload[0]; /* roundup(length, 4) long */ |
| 1157 | } __packed; |
| 1158 | |
| 1159 | struct htt_stats_conf { |
| 1160 | u8 pad[3]; |
| 1161 | __le32 cookie_lsb; |
| 1162 | __le32 cookie_msb; |
| 1163 | |
| 1164 | /* each item has variable length! */ |
| 1165 | struct htt_stats_conf_item items[0]; |
| 1166 | } __packed; |
| 1167 | |
| 1168 | static inline struct htt_stats_conf_item *htt_stats_conf_next_item( |
| 1169 | const struct htt_stats_conf_item *item) |
| 1170 | { |
| 1171 | return (void *)item + sizeof(*item) + roundup(item->length, 4); |
| 1172 | } |
Kalle Valo | 8cc7f26 | 2014-09-14 12:50:39 +0300 | [diff] [blame] | 1173 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1174 | /* |
| 1175 | * host -> target FRAG DESCRIPTOR/MSDU_EXT DESC bank |
| 1176 | * |
| 1177 | * The following field definitions describe the format of the HTT host |
| 1178 | * to target frag_desc/msdu_ext bank configuration message. |
| 1179 | * The message contains the based address and the min and max id of the |
| 1180 | * MSDU_EXT/FRAG_DESC that will be used by the HTT to map MSDU DESC and |
| 1181 | * MSDU_EXT/FRAG_DESC. |
| 1182 | * HTT will use id in HTT descriptor instead sending the frag_desc_ptr. |
| 1183 | * For QCA988X HW the firmware will use fragment_desc_ptr but in WIFI2.0 |
| 1184 | * the hardware does the mapping/translation. |
| 1185 | * |
| 1186 | * Total banks that can be configured is configured to 16. |
| 1187 | * |
| 1188 | * This should be called before any TX has be initiated by the HTT |
| 1189 | * |
| 1190 | * |31 16|15 8|7 5|4 0| |
| 1191 | * |------------------------------------------------------------| |
| 1192 | * | DESC_SIZE | NUM_BANKS | RES |SWP|pdev| msg type | |
| 1193 | * |------------------------------------------------------------| |
| 1194 | * | BANK0_BASE_ADDRESS | |
| 1195 | * |------------------------------------------------------------| |
| 1196 | * | ... | |
| 1197 | * |------------------------------------------------------------| |
| 1198 | * | BANK15_BASE_ADDRESS | |
| 1199 | * |------------------------------------------------------------| |
| 1200 | * | BANK0_MAX_ID | BANK0_MIN_ID | |
| 1201 | * |------------------------------------------------------------| |
| 1202 | * | ... | |
| 1203 | * |------------------------------------------------------------| |
| 1204 | * | BANK15_MAX_ID | BANK15_MIN_ID | |
| 1205 | * |------------------------------------------------------------| |
| 1206 | * Header fields: |
| 1207 | * - MSG_TYPE |
| 1208 | * Bits 7:0 |
| 1209 | * Value: 0x6 |
| 1210 | * - BANKx_BASE_ADDRESS |
| 1211 | * Bits 31:0 |
| 1212 | * Purpose: Provide a mechanism to specify the base address of the MSDU_EXT |
| 1213 | * bank physical/bus address. |
| 1214 | * - BANKx_MIN_ID |
| 1215 | * Bits 15:0 |
| 1216 | * Purpose: Provide a mechanism to specify the min index that needs to |
| 1217 | * mapped. |
| 1218 | * - BANKx_MAX_ID |
| 1219 | * Bits 31:16 |
| 1220 | * Purpose: Provide a mechanism to specify the max index that needs to |
| 1221 | * |
| 1222 | */ |
| 1223 | struct htt_frag_desc_bank_id { |
| 1224 | __le16 bank_min_id; |
| 1225 | __le16 bank_max_id; |
| 1226 | } __packed; |
| 1227 | |
| 1228 | /* real is 16 but it wouldn't fit in the max htt message size |
| 1229 | * so we use a conservatively safe value for now */ |
| 1230 | #define HTT_FRAG_DESC_BANK_MAX 4 |
| 1231 | |
| 1232 | #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_MASK 0x03 |
| 1233 | #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_LSB 0 |
| 1234 | #define HTT_FRAG_DESC_BANK_CFG_INFO_SWAP (1 << 2) |
| 1235 | |
| 1236 | struct htt_frag_desc_bank_cfg { |
| 1237 | u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */ |
| 1238 | u8 num_banks; |
| 1239 | u8 desc_size; |
| 1240 | __le32 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX]; |
| 1241 | struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX]; |
| 1242 | } __packed; |
| 1243 | |
| 1244 | union htt_rx_pn_t { |
| 1245 | /* WEP: 24-bit PN */ |
| 1246 | u32 pn24; |
| 1247 | |
| 1248 | /* TKIP or CCMP: 48-bit PN */ |
| 1249 | u_int64_t pn48; |
| 1250 | |
| 1251 | /* WAPI: 128-bit PN */ |
| 1252 | u_int64_t pn128[2]; |
| 1253 | }; |
| 1254 | |
| 1255 | struct htt_cmd { |
| 1256 | struct htt_cmd_hdr hdr; |
| 1257 | union { |
| 1258 | struct htt_ver_req ver_req; |
| 1259 | struct htt_mgmt_tx_desc mgmt_tx; |
| 1260 | struct htt_data_tx_desc data_tx; |
| 1261 | struct htt_rx_ring_setup rx_setup; |
| 1262 | struct htt_stats_req stats_req; |
| 1263 | struct htt_oob_sync_req oob_sync_req; |
| 1264 | struct htt_aggr_conf aggr_conf; |
| 1265 | struct htt_frag_desc_bank_cfg frag_desc_bank_cfg; |
| 1266 | }; |
| 1267 | } __packed; |
| 1268 | |
| 1269 | struct htt_resp { |
| 1270 | struct htt_resp_hdr hdr; |
| 1271 | union { |
| 1272 | struct htt_ver_resp ver_resp; |
| 1273 | struct htt_mgmt_tx_completion mgmt_tx_completion; |
| 1274 | struct htt_data_tx_completion data_tx_completion; |
| 1275 | struct htt_rx_indication rx_ind; |
| 1276 | struct htt_rx_fragment_indication rx_frag_ind; |
| 1277 | struct htt_rx_peer_map peer_map; |
| 1278 | struct htt_rx_peer_unmap peer_unmap; |
| 1279 | struct htt_rx_flush rx_flush; |
| 1280 | struct htt_rx_addba rx_addba; |
| 1281 | struct htt_rx_delba rx_delba; |
| 1282 | struct htt_security_indication security_indication; |
| 1283 | struct htt_rc_update rc_update; |
| 1284 | struct htt_rx_test rx_test; |
| 1285 | struct htt_pktlog_msg pktlog_msg; |
| 1286 | struct htt_stats_conf stats_conf; |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 1287 | struct htt_rx_pn_ind rx_pn_ind; |
| 1288 | struct htt_rx_offload_ind rx_offload_ind; |
| 1289 | struct htt_rx_in_ord_ind rx_in_ord_ind; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1290 | }; |
| 1291 | } __packed; |
| 1292 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1293 | /*** host side structures follow ***/ |
| 1294 | |
| 1295 | struct htt_tx_done { |
| 1296 | u32 msdu_id; |
| 1297 | bool discard; |
| 1298 | bool no_ack; |
| 1299 | }; |
| 1300 | |
| 1301 | struct htt_peer_map_event { |
| 1302 | u8 vdev_id; |
| 1303 | u16 peer_id; |
| 1304 | u8 addr[ETH_ALEN]; |
| 1305 | }; |
| 1306 | |
| 1307 | struct htt_peer_unmap_event { |
| 1308 | u16 peer_id; |
| 1309 | }; |
| 1310 | |
Michal Kazior | a16942e | 2014-02-27 18:50:04 +0200 | [diff] [blame] | 1311 | struct ath10k_htt_txbuf { |
| 1312 | struct htt_data_tx_desc_frag frags[2]; |
| 1313 | struct ath10k_htc_hdr htc_hdr; |
| 1314 | struct htt_cmd_hdr cmd_hdr; |
| 1315 | struct htt_data_tx_desc cmd_tx; |
| 1316 | } __packed; |
| 1317 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1318 | struct ath10k_htt { |
| 1319 | struct ath10k *ar; |
| 1320 | enum ath10k_htc_ep_id eid; |
| 1321 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1322 | u8 target_version_major; |
| 1323 | u8 target_version_minor; |
| 1324 | struct completion target_version_received; |
Rajkumar Manoharan | 8348db2 | 2015-03-25 13:12:27 +0200 | [diff] [blame^] | 1325 | enum ath10k_fw_htt_op_version op_version; |
| 1326 | |
| 1327 | const enum htt_t2h_msg_type *t2h_msg_types; |
| 1328 | u32 t2h_msg_types_max; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1329 | |
| 1330 | struct { |
| 1331 | /* |
| 1332 | * Ring of network buffer objects - This ring is |
| 1333 | * used exclusively by the host SW. This ring |
| 1334 | * mirrors the dev_addrs_ring that is shared |
| 1335 | * between the host SW and the MAC HW. The host SW |
| 1336 | * uses this netbufs ring to locate the network |
| 1337 | * buffer objects whose data buffers the HW has |
| 1338 | * filled. |
| 1339 | */ |
| 1340 | struct sk_buff **netbufs_ring; |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 1341 | |
| 1342 | /* This is used only with firmware supporting IN_ORD_IND. |
| 1343 | * |
| 1344 | * With Full Rx Reorder the HTT Rx Ring is more of a temporary |
| 1345 | * buffer ring from which buffer addresses are copied by the |
| 1346 | * firmware to MAC Rx ring. Firmware then delivers IN_ORD_IND |
| 1347 | * pointing to specific (re-ordered) buffers. |
| 1348 | * |
| 1349 | * FIXME: With kernel generic hashing functions there's a lot |
| 1350 | * of hash collisions for sk_buffs. |
| 1351 | */ |
| 1352 | bool in_ord_rx; |
| 1353 | DECLARE_HASHTABLE(skb_table, 4); |
| 1354 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1355 | /* |
| 1356 | * Ring of buffer addresses - |
| 1357 | * This ring holds the "physical" device address of the |
| 1358 | * rx buffers the host SW provides for the MAC HW to |
| 1359 | * fill. |
| 1360 | */ |
| 1361 | __le32 *paddrs_ring; |
| 1362 | |
| 1363 | /* |
| 1364 | * Base address of ring, as a "physical" device address |
| 1365 | * rather than a CPU address. |
| 1366 | */ |
| 1367 | dma_addr_t base_paddr; |
| 1368 | |
| 1369 | /* how many elems in the ring (power of 2) */ |
| 1370 | int size; |
| 1371 | |
| 1372 | /* size - 1 */ |
| 1373 | unsigned size_mask; |
| 1374 | |
| 1375 | /* how many rx buffers to keep in the ring */ |
| 1376 | int fill_level; |
| 1377 | |
| 1378 | /* how many rx buffers (full+empty) are in the ring */ |
| 1379 | int fill_cnt; |
| 1380 | |
| 1381 | /* |
| 1382 | * alloc_idx - where HTT SW has deposited empty buffers |
| 1383 | * This is allocated in consistent mem, so that the FW can |
| 1384 | * read this variable, and program the HW's FW_IDX reg with |
| 1385 | * the value of this shadow register. |
| 1386 | */ |
| 1387 | struct { |
| 1388 | __le32 *vaddr; |
| 1389 | dma_addr_t paddr; |
| 1390 | } alloc_idx; |
| 1391 | |
| 1392 | /* where HTT SW has processed bufs filled by rx MAC DMA */ |
| 1393 | struct { |
| 1394 | unsigned msdu_payld; |
| 1395 | } sw_rd_idx; |
| 1396 | |
| 1397 | /* |
| 1398 | * refill_retry_timer - timer triggered when the ring is |
| 1399 | * not refilled to the level expected |
| 1400 | */ |
| 1401 | struct timer_list refill_retry_timer; |
| 1402 | |
| 1403 | /* Protects access to all rx ring buffer state variables */ |
| 1404 | spinlock_t lock; |
| 1405 | } rx_ring; |
| 1406 | |
| 1407 | unsigned int prefetch_len; |
| 1408 | |
Michal Kazior | 89d6d83 | 2015-01-24 12:14:51 +0200 | [diff] [blame] | 1409 | /* Protects access to pending_tx, num_pending_tx */ |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1410 | spinlock_t tx_lock; |
| 1411 | int max_num_pending_tx; |
| 1412 | int num_pending_tx; |
Michal Kazior | 89d6d83 | 2015-01-24 12:14:51 +0200 | [diff] [blame] | 1413 | struct idr pending_tx; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1414 | wait_queue_head_t empty_tx_wq; |
Michal Kazior | a16942e | 2014-02-27 18:50:04 +0200 | [diff] [blame] | 1415 | struct dma_pool *tx_pool; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1416 | |
| 1417 | /* set if host-fw communication goes haywire |
| 1418 | * used to avoid further failures */ |
| 1419 | bool rx_confused; |
Michal Kazior | 6e712d4 | 2013-09-24 10:18:36 +0200 | [diff] [blame] | 1420 | struct tasklet_struct rx_replenish_task; |
Michal Kazior | 6c5151a | 2014-02-27 18:50:04 +0200 | [diff] [blame] | 1421 | |
| 1422 | /* This is used to group tx/rx completions separately and process them |
| 1423 | * in batches to reduce cache stalls */ |
| 1424 | struct tasklet_struct txrx_compl_task; |
| 1425 | struct sk_buff_head tx_compl_q; |
| 1426 | struct sk_buff_head rx_compl_q; |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 1427 | struct sk_buff_head rx_in_ord_compl_q; |
Janusz Dziedzic | 6df92a3 | 2014-03-24 21:24:57 +0100 | [diff] [blame] | 1428 | |
| 1429 | /* rx_status template */ |
| 1430 | struct ieee80211_rx_status rx_status; |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1431 | }; |
| 1432 | |
| 1433 | #define RX_HTT_HDR_STATUS_LEN 64 |
| 1434 | |
| 1435 | /* This structure layout is programmed via rx ring setup |
| 1436 | * so that FW knows how to transfer the rx descriptor to the host. |
| 1437 | * Buffers like this are placed on the rx ring. */ |
| 1438 | struct htt_rx_desc { |
| 1439 | union { |
| 1440 | /* This field is filled on the host using the msdu buffer |
| 1441 | * from htt_rx_indication */ |
| 1442 | struct fw_rx_desc_base fw_desc; |
| 1443 | u32 pad; |
| 1444 | } __packed; |
| 1445 | struct { |
| 1446 | struct rx_attention attention; |
| 1447 | struct rx_frag_info frag_info; |
| 1448 | struct rx_mpdu_start mpdu_start; |
| 1449 | struct rx_msdu_start msdu_start; |
| 1450 | struct rx_msdu_end msdu_end; |
| 1451 | struct rx_mpdu_end mpdu_end; |
| 1452 | struct rx_ppdu_start ppdu_start; |
| 1453 | struct rx_ppdu_end ppdu_end; |
| 1454 | } __packed; |
| 1455 | u8 rx_hdr_status[RX_HTT_HDR_STATUS_LEN]; |
| 1456 | u8 msdu_payload[0]; |
| 1457 | }; |
| 1458 | |
| 1459 | #define HTT_RX_DESC_ALIGN 8 |
| 1460 | |
| 1461 | #define HTT_MAC_ADDR_LEN 6 |
| 1462 | |
| 1463 | /* |
| 1464 | * FIX THIS |
| 1465 | * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size, |
| 1466 | * rounded up to a cache line size. |
| 1467 | */ |
| 1468 | #define HTT_RX_BUF_SIZE 1920 |
| 1469 | #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc)) |
| 1470 | |
Michal Kazior | 6e712d4 | 2013-09-24 10:18:36 +0200 | [diff] [blame] | 1471 | /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle |
| 1472 | * aggregated traffic more nicely. */ |
| 1473 | #define ATH10K_HTT_MAX_NUM_REFILL 16 |
| 1474 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1475 | /* |
| 1476 | * DMA_MAP expects the buffer to be an integral number of cache lines. |
| 1477 | * Rather than checking the actual cache line size, this code makes a |
| 1478 | * conservative estimate of what the cache line size could be. |
| 1479 | */ |
| 1480 | #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */ |
| 1481 | #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1) |
| 1482 | |
Michal Kazior | 95bf21f | 2014-05-16 17:15:39 +0300 | [diff] [blame] | 1483 | int ath10k_htt_connect(struct ath10k_htt *htt); |
| 1484 | int ath10k_htt_init(struct ath10k *ar); |
| 1485 | int ath10k_htt_setup(struct ath10k_htt *htt); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1486 | |
Michal Kazior | 95bf21f | 2014-05-16 17:15:39 +0300 | [diff] [blame] | 1487 | int ath10k_htt_tx_alloc(struct ath10k_htt *htt); |
| 1488 | void ath10k_htt_tx_free(struct ath10k_htt *htt); |
| 1489 | |
| 1490 | int ath10k_htt_rx_alloc(struct ath10k_htt *htt); |
Michal Kazior | c545070 | 2015-01-24 12:14:48 +0200 | [diff] [blame] | 1491 | int ath10k_htt_rx_ring_refill(struct ath10k *ar); |
Michal Kazior | 95bf21f | 2014-05-16 17:15:39 +0300 | [diff] [blame] | 1492 | void ath10k_htt_rx_free(struct ath10k_htt *htt); |
| 1493 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1494 | void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb); |
| 1495 | void ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb); |
| 1496 | int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt); |
Kalle Valo | a3d135e | 2013-09-03 11:44:10 +0300 | [diff] [blame] | 1497 | int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u8 mask, u64 cookie); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1498 | int ath10k_htt_send_rx_ring_cfg_ll(struct ath10k_htt *htt); |
Janusz Dziedzic | d385623 | 2014-06-02 21:19:46 +0300 | [diff] [blame] | 1499 | int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt, |
| 1500 | u8 max_subfrms_ampdu, |
| 1501 | u8 max_subfrms_amsdu); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1502 | |
| 1503 | void __ath10k_htt_tx_dec_pending(struct ath10k_htt *htt); |
Michal Kazior | 89d6d83 | 2015-01-24 12:14:51 +0200 | [diff] [blame] | 1504 | int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb); |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1505 | void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id); |
| 1506 | int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *); |
| 1507 | int ath10k_htt_tx(struct ath10k_htt *htt, struct sk_buff *); |
Michal Kazior | 6c5151a | 2014-02-27 18:50:04 +0200 | [diff] [blame] | 1508 | |
Kalle Valo | 5e3dd15 | 2013-06-12 20:52:10 +0300 | [diff] [blame] | 1509 | #endif |