1 /*
2  * Copyright (c) 2023 Qualcomm Innovation Center, Inc. All rights reserved.
3  *
4  * Permission to use, copy, modify, and/or distribute this software for any
5  * purpose with or without fee is hereby granted, provided that the above
6  * copyright notice and this permission notice appear in all copies.
7  *
8  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9  * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10  * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11  * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13  * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14  * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15  */
16 
17 
18 #ifndef _RX_MSDU_START_H_
19 #define _RX_MSDU_START_H_
20 
21 #define NUM_OF_DWORDS_RX_MSDU_START 10
22 
23 struct rx_msdu_start {
24 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
25              uint32_t rxpcu_mpdu_filter_in_category                           :  2,
26                       sw_frame_group_id                                       :  7,
27                       reserved_0                                              :  7,
28                       phy_ppdu_id                                             : 16;
29              uint32_t msdu_length                                             : 14,
30                       stbc                                                    :  1,
31                       ipsec_esp                                               :  1,
32                       l3_offset                                               :  7,
33                       ipsec_ah                                                :  1,
34                       l4_offset                                               :  8;
35              uint32_t msdu_number                                             :  8,
36                       decap_format                                            :  2,
37                       ipv4_proto                                              :  1,
38                       ipv6_proto                                              :  1,
39                       tcp_proto                                               :  1,
40                       udp_proto                                               :  1,
41                       ip_frag                                                 :  1,
42                       tcp_only_ack                                            :  1,
43                       da_is_bcast_mcast                                       :  1,
44                       toeplitz_hash_sel                                       :  2,
45                       ip_fixed_header_valid                                   :  1,
46                       ip_extn_header_valid                                    :  1,
47                       tcp_udp_header_valid                                    :  1,
48                       mesh_control_present                                    :  1,
49                       ldpc                                                    :  1,
50                       ip4_protocol_ip6_next_header                            :  8;
51              uint32_t toeplitz_hash_2_or_4                                    : 32;
52              uint32_t flow_id_toeplitz                                        : 32;
53              uint32_t user_rssi                                               :  8,
54                       pkt_type                                                :  4,
55                       sgi                                                     :  2,
56                       rate_mcs                                                :  4,
57                       receive_bandwidth                                       :  3,
58                       reception_type                                          :  3,
59                       mimo_ss_bitmap                                          :  8;
60              uint32_t ppdu_start_timestamp_31_0                               : 32;
61              uint32_t ppdu_start_timestamp_63_32                              : 32;
62              uint32_t sw_phy_meta_data                                        : 32;
63              uint32_t vlan_ctag_ci                                            : 16,
64                       vlan_stag_ci                                            : 16;
65 #else
66              uint32_t phy_ppdu_id                                             : 16,
67                       reserved_0                                              :  7,
68                       sw_frame_group_id                                       :  7,
69                       rxpcu_mpdu_filter_in_category                           :  2;
70              uint32_t l4_offset                                               :  8,
71                       ipsec_ah                                                :  1,
72                       l3_offset                                               :  7,
73                       ipsec_esp                                               :  1,
74                       stbc                                                    :  1,
75                       msdu_length                                             : 14;
76              uint32_t ip4_protocol_ip6_next_header                            :  8,
77                       ldpc                                                    :  1,
78                       mesh_control_present                                    :  1,
79                       tcp_udp_header_valid                                    :  1,
80                       ip_extn_header_valid                                    :  1,
81                       ip_fixed_header_valid                                   :  1,
82                       toeplitz_hash_sel                                       :  2,
83                       da_is_bcast_mcast                                       :  1,
84                       tcp_only_ack                                            :  1,
85                       ip_frag                                                 :  1,
86                       udp_proto                                               :  1,
87                       tcp_proto                                               :  1,
88                       ipv6_proto                                              :  1,
89                       ipv4_proto                                              :  1,
90                       decap_format                                            :  2,
91                       msdu_number                                             :  8;
92              uint32_t toeplitz_hash_2_or_4                                    : 32;
93              uint32_t flow_id_toeplitz                                        : 32;
94              uint32_t mimo_ss_bitmap                                          :  8,
95                       reception_type                                          :  3,
96                       receive_bandwidth                                       :  3,
97                       rate_mcs                                                :  4,
98                       sgi                                                     :  2,
99                       pkt_type                                                :  4,
100                       user_rssi                                               :  8;
101              uint32_t ppdu_start_timestamp_31_0                               : 32;
102              uint32_t ppdu_start_timestamp_63_32                              : 32;
103              uint32_t sw_phy_meta_data                                        : 32;
104              uint32_t vlan_stag_ci                                            : 16,
105                       vlan_ctag_ci                                            : 16;
106 #endif
107 };
108 
109 #define RX_MSDU_START_RXPCU_MPDU_FILTER_IN_CATEGORY_OFFSET                          0x00000000
110 #define RX_MSDU_START_RXPCU_MPDU_FILTER_IN_CATEGORY_LSB                             0
111 #define RX_MSDU_START_RXPCU_MPDU_FILTER_IN_CATEGORY_MSB                             1
112 #define RX_MSDU_START_RXPCU_MPDU_FILTER_IN_CATEGORY_MASK                            0x00000003
113 
114 #define RX_MSDU_START_SW_FRAME_GROUP_ID_OFFSET                                      0x00000000
115 #define RX_MSDU_START_SW_FRAME_GROUP_ID_LSB                                         2
116 #define RX_MSDU_START_SW_FRAME_GROUP_ID_MSB                                         8
117 #define RX_MSDU_START_SW_FRAME_GROUP_ID_MASK                                        0x000001fc
118 
119 #define RX_MSDU_START_RESERVED_0_OFFSET                                             0x00000000
120 #define RX_MSDU_START_RESERVED_0_LSB                                                9
121 #define RX_MSDU_START_RESERVED_0_MSB                                                15
122 #define RX_MSDU_START_RESERVED_0_MASK                                               0x0000fe00
123 
124 #define RX_MSDU_START_PHY_PPDU_ID_OFFSET                                            0x00000000
125 #define RX_MSDU_START_PHY_PPDU_ID_LSB                                               16
126 #define RX_MSDU_START_PHY_PPDU_ID_MSB                                               31
127 #define RX_MSDU_START_PHY_PPDU_ID_MASK                                              0xffff0000
128 
129 #define RX_MSDU_START_MSDU_LENGTH_OFFSET                                            0x00000004
130 #define RX_MSDU_START_MSDU_LENGTH_LSB                                               0
131 #define RX_MSDU_START_MSDU_LENGTH_MSB                                               13
132 #define RX_MSDU_START_MSDU_LENGTH_MASK                                              0x00003fff
133 
134 #define RX_MSDU_START_STBC_OFFSET                                                   0x00000004
135 #define RX_MSDU_START_STBC_LSB                                                      14
136 #define RX_MSDU_START_STBC_MSB                                                      14
137 #define RX_MSDU_START_STBC_MASK                                                     0x00004000
138 
139 #define RX_MSDU_START_IPSEC_ESP_OFFSET                                              0x00000004
140 #define RX_MSDU_START_IPSEC_ESP_LSB                                                 15
141 #define RX_MSDU_START_IPSEC_ESP_MSB                                                 15
142 #define RX_MSDU_START_IPSEC_ESP_MASK                                                0x00008000
143 
144 #define RX_MSDU_START_L3_OFFSET_OFFSET                                              0x00000004
145 #define RX_MSDU_START_L3_OFFSET_LSB                                                 16
146 #define RX_MSDU_START_L3_OFFSET_MSB                                                 22
147 #define RX_MSDU_START_L3_OFFSET_MASK                                                0x007f0000
148 
149 #define RX_MSDU_START_IPSEC_AH_OFFSET                                               0x00000004
150 #define RX_MSDU_START_IPSEC_AH_LSB                                                  23
151 #define RX_MSDU_START_IPSEC_AH_MSB                                                  23
152 #define RX_MSDU_START_IPSEC_AH_MASK                                                 0x00800000
153 
154 #define RX_MSDU_START_L4_OFFSET_OFFSET                                              0x00000004
155 #define RX_MSDU_START_L4_OFFSET_LSB                                                 24
156 #define RX_MSDU_START_L4_OFFSET_MSB                                                 31
157 #define RX_MSDU_START_L4_OFFSET_MASK                                                0xff000000
158 
159 #define RX_MSDU_START_MSDU_NUMBER_OFFSET                                            0x00000008
160 #define RX_MSDU_START_MSDU_NUMBER_LSB                                               0
161 #define RX_MSDU_START_MSDU_NUMBER_MSB                                               7
162 #define RX_MSDU_START_MSDU_NUMBER_MASK                                              0x000000ff
163 
164 #define RX_MSDU_START_DECAP_FORMAT_OFFSET                                           0x00000008
165 #define RX_MSDU_START_DECAP_FORMAT_LSB                                              8
166 #define RX_MSDU_START_DECAP_FORMAT_MSB                                              9
167 #define RX_MSDU_START_DECAP_FORMAT_MASK                                             0x00000300
168 
169 #define RX_MSDU_START_IPV4_PROTO_OFFSET                                             0x00000008
170 #define RX_MSDU_START_IPV4_PROTO_LSB                                                10
171 #define RX_MSDU_START_IPV4_PROTO_MSB                                                10
172 #define RX_MSDU_START_IPV4_PROTO_MASK                                               0x00000400
173 
174 #define RX_MSDU_START_IPV6_PROTO_OFFSET                                             0x00000008
175 #define RX_MSDU_START_IPV6_PROTO_LSB                                                11
176 #define RX_MSDU_START_IPV6_PROTO_MSB                                                11
177 #define RX_MSDU_START_IPV6_PROTO_MASK                                               0x00000800
178 
179 #define RX_MSDU_START_TCP_PROTO_OFFSET                                              0x00000008
180 #define RX_MSDU_START_TCP_PROTO_LSB                                                 12
181 #define RX_MSDU_START_TCP_PROTO_MSB                                                 12
182 #define RX_MSDU_START_TCP_PROTO_MASK                                                0x00001000
183 
184 #define RX_MSDU_START_UDP_PROTO_OFFSET                                              0x00000008
185 #define RX_MSDU_START_UDP_PROTO_LSB                                                 13
186 #define RX_MSDU_START_UDP_PROTO_MSB                                                 13
187 #define RX_MSDU_START_UDP_PROTO_MASK                                                0x00002000
188 
189 #define RX_MSDU_START_IP_FRAG_OFFSET                                                0x00000008
190 #define RX_MSDU_START_IP_FRAG_LSB                                                   14
191 #define RX_MSDU_START_IP_FRAG_MSB                                                   14
192 #define RX_MSDU_START_IP_FRAG_MASK                                                  0x00004000
193 
194 #define RX_MSDU_START_TCP_ONLY_ACK_OFFSET                                           0x00000008
195 #define RX_MSDU_START_TCP_ONLY_ACK_LSB                                              15
196 #define RX_MSDU_START_TCP_ONLY_ACK_MSB                                              15
197 #define RX_MSDU_START_TCP_ONLY_ACK_MASK                                             0x00008000
198 
199 #define RX_MSDU_START_DA_IS_BCAST_MCAST_OFFSET                                      0x00000008
200 #define RX_MSDU_START_DA_IS_BCAST_MCAST_LSB                                         16
201 #define RX_MSDU_START_DA_IS_BCAST_MCAST_MSB                                         16
202 #define RX_MSDU_START_DA_IS_BCAST_MCAST_MASK                                        0x00010000
203 
204 #define RX_MSDU_START_TOEPLITZ_HASH_SEL_OFFSET                                      0x00000008
205 #define RX_MSDU_START_TOEPLITZ_HASH_SEL_LSB                                         17
206 #define RX_MSDU_START_TOEPLITZ_HASH_SEL_MSB                                         18
207 #define RX_MSDU_START_TOEPLITZ_HASH_SEL_MASK                                        0x00060000
208 
209 #define RX_MSDU_START_IP_FIXED_HEADER_VALID_OFFSET                                  0x00000008
210 #define RX_MSDU_START_IP_FIXED_HEADER_VALID_LSB                                     19
211 #define RX_MSDU_START_IP_FIXED_HEADER_VALID_MSB                                     19
212 #define RX_MSDU_START_IP_FIXED_HEADER_VALID_MASK                                    0x00080000
213 
214 #define RX_MSDU_START_IP_EXTN_HEADER_VALID_OFFSET                                   0x00000008
215 #define RX_MSDU_START_IP_EXTN_HEADER_VALID_LSB                                      20
216 #define RX_MSDU_START_IP_EXTN_HEADER_VALID_MSB                                      20
217 #define RX_MSDU_START_IP_EXTN_HEADER_VALID_MASK                                     0x00100000
218 
219 #define RX_MSDU_START_TCP_UDP_HEADER_VALID_OFFSET                                   0x00000008
220 #define RX_MSDU_START_TCP_UDP_HEADER_VALID_LSB                                      21
221 #define RX_MSDU_START_TCP_UDP_HEADER_VALID_MSB                                      21
222 #define RX_MSDU_START_TCP_UDP_HEADER_VALID_MASK                                     0x00200000
223 
224 #define RX_MSDU_START_MESH_CONTROL_PRESENT_OFFSET                                   0x00000008
225 #define RX_MSDU_START_MESH_CONTROL_PRESENT_LSB                                      22
226 #define RX_MSDU_START_MESH_CONTROL_PRESENT_MSB                                      22
227 #define RX_MSDU_START_MESH_CONTROL_PRESENT_MASK                                     0x00400000
228 
229 #define RX_MSDU_START_LDPC_OFFSET                                                   0x00000008
230 #define RX_MSDU_START_LDPC_LSB                                                      23
231 #define RX_MSDU_START_LDPC_MSB                                                      23
232 #define RX_MSDU_START_LDPC_MASK                                                     0x00800000
233 
234 #define RX_MSDU_START_IP4_PROTOCOL_IP6_NEXT_HEADER_OFFSET                           0x00000008
235 #define RX_MSDU_START_IP4_PROTOCOL_IP6_NEXT_HEADER_LSB                              24
236 #define RX_MSDU_START_IP4_PROTOCOL_IP6_NEXT_HEADER_MSB                              31
237 #define RX_MSDU_START_IP4_PROTOCOL_IP6_NEXT_HEADER_MASK                             0xff000000
238 
239 #define RX_MSDU_START_TOEPLITZ_HASH_2_OR_4_OFFSET                                   0x0000000c
240 #define RX_MSDU_START_TOEPLITZ_HASH_2_OR_4_LSB                                      0
241 #define RX_MSDU_START_TOEPLITZ_HASH_2_OR_4_MSB                                      31
242 #define RX_MSDU_START_TOEPLITZ_HASH_2_OR_4_MASK                                     0xffffffff
243 
244 #define RX_MSDU_START_FLOW_ID_TOEPLITZ_OFFSET                                       0x00000010
245 #define RX_MSDU_START_FLOW_ID_TOEPLITZ_LSB                                          0
246 #define RX_MSDU_START_FLOW_ID_TOEPLITZ_MSB                                          31
247 #define RX_MSDU_START_FLOW_ID_TOEPLITZ_MASK                                         0xffffffff
248 
249 #define RX_MSDU_START_USER_RSSI_OFFSET                                              0x00000014
250 #define RX_MSDU_START_USER_RSSI_LSB                                                 0
251 #define RX_MSDU_START_USER_RSSI_MSB                                                 7
252 #define RX_MSDU_START_USER_RSSI_MASK                                                0x000000ff
253 
254 #define RX_MSDU_START_PKT_TYPE_OFFSET                                               0x00000014
255 #define RX_MSDU_START_PKT_TYPE_LSB                                                  8
256 #define RX_MSDU_START_PKT_TYPE_MSB                                                  11
257 #define RX_MSDU_START_PKT_TYPE_MASK                                                 0x00000f00
258 
259 #define RX_MSDU_START_SGI_OFFSET                                                    0x00000014
260 #define RX_MSDU_START_SGI_LSB                                                       12
261 #define RX_MSDU_START_SGI_MSB                                                       13
262 #define RX_MSDU_START_SGI_MASK                                                      0x00003000
263 
264 #define RX_MSDU_START_RATE_MCS_OFFSET                                               0x00000014
265 #define RX_MSDU_START_RATE_MCS_LSB                                                  14
266 #define RX_MSDU_START_RATE_MCS_MSB                                                  17
267 #define RX_MSDU_START_RATE_MCS_MASK                                                 0x0003c000
268 
269 #define RX_MSDU_START_RECEIVE_BANDWIDTH_OFFSET                                      0x00000014
270 #define RX_MSDU_START_RECEIVE_BANDWIDTH_LSB                                         18
271 #define RX_MSDU_START_RECEIVE_BANDWIDTH_MSB                                         20
272 #define RX_MSDU_START_RECEIVE_BANDWIDTH_MASK                                        0x001c0000
273 
274 #define RX_MSDU_START_RECEPTION_TYPE_OFFSET                                         0x00000014
275 #define RX_MSDU_START_RECEPTION_TYPE_LSB                                            21
276 #define RX_MSDU_START_RECEPTION_TYPE_MSB                                            23
277 #define RX_MSDU_START_RECEPTION_TYPE_MASK                                           0x00e00000
278 
279 #define RX_MSDU_START_MIMO_SS_BITMAP_OFFSET                                         0x00000014
280 #define RX_MSDU_START_MIMO_SS_BITMAP_LSB                                            24
281 #define RX_MSDU_START_MIMO_SS_BITMAP_MSB                                            31
282 #define RX_MSDU_START_MIMO_SS_BITMAP_MASK                                           0xff000000
283 
284 #define RX_MSDU_START_PPDU_START_TIMESTAMP_31_0_OFFSET                              0x00000018
285 #define RX_MSDU_START_PPDU_START_TIMESTAMP_31_0_LSB                                 0
286 #define RX_MSDU_START_PPDU_START_TIMESTAMP_31_0_MSB                                 31
287 #define RX_MSDU_START_PPDU_START_TIMESTAMP_31_0_MASK                                0xffffffff
288 
289 #define RX_MSDU_START_PPDU_START_TIMESTAMP_63_32_OFFSET                             0x0000001c
290 #define RX_MSDU_START_PPDU_START_TIMESTAMP_63_32_LSB                                0
291 #define RX_MSDU_START_PPDU_START_TIMESTAMP_63_32_MSB                                31
292 #define RX_MSDU_START_PPDU_START_TIMESTAMP_63_32_MASK                               0xffffffff
293 
294 #define RX_MSDU_START_SW_PHY_META_DATA_OFFSET                                       0x00000020
295 #define RX_MSDU_START_SW_PHY_META_DATA_LSB                                          0
296 #define RX_MSDU_START_SW_PHY_META_DATA_MSB                                          31
297 #define RX_MSDU_START_SW_PHY_META_DATA_MASK                                         0xffffffff
298 
299 #define RX_MSDU_START_VLAN_CTAG_CI_OFFSET                                           0x00000024
300 #define RX_MSDU_START_VLAN_CTAG_CI_LSB                                              0
301 #define RX_MSDU_START_VLAN_CTAG_CI_MSB                                              15
302 #define RX_MSDU_START_VLAN_CTAG_CI_MASK                                             0x0000ffff
303 
304 #define RX_MSDU_START_VLAN_STAG_CI_OFFSET                                           0x00000024
305 #define RX_MSDU_START_VLAN_STAG_CI_LSB                                              16
306 #define RX_MSDU_START_VLAN_STAG_CI_MSB                                              31
307 #define RX_MSDU_START_VLAN_STAG_CI_MASK                                             0xffff0000
308 
309 #endif
310