1 
2 /* Copyright (c) 2022, 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 
19 
20 
21 
22 
23 
24 
25 
26 #ifndef _PHYRX_COMMON_USER_INFO_H_
27 #define _PHYRX_COMMON_USER_INFO_H_
28 #if !defined(__ASSEMBLER__)
29 #endif
30 
31 #define NUM_OF_DWORDS_PHYRX_COMMON_USER_INFO 4
32 
33 #define NUM_OF_QWORDS_PHYRX_COMMON_USER_INFO 2
34 
35 
36 struct phyrx_common_user_info {
37 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
38              uint32_t receive_duration                                        : 16, // [15:0]
39                       reserved_0a                                             : 16; // [31:16]
40              uint32_t u_sig_puncture_pattern_encoding                         :  6, // [5:0]
41                       reserved_1a                                             : 26; // [31:6]
42              uint32_t eht_ppdu_type                                           :  2, // [1:0]
43                       bss_color_id                                            :  6, // [7:2]
44                       dl_ul_flag                                              :  1, // [8:8]
45                       txop_duration                                           :  7, // [15:9]
46                       cp_setting                                              :  2, // [17:16]
47                       ltf_size                                                :  2, // [19:18]
48                       spatial_reuse                                           :  4, // [23:20]
49                       rx_ndp                                                  :  1, // [24:24]
50                       dot11be_su_extended                                     :  1, // [25:25]
51                       reserved_2a                                             :  6; // [31:26]
52              uint32_t eht_duplicate                                           :  2, // [1:0]
53                       eht_sig_cmn_field_type                                  :  2, // [3:2]
54                       doppler_indication                                      :  1, // [4:4]
55                       sta_id                                                  : 11, // [15:5]
56                       puncture_bitmap                                         : 16; // [31:16]
57 #else
58              uint32_t reserved_0a                                             : 16, // [31:16]
59                       receive_duration                                        : 16; // [15:0]
60              uint32_t reserved_1a                                             : 26, // [31:6]
61                       u_sig_puncture_pattern_encoding                         :  6; // [5:0]
62              uint32_t reserved_2a                                             :  6, // [31:26]
63                       dot11be_su_extended                                     :  1, // [25:25]
64                       rx_ndp                                                  :  1, // [24:24]
65                       spatial_reuse                                           :  4, // [23:20]
66                       ltf_size                                                :  2, // [19:18]
67                       cp_setting                                              :  2, // [17:16]
68                       txop_duration                                           :  7, // [15:9]
69                       dl_ul_flag                                              :  1, // [8:8]
70                       bss_color_id                                            :  6, // [7:2]
71                       eht_ppdu_type                                           :  2; // [1:0]
72              uint32_t puncture_bitmap                                         : 16, // [31:16]
73                       sta_id                                                  : 11, // [15:5]
74                       doppler_indication                                      :  1, // [4:4]
75                       eht_sig_cmn_field_type                                  :  2, // [3:2]
76                       eht_duplicate                                           :  2; // [1:0]
77 #endif
78 };
79 
80 
81 /* Description		RECEIVE_DURATION
82 
83 			The remaining receive duration of this PPDU in the medium
84 			 (in us).
85 			The timing reference point is the assertion of 'rx_frame'
86 			by PHY for the PPDU reception. The value shall be accurate
87 			 to within 2us.
88 			RXPCU shall subtract the time elapsed between 'rx_frame'
89 			assertion and reception of this TLV to find the actual remaining
90 			 receive duration.
91 			<legal all>
92 */
93 
94 #define PHYRX_COMMON_USER_INFO_RECEIVE_DURATION_OFFSET                              0x0000000000000000
95 #define PHYRX_COMMON_USER_INFO_RECEIVE_DURATION_LSB                                 0
96 #define PHYRX_COMMON_USER_INFO_RECEIVE_DURATION_MSB                                 15
97 #define PHYRX_COMMON_USER_INFO_RECEIVE_DURATION_MASK                                0x000000000000ffff
98 
99 
100 /* Description		RESERVED_0A
101 
102 			<legal 0>
103 */
104 
105 #define PHYRX_COMMON_USER_INFO_RESERVED_0A_OFFSET                                   0x0000000000000000
106 #define PHYRX_COMMON_USER_INFO_RESERVED_0A_LSB                                      16
107 #define PHYRX_COMMON_USER_INFO_RESERVED_0A_MSB                                      31
108 #define PHYRX_COMMON_USER_INFO_RESERVED_0A_MASK                                     0x00000000ffff0000
109 
110 
111 /* Description		U_SIG_PUNCTURE_PATTERN_ENCODING
112 
113 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
114 
115 
116 			The 6-bit value used in U-SIG and/or EHT-SIG Common field
117 			 for the puncture pattern
118 			<legal 0-29>
119 */
120 
121 #define PHYRX_COMMON_USER_INFO_U_SIG_PUNCTURE_PATTERN_ENCODING_OFFSET               0x0000000000000000
122 #define PHYRX_COMMON_USER_INFO_U_SIG_PUNCTURE_PATTERN_ENCODING_LSB                  32
123 #define PHYRX_COMMON_USER_INFO_U_SIG_PUNCTURE_PATTERN_ENCODING_MSB                  37
124 #define PHYRX_COMMON_USER_INFO_U_SIG_PUNCTURE_PATTERN_ENCODING_MASK                 0x0000003f00000000
125 
126 
127 /* Description		RESERVED_1A
128 
129 			<legal 0>
130 */
131 
132 #define PHYRX_COMMON_USER_INFO_RESERVED_1A_OFFSET                                   0x0000000000000000
133 #define PHYRX_COMMON_USER_INFO_RESERVED_1A_LSB                                      38
134 #define PHYRX_COMMON_USER_INFO_RESERVED_1A_MSB                                      63
135 #define PHYRX_COMMON_USER_INFO_RESERVED_1A_MASK                                     0xffffffc000000000
136 
137 
138 /* Description		EHT_PPDU_TYPE
139 
140 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
141 
142 
143 			<enum 0 EHT_PPDU_rsvd> DO NOT USE
144 			<enum 1 EHT_PPDU_TB>
145 			<enum 2 EHT_PPDU_MU> Need to look at both EHT-SIG content
146 			 channels
147 			<enum 3 EHT_PPDU_SU> Need to look at only one EHT-SIG content
148 			 channel
149 			<legal all>
150 */
151 
152 #define PHYRX_COMMON_USER_INFO_EHT_PPDU_TYPE_OFFSET                                 0x0000000000000008
153 #define PHYRX_COMMON_USER_INFO_EHT_PPDU_TYPE_LSB                                    0
154 #define PHYRX_COMMON_USER_INFO_EHT_PPDU_TYPE_MSB                                    1
155 #define PHYRX_COMMON_USER_INFO_EHT_PPDU_TYPE_MASK                                   0x0000000000000003
156 
157 
158 /* Description		BSS_COLOR_ID
159 
160 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
161 
162 
163 			BSS color ID
164 
165 			Field used by MAC HW
166 			<legal all>
167 */
168 
169 #define PHYRX_COMMON_USER_INFO_BSS_COLOR_ID_OFFSET                                  0x0000000000000008
170 #define PHYRX_COMMON_USER_INFO_BSS_COLOR_ID_LSB                                     2
171 #define PHYRX_COMMON_USER_INFO_BSS_COLOR_ID_MSB                                     7
172 #define PHYRX_COMMON_USER_INFO_BSS_COLOR_ID_MASK                                    0x00000000000000fc
173 
174 
175 /* Description		DL_UL_FLAG
176 
177 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
178 
179 
180 			Differentiates between DL and UL transmission
181 
182 			<enum 0 DL_UL_FLAG_IS_DL_OR_TDLS>
183 			<enum 1 DL_UL_FLAG_IS_UL>
184 			<legal all>
185 */
186 
187 #define PHYRX_COMMON_USER_INFO_DL_UL_FLAG_OFFSET                                    0x0000000000000008
188 #define PHYRX_COMMON_USER_INFO_DL_UL_FLAG_LSB                                       8
189 #define PHYRX_COMMON_USER_INFO_DL_UL_FLAG_MSB                                       8
190 #define PHYRX_COMMON_USER_INFO_DL_UL_FLAG_MASK                                      0x0000000000000100
191 
192 
193 /* Description		TXOP_DURATION
194 
195 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
196 
197 
198 			Indicates the remaining time in the current TXOP
199 
200 			Field used by MAC HW
201 			 <legal all>
202 */
203 
204 #define PHYRX_COMMON_USER_INFO_TXOP_DURATION_OFFSET                                 0x0000000000000008
205 #define PHYRX_COMMON_USER_INFO_TXOP_DURATION_LSB                                    9
206 #define PHYRX_COMMON_USER_INFO_TXOP_DURATION_MSB                                    15
207 #define PHYRX_COMMON_USER_INFO_TXOP_DURATION_MASK                                   0x000000000000fe00
208 
209 
210 /* Description		CP_SETTING
211 
212 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
213 
214 
215 			<enum 0     gi_0_8_us > Legacy normal GI
216 			<enum 1     gi_0_4_us > Legacy short GI
217 			<enum 2     gi_1_6_us > HE related GI
218 			<enum 3     gi_3_2_us > HE related GI
219 			<legal 0 - 3>
220 */
221 
222 #define PHYRX_COMMON_USER_INFO_CP_SETTING_OFFSET                                    0x0000000000000008
223 #define PHYRX_COMMON_USER_INFO_CP_SETTING_LSB                                       16
224 #define PHYRX_COMMON_USER_INFO_CP_SETTING_MSB                                       17
225 #define PHYRX_COMMON_USER_INFO_CP_SETTING_MASK                                      0x0000000000030000
226 
227 
228 /* Description		LTF_SIZE
229 
230 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
231 
232 
233 			Ltf size
234 
235 			<enum 0     ltf_1x >
236 			<enum 1     ltf_2x >
237 			<enum 2     ltf_4x >
238 			<legal 0 - 2>
239 */
240 
241 #define PHYRX_COMMON_USER_INFO_LTF_SIZE_OFFSET                                      0x0000000000000008
242 #define PHYRX_COMMON_USER_INFO_LTF_SIZE_LSB                                         18
243 #define PHYRX_COMMON_USER_INFO_LTF_SIZE_MSB                                         19
244 #define PHYRX_COMMON_USER_INFO_LTF_SIZE_MASK                                        0x00000000000c0000
245 
246 
247 /* Description		SPATIAL_REUSE
248 
249 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
250 
251 
252 			TODO: Placeholder
253 			<legal all>
254 */
255 
256 #define PHYRX_COMMON_USER_INFO_SPATIAL_REUSE_OFFSET                                 0x0000000000000008
257 #define PHYRX_COMMON_USER_INFO_SPATIAL_REUSE_LSB                                    20
258 #define PHYRX_COMMON_USER_INFO_SPATIAL_REUSE_MSB                                    23
259 #define PHYRX_COMMON_USER_INFO_SPATIAL_REUSE_MASK                                   0x0000000000f00000
260 
261 
262 /* Description		RX_NDP
263 
264 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
265 
266 
267 			On RX side, looked at by MAC HW
268 
269 			When set, PHY has received an (expected) NDP frame
270 			<legal all>
271 */
272 
273 #define PHYRX_COMMON_USER_INFO_RX_NDP_OFFSET                                        0x0000000000000008
274 #define PHYRX_COMMON_USER_INFO_RX_NDP_LSB                                           24
275 #define PHYRX_COMMON_USER_INFO_RX_NDP_MSB                                           24
276 #define PHYRX_COMMON_USER_INFO_RX_NDP_MASK                                          0x0000000001000000
277 
278 
279 /* Description		DOT11BE_SU_EXTENDED
280 
281 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
282 
283 
284 			On RX side, evaluated by MAC HW
285 
286 			This is the only way for MAC RX to know that this was a
287 			U_SIG_EHT_SU received in extended range format.
288 
289 			When set, the 11be frame is of the extended range format.
290 
291 			<legal all>
292 */
293 
294 #define PHYRX_COMMON_USER_INFO_DOT11BE_SU_EXTENDED_OFFSET                           0x0000000000000008
295 #define PHYRX_COMMON_USER_INFO_DOT11BE_SU_EXTENDED_LSB                              25
296 #define PHYRX_COMMON_USER_INFO_DOT11BE_SU_EXTENDED_MSB                              25
297 #define PHYRX_COMMON_USER_INFO_DOT11BE_SU_EXTENDED_MASK                             0x0000000002000000
298 
299 
300 /* Description		RESERVED_2A
301 
302 			<legal 0>
303 */
304 
305 #define PHYRX_COMMON_USER_INFO_RESERVED_2A_OFFSET                                   0x0000000000000008
306 #define PHYRX_COMMON_USER_INFO_RESERVED_2A_LSB                                      26
307 #define PHYRX_COMMON_USER_INFO_RESERVED_2A_MSB                                      31
308 #define PHYRX_COMMON_USER_INFO_RESERVED_2A_MASK                                     0x00000000fc000000
309 
310 
311 /* Description		EHT_DUPLICATE
312 
313 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
314 
315 
316 			Indicates EHT duplicate modulation
317 
318 			<enum 0 eht_no_duplicate>
319 			<enum 1 eht_2x_duplicate>
320 			<enum 2 eht_4x_duplicate>
321 
322 			<legal 0-2>
323 */
324 
325 #define PHYRX_COMMON_USER_INFO_EHT_DUPLICATE_OFFSET                                 0x0000000000000008
326 #define PHYRX_COMMON_USER_INFO_EHT_DUPLICATE_LSB                                    32
327 #define PHYRX_COMMON_USER_INFO_EHT_DUPLICATE_MSB                                    33
328 #define PHYRX_COMMON_USER_INFO_EHT_DUPLICATE_MASK                                   0x0000000300000000
329 
330 
331 /* Description		EHT_SIG_CMN_FIELD_TYPE
332 
333 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
334 
335 
336 			Indicates the type of EHT-SIG Common field
337 
338 			<enum 0 EHT_SIG_CMN_NO_PUNC> Non-OFDMA, EHT-SIG Common field
339 			 does not contain puncturing information
340 			<enum 1 EHT_SIG_CMN_PUNC> Non-OFDMA, EHT-SIG Common field
341 			 contains puncturing information
342 			<enum 2 EHT_SIG_OFDMA>
343 			OFDMA, EHT-SIG Common field contains RU structure
344 			<legal 0-2>
345 */
346 
347 #define PHYRX_COMMON_USER_INFO_EHT_SIG_CMN_FIELD_TYPE_OFFSET                        0x0000000000000008
348 #define PHYRX_COMMON_USER_INFO_EHT_SIG_CMN_FIELD_TYPE_LSB                           34
349 #define PHYRX_COMMON_USER_INFO_EHT_SIG_CMN_FIELD_TYPE_MSB                           35
350 #define PHYRX_COMMON_USER_INFO_EHT_SIG_CMN_FIELD_TYPE_MASK                          0x0000000c00000000
351 
352 
353 /* Description		DOPPLER_INDICATION
354 
355 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV.
356 
357 
358 			0: No Doppler support
359 			1: Doppler support
360 			<legal all>
361 */
362 
363 #define PHYRX_COMMON_USER_INFO_DOPPLER_INDICATION_OFFSET                            0x0000000000000008
364 #define PHYRX_COMMON_USER_INFO_DOPPLER_INDICATION_LSB                               36
365 #define PHYRX_COMMON_USER_INFO_DOPPLER_INDICATION_MSB                               36
366 #define PHYRX_COMMON_USER_INFO_DOPPLER_INDICATION_MASK                              0x0000001000000000
367 
368 
369 /* Description		STA_ID
370 
371 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV
372 			 and EHT_PPDU_type is EHT_PPDU_MU (MU-MIMO or OFDMA).
373 
374 			Identifies the STA that is addressed. Details of STA ID
375 			are TBD
376 */
377 
378 #define PHYRX_COMMON_USER_INFO_STA_ID_OFFSET                                        0x0000000000000008
379 #define PHYRX_COMMON_USER_INFO_STA_ID_LSB                                           37
380 #define PHYRX_COMMON_USER_INFO_STA_ID_MSB                                           47
381 #define PHYRX_COMMON_USER_INFO_STA_ID_MASK                                          0x0000ffe000000000
382 
383 
384 /* Description		PUNCTURE_BITMAP
385 
386 			Field only valid if PHY has sent 'PHYRX_GENERIC_U_SIG' TLV
387 			 and EHT_SIG_CMN_field_type is EHT_SIG_CMN_PUNC.
388 
389 			Indicates which 20 MHz sub-bands will be modulated vs punctured
390 			 (bits [15:0]) in CCA order (primary/secondary)
391 
392 			Bit 0: primary 20MHz sub-band
393 			Bit 1: secondary 20 MHz sub-band
394 			Bit 2: first 20 MHz sub-band in secondary 40 MHz
395 			Bit 3: second 20 MHz sub-band in secondary 40 MHz
396 			...
397 			Bit 15: last 20MHz sub-band in secondary 160 MHz
398 			A value of 0 means the band is punctured
399 			A value of 1 means the band is modulated
400 
401 			If the PPDU BW is less than 320 MHz, the MSB bits are reserved
402 			 and set to 0.
403 */
404 
405 #define PHYRX_COMMON_USER_INFO_PUNCTURE_BITMAP_OFFSET                               0x0000000000000008
406 #define PHYRX_COMMON_USER_INFO_PUNCTURE_BITMAP_LSB                                  48
407 #define PHYRX_COMMON_USER_INFO_PUNCTURE_BITMAP_MSB                                  63
408 #define PHYRX_COMMON_USER_INFO_PUNCTURE_BITMAP_MASK                                 0xffff000000000000
409 
410 
411 
412 #endif   // PHYRX_COMMON_USER_INFO
413