1 
2 /*
3  * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights reserved.
4  *
5  * Permission to use, copy, modify, and/or distribute this software for
6  * any purpose with or without fee is hereby granted, provided that the
7  * above copyright notice and this permission notice appear in all
8  * copies.
9  *
10  * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
11  * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
12  * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
13  * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
15  * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
16  * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
17  * PERFORMANCE OF THIS SOFTWARE.
18  */
19 
20 
21 
22 #ifndef _RX_FLOW_SEARCH_ENTRY_H_
23 #define _RX_FLOW_SEARCH_ENTRY_H_
24 #if !defined(__ASSEMBLER__)
25 #endif
26 
27 #define NUM_OF_DWORDS_RX_FLOW_SEARCH_ENTRY 16
28 
29 struct rx_flow_search_entry {
30 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
31              uint32_t src_ip_127_96                                           : 32;
32              uint32_t src_ip_95_64                                            : 32;
33              uint32_t src_ip_63_32                                            : 32;
34              uint32_t src_ip_31_0                                             : 32;
35              uint32_t dest_ip_127_96                                          : 32;
36              uint32_t dest_ip_95_64                                           : 32;
37              uint32_t dest_ip_63_32                                           : 32;
38              uint32_t dest_ip_31_0                                            : 32;
39              uint32_t src_port                                                : 16,
40                       dest_port                                               : 16;
41              uint32_t l4_protocol                                             :  8,
42                       valid                                                   :  1,
43                       reserved_9                                              :  4,
44                       service_code                                            :  9,
45                       priority_valid                                          :  1,
46                       use_ppe                                                 :  1,
47                       reo_destination_indication                              :  5,
48                       msdu_drop                                               :  1,
49                       reo_destination_handler                                 :  2;
50              uint32_t metadata                                                : 32;
51              uint32_t aggregation_count                                       :  7,
52                       lro_eligible                                            :  1,
53                       msdu_count                                              : 24;
54              uint32_t msdu_byte_count                                         : 32;
55              uint32_t timestamp                                               : 32;
56              uint32_t cumulative_ip_length_pmac1                              : 16,
57                       cumulative_ip_length                                    : 16;
58              uint32_t tcp_sequence_number                                     : 32;
59 #else
60              uint32_t src_ip_127_96                                           : 32;
61              uint32_t src_ip_95_64                                            : 32;
62              uint32_t src_ip_63_32                                            : 32;
63              uint32_t src_ip_31_0                                             : 32;
64              uint32_t dest_ip_127_96                                          : 32;
65              uint32_t dest_ip_95_64                                           : 32;
66              uint32_t dest_ip_63_32                                           : 32;
67              uint32_t dest_ip_31_0                                            : 32;
68              uint32_t dest_port                                               : 16,
69                       src_port                                                : 16;
70              uint32_t reo_destination_handler                                 :  2,
71                       msdu_drop                                               :  1,
72                       reo_destination_indication                              :  5,
73                       use_ppe                                                 :  1,
74                       priority_valid                                          :  1,
75                       service_code                                            :  9,
76                       reserved_9                                              :  4,
77                       valid                                                   :  1,
78                       l4_protocol                                             :  8;
79              uint32_t metadata                                                : 32;
80              uint32_t msdu_count                                              : 24,
81                       lro_eligible                                            :  1,
82                       aggregation_count                                       :  7;
83              uint32_t msdu_byte_count                                         : 32;
84              uint32_t timestamp                                               : 32;
85              uint32_t cumulative_ip_length                                    : 16,
86                       cumulative_ip_length_pmac1                              : 16;
87              uint32_t tcp_sequence_number                                     : 32;
88 #endif
89 };
90 
91 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_OFFSET                                   0x00000000
92 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_LSB                                      0
93 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_MSB                                      31
94 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_MASK                                     0xffffffff
95 
96 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_OFFSET                                    0x00000004
97 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_LSB                                       0
98 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_MSB                                       31
99 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_MASK                                      0xffffffff
100 
101 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_OFFSET                                    0x00000008
102 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_LSB                                       0
103 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_MSB                                       31
104 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_MASK                                      0xffffffff
105 
106 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_OFFSET                                     0x0000000c
107 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_LSB                                        0
108 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_MSB                                        31
109 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_MASK                                       0xffffffff
110 
111 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_OFFSET                                  0x00000010
112 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_LSB                                     0
113 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_MSB                                     31
114 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_MASK                                    0xffffffff
115 
116 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_OFFSET                                   0x00000014
117 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_LSB                                      0
118 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_MSB                                      31
119 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_MASK                                     0xffffffff
120 
121 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_OFFSET                                   0x00000018
122 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_LSB                                      0
123 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_MSB                                      31
124 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_MASK                                     0xffffffff
125 
126 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_OFFSET                                    0x0000001c
127 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_LSB                                       0
128 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_MSB                                       31
129 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_MASK                                      0xffffffff
130 
131 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_OFFSET                                        0x00000020
132 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_LSB                                           0
133 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_MSB                                           15
134 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_MASK                                          0x0000ffff
135 
136 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_OFFSET                                       0x00000020
137 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_LSB                                          16
138 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_MSB                                          31
139 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_MASK                                         0xffff0000
140 
141 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_OFFSET                                     0x00000024
142 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_LSB                                        0
143 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_MSB                                        7
144 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_MASK                                       0x000000ff
145 
146 #define RX_FLOW_SEARCH_ENTRY_VALID_OFFSET                                           0x00000024
147 #define RX_FLOW_SEARCH_ENTRY_VALID_LSB                                              8
148 #define RX_FLOW_SEARCH_ENTRY_VALID_MSB                                              8
149 #define RX_FLOW_SEARCH_ENTRY_VALID_MASK                                             0x00000100
150 
151 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_OFFSET                                      0x00000024
152 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_LSB                                         9
153 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_MSB                                         12
154 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_MASK                                        0x00001e00
155 
156 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_OFFSET                                    0x00000024
157 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_LSB                                       13
158 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_MSB                                       21
159 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_MASK                                      0x003fe000
160 
161 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_OFFSET                                  0x00000024
162 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_LSB                                     22
163 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_MSB                                     22
164 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_MASK                                    0x00400000
165 
166 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_OFFSET                                         0x00000024
167 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_LSB                                            23
168 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_MSB                                            23
169 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_MASK                                           0x00800000
170 
171 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_OFFSET                      0x00000024
172 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_LSB                         24
173 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_MSB                         28
174 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_MASK                        0x1f000000
175 
176 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_OFFSET                                       0x00000024
177 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_LSB                                          29
178 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_MSB                                          29
179 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_MASK                                         0x20000000
180 
181 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_OFFSET                         0x00000024
182 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_LSB                            30
183 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_MSB                            31
184 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_MASK                           0xc0000000
185 
186 #define RX_FLOW_SEARCH_ENTRY_METADATA_OFFSET                                        0x00000028
187 #define RX_FLOW_SEARCH_ENTRY_METADATA_LSB                                           0
188 #define RX_FLOW_SEARCH_ENTRY_METADATA_MSB                                           31
189 #define RX_FLOW_SEARCH_ENTRY_METADATA_MASK                                          0xffffffff
190 
191 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_OFFSET                               0x0000002c
192 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_LSB                                  0
193 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_MSB                                  6
194 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_MASK                                 0x0000007f
195 
196 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_OFFSET                                    0x0000002c
197 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_LSB                                       7
198 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_MSB                                       7
199 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_MASK                                      0x00000080
200 
201 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_OFFSET                                      0x0000002c
202 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_LSB                                         8
203 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_MSB                                         31
204 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_MASK                                        0xffffff00
205 
206 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_OFFSET                                 0x00000030
207 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_LSB                                    0
208 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_MSB                                    31
209 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_MASK                                   0xffffffff
210 
211 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_OFFSET                                       0x00000034
212 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_LSB                                          0
213 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_MSB                                          31
214 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_MASK                                         0xffffffff
215 
216 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_OFFSET                      0x00000038
217 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_LSB                         0
218 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_MSB                         15
219 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_MASK                        0x0000ffff
220 
221 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_OFFSET                            0x00000038
222 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_LSB                               16
223 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_MSB                               31
224 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_MASK                              0xffff0000
225 
226 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_OFFSET                             0x0000003c
227 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_LSB                                0
228 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_MSB                                31
229 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_MASK                               0xffffffff
230 
231 #endif
232