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 _RECEIVE_USER_INFO_H_
18  #define _RECEIVE_USER_INFO_H_
19  #if !defined(__ASSEMBLER__)
20  #endif
21  
22  
23  // ################ START SUMMARY #################
24  //
25  //	Dword	Fields
26  //	0	phy_ppdu_id[15:0], user_rssi[23:16], pkt_type[27:24], stbc[28], reception_type[31:29]
27  //	1	rate_mcs[3:0], sgi[5:4], receive_bandwidth[7:6], mimo_ss_bitmap[15:8], ofdma_ru_allocation[23:16], ofdma_user_index[30:24], ofdma_content_channel[31]
28  //	2	ldpc[0], ru_width[7:1], reserved_2a[31:8]
29  //
30  // ################ END SUMMARY #################
31  
32  #define NUM_OF_DWORDS_RECEIVE_USER_INFO 3
33  
34  struct receive_user_info {
35               uint32_t phy_ppdu_id                     : 16, //[15:0]
36                        user_rssi                       :  8, //[23:16]
37                        pkt_type                        :  4, //[27:24]
38                        stbc                            :  1, //[28]
39                        reception_type                  :  3; //[31:29]
40               uint32_t rate_mcs                        :  4, //[3:0]
41                        sgi                             :  2, //[5:4]
42                        receive_bandwidth               :  2, //[7:6]
43                        mimo_ss_bitmap                  :  8, //[15:8]
44                        ofdma_ru_allocation             :  8, //[23:16]
45                        ofdma_user_index                :  7, //[30:24]
46                        ofdma_content_channel           :  1; //[31]
47               uint32_t ldpc                            :  1, //[0]
48                        ru_width                        :  7, //[7:1]
49                        reserved_2a                     : 24; //[31:8]
50  };
51  
52  /*
53  
54  phy_ppdu_id
55  
56  			A ppdu counter value that PHY increments for every PPDU
57  			received. The counter value wraps around
58  
59  			<legal all>
60  
61  user_rssi
62  
63  			RSSI for this user
64  
65  			Frequency domain RSSI measurement for this user. Based
66  			on the channel estimate.
67  
68  
69  
70  			<legal all>
71  
72  pkt_type
73  
74  			Packet type:
75  
76  
77  
78  			<enum 0 dot11a>802.11a PPDU type
79  
80  			<enum 1 dot11b>802.11b PPDU type
81  
82  			<enum 2 dot11n_mm>802.11n Mixed Mode PPDU type
83  
84  			<enum 3 dot11ac>802.11ac PPDU type
85  
86  			<enum 4 dot11ax>802.11ax PPDU type
87  
88  			<enum 5 dot11ba>802.11ba (WUR) PPDU type
89  
90  stbc
91  
92  			When set, use STBC transmission rates
93  
94  reception_type
95  
96  			Indicates what type of reception this is.
97  
98  			<enum 0     reception_type_SU > Basic SU reception (not
99  			part of OFDMA or MU-MIMO)
100  
101  			<enum 1     reception_type_MU_MIMO > This is related to
102  			DL type of reception
103  
104  			<enum 2     reception_type_MU_OFDMA >  This is related
105  			to DL type of reception
106  
107  			<enum 3     reception_type_MU_OFDMA_MIMO >  This is
108  			related to DL type of reception
109  
110  			<enum 4     reception_type_UL_MU_MIMO > This is related
111  			to UL type of reception
112  
113  			<enum 5     reception_type_UL_MU_OFDMA >  This is
114  			related to UL type of reception
115  
116  			<enum 6     reception_type_UL_MU_OFDMA_MIMO >  This is
117  			related to UL type of reception
118  
119  
120  
121  			<legal 0-6>
122  
123  rate_mcs
124  
125  			For details, refer to  MCS_TYPE description
126  
127  			<legal all>
128  
129  sgi
130  
131  			Field only valid when pkt type is HT, VHT or HE.
132  
133  
134  
135  			<enum 0     gi_0_8_us > Legacy normal GI.  Can also be
136  			used for HE
137  
138  			<enum 1     gi_0_4_us > Legacy short GI.  Can also be
139  			used for HE
140  
141  			<enum 2     gi_1_6_us > HE related GI
142  
143  			<enum 3     gi_3_2_us > HE related GI
144  
145  			<legal 0 - 3>
146  
147  receive_bandwidth
148  
149  			Full receive Bandwidth
150  
151  
152  
153  			<enum 0     full_rx_bw_20_mhz>
154  
155  			<enum 1      full_rx_bw_40_mhz>
156  
157  			<enum 2      full_rx_bw_80_mhz>
158  
159  			<enum 3      full_rx_bw_160_mhz>
160  
161  
162  
163  			<legal 0-3>
164  
165  mimo_ss_bitmap
166  
167  			Bitmap, with each bit indicating if the related spatial
168  			stream is used for this STA
169  
170  			LSB related to SS 0
171  
172  
173  
174  			0: spatial stream not used for this reception
175  
176  			1: spatial stream used for this reception
177  
178  
179  
180  			<legal all>
181  
182  ofdma_ru_allocation
183  
184  			Field only valid in case of OFDMA type receptions (DL
185  			and UL)
186  
187  
188  
189  			Indicates the RU number associated with this user.
190  
191  
192  
193  			In case of reception where the transmission was DL MU
194  			OFDMA, this field provides the RU pattern. Note that fields
195  			ofdma_user_index and ofdma_content_channel are needed to
196  			determine which RU (within a 40 MHz channel) was actually
197  			assigned to this user, but this does not give info on which
198  			40 MHz channel was assigned to this user. Please refer
199  			DL_ofdma_ru_* in PHYRX_PKT_END_INFO for complete RU info for
200  			this user.
201  
202  
203  
204  			In case of reception where the transmission was UL MU
205  			OFDMA, PHY is recommended to insert the RU start index in
206  			this field. Note that PHY may insert the RU width in
207  			Reserved_2a[6:0].
208  
209  			<legal all>
210  
211  ofdma_user_index
212  
213  			Field only valid in the of DL MU OFDMA reception
214  
215  
216  
217  			The user number within the RU_allocation.
218  
219  
220  
221  			This is needed for SW to determine the exact RU position
222  			within the reception.
223  
224  			<legal all>
225  
226  ofdma_content_channel
227  
228  			Field only valid in the of DL MU OFDMA/MIMO reception
229  
230  
231  
232  			In case of DL MU reception, this field indicates the
233  			content channel number where PHY found the RU information
234  			for this user
235  
236  
237  
238  			This is needed for SW to determine the exact RU position
239  			within the reception.
240  
241  
242  
243  			<enum 0      content_channel_1>
244  
245  			<enum 1      content_channel_2>
246  
247  
248  
249  			<legal all>
250  
251  ldpc
252  
253  			When set, use LDPC transmission rates were used.
254  
255  			<legal all>
256  
257  ru_width
258  
259  			In case of UL OFDMA reception, PHY is recommended to
260  			insert the RU width
261  
262  			In Hastings80: was using Reserved_2a[6:0].
263  
264  			<legal 1 - 74>
265  
266  reserved_2a
267  
268  			<legal 0>
269  */
270  
271  
272  /* Description		RECEIVE_USER_INFO_0_PHY_PPDU_ID
273  
274  			A ppdu counter value that PHY increments for every PPDU
275  			received. The counter value wraps around
276  
277  			<legal all>
278  */
279  #define RECEIVE_USER_INFO_0_PHY_PPDU_ID_OFFSET                       0x00000000
280  #define RECEIVE_USER_INFO_0_PHY_PPDU_ID_LSB                          0
281  #define RECEIVE_USER_INFO_0_PHY_PPDU_ID_MASK                         0x0000ffff
282  
283  /* Description		RECEIVE_USER_INFO_0_USER_RSSI
284  
285  			RSSI for this user
286  
287  			Frequency domain RSSI measurement for this user. Based
288  			on the channel estimate.
289  
290  
291  
292  			<legal all>
293  */
294  #define RECEIVE_USER_INFO_0_USER_RSSI_OFFSET                         0x00000000
295  #define RECEIVE_USER_INFO_0_USER_RSSI_LSB                            16
296  #define RECEIVE_USER_INFO_0_USER_RSSI_MASK                           0x00ff0000
297  
298  /* Description		RECEIVE_USER_INFO_0_PKT_TYPE
299  
300  			Packet type:
301  
302  
303  
304  			<enum 0 dot11a>802.11a PPDU type
305  
306  			<enum 1 dot11b>802.11b PPDU type
307  
308  			<enum 2 dot11n_mm>802.11n Mixed Mode PPDU type
309  
310  			<enum 3 dot11ac>802.11ac PPDU type
311  
312  			<enum 4 dot11ax>802.11ax PPDU type
313  
314  			<enum 5 dot11ba>802.11ba (WUR) PPDU type
315  */
316  #define RECEIVE_USER_INFO_0_PKT_TYPE_OFFSET                          0x00000000
317  #define RECEIVE_USER_INFO_0_PKT_TYPE_LSB                             24
318  #define RECEIVE_USER_INFO_0_PKT_TYPE_MASK                            0x0f000000
319  
320  /* Description		RECEIVE_USER_INFO_0_STBC
321  
322  			When set, use STBC transmission rates
323  */
324  #define RECEIVE_USER_INFO_0_STBC_OFFSET                              0x00000000
325  #define RECEIVE_USER_INFO_0_STBC_LSB                                 28
326  #define RECEIVE_USER_INFO_0_STBC_MASK                                0x10000000
327  
328  /* Description		RECEIVE_USER_INFO_0_RECEPTION_TYPE
329  
330  			Indicates what type of reception this is.
331  
332  			<enum 0     reception_type_SU > Basic SU reception (not
333  			part of OFDMA or MU-MIMO)
334  
335  			<enum 1     reception_type_MU_MIMO > This is related to
336  			DL type of reception
337  
338  			<enum 2     reception_type_MU_OFDMA >  This is related
339  			to DL type of reception
340  
341  			<enum 3     reception_type_MU_OFDMA_MIMO >  This is
342  			related to DL type of reception
343  
344  			<enum 4     reception_type_UL_MU_MIMO > This is related
345  			to UL type of reception
346  
347  			<enum 5     reception_type_UL_MU_OFDMA >  This is
348  			related to UL type of reception
349  
350  			<enum 6     reception_type_UL_MU_OFDMA_MIMO >  This is
351  			related to UL type of reception
352  
353  
354  
355  			<legal 0-6>
356  */
357  #define RECEIVE_USER_INFO_0_RECEPTION_TYPE_OFFSET                    0x00000000
358  #define RECEIVE_USER_INFO_0_RECEPTION_TYPE_LSB                       29
359  #define RECEIVE_USER_INFO_0_RECEPTION_TYPE_MASK                      0xe0000000
360  
361  /* Description		RECEIVE_USER_INFO_1_RATE_MCS
362  
363  			For details, refer to  MCS_TYPE description
364  
365  			<legal all>
366  */
367  #define RECEIVE_USER_INFO_1_RATE_MCS_OFFSET                          0x00000004
368  #define RECEIVE_USER_INFO_1_RATE_MCS_LSB                             0
369  #define RECEIVE_USER_INFO_1_RATE_MCS_MASK                            0x0000000f
370  
371  /* Description		RECEIVE_USER_INFO_1_SGI
372  
373  			Field only valid when pkt type is HT, VHT or HE.
374  
375  
376  
377  			<enum 0     gi_0_8_us > Legacy normal GI.  Can also be
378  			used for HE
379  
380  			<enum 1     gi_0_4_us > Legacy short GI.  Can also be
381  			used for HE
382  
383  			<enum 2     gi_1_6_us > HE related GI
384  
385  			<enum 3     gi_3_2_us > HE related GI
386  
387  			<legal 0 - 3>
388  */
389  #define RECEIVE_USER_INFO_1_SGI_OFFSET                               0x00000004
390  #define RECEIVE_USER_INFO_1_SGI_LSB                                  4
391  #define RECEIVE_USER_INFO_1_SGI_MASK                                 0x00000030
392  
393  /* Description		RECEIVE_USER_INFO_1_RECEIVE_BANDWIDTH
394  
395  			Full receive Bandwidth
396  
397  
398  
399  			<enum 0     full_rx_bw_20_mhz>
400  
401  			<enum 1      full_rx_bw_40_mhz>
402  
403  			<enum 2      full_rx_bw_80_mhz>
404  
405  			<enum 3      full_rx_bw_160_mhz>
406  
407  
408  
409  			<legal 0-3>
410  */
411  #define RECEIVE_USER_INFO_1_RECEIVE_BANDWIDTH_OFFSET                 0x00000004
412  #define RECEIVE_USER_INFO_1_RECEIVE_BANDWIDTH_LSB                    6
413  #define RECEIVE_USER_INFO_1_RECEIVE_BANDWIDTH_MASK                   0x000000c0
414  
415  /* Description		RECEIVE_USER_INFO_1_MIMO_SS_BITMAP
416  
417  			Bitmap, with each bit indicating if the related spatial
418  			stream is used for this STA
419  
420  			LSB related to SS 0
421  
422  
423  
424  			0: spatial stream not used for this reception
425  
426  			1: spatial stream used for this reception
427  
428  
429  
430  			<legal all>
431  */
432  #define RECEIVE_USER_INFO_1_MIMO_SS_BITMAP_OFFSET                    0x00000004
433  #define RECEIVE_USER_INFO_1_MIMO_SS_BITMAP_LSB                       8
434  #define RECEIVE_USER_INFO_1_MIMO_SS_BITMAP_MASK                      0x0000ff00
435  
436  /* Description		RECEIVE_USER_INFO_1_OFDMA_RU_ALLOCATION
437  
438  			Field only valid in case of OFDMA type receptions (DL
439  			and UL)
440  
441  
442  
443  			Indicates the RU number associated with this user.
444  
445  
446  
447  			In case of reception where the transmission was DL MU
448  			OFDMA, this field provides the RU pattern. Note that fields
449  			ofdma_user_index and ofdma_content_channel are needed to
450  			determine which RU (within a 40 MHz channel) was actually
451  			assigned to this user, but this does not give info on which
452  			40 MHz channel was assigned to this user. Please refer
453  			DL_ofdma_ru_* in PHYRX_PKT_END_INFO for complete RU info for
454  			this user.
455  
456  
457  
458  			In case of reception where the transmission was UL MU
459  			OFDMA, PHY is recommended to insert the RU start index in
460  			this field. Note that PHY may insert the RU width in
461  			Reserved_2a[6:0].
462  
463  			<legal all>
464  */
465  #define RECEIVE_USER_INFO_1_OFDMA_RU_ALLOCATION_OFFSET               0x00000004
466  #define RECEIVE_USER_INFO_1_OFDMA_RU_ALLOCATION_LSB                  16
467  #define RECEIVE_USER_INFO_1_OFDMA_RU_ALLOCATION_MASK                 0x00ff0000
468  
469  /* Description		RECEIVE_USER_INFO_1_OFDMA_USER_INDEX
470  
471  			Field only valid in the of DL MU OFDMA reception
472  
473  
474  
475  			The user number within the RU_allocation.
476  
477  
478  
479  			This is needed for SW to determine the exact RU position
480  			within the reception.
481  
482  			<legal all>
483  */
484  #define RECEIVE_USER_INFO_1_OFDMA_USER_INDEX_OFFSET                  0x00000004
485  #define RECEIVE_USER_INFO_1_OFDMA_USER_INDEX_LSB                     24
486  #define RECEIVE_USER_INFO_1_OFDMA_USER_INDEX_MASK                    0x7f000000
487  
488  /* Description		RECEIVE_USER_INFO_1_OFDMA_CONTENT_CHANNEL
489  
490  			Field only valid in the of DL MU OFDMA/MIMO reception
491  
492  
493  
494  			In case of DL MU reception, this field indicates the
495  			content channel number where PHY found the RU information
496  			for this user
497  
498  
499  
500  			This is needed for SW to determine the exact RU position
501  			within the reception.
502  
503  
504  
505  			<enum 0      content_channel_1>
506  
507  			<enum 1      content_channel_2>
508  
509  
510  
511  			<legal all>
512  */
513  #define RECEIVE_USER_INFO_1_OFDMA_CONTENT_CHANNEL_OFFSET             0x00000004
514  #define RECEIVE_USER_INFO_1_OFDMA_CONTENT_CHANNEL_LSB                31
515  #define RECEIVE_USER_INFO_1_OFDMA_CONTENT_CHANNEL_MASK               0x80000000
516  
517  /* Description		RECEIVE_USER_INFO_2_LDPC
518  
519  			When set, use LDPC transmission rates were used.
520  
521  			<legal all>
522  */
523  #define RECEIVE_USER_INFO_2_LDPC_OFFSET                              0x00000008
524  #define RECEIVE_USER_INFO_2_LDPC_LSB                                 0
525  #define RECEIVE_USER_INFO_2_LDPC_MASK                                0x00000001
526  
527  /* Description		RECEIVE_USER_INFO_2_RU_WIDTH
528  
529  			In case of UL OFDMA reception, PHY is recommended to
530  			insert the RU width
531  
532  			In Hastings80: was using Reserved_2a[6:0].
533  
534  			<legal 1 - 74>
535  */
536  #define RECEIVE_USER_INFO_2_RU_WIDTH_OFFSET                          0x00000008
537  #define RECEIVE_USER_INFO_2_RU_WIDTH_LSB                             1
538  #define RECEIVE_USER_INFO_2_RU_WIDTH_MASK                            0x000000fe
539  
540  /* Description		RECEIVE_USER_INFO_2_RESERVED_2A
541  
542  			<legal 0>
543  */
544  #define RECEIVE_USER_INFO_2_RESERVED_2A_OFFSET                       0x00000008
545  #define RECEIVE_USER_INFO_2_RESERVED_2A_LSB                          8
546  #define RECEIVE_USER_INFO_2_RESERVED_2A_MASK                         0xffffff00
547  
548  
549  #endif // _RECEIVE_USER_INFO_H_
550