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 
18 #ifndef _RX_FLOW_SEARCH_ENTRY_H_
19 #define _RX_FLOW_SEARCH_ENTRY_H_
20 
21 #define NUM_OF_DWORDS_RX_FLOW_SEARCH_ENTRY 16
22 
23 struct rx_flow_search_entry {
24 #ifndef WIFI_BIT_ORDER_BIG_ENDIAN
25              uint32_t src_ip_127_96                                           : 32;
26              uint32_t src_ip_95_64                                            : 32;
27              uint32_t src_ip_63_32                                            : 32;
28              uint32_t src_ip_31_0                                             : 32;
29              uint32_t dest_ip_127_96                                          : 32;
30              uint32_t dest_ip_95_64                                           : 32;
31              uint32_t dest_ip_63_32                                           : 32;
32              uint32_t dest_ip_31_0                                            : 32;
33              uint32_t src_port                                                : 16,
34                       dest_port                                               : 16;
35              uint32_t l4_protocol                                             :  8,
36                       valid                                                   :  1,
37                       reserved_9                                              :  4,
38                       service_code                                            :  9,
39                       priority_valid                                          :  1,
40                       use_ppe                                                 :  1,
41                       reo_destination_indication                              :  5,
42                       msdu_drop                                               :  1,
43                       reo_destination_handler                                 :  2;
44              uint32_t metadata                                                : 32;
45              uint32_t aggregation_count                                       :  7,
46                       lro_eligible                                            :  1,
47                       msdu_count                                              : 24;
48              uint32_t msdu_byte_count                                         : 32;
49              uint32_t timestamp                                               : 32;
50              uint32_t cumulative_ip_length_pmac1                              : 16,
51                       cumulative_ip_length                                    : 16;
52              uint32_t tcp_sequence_number                                     : 32;
53 #else
54              uint32_t src_ip_127_96                                           : 32;
55              uint32_t src_ip_95_64                                            : 32;
56              uint32_t src_ip_63_32                                            : 32;
57              uint32_t src_ip_31_0                                             : 32;
58              uint32_t dest_ip_127_96                                          : 32;
59              uint32_t dest_ip_95_64                                           : 32;
60              uint32_t dest_ip_63_32                                           : 32;
61              uint32_t dest_ip_31_0                                            : 32;
62              uint32_t dest_port                                               : 16,
63                       src_port                                                : 16;
64              uint32_t reo_destination_handler                                 :  2,
65                       msdu_drop                                               :  1,
66                       reo_destination_indication                              :  5,
67                       use_ppe                                                 :  1,
68                       priority_valid                                          :  1,
69                       service_code                                            :  9,
70                       reserved_9                                              :  4,
71                       valid                                                   :  1,
72                       l4_protocol                                             :  8;
73              uint32_t metadata                                                : 32;
74              uint32_t msdu_count                                              : 24,
75                       lro_eligible                                            :  1,
76                       aggregation_count                                       :  7;
77              uint32_t msdu_byte_count                                         : 32;
78              uint32_t timestamp                                               : 32;
79              uint32_t cumulative_ip_length                                    : 16,
80                       cumulative_ip_length_pmac1                              : 16;
81              uint32_t tcp_sequence_number                                     : 32;
82 #endif
83 };
84 
85 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_OFFSET                                   0x00000000
86 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_LSB                                      0
87 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_MSB                                      31
88 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_127_96_MASK                                     0xffffffff
89 
90 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_OFFSET                                    0x00000004
91 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_LSB                                       0
92 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_MSB                                       31
93 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_95_64_MASK                                      0xffffffff
94 
95 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_OFFSET                                    0x00000008
96 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_LSB                                       0
97 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_MSB                                       31
98 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_63_32_MASK                                      0xffffffff
99 
100 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_OFFSET                                     0x0000000c
101 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_LSB                                        0
102 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_MSB                                        31
103 #define RX_FLOW_SEARCH_ENTRY_SRC_IP_31_0_MASK                                       0xffffffff
104 
105 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_OFFSET                                  0x00000010
106 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_LSB                                     0
107 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_MSB                                     31
108 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_127_96_MASK                                    0xffffffff
109 
110 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_OFFSET                                   0x00000014
111 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_LSB                                      0
112 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_MSB                                      31
113 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_95_64_MASK                                     0xffffffff
114 
115 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_OFFSET                                   0x00000018
116 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_LSB                                      0
117 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_MSB                                      31
118 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_63_32_MASK                                     0xffffffff
119 
120 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_OFFSET                                    0x0000001c
121 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_LSB                                       0
122 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_MSB                                       31
123 #define RX_FLOW_SEARCH_ENTRY_DEST_IP_31_0_MASK                                      0xffffffff
124 
125 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_OFFSET                                        0x00000020
126 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_LSB                                           0
127 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_MSB                                           15
128 #define RX_FLOW_SEARCH_ENTRY_SRC_PORT_MASK                                          0x0000ffff
129 
130 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_OFFSET                                       0x00000020
131 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_LSB                                          16
132 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_MSB                                          31
133 #define RX_FLOW_SEARCH_ENTRY_DEST_PORT_MASK                                         0xffff0000
134 
135 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_OFFSET                                     0x00000024
136 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_LSB                                        0
137 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_MSB                                        7
138 #define RX_FLOW_SEARCH_ENTRY_L4_PROTOCOL_MASK                                       0x000000ff
139 
140 #define RX_FLOW_SEARCH_ENTRY_VALID_OFFSET                                           0x00000024
141 #define RX_FLOW_SEARCH_ENTRY_VALID_LSB                                              8
142 #define RX_FLOW_SEARCH_ENTRY_VALID_MSB                                              8
143 #define RX_FLOW_SEARCH_ENTRY_VALID_MASK                                             0x00000100
144 
145 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_OFFSET                                      0x00000024
146 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_LSB                                         9
147 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_MSB                                         12
148 #define RX_FLOW_SEARCH_ENTRY_RESERVED_9_MASK                                        0x00001e00
149 
150 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_OFFSET                                    0x00000024
151 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_LSB                                       13
152 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_MSB                                       21
153 #define RX_FLOW_SEARCH_ENTRY_SERVICE_CODE_MASK                                      0x003fe000
154 
155 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_OFFSET                                  0x00000024
156 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_LSB                                     22
157 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_MSB                                     22
158 #define RX_FLOW_SEARCH_ENTRY_PRIORITY_VALID_MASK                                    0x00400000
159 
160 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_OFFSET                                         0x00000024
161 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_LSB                                            23
162 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_MSB                                            23
163 #define RX_FLOW_SEARCH_ENTRY_USE_PPE_MASK                                           0x00800000
164 
165 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_OFFSET                      0x00000024
166 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_LSB                         24
167 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_MSB                         28
168 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_INDICATION_MASK                        0x1f000000
169 
170 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_OFFSET                                       0x00000024
171 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_LSB                                          29
172 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_MSB                                          29
173 #define RX_FLOW_SEARCH_ENTRY_MSDU_DROP_MASK                                         0x20000000
174 
175 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_OFFSET                         0x00000024
176 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_LSB                            30
177 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_MSB                            31
178 #define RX_FLOW_SEARCH_ENTRY_REO_DESTINATION_HANDLER_MASK                           0xc0000000
179 
180 #define RX_FLOW_SEARCH_ENTRY_METADATA_OFFSET                                        0x00000028
181 #define RX_FLOW_SEARCH_ENTRY_METADATA_LSB                                           0
182 #define RX_FLOW_SEARCH_ENTRY_METADATA_MSB                                           31
183 #define RX_FLOW_SEARCH_ENTRY_METADATA_MASK                                          0xffffffff
184 
185 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_OFFSET                               0x0000002c
186 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_LSB                                  0
187 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_MSB                                  6
188 #define RX_FLOW_SEARCH_ENTRY_AGGREGATION_COUNT_MASK                                 0x0000007f
189 
190 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_OFFSET                                    0x0000002c
191 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_LSB                                       7
192 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_MSB                                       7
193 #define RX_FLOW_SEARCH_ENTRY_LRO_ELIGIBLE_MASK                                      0x00000080
194 
195 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_OFFSET                                      0x0000002c
196 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_LSB                                         8
197 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_MSB                                         31
198 #define RX_FLOW_SEARCH_ENTRY_MSDU_COUNT_MASK                                        0xffffff00
199 
200 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_OFFSET                                 0x00000030
201 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_LSB                                    0
202 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_MSB                                    31
203 #define RX_FLOW_SEARCH_ENTRY_MSDU_BYTE_COUNT_MASK                                   0xffffffff
204 
205 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_OFFSET                                       0x00000034
206 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_LSB                                          0
207 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_MSB                                          31
208 #define RX_FLOW_SEARCH_ENTRY_TIMESTAMP_MASK                                         0xffffffff
209 
210 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_OFFSET                      0x00000038
211 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_LSB                         0
212 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_MSB                         15
213 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_PMAC1_MASK                        0x0000ffff
214 
215 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_OFFSET                            0x00000038
216 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_LSB                               16
217 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_MSB                               31
218 #define RX_FLOW_SEARCH_ENTRY_CUMULATIVE_IP_LENGTH_MASK                              0xffff0000
219 
220 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_OFFSET                             0x0000003c
221 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_LSB                                0
222 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_MSB                                31
223 #define RX_FLOW_SEARCH_ENTRY_TCP_SEQUENCE_NUMBER_MASK                               0xffffffff
224 
225 #endif
226