xref: /wlan-driver/qca-wifi-host-cmn/hal/wifi3.0/qcn9000/hal_9000_rx.h (revision 5113495b16420b49004c444715d2daae2066e7dc)
1*5113495bSYour Name /*
2*5113495bSYour Name  * Copyright (c) 2016-2021 The Linux Foundation. All rights reserved.
3*5113495bSYour Name  *
4*5113495bSYour Name  * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name  * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name  * above copyright notice and this permission notice appear in all
7*5113495bSYour Name  * copies.
8*5113495bSYour Name  *
9*5113495bSYour Name  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name  * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name  */
18*5113495bSYour Name 
19*5113495bSYour Name #include "sw_monitor_ring.h"
20*5113495bSYour Name #include "hal_rx.h"
21*5113495bSYour Name #include "hal_api_mon.h"
22*5113495bSYour Name 
23*5113495bSYour Name #define HAL_RX_MSDU0_BUFFER_ADDR_LSB(link_desc_va)      \
24*5113495bSYour Name 	((uint8_t *)(link_desc_va) +			\
25*5113495bSYour Name 	RX_MSDU_LINK_8_MSDU_0_BUFFER_ADDR_INFO_DETAILS_BUFFER_ADDR_31_0_OFFSET)
26*5113495bSYour Name 
27*5113495bSYour Name #define HAL_RX_MSDU_DESC_INFO_PTR_GET(msdu0)			\
28*5113495bSYour Name 	((uint8_t *)(msdu0) +				\
29*5113495bSYour Name 	RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_DETAILS_FIRST_MSDU_IN_MPDU_FLAG_OFFSET)
30*5113495bSYour Name 
31*5113495bSYour Name #define HAL_ENT_MPDU_DESC_INFO(ent_ring_desc)		\
32*5113495bSYour Name 	((uint8_t *)(ent_ring_desc) +			\
33*5113495bSYour Name 	RX_MPDU_DETAILS_2_RX_MPDU_DESC_INFO_DETAILS_MSDU_COUNT_OFFSET)
34*5113495bSYour Name 
35*5113495bSYour Name #define HAL_DST_MPDU_DESC_INFO(dst_ring_desc)		\
36*5113495bSYour Name 	((uint8_t *)(dst_ring_desc) +			\
37*5113495bSYour Name 	REO_DESTINATION_RING_2_RX_MPDU_DESC_INFO_DETAILS_MSDU_COUNT_OFFSET)
38*5113495bSYour Name 
39*5113495bSYour Name #define HAL_RX_GET_FC_VALID(rx_mpdu_start)	\
40*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_11, MPDU_FRAME_CONTROL_VALID)
41*5113495bSYour Name 
42*5113495bSYour Name #define HAL_RX_GET_TO_DS_FLAG(rx_mpdu_start)	\
43*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_11, TO_DS)
44*5113495bSYour Name 
45*5113495bSYour Name #define HAL_RX_GET_MAC_ADDR1_VALID(rx_mpdu_start) \
46*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_11, MAC_ADDR_AD1_VALID)
47*5113495bSYour Name 
48*5113495bSYour Name #define HAL_RX_GET_MAC_ADDR2_VALID(rx_mpdu_start) \
49*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_11, MAC_ADDR_AD2_VALID)
50*5113495bSYour Name 
51*5113495bSYour Name #define HAL_RX_GET_FILTER_CATEGORY(rx_mpdu_start) \
52*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_9, RXPCU_MPDU_FILTER_IN_CATEGORY)
53*5113495bSYour Name 
54*5113495bSYour Name #define HAL_RX_GET_PPDU_ID(rx_mpdu_start)	\
55*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_9, PHY_PPDU_ID)
56*5113495bSYour Name 
57*5113495bSYour Name #define HAL_RX_GET_SW_FRAME_GROUP_ID(rx_mpdu_start)	\
58*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_9, SW_FRAME_GROUP_ID)
59*5113495bSYour Name 
60*5113495bSYour Name #define HAL_RX_GET_SW_PEER_ID(rx_mpdu_start)	\
61*5113495bSYour Name 	HAL_RX_GET(rx_mpdu_start, RX_MPDU_INFO_10, SW_PEER_ID)
62*5113495bSYour Name 
63*5113495bSYour Name #define HAL_REO_R0_CONFIG(soc, reg_val, reo_params)		\
64*5113495bSYour Name 	do { \
65*5113495bSYour Name 		reg_val &= \
66*5113495bSYour Name 			~(HWIO_REO_R0_GENERAL_ENABLE_FRAGMENT_DEST_RING_BMSK |\
67*5113495bSYour Name 			HWIO_REO_R0_GENERAL_ENABLE_AGING_LIST_ENABLE_BMSK | \
68*5113495bSYour Name 			HWIO_REO_R0_GENERAL_ENABLE_AGING_FLUSH_ENABLE_BMSK); \
69*5113495bSYour Name 		reg_val |= \
70*5113495bSYour Name 			HAL_SM(HWIO_REO_R0_GENERAL_ENABLE, \
71*5113495bSYour Name 			       FRAGMENT_DEST_RING, \
72*5113495bSYour Name 			       (reo_params)->frag_dst_ring) |	\
73*5113495bSYour Name 			HAL_SM(HWIO_REO_R0_GENERAL_ENABLE, \
74*5113495bSYour Name 			       AGING_LIST_ENABLE, 1) |\
75*5113495bSYour Name 			HAL_SM(HWIO_REO_R0_GENERAL_ENABLE, \
76*5113495bSYour Name 			       AGING_FLUSH_ENABLE, 1);\
77*5113495bSYour Name 		HAL_REG_WRITE((soc), \
78*5113495bSYour Name 			      HWIO_REO_R0_GENERAL_ENABLE_ADDR( \
79*5113495bSYour Name 			      SEQ_WCSS_UMAC_REO_REG_OFFSET), \
80*5113495bSYour Name 			      (reg_val)); \
81*5113495bSYour Name 		(reg_val) = \
82*5113495bSYour Name 		HAL_REG_READ((soc), \
83*5113495bSYour Name 			     HWIO_REO_R0_DESTINATION_RING_ALT_CTRL_IX_0_ADDR(	\
84*5113495bSYour Name 			     SEQ_WCSS_UMAC_REO_REG_OFFSET)); \
85*5113495bSYour Name 		(reg_val) &= \
86*5113495bSYour Name 			~(HWIO_REO_R0_DESTINATION_RING_ALT_CTRL_IX_0_DEST_RING_ALT_MAPPING_0_BMSK); \
87*5113495bSYour Name 		(reg_val) |= \
88*5113495bSYour Name 			HAL_SM(HWIO_REO_R0_DESTINATION_RING_ALT_CTRL_IX_0, \
89*5113495bSYour Name 			       DEST_RING_ALT_MAPPING_0, \
90*5113495bSYour Name 			       (reo_params)->alt_dst_ind_0); \
91*5113495bSYour Name 		HAL_REG_WRITE((soc), \
92*5113495bSYour Name 			      HWIO_REO_R0_DESTINATION_RING_ALT_CTRL_IX_0_ADDR( \
93*5113495bSYour Name 			      SEQ_WCSS_UMAC_REO_REG_OFFSET), \
94*5113495bSYour Name 			      (reg_val)); \
95*5113495bSYour Name 	} while (0)
96*5113495bSYour Name 
97*5113495bSYour Name #define HAL_RX_MSDU_DESC_INFO_GET(msdu_details_ptr) \
98*5113495bSYour Name 	((struct rx_msdu_desc_info *) \
99*5113495bSYour Name 	_OFFSET_TO_BYTE_PTR((msdu_details_ptr), \
100*5113495bSYour Name 	UNIFIED_RX_MSDU_DETAILS_2_RX_MSDU_DESC_INFO_RX_MSDU_DESC_INFO_DETAILS_OFFSET))
101*5113495bSYour Name 
102*5113495bSYour Name #define HAL_RX_LINK_DESC_MSDU0_PTR(link_desc)   \
103*5113495bSYour Name 	((struct rx_msdu_details *) \
104*5113495bSYour Name 	 _OFFSET_TO_BYTE_PTR((link_desc),\
105*5113495bSYour Name 	UNIFIED_RX_MSDU_LINK_8_RX_MSDU_DETAILS_MSDU_0_OFFSET))
106*5113495bSYour Name 
107*5113495bSYour Name #define HAL_RX_TLV_GET_TCP_CHKSUM(buf) \
108*5113495bSYour Name 	(_HAL_MS( \
109*5113495bSYour Name 		 (*_OFFSET_TO_WORD_PTR(&(((struct rx_pkt_tlvs *)(buf))->\
110*5113495bSYour Name 			 msdu_end_tlv.rx_msdu_end), \
111*5113495bSYour Name 			 RX_MSDU_END_10_TCP_UDP_CHKSUM_OFFSET)), \
112*5113495bSYour Name 		RX_MSDU_END_10_TCP_UDP_CHKSUM_MASK, \
113*5113495bSYour Name 		RX_MSDU_END_10_TCP_UDP_CHKSUM_LSB))
114*5113495bSYour Name 
115*5113495bSYour Name #define HAL_RX_MSDU_END_FIRST_MSDU_GET(_rx_msdu_end)	\
116*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
117*5113495bSYour Name 		RX_MSDU_END_10_FIRST_MSDU_OFFSET)),	\
118*5113495bSYour Name 		RX_MSDU_END_10_FIRST_MSDU_MASK,		\
119*5113495bSYour Name 		RX_MSDU_END_10_FIRST_MSDU_LSB))
120*5113495bSYour Name 
121*5113495bSYour Name #define HAL_RX_MSDU_END_LAST_MSDU_GET(_rx_msdu_end)	\
122*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
123*5113495bSYour Name 		RX_MSDU_END_10_LAST_MSDU_OFFSET)),	\
124*5113495bSYour Name 		RX_MSDU_END_10_LAST_MSDU_MASK,		\
125*5113495bSYour Name 		RX_MSDU_END_10_LAST_MSDU_LSB))
126*5113495bSYour Name 
127*5113495bSYour Name #define HAL_RX_MSDU_END_SA_IS_VALID_GET(_rx_msdu_end)	\
128*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
129*5113495bSYour Name 		RX_MSDU_END_10_SA_IS_VALID_OFFSET)),	\
130*5113495bSYour Name 		RX_MSDU_END_10_SA_IS_VALID_MASK,		\
131*5113495bSYour Name 		RX_MSDU_END_10_SA_IS_VALID_LSB))
132*5113495bSYour Name 
133*5113495bSYour Name #define HAL_RX_MSDU_END_DA_IS_VALID_GET(_rx_msdu_end)	\
134*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
135*5113495bSYour Name 		RX_MSDU_END_10_DA_IS_VALID_OFFSET)),	\
136*5113495bSYour Name 		RX_MSDU_END_10_DA_IS_VALID_MASK,		\
137*5113495bSYour Name 		RX_MSDU_END_10_DA_IS_VALID_LSB))
138*5113495bSYour Name 
139*5113495bSYour Name #define HAL_RX_MSDU_END_DA_IS_MCBC_GET(_rx_msdu_end)	\
140*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
141*5113495bSYour Name 		RX_MSDU_END_10_DA_IS_MCBC_OFFSET)),	\
142*5113495bSYour Name 		RX_MSDU_END_10_DA_IS_MCBC_MASK,		\
143*5113495bSYour Name 		RX_MSDU_END_10_DA_IS_MCBC_LSB))
144*5113495bSYour Name 
145*5113495bSYour Name #define HAL_RX_MSDU_END_L3_HEADER_PADDING_GET(_rx_msdu_end)	\
146*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,		\
147*5113495bSYour Name 		RX_MSDU_END_10_L3_HEADER_PADDING_OFFSET)),	\
148*5113495bSYour Name 		RX_MSDU_END_10_L3_HEADER_PADDING_MASK,		\
149*5113495bSYour Name 		RX_MSDU_END_10_L3_HEADER_PADDING_LSB))
150*5113495bSYour Name 
151*5113495bSYour Name #define HAL_RX_MSDU_END_SA_IDX_GET(_rx_msdu_end)	\
152*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
153*5113495bSYour Name 		RX_MSDU_END_11_SA_IDX_OFFSET)),	\
154*5113495bSYour Name 		RX_MSDU_END_11_SA_IDX_MASK,		\
155*5113495bSYour Name 		RX_MSDU_END_11_SA_IDX_LSB))
156*5113495bSYour Name 
157*5113495bSYour Name #define HAL_RX_MSDU_END_SA_SW_PEER_ID_GET(_rx_msdu_end)		\
158*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,		\
159*5113495bSYour Name 		RX_MSDU_END_14_SA_SW_PEER_ID_OFFSET)),		\
160*5113495bSYour Name 		RX_MSDU_END_14_SA_SW_PEER_ID_MASK,		\
161*5113495bSYour Name 		RX_MSDU_END_14_SA_SW_PEER_ID_LSB))
162*5113495bSYour Name 
163*5113495bSYour Name #define HAL_RX_MSDU_END_CCE_METADATA_GET(_rx_msdu_end)	\
164*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,	\
165*5113495bSYour Name 		RX_MSDU_END_14_CCE_METADATA_OFFSET)),	\
166*5113495bSYour Name 		RX_MSDU_END_14_CCE_METADATA_MASK,	\
167*5113495bSYour Name 		RX_MSDU_END_14_CCE_METADATA_LSB))
168*5113495bSYour Name 
169*5113495bSYour Name #define HAL_RX_MSDU_END_DA_IDX_GET(_rx_msdu_end)		\
170*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,		\
171*5113495bSYour Name 		RX_MSDU_END_11_DA_IDX_OR_SW_PEER_ID_OFFSET)),	\
172*5113495bSYour Name 		RX_MSDU_END_11_DA_IDX_OR_SW_PEER_ID_MASK,	\
173*5113495bSYour Name 		RX_MSDU_END_11_DA_IDX_OR_SW_PEER_ID_LSB))
174*5113495bSYour Name 
175*5113495bSYour Name #define HAL_RX_MPDU_SW_FRAME_GROUP_ID_GET(_rx_mpdu_info) \
176*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_mpdu_info),  \
177*5113495bSYour Name 	RX_MPDU_INFO_9_SW_FRAME_GROUP_ID_OFFSET)),       \
178*5113495bSYour Name 	RX_MPDU_INFO_9_SW_FRAME_GROUP_ID_MASK,           \
179*5113495bSYour Name 	RX_MPDU_INFO_9_SW_FRAME_GROUP_ID_LSB))           \
180*5113495bSYour Name 
181*5113495bSYour Name #define HAL_RX_MPDU_INFO_SW_PEER_ID_GET(_rx_mpdu_info) \
182*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_mpdu_info),	\
183*5113495bSYour Name 		RX_MPDU_INFO_10_SW_PEER_ID_OFFSET)),	\
184*5113495bSYour Name 		RX_MPDU_INFO_10_SW_PEER_ID_MASK,		\
185*5113495bSYour Name 		RX_MPDU_INFO_10_SW_PEER_ID_LSB))
186*5113495bSYour Name 
187*5113495bSYour Name #define HAL_RX_MPDU_GET_FRAME_CONTROL_VALID(_rx_mpdu_info)	\
188*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
189*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_FRAME_CONTROL_VALID_OFFSET)),	\
190*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_FRAME_CONTROL_VALID_MASK,	\
191*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_FRAME_CONTROL_VALID_LSB))
192*5113495bSYour Name 
193*5113495bSYour Name #define HAL_RX_MPDU_MAC_ADDR_AD1_VALID_GET(_rx_mpdu_info) \
194*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
195*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD1_VALID_OFFSET)), \
196*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD1_VALID_MASK,	\
197*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD1_VALID_LSB))
198*5113495bSYour Name 
199*5113495bSYour Name #define HAL_RX_MPDU_AD1_31_0_GET(_rx_mpdu_info)	\
200*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
201*5113495bSYour Name 		RX_MPDU_INFO_15_MAC_ADDR_AD1_31_0_OFFSET)), \
202*5113495bSYour Name 		RX_MPDU_INFO_15_MAC_ADDR_AD1_31_0_MASK,	\
203*5113495bSYour Name 		RX_MPDU_INFO_15_MAC_ADDR_AD1_31_0_LSB))
204*5113495bSYour Name 
205*5113495bSYour Name #define HAL_RX_MPDU_AD1_47_32_GET(_rx_mpdu_info)	\
206*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
207*5113495bSYour Name 		RX_MPDU_INFO_16_MAC_ADDR_AD1_47_32_OFFSET)), \
208*5113495bSYour Name 		RX_MPDU_INFO_16_MAC_ADDR_AD1_47_32_MASK,	\
209*5113495bSYour Name 		RX_MPDU_INFO_16_MAC_ADDR_AD1_47_32_LSB))
210*5113495bSYour Name 
211*5113495bSYour Name #define HAL_RX_MPDU_MAC_ADDR_AD2_VALID_GET(_rx_mpdu_info) \
212*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
213*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD2_VALID_OFFSET)), \
214*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD2_VALID_MASK,	\
215*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD2_VALID_LSB))
216*5113495bSYour Name 
217*5113495bSYour Name #define HAL_RX_MPDU_AD2_15_0_GET(_rx_mpdu_info)	\
218*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
219*5113495bSYour Name 		RX_MPDU_INFO_16_MAC_ADDR_AD2_15_0_OFFSET)), \
220*5113495bSYour Name 		RX_MPDU_INFO_16_MAC_ADDR_AD2_15_0_MASK,	\
221*5113495bSYour Name 		RX_MPDU_INFO_16_MAC_ADDR_AD2_15_0_LSB))
222*5113495bSYour Name 
223*5113495bSYour Name #define HAL_RX_MPDU_AD2_47_16_GET(_rx_mpdu_info)	\
224*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
225*5113495bSYour Name 		RX_MPDU_INFO_17_MAC_ADDR_AD2_47_16_OFFSET)), \
226*5113495bSYour Name 		RX_MPDU_INFO_17_MAC_ADDR_AD2_47_16_MASK,	\
227*5113495bSYour Name 		RX_MPDU_INFO_17_MAC_ADDR_AD2_47_16_LSB))
228*5113495bSYour Name 
229*5113495bSYour Name #define HAL_RX_MPDU_MAC_ADDR_AD3_VALID_GET(_rx_mpdu_info) \
230*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
231*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD3_VALID_OFFSET)), \
232*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD3_VALID_MASK,	\
233*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD3_VALID_LSB))
234*5113495bSYour Name 
235*5113495bSYour Name #define HAL_RX_MPDU_AD3_31_0_GET(_rx_mpdu_info)	\
236*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
237*5113495bSYour Name 		RX_MPDU_INFO_18_MAC_ADDR_AD3_31_0_OFFSET)), \
238*5113495bSYour Name 		RX_MPDU_INFO_18_MAC_ADDR_AD3_31_0_MASK,	\
239*5113495bSYour Name 		RX_MPDU_INFO_18_MAC_ADDR_AD3_31_0_LSB))
240*5113495bSYour Name 
241*5113495bSYour Name #define HAL_RX_MPDU_AD3_47_32_GET(_rx_mpdu_info)	\
242*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
243*5113495bSYour Name 		RX_MPDU_INFO_19_MAC_ADDR_AD3_47_32_OFFSET)), \
244*5113495bSYour Name 		RX_MPDU_INFO_19_MAC_ADDR_AD3_47_32_MASK,	\
245*5113495bSYour Name 		RX_MPDU_INFO_19_MAC_ADDR_AD3_47_32_LSB))
246*5113495bSYour Name 
247*5113495bSYour Name #define HAL_RX_MPDU_MAC_ADDR_AD4_VALID_GET(_rx_mpdu_info) \
248*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
249*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD4_VALID_OFFSET)), \
250*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD4_VALID_MASK,	\
251*5113495bSYour Name 		RX_MPDU_INFO_11_MAC_ADDR_AD4_VALID_LSB))
252*5113495bSYour Name 
253*5113495bSYour Name #define HAL_RX_MPDU_AD4_31_0_GET(_rx_mpdu_info)	\
254*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
255*5113495bSYour Name 		RX_MPDU_INFO_20_MAC_ADDR_AD4_31_0_OFFSET)), \
256*5113495bSYour Name 		RX_MPDU_INFO_20_MAC_ADDR_AD4_31_0_MASK,	\
257*5113495bSYour Name 		RX_MPDU_INFO_20_MAC_ADDR_AD4_31_0_LSB))
258*5113495bSYour Name 
259*5113495bSYour Name #define HAL_RX_MPDU_AD4_47_32_GET(_rx_mpdu_info)	\
260*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info, \
261*5113495bSYour Name 		RX_MPDU_INFO_21_MAC_ADDR_AD4_47_32_OFFSET)), \
262*5113495bSYour Name 		RX_MPDU_INFO_21_MAC_ADDR_AD4_47_32_MASK,	\
263*5113495bSYour Name 		RX_MPDU_INFO_21_MAC_ADDR_AD4_47_32_LSB))
264*5113495bSYour Name 
265*5113495bSYour Name #define HAL_RX_MPDU_GET_SEQUENCE_CONTROL_VALID(_rx_mpdu_info)	\
266*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
267*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_CONTROL_VALID_OFFSET)),	\
268*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_CONTROL_VALID_MASK,	\
269*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_CONTROL_VALID_LSB))
270*5113495bSYour Name 
271*5113495bSYour Name #define HAL_RX_MPDU_INFO_QOS_CONTROL_VALID_GET(_rx_mpdu_info) \
272*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_mpdu_info),		\
273*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_CONTROL_VALID_OFFSET)),	\
274*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_CONTROL_VALID_MASK,	\
275*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_CONTROL_VALID_LSB))
276*5113495bSYour Name 
277*5113495bSYour Name #define HAL_RX_MPDU_ENCRYPTION_INFO_VALID(_rx_mpdu_info)	\
278*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,		\
279*5113495bSYour Name 	RX_MPDU_INFO_11_FRAME_ENCRYPTION_INFO_VALID_OFFSET)),	\
280*5113495bSYour Name 	RX_MPDU_INFO_11_FRAME_ENCRYPTION_INFO_VALID_MASK,	\
281*5113495bSYour Name 	RX_MPDU_INFO_11_FRAME_ENCRYPTION_INFO_VALID_LSB))
282*5113495bSYour Name 
283*5113495bSYour Name #define HAL_RX_MPDU_GET_FROMDS(_rx_mpdu_info)	\
284*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
285*5113495bSYour Name 		RX_MPDU_INFO_11_FR_DS_OFFSET)),	\
286*5113495bSYour Name 		RX_MPDU_INFO_11_FR_DS_MASK,	\
287*5113495bSYour Name 		RX_MPDU_INFO_11_FR_DS_LSB))
288*5113495bSYour Name 
289*5113495bSYour Name #define HAL_RX_MPDU_GET_TODS(_rx_mpdu_info)	\
290*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
291*5113495bSYour Name 		RX_MPDU_INFO_11_TO_DS_OFFSET)),	\
292*5113495bSYour Name 		RX_MPDU_INFO_11_TO_DS_MASK,	\
293*5113495bSYour Name 		RX_MPDU_INFO_11_TO_DS_LSB))
294*5113495bSYour Name 
295*5113495bSYour Name #define HAL_RX_MPDU_GET_SEQUENCE_NUMBER(_rx_mpdu_info)	\
296*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
297*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_NUMBER_OFFSET)),	\
298*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_NUMBER_MASK,	\
299*5113495bSYour Name 		RX_MPDU_INFO_11_MPDU_SEQUENCE_NUMBER_LSB))
300*5113495bSYour Name 
301*5113495bSYour Name #define HAL_RX_MPDU_PN_31_0_GET(_rx_mpdu_info)		\
302*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
303*5113495bSYour Name 	RX_MPDU_INFO_3_PN_31_0_OFFSET)),		\
304*5113495bSYour Name 	RX_MPDU_INFO_3_PN_31_0_MASK,			\
305*5113495bSYour Name 	RX_MPDU_INFO_3_PN_31_0_LSB))
306*5113495bSYour Name 
307*5113495bSYour Name #define HAL_RX_MPDU_PN_63_32_GET(_rx_mpdu_info)		\
308*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
309*5113495bSYour Name 	RX_MPDU_INFO_4_PN_63_32_OFFSET)),		\
310*5113495bSYour Name 	RX_MPDU_INFO_4_PN_63_32_MASK,			\
311*5113495bSYour Name 	RX_MPDU_INFO_4_PN_63_32_LSB))
312*5113495bSYour Name 
313*5113495bSYour Name #define HAL_RX_MPDU_PN_95_64_GET(_rx_mpdu_info)		\
314*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
315*5113495bSYour Name 	RX_MPDU_INFO_5_PN_95_64_OFFSET)),		\
316*5113495bSYour Name 	RX_MPDU_INFO_5_PN_95_64_MASK,			\
317*5113495bSYour Name 	RX_MPDU_INFO_5_PN_95_64_LSB))
318*5113495bSYour Name 
319*5113495bSYour Name #define HAL_RX_MPDU_PN_127_96_GET(_rx_mpdu_info)	\
320*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_mpdu_info,	\
321*5113495bSYour Name 	RX_MPDU_INFO_6_PN_127_96_OFFSET)),		\
322*5113495bSYour Name 	RX_MPDU_INFO_6_PN_127_96_MASK,			\
323*5113495bSYour Name 	RX_MPDU_INFO_6_PN_127_96_LSB))
324*5113495bSYour Name 
325*5113495bSYour Name #define HAL_RX_MSDU_END_FLOW_IDX_TIMEOUT_GET(_rx_msdu_end)  \
326*5113495bSYour Name 		(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,  \
327*5113495bSYour Name 		RX_MSDU_END_10_FLOW_IDX_TIMEOUT_OFFSET)),  \
328*5113495bSYour Name 		RX_MSDU_END_10_FLOW_IDX_TIMEOUT_MASK,    \
329*5113495bSYour Name 		RX_MSDU_END_10_FLOW_IDX_TIMEOUT_LSB))
330*5113495bSYour Name 
331*5113495bSYour Name #define HAL_RX_MSDU_END_FLOW_IDX_INVALID_GET(_rx_msdu_end)  \
332*5113495bSYour Name 		(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,  \
333*5113495bSYour Name 		RX_MSDU_END_10_FLOW_IDX_INVALID_OFFSET)),  \
334*5113495bSYour Name 		RX_MSDU_END_10_FLOW_IDX_INVALID_MASK,    \
335*5113495bSYour Name 		RX_MSDU_END_10_FLOW_IDX_INVALID_LSB))
336*5113495bSYour Name 
337*5113495bSYour Name #define HAL_RX_MSDU_END_FLOW_IDX_GET(_rx_msdu_end)  \
338*5113495bSYour Name 		(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,  \
339*5113495bSYour Name 		RX_MSDU_END_12_FLOW_IDX_OFFSET)),  \
340*5113495bSYour Name 		RX_MSDU_END_12_FLOW_IDX_MASK,    \
341*5113495bSYour Name 		RX_MSDU_END_12_FLOW_IDX_LSB))
342*5113495bSYour Name 
343*5113495bSYour Name #define HAL_RX_MSDU_END_FSE_METADATA_GET(_rx_msdu_end)  \
344*5113495bSYour Name 		(_HAL_MS((*_OFFSET_TO_WORD_PTR(_rx_msdu_end,  \
345*5113495bSYour Name 		RX_MSDU_END_13_FSE_METADATA_OFFSET)),	\
346*5113495bSYour Name 		RX_MSDU_END_13_FSE_METADATA_MASK,    \
347*5113495bSYour Name 		RX_MSDU_END_13_FSE_METADATA_LSB))
348*5113495bSYour Name 
349*5113495bSYour Name #define HAL_RX_MPDU_GET_PHY_PPDU_ID(_rx_mpdu_info)	\
350*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_mpdu_info),	\
351*5113495bSYour Name 	RX_MPDU_INFO_9_PHY_PPDU_ID_OFFSET)),		\
352*5113495bSYour Name 	RX_MPDU_INFO_9_PHY_PPDU_ID_MASK,		\
353*5113495bSYour Name 	RX_MPDU_INFO_9_PHY_PPDU_ID_LSB))		\
354*5113495bSYour Name 
355*5113495bSYour Name #define HAL_RX_MSDU_START_MIMO_SS_BITMAP(_rx_msdu_start)\
356*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),\
357*5113495bSYour Name 	RX_MSDU_START_5_MIMO_SS_BITMAP_OFFSET)),	\
358*5113495bSYour Name 	RX_MSDU_START_5_MIMO_SS_BITMAP_MASK,		\
359*5113495bSYour Name 	RX_MSDU_START_5_MIMO_SS_BITMAP_LSB))
360*5113495bSYour Name 
361*5113495bSYour Name #ifdef GET_MSDU_AGGREGATION
362*5113495bSYour Name #define HAL_RX_GET_MSDU_AGGREGATION(rx_desc, rs)\
363*5113495bSYour Name {\
364*5113495bSYour Name 	struct rx_msdu_end *rx_msdu_end;\
365*5113495bSYour Name 	bool first_msdu, last_msdu; \
366*5113495bSYour Name 	rx_msdu_end = &rx_desc->msdu_end_tlv.rx_msdu_end;\
367*5113495bSYour Name 	first_msdu = HAL_RX_GET(rx_msdu_end, RX_MSDU_END_10, FIRST_MSDU);\
368*5113495bSYour Name 	last_msdu = HAL_RX_GET(rx_msdu_end, RX_MSDU_END_10, LAST_MSDU);\
369*5113495bSYour Name 	if (first_msdu && last_msdu)\
370*5113495bSYour Name 		rs->rs_flags &= (~IEEE80211_AMSDU_FLAG);\
371*5113495bSYour Name 	else\
372*5113495bSYour Name 		rs->rs_flags |= (IEEE80211_AMSDU_FLAG); \
373*5113495bSYour Name } \
374*5113495bSYour Name 
375*5113495bSYour Name #else
376*5113495bSYour Name #define HAL_RX_GET_MSDU_AGGREGATION(rx_desc, rs)
377*5113495bSYour Name #endif
378*5113495bSYour Name 
379*5113495bSYour Name #define HAL_RX_MPDU_INFO_TID_GET(_rx_mpdu_info) \
380*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_mpdu_info),	\
381*5113495bSYour Name 		RX_MPDU_INFO_7_TID_OFFSET)),		\
382*5113495bSYour Name 		RX_MPDU_INFO_7_TID_MASK,		\
383*5113495bSYour Name 		RX_MPDU_INFO_7_TID_LSB))
384*5113495bSYour Name 
385*5113495bSYour Name #define HAL_RX_MSDU_START_RECEPTION_TYPE_GET(_rx_msdu_start)	\
386*5113495bSYour Name 	(_HAL_MS((*_OFFSET_TO_WORD_PTR((_rx_msdu_start),	\
387*5113495bSYour Name 	RX_MSDU_START_5_RECEPTION_TYPE_OFFSET)),		\
388*5113495bSYour Name 	RX_MSDU_START_5_RECEPTION_TYPE_MASK,			\
389*5113495bSYour Name 	RX_MSDU_START_5_RECEPTION_TYPE_LSB))
390*5113495bSYour Name 
391*5113495bSYour Name #define RX_LOCATION_INFO_DETAILS_RESERVED_8_CHAN_CAPTURE_STATUS_BMASK 0x3
392*5113495bSYour Name 
393*5113495bSYour Name #define GET_RX_LOCATION_INFO_CHAN_CAPTURE_STATUS(rx_tlv) \
394*5113495bSYour Name 	(HAL_RX_GET(rx_tlv, \
395*5113495bSYour Name 		    PHYRX_PKT_END_13_RX_PKT_END_DETAILS_RX_LOCATION_INFO_DETAILS, \
396*5113495bSYour Name 		    RESERVED_8) & \
397*5113495bSYour Name 	 RX_LOCATION_INFO_DETAILS_RESERVED_8_CHAN_CAPTURE_STATUS_BMASK)
398