Branch data Line data Source code
1 : : /* SPDX-License-Identifier: BSD-3-Clause
2 : : * Copyright (c) 2022 NVIDIA Corporation & Affiliates
3 : : */
4 : :
5 : : #ifndef MLX5DR_DEFINER_H_
6 : : #define MLX5DR_DEFINER_H_
7 : :
8 : : /* Max available selecotrs */
9 : : #define DW_SELECTORS 9
10 : : #define BYTE_SELECTORS 8
11 : :
12 : : /* Selectors based on match TAG */
13 : : #define DW_SELECTORS_MATCH 6
14 : : #define DW_SELECTORS_LIMITED 3
15 : :
16 : : /* Selectors based on range TAG */
17 : : #define DW_SELECTORS_RANGE 2
18 : : #define BYTE_SELECTORS_RANGE 8
19 : :
20 : : enum mlx5dr_definer_fname {
21 : : MLX5DR_DEFINER_FNAME_ETH_SMAC_48_16_O,
22 : : MLX5DR_DEFINER_FNAME_ETH_SMAC_48_16_I,
23 : : MLX5DR_DEFINER_FNAME_ETH_SMAC_15_0_O,
24 : : MLX5DR_DEFINER_FNAME_ETH_SMAC_15_0_I,
25 : : MLX5DR_DEFINER_FNAME_ETH_DMAC_48_16_O,
26 : : MLX5DR_DEFINER_FNAME_ETH_DMAC_48_16_I,
27 : : MLX5DR_DEFINER_FNAME_ETH_DMAC_15_0_O,
28 : : MLX5DR_DEFINER_FNAME_ETH_DMAC_15_0_I,
29 : : MLX5DR_DEFINER_FNAME_ETH_TYPE_O,
30 : : MLX5DR_DEFINER_FNAME_ETH_TYPE_I,
31 : : MLX5DR_DEFINER_FNAME_VLAN_TYPE_O,
32 : : MLX5DR_DEFINER_FNAME_VLAN_TYPE_I,
33 : : MLX5DR_DEFINER_FNAME_VLAN_TCI_O,
34 : : MLX5DR_DEFINER_FNAME_VLAN_TCI_I,
35 : : MLX5DR_DEFINER_FNAME_IPV4_IHL_O,
36 : : MLX5DR_DEFINER_FNAME_IPV4_IHL_I,
37 : : MLX5DR_DEFINER_FNAME_IP_TTL_O,
38 : : MLX5DR_DEFINER_FNAME_IP_TTL_I,
39 : : MLX5DR_DEFINER_FNAME_IPV4_DST_O,
40 : : MLX5DR_DEFINER_FNAME_IPV4_DST_I,
41 : : MLX5DR_DEFINER_FNAME_IPV4_SRC_O,
42 : : MLX5DR_DEFINER_FNAME_IPV4_SRC_I,
43 : : MLX5DR_DEFINER_FNAME_IP_VERSION_O,
44 : : MLX5DR_DEFINER_FNAME_IP_VERSION_I,
45 : : MLX5DR_DEFINER_FNAME_IP_FRAG_O,
46 : : MLX5DR_DEFINER_FNAME_IP_FRAG_I,
47 : : MLX5DR_DEFINER_FNAME_IP_LEN_O,
48 : : MLX5DR_DEFINER_FNAME_IP_LEN_I,
49 : : MLX5DR_DEFINER_FNAME_IP_TOS_O,
50 : : MLX5DR_DEFINER_FNAME_IP_TOS_I,
51 : : MLX5DR_DEFINER_FNAME_IPV6_FLOW_LABEL_O,
52 : : MLX5DR_DEFINER_FNAME_IPV6_FLOW_LABEL_I,
53 : : MLX5DR_DEFINER_FNAME_IPV6_DST_127_96_O,
54 : : MLX5DR_DEFINER_FNAME_IPV6_DST_95_64_O,
55 : : MLX5DR_DEFINER_FNAME_IPV6_DST_63_32_O,
56 : : MLX5DR_DEFINER_FNAME_IPV6_DST_31_0_O,
57 : : MLX5DR_DEFINER_FNAME_IPV6_DST_127_96_I,
58 : : MLX5DR_DEFINER_FNAME_IPV6_DST_95_64_I,
59 : : MLX5DR_DEFINER_FNAME_IPV6_DST_63_32_I,
60 : : MLX5DR_DEFINER_FNAME_IPV6_DST_31_0_I,
61 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_127_96_O,
62 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_95_64_O,
63 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_63_32_O,
64 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_31_0_O,
65 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_127_96_I,
66 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_95_64_I,
67 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_63_32_I,
68 : : MLX5DR_DEFINER_FNAME_IPV6_SRC_31_0_I,
69 : : MLX5DR_DEFINER_FNAME_IP_PROTOCOL_O,
70 : : MLX5DR_DEFINER_FNAME_IP_PROTOCOL_I,
71 : : MLX5DR_DEFINER_FNAME_L4_SPORT_O,
72 : : MLX5DR_DEFINER_FNAME_L4_SPORT_I,
73 : : MLX5DR_DEFINER_FNAME_L4_DPORT_O,
74 : : MLX5DR_DEFINER_FNAME_L4_DPORT_I,
75 : : MLX5DR_DEFINER_FNAME_TCP_FLAGS_I,
76 : : MLX5DR_DEFINER_FNAME_TCP_FLAGS_O,
77 : : MLX5DR_DEFINER_FNAME_GTP_TEID,
78 : : MLX5DR_DEFINER_FNAME_GTP_MSG_TYPE,
79 : : MLX5DR_DEFINER_FNAME_GTP_EXT_FLAG,
80 : : MLX5DR_DEFINER_FNAME_GTP_NEXT_EXT_HDR,
81 : : MLX5DR_DEFINER_FNAME_GTP_EXT_HDR_PDU,
82 : : MLX5DR_DEFINER_FNAME_GTP_EXT_HDR_QFI,
83 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_0,
84 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_1,
85 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_2,
86 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_3,
87 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_4,
88 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_5,
89 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_6,
90 : : MLX5DR_DEFINER_FNAME_FLEX_PARSER_7,
91 : : MLX5DR_DEFINER_FNAME_VPORT_REG_C_0,
92 : : MLX5DR_DEFINER_FNAME_VXLAN_FLAGS,
93 : : MLX5DR_DEFINER_FNAME_VXLAN_VNI,
94 : : MLX5DR_DEFINER_FNAME_SOURCE_QP,
95 : : MLX5DR_DEFINER_FNAME_REG_0,
96 : : MLX5DR_DEFINER_FNAME_REG_1,
97 : : MLX5DR_DEFINER_FNAME_REG_2,
98 : : MLX5DR_DEFINER_FNAME_REG_3,
99 : : MLX5DR_DEFINER_FNAME_REG_4,
100 : : MLX5DR_DEFINER_FNAME_REG_5,
101 : : MLX5DR_DEFINER_FNAME_REG_6,
102 : : MLX5DR_DEFINER_FNAME_REG_7,
103 : : MLX5DR_DEFINER_FNAME_REG_8,
104 : : MLX5DR_DEFINER_FNAME_REG_9,
105 : : MLX5DR_DEFINER_FNAME_REG_10,
106 : : MLX5DR_DEFINER_FNAME_REG_11,
107 : : MLX5DR_DEFINER_FNAME_REG_A,
108 : : MLX5DR_DEFINER_FNAME_REG_B,
109 : : MLX5DR_DEFINER_FNAME_GRE_KEY_PRESENT,
110 : : MLX5DR_DEFINER_FNAME_GRE_C_VER,
111 : : MLX5DR_DEFINER_FNAME_GRE_PROTOCOL,
112 : : MLX5DR_DEFINER_FNAME_GRE_OPT_KEY,
113 : : MLX5DR_DEFINER_FNAME_GRE_OPT_SEQ,
114 : : MLX5DR_DEFINER_FNAME_GRE_OPT_CHECKSUM,
115 : : MLX5DR_DEFINER_FNAME_INTEGRITY_O,
116 : : MLX5DR_DEFINER_FNAME_INTEGRITY_I,
117 : : MLX5DR_DEFINER_FNAME_ICMP_DW1,
118 : : MLX5DR_DEFINER_FNAME_ICMP_DW2,
119 : : MLX5DR_DEFINER_FNAME_ESP_SPI,
120 : : MLX5DR_DEFINER_FNAME_ESP_SEQUENCE_NUMBER,
121 : : MLX5DR_DEFINER_FNAME_MPLS0_O,
122 : : MLX5DR_DEFINER_FNAME_MPLS1_O,
123 : : MLX5DR_DEFINER_FNAME_MPLS2_O,
124 : : MLX5DR_DEFINER_FNAME_MPLS3_O,
125 : : MLX5DR_DEFINER_FNAME_MPLS4_O,
126 : : MLX5DR_DEFINER_FNAME_MPLS0_I,
127 : : MLX5DR_DEFINER_FNAME_MPLS1_I,
128 : : MLX5DR_DEFINER_FNAME_MPLS2_I,
129 : : MLX5DR_DEFINER_FNAME_MPLS3_I,
130 : : MLX5DR_DEFINER_FNAME_MPLS4_I,
131 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS0_O,
132 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS1_O,
133 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS2_O,
134 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS3_O,
135 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS4_O,
136 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS0_I,
137 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS1_I,
138 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS2_I,
139 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS3_I,
140 : : MLX5DR_DEFINER_FNAME_OKS2_MPLS4_I,
141 : : MLX5DR_DEFINER_FNAME_IB_L4_OPCODE,
142 : : MLX5DR_DEFINER_FNAME_IB_L4_QPN,
143 : : MLX5DR_DEFINER_FNAME_IB_L4_A,
144 : : MLX5DR_DEFINER_FNAME_PTYPE_L2_O,
145 : : MLX5DR_DEFINER_FNAME_PTYPE_L2_I,
146 : : MLX5DR_DEFINER_FNAME_PTYPE_L3_O,
147 : : MLX5DR_DEFINER_FNAME_PTYPE_L3_I,
148 : : MLX5DR_DEFINER_FNAME_PTYPE_L4_O,
149 : : MLX5DR_DEFINER_FNAME_PTYPE_L4_I,
150 : : MLX5DR_DEFINER_FNAME_PTYPE_TUNNEL,
151 : : MLX5DR_DEFINER_FNAME_PTYPE_FRAG_O,
152 : : MLX5DR_DEFINER_FNAME_PTYPE_FRAG_I,
153 : : MLX5DR_DEFINER_FNAME_MAX,
154 : : };
155 : :
156 : : enum mlx5dr_definer_type {
157 : : MLX5DR_DEFINER_TYPE_MATCH,
158 : : MLX5DR_DEFINER_TYPE_JUMBO,
159 : : MLX5DR_DEFINER_TYPE_RANGE,
160 : : };
161 : :
162 : : struct mlx5dr_definer_fc {
163 : : uint8_t item_idx;
164 : : uint8_t is_range;
165 : : uint32_t byte_off;
166 : : int bit_off;
167 : : uint32_t bit_mask;
168 : : enum mlx5dr_definer_fname fname;
169 : : uint8_t not_overwrite;
170 : : void (*tag_set)(struct mlx5dr_definer_fc *fc,
171 : : const void *item_spec,
172 : : uint8_t *tag);
173 : : void (*tag_mask_set)(struct mlx5dr_definer_fc *fc,
174 : : const void *item_spec,
175 : : uint8_t *tag);
176 : : };
177 : :
178 : : struct mlx5_ifc_definer_hl_eth_l2_bits {
179 : : u8 dmac_47_16[0x20];
180 : : u8 dmac_15_0[0x10];
181 : : u8 l3_ethertype[0x10];
182 : : u8 reserved_at_40[0x1];
183 : : u8 sx_sniffer[0x1];
184 : : u8 functional_lb[0x1];
185 : : u8 ip_fragmented[0x1];
186 : : u8 qp_type[0x2];
187 : : u8 encap_type[0x2];
188 : : u8 port_number[0x2];
189 : : u8 l3_type[0x2];
190 : : u8 l4_type_bwc[0x2];
191 : : u8 first_vlan_qualifier[0x2];
192 : : u8 tci[0x10]; /* contains first_priority[0x3] + first_cfi[0x1] + first_vlan_id[0xc] */
193 : : u8 l4_type[0x4];
194 : : u8 reserved_at_64[0x2];
195 : : u8 ipsec_layer[0x2];
196 : : u8 l2_type[0x2];
197 : : u8 force_lb[0x1];
198 : : u8 l2_ok[0x1];
199 : : u8 l3_ok[0x1];
200 : : u8 l4_ok[0x1];
201 : : u8 second_vlan_qualifier[0x2];
202 : : u8 second_priority[0x3];
203 : : u8 second_cfi[0x1];
204 : : u8 second_vlan_id[0xc];
205 : : };
206 : :
207 : : struct mlx5_ifc_definer_hl_eth_l2_src_bits {
208 : : u8 smac_47_16[0x20];
209 : : u8 smac_15_0[0x10];
210 : : u8 loopback_syndrome[0x8];
211 : : u8 l3_type[0x2];
212 : : u8 l4_type_bwc[0x2];
213 : : u8 first_vlan_qualifier[0x2];
214 : : u8 ip_fragmented[0x1];
215 : : u8 functional_lb[0x1];
216 : : };
217 : :
218 : : struct mlx5_ifc_definer_hl_ib_l2_bits {
219 : : u8 sx_sniffer[0x1];
220 : : u8 force_lb[0x1];
221 : : u8 functional_lb[0x1];
222 : : u8 reserved_at_3[0x3];
223 : : u8 port_number[0x2];
224 : : u8 sl[0x4];
225 : : u8 qp_type[0x2];
226 : : u8 lnh[0x2];
227 : : u8 dlid[0x10];
228 : : u8 vl[0x4];
229 : : u8 lrh_packet_length[0xc];
230 : : u8 slid[0x10];
231 : : };
232 : :
233 : : struct mlx5_ifc_definer_hl_eth_l3_bits {
234 : : u8 ip_version[0x4];
235 : : u8 ihl[0x4];
236 : : union {
237 : : u8 tos[0x8];
238 : : struct {
239 : : u8 dscp[0x6];
240 : : u8 ecn[0x2];
241 : : };
242 : : };
243 : : u8 time_to_live_hop_limit[0x8];
244 : : u8 protocol_next_header[0x8];
245 : : u8 identification[0x10];
246 : : union {
247 : : u8 ipv4_frag[0x10];
248 : : struct {
249 : : u8 flags[0x3];
250 : : u8 fragment_offset[0xd];
251 : : };
252 : : };
253 : : u8 ipv4_total_length[0x10];
254 : : u8 checksum[0x10];
255 : : u8 reserved_at_60[0xc];
256 : : u8 flow_label[0x14];
257 : : u8 packet_length[0x10];
258 : : u8 ipv6_payload_length[0x10];
259 : : };
260 : :
261 : : struct mlx5_ifc_definer_hl_eth_l4_bits {
262 : : u8 source_port[0x10];
263 : : u8 destination_port[0x10];
264 : : u8 data_offset[0x4];
265 : : u8 l4_ok[0x1];
266 : : u8 l3_ok[0x1];
267 : : u8 ip_fragmented[0x1];
268 : : u8 tcp_ns[0x1];
269 : : union {
270 : : u8 tcp_flags[0x8];
271 : : struct {
272 : : u8 tcp_cwr[0x1];
273 : : u8 tcp_ece[0x1];
274 : : u8 tcp_urg[0x1];
275 : : u8 tcp_ack[0x1];
276 : : u8 tcp_psh[0x1];
277 : : u8 tcp_rst[0x1];
278 : : u8 tcp_syn[0x1];
279 : : u8 tcp_fin[0x1];
280 : : };
281 : : };
282 : : u8 first_fragment[0x1];
283 : : u8 reserved_at_31[0xf];
284 : : };
285 : :
286 : : struct mlx5_ifc_definer_hl_src_qp_gvmi_bits {
287 : : u8 loopback_syndrome[0x8];
288 : : u8 l3_type[0x2];
289 : : u8 l4_type_bwc[0x2];
290 : : u8 first_vlan_qualifier[0x2];
291 : : u8 reserved_at_e[0x1];
292 : : u8 functional_lb[0x1];
293 : : u8 source_gvmi[0x10];
294 : : u8 force_lb[0x1];
295 : : u8 ip_fragmented[0x1];
296 : : u8 source_is_requestor[0x1];
297 : : u8 reserved_at_23[0x5];
298 : : u8 source_qp[0x18];
299 : : };
300 : :
301 : : struct mlx5_ifc_definer_hl_ib_l4_bits {
302 : : u8 opcode[0x8];
303 : : u8 qp[0x18];
304 : : u8 se[0x1];
305 : : u8 migreq[0x1];
306 : : u8 ackreq[0x1];
307 : : u8 fecn[0x1];
308 : : u8 becn[0x1];
309 : : u8 bth[0x1];
310 : : u8 deth[0x1];
311 : : u8 dcceth[0x1];
312 : : u8 reserved_at_28[0x2];
313 : : u8 pad_count[0x2];
314 : : u8 tver[0x4];
315 : : u8 p_key[0x10];
316 : : u8 reserved_at_40[0x8];
317 : : u8 deth_source_qp[0x18];
318 : : };
319 : :
320 : : enum mlx5dr_integrity_ok1_bits {
321 : : MLX5DR_DEFINER_OKS1_FIRST_L4_OK = 24,
322 : : MLX5DR_DEFINER_OKS1_FIRST_L3_OK = 25,
323 : : MLX5DR_DEFINER_OKS1_SECOND_L4_OK = 26,
324 : : MLX5DR_DEFINER_OKS1_SECOND_L3_OK = 27,
325 : : MLX5DR_DEFINER_OKS1_FIRST_L4_CSUM_OK = 28,
326 : : MLX5DR_DEFINER_OKS1_FIRST_IPV4_CSUM_OK = 29,
327 : : MLX5DR_DEFINER_OKS1_SECOND_L4_CSUM_OK = 30,
328 : : MLX5DR_DEFINER_OKS1_SECOND_IPV4_CSUM_OK = 31,
329 : : };
330 : :
331 : : struct mlx5_ifc_definer_hl_oks1_bits {
332 : : union {
333 : : u8 oks1_bits[0x20];
334 : : struct {
335 : : u8 second_ipv4_checksum_ok[0x1];
336 : : u8 second_l4_checksum_ok[0x1];
337 : : u8 first_ipv4_checksum_ok[0x1];
338 : : u8 first_l4_checksum_ok[0x1];
339 : : u8 second_l3_ok[0x1];
340 : : u8 second_l4_ok[0x1];
341 : : u8 first_l3_ok[0x1];
342 : : u8 first_l4_ok[0x1];
343 : : u8 flex_parser7_steering_ok[0x1];
344 : : u8 flex_parser6_steering_ok[0x1];
345 : : u8 flex_parser5_steering_ok[0x1];
346 : : u8 flex_parser4_steering_ok[0x1];
347 : : u8 flex_parser3_steering_ok[0x1];
348 : : u8 flex_parser2_steering_ok[0x1];
349 : : u8 flex_parser1_steering_ok[0x1];
350 : : u8 flex_parser0_steering_ok[0x1];
351 : : u8 second_ipv6_extension_header_vld[0x1];
352 : : u8 first_ipv6_extension_header_vld[0x1];
353 : : u8 l3_tunneling_ok[0x1];
354 : : u8 l2_tunneling_ok[0x1];
355 : : u8 second_tcp_ok[0x1];
356 : : u8 second_udp_ok[0x1];
357 : : u8 second_ipv4_ok[0x1];
358 : : u8 second_ipv6_ok[0x1];
359 : : u8 second_l2_ok[0x1];
360 : : u8 vxlan_ok[0x1];
361 : : u8 gre_ok[0x1];
362 : : u8 first_tcp_ok[0x1];
363 : : u8 first_udp_ok[0x1];
364 : : u8 first_ipv4_ok[0x1];
365 : : u8 first_ipv6_ok[0x1];
366 : : u8 first_l2_ok[0x1];
367 : : };
368 : : };
369 : : };
370 : :
371 : : struct mlx5_ifc_definer_hl_oks2_bits {
372 : : u8 reserved_at_0[0xa];
373 : : u8 second_mpls_ok[0x1];
374 : : u8 second_mpls4_s_bit[0x1];
375 : : u8 second_mpls4_qualifier[0x1];
376 : : u8 second_mpls3_s_bit[0x1];
377 : : u8 second_mpls3_qualifier[0x1];
378 : : u8 second_mpls2_s_bit[0x1];
379 : : u8 second_mpls2_qualifier[0x1];
380 : : u8 second_mpls1_s_bit[0x1];
381 : : u8 second_mpls1_qualifier[0x1];
382 : : u8 second_mpls0_s_bit[0x1];
383 : : u8 second_mpls0_qualifier[0x1];
384 : : u8 first_mpls_ok[0x1];
385 : : u8 first_mpls4_s_bit[0x1];
386 : : u8 first_mpls4_qualifier[0x1];
387 : : u8 first_mpls3_s_bit[0x1];
388 : : u8 first_mpls3_qualifier[0x1];
389 : : u8 first_mpls2_s_bit[0x1];
390 : : u8 first_mpls2_qualifier[0x1];
391 : : u8 first_mpls1_s_bit[0x1];
392 : : u8 first_mpls1_qualifier[0x1];
393 : : u8 first_mpls0_s_bit[0x1];
394 : : u8 first_mpls0_qualifier[0x1];
395 : : };
396 : :
397 : : struct mlx5_ifc_definer_hl_voq_bits {
398 : : u8 reserved_at_0[0x18];
399 : : u8 ecn_ok[0x1];
400 : : u8 congestion[0x1];
401 : : u8 profile[0x2];
402 : : u8 internal_prio[0x4];
403 : : };
404 : :
405 : : struct mlx5_ifc_definer_hl_ipv4_src_dst_bits {
406 : : u8 source_address[0x20];
407 : : u8 destination_address[0x20];
408 : : };
409 : :
410 : : struct mlx5_ifc_definer_hl_ipv6_addr_bits {
411 : : u8 ipv6_address_127_96[0x20];
412 : : u8 ipv6_address_95_64[0x20];
413 : : u8 ipv6_address_63_32[0x20];
414 : : u8 ipv6_address_31_0[0x20];
415 : : };
416 : :
417 : : struct mlx5_ifc_definer_tcp_icmp_header_bits {
418 : : union {
419 : : struct {
420 : : u8 icmp_dw1[0x20];
421 : : u8 icmp_dw2[0x20];
422 : : u8 icmp_dw3[0x20];
423 : : };
424 : : struct {
425 : : u8 tcp_seq[0x20];
426 : : u8 tcp_ack[0x20];
427 : : u8 tcp_win_urg[0x20];
428 : : };
429 : : };
430 : : };
431 : :
432 : : struct mlx5_ifc_definer_hl_tunnel_header_bits {
433 : : u8 tunnel_header_0[0x20];
434 : : u8 tunnel_header_1[0x20];
435 : : u8 tunnel_header_2[0x20];
436 : : u8 tunnel_header_3[0x20];
437 : : };
438 : :
439 : : struct mlx5_ifc_definer_hl_ipsec_bits {
440 : : u8 spi[0x20];
441 : : u8 sequence_number[0x20];
442 : : u8 reserved[0x10];
443 : : u8 ipsec_syndrome[0x8];
444 : : u8 next_header[0x8];
445 : : };
446 : :
447 : : struct mlx5_ifc_definer_hl_metadata_bits {
448 : : u8 metadata_to_cqe[0x20];
449 : : u8 general_purpose[0x20];
450 : : u8 acomulated_hash[0x20];
451 : : };
452 : :
453 : : struct mlx5_ifc_definer_hl_flex_parser_bits {
454 : : u8 flex_parser_7[0x20];
455 : : u8 flex_parser_6[0x20];
456 : : u8 flex_parser_5[0x20];
457 : : u8 flex_parser_4[0x20];
458 : : u8 flex_parser_3[0x20];
459 : : u8 flex_parser_2[0x20];
460 : : u8 flex_parser_1[0x20];
461 : : u8 flex_parser_0[0x20];
462 : : };
463 : :
464 : : struct mlx5_ifc_definer_hl_registers_bits {
465 : : u8 register_c_10[0x20];
466 : : u8 register_c_11[0x20];
467 : : u8 register_c_8[0x20];
468 : : u8 register_c_9[0x20];
469 : : u8 register_c_6[0x20];
470 : : u8 register_c_7[0x20];
471 : : u8 register_c_4[0x20];
472 : : u8 register_c_5[0x20];
473 : : u8 register_c_2[0x20];
474 : : u8 register_c_3[0x20];
475 : : u8 register_c_0[0x20];
476 : : u8 register_c_1[0x20];
477 : : };
478 : :
479 : : struct mlx5_ifc_definer_hl_mpls_bits {
480 : : u8 mpls0_label[0x20];
481 : : u8 mpls1_label[0x20];
482 : : u8 mpls2_label[0x20];
483 : : u8 mpls3_label[0x20];
484 : : u8 mpls4_label[0x20];
485 : : };
486 : :
487 : : struct mlx5_ifc_definer_hl_bits {
488 : : struct mlx5_ifc_definer_hl_eth_l2_bits eth_l2_outer;
489 : : struct mlx5_ifc_definer_hl_eth_l2_bits eth_l2_inner;
490 : : struct mlx5_ifc_definer_hl_eth_l2_src_bits eth_l2_src_outer;
491 : : struct mlx5_ifc_definer_hl_eth_l2_src_bits eth_l2_src_inner;
492 : : struct mlx5_ifc_definer_hl_ib_l2_bits ib_l2;
493 : : struct mlx5_ifc_definer_hl_eth_l3_bits eth_l3_outer;
494 : : struct mlx5_ifc_definer_hl_eth_l3_bits eth_l3_inner;
495 : : struct mlx5_ifc_definer_hl_eth_l4_bits eth_l4_outer;
496 : : struct mlx5_ifc_definer_hl_eth_l4_bits eth_l4_inner;
497 : : struct mlx5_ifc_definer_hl_src_qp_gvmi_bits source_qp_gvmi;
498 : : struct mlx5_ifc_definer_hl_ib_l4_bits ib_l4;
499 : : struct mlx5_ifc_definer_hl_oks1_bits oks1;
500 : : struct mlx5_ifc_definer_hl_oks2_bits oks2;
501 : : struct mlx5_ifc_definer_hl_voq_bits voq;
502 : : u8 reserved_at_480[0x380];
503 : : struct mlx5_ifc_definer_hl_ipv4_src_dst_bits ipv4_src_dest_outer;
504 : : struct mlx5_ifc_definer_hl_ipv4_src_dst_bits ipv4_src_dest_inner;
505 : : struct mlx5_ifc_definer_hl_ipv6_addr_bits ipv6_dst_outer;
506 : : struct mlx5_ifc_definer_hl_ipv6_addr_bits ipv6_dst_inner;
507 : : struct mlx5_ifc_definer_hl_ipv6_addr_bits ipv6_src_outer;
508 : : struct mlx5_ifc_definer_hl_ipv6_addr_bits ipv6_src_inner;
509 : : u8 unsupported_dest_ib_l3[0x80];
510 : : u8 unsupported_source_ib_l3[0x80];
511 : : u8 unsupported_udp_misc_outer[0x20];
512 : : u8 unsupported_udp_misc_inner[0x20];
513 : : struct mlx5_ifc_definer_tcp_icmp_header_bits tcp_icmp;
514 : : struct mlx5_ifc_definer_hl_tunnel_header_bits tunnel_header;
515 : : struct mlx5_ifc_definer_hl_mpls_bits mpls_outer;
516 : : struct mlx5_ifc_definer_hl_mpls_bits mpls_inner;
517 : : u8 unsupported_config_headers_outer[0x80];
518 : : u8 unsupported_config_headers_inner[0x80];
519 : : u8 unsupported_random_number[0x20];
520 : : struct mlx5_ifc_definer_hl_ipsec_bits ipsec;
521 : : struct mlx5_ifc_definer_hl_metadata_bits metadata;
522 : : u8 unsupported_utc_timestamp[0x40];
523 : : u8 unsupported_free_running_timestamp[0x40];
524 : : struct mlx5_ifc_definer_hl_flex_parser_bits flex_parser;
525 : : struct mlx5_ifc_definer_hl_registers_bits registers;
526 : : /* struct x ib_l3_extended; */
527 : : /* struct x rwh */
528 : : /* struct x dcceth */
529 : : /* struct x dceth */
530 : : };
531 : :
532 : : enum mlx5dr_definer_gtp {
533 : : MLX5DR_DEFINER_GTP_EXT_HDR_BIT = 0x04,
534 : : };
535 : :
536 : : struct mlx5_ifc_header_gtp_bits {
537 : : u8 version[0x3];
538 : : u8 proto_type[0x1];
539 : : u8 reserved1[0x1];
540 : : u8 ext_hdr_flag[0x1];
541 : : u8 seq_num_flag[0x1];
542 : : u8 pdu_flag[0x1];
543 : : u8 msg_type[0x8];
544 : : u8 msg_len[0x8];
545 : : u8 teid[0x20];
546 : : };
547 : :
548 : : struct mlx5_ifc_header_opt_gtp_bits {
549 : : u8 seq_num[0x10];
550 : : u8 pdu_num[0x8];
551 : : u8 next_ext_hdr_type[0x8];
552 : : };
553 : :
554 : : struct mlx5_ifc_header_gtp_psc_bits {
555 : : u8 len[0x8];
556 : : u8 pdu_type[0x4];
557 : : u8 flags[0x4];
558 : : u8 qfi[0x8];
559 : : u8 reserved2[0x8];
560 : : };
561 : :
562 : : struct mlx5_ifc_header_ipv6_vtc_bits {
563 : : u8 version[0x4];
564 : : union {
565 : : u8 tos[0x8];
566 : : struct {
567 : : u8 dscp[0x6];
568 : : u8 ecn[0x2];
569 : : };
570 : : };
571 : : u8 flow_label[0x14];
572 : : };
573 : :
574 : : struct mlx5_ifc_header_ipv6_routing_ext_bits {
575 : : u8 next_hdr[0x8];
576 : : u8 hdr_len[0x8];
577 : : u8 type[0x8];
578 : : u8 segments_left[0x8];
579 : : union {
580 : : u8 flags[0x20];
581 : : struct {
582 : : u8 last_entry[0x8];
583 : : u8 flag[0x8];
584 : : u8 tag[0x10];
585 : : };
586 : : };
587 : : };
588 : :
589 : : struct mlx5_ifc_header_vxlan_bits {
590 : : u8 flags[0x8];
591 : : u8 reserved1[0x18];
592 : : u8 vni[0x18];
593 : : u8 reserved2[0x8];
594 : : };
595 : :
596 : : struct mlx5_ifc_header_gre_bits {
597 : : union {
598 : : u8 c_rsvd0_ver[0x10];
599 : : struct {
600 : : u8 gre_c_present[0x1];
601 : : u8 reserved_at_1[0x1];
602 : : u8 gre_k_present[0x1];
603 : : u8 gre_s_present[0x1];
604 : : u8 reserved_at_4[0x9];
605 : : u8 version[0x3];
606 : : };
607 : : };
608 : : u8 gre_protocol[0x10];
609 : : u8 checksum[0x10];
610 : : u8 reserved_at_30[0x10];
611 : : };
612 : :
613 : : struct mlx5_ifc_header_icmp_bits {
614 : : union {
615 : : u8 icmp_dw1[0x20];
616 : : struct {
617 : : u8 type[0x8];
618 : : u8 code[0x8];
619 : : u8 cksum[0x10];
620 : : };
621 : : };
622 : : union {
623 : : u8 icmp_dw2[0x20];
624 : : struct {
625 : : u8 ident[0x10];
626 : : u8 seq_nb[0x10];
627 : : };
628 : : };
629 : : };
630 : :
631 : : struct mlx5dr_definer {
632 : : enum mlx5dr_definer_type type;
633 : : uint8_t dw_selector[DW_SELECTORS];
634 : : uint8_t byte_selector[BYTE_SELECTORS];
635 : : struct mlx5dr_rule_match_tag mask;
636 : : struct mlx5dr_devx_obj *obj;
637 : : };
638 : :
639 : : struct mlx5dr_definer_cache {
640 : : LIST_HEAD(definer_head, mlx5dr_definer_cache_item) head;
641 : : };
642 : :
643 : : struct mlx5dr_definer_cache_item {
644 : : struct mlx5dr_definer definer;
645 : : uint32_t refcount;
646 : : LIST_ENTRY(mlx5dr_definer_cache_item) next;
647 : : };
648 : :
649 : : static inline bool
650 : : mlx5dr_definer_is_jumbo(struct mlx5dr_definer *definer)
651 : : {
652 [ # # # # : 0 : return (definer->type == MLX5DR_DEFINER_TYPE_JUMBO);
# # # # #
# ]
653 : : }
654 : :
655 : : void mlx5dr_definer_create_tag(const struct rte_flow_item *items,
656 : : struct mlx5dr_definer_fc *fc,
657 : : uint32_t fc_sz,
658 : : uint8_t *tag);
659 : :
660 : : void mlx5dr_definer_create_tag_range(const struct rte_flow_item *items,
661 : : struct mlx5dr_definer_fc *fc,
662 : : uint32_t fc_sz,
663 : : uint8_t *tag);
664 : :
665 : : int mlx5dr_definer_get_id(struct mlx5dr_definer *definer);
666 : :
667 : : int mlx5dr_definer_matcher_init(struct mlx5dr_context *ctx,
668 : : struct mlx5dr_matcher *matcher);
669 : :
670 : : void mlx5dr_definer_matcher_uninit(struct mlx5dr_matcher *matcher);
671 : :
672 : : int mlx5dr_definer_init_cache(struct mlx5dr_definer_cache **cache);
673 : :
674 : : void mlx5dr_definer_uninit_cache(struct mlx5dr_definer_cache *cache);
675 : :
676 : : #endif
|