1 /*
2  * Copyright (c) 2017-2021 The Linux Foundation. All rights reserved.
3  * Copyright (c) 2021-2024 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 /**
20  * @file htt_ppdu_stats.h
21  *
22  * @details the public header file of HTT STATS
23  */
24 #ifndef __HTT_PPDU_STATS_H__
25 #define __HTT_PPDU_STATS_H__
26 
27 #include <htt.h>
28 #include <htt_stats.h>
29 #include <htt_common.h> /* HTT_STATS_MAX_CHAINS */
30 
31 
32 /* HTT_PPDU_STATS_VAR_LEN_ARRAY1:
33  * This macro is for converting the definition of existing variable-length
34  * arrays within HTT PPDU stats structs of the form "type name[1];" to use
35  * the form "type name[];" while ensuring that the length of the TLV struct
36  * is unmodified by the conversion.
37  * In general, any new variable-length structs should simply use
38  * "type name[];" directly, rather than using HTT_PPDU_STATS_VAR_LEN_ARRAY1.
39  * However, if there's a legitimate reason to make the new variable-length
40  * struct appear to not have a variable length, HTT_PPDU_STATS_VAR_LEN_ARRAY1
41  * can be used for this purpose.
42  */
43 #if defined(ATH_TARGET) || defined(__WINDOWS__)
44     #define HTT_PPDU_STATS_VAR_LEN_ARRAY1(type, name) type name[1]
45 #else
46     /*
47      * Certain build settings of the Linux kernel don't allow zero-element
48      * arrays, and C++ doesn't allow zero-length empty structs.
49      * Confirm that there's no build that combines kernel with C++.
50      */
51     #ifdef __cplusplus
52         #error unsupported combination of kernel and C plus plus
53     #endif
54     #define HTT_PPDU_STATS_DUMMY_ZERO_LEN_FIELD struct {} dummy_zero_len_field
55 
56     #define HTT_PPDU_STATS_VAR_LEN_ARRAY1(type, name) \
57         union { \
58             type name ## __first_elem; \
59             struct { \
60                 HTT_PPDU_STATS_DUMMY_ZERO_LEN_FIELD; \
61                 type name[]; \
62             };  \
63         }
64 #endif
65 
66 
67 #define HTT_STATS_NUM_SUPPORTED_BW_SMART_ANTENNA 4 /* 20, 40, 80, 160 MHz */
68 
69 #define HTT_BA_64_BIT_MAP_SIZE_DWORDS 2
70 #define HTT_BA_256_BIT_MAP_SIZE_DWORDS 8
71 #define HTT_BA_1024_BIT_MAP_SIZE_DWORDS 32
72 
73 enum htt_ppdu_stats_tlv_tag {
74     HTT_PPDU_STATS_COMMON_TLV,                    /* htt_ppdu_stats_common_tlv */
75     HTT_PPDU_STATS_USR_COMMON_TLV,                /* htt_ppdu_stats_user_common_tlv */
76     HTT_PPDU_STATS_USR_RATE_TLV,                  /* htt_ppdu_stats_user_rate_tlv */
77     HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_64_TLV,    /* htt_ppdu_stats_enq_mpdu_bitmap_64_tlv */
78     HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_256_TLV,   /* htt_ppdu_stats_enq_mpdu_bitmap_256_tlv */
79     HTT_PPDU_STATS_SCH_CMD_STATUS_TLV,            /* htt_ppdu_stats_sch_cmd_tlv_v */
80     HTT_PPDU_STATS_USR_COMPLTN_COMMON_TLV,        /* htt_ppdu_stats_user_compltn_common_tlv */
81     HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_64_TLV,  /* htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv */
82     HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_256_TLV, /* htt_ppdu_stats_user_cmpltn_ba_bitmap_256_tlv */
83     HTT_PPDU_STATS_USR_COMPLTN_ACK_BA_STATUS_TLV, /* htt_ppdu_stats_user_cmpltn_ack_ba_status_tlv */
84     HTT_PPDU_STATS_USR_COMPLTN_FLUSH_TLV,         /* htt_ppdu_stats_flush_tlv */
85     HTT_PPDU_STATS_USR_COMMON_ARRAY_TLV,          /* htt_ppdu_stats_usr_common_array_tlv_v */
86     HTT_PPDU_STATS_INFO_TLV,                      /* htt_ppdu_stats_info */
87     HTT_PPDU_STATS_TX_MGMTCTRL_PAYLOAD_TLV,       /* htt_ppdu_stats_tx_mgmtctrl_payload_tlv */
88     HTT_PPDU_STATS_USERS_INFO_TLV,                /* htt_ppdu_stats_users_info_tlv */
89     HTT_PPDU_STATS_USR_MPDU_ENQ_BITMAP_1024_TLV,  /* htt_ppdu_stats_enq_mpdu_bitmap_1024_tlv */
90     HTT_PPDU_STATS_USR_COMPLTN_BA_BITMAP_1024_TLV,/* htt_ppdu_stats_user_compltn_ba_bitmap_1024_tlv */
91     HTT_PPDU_STATS_RX_MGMTCTRL_PAYLOAD_TLV,       /* htt_ppdu_stats_rx_mgmtctrl_payload_tlv */
92     HTT_PPDU_STATS_FOR_SMU_TLV,                   /* htt_ppdu_stats_for_smu_tlv */
93     HTT_PPDU_STATS_MLO_TX_RESP_TLV,               /* htt_ppdu_stats_mlo_tx_resp_tlv */
94     HTT_PPDU_STATS_MLO_TX_NOTIFICATION_TLV,       /* htt_ppdu_stats_mlo_tx_notification_tlv */
95 
96     /* New TLV's are added above to this line */
97     HTT_PPDU_STATS_MAX_TAG,
98 };
99 typedef enum htt_ppdu_stats_tlv_tag htt_ppdu_stats_tlv_tag_t;
100 
101 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_M     0x000000ff
102 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_S              0
103 
104 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_GET(_var) \
105     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_M) >> \
106     HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_S)
107 
108 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_SET(_var, _val) \
109      do { \
110          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE, _val); \
111          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RATE_S)); \
112      } while (0)
113 
114 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_M     0x00000100
115 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_S              8
116 
117 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_GET(_var) \
118     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_M) >> \
119     HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_S)
120 
121 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_SET(_var, _val) \
122      do { \
123          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU, _val); \
124          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_IS_AMPDU_S)); \
125      } while (0)
126 
127 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_M     0x00000600
128 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_S              9
129 
130 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_GET(_var) \
131     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_M) >> \
132     HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_S)
133 
134 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_SET(_var, _val) \
135      do { \
136          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED, _val); \
137          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_BA_ACK_FAILED_S)); \
138      } while (0)
139 
140 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_M     0x00003800
141 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_S             11
142 
143 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_GET(_var) \
144     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_M) >> \
145     HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_S)
146 
147 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_SET(_var, _val) \
148      do { \
149          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW, _val); \
150          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_BW_S)); \
151      } while (0)
152 
153 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_M     0x00004000
154 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_S             14
155 
156 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_GET(_var) \
157     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_M) >> \
158     HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_S)
159 
160 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_SET(_var, _val) \
161      do { \
162          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI, _val); \
163          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_SGI_S)); \
164      } while (0)
165 
166 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_M     0x00008000
167 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_S             15
168 
169 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_GET(_var) \
170     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_M) >> \
171     HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_S)
172 
173 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_SET(_var, _val) \
174     do { \
175         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR, _val); \
176         ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_SR_S)); \
177     } while (0)
178 
179 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_M     0xffff0000
180 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_S             16
181 
182 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_GET(_var) \
183     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_M) >> \
184     HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_S)
185 
186 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_SET(_var, _val) \
187      do { \
188          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID, _val); \
189          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_PEERID_S)); \
190      } while (0)
191 
192 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_M     0x0000ffff
193 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_S              0
194 
195 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_GET(_var) \
196     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_M) >> \
197     HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_S)
198 
199 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_SET(_var, _val) \
200      do { \
201          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS, _val); \
202          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_SUCC_MSDUS_S)); \
203      } while (0)
204 
205 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_M     0xffff0000
206 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_S             16
207 
208 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_GET(_var) \
209     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_M) >> \
210     HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_S)
211 
212 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_SET(_var, _val) \
213      do { \
214          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS, _val); \
215          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_RETRY_MSDUS_S)); \
216      } while (0)
217 
218 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_M     0x0000ffff
219 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_S              0
220 
221 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_GET(_var) \
222     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_M) >> \
223     HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_S)
224 
225 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_SET(_var, _val) \
226      do { \
227          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS, _val); \
228          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_FAILED_MSDUS_S)); \
229      } while (0)
230 
231 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_M     0xffff0000
232 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_S             16
233 
234 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_GET(_var) \
235     (((_var) & HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_M) >> \
236     HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_S)
237 
238 #define HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_SET(_var, _val) \
239      do { \
240          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR, _val); \
241          ((_var) |= ((_val) << HTT_PPDU_STATS_ARRAY_ITEM_TLV_TX_DUR_S)); \
242      } while (0)
243 
244 PREPACK struct htt_tx_ppdu_stats_info {
245     htt_tlv_hdr_t tlv_hdr;
246     A_UINT32 tx_success_bytes;
247     A_UINT32 tx_retry_bytes;
248     A_UINT32 tx_failed_bytes;
249     A_UINT32 tx_ratecode:       8,
250              is_ampdu:          1,
251              ba_ack_failed:     2,
252              /* bw
253               *  0: 20 MHz
254               *  1: 40 MHz
255               *  2: 80 MHz
256               *  3: 160 MHz or 80+80 MHz
257               *  4: 320 MHz
258               */
259              bw:                3,
260              sgi:               1,
261              skipped_rate_ctrl: 1,
262              peer_id:          16;
263     A_UINT32 tx_success_msdus: 16,
264              tx_retry_msdus:   16;
265     A_UINT32 tx_failed_msdus:  16,
266              /* united in us */
267              tx_duration:      16;
268     /*
269      * 1 in bit 0 of valid_bitmap represents that bitmap itself is valid.
270      * If the bitmap is valid (i.e. bit 0 is set), then check the other bits
271      * of bitmap to know which fields within htt_tx_ppdu_stats_info are valid.
272      * If bit 1 is set, tx_success_bytes is valid
273      * If bit 2 is set, tx_retry_bytes is valid
274      * ...
275      * If bit 14 is set, tx_duration is valid
276      * If bit 15 is set, all of ack_rssi_chain are valid,
277      *     for each validation of chain, need to check value in field
278      * If bit 16 is set, tx_timestamp is valid
279      * If bit 16 is set, sa_ant_matrix is valid
280      * If bit 17 is set, tid is valid
281      */
282     A_UINT32 valid_bitmap;
283     A_UINT32 ext_valid_bitmap; /* reserved for future extension valid bitmap */
284     /* ack rssi for each chain */
285     A_UINT32 ack_rssi_chain0:   8, /* Units: dB w.r.t noise floor, RSSI of Ack of all active chains. Value of 0x80 indicates invalid.*/
286              ack_rssi_chain1:   8, /* same as above */
287              ack_rssi_chain2:   8, /* same as above */
288              ack_rssi_chain3:   8; /* same as above */
289     A_UINT32 ack_rssi_chain4:   8, /* same as above */
290              ack_rssi_chain5:   8, /* same as above */
291              ack_rssi_chain6:   8, /* same as above */
292              ack_rssi_chain7:   8; /* same as above */
293     A_UINT32 tx_timestamp; /* HW assigned timestamp with microsecond unit */
294     A_UINT32 sa_ant_matrix:     8, /* This sa_ant_matrix provides a bitmask of the antennas used while frame transmit */
295              tid:               8,
296              reserved_1:       16;
297 } POSTPACK;
298 
299 typedef struct {
300     htt_tlv_hdr_t tlv_hdr;
301     A_UINT32 number_of_ppdu_stats;
302     /*
303      * tx_ppdu_stats_info is filled by multiple struct htt_tx_ppdu_stats_info
304      * elements.
305      * tx_ppdu_stats_info is variable length, with length =
306      *     number_of_ppdu_stats * sizeof (struct htt_tx_ppdu_stats_info)
307      */
308     struct htt_tx_ppdu_stats_info tx_ppdu_stats_info[1/*number_of_ppdu_stats*/];
309 } htt_ppdu_stats_usr_common_array_tlv_v;
310 
311 typedef struct {
312     htt_tlv_hdr_t tlv_hdr;
313     union {
314         /* DEPRECATED (target_type)
315          * The target_type field is not actually present in the HTT messages
316          * produced by the FW.  However, it cannot be removed (yet), due to
317          * FW code that refers to this field.
318          * As a workaround, this target_type field is being moved into a
319          * union with the "hw" field that actually is present in the message.
320          * This makes the message definitions become consistent with the
321          * actual message contents, while not breaking the compilation of
322          * code that refers to the target_type field.
323          * Overlaying the memory for "target_type" and "hw" does not cause
324          * problems, because the FW code that refers to target_type first
325          * writes a value into the target_type field, then writes data into
326          * the hw field.
327          * Once all FW references to the target_type field have been removed,
328          * the target_type field def and the encapsulating anonymous union
329          * will be removed from this htt_ppdu_stats_sch_cmd_tlv_v struct def.
330          */
331         A_UINT32 target_type;
332 
333         /*
334          * The hw portion of this struct contains a scheduler_command_status
335          * struct, whose definition is different for different target HW types.
336          */
337         HTT_PPDU_STATS_VAR_LEN_ARRAY1(A_UINT32, hw);
338     };
339 } htt_ppdu_stats_sch_cmd_tlv_v;
340 
341 #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_M     0x0000ffff
342 #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_S              0
343 
344 #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_GET(_var) \
345     (((_var) & HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_M) >> \
346     HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_S)
347 
348 #define HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_SET(_var, _val) \
349      do { \
350          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID, _val); \
351          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_SCH_CMDID_S)); \
352      } while (0)
353 
354 #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_M     0x00ff0000
355 #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_S             16
356 
357 #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_GET(_var) \
358     (((_var) & HTT_PPDU_STATS_COMMON_TLV_RING_ID_M) >> \
359     HTT_PPDU_STATS_COMMON_TLV_RING_ID_S)
360 
361 #define HTT_PPDU_STATS_COMMON_TLV_RING_ID_SET(_var, _val) \
362      do { \
363          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_RING_ID, _val); \
364          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_RING_ID_S)); \
365      } while (0)
366 
367 #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_M     0xff000000
368 #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_S             24
369 
370 #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_GET(_var) \
371     (((_var) & HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_M) >> \
372     HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_S)
373 
374 #define HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_SET(_var, _val) \
375      do { \
376          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_NUM_USERS, _val); \
377          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_NUM_USERS_S)); \
378      } while (0)
379 
380 /* HW queue type */
381 enum HTT_TX_QUEUE_TYPE {
382     HTT_TX_QUEUE_INACTIVE,
383     HTT_TX_QUEUE_DATA,
384     HTT_TX_QUEUE_BEACON,
385     HTT_TX_QUEUE_PSPOLL,
386     HTT_TX_QUEUE_CAB,
387     HTT_TX_QUEUE_HALPHY,
388     HTT_TX_QUEUE_QBOOST_RESP,
389     HTT_TX_QUEUE_NAN_BEACON,
390     HTT_TX_QUEUE_NAN_MGMT,
391     HTT_TX_QUEUE_UL_DATA,
392     HTT_TX_QUEUE_UL_BSR_RESP,
393     HTT_TX_QUEUE_MGMT,
394     HTT_TX_QUEUE_MAX,
395 };
396 typedef enum HTT_TX_QUEUE_TYPE HTT_TX_QUEUE_TYPE;
397 
398 /* frame_type */
399 enum HTT_STATS_FTYPE {
400     HTT_STATS_FTYPE_SGEN_NDPA = 0,
401     HTT_STATS_FTYPE_SGEN_NDP,
402     HTT_STATS_FTYPE_SGEN_BRP,
403     HTT_STATS_FTYPE_SGEN_BAR,
404     HTT_STATS_FTYPE_SGEN_RTS,
405     HTT_STATS_FTYPE_SGEN_CTS,
406     HTT_STATS_FTYPE_SGEN_CFEND,
407     HTT_STATS_FTYPE_SGEN_AX_NDPA,
408     HTT_STATS_FTYPE_SGEN_AX_NDP,
409     HTT_STATS_FTYPE_SGEN_MU_TRIG,
410     HTT_STATS_FTYPE_SGEN_MU_BAR,
411     HTT_STATS_FTYPE_SGEN_MU_BRP,
412     HTT_STATS_FTYPE_SGEN_MU_RTS,
413     HTT_STATS_FTYPE_SGEN_MU_BSR,
414     HTT_STATS_FTYPE_SGEN_UL_BSR,
415     HTT_STATS_FTYPE_SGEN_UL_BSR_TRIGGER = HTT_STATS_FTYPE_SGEN_UL_BSR, /*alias*/
416     HTT_STATS_FTYPE_TIDQ_DATA_SU,
417     HTT_STATS_FTYPE_TIDQ_DATA_MU,
418     HTT_STATS_FTYPE_SGEN_UL_BSR_RESP,
419     HTT_STATS_FTYPE_SGEN_QOS_NULL,
420     HTT_STATS_FTYPE_SGEN_BE_NDPA,
421     HTT_STATS_FTYPE_SGEN_BE_NDP,
422     HTT_STATS_FTYPE_SGEN_BE_MU_TRIG,
423     HTT_STATS_FTYPE_SGEN_BE_MU_BAR,
424     HTT_STATS_FTYPE_SGEN_BE_MU_BRP,
425     HTT_STATS_FTYPE_SGEN_BE_MU_RTS,
426     HTT_STATS_FTYPE_SGEN_BE_MU_BSRP,
427     HTT_STATS_FTYPE_MAX,
428 };
429 typedef enum HTT_STATS_FTYPE HTT_STATS_FTYPE;
430 
431 /* FRM_TYPE defined in HTT_STATS_FTYPE */
432 #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_M     0x000000ff
433 #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_S              0
434 
435 #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_GET(_var) \
436     (((_var) & HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_M) >> \
437     HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_S)
438 
439 #define HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_SET(_var, _val) \
440      do { \
441          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE, _val); \
442          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_FRM_TYPE_S)); \
443      } while (0)
444 
445 /* QTYPE defined in HTT_TX_QUEUE_TYPE */
446 #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_M     0x0000ff00
447 #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_S              8
448 
449 #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_GET(_var) \
450     (((_var) & HTT_PPDU_STATS_COMMON_TLV_QTYPE_M) >> \
451     HTT_PPDU_STATS_COMMON_TLV_QTYPE_S)
452 
453 #define HTT_PPDU_STATS_COMMON_TLV_QTYPE_SET(_var, _val) \
454      do { \
455          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_QTYPE, _val); \
456          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_QTYPE_S)); \
457      } while (0)
458 
459 
460 enum HTT_PPDU_STATS_BW {
461     HTT_PPDU_STATS_BANDWIDTH_5MHZ   = 0,
462     HTT_PPDU_STATS_BANDWIDTH_10MHZ  = 1,
463     HTT_PPDU_STATS_BANDWIDTH_20MHZ  = 2,
464     HTT_PPDU_STATS_BANDWIDTH_40MHZ  = 3,
465     HTT_PPDU_STATS_BANDWIDTH_80MHZ  = 4,
466     HTT_PPDU_STATS_BANDWIDTH_160MHZ = 5, /* includes 80+80 */
467     HTT_PPDU_STATS_BANDWIDTH_DYN    = 6,
468     HTT_PPDU_STATS_BANDWIDTH_DYN_PATTERNS = 7,
469     HTT_PPDU_STATS_BANDWIDTH_320MHZ = 8,
470 };
471 typedef enum HTT_PPDU_STATS_BW HTT_PPDU_STATS_BW;
472 
473 #define HTT_PPDU_STATS_COMMON_TLV_BW_M     0x000f0000
474 #define HTT_PPDU_STATS_COMMON_TLV_BW_S             16
475 
476 #define HTT_PPDU_STATS_COMMON_TLV_BW_GET(_var) \
477     (((_var) & HTT_PPDU_STATS_COMMON_TLV_BW_M) >> \
478     HTT_PPDU_STATS_COMMON_TLV_BW_S)
479 
480 #define HTT_PPDU_STATS_COMMON_TLV_BW_SET(_var, _val) \
481      do { \
482          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_BW, _val); \
483          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BW_S)); \
484      } while (0)
485 
486 enum HTT_PPDU_STATS_SEQ_TYPE {
487     HTT_SEQTYPE_UNSPECIFIED         = 0,
488     HTT_SEQTYPE_SU                  = 1,
489     HTT_SEQTYPE_AC_MU_MIMO          = 2,
490     HTT_SEQTYPE_AX_MU_MIMO          = 3,
491     HTT_SEQTYPE_MU_OFDMA            = 4,
492     HTT_SEQTYPE_UL_MU_OFDMA_TRIG    = 5, /* new name - use this */
493         HTT_SEQTYPE_UL_TRIG         = 5,  /* deprecated old name */
494     HTT_SEQTYPE_BURST_BCN           = 6,
495     HTT_SEQTYPE_UL_BSR_RESP         = 7,
496     HTT_SEQTYPE_UL_BSR_TRIG         = 8,
497     HTT_SEQTYPE_UL_RESP             = 9,
498     HTT_SEQTYPE_UL_MU_MIMO_TRIG     = 10,
499     HTT_SEQTYPE_BE_MU_MIMO          = 11,
500     HTT_SEQTYPE_BE_MU_OFDMA         = 12,
501     HTT_SEQTYPE_BE_UL_MU_OFDMA_TRIG = 13,
502     HTT_SEQTYPE_BE_UL_MU_MIMO_TRIG  = 14,
503     HTT_SEQTYPE_BE_UL_BSR_TRIG      = 15,
504 };
505 typedef enum HTT_PPDU_STATS_SEQ_TYPE HTT_PPDU_STATS_SEQ_TYPE;
506 
507 #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_M     0x0ff00000
508 #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_S             20
509 
510 #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_GET(_var) \
511     (((_var) & HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_M) >> \
512     HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_S)
513 
514 #define HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_SET(_var, _val) \
515      do { \
516          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE, _val); \
517          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_PPDU_SEQ_TYPE_S)); \
518      } while (0)
519 
520 /*
521  * MPROT_TYPE enum values: refer to enum
522  * pcu_ppdu_setup_init__medium_prot_type__e
523  * defined in tlv_enum.h
524  */
525 #define HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE_M     0xf0000000
526 #define HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE_S             28
527 
528 #define HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE_GET(_var) \
529     (((_var) & HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE_M) >> \
530     HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE_S)
531 
532 #define HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE_SET(_var, _val) \
533      do { \
534         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_MPROT_TYPE, _val); \
535         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BW_S)); \
536      } while (0)
537 
538 #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_M     0x0000ffff
539 #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_S              0
540 
541 #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_GET(_var) \
542     (((_var) & HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_M) >> \
543     HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_S)
544 
545 #define HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_SET(_var, _val) \
546      do { \
547          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_PHY_MODE, _val); \
548          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_PHY_MODE_S)); \
549      } while (0)
550 
551 #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_M     0xffff0000
552 #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_S             16
553 
554 #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_GET(_var) \
555     (((_var) & HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_M) >> \
556     HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_S)
557 
558 #define HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_SET(_var, _val) \
559      do { \
560          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ, _val); \
561          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_CHAN_MHZ_S)); \
562      } while (0)
563 
564 #define HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_M     0x0000ffff
565 #define HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_S              0
566 
567 #define HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_GET(_var) \
568     (((_var) & HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_M) >> \
569     HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_S )
570 
571 #define HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_SET(_var, _val) \
572      do { \
573          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US, _val); \
574          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_PHY_PPDU_TX_TIME_US_S)); \
575      } while (0)
576 
577 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_M     0x00ff0000
578 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_S             16
579 
580 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_GET(_var) \
581     (((_var) & HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_M) >> \
582     HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_S)
583 
584 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_SET(_var, _val) \
585    do { \
586       HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS, _val); \
587       ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_NUM_UL_EXPECTED_USERS_S)); \
588    } while(0);
589 
590 #define HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_M    0x01000000
591 #define HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_S            24
592 
593 #define HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_GET(_var) \
594     (((_var) & HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_M) >> \
595     HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_S)
596 
597 #define HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_SET(_var, _val) \
598      do { \
599          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE, _val); \
600          ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BEAM_CHANGE_S)); \
601      } while (0)
602 
603 #define HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_M    0x02000000
604 #define HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_S            25
605 
606 #define HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_GET(_var) \
607     (((_var) & HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_M) >> \
608     HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_S)
609 
610 #define HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_SET(_var, _val) \
611     do { \
612         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION, _val); \
613         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_DOPPLER_INDICATION_S)); \
614     } while (0)
615 
616 enum HTT_PPDU_STATS_SPATIAL_REUSE {
617     HTT_SRP_DISALLOW                        =  0,
618     /* values 1-12 are reserved */
619     HTT_SR_RESTRICTED                       = 13,
620     HTT_SR_DELAY                            = 14,
621     HTT_SRP_AND_NON_SRG_OBSS_PD_PROHIBITED  = 15,
622 };
623 typedef enum HTT_PPDU_STATS_SPATIAL_REUSE HTT_PPDU_STATS_SPATIAL_REUSE;
624 
625 #define HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_M    0x3c000000
626 #define HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_S            26
627 
628 #define HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_GET(_var) \
629     (((_var) & HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_M) >> \
630     HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_S)
631 
632 #define HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_SET(_var, _val) \
633     do { \
634         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE, _val); \
635         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_SPATIAL_REUSE_S)); \
636     } while (0)
637 
638 #define HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_M     0x0000003f
639 #define HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_S              0
640 
641 #define HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_GET(_var) \
642     (((_var) & HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_M) >> \
643     HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_S)
644 
645 #define HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_SET(_var, _val) \
646      do { \
647             HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID, _val); \
648             ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BSS_COLOR_ID_S)); \
649     } while (0)
650 
651 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_M     0x00020000
652 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_S             17
653 
654 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_GET(_var) \
655     (((_var) & HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_M) >> \
656     HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_S)
657 
658 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_SET(_var, _val) \
659     do { \
660         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID, _val); \
661         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_VALID_S)); \
662     } while (0)
663 
664 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_M     0x000c0000
665 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_S             18
666 
667 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_GET(_var) \
668     (((_var) & HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_M) >> \
669     HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_S)
670 
671 #define HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_SET(_var, _val) \
672     do { \
673         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_AC_VALID, _val); \
674         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_BACKOFF_AC_S)); \
675     } while (0)
676 
677 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_M     0x00100000
678 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_S             20
679 
680 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_GET(_var) \
681     (((_var) & HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_M) >> \
682     HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_S)
683 
684 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_SET(_var, _val) \
685     do { \
686         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID, _val); \
687         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID_S)); \
688     } while (0)
689 
690 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_M     0x1fe00000
691 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_S             21
692 
693 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_GET(_var) \
694     (((_var) & HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_M) >> \
695     HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_S)
696 
697 #define HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_SET(_var, _val) \
698     do { \
699         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_VALID, _val); \
700         ((_var) |= ((_val) << HTT_PPDU_STATS_COMMON_TLV_NUM_UL_USER_RESPONSES_S)); \
701     } while (0)
702 
703 #define HTT_PPDU_STATS_COMMON_TRIG_COOKIE_M    0x0000ffff
704 #define HTT_PPDU_STATS_COMMON_TRIG_COOKIE_S    0
705 
706 #define HTT_PPDU_STATS_COMMON_TRIG_COOKIE_GET(_val) \
707         (((_val) & HTT_PPDU_STATS_COMMON_TRIG_COOKIE_M) >> \
708          HTT_PPDU_STATS_COMMON_TRIG_COOKIE_S)
709 
710 enum HTT_SEQ_TYPE {
711     WAL_PPDU_SEQ_TYPE = 0,
712     HTT_PPDU_SEQ_TYPE = 1,
713 };
714 
715 typedef struct {
716     htt_tlv_hdr_t tlv_hdr;
717 
718     A_UINT32 ppdu_id;
719     /* BIT [ 15 :   0]   :- sched_cmdid
720      * BIT [ 23 :  16]   :- ring_id
721      * BIT [ 31 :  24]   :- num_users
722      */
723     union {
724         A_UINT32 ring_id__sched_cmdid;
725         struct {
726             A_UINT32 sched_cmdid:   16,
727                      ring_id:        8,
728                      num_users:      8;
729         };
730     };
731     /* BIT [ 7 :   0]   :- frame_type - HTT_STATS_FTYPE
732      * BIT [ 15:   8]   :- queue_type - HTT_TX_QUEUE_TYPE
733      * BIT [ 19:  16]   :- bw - HTT_PPDU_STATS_BW
734      * BIT [ 27:  20]   :- ppdu_seq_type - HTT_PPDU_STATS_SEQ_TYPE
735      * BIT [ 31:  28]   :- mprot_type
736      */
737     union {
738         A_UINT32 bw__queue_type__frame_type;
739         A_UINT32 ppdu_seq_type__bw__queue_type__frame_type;
740         A_UINT32 mprot_type__ppdu_seq_type__bw__queue_type__frame_type;
741         struct {
742             A_UINT32 frame_type:     8,
743                      queue_type:     8,
744                      bw:             4,
745                      ppdu_seq_type:  8,
746                      mprot_type:     4;
747         };
748     };
749     A_UINT32 chain_mask;
750     A_UINT32 fes_duration_us; /* frame exchange sequence */
751     A_UINT32 ppdu_sch_eval_start_tstmp_us;
752     A_UINT32 ppdu_sch_end_tstmp_us;
753     A_UINT32 ppdu_start_tstmp_us;
754     /* BIT [15 :  0] - phy mode (WLAN_PHY_MODE) with which ppdu was transmitted
755      * BIT [31 : 16] - bandwidth (in MHz) with which ppdu was transmitted
756      */
757     union {
758         A_UINT32 chan_mhz__phy_mode;
759         struct {
760             A_UINT32 phy_mode:     16,
761                      chan_mhz:     16;
762         };
763     };
764 
765     /*
766      * The cca_delta_time_us reports the time the tx PPDU in question
767      * was waiting in the HW tx queue for the clear channel assessment
768      * to indicate that the transmission could start.
769      * If this CCA delta time is zero or small, this indicates that the
770      * air interface was unused prior to the transmission, and thus it's
771      * improbable that there was a collision with some other transceiver's
772      * transmission.
773      * In contrast, a large CCA delta time means that this transceiver had
774      * to wait a long time for the air interface to be available; it's
775      * possible that other transceivers were also waiting for the air
776      * interface to become available, and if the other waiting transceiver's
777      * CW backoff aligned with this one, to have a transmit collision.
778      */
779     A_UINT32 cca_delta_time_us;
780 
781     /*
782      * The rxfrm_delta_time_us reports the time the tx PPDU in question
783      * was waiting in the HW tx queue while there was an ongoing rx,
784      * either because the rx was already ongoing at the time the tx PPDU
785      * was enqueued, or because the rx (i.e. the peer's tx) won the air
786      * interface contention over the local vdev's tx.
787      */
788     A_UINT32 rxfrm_delta_time_us;
789 
790     /*
791      * The txfrm_delta_time_us reports the time from when the tx PPDU
792      * in question was enqueued into the HW tx queue until the time the
793      * tx completion interrupt for the PPDU occurred.
794      * Thus, the txfrm_delta_time_us incorporates any time the tx PPDU
795      * had to wait for the air interface to become available, the PPDU
796      * duration, the block ack reception, and the tx completion interrupt
797      * latency.
798      */
799     A_UINT32 txfrm_delta_time_us;
800 
801     /*
802      * The phy_ppdu_tx_time_us reports the time it took to transmit
803      * a PPDU by itself
804      * BIT [15 :  0] - phy_ppdu_tx_time_us reports the time it took to
805      *                 transmit by itself (not including response time)
806      * BIT [23 : 16] - num_ul_expected_users reports the number of users
807      *                 that are expected to respond to this transmission
808      * BIT [24 : 24] - beam_change reports the beam forming pattern
809      *                 between non-HE and HE portion.
810      *                 If we apply TxBF starting from legacy preamble,
811      *                 then beam_change = 0.
812      *                 If we apply TxBF only starting from HE portion,
813      *                 then beam_change = 1.
814      * BIT [25 : 25] - doppler_indication
815      * BIT [29 : 26] - spatial_reuse for HE_SU,HE_MU and HE_EXT_SU format PPDU
816      *                 HTT_PPDU_STATS_SPATIAL_REUSE
817      * BIT [31 : 30] - reserved
818      */
819     union {
820         A_UINT32 reserved__ppdu_tx_time_us;
821         A_UINT32 reserved__num_ul_expected_users__ppdu_tx_time_us;
822         A_UINT32 reserved__spatial_reuse__doppler_indication__beam_change__num_ul_expected_users__ppdu_tx_time_us;
823         struct {
824             A_UINT32 phy_ppdu_tx_time_us:   16,
825                      num_ul_expected_users:  8,
826                      beam_change:            1,
827                      doppler_indication:     1,
828                      spatial_reuse:          4,
829                      reserved1:              2;
830         };
831     };
832 
833     /* ppdu_start_tstmp_u32_us:
834      * Upper 32 bits of the PPDU start timestamp.
835      * This field can be combined with the ppdu_start_tstmp_us field's
836      * lower 32 bits of the PPDU start timestamp to form a 64-bit timestamp.
837      */
838     A_UINT32 ppdu_start_tstmp_u32_us;
839 
840     /*
841      * BIT [5 : 0] - bss_color_id indicates he_bss_color which is an identifier
842      *               of the BSS and is used to assist a receiving STA in
843      *               identifying the BSS from which a PPDU originates.
844      *               Value in the range 0 to 63
845      * BIT [6 : 6] - PPDU transmitted using Non-SRG opportunity
846      * BIT [7 : 7] - PPDU transmitted using SRG opportunity
847      * BIT [15: 8] - RSSI of the aborted OBSS frame (in dB w.r.t. noise floor)
848      *               by which SRG/Non-SRG based spatial reuse opportunity
849      *               was created.
850      * BIT [16:16] - PPDU transmitted using PSR opportunity
851      * BIT [17:17] - backoff_ac_valid
852      * BIT [19:18] - backoff_ac: WMM ACI Value of the backoff engine used for
853      *               this transmission. Only valid if backoff_ac_valid is set
854      *               to 1. Typically this would match the default tid
855      *               number -> AC mapping. For frames in the middle of a SIFS
856      *               burst, the backoff_ac_valid will be 0.
857      * BIT [20:20] - num_ul_user_responses_valid
858      * BIT [21:28] - num_ul_user_responses: The number of user responses
859      *               detected by the MAC layer. This value can be compared with
860      *               the "num_ul_expected_users" field to see whether this frame
861      *               had a complete or partial response failure. Only valid if
862      *               num_ul_user_responses_valid is set to 1.
863      * BIT [31:29] - reserved
864      */
865     union {
866         A_UINT32 reserved__num_ul_user_responses__num_ul_user_responses_valid__backoff_ac__backoff_ac_valid__psr_tx__aborted_obss_rssi__srg_tx__non_srg_tx__bss_color_id;
867         A_UINT32 reserved__psr_tx__aborted_obss_rssi__srg_tx__non_srg_tx___bss_color_id;
868         A_UINT32 reserved__aborted_obss_rssi__srg_tx__non_srg_tx___bss_color_id;
869         A_UINT32 reserved__bss_color_id;
870         struct {
871             A_UINT32 bss_color_id:                6,
872                      non_srg_tx:                  1,
873                      srg_tx:                      1,
874                      aborted_obss_rssi:           8,
875                      psr_tx:                      1,
876                      backoff_ac_valid:            1,
877                      backoff_ac:                  2,
878                      num_ul_user_responses_valid: 1,
879                      num_ul_user_responses:       8,
880                      reserved2:                   3;
881         };
882     };
883 
884     /* Note: This is for tracking a UL OFDMA packet */
885     union {
886         A_UINT32 trig_cookie_info;
887         struct {
888             A_UINT32 trig_cookie: 16,
889                      trig_cookie_rsvd: 15,
890                      trig_cookie_valid: 1;
891         };
892     };
893 
894     /*
895      * BIT [0 : 0] - htt_seq_type field is added for backward compatibility
896      *               with pktlog decoder, host driver or any third party tool
897      *               interpreting ppdu sequence type. If field 'htt_seq_type'
898      *               is not present or is present but set to WAL_PPDU_SEQ_TYPE,
899      *               decoder should interpret the seq type as
900      *               WAL_TXSEND_PPDU_SEQUENCE.
901      *               If the new field htt_seq_type is present and is set to
902      *               HTT_PPDU_SEQ_TYPE then decoder should interpret the
903      *               seq type as HTT_PPDU_STATS_SEQ_TYPE.
904      *               htt_seq_type field will be set to HTT_PPDU_SEQ_TYPE in
905      *               firmware versions where this field is defined.
906      * BIT [31: 1] - reserved
907      */
908     union {
909         A_UINT32 reserved__htt_seq_type;
910         struct {
911             A_UINT32 htt_seq_type:  1,
912                      reserved3:     31;
913         };
914     };
915     /* is_manual_ulofdma_trigger:
916      * Flag to indicate if a given UL OFDMA trigger is manually triggered
917      * from the Host
918      */
919     A_UINT32 is_manual_ulofdma_trigger;
920     /* is_combined_ul_bsrp_trigger:
921      * Flag to indicate if a given UL BSRP trigger is sent combined as
922      * part of existing DL/UL data sequence
923      */
924     A_UINT32 is_combined_ul_bsrp_trigger;
925 } htt_ppdu_stats_common_tlv;
926 
927 #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_M     0x000000ff
928 #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_S              0
929 
930 #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_GET(_var) \
931     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_M) >> \
932     HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_S)
933 
934 #define HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_SET(_var, _val) \
935      do { \
936          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM, _val); \
937          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_TID_NUM_S)); \
938      } while (0)
939 
940 #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_M     0x0000ff00
941 #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_S              8
942 
943 #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_GET(_var) \
944     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_M) >> \
945     HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_S)
946 
947 #define HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_SET(_var, _val) \
948      do { \
949          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID, _val); \
950          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_VAP_ID_S)); \
951      } while (0)
952 
953 #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_M     0xffff0000
954 #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_S             16
955 
956 #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_GET(_var) \
957     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_M) >> \
958     HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_S)
959 
960 #define HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_SET(_var, _val) \
961      do { \
962          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID, _val); \
963          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_SW_PEER_ID_S)); \
964      } while (0)
965 
966 #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_M     0x00000001
967 #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_S              0
968 
969 #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_GET(_var) \
970     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_M) >> \
971     HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_S)
972 
973 #define HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_SET(_var, _val) \
974      do { \
975          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_MCAST, _val); \
976          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_MCAST_S)); \
977      } while (0)
978 
979 #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_M     0x000003fe
980 #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_S              1
981 
982 #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_GET(_var) \
983     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_M) >> \
984     HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_S)
985 
986 #define HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_SET(_var, _val) \
987      do { \
988          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED, _val); \
989          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_MPDUS_TRIED_S)); \
990      } while (0)
991 
992 #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_M     0x00003c00
993 #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_S             10
994 
995 #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_GET(_var) \
996     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_BW_M) >> \
997     HTT_PPDU_STATS_USER_COMMON_TLV_BW_S)
998 
999 #define HTT_PPDU_STATS_USER_COMMON_TLV_BW_SET(_var, _val) \
1000      do { \
1001          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_BW, _val); \
1002          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_BW_S)); \
1003      } while (0)
1004 
1005 #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_M     0x00004000
1006 #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_S             14
1007 
1008 #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_GET(_var) \
1009     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_M) >> \
1010     HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_S)
1011 
1012 #define HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_SET(_var, _val) \
1013      do { \
1014          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA, _val); \
1015          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_DELAYED_BA_S)); \
1016      } while (0)
1017 
1018 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_M     0x00008000
1019 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_S             15
1020 
1021 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_GET(_var) \
1022     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_M) >> \
1023     HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_S)
1024 
1025 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_SET(_var, _val) \
1026      do { \
1027          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER, _val); \
1028          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_IS_SQNUM_VALID_IN_BUFFER_S)); \
1029      } while (0)
1030 
1031 #define HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_M     0xffff0000
1032 #define HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_S             16
1033 
1034 #define HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_GET(_var) \
1035     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_M) >> \
1036     HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_S)
1037 
1038 #define HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_SET(_var, _val) \
1039     do { \
1040         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES, _val); \
1041         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_NUM_FRAMES_S)); \
1042     } while (0)
1043 
1044 #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_M     0x0000ffff
1045 #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_S              0
1046 
1047 #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_GET(_var) \
1048     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_M) >> \
1049     HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_S)
1050 
1051 #define HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_SET(_var, _val) \
1052      do { \
1053          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL, _val); \
1054          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_FRAME_CTRL_S)); \
1055      } while (0)
1056 
1057 #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_M     0xffff0000
1058 #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_S             16
1059 
1060 #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_GET(_var) \
1061     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_M) >> \
1062     HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_S)
1063 
1064 #define HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_SET(_var, _val) \
1065      do { \
1066          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL, _val); \
1067          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_QOS_CTRL_S)); \
1068      } while (0)
1069 
1070 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_M 0x000000ff
1071 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_S          0
1072 
1073 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_GET(_var) \
1074     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_M) >> \
1075     HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_S)
1076 
1077 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_SET(_var, _val) \
1078      do { \
1079          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER, _val); \
1080          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MULTIPLIER_S)); \
1081      } while (0)
1082 
1083 #define HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_M 0x0000ff00
1084 #define HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_S          8
1085 
1086 #define HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_GET(_var) \
1087     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_M) >> \
1088     HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_S)
1089 
1090 #define HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_SET(_var, _val) \
1091      do { \
1092          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS, _val); \
1093          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_CHAIN_ENABLE_BITS_S)); \
1094      } while (0)
1095 
1096 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_M  0x00010000
1097 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_S          16
1098 
1099 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_GET(_var) \
1100     (((_var) & HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_M) >> \
1101     HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_S)
1102 
1103 #define HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_SET(_var, _val) \
1104      do { \
1105          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG, _val); \
1106          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_COMMON_TLV_IS_SMART_ULOFDMA_BASIC_TRIG_S)); \
1107      } while (0)
1108 
1109 
1110 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32 4
1111 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MASK 0x000000ff
1112 
1113 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_GET(tlv, chain_idx) \
1114     ((A_INT8) ((tlv)->tx_pwr[(chain_idx)/HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32] >> \
1115         ((chain_idx)%HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32)*8) & HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MASK)
1116 #define HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_SET(tlv, chain_idx, value) \
1117     (tlv)->tx_pwr[chain_idx/HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32] = \
1118         (tlv)->tx_pwr[chain_idx/HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32] & \
1119             ~(0xff << (((chain_idx)%HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32)*8)) | \
1120             (((value)<<((chain_idx)%HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32)*8))
1121 
1122 #define HTT_PPDU_STATS_USER_COMMON_TLV_ALT_TX_PWR_GET(tlv, chain_idx) \
1123     ((A_INT8) ((tlv)->alt_tx_pwr[(chain_idx)/HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32] >> \
1124         ((chain_idx)%HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32)*8) & HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_MASK)
1125 #define HTT_PPDU_STATS_USER_COMMON_TLV_ALT_TX_PWR_SET(tlv, chain_idx, value) \
1126     (tlv)->alt_tx_pwr[chain_idx/HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32] = \
1127         (tlv)->alt_tx_pwr[chain_idx/HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32] & \
1128             ~(0xff << (((chain_idx)%HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32)*8)) | \
1129             (((value)<<((chain_idx)%HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32)*8))
1130 
1131 typedef struct {
1132     htt_tlv_hdr_t tlv_hdr;
1133 
1134     /* BIT [ 7 :   0]   :- tid_num
1135      * BIT [ 15:   8]   :- vap_id
1136      * BIT [ 31:  16]   :- sw_peer_id
1137      */
1138     union {
1139         A_UINT32 sw_peer_id__vapid__tid_num;
1140         struct {
1141             A_UINT32 tid_num:           8,
1142                      vap_id:            8,
1143                      sw_peer_id:       16;
1144         };
1145     };
1146 
1147     /* BIT [ 0 :    0]   :- mcast
1148      * BIT [ 9 :    1]   :- mpdus_tried
1149      * BIT [ 13:   10]   :- bw - HTT_PPDU_STATS_BW
1150      * BIT [ 14:   14]   :- delayed_ba
1151      * BIT [ 15:   15]   :- rsvd
1152      * BIT [ 31:   16]   :- num_frames - num of MSDUs + num of MPDUs
1153      */
1154     union {
1155         A_UINT32 bw__mpdus_tried__mcast;
1156         struct {
1157             A_UINT32 mcast:                    1,
1158                      mpdus_tried:              9,
1159                      bw:                       4,
1160                      delayed_ba:               1,
1161                      is_sqno_valid_in_buffer:  1,
1162                      num_frames:              16;
1163         };
1164     };
1165 
1166     /* BIT [ 15:   0]   :- frame_ctrl
1167      * BIT [ 31:  16]   :- qos_ctrl
1168      */
1169     union {
1170         A_UINT32 qos_ctrl_frame_ctrl;
1171         struct {
1172             A_UINT32 frame_ctrl:       16,
1173                      qos_ctrl:         16;
1174         };
1175     };
1176 
1177     /*
1178      * Data fields containing the physical address info of a MSDU buffer
1179      * as well as the owner and a SW cookie info that can be used by the host
1180      * to look up the virtual address of the MSDU buffer.
1181      * These fields are only valid if is_buffer_addr_info_valid is set to 1.
1182      */
1183      A_UINT32 buffer_paddr_31_0       : 32;
1184      A_UINT32 buffer_paddr_39_32      :  8,
1185               return_buffer_manager   :  3,
1186               sw_buffer_cookie        : 21;
1187 
1188     /*
1189      * host_opaque_cookie : Host can send upto 2 bytes of opaque
1190      * cookie in TCL_DATA_CMD and FW will replay this back in
1191      * HTT PPDU stats. Valid only if sent to FW through
1192      * exception mechanism.
1193      *
1194      * is_standalone : This msdu was sent as a single MSDU/MPDU
1195      * PPDU as indicated by host via TCL_DATA_CMD using
1196      * the send_as_standalone bit.
1197      *
1198      * is_buffer_addr_info_valid : This will be set whenever a MSDU is sent as
1199      * a singleton (single-MSDU PPDU) for FW use-cases or as indicated by host
1200      * via send_as_standalone in TCL_DATA_CMD.
1201      *
1202      * The fields is_sw_rts_enabled, is_hw_rts_enabled, is_sfm_war_enabled
1203      * indicate whether SW RTS, HW RTS, SFM WAR are enabled for the
1204      * current Tx-sequence respectively.
1205      */
1206     A_UINT32 host_opaque_cookie:        16,
1207              is_host_opaque_valid:       1,
1208              is_standalone:              1,
1209              is_buffer_addr_info_valid:  1,
1210              is_sw_rts_enabled:          1,
1211              is_hw_rts_enabled:          1,
1212              is_sfm_war_enabled:         1,
1213              reserved1:                 10;
1214 
1215     /* qdepth bytes : Contains Number of bytes of TIDQ depth */
1216     A_UINT32 qdepth_bytes;
1217     A_UINT32 full_aid : 12,
1218              reserved : 20;
1219 
1220     /* data_frm_ppdu_id:
1221      * Note - this is valid in case delayed BA processing specifically for
1222      * BAR frames*/
1223     A_UINT32 data_frm_ppdu_id;
1224 
1225     /* sw_rts_prot_dur_us:
1226      * SW RTS protection duration in micro sec.
1227      * Note - this is valid if SW RTS was used instead of HW RTS.
1228      */
1229     A_UINT32 sw_rts_prot_dur_us;
1230 
1231     /* tx_pwr_multiplier:
1232      * Hawkeye now supports power accuracy in 0.25 dBm steps,
1233      * so all powers are x4.
1234      * This is needed to resolve compatibility issues with previous
1235      * generation chipsets.
1236      * API in halphy phyrf_bdf_GetMaxRatePwrMultiplier, used to find out
1237      * what the multiplier and use that to correctly report the TPC value
1238      * to host.
1239      *
1240      * chain_enable_bits:
1241      * Indicates the valid tx_pwr values in the tx_pwr field.
1242      * Default value: 1
1243      * tx_pwr[0] value is used for all chains if chain_enable_bits field
1244      * is set to 1.
1245      *
1246      * is_smart_ulofdma_basic_trig:
1247      * To check if user grouped in UL OFDMA Basic Trigger Frame is
1248      * due to Smart Basic Trigger.
1249      */
1250     A_UINT32 tx_pwr_multiplier          :  8,
1251              chain_enable_bits          :  8,
1252              is_smart_ulofdma_basic_trig:  1,
1253              is_primary_link_peer       :  1,
1254              reserved2                  : 14;
1255 
1256     /*
1257      * Transmit powers (signed values packed into unsigned bitfields)
1258      * in units of 0.25 dBm per chain.
1259      * To report the tx_pwr value in dBm units, stored value has to be
1260      * divided with tx_pwr_multiplier field.
1261      * Per chain tx_pwr configuration is not available for all chipsets.
1262      * Use tx_pwr[0] value for all chains if chain_enable_bits field
1263      * is set to 1.
1264      * Each chain uses 1 byte to store the transmit power.
1265      * The bytes within a A_UINT32 use little-endian order,
1266      * i.e. bits 7:0 of tx_pwr[0] store the tx pwr for chain 0,
1267      * bits 15:8 of tx_pwr[0] store the tx pwr for chain 1, etc.
1268      * Since HTT_STATS_MAX_CHAINS is a multiple of 4, no rounding is needed
1269      * to determine the number of A_UINT32 array elements.
1270      * Any bytes that exceed the number of chains with valid
1271      * tx_pwr data will be filled with 0x00.
1272      * When packing the 1-byte tx_pwr values into the A_UINT32,
1273      * masking is needed to keep the sign bits from clobbering
1274      * the higher bytes.
1275      * When extracting the 1-byte tx_pwr values from the A_UINT32,
1276      * sign-extension is needed if the variable holding the extracted
1277      * value is larger than A_INT8.
1278      */
1279     A_UINT32 tx_pwr[HTT_STATS_MAX_CHAINS / HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32];
1280 
1281     /*
1282      * Transmit powers for the alternate transmit descriptor used for BT COEX
1283      * (signed values packed into unsigned bitfields) in units of
1284      * 0.25 dBm per chain.
1285      * Not used by the host currently.
1286      * To report the alt_tx_pwr value in dBm units, stored value has to be
1287      * divided with tx_pwr_multiplier field.
1288      * Per chain alt_tx_pwr configuration is not available for all chipsets.
1289      * Use alt_tx_pwr[0] value for all chains if chain_enable_bits field
1290      * is set to 1.
1291      * Each chain uses 1 byte to store the alternate transmit power.
1292      * The bytes within a A_UINT32 use little-endian order,
1293      * i.e. bits 7:0 of alt_tx_pwr[0] store the alt tx pwr for chain 0,
1294      * bits 15:8 of alt_tx_pwr[0] store the alt tx pwr for chain 1, etc.
1295      * Since HTT_STATS_MAX_CHAINS is a multiple of 4, no rounding is needed
1296      * to determine the number of A_UINT32 array elements.
1297      * Any bytes that exceed the number of chains with valid
1298      * alt_tx_pwr data will be filled with 0x00.
1299      * When packing the 1-byte alt_tx_pwr values into the A_UINT32,
1300      * masking is needed to keep the sign bits from clobbering
1301      * the higher bytes.
1302      * When extracting the 1-byte alt_tx_pwr values from the A_UINT32,
1303      * sign-extension is needed if the variable holding the extracted
1304      * value is larger than A_INT8.
1305      */
1306     A_UINT32 alt_tx_pwr[HTT_STATS_MAX_CHAINS / HTT_PPDU_STATS_USER_COMMON_TLV_TX_PWR_CHAINS_PER_U32];
1307 
1308     /*
1309      * A bitmap indicating the MSDUQs that the scheduler is attempting to
1310      * transmit in this PPDU. Note that in some cases, the scheduler's notion
1311      * of what MSDUQs are being transmitted from may not be fully accurate,
1312      * such as when MPDUs are retried, or when some previously generated MPDUs
1313      * that were not attempted OTA yet are tried.
1314      *
1315      * The valid bit indices for this bitmap are defined by the HTT_MSDUQ_INDEX
1316      * enum (in htt.h). For example, (1 << HTT_MSDUQ_INDEX_UDP) would
1317      * correspond to the default UDP msduq.
1318      */
1319     A_UINT32 msduq_bitmap;
1320 } htt_ppdu_stats_user_common_tlv;
1321 
1322 #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_M     0x000000ff
1323 #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_S              0
1324 
1325 #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_GET(_var) \
1326     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_M) >> \
1327     HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_S)
1328 
1329 #define HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_SET(_var, _val) \
1330      do { \
1331          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM, _val); \
1332          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_TID_NUM_S)); \
1333      } while (0)
1334 
1335 #define HTT_PPDU_STATS_USER_RATE_TLV_RESERVED_M     0x0000ff00
1336 #define HTT_PPDU_STATS_USER_RATE_TLV_RESERVED_S              8
1337 
1338 
1339 #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_M     0xffff0000
1340 #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_S             16
1341 
1342 #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_GET(_var) \
1343     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_M) >> \
1344     HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_S)
1345 
1346 #define HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_SET(_var, _val) \
1347      do { \
1348          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID, _val); \
1349          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_SW_PEER_ID_S)); \
1350      } while (0)
1351 
1352 #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_M     0x0000000f
1353 #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_S              0
1354 
1355 #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_GET(_var) \
1356     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_M) >> \
1357     HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_S)
1358 
1359 #define HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_SET(_var, _val) \
1360      do { \
1361          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_USER_POS, _val); \
1362          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_USER_POS_S)); \
1363      } while (0)
1364 
1365 #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_M     0x00000ff0
1366 #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_S              4
1367 
1368 #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_GET(_var) \
1369     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_M) >> \
1370     HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_S)
1371 
1372 #define HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_SET(_var, _val) \
1373      do { \
1374          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID, _val); \
1375          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_MU_GROUPID_S)); \
1376      } while (0)
1377 
1378 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_M     0x0000ffff
1379 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S              0
1380 
1381 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_GET(_var) \
1382     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_END_M) >> \
1383     HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S)
1384 
1385 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_SET(_var, _val) \
1386      do { \
1387          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_END, _val); \
1388          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S)); \
1389      } while (0)
1390 
1391 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_M     0xffff0000
1392 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S             16
1393 
1394 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_GET(_var) \
1395     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_START_M) >> \
1396     HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S)
1397 
1398 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_SET(_var, _val) \
1399      do { \
1400          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_START, _val); \
1401          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S)); \
1402      } while (0)
1403 
1404 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_M     0x00000001
1405 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_S              0
1406 
1407 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_GET(_var) \
1408     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_M) >> \
1409     HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_S)
1410 
1411 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_SET(_var, _val) \
1412      do { \
1413          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID, _val); \
1414          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_TYPE_VALID_S)); \
1415      } while (0)
1416 
1417 
1418 #define HTT_PPDU_STATS_BUF_ADDR_39_32_M     0x000000ff
1419 #define HTT_PPDU_STATS_BUF_ADDR_39_32_S              0
1420 
1421 #define HTT_PPDU_STATS_BUF_ADDR_39_32__GET(_var) \
1422     (((_var) & HTT_PPDU_STATS_BUF_ADDR_39_32_M) >> \
1423     HTT_PPDU_STATS_BUF_ADDR_39_32_S)
1424 
1425 #define HTT_PPDU_STATS_BUF_ADDR_39_32_SET(_var, _val) \
1426      do { \
1427          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_BUF_ADDR_39_32, _val); \
1428          ((_var) |= ((_val) << HTT_PPDU_STATS_BUF_ADDR_39_32_S)); \
1429      } while (0)
1430 
1431 
1432 #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_M     0x00000700
1433 #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_S              8
1434 
1435 #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_GET(_var) \
1436     (((_var) & HTT_PPDU_STATS_RETURN_BUF_MANAGER_M) >> \
1437     HTT_PPDU_STATS_RETURN_BUF_MANAGER_S)
1438 
1439 #define HTT_PPDU_STATS_RETURN_BUF_MANAGER_SET(_var, _val) \
1440      do { \
1441          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_RETURN_BUF_MANAGER, _val); \
1442          ((_var) |= ((_val) << HTT_PPDU_STATS_RETURN_BUF_MANAGER_S)); \
1443      } while (0)
1444 
1445 
1446 #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_M     0xfffff800
1447 #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_S             11
1448 
1449 #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_GET(_var) \
1450     (((_var) & HTT_PPDU_STATS_SW_BUFFER_COOKIE_M) >> \
1451     HTT_PPDU_STATS_SW_BUFFER_COOKIE_S)
1452 
1453 #define HTT_PPDU_STATS_SW_BUFFER_COOKIE_SET(_var, _val) \
1454      do { \
1455          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_SW_BUFFER_COOKIE, _val); \
1456          ((_var) |= ((_val) << HTT_PPDU_STATS_SW_BUFFER_COOKIE_S)); \
1457      } while (0)
1458 
1459 
1460 #define HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_M     0x0000FFFF
1461 #define HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_S              0
1462 
1463 #define HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_GET(_var) \
1464     (((_var) & HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_M) >> \
1465     HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_S)
1466 
1467 #define HTT_PPDU_STAT_HOST_OPAQUE_COOKIE_SET(_var, _val) \
1468      do { \
1469          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_HOST_OPAQUE_COOKIE, _val); \
1470          ((_var) |= ((_val) << HTT_PPDU_STATS_HOST_OPAQUE_COOKIE_S)); \
1471      } while (0)
1472 
1473 
1474 #define HTT_PPDU_STATS_IS_OPAQUE_VALID_M        0x00010000
1475 #define HTT_PPDU_STATS_IS_OPAQUE_VALID_S                16
1476 
1477 #define HTT_PPDU_STATS_IS_OPAQUE_VALID_GET(_var) \
1478     (((_var) & HTT_PPDU_STATS_IS_OPAQUE_VALID_M) >> \
1479     HTT_PPDU_STATS_IS_OPAQUE_VALID_S)
1480 
1481 #define HTT_PPDU_STATS_IS_OPAQUE_VALID_SET(_var, _val) \
1482      do { \
1483          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_IS_OPAQUE_VALID, _val); \
1484          ((_var) |= ((_val) << HTT_PPDU_STATS_IS_OPAQUE_VALID_S)); \
1485      } while (0)
1486 
1487 
1488 #define HTT_PPDU_STATS_IS_STANDALONE_M          0x00020000
1489 #define HTT_PPDU_STATS_IS_STANDALONE_S                  17
1490 
1491 #define HTT_PPDU_STATS_IS_STANDALONE_GET(_var) \
1492     (((_var) & HTT_PPDU_STATS_IS_STANDALONE_M) >> \
1493     HTT_PPDU_STATS_IS_OPAQUE_VALID_S)
1494 
1495 #define HTT_PPDU_STATS_IS_STANDALONE_SET(_var, _val) \
1496      do { \
1497          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_IS_STANDALONE, _val); \
1498          ((_var) |= ((_val) << HTT_PPDU_STATS_IS_STANDALONE_S)); \
1499      } while (0)
1500 
1501 
1502 #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_M          0x000400000
1503 #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_S                   18
1504 
1505 #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_GET(_var) \
1506     (((_var) & HTT_PPDU_STATS_IS_BUFF_INFO_VALID_M) >> \
1507     HTT_PPDU_STATS_IS_BUFF_INFO_VALID_S)
1508 
1509 #define HTT_PPDU_STATS_IS_BUFF_INFO_VALID_SET(_var, _val) \
1510      do { \
1511          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_IS_BUFF_INFO_VALID, _val); \
1512          ((_var) |= ((_val) << HTT_PPDU_STATS_IS_BUFF_INFO_VALID_S)); \
1513      } while (0)
1514 
1515 enum HTT_PPDU_STATS_PPDU_TYPE {
1516     HTT_PPDU_STATS_PPDU_TYPE_SU,
1517     HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO,
1518     HTT_PPDU_STATS_PPDU_TYPE_MU_OFDMA,
1519     HTT_PPDU_STATS_PPDU_TYPE_MU_MIMO_OFDMA,
1520     HTT_PPDU_STATS_PPDU_TYPE_UL_TRIG,
1521     HTT_PPDU_STATS_PPDU_TYPE_BURST_BCN,
1522     HTT_PPDU_STATS_PPDU_TYPE_UL_BSR_RESP,
1523     HTT_PPDU_STATS_PPDU_TYPE_UL_BSR_TRIG,
1524     HTT_PPDU_STATS_PPDU_TYPE_UL_RESP,
1525 
1526     HTT_PPDU_STATS_PPDU_TYPE_UNKNOWN = 0x1F,
1527 };
1528 typedef enum HTT_PPDU_STATS_PPDU_TYPE HTT_PPDU_STATS_PPDU_TYPE;
1529 
1530 #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_M     0x0000003E
1531 #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_S              1
1532 
1533 #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_GET(_var) \
1534     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_M) >> \
1535     HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_S)
1536 
1537 #define HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_SET(_var, _val) \
1538      do { \
1539          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE, _val); \
1540          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_PPDU_TYPE_S)); \
1541      } while (0)
1542 
1543 enum HTT_PPDU_STATS_TXBF_TYPE {
1544     HTT_PPDU_STATS_TXBF_OPEN_LOOP,
1545     HTT_PPDU_STATS_TXBF_IMPLICIT,
1546     HTT_PPDU_STATS_TXBF_EXPLICIT,
1547     HTT_PPDU_STATS_TXBF_MAX,
1548 };
1549 
1550 #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_M     0x00000003
1551 #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_S              0
1552 
1553 #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_GET(_var) \
1554     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_M) >> \
1555     HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_S)
1556 
1557 #define HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_SET(_var, _val) \
1558      do { \
1559          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE, _val); \
1560          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_LTF_SIZE_S)); \
1561      } while (0)
1562 
1563 #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_M     0x00000004
1564 #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_S              2
1565 
1566 #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_GET(_var) \
1567     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_STBC_M) >> \
1568     HTT_PPDU_STATS_USER_RATE_TLV_STBC_S)
1569 
1570 #define HTT_PPDU_STATS_USER_RATE_TLV_STBC_SET(_var, _val) \
1571      do { \
1572          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_STBC, _val); \
1573          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_STBC_S)); \
1574      } while (0)
1575 
1576 #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_M     0x00000008
1577 #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_S              3
1578 
1579 #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_GET(_var) \
1580     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_M) >> \
1581     HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_S)
1582 
1583 #define HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_SET(_var, _val) \
1584      do { \
1585          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_HE_RE, _val); \
1586          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_HE_RE_S)); \
1587      } while (0)
1588 
1589 #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_M     0x000000f0
1590 #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_S              4
1591 
1592 #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_GET(_var) \
1593     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_TXBF_M) >> \
1594     HTT_PPDU_STATS_USER_RATE_TLV_TXBF_S)
1595 
1596 #define HTT_PPDU_STATS_USER_RATE_TLV_TXBF_SET(_var, _val) \
1597      do { \
1598          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_TXBF, _val); \
1599          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_TXBF_S)); \
1600      } while (0)
1601 
1602 #define HTT_PPDU_STATS_USER_RATE_TLV_BW_M     0x00000f00
1603 #define HTT_PPDU_STATS_USER_RATE_TLV_BW_S              8
1604 
1605 #define HTT_PPDU_STATS_USER_RATE_TLV_BW_GET(_var) \
1606     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_BW_M) >> \
1607     HTT_PPDU_STATS_USER_RATE_TLV_BW_S)
1608 
1609 #define HTT_PPDU_STATS_USER_RATE_TLV_BW_SET(_var, _val) \
1610      do { \
1611          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_BW, _val); \
1612          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_BW_S)); \
1613      } while (0)
1614 
1615 #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_M     0x0000f000
1616 #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_S             12
1617 
1618 #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_GET(_var) \
1619     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_NSS_M) >> \
1620     HTT_PPDU_STATS_USER_RATE_TLV_NSS_S)
1621 
1622 #define HTT_PPDU_STATS_USER_RATE_TLV_NSS_SET(_var, _val) \
1623      do { \
1624          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_NSS, _val); \
1625          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_NSS_S)); \
1626      } while (0)
1627 
1628 #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_M     0x000f0000
1629 #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_S             16
1630 
1631 #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_GET(_var) \
1632     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_MCS_M) >> \
1633     HTT_PPDU_STATS_USER_RATE_TLV_MCS_S)
1634 
1635 #define HTT_PPDU_STATS_USER_RATE_TLV_MCS_SET(_var, _val) \
1636      do { \
1637          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_MCS, _val); \
1638          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_MCS_S)); \
1639      } while (0)
1640 
1641 /* Refer HTT_STATS_PREAM_TYPE */
1642 #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_M     0x00f00000
1643 #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_S             20
1644 
1645 #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_GET(_var) \
1646     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_M) >> \
1647     HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_S)
1648 
1649 #define HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_SET(_var, _val) \
1650      do { \
1651          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE, _val); \
1652          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_PREAMBLE_S)); \
1653      } while (0)
1654 
1655 /* Guard Intervals */
1656 enum HTT_PPDU_STATS_GI {
1657     HTT_PPDU_STATS_GI_800,
1658     HTT_PPDU_STATS_GI_400,
1659     HTT_PPDU_STATS_GI_1600,
1660     HTT_PPDU_STATS_GI_3200,
1661     HTT_PPDU_STATS_GI_CNT,
1662 };
1663 typedef enum HTT_PPDU_STATS_GI HTT_PPDU_STATS_GI;
1664 
1665 /* Refer HTT_PPDU_STATS_GI */
1666 #define HTT_PPDU_STATS_USER_RATE_TLV_GI_M     0x0f000000
1667 #define HTT_PPDU_STATS_USER_RATE_TLV_GI_S             24
1668 
1669 #define HTT_PPDU_STATS_USER_RATE_TLV_GI_GET(_var) \
1670     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_GI_M) >> \
1671     HTT_PPDU_STATS_USER_RATE_TLV_GI_S)
1672 
1673 #define HTT_PPDU_STATS_USER_RATE_TLV_GI_SET(_var, _val) \
1674      do { \
1675          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_GI, _val); \
1676          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_GI_S)); \
1677      } while (0)
1678 
1679 
1680 #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_M     0x10000000
1681 #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_S             28
1682 
1683 #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_GET(_var) \
1684     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_DCM_M) >> \
1685     HTT_PPDU_STATS_USER_RATE_TLV_DCM_S)
1686 
1687 #define HTT_PPDU_STATS_USER_RATE_TLV_DCM_SET(_var, _val) \
1688      do { \
1689          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_DCM, _val); \
1690          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_DCM_S)); \
1691      } while (0)
1692 
1693 #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_M     0x20000000
1694 #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_S             29
1695 
1696 #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_GET(_var) \
1697     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_LDPC_M) >> \
1698     HTT_PPDU_STATS_USER_RATE_TLV_LDPC_S)
1699 
1700 #define HTT_PPDU_STATS_USER_RATE_TLV_LDPC_SET(_var, _val) \
1701      do { \
1702          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_LDPC, _val); \
1703          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_LDPC_S)); \
1704      } while (0)
1705 
1706 enum HTT_PPDU_STATS_RESP_PPDU_TYPE {
1707     HTT_PPDU_STATS_RESP_PPDU_TYPE_MU_MIMO_UL,
1708     HTT_PPDU_STATS_RESP_PPDU_TYPE_MU_OFDMA_UL,
1709 };
1710 typedef enum HTT_PPDU_STATS_RESP_PPDU_TYPE HTT_PPDU_STATS_RESP_PPDU_TYPE;
1711 
1712 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_M     0xC0000000
1713 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_S             30
1714 
1715 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_GET(_var) \
1716     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_M) >> \
1717     HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_S)
1718 
1719 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_SET(_var, _val) \
1720      do { \
1721          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE, _val); \
1722          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_PPDU_TYPE_S)); \
1723      } while (0)
1724 
1725 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_M        0x0000f000
1726 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_S                12
1727 
1728 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_GET(_var) \
1729     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_M) >> \
1730     HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_S)
1731 
1732 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_SET(_var, _val) \
1733      do { \
1734          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT, _val); \
1735          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_FORMAT_S)); \
1736      } while (0)
1737 
1738 
1739 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_M           0x0000ffff
1740 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S                    0
1741 
1742 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_GET(_var) \
1743     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_END_M) >> \
1744     HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S)
1745 
1746 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_END_SET(_var, _val) \
1747      do { \
1748          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_END, _val); \
1749          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_END_S)); \
1750      } while (0)
1751 
1752 
1753 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_M         0xffff0000
1754 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S                 16
1755 
1756 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_GET(_var) \
1757     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_START_M) >> \
1758     HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S)
1759 
1760 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_START_SET(_var, _val) \
1761      do { \
1762          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_START, _val); \
1763          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_START_S)); \
1764      } while (0)
1765 
1766 
1767 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_M         0x0000ffff
1768 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_S                  0
1769 
1770 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_GET(_var) \
1771     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_M) >> \
1772     HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_S)
1773 
1774 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_SET(_var, _val) \
1775      do { \
1776          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX, _val); \
1777          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_INDEX_S)); \
1778      } while (0)
1779 
1780 
1781 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_M          0xffff0000
1782 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_S                  16
1783 
1784 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_GET(_var) \
1785     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_M) >> \
1786     HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_S)
1787 
1788 #define HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_SET(_var, _val) \
1789      do { \
1790          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE, _val); \
1791          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RU_SIZE_S)); \
1792      } while (0)
1793 
1794 
1795 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_M      0x0000ffff
1796 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_S               0
1797 
1798 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_GET(_var) \
1799     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_M) >> \
1800     HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_S)
1801 
1802 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_SET(_var, _val) \
1803      do { \
1804          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END, _val); \
1805          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_END_S)); \
1806      } while (0)
1807 
1808 
1809 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_M    0xffff0000
1810 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_S            16
1811 
1812 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_GET(_var) \
1813     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_M) >> \
1814     HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_S)
1815 
1816 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_SET(_var, _val) \
1817      do { \
1818          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START, _val); \
1819          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_START_S)); \
1820      } while (0)
1821 
1822 
1823 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_M    0x0000ffff
1824 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_S             0
1825 
1826 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_GET(_var) \
1827     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_M) >> \
1828     HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_S)
1829 
1830 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_SET(_var, _val) \
1831      do { \
1832          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX, _val); \
1833          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_INDEX_S)); \
1834      } while (0)
1835 
1836 
1837 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_M     0xffff0000
1838 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_S             16
1839 
1840 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_GET(_var) \
1841     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_M) >> \
1842     HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_S)
1843 
1844 #define HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_SET(_var, _val) \
1845      do { \
1846          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE, _val); \
1847          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_RESP_RU_SIZE_S)); \
1848      } while (0)
1849 
1850 #define HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_M  0x0000ffff
1851 #define HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_S           0
1852 
1853 #define HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_GET(_var) \
1854     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_M) >> \
1855     HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_S)
1856 
1857 #define HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_SET (_var , _val) \
1858     do { \
1859         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP, _val); \
1860         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_PUNC_PATTERN_BITMAP_S)); \
1861     } while (0)
1862 
1863 #define HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_M  0x00010000
1864 #define HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_S          16
1865 
1866 #define HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_GET(_var) \
1867     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_M) >> \
1868     HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_S)
1869 
1870 #define HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_SET (_var , _val) \
1871     do { \
1872         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF, _val); \
1873         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_EXTRA_EHT_LTF_S)); \
1874     } while (0)
1875 
1876 #define HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_M  0x00020000
1877 #define HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_S          17
1878 
1879 #define HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_GET(_var) \
1880     (((_var) & HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_M) >> \
1881     HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_S)
1882 
1883 #define HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_SET (_var , _val) \
1884     do { \
1885         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE, _val); \
1886         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_RATE_TLV_IS_MIN_RATE_S)); \
1887     } while (0)
1888 
1889 typedef enum HTT_PPDU_STATS_RU_SIZE {
1890     HTT_PPDU_STATS_RU_26,
1891     HTT_PPDU_STATS_RU_52,
1892     HTT_PPDU_STATS_RU_52_26,
1893     HTT_PPDU_STATS_RU_106,
1894     HTT_PPDU_STATS_RU_106_26,
1895     HTT_PPDU_STATS_RU_242,
1896     HTT_PPDU_STATS_RU_484,
1897     HTT_PPDU_STATS_RU_484_242,
1898     HTT_PPDU_STATS_RU_996,
1899     HTT_PPDU_STATS_RU_996_484,
1900     HTT_PPDU_STATS_RU_996_484_242,
1901     HTT_PPDU_STATS_RU_996x2,
1902     HTT_PPDU_STATS_RU_996x2_484,
1903     HTT_PPDU_STATS_RU_996x3,
1904     HTT_PPDU_STATS_RU_996x3_484,
1905     HTT_PPDU_STATS_RU_996x4,
1906 } HTT_PPDU_STATS_RU_SIZE;
1907 
1908 typedef struct {
1909     htt_tlv_hdr_t tlv_hdr;
1910 
1911     /* BIT [ 7 :   0]   :- tid_num
1912      * BIT [ 15:   8]   :- reserved0
1913      * BIT [ 31:  16]   :- sw_peer_id
1914      */
1915     union {
1916         A_UINT32 sw_peer_id__tid_num;
1917         struct {
1918             A_UINT32 tid_num:            8,
1919                      reserved0:          8,
1920                      sw_peer_id:        16;
1921         };
1922     };
1923 
1924     /* BIT [ 3 :   0]   :- user_pos
1925      * BIT [ 11:   4]   :- mu_group_id
1926      * BIT [ 15:  12]   :- ru_format
1927      * BIT [ 31:  16]   :- reserved1
1928      */
1929     union {
1930         A_UINT32 mu_group_id__user_pos;
1931         struct {
1932             A_UINT32 user_pos:           4,
1933                      mu_group_id:        8,
1934                      ru_format:          4,
1935                      reserved1:         16;
1936         };
1937     };
1938 
1939     /* BIT [ 15 :   0]   :- ru_end or ru_index
1940      * BIT [ 31 :  16]   :- ru_start or ru_size
1941      *
1942      * Discriminant is field ru_format:
1943      *     - ru_format = 0: ru_end, ru_start
1944      *     - ru_format = 1: ru_index, ru_size
1945      *     - ru_format = other: reserved for future expansion
1946      *
1947      * ru_start and ru_end are RU 26 indices
1948      *
1949      * ru_size is an HTT_PPDU_STATS_RU_SIZE, ru_index is a size
1950      * specific index for the given ru_size.
1951      */
1952     union {
1953         A_UINT32 ru_start__ru_end;
1954         A_UINT32 ru_size__ru_index;
1955         struct {
1956             A_UINT32 ru_end:   16,
1957                      ru_start: 16;
1958         };
1959         struct {
1960             A_UINT32 ru_index: 16,
1961                      ru_size:  16;
1962         };
1963     };
1964 
1965     /* BIT [ 15 :   0]   :- resp_ru_end or resp_ru_index
1966      * BIT [ 31 :  16]   :- resp_ru_start or resp_ru_size
1967      *
1968      * Discriminant is field ru_format:
1969      *     - ru_format = 0: resp_ru_end, resp_ru_start
1970      *     - ru_format = 1: resp_ru_index, resp_ru_size
1971      *     - ru_format = other: reserved for future expansion
1972      *
1973      * resp_ru_start and resp_ru_end are RU 26 indices
1974      *
1975      * resp_ru_size is an HTT_PPDU_STATS_RU_SIZE, resp_ru_index
1976      * is a size specific index for the given ru_size.
1977      */
1978     union {
1979         A_UINT32 resp_ru_start__ru_end;
1980         A_UINT32 resp_ru_size__ru_index;
1981         struct {
1982             A_UINT32 resp_ru_end:   16,
1983                      resp_ru_start: 16;
1984         };
1985         struct {
1986             A_UINT32 resp_ru_index: 16,
1987                      resp_ru_size:  16;
1988         };
1989     };
1990 
1991     /* BIT [ 0 :   0 ]   :- resp_type_valid
1992      * BIT [ 5 :   1 ]   :- ppdu_type - HTT_PPDU_STAT_PPDU_TYPE
1993      * BIT [ 31:   6 ]   :- reserved2
1994      */
1995     union {
1996         A_UINT32 resp_type_vld_ppdu_type;
1997         struct {
1998             A_UINT32 resp_type_vld:      1,
1999                      ppdu_type:          5,
2000                      reserved2:         26;
2001         };
2002     };
2003 
2004     /* BIT [ 1 :   0 ]   :- ltf_size
2005      * BIT [ 2 :   2 ]   :- stbc
2006      * BIT [ 3 :   3 ]   :- he_re (range extension)
2007      * BIT [ 7 :   4 ]   :- txbf
2008      * BIT [ 11:   8 ]   :- bw
2009      * BIT [ 15:   12]   :- nss  NSS 1,2, ...8
2010      * BIT [ 19:   16]   :- mcs
2011      * BIT [ 23:   20]   :- preamble
2012      * BIT [ 27:   24]   :- gi - HTT_PPDU_STATS_GI
2013      * BIT [ 28:   28]   :- dcm
2014      * BIT [ 29:   29]   :- ldpc
2015      * BIT [ 30:   30]   :- valid_skipped_rate_ctrl
2016      *                      This flag indicates whether the skipped_rate_ctrl
2017      *                      flag should be ignored, or if it holds valid data.
2018      * BIT [ 31:   31]   :- skipped_rate_ctrl
2019      */
2020     union {
2021         A_UINT32 rate_info;
2022         struct {
2023             A_UINT32 ltf_size:                2,
2024                      stbc:                    1,
2025                      he_re:                   1,
2026                      txbf:                    4,
2027                      bw:                      4,
2028                      nss:                     4,
2029                      mcs:                     4,
2030                      preamble:                4,
2031                      gi:                      4,
2032                      dcm:                     1,
2033                      ldpc:                    1,
2034                      valid_skipped_rate_ctrl: 1,
2035                      skipped_rate_ctrl:       1;
2036         };
2037     };
2038 
2039     /* Note: resp_rate_info is only valid for if resp_type is UL
2040      * BIT [ 1 :   0 ]   :- ltf_size
2041      * BIT [ 2 :   2 ]   :- stbc
2042      * BIT [ 3 :   3 ]   :- he_re (range extension)
2043      * BIT [ 7 :   4 ]   :- reserved3
2044      * BIT [ 11:   8 ]   :- bw
2045      * BIT [ 15:   12]   :- nss  NSS 1,2, ...8
2046      * BIT [ 19:   16]   :- mcs
2047      * BIT [ 23:   20]   :- preamble
2048      * BIT [ 27:   24]   :- gi
2049      * BIT [ 28:   28]   :- dcm
2050      * BIT [ 29:   29]   :- ldpc
2051      * BIT [ 31:   30]   :- resp_ppdu_type - HTT_PPDU_STATS_RESP_PPDU_TYPE
2052      */
2053     union {
2054         A_UINT32 resp_rate_info;
2055         struct {
2056             A_UINT32 resp_ltf_size:           2,
2057                      resp_stbc:               1,
2058                      resp_he_re:              1,
2059                      reserved3:               4,
2060                      resp_bw:                 4,
2061                      resp_nss:                4,
2062                      resp_mcs:                4,
2063                      resp_preamble:           4,
2064                      resp_gi:                 4,
2065                      resp_dcm:                1,
2066                      resp_ldpc:               1,
2067                      resp_ppdu_type:          2;
2068         };
2069     };
2070 
2071     /*
2072      * BIT [15:0]  :- Punctured BW bitmap pattern to indicate which BWs are
2073      *                punctured.
2074      * BIT 16      :- flag showing whether EHT extra LTF is applied
2075      *                for current PPDU
2076      */
2077     A_UINT32 punc_pattern_bitmap: 16,
2078              extra_eht_ltf:       1,
2079              is_min_rate:         1,
2080              reserved4:           14;
2081 } htt_ppdu_stats_user_rate_tlv;
2082 
2083 #define HTT_PPDU_STATS_USR_RATE_VALID_M     0x80000000
2084 #define HTT_PPDU_STATS_USR_RATE_VALID_S     31
2085 
2086 #define HTT_PPDU_STATS_USR_RATE_VALID_GET(_val) \
2087         (((_val) & HTT_PPDU_STATS_USR_RATE_VALID_M) >> \
2088          HTT_PPDU_STATS_USR_RATE_VALID_S)
2089 
2090 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_M     0x000000ff
2091 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_S              0
2092 
2093 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_GET(_var) \
2094     (((_var) & HTT_PPDU_STATS_EMQ_MPDU_BITMAP_TLV_TID_NUM_M) >> \
2095     HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_S)
2096 
2097 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_SET(_var, _val) \
2098      do { \
2099          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM, _val); \
2100          ((_var) |= ((_val) << HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_TID_NUM_S)); \
2101      } while (0)
2102 
2103 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_RESERVED_M     0x0000ff00
2104 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_RESERVED_S              8
2105 
2106 
2107 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_M     0xffff0000
2108 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_S             16
2109 
2110 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_GET(_var) \
2111     (((_var) & HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_M) >> \
2112     HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_S)
2113 
2114 #define HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_SET(_var, _val) \
2115      do { \
2116          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID, _val); \
2117          ((_var) |= ((_val) << HTT_PPDU_STATS_ENQ_MPDU_BITMAP_TLV_SW_PEER_ID_S)); \
2118      } while (0)
2119 
2120 typedef struct {
2121     htt_tlv_hdr_t tlv_hdr;
2122     /* BIT [ 7 :   0]   :- tid_num
2123      * BIT [ 15:   8]   :- reserved0
2124      * BIT [ 31:  16]   :- sw_peer_id
2125      */
2126     union {
2127         A_UINT32 sw_peer_id__tid_num;
2128         struct {
2129             A_UINT32 tid_num:         8,
2130                      reserved0:       8,
2131                      sw_peer_id:     16;
2132         };
2133     };
2134     A_UINT32 start_seq;
2135     A_UINT32 enq_bitmap[HTT_BA_64_BIT_MAP_SIZE_DWORDS];
2136 } htt_ppdu_stats_enq_mpdu_bitmap_64_tlv;
2137 
2138 typedef struct {
2139     htt_tlv_hdr_t tlv_hdr;
2140     /* BIT [ 7 :   0]   :- tid_num
2141      * BIT [ 15:   8]   :- reserved0
2142      * BIT [ 31:  16]   :- sw_peer_id
2143      */
2144     union {
2145         A_UINT32 sw_peer_id__tid_num;
2146         struct {
2147             A_UINT32 tid_num:         8,
2148                      reserved0:       8,
2149                      sw_peer_id:     16;
2150         };
2151     };
2152     A_UINT32 start_seq;
2153     A_UINT32 enq_bitmap[HTT_BA_256_BIT_MAP_SIZE_DWORDS];
2154 } htt_ppdu_stats_enq_mpdu_bitmap_256_tlv;
2155 
2156 typedef struct {
2157     htt_tlv_hdr_t tlv_hdr;
2158     /* BIT [ 7 :   0]   :- tid_num
2159      * BIT [ 15:   8]   :- reserved0
2160      * BIT [ 31:  16]   :- sw_peer_id
2161      */
2162     union {
2163         A_UINT32 sw_peer_id__tid_num;
2164         struct {
2165             A_UINT32 tid_num:         8,
2166                      reserved0:       8,
2167                      sw_peer_id:     16;
2168         };
2169     };
2170     A_UINT32 start_seq;
2171     A_UINT32 enq_bitmap[HTT_BA_1024_BIT_MAP_SIZE_DWORDS];
2172 } htt_ppdu_stats_enq_mpdu_bitmap_1024_tlv;
2173 
2174 /* COMPLETION_STATUS defined in HTT_PPDU_STATS_USER_COMPLETION_STATUS */
2175 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_M     0x000000ff
2176 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_S              0
2177 
2178 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_GET(_var) \
2179     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_M) >> \
2180     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_S)
2181 
2182 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_SET(_var, _val) \
2183      do { \
2184          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS, _val); \
2185          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_COMPLETION_STATUS_S)); \
2186      } while (0)
2187 
2188 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_M     0x0000ff00
2189 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_S              8
2190 
2191 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_GET(_var) \
2192     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_M) >> \
2193     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_S)
2194 
2195 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_SET(_var, _val) \
2196      do { \
2197          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM, _val); \
2198          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TID_NUM_S)); \
2199      } while (0)
2200 
2201 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_M     0xffff0000
2202 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_S             16
2203 
2204 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_GET(_var) \
2205     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_M) >> \
2206     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_S)
2207 
2208 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_SET(_var, _val) \
2209      do { \
2210          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID, _val); \
2211          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SW_PEER_ID_S)); \
2212      } while (0)
2213 
2214 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_M     0x0000ffff
2215 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_S              0
2216 
2217 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_GET(_var) \
2218     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_M) >> \
2219     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_S)
2220 
2221 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_SET(_var, _val) \
2222      do { \
2223          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED, _val); \
2224          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_TRIED_S)); \
2225      } while (0)
2226 
2227 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_M     0xffff0000
2228 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_S             16
2229 
2230 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_GET(_var) \
2231     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_M) >> \
2232     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_S)
2233 
2234 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_SET(_var, _val) \
2235      do { \
2236          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS, _val); \
2237          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPDU_SUCCESS_S)); \
2238      } while (0)
2239 
2240 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_M     0x0000000f
2241 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_S              0
2242 
2243 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_GET(_var) \
2244     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_M) >> \
2245     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_S)
2246 
2247 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_SET(_var, _val) \
2248      do { \
2249          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY, _val); \
2250          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_LONG_RETRY_S)); \
2251      } while (0)
2252 
2253 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_M     0x000000f0
2254 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_S              4
2255 
2256 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_GET(_var) \
2257     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_M) >> \
2258     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_S)
2259 
2260 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_SET(_var, _val) \
2261      do { \
2262          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY, _val); \
2263          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_SHORT_RETRY_S)); \
2264      } while (0)
2265 
2266 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_M     0x00000100
2267 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_S              8
2268 
2269 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_GET(_var) \
2270     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_M) >> \
2271     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_S)
2272 
2273 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_SET(_var, _val) \
2274      do { \
2275          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU, _val); \
2276          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_AMPDU_S)); \
2277      } while (0)
2278 
2279 enum HTT_PPDU_STATS_RESP_TYPE {
2280     HTT_PPDU_STATS_NO_RESPONSE_EXPECTED_E                      = 0,
2281     HTT_PPDU_STATS_ACK_EXPECTED_E                              = 1,
2282     HTT_PPDU_STATS_BA_BITMAP_EXPECTED_E                        = 2,
2283     HTT_PPDU_STATS_UL_MU_BA_EXPECTED_E                         = 3,
2284     HTT_PPDU_STATS_UL_MU_BA_AND_DATA_EXPECTED_E                = 4,
2285     HTT_PPDU_STATS_CTS_EXPECTED_E                              = 5,
2286     HTT_PPDU_STATS_MU_CBF_EXPECTED_E                           = 6,
2287 };
2288 typedef enum HTT_PPDU_STATS_RESP_TYPE HTT_PPDU_STATS_RESP_TYPE;
2289 
2290 /* Refer HTT_PPDU_STATS_RESP_TYPE */
2291 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_M     0x00001e00
2292 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_S              9
2293 
2294 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_GET(_var) \
2295     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_M) >> \
2296     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_S)
2297 
2298 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_SET(_var, _val) \
2299      do { \
2300          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE, _val); \
2301          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RESP_TYPE_S)); \
2302      } while (0)
2303 
2304 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_M  0x0000e000
2305 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_S          13
2306 
2307 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_GET(_var) \
2308     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_M) >> \
2309     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_S)
2310 
2311 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_SET (_var , _val) \
2312     do { \
2313         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE, _val); \
2314         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MPROT_TYPE_S)); \
2315     } while (0)
2316 
2317 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_M  0x00010000
2318 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_S          16
2319 
2320 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_GET(_var) \
2321     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_M) >> \
2322     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_S)
2323 
2324 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_SET (_var, _val) \
2325     do { \
2326         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS, _val); \
2327         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_SUCCESS_S)); \
2328     } while (0)
2329 
2330 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_M  0x00020000
2331 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_S          17
2332 
2333 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_GET(_var) \
2334     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_M) >> \
2335     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_S)
2336 
2337 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_SET (_var , _val) \
2338     do { \
2339         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE, _val); \
2340         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_RTS_FAILURE_S)); \
2341     } while (0)
2342 
2343 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_M  0x00040000
2344 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_S          18
2345 
2346 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_GET(_var) \
2347     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_M) >> \
2348     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_S)
2349 
2350 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_SET (_var , _val) \
2351     do { \
2352         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX, _val); \
2353         ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PREAM_PUNC_TX_S)); \
2354     } while (0)
2355 
2356 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_M     0xffffffff
2357 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_S              0
2358 
2359 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_GET(_var) \
2360     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_M) >> \
2361     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_S)
2362 
2363 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_SET(_var, _val) \
2364      do { \
2365          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI, _val); \
2366          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CHAIN_RSSI_S)); \
2367      } while (0)
2368 
2369 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_M     0xffffffff
2370 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_S              0
2371 
2372 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_GET(_var) \
2373     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_M) >> \
2374     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_S)
2375 
2376 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_SET(_var, _val) \
2377      do { \
2378          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK, _val); \
2379          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_TX_ANTENNA_MASK_S)); \
2380      } while (0)
2381 
2382 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_M     0x00010000
2383 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_S             16
2384 
2385 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_GET(_var) \
2386     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_M) >> \
2387     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_S)
2388 
2389 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_SET(_var, _val) \
2390      do { \
2391          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING, _val); \
2392          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_IS_TRAINING_S)); \
2393      } while (0)
2394 
2395 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_M     0x0000ffff
2396 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_S              0
2397 
2398 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_GET(_var) \
2399     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_M) >> \
2400     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_S)
2401 
2402 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_SET(_var, _val) \
2403      do { \
2404          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS, _val); \
2405          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_PENDING_TRAINING_PKTS_S)); \
2406      } while (0)
2407 
2408 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_M     0xffffffff
2409 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_S              0
2410 
2411 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_GET(_var) \
2412     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_M) >> \
2413     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_S)
2414 
2415 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_SET(_var, _val) \
2416      do { \
2417          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES, _val); \
2418          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_MAX_RATES_S)); \
2419      } while (0)
2420 
2421 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_M     0xffffffff
2422 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_S              0
2423 
2424 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_GET(_var) \
2425     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_M) >> \
2426     HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_S)
2427 
2428 #define HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_SET(_var, _val) \
2429      do { \
2430          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER, _val); \
2431          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_COMMON_TLV_CURRENT_RATE_PER_S)); \
2432      } while (0)
2433 
2434 enum  HTT_PPDU_STATS_USER_COMPLETION_STATUS {
2435     HTT_PPDU_STATS_USER_STATUS_OK,
2436     HTT_PPDU_STATS_USER_STATUS_FILTERED,
2437     HTT_PPDU_STATS_USER_STATUS_RESP_TIMEOUT,
2438     HTT_PPDU_STATS_USER_STATUS_RESP_MISMATCH,
2439     HTT_PPDU_STATS_USER_STATUS_ABORT,
2440 };
2441 typedef enum HTT_PPDU_STATS_USER_COMPLETION_STATUS HTT_PPDU_STATS_USER_COMPLETION_STATUS;
2442 
2443 typedef struct {
2444     htt_tlv_hdr_t tlv_hdr;
2445     /* BIT [ 7 :   0]   :- completion_status
2446      * BIT [ 15:   8]   :- tid_num
2447      * BIT [ 31:  16]   :- sw_peer_id
2448      */
2449     union {
2450         A_UINT32 sw_peer_id__tid_num__completion_status;
2451         struct {
2452             A_UINT32 completion_status:         8,
2453                      tid_num:                   8,
2454                      sw_peer_id:               16;
2455         };
2456     };
2457 
2458     /* RSSI value of last ack packet (units = dB above noise floor) */
2459     A_UINT32 ack_rssi;
2460 
2461     /* BIT [ 15 :   0]   :- mpdu_tried
2462      * BIT [ 31 :  16]   :- mpdu_success
2463      */
2464     union {
2465         A_UINT32 mpdu_tried__mpdu_success;
2466         struct {
2467             A_UINT32 mpdu_tried:                16,
2468                      mpdu_success:              16;
2469         };
2470     };
2471 
2472     /* BIT [ 3 :   0]   :- long_retries
2473      * BIT [ 7 :   4]   :- short_retries
2474      * BIT [ 8 :   8]   :- is_ampdu
2475      * BIT [ 12:   9]   :- resp_type
2476      * BIT [ 15:  13]   :- medium protection type
2477      * BIT [ 16:  16]   :- rts_success (HW RTS)
2478      * BIT [ 17:  17]   :- rts_failure (HW RTS)
2479      * BIT [ 18:  18]   :- pream_punc_tx
2480      * BIT [ 31:  19]   :- reserved
2481      */
2482     union {
2483         /* older names */
2484         A_UINT32 resp_type_is_ampdu__short_retry__long_retry;
2485         A_UINT32 resp_type__is_ampdu__short_retry__long_retry__mprot_type__rts_success__rts_failure;
2486         /* newest name */
2487         A_UINT32 resp_type__is_ampdu__short_retry__long_retry__mprot_type__rts_success__rts_failure__pream_punc_tx;
2488         struct { /* bitfield names */
2489             A_UINT32 long_retries:               4,
2490                      short_retries:              4,
2491                      is_ampdu:                   1,
2492                      resp_type:                  4,
2493                      mprot_type:                 3,
2494                      rts_success:                1,
2495                      rts_failure:                1,
2496                      pream_punc_tx:              1,
2497                      reserved0:                 13;
2498         };
2499     };
2500 
2501     /*
2502      * ack RSSI per chain for last transmission to the peer-TID
2503      * (value in dB w.r.t noise floor)
2504      */
2505     A_UINT32 chain_rssi[HTT_STATS_MAX_CHAINS];
2506 
2507     /* Tx Antenna mask for last packet transmission */
2508     A_UINT32 tx_antenna_mask;
2509 
2510     /* For SmartAntenna
2511      * BIT [15:0]  :- pending_training_pkts
2512      *                Holds number of pending training packets during training.
2513      * BIT [16]    :- is_training
2514      *                This flag indicates if peer is under training.
2515      * BIT [31:17] :- reserved1
2516      */
2517     A_UINT32 pending_training_pkts:16,
2518              is_training:1,
2519              reserved1:15;
2520 
2521     /*
2522      * Max rates configured per BW:
2523      * for BW supported by Smart Antenna - 20MHZ, 40MHZ, 80MHZ and 160MHZ
2524      * (Note: 160 MHz is currently not supported by Smart Antenna)
2525      */
2526     A_UINT32 max_rates[HTT_STATS_NUM_SUPPORTED_BW_SMART_ANTENNA];
2527 
2528     /* PER of the last transmission to the peer-TID (in percent) */
2529     A_UINT32 current_rate_per;
2530 
2531     /*
2532      * For SW RTS
2533      * BIT [0]    :- Whether SW RTS successfully sent OTA.
2534      * BIT [1]    :- Whether SW RTS successful completion.
2535      * BIT [2]    :- Whether SW RTS failed completion.
2536      * BIT [3]    :- Whether SW RTS response with different BW.
2537      * BIT [31:4] :- reserved2
2538      */
2539     A_UINT32 sw_rts_tried:      1,
2540              sw_rts_success:    1,
2541              sw_rts_failure:    1,
2542              cts_rcvd_diff_bw:  1,
2543              reserved2:        28;
2544 
2545     /*
2546      * Max rates configured per BW:
2547      * for BW supported by Smart Antenna - 320 MHZ
2548      */
2549     A_UINT32 max_rates_ext;
2550 
2551     /* hw_prot_dur_us:
2552      * hw protection frame's FES duration in micro seconds.
2553      */
2554     A_UINT32 hw_prot_dur_us;
2555 } htt_ppdu_stats_user_cmpltn_common_tlv;
2556 
2557 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_M     0x000000ff
2558 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_S              0
2559 
2560 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_GET(_var) \
2561     (((_var) & HTT_PPDU_STATS_EMQ_MPDU_BITMAP_TLV_TID_NUM_M) >> \
2562     HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_S)
2563 
2564 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_SET(_var, _val) \
2565      do { \
2566          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM, _val); \
2567          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_TID_NUM_S)); \
2568      } while (0)
2569 
2570 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_RESERVED_M     0x0000ff00
2571 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_RESERVED_S              8
2572 
2573 
2574 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_M     0xffff0000
2575 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_S             16
2576 
2577 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_GET(_var) \
2578     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_M) >> \
2579     HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_S)
2580 
2581 #define HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_SET(_var, _val) \
2582      do { \
2583          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID, _val); \
2584          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_BA_BITMAP_TLV_SW_PEER_ID_S)); \
2585      } while (0)
2586 
2587 
2588 typedef struct {
2589     htt_tlv_hdr_t tlv_hdr;
2590     /* BIT [ 7 :   0]   :- tid_num
2591      * BIT [ 15:   8]   :- reserved0
2592      * BIT [ 31:  16]   :- sw_peer_id
2593      */
2594     union {
2595         A_UINT32 sw_peer_id__tid_num;
2596         struct {
2597             A_UINT32 tid_num:        8,
2598                      reserved0:      8,
2599                      sw_peer_id:    16;
2600         };
2601     };
2602     A_UINT32 ba_seq_no;
2603     A_UINT32 ba_bitmap[HTT_BA_64_BIT_MAP_SIZE_DWORDS];
2604 } htt_ppdu_stats_user_compltn_ba_bitmap_64_tlv;
2605 
2606 typedef struct {
2607     htt_tlv_hdr_t tlv_hdr;
2608     /* BIT [ 7 :   0]   :- tid_num
2609      * BIT [ 15:   8]   :- reserved0
2610      * BIT [ 31:  16]   :- sw_peer_id
2611      */
2612     union {
2613         A_UINT32 sw_peer_id__tid_num;
2614         struct {
2615             A_UINT32 tid_num:        8,
2616                      reserved0:      8,
2617                      sw_peer_id:    16;
2618         };
2619     };
2620     A_UINT32 ba_seq_no;
2621     A_UINT32 ba_bitmap[HTT_BA_256_BIT_MAP_SIZE_DWORDS];
2622 } htt_ppdu_stats_user_compltn_ba_bitmap_256_tlv;
2623 
2624 typedef struct {
2625     htt_tlv_hdr_t tlv_hdr;
2626     /* BIT [ 7 :   0]   :- tid_num
2627      * BIT [ 15:   8]   :- reserved0
2628      * BIT [ 31:  16]   :- sw_peer_id
2629      */
2630     union {
2631         A_UINT32 sw_peer_id__tid_num;
2632         struct {
2633             A_UINT32 tid_num:        8,
2634                      reserved0:      8,
2635                      sw_peer_id:    16;
2636         };
2637     };
2638     A_UINT32 ba_seq_no;
2639     A_UINT32 ba_bitmap[HTT_BA_1024_BIT_MAP_SIZE_DWORDS];
2640 } htt_ppdu_stats_user_compltn_ba_bitmap_1024_tlv;
2641 
2642 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_M     0x0000ffff
2643 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_S              0
2644 
2645 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_GET(_var) \
2646     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_M) >> \
2647     HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_S)
2648 
2649 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_SET(_var, _val) \
2650      do { \
2651          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID, _val); \
2652          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_SW_PEER_ID_S)); \
2653      } while (0)
2654 
2655 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_M     0x000001ff
2656 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_S              0
2657 
2658 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_GET(_var) \
2659     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_M) >> \
2660     HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_S)
2661 
2662 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_SET(_var, _val) \
2663      do { \
2664          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU, _val); \
2665          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MPDU_S)); \
2666      } while (0)
2667 
2668 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_M     0x01fffe00
2669 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_S              9
2670 
2671 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_GET(_var) \
2672     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_M) >> \
2673     HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_S)
2674 
2675 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_SET(_var, _val) \
2676      do { \
2677          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU, _val); \
2678          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_NUM_MSDU_S)); \
2679      } while (0)
2680 
2681 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_M     0xfe000000
2682 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_S             25
2683 
2684 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_GET(_var) \
2685     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_M) >> \
2686     HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_S)
2687 
2688 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_SET(_var, _val) \
2689      do { \
2690          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM, _val); \
2691          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_TID_NUM_S)); \
2692      } while (0)
2693 
2694 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_M     0x0000ffff
2695 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_S              0
2696 
2697 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_GET(_var) \
2698     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_M) >> \
2699     HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_S)
2700 
2701 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_SET(_var, _val) \
2702      do { \
2703          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ, _val); \
2704          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_CUR_SEQ_S)); \
2705      } while (0)
2706 
2707 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_M     0xffff0000
2708 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_S             16
2709 
2710 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_GET(_var) \
2711     (((_var) & HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_M) >> \
2712     HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_S)
2713 
2714 #define HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_SET(_var, _val) \
2715      do { \
2716          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ, _val); \
2717          ((_var) |= ((_val) << HTT_PPDU_STATS_USER_CMPLTN_ACK_BA_STATUS_TLV_START_SEQ_S)); \
2718      } while (0)
2719 
2720 typedef struct {
2721     htt_tlv_hdr_t tlv_hdr;
2722     A_UINT32 ppdu_id;
2723 
2724     /* BIT [ 15 :   0]   :- sw_peer_id
2725      * BIT [ 31 :  16]   :- reserved0
2726      */
2727     union {
2728         A_UINT32 rsvd_sw_peer_id;
2729         struct {
2730             A_UINT32 sw_peer_id:          16,
2731                      reserved0:           16;
2732         };
2733     };
2734 
2735     /* BIT [ 8  :   0]   :- num_mpdu
2736      * BIT [ 24 :   9]   :- num_msdu
2737      * BIT [ 31 :  25]   :- tid_num
2738      */
2739     union {
2740         A_UINT32 tid_num__num_msdu__num_mpdu;
2741         struct {
2742             A_UINT32 num_mpdu:             9,
2743                      num_msdu:            16,
2744                      tid_num:              7;
2745         };
2746     };
2747 
2748     /* BIT [ 15 :   0]   :- current_seq
2749      * BIT [ 31 :  16]   :- start_seq
2750      */
2751     union {
2752         A_UINT32 start_seq__current_seq;
2753         struct {
2754             A_UINT32 current_seq:          16,
2755                      start_seq:            16;
2756         };
2757     };
2758 
2759     A_UINT32 success_bytes;
2760 } htt_ppdu_stats_user_compltn_ack_ba_status_tlv;
2761 
2762 /* FLOW_TYPE defined in HTT_TX_FLOW_TYPE */
2763 #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_M     0x000000ff
2764 #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_S              0
2765 
2766 #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_GET(_var) \
2767     (((_var) & HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_M) >> \
2768     HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_S)
2769 
2770 #define HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_SET(_var, _val) \
2771      do { \
2772          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE, _val); \
2773          ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_FLOW_TYPE_S)); \
2774      } while (0)
2775 
2776 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_M     0x0001ff00
2777 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_S              8
2778 
2779 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_GET(_var) \
2780     (((_var) & HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_M) >> \
2781     HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_S)
2782 
2783 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_SET(_var, _val) \
2784      do { \
2785          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU, _val); \
2786          ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_NUM_MPDU_S)); \
2787      } while (0)
2788 
2789 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_M     0x7ffe0000
2790 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_S             17
2791 
2792 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_GET(_var) \
2793     (((_var) & HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_M) >> \
2794     HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_S)
2795 
2796 #define HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_SET(_var, _val) \
2797      do { \
2798          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU, _val); \
2799          ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_NUM_MSDU_S)); \
2800      } while (0)
2801 
2802 #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_M     0x000000ff
2803 #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_S              0
2804 
2805 #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_GET(_var) \
2806     (((_var) & HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_M) >> \
2807     HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_S)
2808 
2809 #define HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_SET(_var, _val) \
2810      do { \
2811          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_TID_NUM, _val); \
2812          ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_TID_NUM_S)); \
2813      } while (0)
2814 
2815 #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_M     0x0000ff00
2816 #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_S              8
2817 
2818 #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_GET(_var) \
2819     (((_var) & HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_M) >> \
2820     HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_S)
2821 
2822 #define HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_SET(_var, _val) \
2823      do { \
2824          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE, _val); \
2825          ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_QUEUE_TYPE_S)); \
2826      } while (0)
2827 
2828 #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_M     0xffff0000
2829 #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_S             16
2830 
2831 #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_GET(_var) \
2832     (((_var) & HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_M) >> \
2833     HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_S)
2834 
2835 #define HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_SET(_var, _val) \
2836      do { \
2837          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID, _val); \
2838          ((_var) |= ((_val) << HTT_PPDU_STATS_FLUSH_TLV_SW_PEER_ID_S)); \
2839      } while (0)
2840 
2841 enum HTT_TX_FLOW_TYPE {
2842     HTT_TX_TID_FRAMEQ,
2843     HTT_TX_TQM_MSDUQ,
2844     HTT_TQM_MPDUQ,
2845 };
2846 
2847 enum HTT_FLUSH_STATUS_DROP_REASON {
2848     HTT_FLUSH_PEER_DELETE,
2849     HTT_FLUSH_TID_DELETE,
2850     HTT_FLUSH_TTL_EXCEEDED,
2851     HTT_FLUSH_EXCESS_RETRIES,
2852     HTT_FLUSH_REINJECT,
2853 };
2854 
2855 typedef struct {
2856     htt_tlv_hdr_t tlv_hdr;
2857 
2858     A_UINT32 drop_reason;
2859     /* BIT [ 7 :   0]   :- flow_type
2860      * BIT [ 16:   8]   :- num_mpdu
2861      * BIT [ 30:  17]   :- num_msdu
2862      * BIT [ 31:  31]   :- reserved0
2863      */
2864     union {
2865         A_UINT32 num_msdu__num_mpdu__flow_type;
2866         struct {
2867             A_UINT32 flow_type:        8,
2868                      num_mpdu:         9,
2869                      num_msdu:        14,
2870                      reserved0:        1;
2871         };
2872     };
2873 
2874     /* BIT [ 7  :   0]   :- tid_num
2875      * BIT [ 15 :   8]   :- queue_type
2876      * BIT [ 31 :  16]   :- sw_peer_id
2877      */
2878     union {
2879         A_UINT32 sw_peer_id__queue_type__tid_num;
2880         struct {
2881             A_UINT32 tid_num:          8,
2882                      queue_type:       8,
2883                      sw_peer_id:       16;
2884         };
2885     };
2886 } htt_ppdu_stats_flush_tlv;
2887 
2888 #define HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_M     0x0000ffff
2889 #define HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_S              0
2890 
2891 #define HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_GET(_var) \
2892     (((_var) & HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_M) >> \
2893     HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_S)
2894 
2895 #define HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_SET(_var, _val) \
2896      do { \
2897          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH, _val); \
2898          ((_var) |= ((_val) << HTT_PPDU_STATS_TX_MGMTCTRL_TLV_FRAME_LENGTH_S)); \
2899      } while (0)
2900 
2901 typedef struct {
2902     htt_tlv_hdr_t tlv_hdr;
2903 
2904     /*
2905      * BIT [ 15 :   0]   :- frame_length
2906      * BIT [ 31 :  16]   :- reserved1
2907      */
2908     union {
2909         A_UINT32 rsvd__frame_length;
2910         struct {
2911             A_UINT32 frame_length: 16,
2912                      reserved1:    16; /* set to 0x0 */
2913         };
2914     };
2915 
2916     /* Future purpose */
2917     A_UINT32 reserved2; /* set to 0x0 */
2918     A_UINT32 reserved3; /* set to 0x0 */
2919 
2920     /* mgmt/ctrl frame payload
2921      * The size of the actual mgmt payload (in bytes) can be obtained from
2922      * the frame_length field.
2923      * The size of entire payload including the padding for alignment
2924      * (in bytes) can be derived from the length in tlv parameters,
2925      * minus the 12 bytes of the above fields.
2926      */
2927     HTT_PPDU_STATS_VAR_LEN_ARRAY1(A_UINT32, payload);
2928 } htt_ppdu_stats_tx_mgmtctrl_payload_tlv;
2929 
2930 #define HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_M     0x0000ffff
2931 #define HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_S              0
2932 
2933 #define HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_GET(_var) \
2934     (((_var) & HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_M) >> \
2935     HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_S)
2936 
2937 #define HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_SET(_var, _val) \
2938      do { \
2939          HTT_CHECK_SET_VAL(HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH, _val); \
2940          ((_var) |= ((_val) << HTT_PPDU_STATS_RX_MGMTCTRL_TLV_FRAME_LENGTH_S)); \
2941      } while (0)
2942 
2943 typedef struct {
2944     htt_tlv_hdr_t tlv_hdr;
2945 
2946     /*
2947      * BIT [ 15 :   0]   :- frame_length (in bytes)
2948      * BIT [ 31 :  16]   :- reserved1
2949      */
2950     union {
2951         A_UINT32 rsvd__frame_length;
2952         struct {
2953             A_UINT32 frame_length: 16,
2954                      reserved1:    16; /* set to 0x0 */
2955         };
2956     };
2957 
2958     /* Future purpose */
2959     A_UINT32 reserved2; /* set to 0x0 */
2960     A_UINT32 reserved3; /* set to 0x0 */
2961 
2962     /* mgmt/ctrl frame payload
2963      * The size of the actual mgmt payload (in bytes) can be obtained from
2964      * the frame_length field.
2965      * The size of entire payload including the padding for alignment
2966      * (in bytes) can be derived from the length in tlv parameters,
2967      * minus the 12 bytes of the above fields.
2968      */
2969     HTT_PPDU_STATS_VAR_LEN_ARRAY1(A_UINT32, payload);
2970 } htt_ppdu_stats_rx_mgmtctrl_payload_tlv;
2971 
2972 #define HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_M   0x000000ff
2973 #define HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_S            0
2974 
2975 #define HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_GET(_var) \
2976     (((_var) & HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_M) >> \
2977     HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_S)
2978 
2979 #define HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_SET(_var, _val) \
2980     do { \
2981         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS, _val); \
2982         ((_var) |= ((_val) << HTT_PPDU_STATS_USERS_INFO_TLV_MAX_USERS_S)); \
2983     } while (0)
2984 
2985 #define HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_M   0x0000ff00
2986 #define HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_S            8
2987 
2988 #define HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_GET(_var) \
2989     (((_var) & HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_M) >> \
2990     HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_S)
2991 
2992 #define HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_SET(_var, _val) \
2993     do { \
2994         HTT_CHECK_SET_VAL(HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE, _val); \
2995         ((_var) |= ((_val) << HTT_PPDU_STATS_USERS_INFO_TLV_FRAME_TYPE_S)); \
2996     } while (0)
2997 
2998 typedef struct {
2999     htt_tlv_hdr_t tlv_hdr;
3000 
3001     /*
3002      * BIT [  7 :   0]   :- max_users
3003      * BIT [ 15 :   8]   :- frame_type (HTT_STATS_FTYPE)
3004      * BIT [ 31 :  16]   :- reserved1
3005      */
3006     union {
3007         A_UINT32 rsvd__frame_type__max_users;
3008         struct {
3009             A_UINT32 max_users: 8,
3010                      frame_type:     8,
3011                      reserved1:     16;
3012         };
3013     };
3014 } htt_ppdu_stats_users_info_tlv;
3015 
3016 typedef struct {
3017     htt_tlv_hdr_t tlv_hdr;
3018     A_UINT32 ppdu_id;
3019     A_UINT32 tid_num    : 8,
3020              reserved1  :24;
3021     A_UINT32 start_seq  :16, /* [15: 0] */
3022              /* ba_enabled:
3023               * To know if block ack established or not.
3024               * If block ack is not enabled, start_seq represents
3025               * the seq number of the current MPDU/PPDU.
3026               */
3027              ba_enabled : 1,
3028              nss        : 4,
3029              /* win_size:
3030               * Block ack window size in multiples of 32 bits.
3031               * For example: For a 64-bit block ack, win_size will be 2.
3032               */
3033              win_size   : 8,
3034              reserved2  : 3;
3035     /* The number of elements in the ba_bitmap array depends on win_size. */
3036     HTT_PPDU_STATS_VAR_LEN_ARRAY1(A_UINT32, ba_bitmap);
3037 } htt_ppdu_stats_for_smu_tlv;
3038 
3039 typedef struct {
3040     htt_tlv_hdr_t tlv_hdr;
3041     /*
3042      * BIT [  2 :   0]   :- response_reason
3043      * BIT [  6 :   3]   :- mlo_change_t1_cts2self
3044      * BIT [ 10 :   7]   :- mlo_change_t1_ppdu
3045      * BIT [ 14 :  11]   :- mlo_change_t2_response
3046      * BIT [ 18 :  15]   :- mlo_change_t3_r2r
3047      * BIT [ 19 :  19]   :- partner_link_info_valid
3048      * BIT [ 22 :  20]   :- partner_link_id
3049      * BIT [ 27 :  23]   :- partner_link_cmd_ring_id
3050      * BIT [ 28 :  28]   :- dot11ax_trigger_frame_embedded
3051      * BIT [ 31 :  29]   :- reserved_0a
3052      */
3053     A_UINT32 response_reason                                         :  3,
3054              mlo_change_t1_cts2self                                  :  4,
3055              mlo_change_t1_ppdu                                      :  4,
3056              mlo_change_t2_response                                  :  4,
3057              mlo_change_t3_r2r                                       :  4,
3058              partner_link_info_valid                                 :  1,
3059              partner_link_id                                         :  3,
3060              partner_link_cmd_ring_id                                :  5,
3061              dot11ax_trigger_frame_embedded                          :  1,
3062              reserved_0a                                             :  3;
3063     /*
3064      * BIT [ 15 :   0]   :- partner_link_schedule_id
3065      * BIT [ 31 :  16]   :- tx_rx_overlap_duration (microsecond units)
3066      */
3067     A_UINT32 partner_link_schedule_id                                : 16,
3068              tx_rx_overlap_duration_us                               : 16;
3069     /*
3070      * BIT [ 15 :   0]   :- cts2self_duration (microsecond units)
3071      * BIT [ 31 :  16]   :- ppdu_duration (microsecond units)
3072      */
3073     A_UINT32 cts2self_duration_us                                    : 16,
3074              ppdu_duration_us                                        : 16;
3075     /*
3076      * BIT [ 15 :   0]   :- response_duration (microsecond units)
3077      * BIT [ 31 :  16]   :- response_to_response_duration (microsecond units)
3078      */
3079     A_UINT32 response_duration_us                                    : 16,
3080              response_to_response_duration_us                        : 16;
3081     /*
3082      * BIT [ 15 :   0]   :- self_link_schedule_id
3083      * BIT [ 31 :  16]   :- hls_branch_debug_code
3084      */
3085     A_UINT32 self_link_schedule_id                                   : 16,
3086              hls_branch_debug_code                                   : 16;
3087     /*
3088      * BIT [ 31 :   0]   :- hls_decision_debug_info
3089      */
3090     A_UINT32 hls_decision_debug_info                                 : 32;
3091 } htt_ppdu_stats_mlo_tx_resp_tlv;
3092 
3093 typedef struct {
3094     htt_tlv_hdr_t tlv_hdr;
3095     /*
3096      * BIT [  2 :   0]   :- notification_reason
3097      * BIT [  3 :   3]   :- ml_decision
3098      * BIT [  4 :   4]   :- cts2self_padding
3099      * BIT [  5 :   5]   :- initiated_by_truncated_backoff
3100      * BIT [  8 :   6]   :- transmit_start_reason
3101      * BIT [ 14 :   9]   :- num_users
3102      * BIT [ 24 :  15]   :- nstr_mlo_sta_id
3103      * BIT [ 25 :  25]   :- block_self_ml_sync
3104      * BIT [ 26 :  26]   :- block_partner_ml_sync
3105      * BIT [ 27 :  27]   :- nstr_mlo_sta_id_valid
3106      * BIT [ 31 :  28]   :- reserved_0a
3107      */
3108     A_UINT32 notification_reason                                     :  3,
3109              ml_decision                                             :  1,
3110              cts2self_padding                                        :  1,
3111              initiated_by_truncated_backoff                          :  1,
3112              transmit_start_reason                                   :  3,
3113              num_users                                               :  6,
3114              nstr_mlo_sta_id                                         : 10,
3115              block_self_ml_sync                                      :  1,
3116              block_partner_ml_sync                                   :  1,
3117              nstr_mlo_sta_id_valid                                   :  1,
3118              reserved_0a                                             :  4;
3119     /*
3120      * BIT [ 15 :   0]   :- pdg_ppdu_duration_adjust_value (microsecond units)
3121      * BIT [ 31 :  16]   :- mlo_ppdu_duration_adjust_value (microsecond units)
3122      */
3123     A_UINT32 pdg_ppdu_duration_adjust_value_us                       : 16,
3124              mlo_ppdu_duration_adjust_value_us                       : 16;
3125     /*
3126      * BIT [ 15 :   0]   :- response_duration (microsecond units)
3127      * BIT [ 31 :  16]   :- response_to_response_duration (microsecond units)
3128      */
3129     A_UINT32 response_duration_us                                    : 16,
3130              response_to_response_duration_us                        : 16;
3131     /*
3132      * BIT [ 15 :   0]   :- schedule_id
3133      * BIT [ 20 :  16]   :- cmd_ring_id
3134      * BIT [ 31 :  21]   :- reserved_1a
3135      */
3136     A_UINT32 schedule_id                                             : 16,
3137              cmd_ring_id                                             :  5,
3138              reserved_1a                                             : 11;
3139     /*
3140      * BIT [ 31 :  0]   :- mlo_reference_timestamp (microsecond units)
3141      */
3142     A_UINT32 mlo_reference_timestamp_us                              : 32;
3143     /*
3144      * BIT [ 15 :   0]   :- cts2self_duration (microsecond units)
3145      * BIT [ 31 :  16]   :- ppdu_duration (microsecond units)
3146      */
3147     A_UINT32 cts2self_duration_us                                    : 16,
3148              ppdu_duration_us                                        : 16;
3149 } htt_ppdu_stats_mlo_tx_notification_tlv;
3150 
3151 
3152 #endif //__HTT_PPDU_STATS_H__
3153