2 * Copyright (c) 2005-2011 Atheros Communications Inc.
3 * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
4 * Copyright (c) 2018, The Linux Foundation. All rights reserved.
6 * Permission to use, copy, modify, and/or distribute this software for any
7 * purpose with or without fee is hereby granted, provided that the above
8 * copyright notice and this permission notice appear in all copies.
10 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
11 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
12 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
13 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
14 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
15 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
16 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
22 #include <linux/bug.h>
23 #include <linux/interrupt.h>
24 #include <linux/dmapool.h>
25 #include <linux/hashtable.h>
26 #include <linux/kfifo.h>
27 #include <net/mac80211.h>
34 enum htt_dbg_stats_type {
35 HTT_DBG_STATS_WAL_PDEV_TXRX = 1 << 0,
36 HTT_DBG_STATS_RX_REORDER = 1 << 1,
37 HTT_DBG_STATS_RX_RATE_INFO = 1 << 2,
38 HTT_DBG_STATS_TX_PPDU_LOG = 1 << 3,
39 HTT_DBG_STATS_TX_RATE_INFO = 1 << 4,
40 /* bits 5-23 currently reserved */
42 HTT_DBG_NUM_STATS /* keep this last */
45 enum htt_h2t_msg_type { /* host-to-target */
46 HTT_H2T_MSG_TYPE_VERSION_REQ = 0,
47 HTT_H2T_MSG_TYPE_TX_FRM = 1,
48 HTT_H2T_MSG_TYPE_RX_RING_CFG = 2,
49 HTT_H2T_MSG_TYPE_STATS_REQ = 3,
50 HTT_H2T_MSG_TYPE_SYNC = 4,
51 HTT_H2T_MSG_TYPE_AGGR_CFG = 5,
52 HTT_H2T_MSG_TYPE_FRAG_DESC_BANK_CFG = 6,
54 /* This command is used for sending management frames in HTT < 3.0.
55 * HTT >= 3.0 uses TX_FRM for everything.
57 HTT_H2T_MSG_TYPE_MGMT_TX = 7,
58 HTT_H2T_MSG_TYPE_TX_FETCH_RESP = 11,
60 HTT_H2T_NUM_MSGS /* keep this last */
68 u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
72 * HTT tx MSDU descriptor
74 * The HTT tx MSDU descriptor is created by the host HTT SW for each
75 * tx MSDU. The HTT tx MSDU descriptor contains the information that
76 * the target firmware needs for the FW's tx processing, particularly
77 * for creating the HW msdu descriptor.
78 * The same HTT tx descriptor is used for HL and LL systems, though
79 * a few fields within the tx descriptor are used only by LL or
81 * The HTT tx descriptor is defined in two manners: by a struct with
82 * bitfields, and by a series of [dword offset, bit mask, bit shift]
84 * The target should use the struct def, for simplicitly and clarity,
85 * but the host shall use the bit-mast + bit-shift defs, to be endian-
86 * neutral. Specifically, the host shall use the get/set macros built
87 * around the mask + shift defs.
89 struct htt_data_tx_desc_frag {
91 struct double_word_addr {
94 } __packed dword_addr;
95 struct triple_word_addr {
99 } __packed tword_addr;
103 struct htt_msdu_ext_desc {
105 __le16 ip_identification;
108 struct htt_data_tx_desc_frag frags[6];
111 struct htt_msdu_ext_desc_64 {
113 __le16 ip_identification;
116 struct htt_data_tx_desc_frag frags[6];
119 #define HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE BIT(0)
120 #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE BIT(1)
121 #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE BIT(2)
122 #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE BIT(3)
123 #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE BIT(4)
125 #define HTT_MSDU_CHECKSUM_ENABLE (HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE \
126 | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE \
127 | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE \
128 | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE \
129 | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE)
131 #define HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE_64 BIT(16)
132 #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE_64 BIT(17)
133 #define HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE_64 BIT(18)
134 #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE_64 BIT(19)
135 #define HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE_64 BIT(20)
136 #define HTT_MSDU_EXT_DESC_FLAG_PARTIAL_CSUM_ENABLE_64 BIT(21)
138 #define HTT_MSDU_CHECKSUM_ENABLE_64 (HTT_MSDU_EXT_DESC_FLAG_IPV4_CSUM_ENABLE_64 \
139 | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV4_CSUM_ENABLE_64 \
140 | HTT_MSDU_EXT_DESC_FLAG_UDP_IPV6_CSUM_ENABLE_64 \
141 | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV4_CSUM_ENABLE_64 \
142 | HTT_MSDU_EXT_DESC_FLAG_TCP_IPV6_CSUM_ENABLE_64)
144 enum htt_data_tx_desc_flags0 {
145 HTT_DATA_TX_DESC_FLAGS0_MAC_HDR_PRESENT = 1 << 0,
146 HTT_DATA_TX_DESC_FLAGS0_NO_AGGR = 1 << 1,
147 HTT_DATA_TX_DESC_FLAGS0_NO_ENCRYPT = 1 << 2,
148 HTT_DATA_TX_DESC_FLAGS0_NO_CLASSIFY = 1 << 3,
149 HTT_DATA_TX_DESC_FLAGS0_RSVD0 = 1 << 4
150 #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_MASK 0xE0
151 #define HTT_DATA_TX_DESC_FLAGS0_PKT_TYPE_LSB 5
154 enum htt_data_tx_desc_flags1 {
155 #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_BITS 6
156 #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_MASK 0x003F
157 #define HTT_DATA_TX_DESC_FLAGS1_VDEV_ID_LSB 0
158 #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_BITS 5
159 #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_MASK 0x07C0
160 #define HTT_DATA_TX_DESC_FLAGS1_EXT_TID_LSB 6
161 HTT_DATA_TX_DESC_FLAGS1_POSTPONED = 1 << 11,
162 HTT_DATA_TX_DESC_FLAGS1_MORE_IN_BATCH = 1 << 12,
163 HTT_DATA_TX_DESC_FLAGS1_CKSUM_L3_OFFLOAD = 1 << 13,
164 HTT_DATA_TX_DESC_FLAGS1_CKSUM_L4_OFFLOAD = 1 << 14,
165 HTT_DATA_TX_DESC_FLAGS1_RSVD1 = 1 << 15
168 enum htt_data_tx_ext_tid {
169 HTT_DATA_TX_EXT_TID_NON_QOS_MCAST_BCAST = 16,
170 HTT_DATA_TX_EXT_TID_MGMT = 17,
171 HTT_DATA_TX_EXT_TID_INVALID = 31
174 #define HTT_INVALID_PEERID 0xFFFF
177 * htt_data_tx_desc - used for data tx path
179 * Note: vdev_id irrelevant for pkt_type == raw and no_classify == 1.
180 * ext_tid: for qos-data frames (0-15), see %HTT_DATA_TX_EXT_TID_
181 * for special kinds of tids
182 * postponed: only for HL hosts. indicates if this is a resend
183 * (HL hosts manage queues on the host )
184 * more_in_batch: only for HL hosts. indicates if more packets are
185 * pending. this allows target to wait and aggregate
186 * freq: 0 means home channel of given vdev. intended for offchannel
188 struct htt_data_tx_desc {
189 u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */
190 __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */
199 } __packed offchan_tx;
201 u8 prefetch[0]; /* start of frame, for FW classification engine */
204 struct htt_data_tx_desc_64 {
205 u8 flags0; /* %HTT_DATA_TX_DESC_FLAGS0_ */
206 __le16 flags1; /* %HTT_DATA_TX_DESC_FLAGS1_ */
215 } __packed offchan_tx;
217 u8 prefetch[0]; /* start of frame, for FW classification engine */
220 enum htt_rx_ring_flags {
221 HTT_RX_RING_FLAGS_MAC80211_HDR = 1 << 0,
222 HTT_RX_RING_FLAGS_MSDU_PAYLOAD = 1 << 1,
223 HTT_RX_RING_FLAGS_PPDU_START = 1 << 2,
224 HTT_RX_RING_FLAGS_PPDU_END = 1 << 3,
225 HTT_RX_RING_FLAGS_MPDU_START = 1 << 4,
226 HTT_RX_RING_FLAGS_MPDU_END = 1 << 5,
227 HTT_RX_RING_FLAGS_MSDU_START = 1 << 6,
228 HTT_RX_RING_FLAGS_MSDU_END = 1 << 7,
229 HTT_RX_RING_FLAGS_RX_ATTENTION = 1 << 8,
230 HTT_RX_RING_FLAGS_FRAG_INFO = 1 << 9,
231 HTT_RX_RING_FLAGS_UNICAST_RX = 1 << 10,
232 HTT_RX_RING_FLAGS_MULTICAST_RX = 1 << 11,
233 HTT_RX_RING_FLAGS_CTRL_RX = 1 << 12,
234 HTT_RX_RING_FLAGS_MGMT_RX = 1 << 13,
235 HTT_RX_RING_FLAGS_NULL_RX = 1 << 14,
236 HTT_RX_RING_FLAGS_PHY_DATA_RX = 1 << 15
239 #define HTT_RX_RING_SIZE_MIN 128
240 #define HTT_RX_RING_SIZE_MAX 2048
241 #define HTT_RX_RING_SIZE HTT_RX_RING_SIZE_MAX
242 #define HTT_RX_RING_FILL_LEVEL (((HTT_RX_RING_SIZE) / 2) - 1)
243 #define HTT_RX_RING_FILL_LEVEL_DUAL_MAC (HTT_RX_RING_SIZE - 1)
245 struct htt_rx_ring_setup_ring32 {
246 __le32 fw_idx_shadow_reg_paddr;
247 __le32 rx_ring_base_paddr;
248 __le16 rx_ring_len; /* in 4-byte words */
249 __le16 rx_ring_bufsize; /* rx skb size - in bytes */
250 __le16 flags; /* %HTT_RX_RING_FLAGS_ */
251 __le16 fw_idx_init_val;
253 /* the following offsets are in 4-byte units */
254 __le16 mac80211_hdr_offset;
255 __le16 msdu_payload_offset;
256 __le16 ppdu_start_offset;
257 __le16 ppdu_end_offset;
258 __le16 mpdu_start_offset;
259 __le16 mpdu_end_offset;
260 __le16 msdu_start_offset;
261 __le16 msdu_end_offset;
262 __le16 rx_attention_offset;
263 __le16 frag_info_offset;
266 struct htt_rx_ring_setup_ring64 {
267 __le64 fw_idx_shadow_reg_paddr;
268 __le64 rx_ring_base_paddr;
269 __le16 rx_ring_len; /* in 4-byte words */
270 __le16 rx_ring_bufsize; /* rx skb size - in bytes */
271 __le16 flags; /* %HTT_RX_RING_FLAGS_ */
272 __le16 fw_idx_init_val;
274 /* the following offsets are in 4-byte units */
275 __le16 mac80211_hdr_offset;
276 __le16 msdu_payload_offset;
277 __le16 ppdu_start_offset;
278 __le16 ppdu_end_offset;
279 __le16 mpdu_start_offset;
280 __le16 mpdu_end_offset;
281 __le16 msdu_start_offset;
282 __le16 msdu_end_offset;
283 __le16 rx_attention_offset;
284 __le16 frag_info_offset;
287 struct htt_rx_ring_setup_hdr {
288 u8 num_rings; /* supported values: 1, 2 */
292 struct htt_rx_ring_setup_32 {
293 struct htt_rx_ring_setup_hdr hdr;
294 struct htt_rx_ring_setup_ring32 rings[0];
297 struct htt_rx_ring_setup_64 {
298 struct htt_rx_ring_setup_hdr hdr;
299 struct htt_rx_ring_setup_ring64 rings[0];
303 * htt_stats_req - request target to send specified statistics
305 * @msg_type: hardcoded %HTT_H2T_MSG_TYPE_STATS_REQ
306 * @upload_types: see %htt_dbg_stats_type. this is 24bit field actually
307 * so make sure its little-endian.
308 * @reset_types: see %htt_dbg_stats_type. this is 24bit field actually
309 * so make sure its little-endian.
310 * @cfg_val: stat_type specific configuration
311 * @stat_type: see %htt_dbg_stats_type
312 * @cookie_lsb: used for confirmation message from target->host
313 * @cookie_msb: ditto as %cookie
315 struct htt_stats_req {
329 #define HTT_STATS_REQ_CFG_STAT_TYPE_INVALID 0xff
332 * htt_oob_sync_req - request out-of-band sync
334 * The HTT SYNC tells the target to suspend processing of subsequent
335 * HTT host-to-target messages until some other target agent locally
336 * informs the target HTT FW that the current sync counter is equal to
337 * or greater than (in a modulo sense) the sync counter specified in
340 * This allows other host-target components to synchronize their operation
341 * with HTT, e.g. to ensure that tx frames don't get transmitted until a
342 * security key has been downloaded to and activated by the target.
343 * In the absence of any explicit synchronization counter value
344 * specification, the target HTT FW will use zero as the default current
347 * The HTT target FW will suspend its host->target message processing as long
348 * as 0 < (in-band sync counter - out-of-band sync counter) & 0xff < 128.
350 struct htt_oob_sync_req {
355 struct htt_aggr_conf {
356 u8 max_num_ampdu_subframes;
357 /* amsdu_subframes is limited by 0x1F mask */
358 u8 max_num_amsdu_subframes;
361 #define HTT_MGMT_FRM_HDR_DOWNLOAD_LEN 32
362 struct htt_mgmt_tx_desc_qca99x0 {
366 struct htt_mgmt_tx_desc {
367 u8 pad[sizeof(u32) - sizeof(struct htt_cmd_hdr)];
372 u8 hdr[HTT_MGMT_FRM_HDR_DOWNLOAD_LEN];
374 struct htt_mgmt_tx_desc_qca99x0 qca99x0;
378 enum htt_mgmt_tx_status {
379 HTT_MGMT_TX_STATUS_OK = 0,
380 HTT_MGMT_TX_STATUS_RETRY = 1,
381 HTT_MGMT_TX_STATUS_DROP = 2
384 /*=== target -> host messages ===============================================*/
386 enum htt_main_t2h_msg_type {
387 HTT_MAIN_T2H_MSG_TYPE_VERSION_CONF = 0x0,
388 HTT_MAIN_T2H_MSG_TYPE_RX_IND = 0x1,
389 HTT_MAIN_T2H_MSG_TYPE_RX_FLUSH = 0x2,
390 HTT_MAIN_T2H_MSG_TYPE_PEER_MAP = 0x3,
391 HTT_MAIN_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
392 HTT_MAIN_T2H_MSG_TYPE_RX_ADDBA = 0x5,
393 HTT_MAIN_T2H_MSG_TYPE_RX_DELBA = 0x6,
394 HTT_MAIN_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
395 HTT_MAIN_T2H_MSG_TYPE_PKTLOG = 0x8,
396 HTT_MAIN_T2H_MSG_TYPE_STATS_CONF = 0x9,
397 HTT_MAIN_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
398 HTT_MAIN_T2H_MSG_TYPE_SEC_IND = 0xb,
399 HTT_MAIN_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
400 HTT_MAIN_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
401 HTT_MAIN_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf,
402 HTT_MAIN_T2H_MSG_TYPE_RX_PN_IND = 0x10,
403 HTT_MAIN_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11,
404 HTT_MAIN_T2H_MSG_TYPE_TEST,
406 HTT_MAIN_T2H_NUM_MSGS
409 enum htt_10x_t2h_msg_type {
410 HTT_10X_T2H_MSG_TYPE_VERSION_CONF = 0x0,
411 HTT_10X_T2H_MSG_TYPE_RX_IND = 0x1,
412 HTT_10X_T2H_MSG_TYPE_RX_FLUSH = 0x2,
413 HTT_10X_T2H_MSG_TYPE_PEER_MAP = 0x3,
414 HTT_10X_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
415 HTT_10X_T2H_MSG_TYPE_RX_ADDBA = 0x5,
416 HTT_10X_T2H_MSG_TYPE_RX_DELBA = 0x6,
417 HTT_10X_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
418 HTT_10X_T2H_MSG_TYPE_PKTLOG = 0x8,
419 HTT_10X_T2H_MSG_TYPE_STATS_CONF = 0x9,
420 HTT_10X_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
421 HTT_10X_T2H_MSG_TYPE_SEC_IND = 0xb,
422 HTT_10X_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc,
423 HTT_10X_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
424 HTT_10X_T2H_MSG_TYPE_TEST = 0xe,
425 HTT_10X_T2H_MSG_TYPE_CHAN_CHANGE = 0xf,
426 HTT_10X_T2H_MSG_TYPE_AGGR_CONF = 0x11,
427 HTT_10X_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x12,
428 HTT_10X_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0x13,
433 enum htt_tlv_t2h_msg_type {
434 HTT_TLV_T2H_MSG_TYPE_VERSION_CONF = 0x0,
435 HTT_TLV_T2H_MSG_TYPE_RX_IND = 0x1,
436 HTT_TLV_T2H_MSG_TYPE_RX_FLUSH = 0x2,
437 HTT_TLV_T2H_MSG_TYPE_PEER_MAP = 0x3,
438 HTT_TLV_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
439 HTT_TLV_T2H_MSG_TYPE_RX_ADDBA = 0x5,
440 HTT_TLV_T2H_MSG_TYPE_RX_DELBA = 0x6,
441 HTT_TLV_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
442 HTT_TLV_T2H_MSG_TYPE_PKTLOG = 0x8,
443 HTT_TLV_T2H_MSG_TYPE_STATS_CONF = 0x9,
444 HTT_TLV_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
445 HTT_TLV_T2H_MSG_TYPE_SEC_IND = 0xb,
446 HTT_TLV_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc, /* deprecated */
447 HTT_TLV_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
448 HTT_TLV_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
449 HTT_TLV_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0xf,
450 HTT_TLV_T2H_MSG_TYPE_RX_PN_IND = 0x10,
451 HTT_TLV_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x11,
452 HTT_TLV_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND = 0x12,
454 HTT_TLV_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE = 0x14,
455 HTT_TLV_T2H_MSG_TYPE_CHAN_CHANGE = 0x15,
456 HTT_TLV_T2H_MSG_TYPE_RX_OFLD_PKT_ERR = 0x16,
457 HTT_TLV_T2H_MSG_TYPE_TEST,
462 enum htt_10_4_t2h_msg_type {
463 HTT_10_4_T2H_MSG_TYPE_VERSION_CONF = 0x0,
464 HTT_10_4_T2H_MSG_TYPE_RX_IND = 0x1,
465 HTT_10_4_T2H_MSG_TYPE_RX_FLUSH = 0x2,
466 HTT_10_4_T2H_MSG_TYPE_PEER_MAP = 0x3,
467 HTT_10_4_T2H_MSG_TYPE_PEER_UNMAP = 0x4,
468 HTT_10_4_T2H_MSG_TYPE_RX_ADDBA = 0x5,
469 HTT_10_4_T2H_MSG_TYPE_RX_DELBA = 0x6,
470 HTT_10_4_T2H_MSG_TYPE_TX_COMPL_IND = 0x7,
471 HTT_10_4_T2H_MSG_TYPE_PKTLOG = 0x8,
472 HTT_10_4_T2H_MSG_TYPE_STATS_CONF = 0x9,
473 HTT_10_4_T2H_MSG_TYPE_RX_FRAG_IND = 0xa,
474 HTT_10_4_T2H_MSG_TYPE_SEC_IND = 0xb,
475 HTT_10_4_T2H_MSG_TYPE_RC_UPDATE_IND = 0xc,
476 HTT_10_4_T2H_MSG_TYPE_TX_INSPECT_IND = 0xd,
477 HTT_10_4_T2H_MSG_TYPE_MGMT_TX_COMPL_IND = 0xe,
478 HTT_10_4_T2H_MSG_TYPE_CHAN_CHANGE = 0xf,
479 HTT_10_4_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND = 0x10,
480 HTT_10_4_T2H_MSG_TYPE_RX_PN_IND = 0x11,
481 HTT_10_4_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND = 0x12,
482 HTT_10_4_T2H_MSG_TYPE_TEST = 0x13,
483 HTT_10_4_T2H_MSG_TYPE_EN_STATS = 0x14,
484 HTT_10_4_T2H_MSG_TYPE_AGGR_CONF = 0x15,
485 HTT_10_4_T2H_MSG_TYPE_TX_FETCH_IND = 0x16,
486 HTT_10_4_T2H_MSG_TYPE_TX_FETCH_CONFIRM = 0x17,
487 HTT_10_4_T2H_MSG_TYPE_STATS_NOUPLOAD = 0x18,
488 /* 0x19 to 0x2f are reserved */
489 HTT_10_4_T2H_MSG_TYPE_TX_MODE_SWITCH_IND = 0x30,
490 HTT_10_4_T2H_MSG_TYPE_PEER_STATS = 0x31,
492 HTT_10_4_T2H_NUM_MSGS
495 enum htt_t2h_msg_type {
496 HTT_T2H_MSG_TYPE_VERSION_CONF,
497 HTT_T2H_MSG_TYPE_RX_IND,
498 HTT_T2H_MSG_TYPE_RX_FLUSH,
499 HTT_T2H_MSG_TYPE_PEER_MAP,
500 HTT_T2H_MSG_TYPE_PEER_UNMAP,
501 HTT_T2H_MSG_TYPE_RX_ADDBA,
502 HTT_T2H_MSG_TYPE_RX_DELBA,
503 HTT_T2H_MSG_TYPE_TX_COMPL_IND,
504 HTT_T2H_MSG_TYPE_PKTLOG,
505 HTT_T2H_MSG_TYPE_STATS_CONF,
506 HTT_T2H_MSG_TYPE_RX_FRAG_IND,
507 HTT_T2H_MSG_TYPE_SEC_IND,
508 HTT_T2H_MSG_TYPE_RC_UPDATE_IND,
509 HTT_T2H_MSG_TYPE_TX_INSPECT_IND,
510 HTT_T2H_MSG_TYPE_MGMT_TX_COMPLETION,
511 HTT_T2H_MSG_TYPE_TX_CREDIT_UPDATE_IND,
512 HTT_T2H_MSG_TYPE_RX_PN_IND,
513 HTT_T2H_MSG_TYPE_RX_OFFLOAD_DELIVER_IND,
514 HTT_T2H_MSG_TYPE_RX_IN_ORD_PADDR_IND,
515 HTT_T2H_MSG_TYPE_WDI_IPA_OP_RESPONSE,
516 HTT_T2H_MSG_TYPE_CHAN_CHANGE,
517 HTT_T2H_MSG_TYPE_RX_OFLD_PKT_ERR,
518 HTT_T2H_MSG_TYPE_AGGR_CONF,
519 HTT_T2H_MSG_TYPE_STATS_NOUPLOAD,
520 HTT_T2H_MSG_TYPE_TEST,
521 HTT_T2H_MSG_TYPE_EN_STATS,
522 HTT_T2H_MSG_TYPE_TX_FETCH_IND,
523 HTT_T2H_MSG_TYPE_TX_FETCH_CONFIRM,
524 HTT_T2H_MSG_TYPE_TX_MODE_SWITCH_IND,
525 HTT_T2H_MSG_TYPE_PEER_STATS,
531 * htt_resp_hdr - header for target-to-host messages
533 * msg_type: see htt_t2h_msg_type
535 struct htt_resp_hdr {
539 #define HTT_RESP_HDR_MSG_TYPE_OFFSET 0
540 #define HTT_RESP_HDR_MSG_TYPE_MASK 0xff
541 #define HTT_RESP_HDR_MSG_TYPE_LSB 0
543 /* htt_ver_resp - response sent for htt_ver_req */
544 struct htt_ver_resp {
550 #define HTT_MGMT_TX_CMPL_FLAG_ACK_RSSI BIT(0)
552 #define HTT_MGMT_TX_CMPL_INFO_ACK_RSSI_MASK GENMASK(7, 0)
554 struct htt_mgmt_tx_completion {
564 #define HTT_RX_INDICATION_INFO0_EXT_TID_MASK (0x1F)
565 #define HTT_RX_INDICATION_INFO0_EXT_TID_LSB (0)
566 #define HTT_RX_INDICATION_INFO0_FLUSH_VALID (1 << 5)
567 #define HTT_RX_INDICATION_INFO0_RELEASE_VALID (1 << 6)
569 #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_MASK 0x0000003F
570 #define HTT_RX_INDICATION_INFO1_FLUSH_START_SEQNO_LSB 0
571 #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_MASK 0x00000FC0
572 #define HTT_RX_INDICATION_INFO1_FLUSH_END_SEQNO_LSB 6
573 #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_MASK 0x0003F000
574 #define HTT_RX_INDICATION_INFO1_RELEASE_START_SEQNO_LSB 12
575 #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_MASK 0x00FC0000
576 #define HTT_RX_INDICATION_INFO1_RELEASE_END_SEQNO_LSB 18
577 #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_MASK 0xFF000000
578 #define HTT_RX_INDICATION_INFO1_NUM_MPDU_RANGES_LSB 24
580 struct htt_rx_indication_hdr {
581 u8 info0; /* %HTT_RX_INDICATION_INFO0_ */
583 __le32 info1; /* %HTT_RX_INDICATION_INFO1_ */
586 #define HTT_RX_INDICATION_INFO0_PHY_ERR_VALID (1 << 0)
587 #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_MASK (0x1E)
588 #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_LSB (1)
589 #define HTT_RX_INDICATION_INFO0_LEGACY_RATE_CCK (1 << 5)
590 #define HTT_RX_INDICATION_INFO0_END_VALID (1 << 6)
591 #define HTT_RX_INDICATION_INFO0_START_VALID (1 << 7)
593 #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_MASK 0x00FFFFFF
594 #define HTT_RX_INDICATION_INFO1_VHT_SIG_A1_LSB 0
595 #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_MASK 0xFF000000
596 #define HTT_RX_INDICATION_INFO1_PREAMBLE_TYPE_LSB 24
598 #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_MASK 0x00FFFFFF
599 #define HTT_RX_INDICATION_INFO2_VHT_SIG_A1_LSB 0
600 #define HTT_RX_INDICATION_INFO2_SERVICE_MASK 0xFF000000
601 #define HTT_RX_INDICATION_INFO2_SERVICE_LSB 24
603 enum htt_rx_legacy_rate {
614 HTT_RX_CCK_11_LP = 0,
615 HTT_RX_CCK_5_5_LP = 1,
624 enum htt_rx_legacy_rate_type {
625 HTT_RX_LEGACY_RATE_OFDM = 0,
626 HTT_RX_LEGACY_RATE_CCK
629 enum htt_rx_preamble_type {
632 HTT_RX_HT_WITH_TXBF = 0x9,
634 HTT_RX_VHT_WITH_TXBF = 0xD,
638 * Fields: phy_err_valid, phy_err_code, tsf,
639 * usec_timestamp, sub_usec_timestamp
640 * ..are valid only if end_valid == 1.
642 * Fields: rssi_chains, legacy_rate_type,
643 * legacy_rate_cck, preamble_type, service,
645 * ..are valid only if start_valid == 1;
647 struct htt_rx_indication_ppdu {
649 u8 sub_usec_timestamp;
651 u8 info0; /* HTT_RX_INDICATION_INFO0_ */
657 } __packed rssi_chains[4];
659 __le32 usec_timestamp;
660 __le32 info1; /* HTT_RX_INDICATION_INFO1_ */
661 __le32 info2; /* HTT_RX_INDICATION_INFO2_ */
664 enum htt_rx_mpdu_status {
665 HTT_RX_IND_MPDU_STATUS_UNKNOWN = 0x0,
666 HTT_RX_IND_MPDU_STATUS_OK,
667 HTT_RX_IND_MPDU_STATUS_ERR_FCS,
668 HTT_RX_IND_MPDU_STATUS_ERR_DUP,
669 HTT_RX_IND_MPDU_STATUS_ERR_REPLAY,
670 HTT_RX_IND_MPDU_STATUS_ERR_INV_PEER,
671 /* only accept EAPOL frames */
672 HTT_RX_IND_MPDU_STATUS_UNAUTH_PEER,
673 HTT_RX_IND_MPDU_STATUS_OUT_OF_SYNC,
674 /* Non-data in promiscuous mode */
675 HTT_RX_IND_MPDU_STATUS_MGMT_CTRL,
676 HTT_RX_IND_MPDU_STATUS_TKIP_MIC_ERR,
677 HTT_RX_IND_MPDU_STATUS_DECRYPT_ERR,
678 HTT_RX_IND_MPDU_STATUS_MPDU_LENGTH_ERR,
679 HTT_RX_IND_MPDU_STATUS_ENCRYPT_REQUIRED_ERR,
680 HTT_RX_IND_MPDU_STATUS_PRIVACY_ERR,
683 * MISC: discard for unspecified reasons.
684 * Leave this enum value last.
686 HTT_RX_IND_MPDU_STATUS_ERR_MISC = 0xFF
689 struct htt_rx_indication_mpdu_range {
691 u8 mpdu_range_status; /* %htt_rx_mpdu_status */
696 struct htt_rx_indication_prefix {
697 __le16 fw_rx_desc_bytes;
702 struct htt_rx_indication {
703 struct htt_rx_indication_hdr hdr;
704 struct htt_rx_indication_ppdu ppdu;
705 struct htt_rx_indication_prefix prefix;
708 * the following fields are both dynamically sized, so
709 * take care addressing them
712 /* the size of this is %fw_rx_desc_bytes */
713 struct fw_rx_desc_base fw_desc;
716 * %mpdu_ranges starts after &%prefix + roundup(%fw_rx_desc_bytes, 4)
717 * and has %num_mpdu_ranges elements.
719 struct htt_rx_indication_mpdu_range mpdu_ranges[0];
722 static inline struct htt_rx_indication_mpdu_range *
723 htt_rx_ind_get_mpdu_ranges(struct htt_rx_indication *rx_ind)
727 ptr += sizeof(rx_ind->hdr)
728 + sizeof(rx_ind->ppdu)
729 + sizeof(rx_ind->prefix)
730 + roundup(__le16_to_cpu(rx_ind->prefix.fw_rx_desc_bytes), 4);
734 enum htt_rx_flush_mpdu_status {
735 HTT_RX_FLUSH_MPDU_DISCARD = 0,
736 HTT_RX_FLUSH_MPDU_REORDER = 1,
740 * htt_rx_flush - discard or reorder given range of mpdus
742 * Note: host must check if all sequence numbers between
743 * [seq_num_start, seq_num_end-1] are valid.
745 struct htt_rx_flush {
749 u8 mpdu_status; /* %htt_rx_flush_mpdu_status */
750 u8 seq_num_start; /* it is 6 LSBs of 802.11 seq no */
751 u8 seq_num_end; /* it is 6 LSBs of 802.11 seq no */
754 struct htt_rx_peer_map {
762 struct htt_rx_peer_unmap {
767 enum htt_security_types {
773 HTT_SECURITY_TKIP_NOMIC,
774 HTT_SECURITY_AES_CCMP,
777 HTT_NUM_SECURITY_TYPES /* keep this last! */
780 enum htt_security_flags {
781 #define HTT_SECURITY_TYPE_MASK 0x7F
782 #define HTT_SECURITY_TYPE_LSB 0
783 HTT_SECURITY_IS_UNICAST = 1 << 7
786 struct htt_security_indication {
788 /* dont use bitfields; undefined behaviour */
789 u8 flags; /* %htt_security_flags */
791 u8 security_type:7, /* %htt_security_types */
800 #define HTT_RX_BA_INFO0_TID_MASK 0x000F
801 #define HTT_RX_BA_INFO0_TID_LSB 0
802 #define HTT_RX_BA_INFO0_PEER_ID_MASK 0xFFF0
803 #define HTT_RX_BA_INFO0_PEER_ID_LSB 4
805 struct htt_rx_addba {
807 __le16 info0; /* %HTT_RX_BA_INFO0_ */
810 struct htt_rx_delba {
812 __le16 info0; /* %HTT_RX_BA_INFO0_ */
815 enum htt_data_tx_status {
816 HTT_DATA_TX_STATUS_OK = 0,
817 HTT_DATA_TX_STATUS_DISCARD = 1,
818 HTT_DATA_TX_STATUS_NO_ACK = 2,
819 HTT_DATA_TX_STATUS_POSTPONE = 3, /* HL only */
820 HTT_DATA_TX_STATUS_DOWNLOAD_FAIL = 128
823 enum htt_data_tx_flags {
824 #define HTT_DATA_TX_STATUS_MASK 0x07
825 #define HTT_DATA_TX_STATUS_LSB 0
826 #define HTT_DATA_TX_TID_MASK 0x78
827 #define HTT_DATA_TX_TID_LSB 3
828 HTT_DATA_TX_TID_INVALID = 1 << 7
831 #define HTT_TX_COMPL_INV_MSDU_ID 0xFFFF
833 struct htt_data_tx_completion {
844 __le16 msdus[0]; /* variable length based on %num_msdus */
847 struct htt_tx_compl_ind_base {
849 u16 payload[1/*or more*/];
852 struct htt_rc_tx_done_params {
856 u32 num_enqued; /* 1 for non-AMPDU */
858 u32 num_failed; /* for AMPDU */
864 struct htt_rc_update {
870 struct htt_rc_tx_done_params params[0]; /* variable length %num_elems */
873 /* see htt_rx_indication for similar fields and descriptions */
874 struct htt_rx_fragment_indication {
876 u8 info0; /* %HTT_RX_FRAG_IND_INFO0_ */
883 __le32 info1; /* %HTT_RX_FRAG_IND_INFO1_ */
884 __le16 fw_rx_desc_bytes;
887 u8 fw_msdu_rx_desc[0];
890 #define HTT_RX_FRAG_IND_INFO0_EXT_TID_MASK 0x1F
891 #define HTT_RX_FRAG_IND_INFO0_EXT_TID_LSB 0
892 #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_MASK 0x20
893 #define HTT_RX_FRAG_IND_INFO0_FLUSH_VALID_LSB 5
895 #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_MASK 0x0000003F
896 #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_START_LSB 0
897 #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_MASK 0x00000FC0
898 #define HTT_RX_FRAG_IND_INFO1_FLUSH_SEQ_NUM_END_LSB 6
900 struct htt_rx_pn_ind {
910 struct htt_rx_offload_msdu {
919 struct htt_rx_offload_ind {
924 struct htt_rx_in_ord_msdu_desc {
931 struct htt_rx_in_ord_msdu_desc_ext {
938 struct htt_rx_in_ord_ind {
945 struct htt_rx_in_ord_msdu_desc msdu_descs32[0];
946 struct htt_rx_in_ord_msdu_desc_ext msdu_descs64[0];
950 #define HTT_RX_IN_ORD_IND_INFO_TID_MASK 0x0000001f
951 #define HTT_RX_IN_ORD_IND_INFO_TID_LSB 0
952 #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_MASK 0x00000020
953 #define HTT_RX_IN_ORD_IND_INFO_OFFLOAD_LSB 5
954 #define HTT_RX_IN_ORD_IND_INFO_FRAG_MASK 0x00000040
955 #define HTT_RX_IN_ORD_IND_INFO_FRAG_LSB 6
958 * target -> host test message definition
960 * The following field definitions describe the format of the test
961 * message sent from the target to the host.
962 * The message consists of a 4-octet header, followed by a variable
963 * number of 32-bit integer values, followed by a variable number
964 * of 8-bit character values.
967 * |-----------------------------------------------------------|
968 * | num chars | num ints | msg type |
969 * |-----------------------------------------------------------|
971 * |-----------------------------------------------------------|
973 * |-----------------------------------------------------------|
975 * |-----------------------------------------------------------|
976 * | char 3 | char 2 | char 1 | char 0 |
977 * |-----------------------------------------------------------|
978 * | | | ... | char 4 |
979 * |-----------------------------------------------------------|
982 * Purpose: identifies this as a test message
983 * Value: HTT_MSG_TYPE_TEST
986 * Purpose: indicate how many 32-bit integers follow the message header
989 * Purpose: indicate how many 8-bit characters follow the series of integers
995 /* payload consists of 2 lists:
996 * a) num_ints * sizeof(__le32)
997 * b) num_chars * sizeof(u8) aligned to 4bytes
1002 static inline __le32 *htt_rx_test_get_ints(struct htt_rx_test *rx_test)
1004 return (__le32 *)rx_test->payload;
1007 static inline u8 *htt_rx_test_get_chars(struct htt_rx_test *rx_test)
1009 return rx_test->payload + (rx_test->num_ints * sizeof(__le32));
1013 * target -> host packet log message
1015 * The following field definitions describe the format of the packet log
1016 * message sent from the target to the host.
1017 * The message consists of a 4-octet header,followed by a variable number
1018 * of 32-bit character values.
1020 * |31 24|23 16|15 8|7 0|
1021 * |-----------------------------------------------------------|
1022 * | | | | msg type |
1023 * |-----------------------------------------------------------|
1025 * |-----------------------------------------------------------|
1028 * Purpose: identifies this as a test message
1029 * Value: HTT_MSG_TYPE_PACKETLOG
1031 struct htt_pktlog_msg {
1036 struct htt_dbg_stats_rx_reorder_stats {
1037 /* Non QoS MPDUs received */
1038 __le32 deliver_non_qos;
1040 /* MPDUs received in-order */
1041 __le32 deliver_in_order;
1043 /* Flush due to reorder timer expired */
1044 __le32 deliver_flush_timeout;
1046 /* Flush due to move out of window */
1047 __le32 deliver_flush_oow;
1049 /* Flush due to DELBA */
1050 __le32 deliver_flush_delba;
1052 /* MPDUs dropped due to FCS error */
1055 /* MPDUs dropped due to monitor mode non-data packet */
1058 /* MPDUs dropped due to invalid peer */
1059 __le32 invalid_peer;
1061 /* MPDUs dropped due to duplication (non aggregation) */
1062 __le32 dup_non_aggr;
1064 /* MPDUs dropped due to processed before */
1067 /* MPDUs dropped due to duplicate in reorder queue */
1068 __le32 dup_in_reorder;
1070 /* Reorder timeout happened */
1071 __le32 reorder_timeout;
1073 /* invalid bar ssn */
1074 __le32 invalid_bar_ssn;
1076 /* reorder reset due to bar ssn */
1080 struct htt_dbg_stats_wal_tx_stats {
1081 /* Num HTT cookies queued to dispatch list */
1084 /* Num HTT cookies dispatched */
1085 __le32 comp_delivered;
1087 /* Num MSDU queued to WAL */
1090 /* Num MPDU queue to WAL */
1093 /* Num MSDUs dropped by WMM limit */
1096 /* Num Local frames queued */
1097 __le32 local_enqued;
1099 /* Num Local frames done */
1102 /* Num queued to HW */
1105 /* Num PPDU reaped from HW */
1111 /* Num PPDUs cleaned up in TX abort */
1114 /* Num MPDUs requed by SW */
1115 __le32 mpdus_requed;
1117 /* excessive retries */
1120 /* data hw rate code */
1123 /* Scheduler self triggers */
1124 __le32 self_triggers;
1126 /* frames dropped due to excessive sw retries */
1127 __le32 sw_retry_failure;
1129 /* illegal rate phy errors */
1130 __le32 illgl_rate_phy_err;
1132 /* wal pdev continuous xretry */
1133 __le32 pdev_cont_xretry;
1135 /* wal pdev continuous xretry */
1136 __le32 pdev_tx_timeout;
1138 /* wal pdev resets */
1141 __le32 phy_underrun;
1143 /* MPDU is more than txop limit */
1147 struct htt_dbg_stats_wal_rx_stats {
1148 /* Cnts any change in ring routing mid-ppdu */
1149 __le32 mid_ppdu_route_change;
1151 /* Total number of statuses processed */
1154 /* Extra frags on rings 0-3 */
1160 /* MSDUs / MPDUs delivered to HTT */
1164 /* MSDUs / MPDUs delivered to local stack */
1168 /* AMSDUs that have more MSDUs than the status ring size */
1169 __le32 oversize_amsdu;
1171 /* Number of PHY errors */
1174 /* Number of PHY errors drops */
1175 __le32 phy_err_drop;
1177 /* Number of mpdu errors - FCS, MIC, ENC etc. */
1181 struct htt_dbg_stats_wal_peer_stats {
1182 __le32 dummy; /* REMOVE THIS ONCE REAL PEER STAT COUNTERS ARE ADDED */
1185 struct htt_dbg_stats_wal_pdev_txrx {
1186 struct htt_dbg_stats_wal_tx_stats tx_stats;
1187 struct htt_dbg_stats_wal_rx_stats rx_stats;
1188 struct htt_dbg_stats_wal_peer_stats peer_stats;
1191 struct htt_dbg_stats_rx_rate_info {
1203 * htt_dbg_stats_status -
1204 * present - The requested stats have been delivered in full.
1205 * This indicates that either the stats information was contained
1206 * in its entirety within this message, or else this message
1207 * completes the delivery of the requested stats info that was
1208 * partially delivered through earlier STATS_CONF messages.
1209 * partial - The requested stats have been delivered in part.
1210 * One or more subsequent STATS_CONF messages with the same
1211 * cookie value will be sent to deliver the remainder of the
1213 * error - The requested stats could not be delivered, for example due
1214 * to a shortage of memory to construct a message holding the
1216 * invalid - The requested stat type is either not recognized, or the
1217 * target is configured to not gather the stats type in question.
1218 * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1219 * series_done - This special value indicates that no further stats info
1220 * elements are present within a series of stats info elems
1221 * (within a stats upload confirmation message).
1223 enum htt_dbg_stats_status {
1224 HTT_DBG_STATS_STATUS_PRESENT = 0,
1225 HTT_DBG_STATS_STATUS_PARTIAL = 1,
1226 HTT_DBG_STATS_STATUS_ERROR = 2,
1227 HTT_DBG_STATS_STATUS_INVALID = 3,
1228 HTT_DBG_STATS_STATUS_SERIES_DONE = 7
1232 * target -> host statistics upload
1234 * The following field definitions describe the format of the HTT target
1235 * to host stats upload confirmation message.
1236 * The message contains a cookie echoed from the HTT host->target stats
1237 * upload request, which identifies which request the confirmation is
1238 * for, and a series of tag-length-value stats information elements.
1239 * The tag-length header for each stats info element also includes a
1240 * status field, to indicate whether the request for the stat type in
1241 * question was fully met, partially met, unable to be met, or invalid
1242 * (if the stat type in question is disabled in the target).
1243 * A special value of all 1's in this status field is used to indicate
1244 * the end of the series of stats info elements.
1247 * |31 16|15 8|7 5|4 0|
1248 * |------------------------------------------------------------|
1249 * | reserved | msg type |
1250 * |------------------------------------------------------------|
1252 * |------------------------------------------------------------|
1254 * |------------------------------------------------------------|
1255 * | stats entry length | reserved | S |stat type|
1256 * |------------------------------------------------------------|
1258 * | type-specific stats info |
1260 * |------------------------------------------------------------|
1261 * | stats entry length | reserved | S |stat type|
1262 * |------------------------------------------------------------|
1264 * | type-specific stats info |
1266 * |------------------------------------------------------------|
1267 * | n/a | reserved | 111 | n/a |
1268 * |------------------------------------------------------------|
1272 * Purpose: identifies this is a statistics upload confirmation message
1276 * Purpose: Provide a mechanism to match a target->host stats confirmation
1277 * message with its preceding host->target stats request message.
1278 * Value: LSBs of the opaque cookie specified by the host-side requestor
1281 * Purpose: Provide a mechanism to match a target->host stats confirmation
1282 * message with its preceding host->target stats request message.
1283 * Value: MSBs of the opaque cookie specified by the host-side requestor
1285 * Stats Information Element tag-length header fields:
1288 * Purpose: identifies the type of statistics info held in the
1289 * following information element
1290 * Value: htt_dbg_stats_type
1293 * Purpose: indicate whether the requested stats are present
1294 * Value: htt_dbg_stats_status, including a special value (0x7) to mark
1295 * the completion of the stats entry series
1298 * Purpose: indicate the stats information size
1299 * Value: This field specifies the number of bytes of stats information
1300 * that follows the element tag-length header.
1301 * It is expected but not required that this length is a multiple of
1302 * 4 bytes. Even if the length is not an integer multiple of 4, the
1303 * subsequent stats entry header will begin on a 4-byte aligned
1307 #define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_MASK 0x1F
1308 #define HTT_STATS_CONF_ITEM_INFO_STAT_TYPE_LSB 0
1309 #define HTT_STATS_CONF_ITEM_INFO_STATUS_MASK 0xE0
1310 #define HTT_STATS_CONF_ITEM_INFO_STATUS_LSB 5
1312 struct htt_stats_conf_item {
1316 u8 stat_type:5; /* %HTT_DBG_STATS_ */
1317 u8 status:3; /* %HTT_DBG_STATS_STATUS_ */
1322 u8 payload[0]; /* roundup(length, 4) long */
1325 struct htt_stats_conf {
1330 /* each item has variable length! */
1331 struct htt_stats_conf_item items[0];
1334 static inline struct htt_stats_conf_item *htt_stats_conf_next_item(
1335 const struct htt_stats_conf_item *item)
1337 return (void *)item + sizeof(*item) + roundup(item->length, 4);
1341 * host -> target FRAG DESCRIPTOR/MSDU_EXT DESC bank
1343 * The following field definitions describe the format of the HTT host
1344 * to target frag_desc/msdu_ext bank configuration message.
1345 * The message contains the based address and the min and max id of the
1346 * MSDU_EXT/FRAG_DESC that will be used by the HTT to map MSDU DESC and
1347 * MSDU_EXT/FRAG_DESC.
1348 * HTT will use id in HTT descriptor instead sending the frag_desc_ptr.
1349 * For QCA988X HW the firmware will use fragment_desc_ptr but in WIFI2.0
1350 * the hardware does the mapping/translation.
1352 * Total banks that can be configured is configured to 16.
1354 * This should be called before any TX has be initiated by the HTT
1356 * |31 16|15 8|7 5|4 0|
1357 * |------------------------------------------------------------|
1358 * | DESC_SIZE | NUM_BANKS | RES |SWP|pdev| msg type |
1359 * |------------------------------------------------------------|
1360 * | BANK0_BASE_ADDRESS |
1361 * |------------------------------------------------------------|
1363 * |------------------------------------------------------------|
1364 * | BANK15_BASE_ADDRESS |
1365 * |------------------------------------------------------------|
1366 * | BANK0_MAX_ID | BANK0_MIN_ID |
1367 * |------------------------------------------------------------|
1369 * |------------------------------------------------------------|
1370 * | BANK15_MAX_ID | BANK15_MIN_ID |
1371 * |------------------------------------------------------------|
1376 * - BANKx_BASE_ADDRESS
1378 * Purpose: Provide a mechanism to specify the base address of the MSDU_EXT
1379 * bank physical/bus address.
1382 * Purpose: Provide a mechanism to specify the min index that needs to
1386 * Purpose: Provide a mechanism to specify the max index that needs to
1389 struct htt_frag_desc_bank_id {
1394 /* real is 16 but it wouldn't fit in the max htt message size
1395 * so we use a conservatively safe value for now
1397 #define HTT_FRAG_DESC_BANK_MAX 4
1399 #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_MASK 0x03
1400 #define HTT_FRAG_DESC_BANK_CFG_INFO_PDEV_ID_LSB 0
1401 #define HTT_FRAG_DESC_BANK_CFG_INFO_SWAP BIT(2)
1402 #define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_VALID BIT(3)
1403 #define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE_MASK BIT(4)
1404 #define HTT_FRAG_DESC_BANK_CFG_INFO_Q_STATE_DEPTH_TYPE_LSB 4
1406 enum htt_q_depth_type {
1407 HTT_Q_DEPTH_TYPE_BYTES = 0,
1408 HTT_Q_DEPTH_TYPE_MSDUS = 1,
1411 #define HTT_TX_Q_STATE_NUM_PEERS (TARGET_10_4_NUM_QCACHE_PEERS_MAX + \
1412 TARGET_10_4_NUM_VDEVS)
1413 #define HTT_TX_Q_STATE_NUM_TIDS 8
1414 #define HTT_TX_Q_STATE_ENTRY_SIZE 1
1415 #define HTT_TX_Q_STATE_ENTRY_MULTIPLIER 0
1418 * htt_q_state_conf - part of htt_frag_desc_bank_cfg for host q state config
1420 * Defines host q state format and behavior. See htt_q_state.
1422 * @record_size: Defines the size of each host q entry in bytes. In practice
1423 * however firmware (at least 10.4.3-00191) ignores this host
1424 * configuration value and uses hardcoded value of 1.
1425 * @record_multiplier: This is valid only when q depth type is MSDUs. It
1426 * defines the exponent for the power of 2 multiplication.
1428 struct htt_q_state_conf {
1433 u8 record_multiplier;
1437 struct htt_frag_desc_bank_cfg32 {
1438 u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */
1441 __le32 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX];
1442 struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX];
1443 struct htt_q_state_conf q_state;
1446 struct htt_frag_desc_bank_cfg64 {
1447 u8 info; /* HTT_FRAG_DESC_BANK_CFG_INFO_ */
1450 __le64 bank_base_addrs[HTT_FRAG_DESC_BANK_MAX];
1451 struct htt_frag_desc_bank_id bank_id[HTT_FRAG_DESC_BANK_MAX];
1452 struct htt_q_state_conf q_state;
1455 #define HTT_TX_Q_STATE_ENTRY_COEFFICIENT 128
1456 #define HTT_TX_Q_STATE_ENTRY_FACTOR_MASK 0x3f
1457 #define HTT_TX_Q_STATE_ENTRY_FACTOR_LSB 0
1458 #define HTT_TX_Q_STATE_ENTRY_EXP_MASK 0xc0
1459 #define HTT_TX_Q_STATE_ENTRY_EXP_LSB 6
1462 * htt_q_state - shared between host and firmware via DMA
1464 * This structure is used for the host to expose it's software queue state to
1465 * firmware so that its rate control can schedule fetch requests for optimized
1466 * performance. This is most notably used for MU-MIMO aggregation when multiple
1467 * MU clients are connected.
1469 * @count: Each element defines the host queue depth. When q depth type was
1470 * configured as HTT_Q_DEPTH_TYPE_BYTES then each entry is defined as:
1471 * FACTOR * 128 * 8^EXP (see HTT_TX_Q_STATE_ENTRY_FACTOR_MASK and
1472 * HTT_TX_Q_STATE_ENTRY_EXP_MASK). When q depth type was configured as
1473 * HTT_Q_DEPTH_TYPE_MSDUS the number of packets is scaled by 2 **
1474 * record_multiplier (see htt_q_state_conf).
1475 * @map: Used by firmware to quickly check which host queues are not empty. It
1476 * is a bitmap simply saying.
1477 * @seq: Used by firmware to quickly check if the host queues were updated
1478 * since it last checked.
1480 * FIXME: Is the q_state map[] size calculation really correct?
1482 struct htt_q_state {
1483 u8 count[HTT_TX_Q_STATE_NUM_TIDS][HTT_TX_Q_STATE_NUM_PEERS];
1484 u32 map[HTT_TX_Q_STATE_NUM_TIDS][(HTT_TX_Q_STATE_NUM_PEERS + 31) / 32];
1488 #define HTT_TX_FETCH_RECORD_INFO_PEER_ID_MASK 0x0fff
1489 #define HTT_TX_FETCH_RECORD_INFO_PEER_ID_LSB 0
1490 #define HTT_TX_FETCH_RECORD_INFO_TID_MASK 0xf000
1491 #define HTT_TX_FETCH_RECORD_INFO_TID_LSB 12
1493 struct htt_tx_fetch_record {
1494 __le16 info; /* HTT_TX_FETCH_IND_RECORD_INFO_ */
1499 struct htt_tx_fetch_ind {
1501 __le16 fetch_seq_num;
1503 __le16 num_resp_ids;
1505 struct htt_tx_fetch_record records[0];
1506 __le32 resp_ids[0]; /* ath10k_htt_get_tx_fetch_ind_resp_ids() */
1509 static inline void *
1510 ath10k_htt_get_tx_fetch_ind_resp_ids(struct htt_tx_fetch_ind *ind)
1512 return (void *)&ind->records[le16_to_cpu(ind->num_records)];
1515 struct htt_tx_fetch_resp {
1518 __le16 fetch_seq_num;
1521 struct htt_tx_fetch_record records[0];
1524 struct htt_tx_fetch_confirm {
1526 __le16 num_resp_ids;
1530 enum htt_tx_mode_switch_mode {
1531 HTT_TX_MODE_SWITCH_PUSH = 0,
1532 HTT_TX_MODE_SWITCH_PUSH_PULL = 1,
1535 #define HTT_TX_MODE_SWITCH_IND_INFO0_ENABLE BIT(0)
1536 #define HTT_TX_MODE_SWITCH_IND_INFO0_NUM_RECORDS_MASK 0xfffe
1537 #define HTT_TX_MODE_SWITCH_IND_INFO0_NUM_RECORDS_LSB 1
1539 #define HTT_TX_MODE_SWITCH_IND_INFO1_MODE_MASK 0x0003
1540 #define HTT_TX_MODE_SWITCH_IND_INFO1_MODE_LSB 0
1541 #define HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD_MASK 0xfffc
1542 #define HTT_TX_MODE_SWITCH_IND_INFO1_THRESHOLD_LSB 2
1544 #define HTT_TX_MODE_SWITCH_RECORD_INFO0_PEER_ID_MASK 0x0fff
1545 #define HTT_TX_MODE_SWITCH_RECORD_INFO0_PEER_ID_LSB 0
1546 #define HTT_TX_MODE_SWITCH_RECORD_INFO0_TID_MASK 0xf000
1547 #define HTT_TX_MODE_SWITCH_RECORD_INFO0_TID_LSB 12
1549 struct htt_tx_mode_switch_record {
1550 __le16 info0; /* HTT_TX_MODE_SWITCH_RECORD_INFO0_ */
1551 __le16 num_max_msdus;
1554 struct htt_tx_mode_switch_ind {
1556 __le16 info0; /* HTT_TX_MODE_SWITCH_IND_INFO0_ */
1557 __le16 info1; /* HTT_TX_MODE_SWITCH_IND_INFO1_ */
1559 struct htt_tx_mode_switch_record records[0];
1562 struct htt_channel_change {
1565 __le32 center_freq1;
1566 __le32 center_freq2;
1570 struct htt_per_peer_tx_stats_ind {
1573 __le32 failed_bytes;
1585 struct htt_peer_tx_stats {
1592 #define ATH10K_10_2_TX_STATS_OFFSET 136
1593 #define PEER_STATS_FOR_NO_OF_PPDUS 4
1595 struct ath10k_10_2_peer_tx_stats {
1596 u8 ratecode[PEER_STATS_FOR_NO_OF_PPDUS];
1597 u8 success_pkts[PEER_STATS_FOR_NO_OF_PPDUS];
1598 __le16 success_bytes[PEER_STATS_FOR_NO_OF_PPDUS];
1599 u8 retry_pkts[PEER_STATS_FOR_NO_OF_PPDUS];
1600 __le16 retry_bytes[PEER_STATS_FOR_NO_OF_PPDUS];
1601 u8 failed_pkts[PEER_STATS_FOR_NO_OF_PPDUS];
1602 __le16 failed_bytes[PEER_STATS_FOR_NO_OF_PPDUS];
1603 u8 flags[PEER_STATS_FOR_NO_OF_PPDUS];
1610 /* WEP: 24-bit PN */
1613 /* TKIP or CCMP: 48-bit PN */
1616 /* WAPI: 128-bit PN */
1621 struct htt_cmd_hdr hdr;
1623 struct htt_ver_req ver_req;
1624 struct htt_mgmt_tx_desc mgmt_tx;
1625 struct htt_data_tx_desc data_tx;
1626 struct htt_rx_ring_setup_32 rx_setup_32;
1627 struct htt_rx_ring_setup_64 rx_setup_64;
1628 struct htt_stats_req stats_req;
1629 struct htt_oob_sync_req oob_sync_req;
1630 struct htt_aggr_conf aggr_conf;
1631 struct htt_frag_desc_bank_cfg32 frag_desc_bank_cfg32;
1632 struct htt_frag_desc_bank_cfg64 frag_desc_bank_cfg64;
1633 struct htt_tx_fetch_resp tx_fetch_resp;
1638 struct htt_resp_hdr hdr;
1640 struct htt_ver_resp ver_resp;
1641 struct htt_mgmt_tx_completion mgmt_tx_completion;
1642 struct htt_data_tx_completion data_tx_completion;
1643 struct htt_rx_indication rx_ind;
1644 struct htt_rx_fragment_indication rx_frag_ind;
1645 struct htt_rx_peer_map peer_map;
1646 struct htt_rx_peer_unmap peer_unmap;
1647 struct htt_rx_flush rx_flush;
1648 struct htt_rx_addba rx_addba;
1649 struct htt_rx_delba rx_delba;
1650 struct htt_security_indication security_indication;
1651 struct htt_rc_update rc_update;
1652 struct htt_rx_test rx_test;
1653 struct htt_pktlog_msg pktlog_msg;
1654 struct htt_stats_conf stats_conf;
1655 struct htt_rx_pn_ind rx_pn_ind;
1656 struct htt_rx_offload_ind rx_offload_ind;
1657 struct htt_rx_in_ord_ind rx_in_ord_ind;
1658 struct htt_tx_fetch_ind tx_fetch_ind;
1659 struct htt_tx_fetch_confirm tx_fetch_confirm;
1660 struct htt_tx_mode_switch_ind tx_mode_switch_ind;
1661 struct htt_channel_change chan_change;
1662 struct htt_peer_tx_stats peer_tx_stats;
1666 /*** host side structures follow ***/
1668 struct htt_tx_done {
1674 enum htt_tx_compl_state {
1675 HTT_TX_COMPL_STATE_NONE,
1676 HTT_TX_COMPL_STATE_ACK,
1677 HTT_TX_COMPL_STATE_NOACK,
1678 HTT_TX_COMPL_STATE_DISCARD,
1681 struct htt_peer_map_event {
1687 struct htt_peer_unmap_event {
1691 struct ath10k_htt_txbuf_32 {
1692 struct htt_data_tx_desc_frag frags[2];
1693 struct ath10k_htc_hdr htc_hdr;
1694 struct htt_cmd_hdr cmd_hdr;
1695 struct htt_data_tx_desc cmd_tx;
1698 struct ath10k_htt_txbuf_64 {
1699 struct htt_data_tx_desc_frag frags[2];
1700 struct ath10k_htc_hdr htc_hdr;
1701 struct htt_cmd_hdr cmd_hdr;
1702 struct htt_data_tx_desc_64 cmd_tx;
1707 enum ath10k_htc_ep_id eid;
1709 u8 target_version_major;
1710 u8 target_version_minor;
1711 struct completion target_version_received;
1715 const enum htt_t2h_msg_type *t2h_msg_types;
1716 u32 t2h_msg_types_max;
1720 * Ring of network buffer objects - This ring is
1721 * used exclusively by the host SW. This ring
1722 * mirrors the dev_addrs_ring that is shared
1723 * between the host SW and the MAC HW. The host SW
1724 * uses this netbufs ring to locate the network
1725 * buffer objects whose data buffers the HW has
1728 struct sk_buff **netbufs_ring;
1730 /* This is used only with firmware supporting IN_ORD_IND.
1732 * With Full Rx Reorder the HTT Rx Ring is more of a temporary
1733 * buffer ring from which buffer addresses are copied by the
1734 * firmware to MAC Rx ring. Firmware then delivers IN_ORD_IND
1735 * pointing to specific (re-ordered) buffers.
1737 * FIXME: With kernel generic hashing functions there's a lot
1738 * of hash collisions for sk_buffs.
1741 DECLARE_HASHTABLE(skb_table, 4);
1744 * Ring of buffer addresses -
1745 * This ring holds the "physical" device address of the
1746 * rx buffers the host SW provides for the MAC HW to
1750 __le64 *paddrs_ring_64;
1751 __le32 *paddrs_ring_32;
1755 * Base address of ring, as a "physical" device address
1756 * rather than a CPU address.
1758 dma_addr_t base_paddr;
1760 /* how many elems in the ring (power of 2) */
1764 unsigned int size_mask;
1766 /* how many rx buffers to keep in the ring */
1769 /* how many rx buffers (full+empty) are in the ring */
1773 * alloc_idx - where HTT SW has deposited empty buffers
1774 * This is allocated in consistent mem, so that the FW can
1775 * read this variable, and program the HW's FW_IDX reg with
1776 * the value of this shadow register.
1783 /* where HTT SW has processed bufs filled by rx MAC DMA */
1785 unsigned int msdu_payld;
1789 * refill_retry_timer - timer triggered when the ring is
1790 * not refilled to the level expected
1792 struct timer_list refill_retry_timer;
1794 /* Protects access to all rx ring buffer state variables */
1798 unsigned int prefetch_len;
1800 /* Protects access to pending_tx, num_pending_tx */
1802 int max_num_pending_tx;
1804 int num_pending_mgmt_tx;
1805 struct idr pending_tx;
1806 wait_queue_head_t empty_tx_wq;
1808 /* FIFO for storing tx done status {ack, no-ack, discard} and msdu id */
1809 DECLARE_KFIFO_PTR(txdone_fifo, struct htt_tx_done);
1811 /* set if host-fw communication goes haywire
1812 * used to avoid further failures
1815 atomic_t num_mpdus_ready;
1817 /* This is used to group tx/rx completions separately and process them
1818 * in batches to reduce cache stalls
1820 struct sk_buff_head rx_msdus_q;
1821 struct sk_buff_head rx_in_ord_compl_q;
1822 struct sk_buff_head tx_fetch_ind_q;
1824 /* rx_status template */
1825 struct ieee80211_rx_status rx_status;
1830 struct htt_msdu_ext_desc *vaddr_desc_32;
1831 struct htt_msdu_ext_desc_64 *vaddr_desc_64;
1839 struct ath10k_htt_txbuf_32 *vaddr_txbuff_32;
1840 struct ath10k_htt_txbuf_64 *vaddr_txbuff_64;
1847 struct htt_q_state *vaddr;
1849 u16 num_push_allowed;
1852 enum htt_tx_mode_switch_mode mode;
1853 enum htt_q_depth_type type;
1856 bool tx_mem_allocated;
1857 const struct ath10k_htt_tx_ops *tx_ops;
1858 const struct ath10k_htt_rx_ops *rx_ops;
1861 struct ath10k_htt_tx_ops {
1862 int (*htt_send_rx_ring_cfg)(struct ath10k_htt *htt);
1863 int (*htt_send_frag_desc_bank_cfg)(struct ath10k_htt *htt);
1864 int (*htt_alloc_frag_desc)(struct ath10k_htt *htt);
1865 void (*htt_free_frag_desc)(struct ath10k_htt *htt);
1866 int (*htt_tx)(struct ath10k_htt *htt, enum ath10k_hw_txrx_mode txmode,
1867 struct sk_buff *msdu);
1868 int (*htt_alloc_txbuff)(struct ath10k_htt *htt);
1869 void (*htt_free_txbuff)(struct ath10k_htt *htt);
1872 static inline int ath10k_htt_send_rx_ring_cfg(struct ath10k_htt *htt)
1874 if (!htt->tx_ops->htt_send_rx_ring_cfg)
1877 return htt->tx_ops->htt_send_rx_ring_cfg(htt);
1880 static inline int ath10k_htt_send_frag_desc_bank_cfg(struct ath10k_htt *htt)
1882 if (!htt->tx_ops->htt_send_frag_desc_bank_cfg)
1885 return htt->tx_ops->htt_send_frag_desc_bank_cfg(htt);
1888 static inline int ath10k_htt_alloc_frag_desc(struct ath10k_htt *htt)
1890 if (!htt->tx_ops->htt_alloc_frag_desc)
1893 return htt->tx_ops->htt_alloc_frag_desc(htt);
1896 static inline void ath10k_htt_free_frag_desc(struct ath10k_htt *htt)
1898 if (htt->tx_ops->htt_free_frag_desc)
1899 htt->tx_ops->htt_free_frag_desc(htt);
1902 static inline int ath10k_htt_tx(struct ath10k_htt *htt,
1903 enum ath10k_hw_txrx_mode txmode,
1904 struct sk_buff *msdu)
1906 return htt->tx_ops->htt_tx(htt, txmode, msdu);
1909 static inline int ath10k_htt_alloc_txbuff(struct ath10k_htt *htt)
1911 if (!htt->tx_ops->htt_alloc_txbuff)
1914 return htt->tx_ops->htt_alloc_txbuff(htt);
1917 static inline void ath10k_htt_free_txbuff(struct ath10k_htt *htt)
1919 if (htt->tx_ops->htt_free_txbuff)
1920 htt->tx_ops->htt_free_txbuff(htt);
1923 struct ath10k_htt_rx_ops {
1924 size_t (*htt_get_rx_ring_size)(struct ath10k_htt *htt);
1925 void (*htt_config_paddrs_ring)(struct ath10k_htt *htt, void *vaddr);
1926 void (*htt_set_paddrs_ring)(struct ath10k_htt *htt, dma_addr_t paddr,
1928 void* (*htt_get_vaddr_ring)(struct ath10k_htt *htt);
1929 void (*htt_reset_paddrs_ring)(struct ath10k_htt *htt, int idx);
1932 static inline size_t ath10k_htt_get_rx_ring_size(struct ath10k_htt *htt)
1934 if (!htt->rx_ops->htt_get_rx_ring_size)
1937 return htt->rx_ops->htt_get_rx_ring_size(htt);
1940 static inline void ath10k_htt_config_paddrs_ring(struct ath10k_htt *htt,
1943 if (htt->rx_ops->htt_config_paddrs_ring)
1944 htt->rx_ops->htt_config_paddrs_ring(htt, vaddr);
1947 static inline void ath10k_htt_set_paddrs_ring(struct ath10k_htt *htt,
1951 if (htt->rx_ops->htt_set_paddrs_ring)
1952 htt->rx_ops->htt_set_paddrs_ring(htt, paddr, idx);
1955 static inline void *ath10k_htt_get_vaddr_ring(struct ath10k_htt *htt)
1957 if (!htt->rx_ops->htt_get_vaddr_ring)
1960 return htt->rx_ops->htt_get_vaddr_ring(htt);
1963 static inline void ath10k_htt_reset_paddrs_ring(struct ath10k_htt *htt, int idx)
1965 if (htt->rx_ops->htt_reset_paddrs_ring)
1966 htt->rx_ops->htt_reset_paddrs_ring(htt, idx);
1969 #define RX_HTT_HDR_STATUS_LEN 64
1971 /* This structure layout is programmed via rx ring setup
1972 * so that FW knows how to transfer the rx descriptor to the host.
1973 * Buffers like this are placed on the rx ring.
1975 struct htt_rx_desc {
1977 /* This field is filled on the host using the msdu buffer
1978 * from htt_rx_indication
1980 struct fw_rx_desc_base fw_desc;
1984 struct rx_attention attention;
1985 struct rx_frag_info frag_info;
1986 struct rx_mpdu_start mpdu_start;
1987 struct rx_msdu_start msdu_start;
1988 struct rx_msdu_end msdu_end;
1989 struct rx_mpdu_end mpdu_end;
1990 struct rx_ppdu_start ppdu_start;
1991 struct rx_ppdu_end ppdu_end;
1993 u8 rx_hdr_status[RX_HTT_HDR_STATUS_LEN];
1997 #define HTT_RX_DESC_ALIGN 8
1999 #define HTT_MAC_ADDR_LEN 6
2003 * Should be: sizeof(struct htt_host_rx_desc) + max rx MSDU size,
2004 * rounded up to a cache line size.
2006 #define HTT_RX_BUF_SIZE 1920
2007 #define HTT_RX_MSDU_SIZE (HTT_RX_BUF_SIZE - (int)sizeof(struct htt_rx_desc))
2009 /* Refill a bunch of RX buffers for each refill round so that FW/HW can handle
2010 * aggregated traffic more nicely.
2012 #define ATH10K_HTT_MAX_NUM_REFILL 100
2015 * DMA_MAP expects the buffer to be an integral number of cache lines.
2016 * Rather than checking the actual cache line size, this code makes a
2017 * conservative estimate of what the cache line size could be.
2019 #define HTT_LOG2_MAX_CACHE_LINE_SIZE 7 /* 2^7 = 128 */
2020 #define HTT_MAX_CACHE_LINE_SIZE_MASK ((1 << HTT_LOG2_MAX_CACHE_LINE_SIZE) - 1)
2022 /* These values are default in most firmware revisions and apparently are a
2023 * sweet spot performance wise.
2025 #define ATH10K_HTT_MAX_NUM_AMSDU_DEFAULT 3
2026 #define ATH10K_HTT_MAX_NUM_AMPDU_DEFAULT 64
2028 int ath10k_htt_connect(struct ath10k_htt *htt);
2029 int ath10k_htt_init(struct ath10k *ar);
2030 int ath10k_htt_setup(struct ath10k_htt *htt);
2032 int ath10k_htt_tx_start(struct ath10k_htt *htt);
2033 void ath10k_htt_tx_stop(struct ath10k_htt *htt);
2034 void ath10k_htt_tx_destroy(struct ath10k_htt *htt);
2035 void ath10k_htt_tx_free(struct ath10k_htt *htt);
2037 int ath10k_htt_rx_alloc(struct ath10k_htt *htt);
2038 int ath10k_htt_rx_ring_refill(struct ath10k *ar);
2039 void ath10k_htt_rx_free(struct ath10k_htt *htt);
2041 void ath10k_htt_htc_tx_complete(struct ath10k *ar, struct sk_buff *skb);
2042 void ath10k_htt_htc_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
2043 bool ath10k_htt_t2h_msg_handler(struct ath10k *ar, struct sk_buff *skb);
2044 int ath10k_htt_h2t_ver_req_msg(struct ath10k_htt *htt);
2045 int ath10k_htt_h2t_stats_req(struct ath10k_htt *htt, u8 mask, u64 cookie);
2046 int ath10k_htt_h2t_aggr_cfg_msg(struct ath10k_htt *htt,
2047 u8 max_subfrms_ampdu,
2048 u8 max_subfrms_amsdu);
2049 void ath10k_htt_hif_tx_complete(struct ath10k *ar, struct sk_buff *skb);
2050 int ath10k_htt_tx_fetch_resp(struct ath10k *ar,
2052 __le16 fetch_seq_num,
2053 struct htt_tx_fetch_record *records,
2054 size_t num_records);
2056 void ath10k_htt_tx_txq_update(struct ieee80211_hw *hw,
2057 struct ieee80211_txq *txq);
2058 void ath10k_htt_tx_txq_recalc(struct ieee80211_hw *hw,
2059 struct ieee80211_txq *txq);
2060 void ath10k_htt_tx_txq_sync(struct ath10k *ar);
2061 void ath10k_htt_tx_dec_pending(struct ath10k_htt *htt);
2062 int ath10k_htt_tx_inc_pending(struct ath10k_htt *htt);
2063 void ath10k_htt_tx_mgmt_dec_pending(struct ath10k_htt *htt);
2064 int ath10k_htt_tx_mgmt_inc_pending(struct ath10k_htt *htt, bool is_mgmt,
2067 int ath10k_htt_tx_alloc_msdu_id(struct ath10k_htt *htt, struct sk_buff *skb);
2068 void ath10k_htt_tx_free_msdu_id(struct ath10k_htt *htt, u16 msdu_id);
2069 int ath10k_htt_mgmt_tx(struct ath10k_htt *htt, struct sk_buff *msdu);
2070 void ath10k_htt_rx_pktlog_completion_handler(struct ath10k *ar,
2071 struct sk_buff *skb);
2072 int ath10k_htt_txrx_compl_task(struct ath10k *ar, int budget);
2073 void ath10k_htt_set_tx_ops(struct ath10k_htt *htt);
2074 void ath10k_htt_set_rx_ops(struct ath10k_htt *htt);