1 /*
2  * Copyright (c) 2020, 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 _VHT_SIG_A_INFO_H_
18 #define _VHT_SIG_A_INFO_H_
19 #if !defined(__ASSEMBLER__)
20 #endif
21 
22 
23 // ################ START SUMMARY #################
24 //
25 //	Dword	Fields
26 //	0	bandwidth[1:0], vhta_reserved_0[2], stbc[3], group_id[9:4], n_sts[21:10], txop_ps_not_allowed[22], vhta_reserved_0b[23], reserved_0[31:24]
27 //	1	gi_setting[1:0], su_mu_coding[2], ldpc_extra_symbol[3], mcs[7:4], beamformed[8], vhta_reserved_1[9], crc[17:10], tail[23:18], reserved_1[31:24]
28 //
29 // ################ END SUMMARY #################
30 
31 #define NUM_OF_DWORDS_VHT_SIG_A_INFO 2
32 
33 struct vht_sig_a_info {
34              uint32_t bandwidth                       :  2, //[1:0]
35                       vhta_reserved_0                 :  1, //[2]
36                       stbc                            :  1, //[3]
37                       group_id                        :  6, //[9:4]
38                       n_sts                           : 12, //[21:10]
39                       txop_ps_not_allowed             :  1, //[22]
40                       vhta_reserved_0b                :  1, //[23]
41                       reserved_0                      :  8; //[31:24]
42              uint32_t gi_setting                      :  2, //[1:0]
43                       su_mu_coding                    :  1, //[2]
44                       ldpc_extra_symbol               :  1, //[3]
45                       mcs                             :  4, //[7:4]
46                       beamformed                      :  1, //[8]
47                       vhta_reserved_1                 :  1, //[9]
48                       crc                             :  8, //[17:10]
49                       tail                            :  6, //[23:18]
50                       reserved_1                      :  8; //[31:24]
51 };
52 
53 /*
54 
55 bandwidth
56 
57 			Packet bandwidth
58 
59 
60 
61 			<enum 0    20_MHZ_11AC>
62 
63 			<enum 1    40_MHZ_11AC>
64 
65 			<enum 2    80_MHZ_11AC>
66 
67 			<enum 3    160_MHZ_11AC>
68 
69 
70 
71 			<legal 0-3>
72 
73 vhta_reserved_0
74 
75 			Reserved.  Set to 1 by MAC, PHY should ignore
76 
77 			<legal 1>
78 
79 stbc
80 
81 			Space time block coding:
82 
83 			<enum 0     stbc_disabled>  Indicates STBC is disabled
84 
85 			<enum 1     stbc_enabled>  Indicates STBC is enabled on
86 			all streams
87 
88 			<legal 0-1>
89 
90 group_id
91 
92 			In a SU VHT PPDU, if the PPDU carries MPDU(s) addressed
93 			to an AP or to a mesh STA, the Group ID field is set to 0,
94 			otherwise it is set to 63.  In an NDP PPDU the Group ID is
95 			set according to IEEE 802.11ac_D1.0 Section 9.30.6
96 			(Transmission of a VHT NDP). For a MU-MIMO PPDU the Group ID
97 			is set as in 802.11ac_D1.0 Section 22.3.11.3 (Group ID).
98 			<legal all>
99 
100 n_sts
101 
102 			For MU:
103 
104 			3 bits/user with maximum of 4 users (user u uses
105 
106 			vht_sig_a[0][10+3u] - vht_sig_a[0][12+3u]), u = 0, 1, 2,
107 			3)
108 
109 			Set to 0 for 0 space time streams
110 
111 			Set to 1 for 1 space time stream
112 
113 			Set to 2 for 2 space time streams
114 
115 			Set to 3 for 3 space time streams
116 
117 			Set to 4 for 4 space time streams (not supported in Wifi
118 			3.0)
119 
120 			Values 5-7 are reserved
121 
122 			In this field, references to user u should be
123 			interpreted as MU user u. As described in the previous
124 			chapter in this document (see chapter on User number), the
125 			MU user value for a given client is defined for each MU
126 			group that the client participates in. The MU user number is
127 			not related to the internal user number that is used within
128 			the BFer.
129 
130 
131 
132 
133 
134 			For SU:
135 
136 			vht_sig_a[0][12:10]
137 
138 			Set to 0 for 1 space time stream
139 
140 			Set to 1 for 2 space time streams
141 
142 			Set to 2 for 3 space time streams
143 
144 			Set to 3 for 4 space time streams
145 
146 			Set to 4 for 5 space time streams
147 
148 			Set to 5 for 6 space time streams
149 
150 			Set to 6 for 7 space time streams
151 
152 			Set to 7 for 8 space time streams
153 
154 
155 
156 			vht_sig_a[0][21:13]
157 
158 			Partial AID:
159 
160 			Set to the value of the TXVECTOR parameter PARTIAL_AID.
161 			Partial AID provides an abbreviated indication of the
162 			intended recipient(s) of the frame (see IEEE802.11ac_D1.0
163 			Section 9.17a (Partial AID in VHT PPDUs)).
164 
165 			<legal all>
166 
167 txop_ps_not_allowed
168 
169 			E_num 0     txop_ps_allowed  Not supported: If set to by
170 			VHT AP if it allows non-AP VHT STAs in TXOP power save mode
171 			to enter Doze state during a TXOP
172 
173 			<enum 1     no_txop_ps_allowed> Otherwise
174 
175 			<legal 1>
176 
177 vhta_reserved_0b
178 
179 			Reserved: Should be set to 1 by the MAC and ignored by
180 			the PHY  <legal 1>
181 
182 reserved_0
183 
184 			This field is not part of HT-SIG:
185 
186 			Reserved: Should be set to 0 by the MAC and ignored by
187 			the PHY <legal 0>
188 
189 gi_setting
190 
191 			<enum 0     normal_gi>  Indicates short guard interval
192 			is not used in the data field
193 
194 			<enum 1     short_gi>  Indicates short guard interval is
195 			used in the data field
196 
197 			<enum 3     short_gi_ambiguity>  Indicates short guard
198 			interval is used in the data field and NSYM mod 10 = 9
199 
200 			NSYM is defined in IEEE802.11ac_D1.0 Section 22.4.3
201 			(TXTIME and PSDU_LENGTH calculation).
202 
203 			<legal 0,1,3>
204 
205 su_mu_coding
206 
207 			For an SU PPDU, B2 is set to 0 for BCC, 1 for LDPC For
208 			an MU PPDU, if the MU[0] NSTS field is nonzero(#6773), then
209 			B2 indicates the coding used for user 0; set to 0 for BCC
210 			and 1 for LDPC. If the MU[0] NSTS field is 0, then this
211 			field is reserved and set to 1
212 
213 ldpc_extra_symbol
214 
215 			Set to 1 if the LDPC PPDU encoding process (if an SU
216 			PPDU), or at least one LDPC user's PPDU encoding process (if
217 			an MU PPDU), results in an extra OFDM symbol (or symbols) as
218 			described in 22.3.10.5.4 (LDPC coding) and 22.3.10.5.5
219 			(Encoding process for MU PPDUs). Set to 0 otherwise.
220 
221 mcs
222 
223 			For SU:
224 
225 			Set to 0 for BPSK 1/2
226 
227 			Set to 1 for QPSK 1/2
228 
229 			Set to 2 for QPSK 3/4
230 
231 			Set to 3 for 16-QAM 1/2
232 
233 			Set to 4 for 16-QAM 3/4
234 
235 			Set to 5 for 64-QAM 2/3
236 
237 			Set to 6 for 64-QAM 3/4
238 
239 			Set to 7 for 64-QAM 5/6
240 
241 			Set to 8 for 256-QAM 3/4
242 
243 			Set to 9 for 256-QAM 5/6
244 
245 			For MU:
246 
247 			If NSTS for user 1 is non-zero, then vht_sig_a[1][4]
248 			indicates coding for user 1: set to 0 for BCC, 1 for LDPC.
249 
250 			If NSTS for user 1 is set to 0, then vht_sig_a[1][4] is
251 			reserved and set to 1.
252 
253 			If NSTS for user 2 is non-zero, then vht_sig_a[1][5]
254 			indicates coding for user 2: set to 0 for BCC, 1 for LDPC.
255 
256 			If NSTS for user 2 is set to 0, then vht_sig_a[1][5] is
257 			reserved and set to 1.
258 
259 			If NSTS for user 3 is non-zero, then vht_sig_a[1][6]
260 			indicates coding for user 3: set to 0 for BCC, 1 for LDPC.
261 
262 			If NSTS for user 3 is set to 0, then vht_sig_a[1][6] is
263 			reserved and set to 1.
264 
265 			vht_sig_a[1][7] is reserved and set to 1
266 
267 			<legal 0-15>
268 
269 beamformed
270 
271 			For SU:
272 
273 			Set to 1 if a Beamforming steering matrix is applied to
274 			the waveform in an SU transmission as described in
275 			IEEE802.11ac_D1.0 Section 19.3.11.11.2 (Spatial mapping),
276 			set to 0 otherwise.
277 
278 			For MU:
279 
280 			Reserved and set to 1
281 
282 			<legal 0-1>
283 
284 vhta_reserved_1
285 
286 			Reserved and set to 1.  <legal 1>
287 
288 crc
289 
290 			CRC calculated as in IEEE802.11ac_D1.0 Section
291 			19.3.9.4.4 (CRC calculation for HTSIG) with C7 in
292 			vht_sig_a[1][10], etc.  <legal all>
293 
294 tail
295 
296 			Used to terminate the trellis of the convolutional
297 			decoder.  Set to 0.  <legal 0>
298 
299 reserved_1
300 
301 			This field is not part of HT-SIG:
302 
303 			Reserved: Should be set to 0 by the MAC and ignored by
304 			the PHY <legal 0>
305 */
306 
307 
308 /* Description		VHT_SIG_A_INFO_0_BANDWIDTH
309 
310 			Packet bandwidth
311 
312 
313 
314 			<enum 0    20_MHZ_11AC>
315 
316 			<enum 1    40_MHZ_11AC>
317 
318 			<enum 2    80_MHZ_11AC>
319 
320 			<enum 3    160_MHZ_11AC>
321 
322 
323 
324 			<legal 0-3>
325 */
326 #define VHT_SIG_A_INFO_0_BANDWIDTH_OFFSET                            0x00000000
327 #define VHT_SIG_A_INFO_0_BANDWIDTH_LSB                               0
328 #define VHT_SIG_A_INFO_0_BANDWIDTH_MASK                              0x00000003
329 
330 /* Description		VHT_SIG_A_INFO_0_VHTA_RESERVED_0
331 
332 			Reserved.  Set to 1 by MAC, PHY should ignore
333 
334 			<legal 1>
335 */
336 #define VHT_SIG_A_INFO_0_VHTA_RESERVED_0_OFFSET                      0x00000000
337 #define VHT_SIG_A_INFO_0_VHTA_RESERVED_0_LSB                         2
338 #define VHT_SIG_A_INFO_0_VHTA_RESERVED_0_MASK                        0x00000004
339 
340 /* Description		VHT_SIG_A_INFO_0_STBC
341 
342 			Space time block coding:
343 
344 			<enum 0     stbc_disabled>  Indicates STBC is disabled
345 
346 			<enum 1     stbc_enabled>  Indicates STBC is enabled on
347 			all streams
348 
349 			<legal 0-1>
350 */
351 #define VHT_SIG_A_INFO_0_STBC_OFFSET                                 0x00000000
352 #define VHT_SIG_A_INFO_0_STBC_LSB                                    3
353 #define VHT_SIG_A_INFO_0_STBC_MASK                                   0x00000008
354 
355 /* Description		VHT_SIG_A_INFO_0_GROUP_ID
356 
357 			In a SU VHT PPDU, if the PPDU carries MPDU(s) addressed
358 			to an AP or to a mesh STA, the Group ID field is set to 0,
359 			otherwise it is set to 63.  In an NDP PPDU the Group ID is
360 			set according to IEEE 802.11ac_D1.0 Section 9.30.6
361 			(Transmission of a VHT NDP). For a MU-MIMO PPDU the Group ID
362 			is set as in 802.11ac_D1.0 Section 22.3.11.3 (Group ID).
363 			<legal all>
364 */
365 #define VHT_SIG_A_INFO_0_GROUP_ID_OFFSET                             0x00000000
366 #define VHT_SIG_A_INFO_0_GROUP_ID_LSB                                4
367 #define VHT_SIG_A_INFO_0_GROUP_ID_MASK                               0x000003f0
368 
369 /* Description		VHT_SIG_A_INFO_0_N_STS
370 
371 			For MU:
372 
373 			3 bits/user with maximum of 4 users (user u uses
374 
375 			vht_sig_a[0][10+3u] - vht_sig_a[0][12+3u]), u = 0, 1, 2,
376 			3)
377 
378 			Set to 0 for 0 space time streams
379 
380 			Set to 1 for 1 space time stream
381 
382 			Set to 2 for 2 space time streams
383 
384 			Set to 3 for 3 space time streams
385 
386 			Set to 4 for 4 space time streams (not supported in Wifi
387 			3.0)
388 
389 			Values 5-7 are reserved
390 
391 			In this field, references to user u should be
392 			interpreted as MU user u. As described in the previous
393 			chapter in this document (see chapter on User number), the
394 			MU user value for a given client is defined for each MU
395 			group that the client participates in. The MU user number is
396 			not related to the internal user number that is used within
397 			the BFer.
398 
399 
400 
401 
402 
403 			For SU:
404 
405 			vht_sig_a[0][12:10]
406 
407 			Set to 0 for 1 space time stream
408 
409 			Set to 1 for 2 space time streams
410 
411 			Set to 2 for 3 space time streams
412 
413 			Set to 3 for 4 space time streams
414 
415 			Set to 4 for 5 space time streams
416 
417 			Set to 5 for 6 space time streams
418 
419 			Set to 6 for 7 space time streams
420 
421 			Set to 7 for 8 space time streams
422 
423 
424 
425 			vht_sig_a[0][21:13]
426 
427 			Partial AID:
428 
429 			Set to the value of the TXVECTOR parameter PARTIAL_AID.
430 			Partial AID provides an abbreviated indication of the
431 			intended recipient(s) of the frame (see IEEE802.11ac_D1.0
432 			Section 9.17a (Partial AID in VHT PPDUs)).
433 
434 			<legal all>
435 */
436 #define VHT_SIG_A_INFO_0_N_STS_OFFSET                                0x00000000
437 #define VHT_SIG_A_INFO_0_N_STS_LSB                                   10
438 #define VHT_SIG_A_INFO_0_N_STS_MASK                                  0x003ffc00
439 
440 /* Description		VHT_SIG_A_INFO_0_TXOP_PS_NOT_ALLOWED
441 
442 			E_num 0     txop_ps_allowed  Not supported: If set to by
443 			VHT AP if it allows non-AP VHT STAs in TXOP power save mode
444 			to enter Doze state during a TXOP
445 
446 			<enum 1     no_txop_ps_allowed> Otherwise
447 
448 			<legal 1>
449 */
450 #define VHT_SIG_A_INFO_0_TXOP_PS_NOT_ALLOWED_OFFSET                  0x00000000
451 #define VHT_SIG_A_INFO_0_TXOP_PS_NOT_ALLOWED_LSB                     22
452 #define VHT_SIG_A_INFO_0_TXOP_PS_NOT_ALLOWED_MASK                    0x00400000
453 
454 /* Description		VHT_SIG_A_INFO_0_VHTA_RESERVED_0B
455 
456 			Reserved: Should be set to 1 by the MAC and ignored by
457 			the PHY  <legal 1>
458 */
459 #define VHT_SIG_A_INFO_0_VHTA_RESERVED_0B_OFFSET                     0x00000000
460 #define VHT_SIG_A_INFO_0_VHTA_RESERVED_0B_LSB                        23
461 #define VHT_SIG_A_INFO_0_VHTA_RESERVED_0B_MASK                       0x00800000
462 
463 /* Description		VHT_SIG_A_INFO_0_RESERVED_0
464 
465 			This field is not part of HT-SIG:
466 
467 			Reserved: Should be set to 0 by the MAC and ignored by
468 			the PHY <legal 0>
469 */
470 #define VHT_SIG_A_INFO_0_RESERVED_0_OFFSET                           0x00000000
471 #define VHT_SIG_A_INFO_0_RESERVED_0_LSB                              24
472 #define VHT_SIG_A_INFO_0_RESERVED_0_MASK                             0xff000000
473 
474 /* Description		VHT_SIG_A_INFO_1_GI_SETTING
475 
476 			<enum 0     normal_gi>  Indicates short guard interval
477 			is not used in the data field
478 
479 			<enum 1     short_gi>  Indicates short guard interval is
480 			used in the data field
481 
482 			<enum 3     short_gi_ambiguity>  Indicates short guard
483 			interval is used in the data field and NSYM mod 10 = 9
484 
485 			NSYM is defined in IEEE802.11ac_D1.0 Section 22.4.3
486 			(TXTIME and PSDU_LENGTH calculation).
487 
488 			<legal 0,1,3>
489 */
490 #define VHT_SIG_A_INFO_1_GI_SETTING_OFFSET                           0x00000004
491 #define VHT_SIG_A_INFO_1_GI_SETTING_LSB                              0
492 #define VHT_SIG_A_INFO_1_GI_SETTING_MASK                             0x00000003
493 
494 /* Description		VHT_SIG_A_INFO_1_SU_MU_CODING
495 
496 			For an SU PPDU, B2 is set to 0 for BCC, 1 for LDPC For
497 			an MU PPDU, if the MU[0] NSTS field is nonzero(#6773), then
498 			B2 indicates the coding used for user 0; set to 0 for BCC
499 			and 1 for LDPC. If the MU[0] NSTS field is 0, then this
500 			field is reserved and set to 1
501 */
502 #define VHT_SIG_A_INFO_1_SU_MU_CODING_OFFSET                         0x00000004
503 #define VHT_SIG_A_INFO_1_SU_MU_CODING_LSB                            2
504 #define VHT_SIG_A_INFO_1_SU_MU_CODING_MASK                           0x00000004
505 
506 /* Description		VHT_SIG_A_INFO_1_LDPC_EXTRA_SYMBOL
507 
508 			Set to 1 if the LDPC PPDU encoding process (if an SU
509 			PPDU), or at least one LDPC user's PPDU encoding process (if
510 			an MU PPDU), results in an extra OFDM symbol (or symbols) as
511 			described in 22.3.10.5.4 (LDPC coding) and 22.3.10.5.5
512 			(Encoding process for MU PPDUs). Set to 0 otherwise.
513 */
514 #define VHT_SIG_A_INFO_1_LDPC_EXTRA_SYMBOL_OFFSET                    0x00000004
515 #define VHT_SIG_A_INFO_1_LDPC_EXTRA_SYMBOL_LSB                       3
516 #define VHT_SIG_A_INFO_1_LDPC_EXTRA_SYMBOL_MASK                      0x00000008
517 
518 /* Description		VHT_SIG_A_INFO_1_MCS
519 
520 			For SU:
521 
522 			Set to 0 for BPSK 1/2
523 
524 			Set to 1 for QPSK 1/2
525 
526 			Set to 2 for QPSK 3/4
527 
528 			Set to 3 for 16-QAM 1/2
529 
530 			Set to 4 for 16-QAM 3/4
531 
532 			Set to 5 for 64-QAM 2/3
533 
534 			Set to 6 for 64-QAM 3/4
535 
536 			Set to 7 for 64-QAM 5/6
537 
538 			Set to 8 for 256-QAM 3/4
539 
540 			Set to 9 for 256-QAM 5/6
541 
542 			For MU:
543 
544 			If NSTS for user 1 is non-zero, then vht_sig_a[1][4]
545 			indicates coding for user 1: set to 0 for BCC, 1 for LDPC.
546 
547 			If NSTS for user 1 is set to 0, then vht_sig_a[1][4] is
548 			reserved and set to 1.
549 
550 			If NSTS for user 2 is non-zero, then vht_sig_a[1][5]
551 			indicates coding for user 2: set to 0 for BCC, 1 for LDPC.
552 
553 			If NSTS for user 2 is set to 0, then vht_sig_a[1][5] is
554 			reserved and set to 1.
555 
556 			If NSTS for user 3 is non-zero, then vht_sig_a[1][6]
557 			indicates coding for user 3: set to 0 for BCC, 1 for LDPC.
558 
559 			If NSTS for user 3 is set to 0, then vht_sig_a[1][6] is
560 			reserved and set to 1.
561 
562 			vht_sig_a[1][7] is reserved and set to 1
563 
564 			<legal 0-15>
565 */
566 #define VHT_SIG_A_INFO_1_MCS_OFFSET                                  0x00000004
567 #define VHT_SIG_A_INFO_1_MCS_LSB                                     4
568 #define VHT_SIG_A_INFO_1_MCS_MASK                                    0x000000f0
569 
570 /* Description		VHT_SIG_A_INFO_1_BEAMFORMED
571 
572 			For SU:
573 
574 			Set to 1 if a Beamforming steering matrix is applied to
575 			the waveform in an SU transmission as described in
576 			IEEE802.11ac_D1.0 Section 19.3.11.11.2 (Spatial mapping),
577 			set to 0 otherwise.
578 
579 			For MU:
580 
581 			Reserved and set to 1
582 
583 			<legal 0-1>
584 */
585 #define VHT_SIG_A_INFO_1_BEAMFORMED_OFFSET                           0x00000004
586 #define VHT_SIG_A_INFO_1_BEAMFORMED_LSB                              8
587 #define VHT_SIG_A_INFO_1_BEAMFORMED_MASK                             0x00000100
588 
589 /* Description		VHT_SIG_A_INFO_1_VHTA_RESERVED_1
590 
591 			Reserved and set to 1.  <legal 1>
592 */
593 #define VHT_SIG_A_INFO_1_VHTA_RESERVED_1_OFFSET                      0x00000004
594 #define VHT_SIG_A_INFO_1_VHTA_RESERVED_1_LSB                         9
595 #define VHT_SIG_A_INFO_1_VHTA_RESERVED_1_MASK                        0x00000200
596 
597 /* Description		VHT_SIG_A_INFO_1_CRC
598 
599 			CRC calculated as in IEEE802.11ac_D1.0 Section
600 			19.3.9.4.4 (CRC calculation for HTSIG) with C7 in
601 			vht_sig_a[1][10], etc.  <legal all>
602 */
603 #define VHT_SIG_A_INFO_1_CRC_OFFSET                                  0x00000004
604 #define VHT_SIG_A_INFO_1_CRC_LSB                                     10
605 #define VHT_SIG_A_INFO_1_CRC_MASK                                    0x0003fc00
606 
607 /* Description		VHT_SIG_A_INFO_1_TAIL
608 
609 			Used to terminate the trellis of the convolutional
610 			decoder.  Set to 0.  <legal 0>
611 */
612 #define VHT_SIG_A_INFO_1_TAIL_OFFSET                                 0x00000004
613 #define VHT_SIG_A_INFO_1_TAIL_LSB                                    18
614 #define VHT_SIG_A_INFO_1_TAIL_MASK                                   0x00fc0000
615 
616 /* Description		VHT_SIG_A_INFO_1_RESERVED_1
617 
618 			This field is not part of HT-SIG:
619 
620 			Reserved: Should be set to 0 by the MAC and ignored by
621 			the PHY <legal 0>
622 */
623 #define VHT_SIG_A_INFO_1_RESERVED_1_OFFSET                           0x00000004
624 #define VHT_SIG_A_INFO_1_RESERVED_1_LSB                              24
625 #define VHT_SIG_A_INFO_1_RESERVED_1_MASK                             0xff000000
626 
627 
628 #endif // _VHT_SIG_A_INFO_H_
629