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 _MON_DESTINATION_RING_WITH_DROP_H_
27  #define _MON_DESTINATION_RING_WITH_DROP_H_
28  #if !defined(__ASSEMBLER__)
29  #endif
30  
31  #define NUM_OF_DWORDS_MON_DESTINATION_RING_WITH_DROP 4
32  
33  
34  struct mon_destination_ring_with_drop {
35  #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
36               uint32_t ppdu_drop_cnt                                           : 10, // [9:0]
37                        mpdu_drop_cnt                                           : 10, // [19:10]
38                        tlv_drop_cnt                                            : 10, // [29:20]
39                        end_of_ppdu_seen                                        :  1, // [30:30]
40                        reserved_0a                                             :  1; // [31:31]
41               uint32_t reserved_1a                                             : 32; // [31:0]
42               uint32_t ppdu_id                                                 : 32; // [31:0]
43               uint32_t reserved_3a                                             : 18, // [17:0]
44                        initiator                                               :  1, // [18:18]
45                        empty_descriptor                                        :  1, // [19:19]
46                        ring_id                                                 :  8, // [27:20]
47                        looping_count                                           :  4; // [31:28]
48  #else
49               uint32_t reserved_0a                                             :  1, // [31:31]
50                        end_of_ppdu_seen                                        :  1, // [30:30]
51                        tlv_drop_cnt                                            : 10, // [29:20]
52                        mpdu_drop_cnt                                           : 10, // [19:10]
53                        ppdu_drop_cnt                                           : 10; // [9:0]
54               uint32_t reserved_1a                                             : 32; // [31:0]
55               uint32_t ppdu_id                                                 : 32; // [31:0]
56               uint32_t looping_count                                           :  4, // [31:28]
57                        ring_id                                                 :  8, // [27:20]
58                        empty_descriptor                                        :  1, // [19:19]
59                        initiator                                               :  1, // [18:18]
60                        reserved_3a                                             : 18; // [17:0]
61  #endif
62  };
63  
64  
65  /* Description		PPDU_DROP_CNT
66  
67  			The number of PPDUs dropped due to the back-pressure
68  
69  			Set to 1023 if >1023 PPDUs got dropped
70  			<legal all>
71  */
72  
73  #define MON_DESTINATION_RING_WITH_DROP_PPDU_DROP_CNT_OFFSET                         0x00000000
74  #define MON_DESTINATION_RING_WITH_DROP_PPDU_DROP_CNT_LSB                            0
75  #define MON_DESTINATION_RING_WITH_DROP_PPDU_DROP_CNT_MSB                            9
76  #define MON_DESTINATION_RING_WITH_DROP_PPDU_DROP_CNT_MASK                           0x000003ff
77  
78  
79  /* Description		MPDU_DROP_CNT
80  
81  			The number of MPDUs dropped within the first PPDU due to
82  			 the back-pressure
83  
84  			Set to 1023 if >1023 MPDUs got dropped
85  			<legal all>
86  */
87  
88  #define MON_DESTINATION_RING_WITH_DROP_MPDU_DROP_CNT_OFFSET                         0x00000000
89  #define MON_DESTINATION_RING_WITH_DROP_MPDU_DROP_CNT_LSB                            10
90  #define MON_DESTINATION_RING_WITH_DROP_MPDU_DROP_CNT_MSB                            19
91  #define MON_DESTINATION_RING_WITH_DROP_MPDU_DROP_CNT_MASK                           0x000ffc00
92  
93  
94  /* Description		TLV_DROP_CNT
95  
96  			The number of PPDU-level (global or per-user) TLVs dropped
97  			 within the first PPDU due to the back-pressure
98  */
99  
100  #define MON_DESTINATION_RING_WITH_DROP_TLV_DROP_CNT_OFFSET                          0x00000000
101  #define MON_DESTINATION_RING_WITH_DROP_TLV_DROP_CNT_LSB                             20
102  #define MON_DESTINATION_RING_WITH_DROP_TLV_DROP_CNT_MSB                             29
103  #define MON_DESTINATION_RING_WITH_DROP_TLV_DROP_CNT_MASK                            0x3ff00000
104  
105  
106  /* Description		END_OF_PPDU_SEEN
107  
108  			Field valid only if mpdu_drop_cnt > 0 or tlv_drop_cnt >
109  			0
110  
111  			Set by TXMON if 'TX_FES_STATUS_END' is received for a partially
112  			 dropped PPDU when Initiator = 1.
113  			Set by TXMON if 'RESPONSE_END_STATUS' is received for a
114  			partially dropped PPDU when Initiator = 0.
115  			Set by RXMON if 'RX_PPDU_END_STATUS_DONE' is received for
116  			 a partially dropped PPDU.
117  */
118  
119  #define MON_DESTINATION_RING_WITH_DROP_END_OF_PPDU_SEEN_OFFSET                      0x00000000
120  #define MON_DESTINATION_RING_WITH_DROP_END_OF_PPDU_SEEN_LSB                         30
121  #define MON_DESTINATION_RING_WITH_DROP_END_OF_PPDU_SEEN_MSB                         30
122  #define MON_DESTINATION_RING_WITH_DROP_END_OF_PPDU_SEEN_MASK                        0x40000000
123  
124  
125  /* Description		RESERVED_0A
126  
127  			<legal 0>
128  */
129  
130  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_0A_OFFSET                           0x00000000
131  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_0A_LSB                              31
132  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_0A_MSB                              31
133  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_0A_MASK                             0x80000000
134  
135  
136  /* Description		RESERVED_1A
137  
138  			<legal 0>
139  */
140  
141  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_1A_OFFSET                           0x00000004
142  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_1A_LSB                              0
143  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_1A_MSB                              31
144  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_1A_MASK                             0xffffffff
145  
146  
147  /* Description		PPDU_ID
148  
149  			The ID of the last PPDU which saw the back-pressure on AXI
150  
151  
152  			TXMON fills this with the schedule_id from 'TX_FES_SETUP'
153  			when Initiator = 1.
154  			TXMON fills this with the Phy_ppdu_id from 'RX_RESPONSE_REQUIRED_INFO'
155  			when Initiator = 0.
156  			RXMON fills this with the Phy_ppdu_id from 'RX_PPDU_START.'
157  
158  			<legal all>
159  */
160  
161  #define MON_DESTINATION_RING_WITH_DROP_PPDU_ID_OFFSET                               0x00000008
162  #define MON_DESTINATION_RING_WITH_DROP_PPDU_ID_LSB                                  0
163  #define MON_DESTINATION_RING_WITH_DROP_PPDU_ID_MSB                                  31
164  #define MON_DESTINATION_RING_WITH_DROP_PPDU_ID_MASK                                 0xffffffff
165  
166  
167  /* Description		RESERVED_3A
168  
169  			<legal 0>
170  */
171  
172  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_3A_OFFSET                           0x0000000c
173  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_3A_LSB                              0
174  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_3A_MSB                              17
175  #define MON_DESTINATION_RING_WITH_DROP_RESERVED_3A_MASK                             0x0003ffff
176  
177  
178  /* Description		INITIATOR
179  
180  			1: This descriptor belongs to a TX FES (TXOP initiator)
181  			0: This descriptor belongs to a response TX (TXOP responder)
182  
183  			<legal all>
184  */
185  
186  #define MON_DESTINATION_RING_WITH_DROP_INITIATOR_OFFSET                             0x0000000c
187  #define MON_DESTINATION_RING_WITH_DROP_INITIATOR_LSB                                18
188  #define MON_DESTINATION_RING_WITH_DROP_INITIATOR_MSB                                18
189  #define MON_DESTINATION_RING_WITH_DROP_INITIATOR_MASK                               0x00040000
190  
191  
192  /* Description		EMPTY_DESCRIPTOR
193  
194  			0: This descriptor is written on a flush or the end of a
195  			 PPDU or the end of status buffer (see 'MON_DESTINATION_RING'
196  			structure)
197  			1: This descriptor is written to indicate drop information
198  
199  			<legal 1>
200  */
201  
202  #define MON_DESTINATION_RING_WITH_DROP_EMPTY_DESCRIPTOR_OFFSET                      0x0000000c
203  #define MON_DESTINATION_RING_WITH_DROP_EMPTY_DESCRIPTOR_LSB                         19
204  #define MON_DESTINATION_RING_WITH_DROP_EMPTY_DESCRIPTOR_MSB                         19
205  #define MON_DESTINATION_RING_WITH_DROP_EMPTY_DESCRIPTOR_MASK                        0x00080000
206  
207  
208  /* Description		RING_ID
209  
210  			Consumer: SW/REO/DEBUG
211  			Producer: SRNG (of TXMON/RXMON)
212  
213  			For debugging.
214  			This field is filled in by the SRNG module.
215  			It help to identify the ring that is being looked
216  			<legal 0>
217  */
218  
219  #define MON_DESTINATION_RING_WITH_DROP_RING_ID_OFFSET                               0x0000000c
220  #define MON_DESTINATION_RING_WITH_DROP_RING_ID_LSB                                  20
221  #define MON_DESTINATION_RING_WITH_DROP_RING_ID_MSB                                  27
222  #define MON_DESTINATION_RING_WITH_DROP_RING_ID_MASK                                 0x0ff00000
223  
224  
225  /* Description		LOOPING_COUNT
226  
227  			Consumer: SW/DEBUG
228  			Producer: SRNG (of TXMON/RXMON)
229  
230  			For debugging.
231  			This field is filled in by the SRNG module.
232  
233  			A count value that indicates the number of times the producer
234  			 of entries into this Ring has looped around the ring.
235  			At initialization time, this value is set to 0. On the first
236  			 loop, this value is set to 1. After the max value is reached
237  			 allowed by the number of bits for this field, the count
238  			 value continues with 0 again.
239  
240  			In case SW is the consumer of the ring entries, it can use
241  			 this field to figure out up to where the producer of entries
242  			 has created new entries. This eliminates the need to check
243  			 where the "head pointer' of the ring is located once the
244  			 SW starts processing an interrupt indicating that new entries
245  			 have been put into this ring...
246  
247  			Also note that SW if it wants only needs to look at the
248  			LSB bit of this count value.
249  			<legal all>
250  */
251  
252  #define MON_DESTINATION_RING_WITH_DROP_LOOPING_COUNT_OFFSET                         0x0000000c
253  #define MON_DESTINATION_RING_WITH_DROP_LOOPING_COUNT_LSB                            28
254  #define MON_DESTINATION_RING_WITH_DROP_LOOPING_COUNT_MSB                            31
255  #define MON_DESTINATION_RING_WITH_DROP_LOOPING_COUNT_MASK                           0xf0000000
256  
257  
258  
259  #endif   // MON_DESTINATION_RING_WITH_DROP
260