1 /*
2  * Copyright (c) 2023 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 #ifndef _MON_DROP_H_
18 #define _MON_DROP_H_
19 #if !defined(__ASSEMBLER__)
20 #endif
21 
22 #define NUM_OF_DWORDS_MON_DROP 2
23 
24 #define NUM_OF_QWORDS_MON_DROP 1
25 
26 
27 struct mon_drop {
28 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
29              uint32_t ppdu_id                                                 : 32; // [31:0]
30              uint32_t ppdu_drop_cnt                                           : 10, // [9:0]
31                       mpdu_drop_cnt                                           : 10, // [19:10]
32                       tlv_drop_cnt                                            : 10, // [29:20]
33                       end_of_ppdu_seen                                        :  1, // [30:30]
34                       reserved_1a                                             :  1; // [31:31]
35 #else
36              uint32_t ppdu_id                                                 : 32; // [31:0]
37              uint32_t reserved_1a                                             :  1, // [31:31]
38                       end_of_ppdu_seen                                        :  1, // [30:30]
39                       tlv_drop_cnt                                            : 10, // [29:20]
40                       mpdu_drop_cnt                                           : 10, // [19:10]
41                       ppdu_drop_cnt                                           : 10; // [9:0]
42 #endif
43 };
44 
45 
46 /* Description		PPDU_ID
47 
48 			The ID of the last PPDU which saw the back-pressure on AXI
49 
50 
51 			TXMON fills this with the schedule_id from 'TX_FES_SETUP'
52 			in case of a TX FES (TXOP initiator).
53 			TXMON fills this with the Phy_ppdu_id from 'RX_RESPONSE_REQUIRED_INFO'
54 			in case of a response TX (TXOP responder).
55 			RXMON fills this with the Phy_ppdu_id from 'RX_PPDU_START.'
56 
57 			<legal all>
58 */
59 
60 #define MON_DROP_PPDU_ID_OFFSET                                                     0x0000000000000000
61 #define MON_DROP_PPDU_ID_LSB                                                        0
62 #define MON_DROP_PPDU_ID_MSB                                                        31
63 #define MON_DROP_PPDU_ID_MASK                                                       0x00000000ffffffff
64 
65 
66 /* Description		PPDU_DROP_CNT
67 
68 			The number of PPDUs dropped due to the back-pressure
69 
70 			Set to 1023 if >1023 PPDUs got dropped
71 			<legal all>
72 */
73 
74 #define MON_DROP_PPDU_DROP_CNT_OFFSET                                               0x0000000000000000
75 #define MON_DROP_PPDU_DROP_CNT_LSB                                                  32
76 #define MON_DROP_PPDU_DROP_CNT_MSB                                                  41
77 #define MON_DROP_PPDU_DROP_CNT_MASK                                                 0x000003ff00000000
78 
79 
80 /* Description		MPDU_DROP_CNT
81 
82 			The number of MPDUs dropped within the first PPDU due to
83 			 the back-pressure
84 
85 			Set to 1023 if >1023 MPDUs got dropped
86 			<legal all>
87 */
88 
89 #define MON_DROP_MPDU_DROP_CNT_OFFSET                                               0x0000000000000000
90 #define MON_DROP_MPDU_DROP_CNT_LSB                                                  42
91 #define MON_DROP_MPDU_DROP_CNT_MSB                                                  51
92 #define MON_DROP_MPDU_DROP_CNT_MASK                                                 0x000ffc0000000000
93 
94 
95 /* Description		TLV_DROP_CNT
96 
97 			The number of PPDU-level (global or per-user) TLVs dropped
98 			 within the first PPDU due to the back-pressure
99 */
100 
101 #define MON_DROP_TLV_DROP_CNT_OFFSET                                                0x0000000000000000
102 #define MON_DROP_TLV_DROP_CNT_LSB                                                   52
103 #define MON_DROP_TLV_DROP_CNT_MSB                                                   61
104 #define MON_DROP_TLV_DROP_CNT_MASK                                                  0x3ff0000000000000
105 
106 
107 /* Description		END_OF_PPDU_SEEN
108 
109 			Field valid only if mpdu_drop_cnt > 0 or tlv_drop_cnt >
110 			0
111 
112 			Set by TXMON if 'TX_FES_STATUS_END' is received but dropped
113 			 in case of a TX FES (TXOP initiator).
114 			Set by TXMON if 'RESPONSE_END_STATUS' is received but dropped
115 			 in case of a response TX (TXOP responder).
116 			Set by RXMON if 'RX_PPDU_END' is received but dropped
117 */
118 
119 #define MON_DROP_END_OF_PPDU_SEEN_OFFSET                                            0x0000000000000000
120 #define MON_DROP_END_OF_PPDU_SEEN_LSB                                               62
121 #define MON_DROP_END_OF_PPDU_SEEN_MSB                                               62
122 #define MON_DROP_END_OF_PPDU_SEEN_MASK                                              0x4000000000000000
123 
124 
125 /* Description		RESERVED_1A
126 
127 			<legal 0>
128 */
129 
130 #define MON_DROP_RESERVED_1A_OFFSET                                                 0x0000000000000000
131 #define MON_DROP_RESERVED_1A_LSB                                                    63
132 #define MON_DROP_RESERVED_1A_MSB                                                    63
133 #define MON_DROP_RESERVED_1A_MASK                                                   0x8000000000000000
134 
135 
136 
137 #endif   // MON_DROP
138