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 _TX_MSDU_START_H_
19 #define _TX_MSDU_START_H_
20 
21 #define NUM_OF_DWORDS_TX_MSDU_START 7
22 
23 struct tx_msdu_start {
24 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
25              uint32_t msdu_len                                                : 14,
26                       first_msdu                                              :  1,
27                       last_msdu                                               :  1,
28                       encap_type                                              :  2,
29                       epd_en                                                  :  1,
30                       da_sa_present                                           :  2,
31                       ipv4_checksum_en                                        :  1,
32                       udp_over_ipv4_checksum_en                               :  1,
33                       udp_over_ipv6_checksum_en                               :  1,
34                       tcp_over_ipv4_checksum_en                               :  1,
35                       tcp_over_ipv6_checksum_en                               :  1,
36                       dummy_msdu_delimitation                                 :  1,
37                       reserved_0a                                             :  5;
38              uint32_t tso_enable                                              :  1,
39                       reserved_1a                                             :  6,
40                       tcp_flag                                                :  9,
41                       tcp_flag_mask                                           :  9,
42                       mesh_enable                                             :  1,
43                       reserved_1b                                             :  6;
44              uint32_t l2_length                                               : 16,
45                       ip_length                                               : 16;
46              uint32_t tcp_seq_number                                          : 32;
47              uint32_t ip_identification                                       : 16,
48                       checksum_offset                                         : 13,
49                       partial_checksum_en                                     :  1,
50                       reserved_4                                              :  2;
51              uint32_t payload_start_offset                                    : 14,
52                       reserved_5a                                             :  2,
53                       payload_end_offset                                      : 14,
54                       reserved_5b                                             :  2;
55              uint32_t udp_length                                              : 16,
56                       reserved_6                                              : 16;
57 #else
58              uint32_t reserved_0a                                             :  5,
59                       dummy_msdu_delimitation                                 :  1,
60                       tcp_over_ipv6_checksum_en                               :  1,
61                       tcp_over_ipv4_checksum_en                               :  1,
62                       udp_over_ipv6_checksum_en                               :  1,
63                       udp_over_ipv4_checksum_en                               :  1,
64                       ipv4_checksum_en                                        :  1,
65                       da_sa_present                                           :  2,
66                       epd_en                                                  :  1,
67                       encap_type                                              :  2,
68                       last_msdu                                               :  1,
69                       first_msdu                                              :  1,
70                       msdu_len                                                : 14;
71              uint32_t reserved_1b                                             :  6,
72                       mesh_enable                                             :  1,
73                       tcp_flag_mask                                           :  9,
74                       tcp_flag                                                :  9,
75                       reserved_1a                                             :  6,
76                       tso_enable                                              :  1;
77              uint32_t ip_length                                               : 16,
78                       l2_length                                               : 16;
79              uint32_t tcp_seq_number                                          : 32;
80              uint32_t reserved_4                                              :  2,
81                       partial_checksum_en                                     :  1,
82                       checksum_offset                                         : 13,
83                       ip_identification                                       : 16;
84              uint32_t reserved_5b                                             :  2,
85                       payload_end_offset                                      : 14,
86                       reserved_5a                                             :  2,
87                       payload_start_offset                                    : 14;
88              uint32_t reserved_6                                              : 16,
89                       udp_length                                              : 16;
90 #endif
91 };
92 
93 #define TX_MSDU_START_MSDU_LEN_OFFSET                                               0x00000000
94 #define TX_MSDU_START_MSDU_LEN_LSB                                                  0
95 #define TX_MSDU_START_MSDU_LEN_MSB                                                  13
96 #define TX_MSDU_START_MSDU_LEN_MASK                                                 0x00003fff
97 
98 #define TX_MSDU_START_FIRST_MSDU_OFFSET                                             0x00000000
99 #define TX_MSDU_START_FIRST_MSDU_LSB                                                14
100 #define TX_MSDU_START_FIRST_MSDU_MSB                                                14
101 #define TX_MSDU_START_FIRST_MSDU_MASK                                               0x00004000
102 
103 #define TX_MSDU_START_LAST_MSDU_OFFSET                                              0x00000000
104 #define TX_MSDU_START_LAST_MSDU_LSB                                                 15
105 #define TX_MSDU_START_LAST_MSDU_MSB                                                 15
106 #define TX_MSDU_START_LAST_MSDU_MASK                                                0x00008000
107 
108 #define TX_MSDU_START_ENCAP_TYPE_OFFSET                                             0x00000000
109 #define TX_MSDU_START_ENCAP_TYPE_LSB                                                16
110 #define TX_MSDU_START_ENCAP_TYPE_MSB                                                17
111 #define TX_MSDU_START_ENCAP_TYPE_MASK                                               0x00030000
112 
113 #define TX_MSDU_START_EPD_EN_OFFSET                                                 0x00000000
114 #define TX_MSDU_START_EPD_EN_LSB                                                    18
115 #define TX_MSDU_START_EPD_EN_MSB                                                    18
116 #define TX_MSDU_START_EPD_EN_MASK                                                   0x00040000
117 
118 #define TX_MSDU_START_DA_SA_PRESENT_OFFSET                                          0x00000000
119 #define TX_MSDU_START_DA_SA_PRESENT_LSB                                             19
120 #define TX_MSDU_START_DA_SA_PRESENT_MSB                                             20
121 #define TX_MSDU_START_DA_SA_PRESENT_MASK                                            0x00180000
122 
123 #define TX_MSDU_START_IPV4_CHECKSUM_EN_OFFSET                                       0x00000000
124 #define TX_MSDU_START_IPV4_CHECKSUM_EN_LSB                                          21
125 #define TX_MSDU_START_IPV4_CHECKSUM_EN_MSB                                          21
126 #define TX_MSDU_START_IPV4_CHECKSUM_EN_MASK                                         0x00200000
127 
128 #define TX_MSDU_START_UDP_OVER_IPV4_CHECKSUM_EN_OFFSET                              0x00000000
129 #define TX_MSDU_START_UDP_OVER_IPV4_CHECKSUM_EN_LSB                                 22
130 #define TX_MSDU_START_UDP_OVER_IPV4_CHECKSUM_EN_MSB                                 22
131 #define TX_MSDU_START_UDP_OVER_IPV4_CHECKSUM_EN_MASK                                0x00400000
132 
133 #define TX_MSDU_START_UDP_OVER_IPV6_CHECKSUM_EN_OFFSET                              0x00000000
134 #define TX_MSDU_START_UDP_OVER_IPV6_CHECKSUM_EN_LSB                                 23
135 #define TX_MSDU_START_UDP_OVER_IPV6_CHECKSUM_EN_MSB                                 23
136 #define TX_MSDU_START_UDP_OVER_IPV6_CHECKSUM_EN_MASK                                0x00800000
137 
138 #define TX_MSDU_START_TCP_OVER_IPV4_CHECKSUM_EN_OFFSET                              0x00000000
139 #define TX_MSDU_START_TCP_OVER_IPV4_CHECKSUM_EN_LSB                                 24
140 #define TX_MSDU_START_TCP_OVER_IPV4_CHECKSUM_EN_MSB                                 24
141 #define TX_MSDU_START_TCP_OVER_IPV4_CHECKSUM_EN_MASK                                0x01000000
142 
143 #define TX_MSDU_START_TCP_OVER_IPV6_CHECKSUM_EN_OFFSET                              0x00000000
144 #define TX_MSDU_START_TCP_OVER_IPV6_CHECKSUM_EN_LSB                                 25
145 #define TX_MSDU_START_TCP_OVER_IPV6_CHECKSUM_EN_MSB                                 25
146 #define TX_MSDU_START_TCP_OVER_IPV6_CHECKSUM_EN_MASK                                0x02000000
147 
148 #define TX_MSDU_START_DUMMY_MSDU_DELIMITATION_OFFSET                                0x00000000
149 #define TX_MSDU_START_DUMMY_MSDU_DELIMITATION_LSB                                   26
150 #define TX_MSDU_START_DUMMY_MSDU_DELIMITATION_MSB                                   26
151 #define TX_MSDU_START_DUMMY_MSDU_DELIMITATION_MASK                                  0x04000000
152 
153 #define TX_MSDU_START_RESERVED_0A_OFFSET                                            0x00000000
154 #define TX_MSDU_START_RESERVED_0A_LSB                                               27
155 #define TX_MSDU_START_RESERVED_0A_MSB                                               31
156 #define TX_MSDU_START_RESERVED_0A_MASK                                              0xf8000000
157 
158 #define TX_MSDU_START_TSO_ENABLE_OFFSET                                             0x00000004
159 #define TX_MSDU_START_TSO_ENABLE_LSB                                                0
160 #define TX_MSDU_START_TSO_ENABLE_MSB                                                0
161 #define TX_MSDU_START_TSO_ENABLE_MASK                                               0x00000001
162 
163 #define TX_MSDU_START_RESERVED_1A_OFFSET                                            0x00000004
164 #define TX_MSDU_START_RESERVED_1A_LSB                                               1
165 #define TX_MSDU_START_RESERVED_1A_MSB                                               6
166 #define TX_MSDU_START_RESERVED_1A_MASK                                              0x0000007e
167 
168 #define TX_MSDU_START_TCP_FLAG_OFFSET                                               0x00000004
169 #define TX_MSDU_START_TCP_FLAG_LSB                                                  7
170 #define TX_MSDU_START_TCP_FLAG_MSB                                                  15
171 #define TX_MSDU_START_TCP_FLAG_MASK                                                 0x0000ff80
172 
173 #define TX_MSDU_START_TCP_FLAG_MASK_OFFSET                                          0x00000004
174 #define TX_MSDU_START_TCP_FLAG_MASK_LSB                                             16
175 #define TX_MSDU_START_TCP_FLAG_MASK_MSB                                             24
176 #define TX_MSDU_START_TCP_FLAG_MASK_MASK                                            0x01ff0000
177 
178 #define TX_MSDU_START_MESH_ENABLE_OFFSET                                            0x00000004
179 #define TX_MSDU_START_MESH_ENABLE_LSB                                               25
180 #define TX_MSDU_START_MESH_ENABLE_MSB                                               25
181 #define TX_MSDU_START_MESH_ENABLE_MASK                                              0x02000000
182 
183 #define TX_MSDU_START_RESERVED_1B_OFFSET                                            0x00000004
184 #define TX_MSDU_START_RESERVED_1B_LSB                                               26
185 #define TX_MSDU_START_RESERVED_1B_MSB                                               31
186 #define TX_MSDU_START_RESERVED_1B_MASK                                              0xfc000000
187 
188 #define TX_MSDU_START_L2_LENGTH_OFFSET                                              0x00000008
189 #define TX_MSDU_START_L2_LENGTH_LSB                                                 0
190 #define TX_MSDU_START_L2_LENGTH_MSB                                                 15
191 #define TX_MSDU_START_L2_LENGTH_MASK                                                0x0000ffff
192 
193 #define TX_MSDU_START_IP_LENGTH_OFFSET                                              0x00000008
194 #define TX_MSDU_START_IP_LENGTH_LSB                                                 16
195 #define TX_MSDU_START_IP_LENGTH_MSB                                                 31
196 #define TX_MSDU_START_IP_LENGTH_MASK                                                0xffff0000
197 
198 #define TX_MSDU_START_TCP_SEQ_NUMBER_OFFSET                                         0x0000000c
199 #define TX_MSDU_START_TCP_SEQ_NUMBER_LSB                                            0
200 #define TX_MSDU_START_TCP_SEQ_NUMBER_MSB                                            31
201 #define TX_MSDU_START_TCP_SEQ_NUMBER_MASK                                           0xffffffff
202 
203 #define TX_MSDU_START_IP_IDENTIFICATION_OFFSET                                      0x00000010
204 #define TX_MSDU_START_IP_IDENTIFICATION_LSB                                         0
205 #define TX_MSDU_START_IP_IDENTIFICATION_MSB                                         15
206 #define TX_MSDU_START_IP_IDENTIFICATION_MASK                                        0x0000ffff
207 
208 #define TX_MSDU_START_CHECKSUM_OFFSET_OFFSET                                        0x00000010
209 #define TX_MSDU_START_CHECKSUM_OFFSET_LSB                                           16
210 #define TX_MSDU_START_CHECKSUM_OFFSET_MSB                                           28
211 #define TX_MSDU_START_CHECKSUM_OFFSET_MASK                                          0x1fff0000
212 
213 #define TX_MSDU_START_PARTIAL_CHECKSUM_EN_OFFSET                                    0x00000010
214 #define TX_MSDU_START_PARTIAL_CHECKSUM_EN_LSB                                       29
215 #define TX_MSDU_START_PARTIAL_CHECKSUM_EN_MSB                                       29
216 #define TX_MSDU_START_PARTIAL_CHECKSUM_EN_MASK                                      0x20000000
217 
218 #define TX_MSDU_START_RESERVED_4_OFFSET                                             0x00000010
219 #define TX_MSDU_START_RESERVED_4_LSB                                                30
220 #define TX_MSDU_START_RESERVED_4_MSB                                                31
221 #define TX_MSDU_START_RESERVED_4_MASK                                               0xc0000000
222 
223 #define TX_MSDU_START_PAYLOAD_START_OFFSET_OFFSET                                   0x00000014
224 #define TX_MSDU_START_PAYLOAD_START_OFFSET_LSB                                      0
225 #define TX_MSDU_START_PAYLOAD_START_OFFSET_MSB                                      13
226 #define TX_MSDU_START_PAYLOAD_START_OFFSET_MASK                                     0x00003fff
227 
228 #define TX_MSDU_START_RESERVED_5A_OFFSET                                            0x00000014
229 #define TX_MSDU_START_RESERVED_5A_LSB                                               14
230 #define TX_MSDU_START_RESERVED_5A_MSB                                               15
231 #define TX_MSDU_START_RESERVED_5A_MASK                                              0x0000c000
232 
233 #define TX_MSDU_START_PAYLOAD_END_OFFSET_OFFSET                                     0x00000014
234 #define TX_MSDU_START_PAYLOAD_END_OFFSET_LSB                                        16
235 #define TX_MSDU_START_PAYLOAD_END_OFFSET_MSB                                        29
236 #define TX_MSDU_START_PAYLOAD_END_OFFSET_MASK                                       0x3fff0000
237 
238 #define TX_MSDU_START_RESERVED_5B_OFFSET                                            0x00000014
239 #define TX_MSDU_START_RESERVED_5B_LSB                                               30
240 #define TX_MSDU_START_RESERVED_5B_MSB                                               31
241 #define TX_MSDU_START_RESERVED_5B_MASK                                              0xc0000000
242 
243 #define TX_MSDU_START_UDP_LENGTH_OFFSET                                             0x00000018
244 #define TX_MSDU_START_UDP_LENGTH_LSB                                                0
245 #define TX_MSDU_START_UDP_LENGTH_MSB                                                15
246 #define TX_MSDU_START_UDP_LENGTH_MASK                                               0x0000ffff
247 
248 #define TX_MSDU_START_RESERVED_6_OFFSET                                             0x00000018
249 #define TX_MSDU_START_RESERVED_6_LSB                                                16
250 #define TX_MSDU_START_RESERVED_6_MSB                                                31
251 #define TX_MSDU_START_RESERVED_6_MASK                                               0xffff0000
252 
253 #endif
254