1 /*
2  * Copyright (c) 2019, The Linux Foundation. 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 #ifndef _TX_RATE_STATS_INFO_H_
18 #define _TX_RATE_STATS_INFO_H_
19 #if !defined(__ASSEMBLER__)
20 #endif
21 
22 
23 // ################ START SUMMARY #################
24 //
25 //	Dword	Fields
26 //	0	tx_rate_stats_info_valid[0], transmit_bw[2:1], transmit_pkt_type[6:3], transmit_stbc[7], transmit_ldpc[8], transmit_sgi[10:9], transmit_mcs[14:11], ofdma_transmission[15], tones_in_ru[27:16], reserved_0a[31:28]
27 //	1	ppdu_transmission_tsf[31:0]
28 //
29 // ################ END SUMMARY #################
30 
31 #define NUM_OF_DWORDS_TX_RATE_STATS_INFO 2
32 
33 struct tx_rate_stats_info {
34              uint32_t tx_rate_stats_info_valid        :  1, //[0]
35                       transmit_bw                     :  2, //[2:1]
36                       transmit_pkt_type               :  4, //[6:3]
37                       transmit_stbc                   :  1, //[7]
38                       transmit_ldpc                   :  1, //[8]
39                       transmit_sgi                    :  2, //[10:9]
40                       transmit_mcs                    :  4, //[14:11]
41                       ofdma_transmission              :  1, //[15]
42                       tones_in_ru                     : 12, //[27:16]
43                       reserved_0a                     :  4; //[31:28]
44              uint32_t ppdu_transmission_tsf           : 32; //[31:0]
45 };
46 
47 /*
48 
49 tx_rate_stats_info_valid
50 
51 			When set all other fields in this STRUCT contain valid
52 			info.
53 
54 
55 
56 
57 			<legal all>
58 
59 transmit_bw
60 
61 			Field only valid when Tx_rate_stats_info_valid is set
62 
63 
64 
65 			Indicates the BW of the upcoming transmission that shall
66 			likely start in about 3 -4 us on the medium
67 
68 
69 
70 			<enum 0 transmit_bw_20_MHz>
71 
72 			<enum 1 transmit_bw_40_MHz>
73 
74 			<enum 2 transmit_bw_80_MHz>
75 
76 			<enum 3 transmit_bw_160_MHz>
77 
78 
79 
80 			<legal all>
81 
82 transmit_pkt_type
83 
84 			Field only valid when Tx_rate_stats_info_valid is set
85 
86 
87 
88 			Field filled in by PDG.
89 
90 			Not valid when in SW transmit mode
91 
92 
93 
94 			The packet type
95 
96 			<enum 0 dot11a>802.11a PPDU type
97 
98 			<enum 1 dot11b>802.11b PPDU type
99 
100 			<enum 2 dot11n_mm>802.11n Mixed Mode PPDU type
101 
102 			<enum 3 dot11ac>802.11ac PPDU type
103 
104 			<enum 4 dot11ax>802.11ax PPDU type
105 
106 			<enum 5 dot11ba>802.11ba (WUR) PPDU type
107 
108 transmit_stbc
109 
110 			Field only valid when Tx_rate_stats_info_valid is set
111 
112 
113 
114 			Field filled in by PDG.
115 
116 			Not valid when in SW transmit mode
117 
118 
119 
120 			When set, STBC transmission rate was used.
121 
122 transmit_ldpc
123 
124 			Field only valid when Tx_rate_stats_info_valid is set
125 
126 
127 
128 			Field filled in by PDG.
129 
130 			Not valid when in SW transmit mode
131 
132 
133 
134 			When set, use LDPC transmission rates
135 
136 transmit_sgi
137 
138 			Field only valid when Tx_rate_stats_info_valid is set
139 
140 
141 
142 			Field filled in by PDG.
143 
144 			Not valid when in SW transmit mode
145 
146 
147 
148 			<enum 0     0_8_us_sgi > Legacy normal GI. Can also be
149 			used for HE
150 
151 			<enum 1     0_4_us_sgi > Legacy short GI. Can also be
152 			used for HE
153 
154 			<enum 2     1_6_us_sgi > HE related GI
155 
156 			<enum 3     3_2_us_sgi > HE related GI
157 
158 			<legal 0 - 3>
159 
160 transmit_mcs
161 
162 			Field only valid when Tx_rate_stats_info_valid is set
163 
164 
165 
166 			Field filled in by PDG.
167 
168 			Not valid when in SW transmit mode
169 
170 
171 
172 			For details, refer to  MCS_TYPE description
173 
174 			<legal all>
175 
176 ofdma_transmission
177 
178 			Field only valid when Tx_rate_stats_info_valid is set
179 
180 
181 
182 			Field filled in by PDG.
183 
184 
185 
186 			Set when the transmission was an OFDMA transmission (DL
187 			or UL).
188 
189 			<legal all>
190 
191 tones_in_ru
192 
193 			Field only valid when Tx_rate_stats_info_valid is set
194 
195 
196 
197 			Field filled in by PDG.
198 
199 			Not valid when in SW transmit mode
200 
201 
202 
203 			The number of tones in the RU used.
204 
205 			<legal all>
206 
207 reserved_0a
208 
209 			<legal 0>
210 
211 ppdu_transmission_tsf
212 
213 			Field only valid when Tx_rate_stats_info_valid is set
214 
215 
216 
217 			Based on a HWSCH configuration register setting, this
218 			field either contains:
219 
220 
221 
222 			Lower 32 bits of the TSF, snapshot of this value when
223 			transmission of the PPDU containing the frame finished.
224 
225 			OR
226 
227 			Lower 32 bits of the TSF, snapshot of this value when
228 			transmission of the PPDU containing the frame started
229 
230 
231 
232 			<legal all>
233 */
234 
235 
236 /* Description		TX_RATE_STATS_INFO_0_TX_RATE_STATS_INFO_VALID
237 
238 			When set all other fields in this STRUCT contain valid
239 			info.
240 
241 
242 
243 
244 			<legal all>
245 */
246 #define TX_RATE_STATS_INFO_0_TX_RATE_STATS_INFO_VALID_OFFSET         0x00000000
247 #define TX_RATE_STATS_INFO_0_TX_RATE_STATS_INFO_VALID_LSB            0
248 #define TX_RATE_STATS_INFO_0_TX_RATE_STATS_INFO_VALID_MASK           0x00000001
249 
250 /* Description		TX_RATE_STATS_INFO_0_TRANSMIT_BW
251 
252 			Field only valid when Tx_rate_stats_info_valid is set
253 
254 
255 
256 			Indicates the BW of the upcoming transmission that shall
257 			likely start in about 3 -4 us on the medium
258 
259 
260 
261 			<enum 0 transmit_bw_20_MHz>
262 
263 			<enum 1 transmit_bw_40_MHz>
264 
265 			<enum 2 transmit_bw_80_MHz>
266 
267 			<enum 3 transmit_bw_160_MHz>
268 
269 
270 
271 			<legal all>
272 */
273 #define TX_RATE_STATS_INFO_0_TRANSMIT_BW_OFFSET                      0x00000000
274 #define TX_RATE_STATS_INFO_0_TRANSMIT_BW_LSB                         1
275 #define TX_RATE_STATS_INFO_0_TRANSMIT_BW_MASK                        0x00000006
276 
277 /* Description		TX_RATE_STATS_INFO_0_TRANSMIT_PKT_TYPE
278 
279 			Field only valid when Tx_rate_stats_info_valid is set
280 
281 
282 
283 			Field filled in by PDG.
284 
285 			Not valid when in SW transmit mode
286 
287 
288 
289 			The packet type
290 
291 			<enum 0 dot11a>802.11a PPDU type
292 
293 			<enum 1 dot11b>802.11b PPDU type
294 
295 			<enum 2 dot11n_mm>802.11n Mixed Mode PPDU type
296 
297 			<enum 3 dot11ac>802.11ac PPDU type
298 
299 			<enum 4 dot11ax>802.11ax PPDU type
300 
301 			<enum 5 dot11ba>802.11ba (WUR) PPDU type
302 */
303 #define TX_RATE_STATS_INFO_0_TRANSMIT_PKT_TYPE_OFFSET                0x00000000
304 #define TX_RATE_STATS_INFO_0_TRANSMIT_PKT_TYPE_LSB                   3
305 #define TX_RATE_STATS_INFO_0_TRANSMIT_PKT_TYPE_MASK                  0x00000078
306 
307 /* Description		TX_RATE_STATS_INFO_0_TRANSMIT_STBC
308 
309 			Field only valid when Tx_rate_stats_info_valid is set
310 
311 
312 
313 			Field filled in by PDG.
314 
315 			Not valid when in SW transmit mode
316 
317 
318 
319 			When set, STBC transmission rate was used.
320 */
321 #define TX_RATE_STATS_INFO_0_TRANSMIT_STBC_OFFSET                    0x00000000
322 #define TX_RATE_STATS_INFO_0_TRANSMIT_STBC_LSB                       7
323 #define TX_RATE_STATS_INFO_0_TRANSMIT_STBC_MASK                      0x00000080
324 
325 /* Description		TX_RATE_STATS_INFO_0_TRANSMIT_LDPC
326 
327 			Field only valid when Tx_rate_stats_info_valid is set
328 
329 
330 
331 			Field filled in by PDG.
332 
333 			Not valid when in SW transmit mode
334 
335 
336 
337 			When set, use LDPC transmission rates
338 */
339 #define TX_RATE_STATS_INFO_0_TRANSMIT_LDPC_OFFSET                    0x00000000
340 #define TX_RATE_STATS_INFO_0_TRANSMIT_LDPC_LSB                       8
341 #define TX_RATE_STATS_INFO_0_TRANSMIT_LDPC_MASK                      0x00000100
342 
343 /* Description		TX_RATE_STATS_INFO_0_TRANSMIT_SGI
344 
345 			Field only valid when Tx_rate_stats_info_valid is set
346 
347 
348 
349 			Field filled in by PDG.
350 
351 			Not valid when in SW transmit mode
352 
353 
354 
355 			<enum 0     0_8_us_sgi > Legacy normal GI. Can also be
356 			used for HE
357 
358 			<enum 1     0_4_us_sgi > Legacy short GI. Can also be
359 			used for HE
360 
361 			<enum 2     1_6_us_sgi > HE related GI
362 
363 			<enum 3     3_2_us_sgi > HE related GI
364 
365 			<legal 0 - 3>
366 */
367 #define TX_RATE_STATS_INFO_0_TRANSMIT_SGI_OFFSET                     0x00000000
368 #define TX_RATE_STATS_INFO_0_TRANSMIT_SGI_LSB                        9
369 #define TX_RATE_STATS_INFO_0_TRANSMIT_SGI_MASK                       0x00000600
370 
371 /* Description		TX_RATE_STATS_INFO_0_TRANSMIT_MCS
372 
373 			Field only valid when Tx_rate_stats_info_valid is set
374 
375 
376 
377 			Field filled in by PDG.
378 
379 			Not valid when in SW transmit mode
380 
381 
382 
383 			For details, refer to  MCS_TYPE description
384 
385 			<legal all>
386 */
387 #define TX_RATE_STATS_INFO_0_TRANSMIT_MCS_OFFSET                     0x00000000
388 #define TX_RATE_STATS_INFO_0_TRANSMIT_MCS_LSB                        11
389 #define TX_RATE_STATS_INFO_0_TRANSMIT_MCS_MASK                       0x00007800
390 
391 /* Description		TX_RATE_STATS_INFO_0_OFDMA_TRANSMISSION
392 
393 			Field only valid when Tx_rate_stats_info_valid is set
394 
395 
396 
397 			Field filled in by PDG.
398 
399 
400 
401 			Set when the transmission was an OFDMA transmission (DL
402 			or UL).
403 
404 			<legal all>
405 */
406 #define TX_RATE_STATS_INFO_0_OFDMA_TRANSMISSION_OFFSET               0x00000000
407 #define TX_RATE_STATS_INFO_0_OFDMA_TRANSMISSION_LSB                  15
408 #define TX_RATE_STATS_INFO_0_OFDMA_TRANSMISSION_MASK                 0x00008000
409 
410 /* Description		TX_RATE_STATS_INFO_0_TONES_IN_RU
411 
412 			Field only valid when Tx_rate_stats_info_valid is set
413 
414 
415 
416 			Field filled in by PDG.
417 
418 			Not valid when in SW transmit mode
419 
420 
421 
422 			The number of tones in the RU used.
423 
424 			<legal all>
425 */
426 #define TX_RATE_STATS_INFO_0_TONES_IN_RU_OFFSET                      0x00000000
427 #define TX_RATE_STATS_INFO_0_TONES_IN_RU_LSB                         16
428 #define TX_RATE_STATS_INFO_0_TONES_IN_RU_MASK                        0x0fff0000
429 
430 /* Description		TX_RATE_STATS_INFO_0_RESERVED_0A
431 
432 			<legal 0>
433 */
434 #define TX_RATE_STATS_INFO_0_RESERVED_0A_OFFSET                      0x00000000
435 #define TX_RATE_STATS_INFO_0_RESERVED_0A_LSB                         28
436 #define TX_RATE_STATS_INFO_0_RESERVED_0A_MASK                        0xf0000000
437 
438 /* Description		TX_RATE_STATS_INFO_1_PPDU_TRANSMISSION_TSF
439 
440 			Field only valid when Tx_rate_stats_info_valid is set
441 
442 
443 
444 			Based on a HWSCH configuration register setting, this
445 			field either contains:
446 
447 
448 
449 			Lower 32 bits of the TSF, snapshot of this value when
450 			transmission of the PPDU containing the frame finished.
451 
452 			OR
453 
454 			Lower 32 bits of the TSF, snapshot of this value when
455 			transmission of the PPDU containing the frame started
456 
457 
458 
459 			<legal all>
460 */
461 #define TX_RATE_STATS_INFO_1_PPDU_TRANSMISSION_TSF_OFFSET            0x00000004
462 #define TX_RATE_STATS_INFO_1_PPDU_TRANSMISSION_TSF_LSB               0
463 #define TX_RATE_STATS_INFO_1_PPDU_TRANSMISSION_TSF_MASK              0xffffffff
464 
465 
466 #endif // _TX_RATE_STATS_INFO_H_
467