xref: /OK3568_Linux_fs/kernel/drivers/net/wireless/ath/ath10k/rx_desc.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /* SPDX-License-Identifier: ISC */
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun  * Copyright (c) 2005-2011 Atheros Communications Inc.
4*4882a593Smuzhiyun  * Copyright (c) 2011-2017 Qualcomm Atheros, Inc.
5*4882a593Smuzhiyun  */
6*4882a593Smuzhiyun 
7*4882a593Smuzhiyun #ifndef _RX_DESC_H_
8*4882a593Smuzhiyun #define _RX_DESC_H_
9*4882a593Smuzhiyun 
10*4882a593Smuzhiyun #include <linux/bitops.h>
11*4882a593Smuzhiyun 
12*4882a593Smuzhiyun enum rx_attention_flags {
13*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_FIRST_MPDU          = BIT(0),
14*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_LAST_MPDU           = BIT(1),
15*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_MCAST_BCAST         = BIT(2),
16*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_PEER_IDX_INVALID    = BIT(3),
17*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_PEER_IDX_TIMEOUT    = BIT(4),
18*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_POWER_MGMT          = BIT(5),
19*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_NON_QOS             = BIT(6),
20*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_NULL_DATA           = BIT(7),
21*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_MGMT_TYPE           = BIT(8),
22*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_CTRL_TYPE           = BIT(9),
23*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_MORE_DATA           = BIT(10),
24*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_EOSP                = BIT(11),
25*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_U_APSD_TRIGGER      = BIT(12),
26*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_FRAGMENT            = BIT(13),
27*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_ORDER               = BIT(14),
28*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_CLASSIFICATION      = BIT(15),
29*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_OVERFLOW_ERR        = BIT(16),
30*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_MSDU_LENGTH_ERR     = BIT(17),
31*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_TCP_UDP_CHKSUM_FAIL = BIT(18),
32*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_IP_CHKSUM_FAIL      = BIT(19),
33*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_SA_IDX_INVALID      = BIT(20),
34*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_DA_IDX_INVALID      = BIT(21),
35*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_SA_IDX_TIMEOUT      = BIT(22),
36*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_DA_IDX_TIMEOUT      = BIT(23),
37*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_ENCRYPT_REQUIRED    = BIT(24),
38*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_DIRECTED            = BIT(25),
39*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_BUFFER_FRAGMENT     = BIT(26),
40*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_MPDU_LENGTH_ERR     = BIT(27),
41*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_TKIP_MIC_ERR        = BIT(28),
42*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_DECRYPT_ERR         = BIT(29),
43*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_FCS_ERR             = BIT(30),
44*4882a593Smuzhiyun 	RX_ATTENTION_FLAGS_MSDU_DONE           = BIT(31),
45*4882a593Smuzhiyun };
46*4882a593Smuzhiyun 
47*4882a593Smuzhiyun struct rx_attention {
48*4882a593Smuzhiyun 	__le32 flags; /* %RX_ATTENTION_FLAGS_ */
49*4882a593Smuzhiyun } __packed;
50*4882a593Smuzhiyun 
51*4882a593Smuzhiyun /*
52*4882a593Smuzhiyun  * first_mpdu
53*4882a593Smuzhiyun  *		Indicates the first MSDU of the PPDU.  If both first_mpdu
54*4882a593Smuzhiyun  *		and last_mpdu are set in the MSDU then this is a not an
55*4882a593Smuzhiyun  *		A-MPDU frame but a stand alone MPDU.  Interior MPDU in an
56*4882a593Smuzhiyun  *		A-MPDU shall have both first_mpdu and last_mpdu bits set to
57*4882a593Smuzhiyun  *		0.  The PPDU start status will only be valid when this bit
58*4882a593Smuzhiyun  *		is set.
59*4882a593Smuzhiyun  *
60*4882a593Smuzhiyun  * last_mpdu
61*4882a593Smuzhiyun  *		Indicates the last MSDU of the last MPDU of the PPDU.  The
62*4882a593Smuzhiyun  *		PPDU end status will only be valid when this bit is set.
63*4882a593Smuzhiyun  *
64*4882a593Smuzhiyun  * mcast_bcast
65*4882a593Smuzhiyun  *		Multicast / broadcast indicator.  Only set when the MAC
66*4882a593Smuzhiyun  *		address 1 bit 0 is set indicating mcast/bcast and the BSSID
67*4882a593Smuzhiyun  *		matches one of the 4 BSSID registers. Only set when
68*4882a593Smuzhiyun  *		first_msdu is set.
69*4882a593Smuzhiyun  *
70*4882a593Smuzhiyun  * peer_idx_invalid
71*4882a593Smuzhiyun  *		Indicates no matching entries within the the max search
72*4882a593Smuzhiyun  *		count.  Only set when first_msdu is set.
73*4882a593Smuzhiyun  *
74*4882a593Smuzhiyun  * peer_idx_timeout
75*4882a593Smuzhiyun  *		Indicates an unsuccessful search for the peer index due to
76*4882a593Smuzhiyun  *		timeout.  Only set when first_msdu is set.
77*4882a593Smuzhiyun  *
78*4882a593Smuzhiyun  * power_mgmt
79*4882a593Smuzhiyun  *		Power management bit set in the 802.11 header.  Only set
80*4882a593Smuzhiyun  *		when first_msdu is set.
81*4882a593Smuzhiyun  *
82*4882a593Smuzhiyun  * non_qos
83*4882a593Smuzhiyun  *		Set if packet is not a non-QoS data frame.  Only set when
84*4882a593Smuzhiyun  *		first_msdu is set.
85*4882a593Smuzhiyun  *
86*4882a593Smuzhiyun  * null_data
87*4882a593Smuzhiyun  *		Set if frame type indicates either null data or QoS null
88*4882a593Smuzhiyun  *		data format.  Only set when first_msdu is set.
89*4882a593Smuzhiyun  *
90*4882a593Smuzhiyun  * mgmt_type
91*4882a593Smuzhiyun  *		Set if packet is a management packet.  Only set when
92*4882a593Smuzhiyun  *		first_msdu is set.
93*4882a593Smuzhiyun  *
94*4882a593Smuzhiyun  * ctrl_type
95*4882a593Smuzhiyun  *		Set if packet is a control packet.  Only set when first_msdu
96*4882a593Smuzhiyun  *		is set.
97*4882a593Smuzhiyun  *
98*4882a593Smuzhiyun  * more_data
99*4882a593Smuzhiyun  *		Set if more bit in frame control is set.  Only set when
100*4882a593Smuzhiyun  *		first_msdu is set.
101*4882a593Smuzhiyun  *
102*4882a593Smuzhiyun  * eosp
103*4882a593Smuzhiyun  *		Set if the EOSP (end of service period) bit in the QoS
104*4882a593Smuzhiyun  *		control field is set.  Only set when first_msdu is set.
105*4882a593Smuzhiyun  *
106*4882a593Smuzhiyun  * u_apsd_trigger
107*4882a593Smuzhiyun  *		Set if packet is U-APSD trigger.  Key table will have bits
108*4882a593Smuzhiyun  *		per TID to indicate U-APSD trigger.
109*4882a593Smuzhiyun  *
110*4882a593Smuzhiyun  * fragment
111*4882a593Smuzhiyun  *		Indicates that this is an 802.11 fragment frame.  This is
112*4882a593Smuzhiyun  *		set when either the more_frag bit is set in the frame
113*4882a593Smuzhiyun  *		control or the fragment number is not zero.  Only set when
114*4882a593Smuzhiyun  *		first_msdu is set.
115*4882a593Smuzhiyun  *
116*4882a593Smuzhiyun  * order
117*4882a593Smuzhiyun  *		Set if the order bit in the frame control is set.  Only set
118*4882a593Smuzhiyun  *		when first_msdu is set.
119*4882a593Smuzhiyun  *
120*4882a593Smuzhiyun  * classification
121*4882a593Smuzhiyun  *		Indicates that this status has a corresponding MSDU that
122*4882a593Smuzhiyun  *		requires FW processing.  The OLE will have classification
123*4882a593Smuzhiyun  *		ring mask registers which will indicate the ring(s) for
124*4882a593Smuzhiyun  *		packets and descriptors which need FW attention.
125*4882a593Smuzhiyun  *
126*4882a593Smuzhiyun  * overflow_err
127*4882a593Smuzhiyun  *		PCU Receive FIFO does not have enough space to store the
128*4882a593Smuzhiyun  *		full receive packet.  Enough space is reserved in the
129*4882a593Smuzhiyun  *		receive FIFO for the status is written.  This MPDU remaining
130*4882a593Smuzhiyun  *		packets in the PPDU will be filtered and no Ack response
131*4882a593Smuzhiyun  *		will be transmitted.
132*4882a593Smuzhiyun  *
133*4882a593Smuzhiyun  * msdu_length_err
134*4882a593Smuzhiyun  *		Indicates that the MSDU length from the 802.3 encapsulated
135*4882a593Smuzhiyun  *		length field extends beyond the MPDU boundary.
136*4882a593Smuzhiyun  *
137*4882a593Smuzhiyun  * tcp_udp_chksum_fail
138*4882a593Smuzhiyun  *		Indicates that the computed checksum (tcp_udp_chksum) did
139*4882a593Smuzhiyun  *		not match the checksum in the TCP/UDP header.
140*4882a593Smuzhiyun  *
141*4882a593Smuzhiyun  * ip_chksum_fail
142*4882a593Smuzhiyun  *		Indicates that the computed checksum did not match the
143*4882a593Smuzhiyun  *		checksum in the IP header.
144*4882a593Smuzhiyun  *
145*4882a593Smuzhiyun  * sa_idx_invalid
146*4882a593Smuzhiyun  *		Indicates no matching entry was found in the address search
147*4882a593Smuzhiyun  *		table for the source MAC address.
148*4882a593Smuzhiyun  *
149*4882a593Smuzhiyun  * da_idx_invalid
150*4882a593Smuzhiyun  *		Indicates no matching entry was found in the address search
151*4882a593Smuzhiyun  *		table for the destination MAC address.
152*4882a593Smuzhiyun  *
153*4882a593Smuzhiyun  * sa_idx_timeout
154*4882a593Smuzhiyun  *		Indicates an unsuccessful search for the source MAC address
155*4882a593Smuzhiyun  *		due to the expiring of the search timer.
156*4882a593Smuzhiyun  *
157*4882a593Smuzhiyun  * da_idx_timeout
158*4882a593Smuzhiyun  *		Indicates an unsuccessful search for the destination MAC
159*4882a593Smuzhiyun  *		address due to the expiring of the search timer.
160*4882a593Smuzhiyun  *
161*4882a593Smuzhiyun  * encrypt_required
162*4882a593Smuzhiyun  *		Indicates that this data type frame is not encrypted even if
163*4882a593Smuzhiyun  *		the policy for this MPDU requires encryption as indicated in
164*4882a593Smuzhiyun  *		the peer table key type.
165*4882a593Smuzhiyun  *
166*4882a593Smuzhiyun  * directed
167*4882a593Smuzhiyun  *		MPDU is a directed packet which means that the RA matched
168*4882a593Smuzhiyun  *		our STA addresses.  In proxySTA it means that the TA matched
169*4882a593Smuzhiyun  *		an entry in our address search table with the corresponding
170*4882a593Smuzhiyun  *		'no_ack' bit is the address search entry cleared.
171*4882a593Smuzhiyun  *
172*4882a593Smuzhiyun  * buffer_fragment
173*4882a593Smuzhiyun  *		Indicates that at least one of the rx buffers has been
174*4882a593Smuzhiyun  *		fragmented.  If set the FW should look at the rx_frag_info
175*4882a593Smuzhiyun  *		descriptor described below.
176*4882a593Smuzhiyun  *
177*4882a593Smuzhiyun  * mpdu_length_err
178*4882a593Smuzhiyun  *		Indicates that the MPDU was pre-maturely terminated
179*4882a593Smuzhiyun  *		resulting in a truncated MPDU.  Don't trust the MPDU length
180*4882a593Smuzhiyun  *		field.
181*4882a593Smuzhiyun  *
182*4882a593Smuzhiyun  * tkip_mic_err
183*4882a593Smuzhiyun  *		Indicates that the MPDU Michael integrity check failed
184*4882a593Smuzhiyun  *
185*4882a593Smuzhiyun  * decrypt_err
186*4882a593Smuzhiyun  *		Indicates that the MPDU decrypt integrity check failed
187*4882a593Smuzhiyun  *
188*4882a593Smuzhiyun  * fcs_err
189*4882a593Smuzhiyun  *		Indicates that the MPDU FCS check failed
190*4882a593Smuzhiyun  *
191*4882a593Smuzhiyun  * msdu_done
192*4882a593Smuzhiyun  *		If set indicates that the RX packet data, RX header data, RX
193*4882a593Smuzhiyun  *		PPDU start descriptor, RX MPDU start/end descriptor, RX MSDU
194*4882a593Smuzhiyun  *		start/end descriptors and RX Attention descriptor are all
195*4882a593Smuzhiyun  *		valid.  This bit must be in the last octet of the
196*4882a593Smuzhiyun  *		descriptor.
197*4882a593Smuzhiyun  */
198*4882a593Smuzhiyun 
199*4882a593Smuzhiyun struct rx_frag_info {
200*4882a593Smuzhiyun 	u8 ring0_more_count;
201*4882a593Smuzhiyun 	u8 ring1_more_count;
202*4882a593Smuzhiyun 	u8 ring2_more_count;
203*4882a593Smuzhiyun 	u8 ring3_more_count;
204*4882a593Smuzhiyun 	u8 ring4_more_count;
205*4882a593Smuzhiyun 	u8 ring5_more_count;
206*4882a593Smuzhiyun 	u8 ring6_more_count;
207*4882a593Smuzhiyun 	u8 ring7_more_count;
208*4882a593Smuzhiyun } __packed;
209*4882a593Smuzhiyun 
210*4882a593Smuzhiyun /*
211*4882a593Smuzhiyun  * ring0_more_count
212*4882a593Smuzhiyun  *		Indicates the number of more buffers associated with RX DMA
213*4882a593Smuzhiyun  *		ring 0.  Field is filled in by the RX_DMA.
214*4882a593Smuzhiyun  *
215*4882a593Smuzhiyun  * ring1_more_count
216*4882a593Smuzhiyun  *		Indicates the number of more buffers associated with RX DMA
217*4882a593Smuzhiyun  *		ring 1. Field is filled in by the RX_DMA.
218*4882a593Smuzhiyun  *
219*4882a593Smuzhiyun  * ring2_more_count
220*4882a593Smuzhiyun  *		Indicates the number of more buffers associated with RX DMA
221*4882a593Smuzhiyun  *		ring 2. Field is filled in by the RX_DMA.
222*4882a593Smuzhiyun  *
223*4882a593Smuzhiyun  * ring3_more_count
224*4882a593Smuzhiyun  *		Indicates the number of more buffers associated with RX DMA
225*4882a593Smuzhiyun  *		ring 3. Field is filled in by the RX_DMA.
226*4882a593Smuzhiyun  */
227*4882a593Smuzhiyun 
228*4882a593Smuzhiyun enum htt_rx_mpdu_encrypt_type {
229*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_WEP40            = 0,
230*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_WEP104           = 1,
231*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_TKIP_WITHOUT_MIC = 2,
232*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_WEP128           = 3,
233*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_TKIP_WPA         = 4,
234*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_WAPI             = 5,
235*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_AES_CCM_WPA2     = 6,
236*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_NONE             = 7,
237*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_AES_CCM256_WPA2  = 8,
238*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_AES_GCMP_WPA2    = 9,
239*4882a593Smuzhiyun 	HTT_RX_MPDU_ENCRYPT_AES_GCMP256_WPA2 = 10,
240*4882a593Smuzhiyun };
241*4882a593Smuzhiyun 
242*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_PEER_IDX_MASK     0x000007ff
243*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_PEER_IDX_LSB      0
244*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_SEQ_NUM_MASK      0x0fff0000
245*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_SEQ_NUM_LSB       16
246*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_ENCRYPT_TYPE_MASK 0xf0000000
247*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_ENCRYPT_TYPE_LSB  28
248*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_FROM_DS           BIT(11)
249*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_TO_DS             BIT(12)
250*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_ENCRYPTED         BIT(13)
251*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_RETRY             BIT(14)
252*4882a593Smuzhiyun #define RX_MPDU_START_INFO0_TXBF_H_INFO       BIT(15)
253*4882a593Smuzhiyun 
254*4882a593Smuzhiyun #define RX_MPDU_START_INFO1_TID_MASK 0xf0000000
255*4882a593Smuzhiyun #define RX_MPDU_START_INFO1_TID_LSB  28
256*4882a593Smuzhiyun #define RX_MPDU_START_INFO1_DIRECTED BIT(16)
257*4882a593Smuzhiyun 
258*4882a593Smuzhiyun struct rx_mpdu_start {
259*4882a593Smuzhiyun 	__le32 info0;
260*4882a593Smuzhiyun 	union {
261*4882a593Smuzhiyun 		struct {
262*4882a593Smuzhiyun 			__le32 pn31_0;
263*4882a593Smuzhiyun 			__le32 info1; /* %RX_MPDU_START_INFO1_ */
264*4882a593Smuzhiyun 		} __packed;
265*4882a593Smuzhiyun 		struct {
266*4882a593Smuzhiyun 			u8 pn[6];
267*4882a593Smuzhiyun 		} __packed;
268*4882a593Smuzhiyun 	} __packed;
269*4882a593Smuzhiyun } __packed;
270*4882a593Smuzhiyun 
271*4882a593Smuzhiyun /*
272*4882a593Smuzhiyun  * peer_idx
273*4882a593Smuzhiyun  *		The index of the address search table which associated with
274*4882a593Smuzhiyun  *		the peer table entry corresponding to this MPDU.  Only valid
275*4882a593Smuzhiyun  *		when first_msdu is set.
276*4882a593Smuzhiyun  *
277*4882a593Smuzhiyun  * fr_ds
278*4882a593Smuzhiyun  *		Set if the from DS bit is set in the frame control.  Only
279*4882a593Smuzhiyun  *		valid when first_msdu is set.
280*4882a593Smuzhiyun  *
281*4882a593Smuzhiyun  * to_ds
282*4882a593Smuzhiyun  *		Set if the to DS bit is set in the frame control.  Only
283*4882a593Smuzhiyun  *		valid when first_msdu is set.
284*4882a593Smuzhiyun  *
285*4882a593Smuzhiyun  * encrypted
286*4882a593Smuzhiyun  *		Protected bit from the frame control.  Only valid when
287*4882a593Smuzhiyun  *		first_msdu is set.
288*4882a593Smuzhiyun  *
289*4882a593Smuzhiyun  * retry
290*4882a593Smuzhiyun  *		Retry bit from the frame control.  Only valid when
291*4882a593Smuzhiyun  *		first_msdu is set.
292*4882a593Smuzhiyun  *
293*4882a593Smuzhiyun  * txbf_h_info
294*4882a593Smuzhiyun  *		The MPDU data will contain H information.  Primarily used
295*4882a593Smuzhiyun  *		for debug.
296*4882a593Smuzhiyun  *
297*4882a593Smuzhiyun  * seq_num
298*4882a593Smuzhiyun  *		The sequence number from the 802.11 header.  Only valid when
299*4882a593Smuzhiyun  *		first_msdu is set.
300*4882a593Smuzhiyun  *
301*4882a593Smuzhiyun  * encrypt_type
302*4882a593Smuzhiyun  *		Indicates type of decrypt cipher used (as defined in the
303*4882a593Smuzhiyun  *		peer table)
304*4882a593Smuzhiyun  *		0: WEP40
305*4882a593Smuzhiyun  *		1: WEP104
306*4882a593Smuzhiyun  *		2: TKIP without MIC
307*4882a593Smuzhiyun  *		3: WEP128
308*4882a593Smuzhiyun  *		4: TKIP (WPA)
309*4882a593Smuzhiyun  *		5: WAPI
310*4882a593Smuzhiyun  *		6: AES-CCM (WPA2)
311*4882a593Smuzhiyun  *		7: No cipher
312*4882a593Smuzhiyun  *		Only valid when first_msdu_is set
313*4882a593Smuzhiyun  *
314*4882a593Smuzhiyun  * pn_31_0
315*4882a593Smuzhiyun  *		Bits [31:0] of the PN number extracted from the IV field
316*4882a593Smuzhiyun  *		WEP: IV = {key_id_octet, pn2, pn1, pn0}.  Only pn[23:0] is
317*4882a593Smuzhiyun  *		valid.
318*4882a593Smuzhiyun  *		TKIP: IV = {pn5, pn4, pn3, pn2, key_id_octet, pn0,
319*4882a593Smuzhiyun  *		WEPSeed[1], pn1}.  Only pn[47:0] is valid.
320*4882a593Smuzhiyun  *		AES-CCM: IV = {pn5, pn4, pn3, pn2, key_id_octet, 0x0, pn1,
321*4882a593Smuzhiyun  *		pn0}.  Only pn[47:0] is valid.
322*4882a593Smuzhiyun  *		WAPI: IV = {key_id_octet, 0x0, pn15, pn14, pn13, pn12, pn11,
323*4882a593Smuzhiyun  *		pn10, pn9, pn8, pn7, pn6, pn5, pn4, pn3, pn2, pn1, pn0}.
324*4882a593Smuzhiyun  *		The ext_wapi_pn[127:48] in the rx_msdu_misc descriptor and
325*4882a593Smuzhiyun  *		pn[47:0] are valid.
326*4882a593Smuzhiyun  *		Only valid when first_msdu is set.
327*4882a593Smuzhiyun  *
328*4882a593Smuzhiyun  * pn_47_32
329*4882a593Smuzhiyun  *		Bits [47:32] of the PN number.   See description for
330*4882a593Smuzhiyun  *		pn_31_0.  The remaining PN fields are in the rx_msdu_end
331*4882a593Smuzhiyun  *		descriptor
332*4882a593Smuzhiyun  *
333*4882a593Smuzhiyun  * pn
334*4882a593Smuzhiyun  *		Use this field to access the pn without worrying about
335*4882a593Smuzhiyun  *		byte-order and bitmasking/bitshifting.
336*4882a593Smuzhiyun  *
337*4882a593Smuzhiyun  * directed
338*4882a593Smuzhiyun  *		See definition in RX attention descriptor
339*4882a593Smuzhiyun  *
340*4882a593Smuzhiyun  * reserved_2
341*4882a593Smuzhiyun  *		Reserved: HW should fill with zero.  FW should ignore.
342*4882a593Smuzhiyun  *
343*4882a593Smuzhiyun  * tid
344*4882a593Smuzhiyun  *		The TID field in the QoS control field
345*4882a593Smuzhiyun  */
346*4882a593Smuzhiyun 
347*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_RESERVED_0_MASK     0x00001fff
348*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_RESERVED_0_LSB      0
349*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_POST_DELIM_CNT_MASK 0x0fff0000
350*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_POST_DELIM_CNT_LSB  16
351*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_OVERFLOW_ERR        BIT(13)
352*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_LAST_MPDU           BIT(14)
353*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_POST_DELIM_ERR      BIT(15)
354*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_MPDU_LENGTH_ERR     BIT(28)
355*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_TKIP_MIC_ERR        BIT(29)
356*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_DECRYPT_ERR         BIT(30)
357*4882a593Smuzhiyun #define RX_MPDU_END_INFO0_FCS_ERR             BIT(31)
358*4882a593Smuzhiyun 
359*4882a593Smuzhiyun struct rx_mpdu_end {
360*4882a593Smuzhiyun 	__le32 info0;
361*4882a593Smuzhiyun } __packed;
362*4882a593Smuzhiyun 
363*4882a593Smuzhiyun /*
364*4882a593Smuzhiyun  * reserved_0
365*4882a593Smuzhiyun  *		Reserved
366*4882a593Smuzhiyun  *
367*4882a593Smuzhiyun  * overflow_err
368*4882a593Smuzhiyun  *		PCU Receive FIFO does not have enough space to store the
369*4882a593Smuzhiyun  *		full receive packet.  Enough space is reserved in the
370*4882a593Smuzhiyun  *		receive FIFO for the status is written.  This MPDU remaining
371*4882a593Smuzhiyun  *		packets in the PPDU will be filtered and no Ack response
372*4882a593Smuzhiyun  *		will be transmitted.
373*4882a593Smuzhiyun  *
374*4882a593Smuzhiyun  * last_mpdu
375*4882a593Smuzhiyun  *		Indicates that this is the last MPDU of a PPDU.
376*4882a593Smuzhiyun  *
377*4882a593Smuzhiyun  * post_delim_err
378*4882a593Smuzhiyun  *		Indicates that a delimiter FCS error occurred after this
379*4882a593Smuzhiyun  *		MPDU before the next MPDU.  Only valid when last_msdu is
380*4882a593Smuzhiyun  *		set.
381*4882a593Smuzhiyun  *
382*4882a593Smuzhiyun  * post_delim_cnt
383*4882a593Smuzhiyun  *		Count of the delimiters after this MPDU.  This requires the
384*4882a593Smuzhiyun  *		last MPDU to be held until all the EOF descriptors have been
385*4882a593Smuzhiyun  *		received.  This may be inefficient in the future when
386*4882a593Smuzhiyun  *		ML-MIMO is used.  Only valid when last_mpdu is set.
387*4882a593Smuzhiyun  *
388*4882a593Smuzhiyun  * mpdu_length_err
389*4882a593Smuzhiyun  *		See definition in RX attention descriptor
390*4882a593Smuzhiyun  *
391*4882a593Smuzhiyun  * tkip_mic_err
392*4882a593Smuzhiyun  *		See definition in RX attention descriptor
393*4882a593Smuzhiyun  *
394*4882a593Smuzhiyun  * decrypt_err
395*4882a593Smuzhiyun  *		See definition in RX attention descriptor
396*4882a593Smuzhiyun  *
397*4882a593Smuzhiyun  * fcs_err
398*4882a593Smuzhiyun  *		See definition in RX attention descriptor
399*4882a593Smuzhiyun  */
400*4882a593Smuzhiyun 
401*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_MSDU_LENGTH_MASK    0x00003fff
402*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_MSDU_LENGTH_LSB     0
403*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_IP_OFFSET_MASK      0x000fc000
404*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_IP_OFFSET_LSB       14
405*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_RING_MASK_MASK      0x00f00000
406*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_RING_MASK_LSB       20
407*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_TCP_UDP_OFFSET_MASK 0x7f000000
408*4882a593Smuzhiyun #define RX_MSDU_START_INFO0_TCP_UDP_OFFSET_LSB  24
409*4882a593Smuzhiyun 
410*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_MSDU_NUMBER_MASK    0x000000ff
411*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_MSDU_NUMBER_LSB     0
412*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_DECAP_FORMAT_MASK   0x00000300
413*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_DECAP_FORMAT_LSB    8
414*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_SA_IDX_MASK         0x07ff0000
415*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_SA_IDX_LSB          16
416*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_IPV4_PROTO          BIT(10)
417*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_IPV6_PROTO          BIT(11)
418*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_TCP_PROTO           BIT(12)
419*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_UDP_PROTO           BIT(13)
420*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_IP_FRAG             BIT(14)
421*4882a593Smuzhiyun #define RX_MSDU_START_INFO1_TCP_ONLY_ACK        BIT(15)
422*4882a593Smuzhiyun 
423*4882a593Smuzhiyun #define RX_MSDU_START_INFO2_DA_IDX_MASK         0x000007ff
424*4882a593Smuzhiyun #define RX_MSDU_START_INFO2_DA_IDX_LSB          0
425*4882a593Smuzhiyun #define RX_MSDU_START_INFO2_IP_PROTO_FIELD_MASK 0x00ff0000
426*4882a593Smuzhiyun #define RX_MSDU_START_INFO2_IP_PROTO_FIELD_LSB  16
427*4882a593Smuzhiyun #define RX_MSDU_START_INFO2_DA_BCAST_MCAST      BIT(11)
428*4882a593Smuzhiyun 
429*4882a593Smuzhiyun /* The decapped header (rx_hdr_status) contains the following:
430*4882a593Smuzhiyun  *  a) 802.11 header
431*4882a593Smuzhiyun  *  [padding to 4 bytes]
432*4882a593Smuzhiyun  *  b) HW crypto parameter
433*4882a593Smuzhiyun  *     - 0 bytes for no security
434*4882a593Smuzhiyun  *     - 4 bytes for WEP
435*4882a593Smuzhiyun  *     - 8 bytes for TKIP, AES
436*4882a593Smuzhiyun  *  [padding to 4 bytes]
437*4882a593Smuzhiyun  *  c) A-MSDU subframe header (14 bytes) if appliable
438*4882a593Smuzhiyun  *  d) LLC/SNAP (RFC1042, 8 bytes)
439*4882a593Smuzhiyun  *
440*4882a593Smuzhiyun  * In case of A-MSDU only first frame in sequence contains (a) and (b).
441*4882a593Smuzhiyun  */
442*4882a593Smuzhiyun enum rx_msdu_decap_format {
443*4882a593Smuzhiyun 	RX_MSDU_DECAP_RAW = 0,
444*4882a593Smuzhiyun 
445*4882a593Smuzhiyun 	/* Note: QoS frames are reported as non-QoS. The rx_hdr_status in
446*4882a593Smuzhiyun 	 * htt_rx_desc contains the original decapped 802.11 header.
447*4882a593Smuzhiyun 	 */
448*4882a593Smuzhiyun 	RX_MSDU_DECAP_NATIVE_WIFI = 1,
449*4882a593Smuzhiyun 
450*4882a593Smuzhiyun 	/* Payload contains an ethernet header (struct ethhdr). */
451*4882a593Smuzhiyun 	RX_MSDU_DECAP_ETHERNET2_DIX = 2,
452*4882a593Smuzhiyun 
453*4882a593Smuzhiyun 	/* Payload contains two 48-bit addresses and 2-byte length (14 bytes
454*4882a593Smuzhiyun 	 * total), followed by an RFC1042 header (8 bytes).
455*4882a593Smuzhiyun 	 */
456*4882a593Smuzhiyun 	RX_MSDU_DECAP_8023_SNAP_LLC = 3
457*4882a593Smuzhiyun };
458*4882a593Smuzhiyun 
459*4882a593Smuzhiyun struct rx_msdu_start_common {
460*4882a593Smuzhiyun 	__le32 info0; /* %RX_MSDU_START_INFO0_ */
461*4882a593Smuzhiyun 	__le32 flow_id_crc;
462*4882a593Smuzhiyun 	__le32 info1; /* %RX_MSDU_START_INFO1_ */
463*4882a593Smuzhiyun } __packed;
464*4882a593Smuzhiyun 
465*4882a593Smuzhiyun struct rx_msdu_start_qca99x0 {
466*4882a593Smuzhiyun 	__le32 info2; /* %RX_MSDU_START_INFO2_ */
467*4882a593Smuzhiyun } __packed;
468*4882a593Smuzhiyun 
469*4882a593Smuzhiyun struct rx_msdu_start_wcn3990 {
470*4882a593Smuzhiyun 	__le32 info2; /* %RX_MSDU_START_INFO2_ */
471*4882a593Smuzhiyun 	__le32 info3; /* %RX_MSDU_START_INFO3_ */
472*4882a593Smuzhiyun } __packed;
473*4882a593Smuzhiyun 
474*4882a593Smuzhiyun struct rx_msdu_start {
475*4882a593Smuzhiyun 	struct rx_msdu_start_common common;
476*4882a593Smuzhiyun 	union {
477*4882a593Smuzhiyun 		struct rx_msdu_start_qca99x0 qca99x0;
478*4882a593Smuzhiyun 		struct rx_msdu_start_wcn3990 wcn3990;
479*4882a593Smuzhiyun 	} __packed;
480*4882a593Smuzhiyun } __packed;
481*4882a593Smuzhiyun 
482*4882a593Smuzhiyun /*
483*4882a593Smuzhiyun  * msdu_length
484*4882a593Smuzhiyun  *		MSDU length in bytes after decapsulation.  This field is
485*4882a593Smuzhiyun  *		still valid for MPDU frames without A-MSDU.  It still
486*4882a593Smuzhiyun  *		represents MSDU length after decapsulation
487*4882a593Smuzhiyun  *
488*4882a593Smuzhiyun  * ip_offset
489*4882a593Smuzhiyun  *		Indicates the IP offset in bytes from the start of the
490*4882a593Smuzhiyun  *		packet after decapsulation.  Only valid if ipv4_proto or
491*4882a593Smuzhiyun  *		ipv6_proto is set.
492*4882a593Smuzhiyun  *
493*4882a593Smuzhiyun  * ring_mask
494*4882a593Smuzhiyun  *		Indicates the destination RX rings for this MSDU.
495*4882a593Smuzhiyun  *
496*4882a593Smuzhiyun  * tcp_udp_offset
497*4882a593Smuzhiyun  *		Indicates the offset in bytes to the start of TCP or UDP
498*4882a593Smuzhiyun  *		header from the start of the IP header after decapsulation.
499*4882a593Smuzhiyun  *		Only valid if tcp_prot or udp_prot is set.  The value 0
500*4882a593Smuzhiyun  *		indicates that the offset is longer than 127 bytes.
501*4882a593Smuzhiyun  *
502*4882a593Smuzhiyun  * reserved_0c
503*4882a593Smuzhiyun  *		Reserved: HW should fill with zero.  FW should ignore.
504*4882a593Smuzhiyun  *
505*4882a593Smuzhiyun  * flow_id_crc
506*4882a593Smuzhiyun  *		The flow_id_crc runs CRC32 on the following information:
507*4882a593Smuzhiyun  *		IPv4 option: dest_addr[31:0], src_addr [31:0], {24'b0,
508*4882a593Smuzhiyun  *		protocol[7:0]}.
509*4882a593Smuzhiyun  *		IPv6 option: dest_addr[127:0], src_addr [127:0], {24'b0,
510*4882a593Smuzhiyun  *		next_header[7:0]}
511*4882a593Smuzhiyun  *		UDP case: sort_port[15:0], dest_port[15:0]
512*4882a593Smuzhiyun  *		TCP case: sort_port[15:0], dest_port[15:0],
513*4882a593Smuzhiyun  *		{header_length[3:0], 6'b0, flags[5:0], window_size[15:0]},
514*4882a593Smuzhiyun  *		{16'b0, urgent_ptr[15:0]}, all options except 32-bit
515*4882a593Smuzhiyun  *		timestamp.
516*4882a593Smuzhiyun  *
517*4882a593Smuzhiyun  * msdu_number
518*4882a593Smuzhiyun  *		Indicates the MSDU number within a MPDU.  This value is
519*4882a593Smuzhiyun  *		reset to zero at the start of each MPDU.  If the number of
520*4882a593Smuzhiyun  *		MSDU exceeds 255 this number will wrap using modulo 256.
521*4882a593Smuzhiyun  *
522*4882a593Smuzhiyun  * decap_format
523*4882a593Smuzhiyun  *		Indicates the format after decapsulation:
524*4882a593Smuzhiyun  *		0: RAW: No decapsulation
525*4882a593Smuzhiyun  *		1: Native WiFi
526*4882a593Smuzhiyun  *		2: Ethernet 2 (DIX)
527*4882a593Smuzhiyun  *		3: 802.3 (SNAP/LLC)
528*4882a593Smuzhiyun  *
529*4882a593Smuzhiyun  * ipv4_proto
530*4882a593Smuzhiyun  *		Set if L2 layer indicates IPv4 protocol.
531*4882a593Smuzhiyun  *
532*4882a593Smuzhiyun  * ipv6_proto
533*4882a593Smuzhiyun  *		Set if L2 layer indicates IPv6 protocol.
534*4882a593Smuzhiyun  *
535*4882a593Smuzhiyun  * tcp_proto
536*4882a593Smuzhiyun  *		Set if the ipv4_proto or ipv6_proto are set and the IP
537*4882a593Smuzhiyun  *		protocol indicates TCP.
538*4882a593Smuzhiyun  *
539*4882a593Smuzhiyun  * udp_proto
540*4882a593Smuzhiyun  *		Set if the ipv4_proto or ipv6_proto are set and the IP
541*4882a593Smuzhiyun  *			protocol indicates UDP.
542*4882a593Smuzhiyun  *
543*4882a593Smuzhiyun  * ip_frag
544*4882a593Smuzhiyun  *		Indicates that either the IP More frag bit is set or IP frag
545*4882a593Smuzhiyun  *		number is non-zero.  If set indicates that this is a
546*4882a593Smuzhiyun  *		fragmented IP packet.
547*4882a593Smuzhiyun  *
548*4882a593Smuzhiyun  * tcp_only_ack
549*4882a593Smuzhiyun  *		Set if only the TCP Ack bit is set in the TCP flags and if
550*4882a593Smuzhiyun  *		the TCP payload is 0.
551*4882a593Smuzhiyun  *
552*4882a593Smuzhiyun  * sa_idx
553*4882a593Smuzhiyun  *		The offset in the address table which matches the MAC source
554*4882a593Smuzhiyun  *		address.
555*4882a593Smuzhiyun  *
556*4882a593Smuzhiyun  * reserved_2b
557*4882a593Smuzhiyun  *		Reserved: HW should fill with zero.  FW should ignore.
558*4882a593Smuzhiyun  */
559*4882a593Smuzhiyun 
560*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_MASK 0x00003fff
561*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_REPORTED_MPDU_LENGTH_LSB  0
562*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_FIRST_MSDU                BIT(14)
563*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_LAST_MSDU                 BIT(15)
564*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_MSDU_LIMIT_ERR            BIT(18)
565*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_PRE_DELIM_ERR             BIT(30)
566*4882a593Smuzhiyun #define RX_MSDU_END_INFO0_RESERVED_3B               BIT(31)
567*4882a593Smuzhiyun 
568*4882a593Smuzhiyun struct rx_msdu_end_common {
569*4882a593Smuzhiyun 	__le16 ip_hdr_cksum;
570*4882a593Smuzhiyun 	__le16 tcp_hdr_cksum;
571*4882a593Smuzhiyun 	u8 key_id_octet;
572*4882a593Smuzhiyun 	u8 classification_filter;
573*4882a593Smuzhiyun 	u8 wapi_pn[10];
574*4882a593Smuzhiyun 	__le32 info0;
575*4882a593Smuzhiyun } __packed;
576*4882a593Smuzhiyun 
577*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_TCP_FLAG_MASK     0x000001ff
578*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_TCP_FLAG_LSB      0
579*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_L3_HDR_PAD_MASK   0x00001c00
580*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_L3_HDR_PAD_LSB    10
581*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_WINDOW_SIZE_MASK  0xffff0000
582*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_WINDOW_SIZE_LSB   16
583*4882a593Smuzhiyun #define RX_MSDU_END_INFO1_IRO_ELIGIBLE      BIT(9)
584*4882a593Smuzhiyun 
585*4882a593Smuzhiyun #define RX_MSDU_END_INFO2_DA_OFFSET_MASK    0x0000003f
586*4882a593Smuzhiyun #define RX_MSDU_END_INFO2_DA_OFFSET_LSB     0
587*4882a593Smuzhiyun #define RX_MSDU_END_INFO2_SA_OFFSET_MASK    0x00000fc0
588*4882a593Smuzhiyun #define RX_MSDU_END_INFO2_SA_OFFSET_LSB     6
589*4882a593Smuzhiyun #define RX_MSDU_END_INFO2_TYPE_OFFSET_MASK  0x0003f000
590*4882a593Smuzhiyun #define RX_MSDU_END_INFO2_TYPE_OFFSET_LSB   12
591*4882a593Smuzhiyun 
592*4882a593Smuzhiyun struct rx_msdu_end_qca99x0 {
593*4882a593Smuzhiyun 	__le32 ipv6_crc;
594*4882a593Smuzhiyun 	__le32 tcp_seq_no;
595*4882a593Smuzhiyun 	__le32 tcp_ack_no;
596*4882a593Smuzhiyun 	__le32 info1;
597*4882a593Smuzhiyun 	__le32 info2;
598*4882a593Smuzhiyun } __packed;
599*4882a593Smuzhiyun 
600*4882a593Smuzhiyun struct rx_msdu_end_wcn3990 {
601*4882a593Smuzhiyun 	__le32 ipv6_crc;
602*4882a593Smuzhiyun 	__le32 tcp_seq_no;
603*4882a593Smuzhiyun 	__le32 tcp_ack_no;
604*4882a593Smuzhiyun 	__le32 info1;
605*4882a593Smuzhiyun 	__le32 info2;
606*4882a593Smuzhiyun 	__le32 rule_indication_0;
607*4882a593Smuzhiyun 	__le32 rule_indication_1;
608*4882a593Smuzhiyun 	__le32 rule_indication_2;
609*4882a593Smuzhiyun 	__le32 rule_indication_3;
610*4882a593Smuzhiyun } __packed;
611*4882a593Smuzhiyun 
612*4882a593Smuzhiyun struct rx_msdu_end {
613*4882a593Smuzhiyun 	struct rx_msdu_end_common common;
614*4882a593Smuzhiyun 	union {
615*4882a593Smuzhiyun 		struct rx_msdu_end_qca99x0 qca99x0;
616*4882a593Smuzhiyun 		struct rx_msdu_end_wcn3990 wcn3990;
617*4882a593Smuzhiyun 	} __packed;
618*4882a593Smuzhiyun } __packed;
619*4882a593Smuzhiyun 
620*4882a593Smuzhiyun /*
621*4882a593Smuzhiyun  *ip_hdr_chksum
622*4882a593Smuzhiyun  *		This can include the IP header checksum or the pseudo header
623*4882a593Smuzhiyun  *		checksum used by TCP/UDP checksum.
624*4882a593Smuzhiyun  *
625*4882a593Smuzhiyun  *tcp_udp_chksum
626*4882a593Smuzhiyun  *		The value of the computed TCP/UDP checksum.  A mode bit
627*4882a593Smuzhiyun  *		selects whether this checksum is the full checksum or the
628*4882a593Smuzhiyun  *		partial checksum which does not include the pseudo header.
629*4882a593Smuzhiyun  *
630*4882a593Smuzhiyun  *key_id_octet
631*4882a593Smuzhiyun  *		The key ID octet from the IV.  Only valid when first_msdu is
632*4882a593Smuzhiyun  *		set.
633*4882a593Smuzhiyun  *
634*4882a593Smuzhiyun  *classification_filter
635*4882a593Smuzhiyun  *		Indicates the number classification filter rule
636*4882a593Smuzhiyun  *
637*4882a593Smuzhiyun  *ext_wapi_pn_63_48
638*4882a593Smuzhiyun  *		Extension PN (packet number) which is only used by WAPI.
639*4882a593Smuzhiyun  *		This corresponds to WAPI PN bits [63:48] (pn6 and pn7).  The
640*4882a593Smuzhiyun  *		WAPI PN bits [63:0] are in the pn field of the rx_mpdu_start
641*4882a593Smuzhiyun  *		descriptor.
642*4882a593Smuzhiyun  *
643*4882a593Smuzhiyun  *ext_wapi_pn_95_64
644*4882a593Smuzhiyun  *		Extension PN (packet number) which is only used by WAPI.
645*4882a593Smuzhiyun  *		This corresponds to WAPI PN bits [95:64] (pn8, pn9, pn10 and
646*4882a593Smuzhiyun  *		pn11).
647*4882a593Smuzhiyun  *
648*4882a593Smuzhiyun  *ext_wapi_pn_127_96
649*4882a593Smuzhiyun  *		Extension PN (packet number) which is only used by WAPI.
650*4882a593Smuzhiyun  *		This corresponds to WAPI PN bits [127:96] (pn12, pn13, pn14,
651*4882a593Smuzhiyun  *		pn15).
652*4882a593Smuzhiyun  *
653*4882a593Smuzhiyun  *reported_mpdu_length
654*4882a593Smuzhiyun  *		MPDU length before decapsulation.  Only valid when
655*4882a593Smuzhiyun  *		first_msdu is set.  This field is taken directly from the
656*4882a593Smuzhiyun  *		length field of the A-MPDU delimiter or the preamble length
657*4882a593Smuzhiyun  *		field for non-A-MPDU frames.
658*4882a593Smuzhiyun  *
659*4882a593Smuzhiyun  *first_msdu
660*4882a593Smuzhiyun  *		Indicates the first MSDU of A-MSDU.  If both first_msdu and
661*4882a593Smuzhiyun  *		last_msdu are set in the MSDU then this is a non-aggregated
662*4882a593Smuzhiyun  *		MSDU frame: normal MPDU.  Interior MSDU in an A-MSDU shall
663*4882a593Smuzhiyun  *		have both first_mpdu and last_mpdu bits set to 0.
664*4882a593Smuzhiyun  *
665*4882a593Smuzhiyun  *last_msdu
666*4882a593Smuzhiyun  *		Indicates the last MSDU of the A-MSDU.  MPDU end status is
667*4882a593Smuzhiyun  *		only valid when last_msdu is set.
668*4882a593Smuzhiyun  *
669*4882a593Smuzhiyun  *msdu_limit_error
670*4882a593Smuzhiyun  *		Indicates that the MSDU threshold was exceeded and thus
671*4882a593Smuzhiyun  *		all the rest of the MSDUs will not be scattered and
672*4882a593Smuzhiyun  *		will not be decapsulated but will be received in RAW format
673*4882a593Smuzhiyun  *		as a single MSDU buffer.
674*4882a593Smuzhiyun  *
675*4882a593Smuzhiyun  *reserved_3a
676*4882a593Smuzhiyun  *		Reserved: HW should fill with zero.  FW should ignore.
677*4882a593Smuzhiyun  *
678*4882a593Smuzhiyun  *pre_delim_err
679*4882a593Smuzhiyun  *		Indicates that the first delimiter had a FCS failure.  Only
680*4882a593Smuzhiyun  *		valid when first_mpdu and first_msdu are set.
681*4882a593Smuzhiyun  *
682*4882a593Smuzhiyun  *reserved_3b
683*4882a593Smuzhiyun  *		Reserved: HW should fill with zero.  FW should ignore.
684*4882a593Smuzhiyun  */
685*4882a593Smuzhiyun 
686*4882a593Smuzhiyun #define HTT_RX_PPDU_START_PREAMBLE_LEGACY        0x04
687*4882a593Smuzhiyun #define HTT_RX_PPDU_START_PREAMBLE_HT            0x08
688*4882a593Smuzhiyun #define HTT_RX_PPDU_START_PREAMBLE_HT_WITH_TXBF  0x09
689*4882a593Smuzhiyun #define HTT_RX_PPDU_START_PREAMBLE_VHT           0x0C
690*4882a593Smuzhiyun #define HTT_RX_PPDU_START_PREAMBLE_VHT_WITH_TXBF 0x0D
691*4882a593Smuzhiyun 
692*4882a593Smuzhiyun #define RX_PPDU_START_INFO0_IS_GREENFIELD BIT(0)
693*4882a593Smuzhiyun 
694*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_RATE_MASK    0x0000000f
695*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_RATE_LSB     0
696*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_LENGTH_MASK  0x0001ffe0
697*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_LENGTH_LSB   5
698*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_TAIL_MASK    0x00fc0000
699*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_TAIL_LSB     18
700*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_MASK 0xff000000
701*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_PREAMBLE_TYPE_LSB  24
702*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_RATE_SELECT  BIT(4)
703*4882a593Smuzhiyun #define RX_PPDU_START_INFO1_L_SIG_PARITY       BIT(17)
704*4882a593Smuzhiyun 
705*4882a593Smuzhiyun #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_MASK 0x00ffffff
706*4882a593Smuzhiyun #define RX_PPDU_START_INFO2_HT_SIG_VHT_SIG_A_1_LSB  0
707*4882a593Smuzhiyun 
708*4882a593Smuzhiyun #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_MASK 0x00ffffff
709*4882a593Smuzhiyun #define RX_PPDU_START_INFO3_HT_SIG_VHT_SIG_A_2_LSB  0
710*4882a593Smuzhiyun #define RX_PPDU_START_INFO3_TXBF_H_INFO             BIT(24)
711*4882a593Smuzhiyun 
712*4882a593Smuzhiyun #define RX_PPDU_START_INFO4_VHT_SIG_B_MASK 0x1fffffff
713*4882a593Smuzhiyun #define RX_PPDU_START_INFO4_VHT_SIG_B_LSB  0
714*4882a593Smuzhiyun 
715*4882a593Smuzhiyun #define RX_PPDU_START_INFO5_SERVICE_MASK 0x0000ffff
716*4882a593Smuzhiyun #define RX_PPDU_START_INFO5_SERVICE_LSB  0
717*4882a593Smuzhiyun 
718*4882a593Smuzhiyun /* No idea what this flag means. It seems to be always set in rate. */
719*4882a593Smuzhiyun #define RX_PPDU_START_RATE_FLAG BIT(3)
720*4882a593Smuzhiyun 
721*4882a593Smuzhiyun struct rx_ppdu_start {
722*4882a593Smuzhiyun 	struct {
723*4882a593Smuzhiyun 		u8 pri20_mhz;
724*4882a593Smuzhiyun 		u8 ext20_mhz;
725*4882a593Smuzhiyun 		u8 ext40_mhz;
726*4882a593Smuzhiyun 		u8 ext80_mhz;
727*4882a593Smuzhiyun 	} rssi_chains[4];
728*4882a593Smuzhiyun 	u8 rssi_comb;
729*4882a593Smuzhiyun 	__le16 rsvd0;
730*4882a593Smuzhiyun 	u8 info0; /* %RX_PPDU_START_INFO0_ */
731*4882a593Smuzhiyun 	__le32 info1; /* %RX_PPDU_START_INFO1_ */
732*4882a593Smuzhiyun 	__le32 info2; /* %RX_PPDU_START_INFO2_ */
733*4882a593Smuzhiyun 	__le32 info3; /* %RX_PPDU_START_INFO3_ */
734*4882a593Smuzhiyun 	__le32 info4; /* %RX_PPDU_START_INFO4_ */
735*4882a593Smuzhiyun 	__le32 info5; /* %RX_PPDU_START_INFO5_ */
736*4882a593Smuzhiyun } __packed;
737*4882a593Smuzhiyun 
738*4882a593Smuzhiyun /*
739*4882a593Smuzhiyun  * rssi_chain0_pri20
740*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 0 of primary 20 MHz bandwidth.
741*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
742*4882a593Smuzhiyun  *
743*4882a593Smuzhiyun  * rssi_chain0_sec20
744*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 0 of secondary 20 MHz bandwidth.
745*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
746*4882a593Smuzhiyun  *
747*4882a593Smuzhiyun  * rssi_chain0_sec40
748*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 0 of secondary 40 MHz bandwidth.
749*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
750*4882a593Smuzhiyun  *
751*4882a593Smuzhiyun  * rssi_chain0_sec80
752*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 0 of secondary 80 MHz bandwidth.
753*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
754*4882a593Smuzhiyun  *
755*4882a593Smuzhiyun  * rssi_chain1_pri20
756*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 1 of primary 20 MHz bandwidth.
757*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
758*4882a593Smuzhiyun  *
759*4882a593Smuzhiyun  * rssi_chain1_sec20
760*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 1 of secondary 20 MHz bandwidth.
761*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
762*4882a593Smuzhiyun  *
763*4882a593Smuzhiyun  * rssi_chain1_sec40
764*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 1 of secondary 40 MHz bandwidth.
765*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
766*4882a593Smuzhiyun  *
767*4882a593Smuzhiyun  * rssi_chain1_sec80
768*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 1 of secondary 80 MHz bandwidth.
769*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
770*4882a593Smuzhiyun  *
771*4882a593Smuzhiyun  * rssi_chain2_pri20
772*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 2 of primary 20 MHz bandwidth.
773*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
774*4882a593Smuzhiyun  *
775*4882a593Smuzhiyun  * rssi_chain2_sec20
776*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 2 of secondary 20 MHz bandwidth.
777*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
778*4882a593Smuzhiyun  *
779*4882a593Smuzhiyun  * rssi_chain2_sec40
780*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 2 of secondary 40 MHz bandwidth.
781*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
782*4882a593Smuzhiyun  *
783*4882a593Smuzhiyun  * rssi_chain2_sec80
784*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 2 of secondary 80 MHz bandwidth.
785*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
786*4882a593Smuzhiyun  *
787*4882a593Smuzhiyun  * rssi_chain3_pri20
788*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 3 of primary 20 MHz bandwidth.
789*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
790*4882a593Smuzhiyun  *
791*4882a593Smuzhiyun  * rssi_chain3_sec20
792*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 3 of secondary 20 MHz bandwidth.
793*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
794*4882a593Smuzhiyun  *
795*4882a593Smuzhiyun  * rssi_chain3_sec40
796*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 3 of secondary 40 MHz bandwidth.
797*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
798*4882a593Smuzhiyun  *
799*4882a593Smuzhiyun  * rssi_chain3_sec80
800*4882a593Smuzhiyun  *		RSSI of RX PPDU on chain 3 of secondary 80 MHz bandwidth.
801*4882a593Smuzhiyun  *		Value of 0x80 indicates invalid.
802*4882a593Smuzhiyun  *
803*4882a593Smuzhiyun  * rssi_comb
804*4882a593Smuzhiyun  *		The combined RSSI of RX PPDU of all active chains and
805*4882a593Smuzhiyun  *		bandwidths.  Value of 0x80 indicates invalid.
806*4882a593Smuzhiyun  *
807*4882a593Smuzhiyun  * reserved_4a
808*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
809*4882a593Smuzhiyun  *
810*4882a593Smuzhiyun  * is_greenfield
811*4882a593Smuzhiyun  *		Do we really support this?
812*4882a593Smuzhiyun  *
813*4882a593Smuzhiyun  * reserved_4b
814*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
815*4882a593Smuzhiyun  *
816*4882a593Smuzhiyun  * l_sig_rate
817*4882a593Smuzhiyun  *		If l_sig_rate_select is 0:
818*4882a593Smuzhiyun  *		0x8: OFDM 48 Mbps
819*4882a593Smuzhiyun  *		0x9: OFDM 24 Mbps
820*4882a593Smuzhiyun  *		0xA: OFDM 12 Mbps
821*4882a593Smuzhiyun  *		0xB: OFDM 6 Mbps
822*4882a593Smuzhiyun  *		0xC: OFDM 54 Mbps
823*4882a593Smuzhiyun  *		0xD: OFDM 36 Mbps
824*4882a593Smuzhiyun  *		0xE: OFDM 18 Mbps
825*4882a593Smuzhiyun  *		0xF: OFDM 9 Mbps
826*4882a593Smuzhiyun  *		If l_sig_rate_select is 1:
827*4882a593Smuzhiyun  *		0x8: CCK 11 Mbps long preamble
828*4882a593Smuzhiyun  *		0x9: CCK 5.5 Mbps long preamble
829*4882a593Smuzhiyun  *		0xA: CCK 2 Mbps long preamble
830*4882a593Smuzhiyun  *		0xB: CCK 1 Mbps long preamble
831*4882a593Smuzhiyun  *		0xC: CCK 11 Mbps short preamble
832*4882a593Smuzhiyun  *		0xD: CCK 5.5 Mbps short preamble
833*4882a593Smuzhiyun  *		0xE: CCK 2 Mbps short preamble
834*4882a593Smuzhiyun  *
835*4882a593Smuzhiyun  * l_sig_rate_select
836*4882a593Smuzhiyun  *		Legacy signal rate select.  If set then l_sig_rate indicates
837*4882a593Smuzhiyun  *		CCK rates.  If clear then l_sig_rate indicates OFDM rates.
838*4882a593Smuzhiyun  *
839*4882a593Smuzhiyun  * l_sig_length
840*4882a593Smuzhiyun  *		Length of legacy frame in octets.
841*4882a593Smuzhiyun  *
842*4882a593Smuzhiyun  * l_sig_parity
843*4882a593Smuzhiyun  *		Odd parity over l_sig_rate and l_sig_length
844*4882a593Smuzhiyun  *
845*4882a593Smuzhiyun  * l_sig_tail
846*4882a593Smuzhiyun  *		Tail bits for Viterbi decoder
847*4882a593Smuzhiyun  *
848*4882a593Smuzhiyun  * preamble_type
849*4882a593Smuzhiyun  *		Indicates the type of preamble ahead:
850*4882a593Smuzhiyun  *		0x4: Legacy (OFDM/CCK)
851*4882a593Smuzhiyun  *		0x8: HT
852*4882a593Smuzhiyun  *		0x9: HT with TxBF
853*4882a593Smuzhiyun  *		0xC: VHT
854*4882a593Smuzhiyun  *		0xD: VHT with TxBF
855*4882a593Smuzhiyun  *		0x80 - 0xFF: Reserved for special baseband data types such
856*4882a593Smuzhiyun  *		as radar and spectral scan.
857*4882a593Smuzhiyun  *
858*4882a593Smuzhiyun  * ht_sig_vht_sig_a_1
859*4882a593Smuzhiyun  *		If preamble_type == 0x8 or 0x9
860*4882a593Smuzhiyun  *		HT-SIG (first 24 bits)
861*4882a593Smuzhiyun  *		If preamble_type == 0xC or 0xD
862*4882a593Smuzhiyun  *		VHT-SIG A (first 24 bits)
863*4882a593Smuzhiyun  *		Else
864*4882a593Smuzhiyun  *		Reserved
865*4882a593Smuzhiyun  *
866*4882a593Smuzhiyun  * reserved_6
867*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
868*4882a593Smuzhiyun  *
869*4882a593Smuzhiyun  * ht_sig_vht_sig_a_2
870*4882a593Smuzhiyun  *		If preamble_type == 0x8 or 0x9
871*4882a593Smuzhiyun  *		HT-SIG (last 24 bits)
872*4882a593Smuzhiyun  *		If preamble_type == 0xC or 0xD
873*4882a593Smuzhiyun  *		VHT-SIG A (last 24 bits)
874*4882a593Smuzhiyun  *		Else
875*4882a593Smuzhiyun  *		Reserved
876*4882a593Smuzhiyun  *
877*4882a593Smuzhiyun  * txbf_h_info
878*4882a593Smuzhiyun  *		Indicates that the packet data carries H information which
879*4882a593Smuzhiyun  *		is used for TxBF debug.
880*4882a593Smuzhiyun  *
881*4882a593Smuzhiyun  * reserved_7
882*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
883*4882a593Smuzhiyun  *
884*4882a593Smuzhiyun  * vht_sig_b
885*4882a593Smuzhiyun  *		WiFi 1.0 and WiFi 2.0 will likely have this field to be all
886*4882a593Smuzhiyun  *		0s since the BB does not plan on decoding VHT SIG-B.
887*4882a593Smuzhiyun  *
888*4882a593Smuzhiyun  * reserved_8
889*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
890*4882a593Smuzhiyun  *
891*4882a593Smuzhiyun  * service
892*4882a593Smuzhiyun  *		Service field from BB for OFDM, HT and VHT packets.  CCK
893*4882a593Smuzhiyun  *		packets will have service field of 0.
894*4882a593Smuzhiyun  *
895*4882a593Smuzhiyun  * reserved_9
896*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
897*4882a593Smuzhiyun  */
898*4882a593Smuzhiyun 
899*4882a593Smuzhiyun #define RX_PPDU_END_FLAGS_PHY_ERR             BIT(0)
900*4882a593Smuzhiyun #define RX_PPDU_END_FLAGS_RX_LOCATION         BIT(1)
901*4882a593Smuzhiyun #define RX_PPDU_END_FLAGS_TXBF_H_INFO         BIT(2)
902*4882a593Smuzhiyun 
903*4882a593Smuzhiyun #define RX_PPDU_END_INFO0_RX_ANTENNA_MASK     0x00ffffff
904*4882a593Smuzhiyun #define RX_PPDU_END_INFO0_RX_ANTENNA_LSB      0
905*4882a593Smuzhiyun #define RX_PPDU_END_INFO0_FLAGS_TX_HT_VHT_ACK BIT(24)
906*4882a593Smuzhiyun #define RX_PPDU_END_INFO0_BB_CAPTURED_CHANNEL BIT(25)
907*4882a593Smuzhiyun 
908*4882a593Smuzhiyun #define RX_PPDU_END_INFO1_PEER_IDX_MASK       0x1ffc
909*4882a593Smuzhiyun #define RX_PPDU_END_INFO1_PEER_IDX_LSB        2
910*4882a593Smuzhiyun #define RX_PPDU_END_INFO1_BB_DATA             BIT(0)
911*4882a593Smuzhiyun #define RX_PPDU_END_INFO1_PEER_IDX_VALID      BIT(1)
912*4882a593Smuzhiyun #define RX_PPDU_END_INFO1_PPDU_DONE           BIT(15)
913*4882a593Smuzhiyun 
914*4882a593Smuzhiyun struct rx_ppdu_end_common {
915*4882a593Smuzhiyun 	__le32 evm_p0;
916*4882a593Smuzhiyun 	__le32 evm_p1;
917*4882a593Smuzhiyun 	__le32 evm_p2;
918*4882a593Smuzhiyun 	__le32 evm_p3;
919*4882a593Smuzhiyun 	__le32 evm_p4;
920*4882a593Smuzhiyun 	__le32 evm_p5;
921*4882a593Smuzhiyun 	__le32 evm_p6;
922*4882a593Smuzhiyun 	__le32 evm_p7;
923*4882a593Smuzhiyun 	__le32 evm_p8;
924*4882a593Smuzhiyun 	__le32 evm_p9;
925*4882a593Smuzhiyun 	__le32 evm_p10;
926*4882a593Smuzhiyun 	__le32 evm_p11;
927*4882a593Smuzhiyun 	__le32 evm_p12;
928*4882a593Smuzhiyun 	__le32 evm_p13;
929*4882a593Smuzhiyun 	__le32 evm_p14;
930*4882a593Smuzhiyun 	__le32 evm_p15;
931*4882a593Smuzhiyun 	__le32 tsf_timestamp;
932*4882a593Smuzhiyun 	__le32 wb_timestamp;
933*4882a593Smuzhiyun } __packed;
934*4882a593Smuzhiyun 
935*4882a593Smuzhiyun struct rx_ppdu_end_qca988x {
936*4882a593Smuzhiyun 	u8 locationing_timestamp;
937*4882a593Smuzhiyun 	u8 phy_err_code;
938*4882a593Smuzhiyun 	__le16 flags; /* %RX_PPDU_END_FLAGS_ */
939*4882a593Smuzhiyun 	__le32 info0; /* %RX_PPDU_END_INFO0_ */
940*4882a593Smuzhiyun 	__le16 bb_length;
941*4882a593Smuzhiyun 	__le16 info1; /* %RX_PPDU_END_INFO1_ */
942*4882a593Smuzhiyun } __packed;
943*4882a593Smuzhiyun 
944*4882a593Smuzhiyun #define RX_PPDU_END_RTT_CORRELATION_VALUE_MASK 0x00ffffff
945*4882a593Smuzhiyun #define RX_PPDU_END_RTT_CORRELATION_VALUE_LSB  0
946*4882a593Smuzhiyun #define RX_PPDU_END_RTT_UNUSED_MASK            0x7f000000
947*4882a593Smuzhiyun #define RX_PPDU_END_RTT_UNUSED_LSB             24
948*4882a593Smuzhiyun #define RX_PPDU_END_RTT_NORMAL_MODE            BIT(31)
949*4882a593Smuzhiyun 
950*4882a593Smuzhiyun struct rx_ppdu_end_qca6174 {
951*4882a593Smuzhiyun 	u8 locationing_timestamp;
952*4882a593Smuzhiyun 	u8 phy_err_code;
953*4882a593Smuzhiyun 	__le16 flags; /* %RX_PPDU_END_FLAGS_ */
954*4882a593Smuzhiyun 	__le32 info0; /* %RX_PPDU_END_INFO0_ */
955*4882a593Smuzhiyun 	__le32 rtt; /* %RX_PPDU_END_RTT_ */
956*4882a593Smuzhiyun 	__le16 bb_length;
957*4882a593Smuzhiyun 	__le16 info1; /* %RX_PPDU_END_INFO1_ */
958*4882a593Smuzhiyun } __packed;
959*4882a593Smuzhiyun 
960*4882a593Smuzhiyun #define RX_PKT_END_INFO0_RX_SUCCESS              BIT(0)
961*4882a593Smuzhiyun #define RX_PKT_END_INFO0_ERR_TX_INTERRUPT_RX     BIT(3)
962*4882a593Smuzhiyun #define RX_PKT_END_INFO0_ERR_OFDM_POWER_DROP     BIT(4)
963*4882a593Smuzhiyun #define RX_PKT_END_INFO0_ERR_OFDM_RESTART        BIT(5)
964*4882a593Smuzhiyun #define RX_PKT_END_INFO0_ERR_CCK_POWER_DROP      BIT(6)
965*4882a593Smuzhiyun #define RX_PKT_END_INFO0_ERR_CCK_RESTART         BIT(7)
966*4882a593Smuzhiyun 
967*4882a593Smuzhiyun #define RX_LOCATION_INFO_RTT_CORR_VAL_MASK       0x0001ffff
968*4882a593Smuzhiyun #define RX_LOCATION_INFO_RTT_CORR_VAL_LSB        0
969*4882a593Smuzhiyun #define RX_LOCATION_INFO_FAC_STATUS_MASK         0x000c0000
970*4882a593Smuzhiyun #define RX_LOCATION_INFO_FAC_STATUS_LSB          18
971*4882a593Smuzhiyun #define RX_LOCATION_INFO_PKT_BW_MASK             0x00700000
972*4882a593Smuzhiyun #define RX_LOCATION_INFO_PKT_BW_LSB              20
973*4882a593Smuzhiyun #define RX_LOCATION_INFO_RTT_TX_FRAME_PHASE_MASK 0x01800000
974*4882a593Smuzhiyun #define RX_LOCATION_INFO_RTT_TX_FRAME_PHASE_LSB  23
975*4882a593Smuzhiyun #define RX_LOCATION_INFO_CIR_STATUS              BIT(17)
976*4882a593Smuzhiyun #define RX_LOCATION_INFO_RTT_MAC_PHY_PHASE       BIT(25)
977*4882a593Smuzhiyun #define RX_LOCATION_INFO_RTT_TX_DATA_START_X     BIT(26)
978*4882a593Smuzhiyun #define RX_LOCATION_INFO_HW_IFFT_MODE            BIT(30)
979*4882a593Smuzhiyun #define RX_LOCATION_INFO_RX_LOCATION_VALID       BIT(31)
980*4882a593Smuzhiyun 
981*4882a593Smuzhiyun struct rx_pkt_end {
982*4882a593Smuzhiyun 	__le32 info0; /* %RX_PKT_END_INFO0_ */
983*4882a593Smuzhiyun 	__le32 phy_timestamp_1;
984*4882a593Smuzhiyun 	__le32 phy_timestamp_2;
985*4882a593Smuzhiyun } __packed;
986*4882a593Smuzhiyun 
987*4882a593Smuzhiyun struct rx_pkt_end_wcn3990 {
988*4882a593Smuzhiyun 	__le32 info0; /* %RX_PKT_END_INFO0_ */
989*4882a593Smuzhiyun 	__le64 phy_timestamp_1;
990*4882a593Smuzhiyun 	__le64 phy_timestamp_2;
991*4882a593Smuzhiyun } __packed;
992*4882a593Smuzhiyun 
993*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_FAC_LEGACY_MASK		0x00003fff
994*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_FAC_LEGACY_LSB		0
995*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_FAC_VHT_MASK		0x1fff8000
996*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_FAC_VHT_LSB		15
997*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_STRONGEST_CHAIN_MASK	0xc0000000
998*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_STRONGEST_CHAIN_LSB	30
999*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_FAC_LEGACY_STATUS		BIT(14)
1000*4882a593Smuzhiyun #define RX_LOCATION_INFO0_RTT_FAC_VHT_STATUS		BIT(29)
1001*4882a593Smuzhiyun 
1002*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_PREAMBLE_TYPE_MASK	0x0000000c
1003*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_PREAMBLE_TYPE_LSB		2
1004*4882a593Smuzhiyun #define RX_LOCATION_INFO1_PKT_BW_MASK			0x00000030
1005*4882a593Smuzhiyun #define RX_LOCATION_INFO1_PKT_BW_LSB			4
1006*4882a593Smuzhiyun #define RX_LOCATION_INFO1_SKIP_P_SKIP_BTCF_MASK		0x0000ff00
1007*4882a593Smuzhiyun #define RX_LOCATION_INFO1_SKIP_P_SKIP_BTCF_LSB		8
1008*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_MSC_RATE_MASK		0x000f0000
1009*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_MSC_RATE_LSB		16
1010*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_PBD_LEG_BW_MASK		0x00300000
1011*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_PBD_LEG_BW_LSB		20
1012*4882a593Smuzhiyun #define RX_LOCATION_INFO1_TIMING_BACKOFF_MASK		0x07c00000
1013*4882a593Smuzhiyun #define RX_LOCATION_INFO1_TIMING_BACKOFF_LSB		22
1014*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_TX_FRAME_PHASE_MASK	0x18000000
1015*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_TX_FRAME_PHASE_LSB	27
1016*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_CFR_STATUS		BIT(0)
1017*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_CIR_STATUS		BIT(1)
1018*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_GI_TYPE			BIT(7)
1019*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_MAC_PHY_PHASE		BIT(29)
1020*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RTT_TX_DATA_START_X_PHASE	BIT(30)
1021*4882a593Smuzhiyun #define RX_LOCATION_INFO1_RX_LOCATION_VALID		BIT(31)
1022*4882a593Smuzhiyun 
1023*4882a593Smuzhiyun struct rx_location_info {
1024*4882a593Smuzhiyun 	__le32 rx_location_info0; /* %RX_LOCATION_INFO0_ */
1025*4882a593Smuzhiyun 	__le32 rx_location_info1; /* %RX_LOCATION_INFO1_ */
1026*4882a593Smuzhiyun } __packed;
1027*4882a593Smuzhiyun 
1028*4882a593Smuzhiyun struct rx_location_info_wcn3990 {
1029*4882a593Smuzhiyun 	__le32 rx_location_info0; /* %RX_LOCATION_INFO0_ */
1030*4882a593Smuzhiyun 	__le32 rx_location_info1; /* %RX_LOCATION_INFO1_ */
1031*4882a593Smuzhiyun 	__le32 rx_location_info2; /* %RX_LOCATION_INFO2_ */
1032*4882a593Smuzhiyun } __packed;
1033*4882a593Smuzhiyun 
1034*4882a593Smuzhiyun enum rx_phy_ppdu_end_info0 {
1035*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_RADAR           = BIT(2),
1036*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_RX_ABORT        = BIT(3),
1037*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_RX_NAP          = BIT(4),
1038*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_TIMING     = BIT(5),
1039*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_PARITY     = BIT(6),
1040*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_RATE       = BIT(7),
1041*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_LENGTH     = BIT(8),
1042*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_RESTART    = BIT(9),
1043*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_SERVICE    = BIT(10),
1044*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_OFDM_POWER_DROP = BIT(11),
1045*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_BLOCKER     = BIT(12),
1046*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_TIMING      = BIT(13),
1047*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_HEADER_CRC  = BIT(14),
1048*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_RATE        = BIT(15),
1049*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_LENGTH      = BIT(16),
1050*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_RESTART     = BIT(17),
1051*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_SERVICE     = BIT(18),
1052*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_CCK_POWER_DROP  = BIT(19),
1053*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_HT_CRC          = BIT(20),
1054*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_HT_LENGTH       = BIT(21),
1055*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_HT_RATE         = BIT(22),
1056*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_HT_ZLF          = BIT(23),
1057*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_FALSE_RADAR_EXT = BIT(24),
1058*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_GREEN_FIELD     = BIT(25),
1059*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_SPECTRAL_SCAN   = BIT(26),
1060*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_RX_DYN_BW       = BIT(27),
1061*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_LEG_HT_MISMATCH = BIT(28),
1062*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_VHT_CRC         = BIT(29),
1063*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_VHT_SIGA        = BIT(30),
1064*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO0_ERR_VHT_LSIG        = BIT(31),
1065*4882a593Smuzhiyun };
1066*4882a593Smuzhiyun 
1067*4882a593Smuzhiyun enum rx_phy_ppdu_end_info1 {
1068*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_VHT_NDP            = BIT(0),
1069*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_VHT_NSYM           = BIT(1),
1070*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_EXT_SYM     = BIT(2),
1071*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID0    = BIT(3),
1072*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID1_62 = BIT(4),
1073*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_VHT_RX_SKIP_ID63   = BIT(5),
1074*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_OFDM_LDPC_DECODER  = BIT(6),
1075*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_DEFER_NAP          = BIT(7),
1076*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_FDOMAIN_TIMEOUT    = BIT(8),
1077*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_LSIG_REL_CHECK     = BIT(9),
1078*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_BT_COLLISION       = BIT(10),
1079*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_MU_FEEDBACK        = BIT(11),
1080*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_TX_INTERRUPT_RX    = BIT(12),
1081*4882a593Smuzhiyun 	RX_PHY_PPDU_END_INFO1_ERR_RX_CBF             = BIT(13),
1082*4882a593Smuzhiyun };
1083*4882a593Smuzhiyun 
1084*4882a593Smuzhiyun struct rx_phy_ppdu_end {
1085*4882a593Smuzhiyun 	__le32 info0; /* %RX_PHY_PPDU_END_INFO0_ */
1086*4882a593Smuzhiyun 	__le32 info1; /* %RX_PHY_PPDU_END_INFO1_ */
1087*4882a593Smuzhiyun } __packed;
1088*4882a593Smuzhiyun 
1089*4882a593Smuzhiyun #define RX_PPDU_END_RX_TIMING_OFFSET_MASK          0x00000fff
1090*4882a593Smuzhiyun #define RX_PPDU_END_RX_TIMING_OFFSET_LSB           0
1091*4882a593Smuzhiyun 
1092*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_RX_ANTENNA_MASK        0x00ffffff
1093*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_RX_ANTENNA_LSB         0
1094*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_TX_HT_VHT_ACK          BIT(24)
1095*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_RX_PKT_END_VALID       BIT(25)
1096*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_RX_PHY_PPDU_END_VALID  BIT(26)
1097*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_RX_TIMING_OFFSET_VALID BIT(27)
1098*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_BB_CAPTURED_CHANNEL    BIT(28)
1099*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_UNSUPPORTED_MU_NC      BIT(29)
1100*4882a593Smuzhiyun #define RX_PPDU_END_RX_INFO_OTP_TXBF_DISABLE       BIT(30)
1101*4882a593Smuzhiyun 
1102*4882a593Smuzhiyun struct rx_ppdu_end_qca99x0 {
1103*4882a593Smuzhiyun 	struct rx_pkt_end rx_pkt_end;
1104*4882a593Smuzhiyun 	__le32 rx_location_info; /* %RX_LOCATION_INFO_ */
1105*4882a593Smuzhiyun 	struct rx_phy_ppdu_end rx_phy_ppdu_end;
1106*4882a593Smuzhiyun 	__le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
1107*4882a593Smuzhiyun 	__le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
1108*4882a593Smuzhiyun 	__le16 bb_length;
1109*4882a593Smuzhiyun 	__le16 info1; /* %RX_PPDU_END_INFO1_ */
1110*4882a593Smuzhiyun } __packed;
1111*4882a593Smuzhiyun 
1112*4882a593Smuzhiyun struct rx_ppdu_end_qca9984 {
1113*4882a593Smuzhiyun 	struct rx_pkt_end rx_pkt_end;
1114*4882a593Smuzhiyun 	struct rx_location_info rx_location_info;
1115*4882a593Smuzhiyun 	struct rx_phy_ppdu_end rx_phy_ppdu_end;
1116*4882a593Smuzhiyun 	__le32 rx_timing_offset; /* %RX_PPDU_END_RX_TIMING_OFFSET_ */
1117*4882a593Smuzhiyun 	__le32 rx_info; /* %RX_PPDU_END_RX_INFO_ */
1118*4882a593Smuzhiyun 	__le16 bb_length;
1119*4882a593Smuzhiyun 	__le16 info1; /* %RX_PPDU_END_INFO1_ */
1120*4882a593Smuzhiyun } __packed;
1121*4882a593Smuzhiyun 
1122*4882a593Smuzhiyun struct rx_ppdu_end_wcn3990 {
1123*4882a593Smuzhiyun 	struct rx_pkt_end_wcn3990 rx_pkt_end;
1124*4882a593Smuzhiyun 	struct rx_location_info_wcn3990 rx_location_info;
1125*4882a593Smuzhiyun 	struct rx_phy_ppdu_end rx_phy_ppdu_end;
1126*4882a593Smuzhiyun 	__le32 rx_timing_offset;
1127*4882a593Smuzhiyun 	__le32 reserved_info_0;
1128*4882a593Smuzhiyun 	__le32 reserved_info_1;
1129*4882a593Smuzhiyun 	__le32 rx_antenna_info;
1130*4882a593Smuzhiyun 	__le32 rx_coex_info;
1131*4882a593Smuzhiyun 	__le32 rx_mpdu_cnt_info;
1132*4882a593Smuzhiyun 	__le64 phy_timestamp_tx;
1133*4882a593Smuzhiyun 	__le32 rx_bb_length;
1134*4882a593Smuzhiyun } __packed;
1135*4882a593Smuzhiyun 
1136*4882a593Smuzhiyun struct rx_ppdu_end {
1137*4882a593Smuzhiyun 	struct rx_ppdu_end_common common;
1138*4882a593Smuzhiyun 	union {
1139*4882a593Smuzhiyun 		struct rx_ppdu_end_qca988x qca988x;
1140*4882a593Smuzhiyun 		struct rx_ppdu_end_qca6174 qca6174;
1141*4882a593Smuzhiyun 		struct rx_ppdu_end_qca99x0 qca99x0;
1142*4882a593Smuzhiyun 		struct rx_ppdu_end_qca9984 qca9984;
1143*4882a593Smuzhiyun 		struct rx_ppdu_end_wcn3990 wcn3990;
1144*4882a593Smuzhiyun 	} __packed;
1145*4882a593Smuzhiyun } __packed;
1146*4882a593Smuzhiyun 
1147*4882a593Smuzhiyun /*
1148*4882a593Smuzhiyun  * evm_p0
1149*4882a593Smuzhiyun  *		EVM for pilot 0.  Contain EVM for streams: 0, 1, 2 and 3.
1150*4882a593Smuzhiyun  *
1151*4882a593Smuzhiyun  * evm_p1
1152*4882a593Smuzhiyun  *		EVM for pilot 1.  Contain EVM for streams: 0, 1, 2 and 3.
1153*4882a593Smuzhiyun  *
1154*4882a593Smuzhiyun  * evm_p2
1155*4882a593Smuzhiyun  *		EVM for pilot 2.  Contain EVM for streams: 0, 1, 2 and 3.
1156*4882a593Smuzhiyun  *
1157*4882a593Smuzhiyun  * evm_p3
1158*4882a593Smuzhiyun  *		EVM for pilot 3.  Contain EVM for streams: 0, 1, 2 and 3.
1159*4882a593Smuzhiyun  *
1160*4882a593Smuzhiyun  * evm_p4
1161*4882a593Smuzhiyun  *		EVM for pilot 4.  Contain EVM for streams: 0, 1, 2 and 3.
1162*4882a593Smuzhiyun  *
1163*4882a593Smuzhiyun  * evm_p5
1164*4882a593Smuzhiyun  *		EVM for pilot 5.  Contain EVM for streams: 0, 1, 2 and 3.
1165*4882a593Smuzhiyun  *
1166*4882a593Smuzhiyun  * evm_p6
1167*4882a593Smuzhiyun  *		EVM for pilot 6.  Contain EVM for streams: 0, 1, 2 and 3.
1168*4882a593Smuzhiyun  *
1169*4882a593Smuzhiyun  * evm_p7
1170*4882a593Smuzhiyun  *		EVM for pilot 7.  Contain EVM for streams: 0, 1, 2 and 3.
1171*4882a593Smuzhiyun  *
1172*4882a593Smuzhiyun  * evm_p8
1173*4882a593Smuzhiyun  *		EVM for pilot 8.  Contain EVM for streams: 0, 1, 2 and 3.
1174*4882a593Smuzhiyun  *
1175*4882a593Smuzhiyun  * evm_p9
1176*4882a593Smuzhiyun  *		EVM for pilot 9.  Contain EVM for streams: 0, 1, 2 and 3.
1177*4882a593Smuzhiyun  *
1178*4882a593Smuzhiyun  * evm_p10
1179*4882a593Smuzhiyun  *		EVM for pilot 10.  Contain EVM for streams: 0, 1, 2 and 3.
1180*4882a593Smuzhiyun  *
1181*4882a593Smuzhiyun  * evm_p11
1182*4882a593Smuzhiyun  *		EVM for pilot 11.  Contain EVM for streams: 0, 1, 2 and 3.
1183*4882a593Smuzhiyun  *
1184*4882a593Smuzhiyun  * evm_p12
1185*4882a593Smuzhiyun  *		EVM for pilot 12.  Contain EVM for streams: 0, 1, 2 and 3.
1186*4882a593Smuzhiyun  *
1187*4882a593Smuzhiyun  * evm_p13
1188*4882a593Smuzhiyun  *		EVM for pilot 13.  Contain EVM for streams: 0, 1, 2 and 3.
1189*4882a593Smuzhiyun  *
1190*4882a593Smuzhiyun  * evm_p14
1191*4882a593Smuzhiyun  *		EVM for pilot 14.  Contain EVM for streams: 0, 1, 2 and 3.
1192*4882a593Smuzhiyun  *
1193*4882a593Smuzhiyun  * evm_p15
1194*4882a593Smuzhiyun  *		EVM for pilot 15.  Contain EVM for streams: 0, 1, 2 and 3.
1195*4882a593Smuzhiyun  *
1196*4882a593Smuzhiyun  * tsf_timestamp
1197*4882a593Smuzhiyun  *		Receive TSF timestamp sampled on the rising edge of
1198*4882a593Smuzhiyun  *		rx_clear.  For PHY errors this may be the current TSF when
1199*4882a593Smuzhiyun  *		phy_error is asserted if the rx_clear does not assert before
1200*4882a593Smuzhiyun  *		the end of the PHY error.
1201*4882a593Smuzhiyun  *
1202*4882a593Smuzhiyun  * wb_timestamp
1203*4882a593Smuzhiyun  *		WLAN/BT timestamp is a 1 usec resolution timestamp which
1204*4882a593Smuzhiyun  *		does not get updated based on receive beacon like TSF.  The
1205*4882a593Smuzhiyun  *		same rules for capturing tsf_timestamp are used to capture
1206*4882a593Smuzhiyun  *		the wb_timestamp.
1207*4882a593Smuzhiyun  *
1208*4882a593Smuzhiyun  * locationing_timestamp
1209*4882a593Smuzhiyun  *		Timestamp used for locationing.  This timestamp is used to
1210*4882a593Smuzhiyun  *		indicate fractions of usec.  For example if the MAC clock is
1211*4882a593Smuzhiyun  *		running at 80 MHz, the timestamp will increment every 12.5
1212*4882a593Smuzhiyun  *		nsec.  The value starts at 0 and increments to 79 and
1213*4882a593Smuzhiyun  *		returns to 0 and repeats.  This information is valid for
1214*4882a593Smuzhiyun  *		every PPDU.  This information can be used in conjunction
1215*4882a593Smuzhiyun  *		with wb_timestamp to capture large delta times.
1216*4882a593Smuzhiyun  *
1217*4882a593Smuzhiyun  * phy_err_code
1218*4882a593Smuzhiyun  *		See the 1.10.8.1.2 for the list of the PHY error codes.
1219*4882a593Smuzhiyun  *
1220*4882a593Smuzhiyun  * phy_err
1221*4882a593Smuzhiyun  *		Indicates a PHY error was detected for this PPDU.
1222*4882a593Smuzhiyun  *
1223*4882a593Smuzhiyun  * rx_location
1224*4882a593Smuzhiyun  *		Indicates that location information was requested.
1225*4882a593Smuzhiyun  *
1226*4882a593Smuzhiyun  * txbf_h_info
1227*4882a593Smuzhiyun  *		Indicates that the packet data carries H information which
1228*4882a593Smuzhiyun  *		is used for TxBF debug.
1229*4882a593Smuzhiyun  *
1230*4882a593Smuzhiyun  * reserved_18
1231*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
1232*4882a593Smuzhiyun  *
1233*4882a593Smuzhiyun  * rx_antenna
1234*4882a593Smuzhiyun  *		Receive antenna value
1235*4882a593Smuzhiyun  *
1236*4882a593Smuzhiyun  * tx_ht_vht_ack
1237*4882a593Smuzhiyun  *		Indicates that a HT or VHT Ack/BA frame was transmitted in
1238*4882a593Smuzhiyun  *		response to this receive packet.
1239*4882a593Smuzhiyun  *
1240*4882a593Smuzhiyun  * bb_captured_channel
1241*4882a593Smuzhiyun  *		Indicates that the BB has captured a channel dump.  FW can
1242*4882a593Smuzhiyun  *		then read the channel dump memory.  This may indicate that
1243*4882a593Smuzhiyun  *		the channel was captured either based on PCU setting the
1244*4882a593Smuzhiyun  *		capture_channel bit  BB descriptor or FW setting the
1245*4882a593Smuzhiyun  *		capture_channel mode bit.
1246*4882a593Smuzhiyun  *
1247*4882a593Smuzhiyun  * reserved_19
1248*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
1249*4882a593Smuzhiyun  *
1250*4882a593Smuzhiyun  * bb_length
1251*4882a593Smuzhiyun  *		Indicates the number of bytes of baseband information for
1252*4882a593Smuzhiyun  *		PPDUs where the BB descriptor preamble type is 0x80 to 0xFF
1253*4882a593Smuzhiyun  *		which indicates that this is not a normal PPDU but rather
1254*4882a593Smuzhiyun  *		contains baseband debug information.
1255*4882a593Smuzhiyun  *
1256*4882a593Smuzhiyun  * reserved_20
1257*4882a593Smuzhiyun  *		Reserved: HW should fill with 0, FW should ignore.
1258*4882a593Smuzhiyun  *
1259*4882a593Smuzhiyun  * ppdu_done
1260*4882a593Smuzhiyun  *		PPDU end status is only valid when ppdu_done bit is set.
1261*4882a593Smuzhiyun  *		Every time HW sets this bit in memory FW/SW must clear this
1262*4882a593Smuzhiyun  *		bit in memory.  FW will initialize all the ppdu_done dword
1263*4882a593Smuzhiyun  *		to 0.
1264*4882a593Smuzhiyun  */
1265*4882a593Smuzhiyun 
1266*4882a593Smuzhiyun #define FW_RX_DESC_INFO0_DISCARD  BIT(0)
1267*4882a593Smuzhiyun #define FW_RX_DESC_INFO0_FORWARD  BIT(1)
1268*4882a593Smuzhiyun #define FW_RX_DESC_INFO0_INSPECT  BIT(5)
1269*4882a593Smuzhiyun #define FW_RX_DESC_INFO0_EXT_MASK 0xC0
1270*4882a593Smuzhiyun #define FW_RX_DESC_INFO0_EXT_LSB  6
1271*4882a593Smuzhiyun 
1272*4882a593Smuzhiyun struct fw_rx_desc_base {
1273*4882a593Smuzhiyun 	u8 info0;
1274*4882a593Smuzhiyun } __packed;
1275*4882a593Smuzhiyun 
1276*4882a593Smuzhiyun #define FW_RX_DESC_FLAGS_FIRST_MSDU (1 << 0)
1277*4882a593Smuzhiyun #define FW_RX_DESC_FLAGS_LAST_MSDU  (1 << 1)
1278*4882a593Smuzhiyun #define FW_RX_DESC_C3_FAILED        (1 << 2)
1279*4882a593Smuzhiyun #define FW_RX_DESC_C4_FAILED        (1 << 3)
1280*4882a593Smuzhiyun #define FW_RX_DESC_IPV6             (1 << 4)
1281*4882a593Smuzhiyun #define FW_RX_DESC_TCP              (1 << 5)
1282*4882a593Smuzhiyun #define FW_RX_DESC_UDP              (1 << 6)
1283*4882a593Smuzhiyun 
1284*4882a593Smuzhiyun struct fw_rx_desc_hl {
1285*4882a593Smuzhiyun 	union {
1286*4882a593Smuzhiyun 		struct {
1287*4882a593Smuzhiyun 		u8 discard:1,
1288*4882a593Smuzhiyun 		   forward:1,
1289*4882a593Smuzhiyun 		   any_err:1,
1290*4882a593Smuzhiyun 		   dup_err:1,
1291*4882a593Smuzhiyun 		   reserved:1,
1292*4882a593Smuzhiyun 		   inspect:1,
1293*4882a593Smuzhiyun 		   extension:2;
1294*4882a593Smuzhiyun 		} bits;
1295*4882a593Smuzhiyun 		u8 info0;
1296*4882a593Smuzhiyun 	} u;
1297*4882a593Smuzhiyun 
1298*4882a593Smuzhiyun 	u8 version;
1299*4882a593Smuzhiyun 	u8 len;
1300*4882a593Smuzhiyun 	u8 flags;
1301*4882a593Smuzhiyun } __packed;
1302*4882a593Smuzhiyun 
1303*4882a593Smuzhiyun #endif /* _RX_DESC_H_ */
1304