1 /* SPDX-License-Identifier: BSD-3-Clause
2 * Copyright(c) 2016-2017 Intel Corporation
13 #include <rte_debug.h>
14 #include <rte_ether.h>
15 #include <rte_ethdev_driver.h>
17 #include <rte_malloc.h>
18 #include <rte_tailq.h>
19 #include <rte_flow_driver.h>
21 #include "i40e_logs.h"
22 #include "base/i40e_type.h"
23 #include "base/i40e_prototype.h"
24 #include "i40e_ethdev.h"
26 #define I40E_IPV6_TC_MASK (0xFF << I40E_FDIR_IPv6_TC_OFFSET)
27 #define I40E_IPV6_FRAG_HEADER 44
28 #define I40E_TENANT_ARRAY_NUM 3
29 #define I40E_TCI_MASK 0xFFFF
31 static int i40e_flow_validate(struct rte_eth_dev *dev,
32 const struct rte_flow_attr *attr,
33 const struct rte_flow_item pattern[],
34 const struct rte_flow_action actions[],
35 struct rte_flow_error *error);
36 static struct rte_flow *i40e_flow_create(struct rte_eth_dev *dev,
37 const struct rte_flow_attr *attr,
38 const struct rte_flow_item pattern[],
39 const struct rte_flow_action actions[],
40 struct rte_flow_error *error);
41 static int i40e_flow_destroy(struct rte_eth_dev *dev,
42 struct rte_flow *flow,
43 struct rte_flow_error *error);
44 static int i40e_flow_flush(struct rte_eth_dev *dev,
45 struct rte_flow_error *error);
47 i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev,
48 const struct rte_flow_item *pattern,
49 struct rte_flow_error *error,
50 struct rte_eth_ethertype_filter *filter);
51 static int i40e_flow_parse_ethertype_action(struct rte_eth_dev *dev,
52 const struct rte_flow_action *actions,
53 struct rte_flow_error *error,
54 struct rte_eth_ethertype_filter *filter);
55 static int i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
56 const struct rte_flow_attr *attr,
57 const struct rte_flow_item *pattern,
58 struct rte_flow_error *error,
59 struct i40e_fdir_filter_conf *filter);
60 static int i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
61 const struct rte_flow_action *actions,
62 struct rte_flow_error *error,
63 struct i40e_fdir_filter_conf *filter);
64 static int i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev,
65 const struct rte_flow_action *actions,
66 struct rte_flow_error *error,
67 struct i40e_tunnel_filter_conf *filter);
68 static int i40e_flow_parse_attr(const struct rte_flow_attr *attr,
69 struct rte_flow_error *error);
70 static int i40e_flow_parse_ethertype_filter(struct rte_eth_dev *dev,
71 const struct rte_flow_attr *attr,
72 const struct rte_flow_item pattern[],
73 const struct rte_flow_action actions[],
74 struct rte_flow_error *error,
75 union i40e_filter_t *filter);
76 static int i40e_flow_parse_fdir_filter(struct rte_eth_dev *dev,
77 const struct rte_flow_attr *attr,
78 const struct rte_flow_item pattern[],
79 const struct rte_flow_action actions[],
80 struct rte_flow_error *error,
81 union i40e_filter_t *filter);
82 static int i40e_flow_parse_vxlan_filter(struct rte_eth_dev *dev,
83 const struct rte_flow_attr *attr,
84 const struct rte_flow_item pattern[],
85 const struct rte_flow_action actions[],
86 struct rte_flow_error *error,
87 union i40e_filter_t *filter);
88 static int i40e_flow_parse_nvgre_filter(struct rte_eth_dev *dev,
89 const struct rte_flow_attr *attr,
90 const struct rte_flow_item pattern[],
91 const struct rte_flow_action actions[],
92 struct rte_flow_error *error,
93 union i40e_filter_t *filter);
94 static int i40e_flow_parse_mpls_filter(struct rte_eth_dev *dev,
95 const struct rte_flow_attr *attr,
96 const struct rte_flow_item pattern[],
97 const struct rte_flow_action actions[],
98 struct rte_flow_error *error,
99 union i40e_filter_t *filter);
100 static int i40e_flow_parse_gtp_filter(struct rte_eth_dev *dev,
101 const struct rte_flow_attr *attr,
102 const struct rte_flow_item pattern[],
103 const struct rte_flow_action actions[],
104 struct rte_flow_error *error,
105 union i40e_filter_t *filter);
106 static int i40e_flow_destroy_ethertype_filter(struct i40e_pf *pf,
107 struct i40e_ethertype_filter *filter);
108 static int i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
109 struct i40e_tunnel_filter *filter);
110 static int i40e_flow_flush_fdir_filter(struct i40e_pf *pf);
111 static int i40e_flow_flush_ethertype_filter(struct i40e_pf *pf);
112 static int i40e_flow_flush_tunnel_filter(struct i40e_pf *pf);
113 static int i40e_flow_flush_rss_filter(struct rte_eth_dev *dev);
115 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
116 const struct rte_flow_attr *attr,
117 const struct rte_flow_item pattern[],
118 const struct rte_flow_action actions[],
119 struct rte_flow_error *error,
120 union i40e_filter_t *filter);
122 i40e_flow_parse_qinq_pattern(struct rte_eth_dev *dev,
123 const struct rte_flow_item *pattern,
124 struct rte_flow_error *error,
125 struct i40e_tunnel_filter_conf *filter);
127 const struct rte_flow_ops i40e_flow_ops = {
128 .validate = i40e_flow_validate,
129 .create = i40e_flow_create,
130 .destroy = i40e_flow_destroy,
131 .flush = i40e_flow_flush,
134 static union i40e_filter_t cons_filter;
135 static enum rte_filter_type cons_filter_type = RTE_ETH_FILTER_NONE;
137 /* Pattern matched ethertype filter */
138 static enum rte_flow_item_type pattern_ethertype[] = {
139 RTE_FLOW_ITEM_TYPE_ETH,
140 RTE_FLOW_ITEM_TYPE_END,
143 /* Pattern matched flow director filter */
144 static enum rte_flow_item_type pattern_fdir_ipv4[] = {
145 RTE_FLOW_ITEM_TYPE_ETH,
146 RTE_FLOW_ITEM_TYPE_IPV4,
147 RTE_FLOW_ITEM_TYPE_END,
150 static enum rte_flow_item_type pattern_fdir_ipv4_udp[] = {
151 RTE_FLOW_ITEM_TYPE_ETH,
152 RTE_FLOW_ITEM_TYPE_IPV4,
153 RTE_FLOW_ITEM_TYPE_UDP,
154 RTE_FLOW_ITEM_TYPE_END,
157 static enum rte_flow_item_type pattern_fdir_ipv4_tcp[] = {
158 RTE_FLOW_ITEM_TYPE_ETH,
159 RTE_FLOW_ITEM_TYPE_IPV4,
160 RTE_FLOW_ITEM_TYPE_TCP,
161 RTE_FLOW_ITEM_TYPE_END,
164 static enum rte_flow_item_type pattern_fdir_ipv4_sctp[] = {
165 RTE_FLOW_ITEM_TYPE_ETH,
166 RTE_FLOW_ITEM_TYPE_IPV4,
167 RTE_FLOW_ITEM_TYPE_SCTP,
168 RTE_FLOW_ITEM_TYPE_END,
171 static enum rte_flow_item_type pattern_fdir_ipv4_gtpc[] = {
172 RTE_FLOW_ITEM_TYPE_ETH,
173 RTE_FLOW_ITEM_TYPE_IPV4,
174 RTE_FLOW_ITEM_TYPE_UDP,
175 RTE_FLOW_ITEM_TYPE_GTPC,
176 RTE_FLOW_ITEM_TYPE_END,
179 static enum rte_flow_item_type pattern_fdir_ipv4_gtpu[] = {
180 RTE_FLOW_ITEM_TYPE_ETH,
181 RTE_FLOW_ITEM_TYPE_IPV4,
182 RTE_FLOW_ITEM_TYPE_UDP,
183 RTE_FLOW_ITEM_TYPE_GTPU,
184 RTE_FLOW_ITEM_TYPE_END,
187 static enum rte_flow_item_type pattern_fdir_ipv4_gtpu_ipv4[] = {
188 RTE_FLOW_ITEM_TYPE_ETH,
189 RTE_FLOW_ITEM_TYPE_IPV4,
190 RTE_FLOW_ITEM_TYPE_UDP,
191 RTE_FLOW_ITEM_TYPE_GTPU,
192 RTE_FLOW_ITEM_TYPE_IPV4,
193 RTE_FLOW_ITEM_TYPE_END,
196 static enum rte_flow_item_type pattern_fdir_ipv4_gtpu_ipv6[] = {
197 RTE_FLOW_ITEM_TYPE_ETH,
198 RTE_FLOW_ITEM_TYPE_IPV4,
199 RTE_FLOW_ITEM_TYPE_UDP,
200 RTE_FLOW_ITEM_TYPE_GTPU,
201 RTE_FLOW_ITEM_TYPE_IPV6,
202 RTE_FLOW_ITEM_TYPE_END,
205 static enum rte_flow_item_type pattern_fdir_ipv6[] = {
206 RTE_FLOW_ITEM_TYPE_ETH,
207 RTE_FLOW_ITEM_TYPE_IPV6,
208 RTE_FLOW_ITEM_TYPE_END,
211 static enum rte_flow_item_type pattern_fdir_ipv6_udp[] = {
212 RTE_FLOW_ITEM_TYPE_ETH,
213 RTE_FLOW_ITEM_TYPE_IPV6,
214 RTE_FLOW_ITEM_TYPE_UDP,
215 RTE_FLOW_ITEM_TYPE_END,
218 static enum rte_flow_item_type pattern_fdir_ipv6_tcp[] = {
219 RTE_FLOW_ITEM_TYPE_ETH,
220 RTE_FLOW_ITEM_TYPE_IPV6,
221 RTE_FLOW_ITEM_TYPE_TCP,
222 RTE_FLOW_ITEM_TYPE_END,
225 static enum rte_flow_item_type pattern_fdir_ipv6_sctp[] = {
226 RTE_FLOW_ITEM_TYPE_ETH,
227 RTE_FLOW_ITEM_TYPE_IPV6,
228 RTE_FLOW_ITEM_TYPE_SCTP,
229 RTE_FLOW_ITEM_TYPE_END,
232 static enum rte_flow_item_type pattern_fdir_ipv6_gtpc[] = {
233 RTE_FLOW_ITEM_TYPE_ETH,
234 RTE_FLOW_ITEM_TYPE_IPV6,
235 RTE_FLOW_ITEM_TYPE_UDP,
236 RTE_FLOW_ITEM_TYPE_GTPC,
237 RTE_FLOW_ITEM_TYPE_END,
240 static enum rte_flow_item_type pattern_fdir_ipv6_gtpu[] = {
241 RTE_FLOW_ITEM_TYPE_ETH,
242 RTE_FLOW_ITEM_TYPE_IPV6,
243 RTE_FLOW_ITEM_TYPE_UDP,
244 RTE_FLOW_ITEM_TYPE_GTPU,
245 RTE_FLOW_ITEM_TYPE_END,
248 static enum rte_flow_item_type pattern_fdir_ipv6_gtpu_ipv4[] = {
249 RTE_FLOW_ITEM_TYPE_ETH,
250 RTE_FLOW_ITEM_TYPE_IPV6,
251 RTE_FLOW_ITEM_TYPE_UDP,
252 RTE_FLOW_ITEM_TYPE_GTPU,
253 RTE_FLOW_ITEM_TYPE_IPV4,
254 RTE_FLOW_ITEM_TYPE_END,
257 static enum rte_flow_item_type pattern_fdir_ipv6_gtpu_ipv6[] = {
258 RTE_FLOW_ITEM_TYPE_ETH,
259 RTE_FLOW_ITEM_TYPE_IPV6,
260 RTE_FLOW_ITEM_TYPE_UDP,
261 RTE_FLOW_ITEM_TYPE_GTPU,
262 RTE_FLOW_ITEM_TYPE_IPV6,
263 RTE_FLOW_ITEM_TYPE_END,
266 static enum rte_flow_item_type pattern_fdir_ethertype_raw_1[] = {
267 RTE_FLOW_ITEM_TYPE_ETH,
268 RTE_FLOW_ITEM_TYPE_RAW,
269 RTE_FLOW_ITEM_TYPE_END,
272 static enum rte_flow_item_type pattern_fdir_ethertype_raw_2[] = {
273 RTE_FLOW_ITEM_TYPE_ETH,
274 RTE_FLOW_ITEM_TYPE_RAW,
275 RTE_FLOW_ITEM_TYPE_RAW,
276 RTE_FLOW_ITEM_TYPE_END,
279 static enum rte_flow_item_type pattern_fdir_ethertype_raw_3[] = {
280 RTE_FLOW_ITEM_TYPE_ETH,
281 RTE_FLOW_ITEM_TYPE_RAW,
282 RTE_FLOW_ITEM_TYPE_RAW,
283 RTE_FLOW_ITEM_TYPE_RAW,
284 RTE_FLOW_ITEM_TYPE_END,
287 static enum rte_flow_item_type pattern_fdir_ipv4_raw_1[] = {
288 RTE_FLOW_ITEM_TYPE_ETH,
289 RTE_FLOW_ITEM_TYPE_IPV4,
290 RTE_FLOW_ITEM_TYPE_RAW,
291 RTE_FLOW_ITEM_TYPE_END,
294 static enum rte_flow_item_type pattern_fdir_ipv4_raw_2[] = {
295 RTE_FLOW_ITEM_TYPE_ETH,
296 RTE_FLOW_ITEM_TYPE_IPV4,
297 RTE_FLOW_ITEM_TYPE_RAW,
298 RTE_FLOW_ITEM_TYPE_RAW,
299 RTE_FLOW_ITEM_TYPE_END,
302 static enum rte_flow_item_type pattern_fdir_ipv4_raw_3[] = {
303 RTE_FLOW_ITEM_TYPE_ETH,
304 RTE_FLOW_ITEM_TYPE_IPV4,
305 RTE_FLOW_ITEM_TYPE_RAW,
306 RTE_FLOW_ITEM_TYPE_RAW,
307 RTE_FLOW_ITEM_TYPE_RAW,
308 RTE_FLOW_ITEM_TYPE_END,
311 static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_1[] = {
312 RTE_FLOW_ITEM_TYPE_ETH,
313 RTE_FLOW_ITEM_TYPE_IPV4,
314 RTE_FLOW_ITEM_TYPE_UDP,
315 RTE_FLOW_ITEM_TYPE_RAW,
316 RTE_FLOW_ITEM_TYPE_END,
319 static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_2[] = {
320 RTE_FLOW_ITEM_TYPE_ETH,
321 RTE_FLOW_ITEM_TYPE_IPV4,
322 RTE_FLOW_ITEM_TYPE_UDP,
323 RTE_FLOW_ITEM_TYPE_RAW,
324 RTE_FLOW_ITEM_TYPE_RAW,
325 RTE_FLOW_ITEM_TYPE_END,
328 static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_3[] = {
329 RTE_FLOW_ITEM_TYPE_ETH,
330 RTE_FLOW_ITEM_TYPE_IPV4,
331 RTE_FLOW_ITEM_TYPE_UDP,
332 RTE_FLOW_ITEM_TYPE_RAW,
333 RTE_FLOW_ITEM_TYPE_RAW,
334 RTE_FLOW_ITEM_TYPE_RAW,
335 RTE_FLOW_ITEM_TYPE_END,
338 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_1[] = {
339 RTE_FLOW_ITEM_TYPE_ETH,
340 RTE_FLOW_ITEM_TYPE_IPV4,
341 RTE_FLOW_ITEM_TYPE_TCP,
342 RTE_FLOW_ITEM_TYPE_RAW,
343 RTE_FLOW_ITEM_TYPE_END,
346 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_2[] = {
347 RTE_FLOW_ITEM_TYPE_ETH,
348 RTE_FLOW_ITEM_TYPE_IPV4,
349 RTE_FLOW_ITEM_TYPE_TCP,
350 RTE_FLOW_ITEM_TYPE_RAW,
351 RTE_FLOW_ITEM_TYPE_RAW,
352 RTE_FLOW_ITEM_TYPE_END,
355 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_3[] = {
356 RTE_FLOW_ITEM_TYPE_ETH,
357 RTE_FLOW_ITEM_TYPE_IPV4,
358 RTE_FLOW_ITEM_TYPE_TCP,
359 RTE_FLOW_ITEM_TYPE_RAW,
360 RTE_FLOW_ITEM_TYPE_RAW,
361 RTE_FLOW_ITEM_TYPE_RAW,
362 RTE_FLOW_ITEM_TYPE_END,
365 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_1[] = {
366 RTE_FLOW_ITEM_TYPE_ETH,
367 RTE_FLOW_ITEM_TYPE_IPV4,
368 RTE_FLOW_ITEM_TYPE_SCTP,
369 RTE_FLOW_ITEM_TYPE_RAW,
370 RTE_FLOW_ITEM_TYPE_END,
373 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_2[] = {
374 RTE_FLOW_ITEM_TYPE_ETH,
375 RTE_FLOW_ITEM_TYPE_IPV4,
376 RTE_FLOW_ITEM_TYPE_SCTP,
377 RTE_FLOW_ITEM_TYPE_RAW,
378 RTE_FLOW_ITEM_TYPE_RAW,
379 RTE_FLOW_ITEM_TYPE_END,
382 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_3[] = {
383 RTE_FLOW_ITEM_TYPE_ETH,
384 RTE_FLOW_ITEM_TYPE_IPV4,
385 RTE_FLOW_ITEM_TYPE_SCTP,
386 RTE_FLOW_ITEM_TYPE_RAW,
387 RTE_FLOW_ITEM_TYPE_RAW,
388 RTE_FLOW_ITEM_TYPE_RAW,
389 RTE_FLOW_ITEM_TYPE_END,
392 static enum rte_flow_item_type pattern_fdir_ipv6_raw_1[] = {
393 RTE_FLOW_ITEM_TYPE_ETH,
394 RTE_FLOW_ITEM_TYPE_IPV6,
395 RTE_FLOW_ITEM_TYPE_RAW,
396 RTE_FLOW_ITEM_TYPE_END,
399 static enum rte_flow_item_type pattern_fdir_ipv6_raw_2[] = {
400 RTE_FLOW_ITEM_TYPE_ETH,
401 RTE_FLOW_ITEM_TYPE_IPV6,
402 RTE_FLOW_ITEM_TYPE_RAW,
403 RTE_FLOW_ITEM_TYPE_RAW,
404 RTE_FLOW_ITEM_TYPE_END,
407 static enum rte_flow_item_type pattern_fdir_ipv6_raw_3[] = {
408 RTE_FLOW_ITEM_TYPE_ETH,
409 RTE_FLOW_ITEM_TYPE_IPV6,
410 RTE_FLOW_ITEM_TYPE_RAW,
411 RTE_FLOW_ITEM_TYPE_RAW,
412 RTE_FLOW_ITEM_TYPE_RAW,
413 RTE_FLOW_ITEM_TYPE_END,
416 static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_1[] = {
417 RTE_FLOW_ITEM_TYPE_ETH,
418 RTE_FLOW_ITEM_TYPE_IPV6,
419 RTE_FLOW_ITEM_TYPE_UDP,
420 RTE_FLOW_ITEM_TYPE_RAW,
421 RTE_FLOW_ITEM_TYPE_END,
424 static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_2[] = {
425 RTE_FLOW_ITEM_TYPE_ETH,
426 RTE_FLOW_ITEM_TYPE_IPV6,
427 RTE_FLOW_ITEM_TYPE_UDP,
428 RTE_FLOW_ITEM_TYPE_RAW,
429 RTE_FLOW_ITEM_TYPE_RAW,
430 RTE_FLOW_ITEM_TYPE_END,
433 static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_3[] = {
434 RTE_FLOW_ITEM_TYPE_ETH,
435 RTE_FLOW_ITEM_TYPE_IPV6,
436 RTE_FLOW_ITEM_TYPE_UDP,
437 RTE_FLOW_ITEM_TYPE_RAW,
438 RTE_FLOW_ITEM_TYPE_RAW,
439 RTE_FLOW_ITEM_TYPE_RAW,
440 RTE_FLOW_ITEM_TYPE_END,
443 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_1[] = {
444 RTE_FLOW_ITEM_TYPE_ETH,
445 RTE_FLOW_ITEM_TYPE_IPV6,
446 RTE_FLOW_ITEM_TYPE_TCP,
447 RTE_FLOW_ITEM_TYPE_RAW,
448 RTE_FLOW_ITEM_TYPE_END,
451 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_2[] = {
452 RTE_FLOW_ITEM_TYPE_ETH,
453 RTE_FLOW_ITEM_TYPE_IPV6,
454 RTE_FLOW_ITEM_TYPE_TCP,
455 RTE_FLOW_ITEM_TYPE_RAW,
456 RTE_FLOW_ITEM_TYPE_RAW,
457 RTE_FLOW_ITEM_TYPE_END,
460 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_3[] = {
461 RTE_FLOW_ITEM_TYPE_ETH,
462 RTE_FLOW_ITEM_TYPE_IPV6,
463 RTE_FLOW_ITEM_TYPE_TCP,
464 RTE_FLOW_ITEM_TYPE_RAW,
465 RTE_FLOW_ITEM_TYPE_RAW,
466 RTE_FLOW_ITEM_TYPE_RAW,
467 RTE_FLOW_ITEM_TYPE_END,
470 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_1[] = {
471 RTE_FLOW_ITEM_TYPE_ETH,
472 RTE_FLOW_ITEM_TYPE_IPV6,
473 RTE_FLOW_ITEM_TYPE_SCTP,
474 RTE_FLOW_ITEM_TYPE_RAW,
475 RTE_FLOW_ITEM_TYPE_END,
478 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_2[] = {
479 RTE_FLOW_ITEM_TYPE_ETH,
480 RTE_FLOW_ITEM_TYPE_IPV6,
481 RTE_FLOW_ITEM_TYPE_SCTP,
482 RTE_FLOW_ITEM_TYPE_RAW,
483 RTE_FLOW_ITEM_TYPE_RAW,
484 RTE_FLOW_ITEM_TYPE_END,
487 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_3[] = {
488 RTE_FLOW_ITEM_TYPE_ETH,
489 RTE_FLOW_ITEM_TYPE_IPV6,
490 RTE_FLOW_ITEM_TYPE_SCTP,
491 RTE_FLOW_ITEM_TYPE_RAW,
492 RTE_FLOW_ITEM_TYPE_RAW,
493 RTE_FLOW_ITEM_TYPE_RAW,
494 RTE_FLOW_ITEM_TYPE_END,
497 static enum rte_flow_item_type pattern_fdir_ethertype_vlan[] = {
498 RTE_FLOW_ITEM_TYPE_ETH,
499 RTE_FLOW_ITEM_TYPE_VLAN,
500 RTE_FLOW_ITEM_TYPE_END,
503 static enum rte_flow_item_type pattern_fdir_vlan_ipv4[] = {
504 RTE_FLOW_ITEM_TYPE_ETH,
505 RTE_FLOW_ITEM_TYPE_VLAN,
506 RTE_FLOW_ITEM_TYPE_IPV4,
507 RTE_FLOW_ITEM_TYPE_END,
510 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp[] = {
511 RTE_FLOW_ITEM_TYPE_ETH,
512 RTE_FLOW_ITEM_TYPE_VLAN,
513 RTE_FLOW_ITEM_TYPE_IPV4,
514 RTE_FLOW_ITEM_TYPE_UDP,
515 RTE_FLOW_ITEM_TYPE_END,
518 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp[] = {
519 RTE_FLOW_ITEM_TYPE_ETH,
520 RTE_FLOW_ITEM_TYPE_VLAN,
521 RTE_FLOW_ITEM_TYPE_IPV4,
522 RTE_FLOW_ITEM_TYPE_TCP,
523 RTE_FLOW_ITEM_TYPE_END,
526 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp[] = {
527 RTE_FLOW_ITEM_TYPE_ETH,
528 RTE_FLOW_ITEM_TYPE_VLAN,
529 RTE_FLOW_ITEM_TYPE_IPV4,
530 RTE_FLOW_ITEM_TYPE_SCTP,
531 RTE_FLOW_ITEM_TYPE_END,
534 static enum rte_flow_item_type pattern_fdir_vlan_ipv6[] = {
535 RTE_FLOW_ITEM_TYPE_ETH,
536 RTE_FLOW_ITEM_TYPE_VLAN,
537 RTE_FLOW_ITEM_TYPE_IPV6,
538 RTE_FLOW_ITEM_TYPE_END,
541 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp[] = {
542 RTE_FLOW_ITEM_TYPE_ETH,
543 RTE_FLOW_ITEM_TYPE_VLAN,
544 RTE_FLOW_ITEM_TYPE_IPV6,
545 RTE_FLOW_ITEM_TYPE_UDP,
546 RTE_FLOW_ITEM_TYPE_END,
549 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp[] = {
550 RTE_FLOW_ITEM_TYPE_ETH,
551 RTE_FLOW_ITEM_TYPE_VLAN,
552 RTE_FLOW_ITEM_TYPE_IPV6,
553 RTE_FLOW_ITEM_TYPE_TCP,
554 RTE_FLOW_ITEM_TYPE_END,
557 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp[] = {
558 RTE_FLOW_ITEM_TYPE_ETH,
559 RTE_FLOW_ITEM_TYPE_VLAN,
560 RTE_FLOW_ITEM_TYPE_IPV6,
561 RTE_FLOW_ITEM_TYPE_SCTP,
562 RTE_FLOW_ITEM_TYPE_END,
565 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_1[] = {
566 RTE_FLOW_ITEM_TYPE_ETH,
567 RTE_FLOW_ITEM_TYPE_VLAN,
568 RTE_FLOW_ITEM_TYPE_RAW,
569 RTE_FLOW_ITEM_TYPE_END,
572 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_2[] = {
573 RTE_FLOW_ITEM_TYPE_ETH,
574 RTE_FLOW_ITEM_TYPE_VLAN,
575 RTE_FLOW_ITEM_TYPE_RAW,
576 RTE_FLOW_ITEM_TYPE_RAW,
577 RTE_FLOW_ITEM_TYPE_END,
580 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_3[] = {
581 RTE_FLOW_ITEM_TYPE_ETH,
582 RTE_FLOW_ITEM_TYPE_VLAN,
583 RTE_FLOW_ITEM_TYPE_RAW,
584 RTE_FLOW_ITEM_TYPE_RAW,
585 RTE_FLOW_ITEM_TYPE_RAW,
586 RTE_FLOW_ITEM_TYPE_END,
589 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_1[] = {
590 RTE_FLOW_ITEM_TYPE_ETH,
591 RTE_FLOW_ITEM_TYPE_VLAN,
592 RTE_FLOW_ITEM_TYPE_IPV4,
593 RTE_FLOW_ITEM_TYPE_RAW,
594 RTE_FLOW_ITEM_TYPE_END,
597 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_2[] = {
598 RTE_FLOW_ITEM_TYPE_ETH,
599 RTE_FLOW_ITEM_TYPE_VLAN,
600 RTE_FLOW_ITEM_TYPE_IPV4,
601 RTE_FLOW_ITEM_TYPE_RAW,
602 RTE_FLOW_ITEM_TYPE_RAW,
603 RTE_FLOW_ITEM_TYPE_END,
606 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_3[] = {
607 RTE_FLOW_ITEM_TYPE_ETH,
608 RTE_FLOW_ITEM_TYPE_VLAN,
609 RTE_FLOW_ITEM_TYPE_IPV4,
610 RTE_FLOW_ITEM_TYPE_RAW,
611 RTE_FLOW_ITEM_TYPE_RAW,
612 RTE_FLOW_ITEM_TYPE_RAW,
613 RTE_FLOW_ITEM_TYPE_END,
616 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_1[] = {
617 RTE_FLOW_ITEM_TYPE_ETH,
618 RTE_FLOW_ITEM_TYPE_VLAN,
619 RTE_FLOW_ITEM_TYPE_IPV4,
620 RTE_FLOW_ITEM_TYPE_UDP,
621 RTE_FLOW_ITEM_TYPE_RAW,
622 RTE_FLOW_ITEM_TYPE_END,
625 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_2[] = {
626 RTE_FLOW_ITEM_TYPE_ETH,
627 RTE_FLOW_ITEM_TYPE_VLAN,
628 RTE_FLOW_ITEM_TYPE_IPV4,
629 RTE_FLOW_ITEM_TYPE_UDP,
630 RTE_FLOW_ITEM_TYPE_RAW,
631 RTE_FLOW_ITEM_TYPE_RAW,
632 RTE_FLOW_ITEM_TYPE_END,
635 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_3[] = {
636 RTE_FLOW_ITEM_TYPE_ETH,
637 RTE_FLOW_ITEM_TYPE_VLAN,
638 RTE_FLOW_ITEM_TYPE_IPV4,
639 RTE_FLOW_ITEM_TYPE_UDP,
640 RTE_FLOW_ITEM_TYPE_RAW,
641 RTE_FLOW_ITEM_TYPE_RAW,
642 RTE_FLOW_ITEM_TYPE_RAW,
643 RTE_FLOW_ITEM_TYPE_END,
646 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_1[] = {
647 RTE_FLOW_ITEM_TYPE_ETH,
648 RTE_FLOW_ITEM_TYPE_VLAN,
649 RTE_FLOW_ITEM_TYPE_IPV4,
650 RTE_FLOW_ITEM_TYPE_TCP,
651 RTE_FLOW_ITEM_TYPE_RAW,
652 RTE_FLOW_ITEM_TYPE_END,
655 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_2[] = {
656 RTE_FLOW_ITEM_TYPE_ETH,
657 RTE_FLOW_ITEM_TYPE_VLAN,
658 RTE_FLOW_ITEM_TYPE_IPV4,
659 RTE_FLOW_ITEM_TYPE_TCP,
660 RTE_FLOW_ITEM_TYPE_RAW,
661 RTE_FLOW_ITEM_TYPE_RAW,
662 RTE_FLOW_ITEM_TYPE_END,
665 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_3[] = {
666 RTE_FLOW_ITEM_TYPE_ETH,
667 RTE_FLOW_ITEM_TYPE_VLAN,
668 RTE_FLOW_ITEM_TYPE_IPV4,
669 RTE_FLOW_ITEM_TYPE_TCP,
670 RTE_FLOW_ITEM_TYPE_RAW,
671 RTE_FLOW_ITEM_TYPE_RAW,
672 RTE_FLOW_ITEM_TYPE_RAW,
673 RTE_FLOW_ITEM_TYPE_END,
676 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_1[] = {
677 RTE_FLOW_ITEM_TYPE_ETH,
678 RTE_FLOW_ITEM_TYPE_VLAN,
679 RTE_FLOW_ITEM_TYPE_IPV4,
680 RTE_FLOW_ITEM_TYPE_SCTP,
681 RTE_FLOW_ITEM_TYPE_RAW,
682 RTE_FLOW_ITEM_TYPE_END,
685 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_2[] = {
686 RTE_FLOW_ITEM_TYPE_ETH,
687 RTE_FLOW_ITEM_TYPE_VLAN,
688 RTE_FLOW_ITEM_TYPE_IPV4,
689 RTE_FLOW_ITEM_TYPE_SCTP,
690 RTE_FLOW_ITEM_TYPE_RAW,
691 RTE_FLOW_ITEM_TYPE_RAW,
692 RTE_FLOW_ITEM_TYPE_END,
695 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_3[] = {
696 RTE_FLOW_ITEM_TYPE_ETH,
697 RTE_FLOW_ITEM_TYPE_VLAN,
698 RTE_FLOW_ITEM_TYPE_IPV4,
699 RTE_FLOW_ITEM_TYPE_SCTP,
700 RTE_FLOW_ITEM_TYPE_RAW,
701 RTE_FLOW_ITEM_TYPE_RAW,
702 RTE_FLOW_ITEM_TYPE_RAW,
703 RTE_FLOW_ITEM_TYPE_END,
706 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_1[] = {
707 RTE_FLOW_ITEM_TYPE_ETH,
708 RTE_FLOW_ITEM_TYPE_VLAN,
709 RTE_FLOW_ITEM_TYPE_IPV6,
710 RTE_FLOW_ITEM_TYPE_RAW,
711 RTE_FLOW_ITEM_TYPE_END,
714 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_2[] = {
715 RTE_FLOW_ITEM_TYPE_ETH,
716 RTE_FLOW_ITEM_TYPE_VLAN,
717 RTE_FLOW_ITEM_TYPE_IPV6,
718 RTE_FLOW_ITEM_TYPE_RAW,
719 RTE_FLOW_ITEM_TYPE_RAW,
720 RTE_FLOW_ITEM_TYPE_END,
723 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_3[] = {
724 RTE_FLOW_ITEM_TYPE_ETH,
725 RTE_FLOW_ITEM_TYPE_VLAN,
726 RTE_FLOW_ITEM_TYPE_IPV6,
727 RTE_FLOW_ITEM_TYPE_RAW,
728 RTE_FLOW_ITEM_TYPE_RAW,
729 RTE_FLOW_ITEM_TYPE_RAW,
730 RTE_FLOW_ITEM_TYPE_END,
733 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_1[] = {
734 RTE_FLOW_ITEM_TYPE_ETH,
735 RTE_FLOW_ITEM_TYPE_VLAN,
736 RTE_FLOW_ITEM_TYPE_IPV6,
737 RTE_FLOW_ITEM_TYPE_UDP,
738 RTE_FLOW_ITEM_TYPE_RAW,
739 RTE_FLOW_ITEM_TYPE_END,
742 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_2[] = {
743 RTE_FLOW_ITEM_TYPE_ETH,
744 RTE_FLOW_ITEM_TYPE_VLAN,
745 RTE_FLOW_ITEM_TYPE_IPV6,
746 RTE_FLOW_ITEM_TYPE_UDP,
747 RTE_FLOW_ITEM_TYPE_RAW,
748 RTE_FLOW_ITEM_TYPE_RAW,
749 RTE_FLOW_ITEM_TYPE_END,
752 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_3[] = {
753 RTE_FLOW_ITEM_TYPE_ETH,
754 RTE_FLOW_ITEM_TYPE_VLAN,
755 RTE_FLOW_ITEM_TYPE_IPV6,
756 RTE_FLOW_ITEM_TYPE_UDP,
757 RTE_FLOW_ITEM_TYPE_RAW,
758 RTE_FLOW_ITEM_TYPE_RAW,
759 RTE_FLOW_ITEM_TYPE_RAW,
760 RTE_FLOW_ITEM_TYPE_END,
763 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_1[] = {
764 RTE_FLOW_ITEM_TYPE_ETH,
765 RTE_FLOW_ITEM_TYPE_VLAN,
766 RTE_FLOW_ITEM_TYPE_IPV6,
767 RTE_FLOW_ITEM_TYPE_TCP,
768 RTE_FLOW_ITEM_TYPE_RAW,
769 RTE_FLOW_ITEM_TYPE_END,
772 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_2[] = {
773 RTE_FLOW_ITEM_TYPE_ETH,
774 RTE_FLOW_ITEM_TYPE_VLAN,
775 RTE_FLOW_ITEM_TYPE_IPV6,
776 RTE_FLOW_ITEM_TYPE_TCP,
777 RTE_FLOW_ITEM_TYPE_RAW,
778 RTE_FLOW_ITEM_TYPE_RAW,
779 RTE_FLOW_ITEM_TYPE_END,
782 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_3[] = {
783 RTE_FLOW_ITEM_TYPE_ETH,
784 RTE_FLOW_ITEM_TYPE_VLAN,
785 RTE_FLOW_ITEM_TYPE_IPV6,
786 RTE_FLOW_ITEM_TYPE_TCP,
787 RTE_FLOW_ITEM_TYPE_RAW,
788 RTE_FLOW_ITEM_TYPE_RAW,
789 RTE_FLOW_ITEM_TYPE_RAW,
790 RTE_FLOW_ITEM_TYPE_END,
793 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_1[] = {
794 RTE_FLOW_ITEM_TYPE_ETH,
795 RTE_FLOW_ITEM_TYPE_VLAN,
796 RTE_FLOW_ITEM_TYPE_IPV6,
797 RTE_FLOW_ITEM_TYPE_SCTP,
798 RTE_FLOW_ITEM_TYPE_RAW,
799 RTE_FLOW_ITEM_TYPE_END,
802 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_2[] = {
803 RTE_FLOW_ITEM_TYPE_ETH,
804 RTE_FLOW_ITEM_TYPE_VLAN,
805 RTE_FLOW_ITEM_TYPE_IPV6,
806 RTE_FLOW_ITEM_TYPE_SCTP,
807 RTE_FLOW_ITEM_TYPE_RAW,
808 RTE_FLOW_ITEM_TYPE_RAW,
809 RTE_FLOW_ITEM_TYPE_END,
812 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_3[] = {
813 RTE_FLOW_ITEM_TYPE_ETH,
814 RTE_FLOW_ITEM_TYPE_VLAN,
815 RTE_FLOW_ITEM_TYPE_IPV6,
816 RTE_FLOW_ITEM_TYPE_SCTP,
817 RTE_FLOW_ITEM_TYPE_RAW,
818 RTE_FLOW_ITEM_TYPE_RAW,
819 RTE_FLOW_ITEM_TYPE_RAW,
820 RTE_FLOW_ITEM_TYPE_END,
823 static enum rte_flow_item_type pattern_fdir_ipv4_vf[] = {
824 RTE_FLOW_ITEM_TYPE_ETH,
825 RTE_FLOW_ITEM_TYPE_IPV4,
826 RTE_FLOW_ITEM_TYPE_VF,
827 RTE_FLOW_ITEM_TYPE_END,
830 static enum rte_flow_item_type pattern_fdir_ipv4_udp_vf[] = {
831 RTE_FLOW_ITEM_TYPE_ETH,
832 RTE_FLOW_ITEM_TYPE_IPV4,
833 RTE_FLOW_ITEM_TYPE_UDP,
834 RTE_FLOW_ITEM_TYPE_VF,
835 RTE_FLOW_ITEM_TYPE_END,
838 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_vf[] = {
839 RTE_FLOW_ITEM_TYPE_ETH,
840 RTE_FLOW_ITEM_TYPE_IPV4,
841 RTE_FLOW_ITEM_TYPE_TCP,
842 RTE_FLOW_ITEM_TYPE_VF,
843 RTE_FLOW_ITEM_TYPE_END,
846 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_vf[] = {
847 RTE_FLOW_ITEM_TYPE_ETH,
848 RTE_FLOW_ITEM_TYPE_IPV4,
849 RTE_FLOW_ITEM_TYPE_SCTP,
850 RTE_FLOW_ITEM_TYPE_VF,
851 RTE_FLOW_ITEM_TYPE_END,
854 static enum rte_flow_item_type pattern_fdir_ipv6_vf[] = {
855 RTE_FLOW_ITEM_TYPE_ETH,
856 RTE_FLOW_ITEM_TYPE_IPV6,
857 RTE_FLOW_ITEM_TYPE_VF,
858 RTE_FLOW_ITEM_TYPE_END,
861 static enum rte_flow_item_type pattern_fdir_ipv6_udp_vf[] = {
862 RTE_FLOW_ITEM_TYPE_ETH,
863 RTE_FLOW_ITEM_TYPE_IPV6,
864 RTE_FLOW_ITEM_TYPE_UDP,
865 RTE_FLOW_ITEM_TYPE_VF,
866 RTE_FLOW_ITEM_TYPE_END,
869 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_vf[] = {
870 RTE_FLOW_ITEM_TYPE_ETH,
871 RTE_FLOW_ITEM_TYPE_IPV6,
872 RTE_FLOW_ITEM_TYPE_TCP,
873 RTE_FLOW_ITEM_TYPE_VF,
874 RTE_FLOW_ITEM_TYPE_END,
877 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_vf[] = {
878 RTE_FLOW_ITEM_TYPE_ETH,
879 RTE_FLOW_ITEM_TYPE_IPV6,
880 RTE_FLOW_ITEM_TYPE_SCTP,
881 RTE_FLOW_ITEM_TYPE_VF,
882 RTE_FLOW_ITEM_TYPE_END,
885 static enum rte_flow_item_type pattern_fdir_ethertype_raw_1_vf[] = {
886 RTE_FLOW_ITEM_TYPE_ETH,
887 RTE_FLOW_ITEM_TYPE_RAW,
888 RTE_FLOW_ITEM_TYPE_VF,
889 RTE_FLOW_ITEM_TYPE_END,
892 static enum rte_flow_item_type pattern_fdir_ethertype_raw_2_vf[] = {
893 RTE_FLOW_ITEM_TYPE_ETH,
894 RTE_FLOW_ITEM_TYPE_RAW,
895 RTE_FLOW_ITEM_TYPE_RAW,
896 RTE_FLOW_ITEM_TYPE_VF,
897 RTE_FLOW_ITEM_TYPE_END,
900 static enum rte_flow_item_type pattern_fdir_ethertype_raw_3_vf[] = {
901 RTE_FLOW_ITEM_TYPE_ETH,
902 RTE_FLOW_ITEM_TYPE_RAW,
903 RTE_FLOW_ITEM_TYPE_RAW,
904 RTE_FLOW_ITEM_TYPE_RAW,
905 RTE_FLOW_ITEM_TYPE_VF,
906 RTE_FLOW_ITEM_TYPE_END,
909 static enum rte_flow_item_type pattern_fdir_ipv4_raw_1_vf[] = {
910 RTE_FLOW_ITEM_TYPE_ETH,
911 RTE_FLOW_ITEM_TYPE_IPV4,
912 RTE_FLOW_ITEM_TYPE_RAW,
913 RTE_FLOW_ITEM_TYPE_VF,
914 RTE_FLOW_ITEM_TYPE_END,
917 static enum rte_flow_item_type pattern_fdir_ipv4_raw_2_vf[] = {
918 RTE_FLOW_ITEM_TYPE_ETH,
919 RTE_FLOW_ITEM_TYPE_IPV4,
920 RTE_FLOW_ITEM_TYPE_RAW,
921 RTE_FLOW_ITEM_TYPE_RAW,
922 RTE_FLOW_ITEM_TYPE_VF,
923 RTE_FLOW_ITEM_TYPE_END,
926 static enum rte_flow_item_type pattern_fdir_ipv4_raw_3_vf[] = {
927 RTE_FLOW_ITEM_TYPE_ETH,
928 RTE_FLOW_ITEM_TYPE_IPV4,
929 RTE_FLOW_ITEM_TYPE_RAW,
930 RTE_FLOW_ITEM_TYPE_RAW,
931 RTE_FLOW_ITEM_TYPE_RAW,
932 RTE_FLOW_ITEM_TYPE_VF,
933 RTE_FLOW_ITEM_TYPE_END,
936 static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_1_vf[] = {
937 RTE_FLOW_ITEM_TYPE_ETH,
938 RTE_FLOW_ITEM_TYPE_IPV4,
939 RTE_FLOW_ITEM_TYPE_UDP,
940 RTE_FLOW_ITEM_TYPE_RAW,
941 RTE_FLOW_ITEM_TYPE_VF,
942 RTE_FLOW_ITEM_TYPE_END,
945 static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_2_vf[] = {
946 RTE_FLOW_ITEM_TYPE_ETH,
947 RTE_FLOW_ITEM_TYPE_IPV4,
948 RTE_FLOW_ITEM_TYPE_UDP,
949 RTE_FLOW_ITEM_TYPE_RAW,
950 RTE_FLOW_ITEM_TYPE_RAW,
951 RTE_FLOW_ITEM_TYPE_VF,
952 RTE_FLOW_ITEM_TYPE_END,
955 static enum rte_flow_item_type pattern_fdir_ipv4_udp_raw_3_vf[] = {
956 RTE_FLOW_ITEM_TYPE_ETH,
957 RTE_FLOW_ITEM_TYPE_IPV4,
958 RTE_FLOW_ITEM_TYPE_UDP,
959 RTE_FLOW_ITEM_TYPE_RAW,
960 RTE_FLOW_ITEM_TYPE_RAW,
961 RTE_FLOW_ITEM_TYPE_RAW,
962 RTE_FLOW_ITEM_TYPE_VF,
963 RTE_FLOW_ITEM_TYPE_END,
966 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_1_vf[] = {
967 RTE_FLOW_ITEM_TYPE_ETH,
968 RTE_FLOW_ITEM_TYPE_IPV4,
969 RTE_FLOW_ITEM_TYPE_TCP,
970 RTE_FLOW_ITEM_TYPE_RAW,
971 RTE_FLOW_ITEM_TYPE_VF,
972 RTE_FLOW_ITEM_TYPE_END,
975 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_2_vf[] = {
976 RTE_FLOW_ITEM_TYPE_ETH,
977 RTE_FLOW_ITEM_TYPE_IPV4,
978 RTE_FLOW_ITEM_TYPE_TCP,
979 RTE_FLOW_ITEM_TYPE_RAW,
980 RTE_FLOW_ITEM_TYPE_RAW,
981 RTE_FLOW_ITEM_TYPE_VF,
982 RTE_FLOW_ITEM_TYPE_END,
985 static enum rte_flow_item_type pattern_fdir_ipv4_tcp_raw_3_vf[] = {
986 RTE_FLOW_ITEM_TYPE_ETH,
987 RTE_FLOW_ITEM_TYPE_IPV4,
988 RTE_FLOW_ITEM_TYPE_TCP,
989 RTE_FLOW_ITEM_TYPE_RAW,
990 RTE_FLOW_ITEM_TYPE_RAW,
991 RTE_FLOW_ITEM_TYPE_RAW,
992 RTE_FLOW_ITEM_TYPE_VF,
993 RTE_FLOW_ITEM_TYPE_END,
996 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_1_vf[] = {
997 RTE_FLOW_ITEM_TYPE_ETH,
998 RTE_FLOW_ITEM_TYPE_IPV4,
999 RTE_FLOW_ITEM_TYPE_SCTP,
1000 RTE_FLOW_ITEM_TYPE_RAW,
1001 RTE_FLOW_ITEM_TYPE_VF,
1002 RTE_FLOW_ITEM_TYPE_END,
1005 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_2_vf[] = {
1006 RTE_FLOW_ITEM_TYPE_ETH,
1007 RTE_FLOW_ITEM_TYPE_IPV4,
1008 RTE_FLOW_ITEM_TYPE_SCTP,
1009 RTE_FLOW_ITEM_TYPE_RAW,
1010 RTE_FLOW_ITEM_TYPE_RAW,
1011 RTE_FLOW_ITEM_TYPE_VF,
1012 RTE_FLOW_ITEM_TYPE_END,
1015 static enum rte_flow_item_type pattern_fdir_ipv4_sctp_raw_3_vf[] = {
1016 RTE_FLOW_ITEM_TYPE_ETH,
1017 RTE_FLOW_ITEM_TYPE_IPV4,
1018 RTE_FLOW_ITEM_TYPE_SCTP,
1019 RTE_FLOW_ITEM_TYPE_RAW,
1020 RTE_FLOW_ITEM_TYPE_RAW,
1021 RTE_FLOW_ITEM_TYPE_RAW,
1022 RTE_FLOW_ITEM_TYPE_VF,
1023 RTE_FLOW_ITEM_TYPE_END,
1026 static enum rte_flow_item_type pattern_fdir_ipv6_raw_1_vf[] = {
1027 RTE_FLOW_ITEM_TYPE_ETH,
1028 RTE_FLOW_ITEM_TYPE_IPV6,
1029 RTE_FLOW_ITEM_TYPE_RAW,
1030 RTE_FLOW_ITEM_TYPE_VF,
1031 RTE_FLOW_ITEM_TYPE_END,
1034 static enum rte_flow_item_type pattern_fdir_ipv6_raw_2_vf[] = {
1035 RTE_FLOW_ITEM_TYPE_ETH,
1036 RTE_FLOW_ITEM_TYPE_IPV6,
1037 RTE_FLOW_ITEM_TYPE_RAW,
1038 RTE_FLOW_ITEM_TYPE_RAW,
1039 RTE_FLOW_ITEM_TYPE_VF,
1040 RTE_FLOW_ITEM_TYPE_END,
1043 static enum rte_flow_item_type pattern_fdir_ipv6_raw_3_vf[] = {
1044 RTE_FLOW_ITEM_TYPE_ETH,
1045 RTE_FLOW_ITEM_TYPE_IPV6,
1046 RTE_FLOW_ITEM_TYPE_RAW,
1047 RTE_FLOW_ITEM_TYPE_RAW,
1048 RTE_FLOW_ITEM_TYPE_RAW,
1049 RTE_FLOW_ITEM_TYPE_VF,
1050 RTE_FLOW_ITEM_TYPE_END,
1053 static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_1_vf[] = {
1054 RTE_FLOW_ITEM_TYPE_ETH,
1055 RTE_FLOW_ITEM_TYPE_IPV6,
1056 RTE_FLOW_ITEM_TYPE_UDP,
1057 RTE_FLOW_ITEM_TYPE_RAW,
1058 RTE_FLOW_ITEM_TYPE_VF,
1059 RTE_FLOW_ITEM_TYPE_END,
1062 static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_2_vf[] = {
1063 RTE_FLOW_ITEM_TYPE_ETH,
1064 RTE_FLOW_ITEM_TYPE_IPV6,
1065 RTE_FLOW_ITEM_TYPE_UDP,
1066 RTE_FLOW_ITEM_TYPE_RAW,
1067 RTE_FLOW_ITEM_TYPE_RAW,
1068 RTE_FLOW_ITEM_TYPE_VF,
1069 RTE_FLOW_ITEM_TYPE_END,
1072 static enum rte_flow_item_type pattern_fdir_ipv6_udp_raw_3_vf[] = {
1073 RTE_FLOW_ITEM_TYPE_ETH,
1074 RTE_FLOW_ITEM_TYPE_IPV6,
1075 RTE_FLOW_ITEM_TYPE_UDP,
1076 RTE_FLOW_ITEM_TYPE_RAW,
1077 RTE_FLOW_ITEM_TYPE_RAW,
1078 RTE_FLOW_ITEM_TYPE_RAW,
1079 RTE_FLOW_ITEM_TYPE_VF,
1080 RTE_FLOW_ITEM_TYPE_END,
1083 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_1_vf[] = {
1084 RTE_FLOW_ITEM_TYPE_ETH,
1085 RTE_FLOW_ITEM_TYPE_IPV6,
1086 RTE_FLOW_ITEM_TYPE_TCP,
1087 RTE_FLOW_ITEM_TYPE_RAW,
1088 RTE_FLOW_ITEM_TYPE_VF,
1089 RTE_FLOW_ITEM_TYPE_END,
1092 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_2_vf[] = {
1093 RTE_FLOW_ITEM_TYPE_ETH,
1094 RTE_FLOW_ITEM_TYPE_IPV6,
1095 RTE_FLOW_ITEM_TYPE_TCP,
1096 RTE_FLOW_ITEM_TYPE_RAW,
1097 RTE_FLOW_ITEM_TYPE_RAW,
1098 RTE_FLOW_ITEM_TYPE_VF,
1099 RTE_FLOW_ITEM_TYPE_END,
1102 static enum rte_flow_item_type pattern_fdir_ipv6_tcp_raw_3_vf[] = {
1103 RTE_FLOW_ITEM_TYPE_ETH,
1104 RTE_FLOW_ITEM_TYPE_IPV6,
1105 RTE_FLOW_ITEM_TYPE_TCP,
1106 RTE_FLOW_ITEM_TYPE_RAW,
1107 RTE_FLOW_ITEM_TYPE_RAW,
1108 RTE_FLOW_ITEM_TYPE_RAW,
1109 RTE_FLOW_ITEM_TYPE_VF,
1110 RTE_FLOW_ITEM_TYPE_END,
1113 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_1_vf[] = {
1114 RTE_FLOW_ITEM_TYPE_ETH,
1115 RTE_FLOW_ITEM_TYPE_IPV6,
1116 RTE_FLOW_ITEM_TYPE_SCTP,
1117 RTE_FLOW_ITEM_TYPE_RAW,
1118 RTE_FLOW_ITEM_TYPE_VF,
1119 RTE_FLOW_ITEM_TYPE_END,
1122 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_2_vf[] = {
1123 RTE_FLOW_ITEM_TYPE_ETH,
1124 RTE_FLOW_ITEM_TYPE_IPV6,
1125 RTE_FLOW_ITEM_TYPE_SCTP,
1126 RTE_FLOW_ITEM_TYPE_RAW,
1127 RTE_FLOW_ITEM_TYPE_RAW,
1128 RTE_FLOW_ITEM_TYPE_VF,
1129 RTE_FLOW_ITEM_TYPE_END,
1132 static enum rte_flow_item_type pattern_fdir_ipv6_sctp_raw_3_vf[] = {
1133 RTE_FLOW_ITEM_TYPE_ETH,
1134 RTE_FLOW_ITEM_TYPE_IPV6,
1135 RTE_FLOW_ITEM_TYPE_SCTP,
1136 RTE_FLOW_ITEM_TYPE_RAW,
1137 RTE_FLOW_ITEM_TYPE_RAW,
1138 RTE_FLOW_ITEM_TYPE_RAW,
1139 RTE_FLOW_ITEM_TYPE_VF,
1140 RTE_FLOW_ITEM_TYPE_END,
1143 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_vf[] = {
1144 RTE_FLOW_ITEM_TYPE_ETH,
1145 RTE_FLOW_ITEM_TYPE_VLAN,
1146 RTE_FLOW_ITEM_TYPE_VF,
1147 RTE_FLOW_ITEM_TYPE_END,
1150 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_vf[] = {
1151 RTE_FLOW_ITEM_TYPE_ETH,
1152 RTE_FLOW_ITEM_TYPE_VLAN,
1153 RTE_FLOW_ITEM_TYPE_IPV4,
1154 RTE_FLOW_ITEM_TYPE_VF,
1155 RTE_FLOW_ITEM_TYPE_END,
1158 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_vf[] = {
1159 RTE_FLOW_ITEM_TYPE_ETH,
1160 RTE_FLOW_ITEM_TYPE_VLAN,
1161 RTE_FLOW_ITEM_TYPE_IPV4,
1162 RTE_FLOW_ITEM_TYPE_UDP,
1163 RTE_FLOW_ITEM_TYPE_VF,
1164 RTE_FLOW_ITEM_TYPE_END,
1167 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_vf[] = {
1168 RTE_FLOW_ITEM_TYPE_ETH,
1169 RTE_FLOW_ITEM_TYPE_VLAN,
1170 RTE_FLOW_ITEM_TYPE_IPV4,
1171 RTE_FLOW_ITEM_TYPE_TCP,
1172 RTE_FLOW_ITEM_TYPE_VF,
1173 RTE_FLOW_ITEM_TYPE_END,
1176 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_vf[] = {
1177 RTE_FLOW_ITEM_TYPE_ETH,
1178 RTE_FLOW_ITEM_TYPE_VLAN,
1179 RTE_FLOW_ITEM_TYPE_IPV4,
1180 RTE_FLOW_ITEM_TYPE_SCTP,
1181 RTE_FLOW_ITEM_TYPE_VF,
1182 RTE_FLOW_ITEM_TYPE_END,
1185 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_vf[] = {
1186 RTE_FLOW_ITEM_TYPE_ETH,
1187 RTE_FLOW_ITEM_TYPE_VLAN,
1188 RTE_FLOW_ITEM_TYPE_IPV6,
1189 RTE_FLOW_ITEM_TYPE_VF,
1190 RTE_FLOW_ITEM_TYPE_END,
1193 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_vf[] = {
1194 RTE_FLOW_ITEM_TYPE_ETH,
1195 RTE_FLOW_ITEM_TYPE_VLAN,
1196 RTE_FLOW_ITEM_TYPE_IPV6,
1197 RTE_FLOW_ITEM_TYPE_UDP,
1198 RTE_FLOW_ITEM_TYPE_VF,
1199 RTE_FLOW_ITEM_TYPE_END,
1202 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_vf[] = {
1203 RTE_FLOW_ITEM_TYPE_ETH,
1204 RTE_FLOW_ITEM_TYPE_VLAN,
1205 RTE_FLOW_ITEM_TYPE_IPV6,
1206 RTE_FLOW_ITEM_TYPE_TCP,
1207 RTE_FLOW_ITEM_TYPE_VF,
1208 RTE_FLOW_ITEM_TYPE_END,
1211 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_vf[] = {
1212 RTE_FLOW_ITEM_TYPE_ETH,
1213 RTE_FLOW_ITEM_TYPE_VLAN,
1214 RTE_FLOW_ITEM_TYPE_IPV6,
1215 RTE_FLOW_ITEM_TYPE_SCTP,
1216 RTE_FLOW_ITEM_TYPE_VF,
1217 RTE_FLOW_ITEM_TYPE_END,
1220 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_1_vf[] = {
1221 RTE_FLOW_ITEM_TYPE_ETH,
1222 RTE_FLOW_ITEM_TYPE_VLAN,
1223 RTE_FLOW_ITEM_TYPE_RAW,
1224 RTE_FLOW_ITEM_TYPE_VF,
1225 RTE_FLOW_ITEM_TYPE_END,
1228 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_2_vf[] = {
1229 RTE_FLOW_ITEM_TYPE_ETH,
1230 RTE_FLOW_ITEM_TYPE_VLAN,
1231 RTE_FLOW_ITEM_TYPE_RAW,
1232 RTE_FLOW_ITEM_TYPE_RAW,
1233 RTE_FLOW_ITEM_TYPE_VF,
1234 RTE_FLOW_ITEM_TYPE_END,
1237 static enum rte_flow_item_type pattern_fdir_ethertype_vlan_raw_3_vf[] = {
1238 RTE_FLOW_ITEM_TYPE_ETH,
1239 RTE_FLOW_ITEM_TYPE_VLAN,
1240 RTE_FLOW_ITEM_TYPE_RAW,
1241 RTE_FLOW_ITEM_TYPE_RAW,
1242 RTE_FLOW_ITEM_TYPE_RAW,
1243 RTE_FLOW_ITEM_TYPE_VF,
1244 RTE_FLOW_ITEM_TYPE_END,
1247 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_1_vf[] = {
1248 RTE_FLOW_ITEM_TYPE_ETH,
1249 RTE_FLOW_ITEM_TYPE_VLAN,
1250 RTE_FLOW_ITEM_TYPE_IPV4,
1251 RTE_FLOW_ITEM_TYPE_RAW,
1252 RTE_FLOW_ITEM_TYPE_VF,
1253 RTE_FLOW_ITEM_TYPE_END,
1256 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_2_vf[] = {
1257 RTE_FLOW_ITEM_TYPE_ETH,
1258 RTE_FLOW_ITEM_TYPE_VLAN,
1259 RTE_FLOW_ITEM_TYPE_IPV4,
1260 RTE_FLOW_ITEM_TYPE_RAW,
1261 RTE_FLOW_ITEM_TYPE_RAW,
1262 RTE_FLOW_ITEM_TYPE_VF,
1263 RTE_FLOW_ITEM_TYPE_END,
1266 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_raw_3_vf[] = {
1267 RTE_FLOW_ITEM_TYPE_ETH,
1268 RTE_FLOW_ITEM_TYPE_VLAN,
1269 RTE_FLOW_ITEM_TYPE_IPV4,
1270 RTE_FLOW_ITEM_TYPE_RAW,
1271 RTE_FLOW_ITEM_TYPE_RAW,
1272 RTE_FLOW_ITEM_TYPE_RAW,
1273 RTE_FLOW_ITEM_TYPE_VF,
1274 RTE_FLOW_ITEM_TYPE_END,
1277 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_1_vf[] = {
1278 RTE_FLOW_ITEM_TYPE_ETH,
1279 RTE_FLOW_ITEM_TYPE_VLAN,
1280 RTE_FLOW_ITEM_TYPE_IPV4,
1281 RTE_FLOW_ITEM_TYPE_UDP,
1282 RTE_FLOW_ITEM_TYPE_RAW,
1283 RTE_FLOW_ITEM_TYPE_VF,
1284 RTE_FLOW_ITEM_TYPE_END,
1287 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_2_vf[] = {
1288 RTE_FLOW_ITEM_TYPE_ETH,
1289 RTE_FLOW_ITEM_TYPE_VLAN,
1290 RTE_FLOW_ITEM_TYPE_IPV4,
1291 RTE_FLOW_ITEM_TYPE_UDP,
1292 RTE_FLOW_ITEM_TYPE_RAW,
1293 RTE_FLOW_ITEM_TYPE_RAW,
1294 RTE_FLOW_ITEM_TYPE_VF,
1295 RTE_FLOW_ITEM_TYPE_END,
1298 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_udp_raw_3_vf[] = {
1299 RTE_FLOW_ITEM_TYPE_ETH,
1300 RTE_FLOW_ITEM_TYPE_VLAN,
1301 RTE_FLOW_ITEM_TYPE_IPV4,
1302 RTE_FLOW_ITEM_TYPE_UDP,
1303 RTE_FLOW_ITEM_TYPE_RAW,
1304 RTE_FLOW_ITEM_TYPE_RAW,
1305 RTE_FLOW_ITEM_TYPE_RAW,
1306 RTE_FLOW_ITEM_TYPE_VF,
1307 RTE_FLOW_ITEM_TYPE_END,
1310 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_1_vf[] = {
1311 RTE_FLOW_ITEM_TYPE_ETH,
1312 RTE_FLOW_ITEM_TYPE_VLAN,
1313 RTE_FLOW_ITEM_TYPE_IPV4,
1314 RTE_FLOW_ITEM_TYPE_TCP,
1315 RTE_FLOW_ITEM_TYPE_RAW,
1316 RTE_FLOW_ITEM_TYPE_VF,
1317 RTE_FLOW_ITEM_TYPE_END,
1320 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_2_vf[] = {
1321 RTE_FLOW_ITEM_TYPE_ETH,
1322 RTE_FLOW_ITEM_TYPE_VLAN,
1323 RTE_FLOW_ITEM_TYPE_IPV4,
1324 RTE_FLOW_ITEM_TYPE_TCP,
1325 RTE_FLOW_ITEM_TYPE_RAW,
1326 RTE_FLOW_ITEM_TYPE_RAW,
1327 RTE_FLOW_ITEM_TYPE_VF,
1328 RTE_FLOW_ITEM_TYPE_END,
1331 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_tcp_raw_3_vf[] = {
1332 RTE_FLOW_ITEM_TYPE_ETH,
1333 RTE_FLOW_ITEM_TYPE_VLAN,
1334 RTE_FLOW_ITEM_TYPE_IPV4,
1335 RTE_FLOW_ITEM_TYPE_TCP,
1336 RTE_FLOW_ITEM_TYPE_RAW,
1337 RTE_FLOW_ITEM_TYPE_RAW,
1338 RTE_FLOW_ITEM_TYPE_RAW,
1339 RTE_FLOW_ITEM_TYPE_VF,
1340 RTE_FLOW_ITEM_TYPE_END,
1343 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_1_vf[] = {
1344 RTE_FLOW_ITEM_TYPE_ETH,
1345 RTE_FLOW_ITEM_TYPE_VLAN,
1346 RTE_FLOW_ITEM_TYPE_IPV4,
1347 RTE_FLOW_ITEM_TYPE_SCTP,
1348 RTE_FLOW_ITEM_TYPE_RAW,
1349 RTE_FLOW_ITEM_TYPE_VF,
1350 RTE_FLOW_ITEM_TYPE_END,
1353 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_2_vf[] = {
1354 RTE_FLOW_ITEM_TYPE_ETH,
1355 RTE_FLOW_ITEM_TYPE_VLAN,
1356 RTE_FLOW_ITEM_TYPE_IPV4,
1357 RTE_FLOW_ITEM_TYPE_SCTP,
1358 RTE_FLOW_ITEM_TYPE_RAW,
1359 RTE_FLOW_ITEM_TYPE_RAW,
1360 RTE_FLOW_ITEM_TYPE_VF,
1361 RTE_FLOW_ITEM_TYPE_END,
1364 static enum rte_flow_item_type pattern_fdir_vlan_ipv4_sctp_raw_3_vf[] = {
1365 RTE_FLOW_ITEM_TYPE_ETH,
1366 RTE_FLOW_ITEM_TYPE_VLAN,
1367 RTE_FLOW_ITEM_TYPE_IPV4,
1368 RTE_FLOW_ITEM_TYPE_SCTP,
1369 RTE_FLOW_ITEM_TYPE_RAW,
1370 RTE_FLOW_ITEM_TYPE_RAW,
1371 RTE_FLOW_ITEM_TYPE_RAW,
1372 RTE_FLOW_ITEM_TYPE_VF,
1373 RTE_FLOW_ITEM_TYPE_END,
1376 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_1_vf[] = {
1377 RTE_FLOW_ITEM_TYPE_ETH,
1378 RTE_FLOW_ITEM_TYPE_VLAN,
1379 RTE_FLOW_ITEM_TYPE_IPV6,
1380 RTE_FLOW_ITEM_TYPE_RAW,
1381 RTE_FLOW_ITEM_TYPE_VF,
1382 RTE_FLOW_ITEM_TYPE_END,
1385 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_2_vf[] = {
1386 RTE_FLOW_ITEM_TYPE_ETH,
1387 RTE_FLOW_ITEM_TYPE_VLAN,
1388 RTE_FLOW_ITEM_TYPE_IPV6,
1389 RTE_FLOW_ITEM_TYPE_RAW,
1390 RTE_FLOW_ITEM_TYPE_RAW,
1391 RTE_FLOW_ITEM_TYPE_VF,
1392 RTE_FLOW_ITEM_TYPE_END,
1395 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_raw_3_vf[] = {
1396 RTE_FLOW_ITEM_TYPE_ETH,
1397 RTE_FLOW_ITEM_TYPE_VLAN,
1398 RTE_FLOW_ITEM_TYPE_IPV6,
1399 RTE_FLOW_ITEM_TYPE_RAW,
1400 RTE_FLOW_ITEM_TYPE_RAW,
1401 RTE_FLOW_ITEM_TYPE_RAW,
1402 RTE_FLOW_ITEM_TYPE_VF,
1403 RTE_FLOW_ITEM_TYPE_END,
1406 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_1_vf[] = {
1407 RTE_FLOW_ITEM_TYPE_ETH,
1408 RTE_FLOW_ITEM_TYPE_VLAN,
1409 RTE_FLOW_ITEM_TYPE_IPV6,
1410 RTE_FLOW_ITEM_TYPE_UDP,
1411 RTE_FLOW_ITEM_TYPE_RAW,
1412 RTE_FLOW_ITEM_TYPE_VF,
1413 RTE_FLOW_ITEM_TYPE_END,
1416 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_2_vf[] = {
1417 RTE_FLOW_ITEM_TYPE_ETH,
1418 RTE_FLOW_ITEM_TYPE_VLAN,
1419 RTE_FLOW_ITEM_TYPE_IPV6,
1420 RTE_FLOW_ITEM_TYPE_UDP,
1421 RTE_FLOW_ITEM_TYPE_RAW,
1422 RTE_FLOW_ITEM_TYPE_RAW,
1423 RTE_FLOW_ITEM_TYPE_VF,
1424 RTE_FLOW_ITEM_TYPE_END,
1427 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_udp_raw_3_vf[] = {
1428 RTE_FLOW_ITEM_TYPE_ETH,
1429 RTE_FLOW_ITEM_TYPE_VLAN,
1430 RTE_FLOW_ITEM_TYPE_IPV6,
1431 RTE_FLOW_ITEM_TYPE_UDP,
1432 RTE_FLOW_ITEM_TYPE_RAW,
1433 RTE_FLOW_ITEM_TYPE_RAW,
1434 RTE_FLOW_ITEM_TYPE_RAW,
1435 RTE_FLOW_ITEM_TYPE_VF,
1436 RTE_FLOW_ITEM_TYPE_END,
1439 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_1_vf[] = {
1440 RTE_FLOW_ITEM_TYPE_ETH,
1441 RTE_FLOW_ITEM_TYPE_VLAN,
1442 RTE_FLOW_ITEM_TYPE_IPV6,
1443 RTE_FLOW_ITEM_TYPE_TCP,
1444 RTE_FLOW_ITEM_TYPE_RAW,
1445 RTE_FLOW_ITEM_TYPE_VF,
1446 RTE_FLOW_ITEM_TYPE_END,
1449 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_2_vf[] = {
1450 RTE_FLOW_ITEM_TYPE_ETH,
1451 RTE_FLOW_ITEM_TYPE_VLAN,
1452 RTE_FLOW_ITEM_TYPE_IPV6,
1453 RTE_FLOW_ITEM_TYPE_TCP,
1454 RTE_FLOW_ITEM_TYPE_RAW,
1455 RTE_FLOW_ITEM_TYPE_RAW,
1456 RTE_FLOW_ITEM_TYPE_VF,
1457 RTE_FLOW_ITEM_TYPE_END,
1460 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_tcp_raw_3_vf[] = {
1461 RTE_FLOW_ITEM_TYPE_ETH,
1462 RTE_FLOW_ITEM_TYPE_VLAN,
1463 RTE_FLOW_ITEM_TYPE_IPV6,
1464 RTE_FLOW_ITEM_TYPE_TCP,
1465 RTE_FLOW_ITEM_TYPE_RAW,
1466 RTE_FLOW_ITEM_TYPE_RAW,
1467 RTE_FLOW_ITEM_TYPE_RAW,
1468 RTE_FLOW_ITEM_TYPE_VF,
1469 RTE_FLOW_ITEM_TYPE_END,
1472 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_1_vf[] = {
1473 RTE_FLOW_ITEM_TYPE_ETH,
1474 RTE_FLOW_ITEM_TYPE_VLAN,
1475 RTE_FLOW_ITEM_TYPE_IPV6,
1476 RTE_FLOW_ITEM_TYPE_SCTP,
1477 RTE_FLOW_ITEM_TYPE_RAW,
1478 RTE_FLOW_ITEM_TYPE_VF,
1479 RTE_FLOW_ITEM_TYPE_END,
1482 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_2_vf[] = {
1483 RTE_FLOW_ITEM_TYPE_ETH,
1484 RTE_FLOW_ITEM_TYPE_VLAN,
1485 RTE_FLOW_ITEM_TYPE_IPV6,
1486 RTE_FLOW_ITEM_TYPE_SCTP,
1487 RTE_FLOW_ITEM_TYPE_RAW,
1488 RTE_FLOW_ITEM_TYPE_RAW,
1489 RTE_FLOW_ITEM_TYPE_VF,
1490 RTE_FLOW_ITEM_TYPE_END,
1493 static enum rte_flow_item_type pattern_fdir_vlan_ipv6_sctp_raw_3_vf[] = {
1494 RTE_FLOW_ITEM_TYPE_ETH,
1495 RTE_FLOW_ITEM_TYPE_VLAN,
1496 RTE_FLOW_ITEM_TYPE_IPV6,
1497 RTE_FLOW_ITEM_TYPE_SCTP,
1498 RTE_FLOW_ITEM_TYPE_RAW,
1499 RTE_FLOW_ITEM_TYPE_RAW,
1500 RTE_FLOW_ITEM_TYPE_RAW,
1501 RTE_FLOW_ITEM_TYPE_VF,
1502 RTE_FLOW_ITEM_TYPE_END,
1505 /* Pattern matched tunnel filter */
1506 static enum rte_flow_item_type pattern_vxlan_1[] = {
1507 RTE_FLOW_ITEM_TYPE_ETH,
1508 RTE_FLOW_ITEM_TYPE_IPV4,
1509 RTE_FLOW_ITEM_TYPE_UDP,
1510 RTE_FLOW_ITEM_TYPE_VXLAN,
1511 RTE_FLOW_ITEM_TYPE_ETH,
1512 RTE_FLOW_ITEM_TYPE_END,
1515 static enum rte_flow_item_type pattern_vxlan_2[] = {
1516 RTE_FLOW_ITEM_TYPE_ETH,
1517 RTE_FLOW_ITEM_TYPE_IPV6,
1518 RTE_FLOW_ITEM_TYPE_UDP,
1519 RTE_FLOW_ITEM_TYPE_VXLAN,
1520 RTE_FLOW_ITEM_TYPE_ETH,
1521 RTE_FLOW_ITEM_TYPE_END,
1524 static enum rte_flow_item_type pattern_vxlan_3[] = {
1525 RTE_FLOW_ITEM_TYPE_ETH,
1526 RTE_FLOW_ITEM_TYPE_IPV4,
1527 RTE_FLOW_ITEM_TYPE_UDP,
1528 RTE_FLOW_ITEM_TYPE_VXLAN,
1529 RTE_FLOW_ITEM_TYPE_ETH,
1530 RTE_FLOW_ITEM_TYPE_VLAN,
1531 RTE_FLOW_ITEM_TYPE_END,
1534 static enum rte_flow_item_type pattern_vxlan_4[] = {
1535 RTE_FLOW_ITEM_TYPE_ETH,
1536 RTE_FLOW_ITEM_TYPE_IPV6,
1537 RTE_FLOW_ITEM_TYPE_UDP,
1538 RTE_FLOW_ITEM_TYPE_VXLAN,
1539 RTE_FLOW_ITEM_TYPE_ETH,
1540 RTE_FLOW_ITEM_TYPE_VLAN,
1541 RTE_FLOW_ITEM_TYPE_END,
1544 static enum rte_flow_item_type pattern_nvgre_1[] = {
1545 RTE_FLOW_ITEM_TYPE_ETH,
1546 RTE_FLOW_ITEM_TYPE_IPV4,
1547 RTE_FLOW_ITEM_TYPE_NVGRE,
1548 RTE_FLOW_ITEM_TYPE_ETH,
1549 RTE_FLOW_ITEM_TYPE_END,
1552 static enum rte_flow_item_type pattern_nvgre_2[] = {
1553 RTE_FLOW_ITEM_TYPE_ETH,
1554 RTE_FLOW_ITEM_TYPE_IPV6,
1555 RTE_FLOW_ITEM_TYPE_NVGRE,
1556 RTE_FLOW_ITEM_TYPE_ETH,
1557 RTE_FLOW_ITEM_TYPE_END,
1560 static enum rte_flow_item_type pattern_nvgre_3[] = {
1561 RTE_FLOW_ITEM_TYPE_ETH,
1562 RTE_FLOW_ITEM_TYPE_IPV4,
1563 RTE_FLOW_ITEM_TYPE_NVGRE,
1564 RTE_FLOW_ITEM_TYPE_ETH,
1565 RTE_FLOW_ITEM_TYPE_VLAN,
1566 RTE_FLOW_ITEM_TYPE_END,
1569 static enum rte_flow_item_type pattern_nvgre_4[] = {
1570 RTE_FLOW_ITEM_TYPE_ETH,
1571 RTE_FLOW_ITEM_TYPE_IPV6,
1572 RTE_FLOW_ITEM_TYPE_NVGRE,
1573 RTE_FLOW_ITEM_TYPE_ETH,
1574 RTE_FLOW_ITEM_TYPE_VLAN,
1575 RTE_FLOW_ITEM_TYPE_END,
1578 static enum rte_flow_item_type pattern_mpls_1[] = {
1579 RTE_FLOW_ITEM_TYPE_ETH,
1580 RTE_FLOW_ITEM_TYPE_IPV4,
1581 RTE_FLOW_ITEM_TYPE_UDP,
1582 RTE_FLOW_ITEM_TYPE_MPLS,
1583 RTE_FLOW_ITEM_TYPE_END,
1586 static enum rte_flow_item_type pattern_mpls_2[] = {
1587 RTE_FLOW_ITEM_TYPE_ETH,
1588 RTE_FLOW_ITEM_TYPE_IPV6,
1589 RTE_FLOW_ITEM_TYPE_UDP,
1590 RTE_FLOW_ITEM_TYPE_MPLS,
1591 RTE_FLOW_ITEM_TYPE_END,
1594 static enum rte_flow_item_type pattern_mpls_3[] = {
1595 RTE_FLOW_ITEM_TYPE_ETH,
1596 RTE_FLOW_ITEM_TYPE_IPV4,
1597 RTE_FLOW_ITEM_TYPE_GRE,
1598 RTE_FLOW_ITEM_TYPE_MPLS,
1599 RTE_FLOW_ITEM_TYPE_END,
1602 static enum rte_flow_item_type pattern_mpls_4[] = {
1603 RTE_FLOW_ITEM_TYPE_ETH,
1604 RTE_FLOW_ITEM_TYPE_IPV6,
1605 RTE_FLOW_ITEM_TYPE_GRE,
1606 RTE_FLOW_ITEM_TYPE_MPLS,
1607 RTE_FLOW_ITEM_TYPE_END,
1610 static enum rte_flow_item_type pattern_qinq_1[] = {
1611 RTE_FLOW_ITEM_TYPE_ETH,
1612 RTE_FLOW_ITEM_TYPE_VLAN,
1613 RTE_FLOW_ITEM_TYPE_VLAN,
1614 RTE_FLOW_ITEM_TYPE_END,
1617 static enum rte_flow_item_type pattern_fdir_ipv4_l2tpv3oip[] = {
1618 RTE_FLOW_ITEM_TYPE_ETH,
1619 RTE_FLOW_ITEM_TYPE_IPV4,
1620 RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
1621 RTE_FLOW_ITEM_TYPE_END,
1624 static enum rte_flow_item_type pattern_fdir_ipv6_l2tpv3oip[] = {
1625 RTE_FLOW_ITEM_TYPE_ETH,
1626 RTE_FLOW_ITEM_TYPE_IPV6,
1627 RTE_FLOW_ITEM_TYPE_L2TPV3OIP,
1628 RTE_FLOW_ITEM_TYPE_END,
1631 static enum rte_flow_item_type pattern_fdir_ipv4_esp[] = {
1632 RTE_FLOW_ITEM_TYPE_ETH,
1633 RTE_FLOW_ITEM_TYPE_IPV4,
1634 RTE_FLOW_ITEM_TYPE_ESP,
1635 RTE_FLOW_ITEM_TYPE_END,
1638 static enum rte_flow_item_type pattern_fdir_ipv6_esp[] = {
1639 RTE_FLOW_ITEM_TYPE_ETH,
1640 RTE_FLOW_ITEM_TYPE_IPV6,
1641 RTE_FLOW_ITEM_TYPE_ESP,
1642 RTE_FLOW_ITEM_TYPE_END,
1645 static enum rte_flow_item_type pattern_fdir_ipv4_udp_esp[] = {
1646 RTE_FLOW_ITEM_TYPE_ETH,
1647 RTE_FLOW_ITEM_TYPE_IPV4,
1648 RTE_FLOW_ITEM_TYPE_UDP,
1649 RTE_FLOW_ITEM_TYPE_ESP,
1650 RTE_FLOW_ITEM_TYPE_END,
1653 static enum rte_flow_item_type pattern_fdir_ipv6_udp_esp[] = {
1654 RTE_FLOW_ITEM_TYPE_ETH,
1655 RTE_FLOW_ITEM_TYPE_IPV6,
1656 RTE_FLOW_ITEM_TYPE_UDP,
1657 RTE_FLOW_ITEM_TYPE_ESP,
1658 RTE_FLOW_ITEM_TYPE_END,
1661 static struct i40e_valid_pattern i40e_supported_patterns[] = {
1663 { pattern_ethertype, i40e_flow_parse_ethertype_filter },
1664 /* FDIR - support default flow type without flexible payload*/
1665 { pattern_ethertype, i40e_flow_parse_fdir_filter },
1666 { pattern_fdir_ipv4, i40e_flow_parse_fdir_filter },
1667 { pattern_fdir_ipv4_udp, i40e_flow_parse_fdir_filter },
1668 { pattern_fdir_ipv4_tcp, i40e_flow_parse_fdir_filter },
1669 { pattern_fdir_ipv4_sctp, i40e_flow_parse_fdir_filter },
1670 { pattern_fdir_ipv4_gtpc, i40e_flow_parse_fdir_filter },
1671 { pattern_fdir_ipv4_gtpu, i40e_flow_parse_fdir_filter },
1672 { pattern_fdir_ipv4_gtpu_ipv4, i40e_flow_parse_fdir_filter },
1673 { pattern_fdir_ipv4_gtpu_ipv6, i40e_flow_parse_fdir_filter },
1674 { pattern_fdir_ipv4_esp, i40e_flow_parse_fdir_filter },
1675 { pattern_fdir_ipv4_udp_esp, i40e_flow_parse_fdir_filter },
1676 { pattern_fdir_ipv6, i40e_flow_parse_fdir_filter },
1677 { pattern_fdir_ipv6_udp, i40e_flow_parse_fdir_filter },
1678 { pattern_fdir_ipv6_tcp, i40e_flow_parse_fdir_filter },
1679 { pattern_fdir_ipv6_sctp, i40e_flow_parse_fdir_filter },
1680 { pattern_fdir_ipv6_gtpc, i40e_flow_parse_fdir_filter },
1681 { pattern_fdir_ipv6_gtpu, i40e_flow_parse_fdir_filter },
1682 { pattern_fdir_ipv6_gtpu_ipv4, i40e_flow_parse_fdir_filter },
1683 { pattern_fdir_ipv6_gtpu_ipv6, i40e_flow_parse_fdir_filter },
1684 { pattern_fdir_ipv6_esp, i40e_flow_parse_fdir_filter },
1685 { pattern_fdir_ipv6_udp_esp, i40e_flow_parse_fdir_filter },
1686 /* FDIR - support default flow type with flexible payload */
1687 { pattern_fdir_ethertype_raw_1, i40e_flow_parse_fdir_filter },
1688 { pattern_fdir_ethertype_raw_2, i40e_flow_parse_fdir_filter },
1689 { pattern_fdir_ethertype_raw_3, i40e_flow_parse_fdir_filter },
1690 { pattern_fdir_ipv4_raw_1, i40e_flow_parse_fdir_filter },
1691 { pattern_fdir_ipv4_raw_2, i40e_flow_parse_fdir_filter },
1692 { pattern_fdir_ipv4_raw_3, i40e_flow_parse_fdir_filter },
1693 { pattern_fdir_ipv4_udp_raw_1, i40e_flow_parse_fdir_filter },
1694 { pattern_fdir_ipv4_udp_raw_2, i40e_flow_parse_fdir_filter },
1695 { pattern_fdir_ipv4_udp_raw_3, i40e_flow_parse_fdir_filter },
1696 { pattern_fdir_ipv4_tcp_raw_1, i40e_flow_parse_fdir_filter },
1697 { pattern_fdir_ipv4_tcp_raw_2, i40e_flow_parse_fdir_filter },
1698 { pattern_fdir_ipv4_tcp_raw_3, i40e_flow_parse_fdir_filter },
1699 { pattern_fdir_ipv4_sctp_raw_1, i40e_flow_parse_fdir_filter },
1700 { pattern_fdir_ipv4_sctp_raw_2, i40e_flow_parse_fdir_filter },
1701 { pattern_fdir_ipv4_sctp_raw_3, i40e_flow_parse_fdir_filter },
1702 { pattern_fdir_ipv6_raw_1, i40e_flow_parse_fdir_filter },
1703 { pattern_fdir_ipv6_raw_2, i40e_flow_parse_fdir_filter },
1704 { pattern_fdir_ipv6_raw_3, i40e_flow_parse_fdir_filter },
1705 { pattern_fdir_ipv6_udp_raw_1, i40e_flow_parse_fdir_filter },
1706 { pattern_fdir_ipv6_udp_raw_2, i40e_flow_parse_fdir_filter },
1707 { pattern_fdir_ipv6_udp_raw_3, i40e_flow_parse_fdir_filter },
1708 { pattern_fdir_ipv6_tcp_raw_1, i40e_flow_parse_fdir_filter },
1709 { pattern_fdir_ipv6_tcp_raw_2, i40e_flow_parse_fdir_filter },
1710 { pattern_fdir_ipv6_tcp_raw_3, i40e_flow_parse_fdir_filter },
1711 { pattern_fdir_ipv6_sctp_raw_1, i40e_flow_parse_fdir_filter },
1712 { pattern_fdir_ipv6_sctp_raw_2, i40e_flow_parse_fdir_filter },
1713 { pattern_fdir_ipv6_sctp_raw_3, i40e_flow_parse_fdir_filter },
1714 /* FDIR - support single vlan input set */
1715 { pattern_fdir_ethertype_vlan, i40e_flow_parse_fdir_filter },
1716 { pattern_fdir_vlan_ipv4, i40e_flow_parse_fdir_filter },
1717 { pattern_fdir_vlan_ipv4_udp, i40e_flow_parse_fdir_filter },
1718 { pattern_fdir_vlan_ipv4_tcp, i40e_flow_parse_fdir_filter },
1719 { pattern_fdir_vlan_ipv4_sctp, i40e_flow_parse_fdir_filter },
1720 { pattern_fdir_vlan_ipv6, i40e_flow_parse_fdir_filter },
1721 { pattern_fdir_vlan_ipv6_udp, i40e_flow_parse_fdir_filter },
1722 { pattern_fdir_vlan_ipv6_tcp, i40e_flow_parse_fdir_filter },
1723 { pattern_fdir_vlan_ipv6_sctp, i40e_flow_parse_fdir_filter },
1724 { pattern_fdir_ethertype_vlan_raw_1, i40e_flow_parse_fdir_filter },
1725 { pattern_fdir_ethertype_vlan_raw_2, i40e_flow_parse_fdir_filter },
1726 { pattern_fdir_ethertype_vlan_raw_3, i40e_flow_parse_fdir_filter },
1727 { pattern_fdir_vlan_ipv4_raw_1, i40e_flow_parse_fdir_filter },
1728 { pattern_fdir_vlan_ipv4_raw_2, i40e_flow_parse_fdir_filter },
1729 { pattern_fdir_vlan_ipv4_raw_3, i40e_flow_parse_fdir_filter },
1730 { pattern_fdir_vlan_ipv4_udp_raw_1, i40e_flow_parse_fdir_filter },
1731 { pattern_fdir_vlan_ipv4_udp_raw_2, i40e_flow_parse_fdir_filter },
1732 { pattern_fdir_vlan_ipv4_udp_raw_3, i40e_flow_parse_fdir_filter },
1733 { pattern_fdir_vlan_ipv4_tcp_raw_1, i40e_flow_parse_fdir_filter },
1734 { pattern_fdir_vlan_ipv4_tcp_raw_2, i40e_flow_parse_fdir_filter },
1735 { pattern_fdir_vlan_ipv4_tcp_raw_3, i40e_flow_parse_fdir_filter },
1736 { pattern_fdir_vlan_ipv4_sctp_raw_1, i40e_flow_parse_fdir_filter },
1737 { pattern_fdir_vlan_ipv4_sctp_raw_2, i40e_flow_parse_fdir_filter },
1738 { pattern_fdir_vlan_ipv4_sctp_raw_3, i40e_flow_parse_fdir_filter },
1739 { pattern_fdir_vlan_ipv6_raw_1, i40e_flow_parse_fdir_filter },
1740 { pattern_fdir_vlan_ipv6_raw_2, i40e_flow_parse_fdir_filter },
1741 { pattern_fdir_vlan_ipv6_raw_3, i40e_flow_parse_fdir_filter },
1742 { pattern_fdir_vlan_ipv6_udp_raw_1, i40e_flow_parse_fdir_filter },
1743 { pattern_fdir_vlan_ipv6_udp_raw_2, i40e_flow_parse_fdir_filter },
1744 { pattern_fdir_vlan_ipv6_udp_raw_3, i40e_flow_parse_fdir_filter },
1745 { pattern_fdir_vlan_ipv6_tcp_raw_1, i40e_flow_parse_fdir_filter },
1746 { pattern_fdir_vlan_ipv6_tcp_raw_2, i40e_flow_parse_fdir_filter },
1747 { pattern_fdir_vlan_ipv6_tcp_raw_3, i40e_flow_parse_fdir_filter },
1748 { pattern_fdir_vlan_ipv6_sctp_raw_1, i40e_flow_parse_fdir_filter },
1749 { pattern_fdir_vlan_ipv6_sctp_raw_2, i40e_flow_parse_fdir_filter },
1750 { pattern_fdir_vlan_ipv6_sctp_raw_3, i40e_flow_parse_fdir_filter },
1751 /* FDIR - support VF item */
1752 { pattern_fdir_ipv4_vf, i40e_flow_parse_fdir_filter },
1753 { pattern_fdir_ipv4_udp_vf, i40e_flow_parse_fdir_filter },
1754 { pattern_fdir_ipv4_tcp_vf, i40e_flow_parse_fdir_filter },
1755 { pattern_fdir_ipv4_sctp_vf, i40e_flow_parse_fdir_filter },
1756 { pattern_fdir_ipv6_vf, i40e_flow_parse_fdir_filter },
1757 { pattern_fdir_ipv6_udp_vf, i40e_flow_parse_fdir_filter },
1758 { pattern_fdir_ipv6_tcp_vf, i40e_flow_parse_fdir_filter },
1759 { pattern_fdir_ipv6_sctp_vf, i40e_flow_parse_fdir_filter },
1760 { pattern_fdir_ethertype_raw_1_vf, i40e_flow_parse_fdir_filter },
1761 { pattern_fdir_ethertype_raw_2_vf, i40e_flow_parse_fdir_filter },
1762 { pattern_fdir_ethertype_raw_3_vf, i40e_flow_parse_fdir_filter },
1763 { pattern_fdir_ipv4_raw_1_vf, i40e_flow_parse_fdir_filter },
1764 { pattern_fdir_ipv4_raw_2_vf, i40e_flow_parse_fdir_filter },
1765 { pattern_fdir_ipv4_raw_3_vf, i40e_flow_parse_fdir_filter },
1766 { pattern_fdir_ipv4_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
1767 { pattern_fdir_ipv4_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
1768 { pattern_fdir_ipv4_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
1769 { pattern_fdir_ipv4_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
1770 { pattern_fdir_ipv4_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
1771 { pattern_fdir_ipv4_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
1772 { pattern_fdir_ipv4_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
1773 { pattern_fdir_ipv4_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
1774 { pattern_fdir_ipv4_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
1775 { pattern_fdir_ipv6_raw_1_vf, i40e_flow_parse_fdir_filter },
1776 { pattern_fdir_ipv6_raw_2_vf, i40e_flow_parse_fdir_filter },
1777 { pattern_fdir_ipv6_raw_3_vf, i40e_flow_parse_fdir_filter },
1778 { pattern_fdir_ipv6_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
1779 { pattern_fdir_ipv6_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
1780 { pattern_fdir_ipv6_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
1781 { pattern_fdir_ipv6_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
1782 { pattern_fdir_ipv6_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
1783 { pattern_fdir_ipv6_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
1784 { pattern_fdir_ipv6_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
1785 { pattern_fdir_ipv6_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
1786 { pattern_fdir_ipv6_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
1787 { pattern_fdir_ethertype_vlan_vf, i40e_flow_parse_fdir_filter },
1788 { pattern_fdir_vlan_ipv4_vf, i40e_flow_parse_fdir_filter },
1789 { pattern_fdir_vlan_ipv4_udp_vf, i40e_flow_parse_fdir_filter },
1790 { pattern_fdir_vlan_ipv4_tcp_vf, i40e_flow_parse_fdir_filter },
1791 { pattern_fdir_vlan_ipv4_sctp_vf, i40e_flow_parse_fdir_filter },
1792 { pattern_fdir_vlan_ipv6_vf, i40e_flow_parse_fdir_filter },
1793 { pattern_fdir_vlan_ipv6_udp_vf, i40e_flow_parse_fdir_filter },
1794 { pattern_fdir_vlan_ipv6_tcp_vf, i40e_flow_parse_fdir_filter },
1795 { pattern_fdir_vlan_ipv6_sctp_vf, i40e_flow_parse_fdir_filter },
1796 { pattern_fdir_ethertype_vlan_raw_1_vf, i40e_flow_parse_fdir_filter },
1797 { pattern_fdir_ethertype_vlan_raw_2_vf, i40e_flow_parse_fdir_filter },
1798 { pattern_fdir_ethertype_vlan_raw_3_vf, i40e_flow_parse_fdir_filter },
1799 { pattern_fdir_vlan_ipv4_raw_1_vf, i40e_flow_parse_fdir_filter },
1800 { pattern_fdir_vlan_ipv4_raw_2_vf, i40e_flow_parse_fdir_filter },
1801 { pattern_fdir_vlan_ipv4_raw_3_vf, i40e_flow_parse_fdir_filter },
1802 { pattern_fdir_vlan_ipv4_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
1803 { pattern_fdir_vlan_ipv4_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
1804 { pattern_fdir_vlan_ipv4_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
1805 { pattern_fdir_vlan_ipv4_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
1806 { pattern_fdir_vlan_ipv4_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
1807 { pattern_fdir_vlan_ipv4_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
1808 { pattern_fdir_vlan_ipv4_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
1809 { pattern_fdir_vlan_ipv4_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
1810 { pattern_fdir_vlan_ipv4_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
1811 { pattern_fdir_vlan_ipv6_raw_1_vf, i40e_flow_parse_fdir_filter },
1812 { pattern_fdir_vlan_ipv6_raw_2_vf, i40e_flow_parse_fdir_filter },
1813 { pattern_fdir_vlan_ipv6_raw_3_vf, i40e_flow_parse_fdir_filter },
1814 { pattern_fdir_vlan_ipv6_udp_raw_1_vf, i40e_flow_parse_fdir_filter },
1815 { pattern_fdir_vlan_ipv6_udp_raw_2_vf, i40e_flow_parse_fdir_filter },
1816 { pattern_fdir_vlan_ipv6_udp_raw_3_vf, i40e_flow_parse_fdir_filter },
1817 { pattern_fdir_vlan_ipv6_tcp_raw_1_vf, i40e_flow_parse_fdir_filter },
1818 { pattern_fdir_vlan_ipv6_tcp_raw_2_vf, i40e_flow_parse_fdir_filter },
1819 { pattern_fdir_vlan_ipv6_tcp_raw_3_vf, i40e_flow_parse_fdir_filter },
1820 { pattern_fdir_vlan_ipv6_sctp_raw_1_vf, i40e_flow_parse_fdir_filter },
1821 { pattern_fdir_vlan_ipv6_sctp_raw_2_vf, i40e_flow_parse_fdir_filter },
1822 { pattern_fdir_vlan_ipv6_sctp_raw_3_vf, i40e_flow_parse_fdir_filter },
1824 { pattern_vxlan_1, i40e_flow_parse_vxlan_filter },
1825 { pattern_vxlan_2, i40e_flow_parse_vxlan_filter },
1826 { pattern_vxlan_3, i40e_flow_parse_vxlan_filter },
1827 { pattern_vxlan_4, i40e_flow_parse_vxlan_filter },
1829 { pattern_nvgre_1, i40e_flow_parse_nvgre_filter },
1830 { pattern_nvgre_2, i40e_flow_parse_nvgre_filter },
1831 { pattern_nvgre_3, i40e_flow_parse_nvgre_filter },
1832 { pattern_nvgre_4, i40e_flow_parse_nvgre_filter },
1833 /* MPLSoUDP & MPLSoGRE */
1834 { pattern_mpls_1, i40e_flow_parse_mpls_filter },
1835 { pattern_mpls_2, i40e_flow_parse_mpls_filter },
1836 { pattern_mpls_3, i40e_flow_parse_mpls_filter },
1837 { pattern_mpls_4, i40e_flow_parse_mpls_filter },
1839 { pattern_fdir_ipv4_gtpc, i40e_flow_parse_gtp_filter },
1840 { pattern_fdir_ipv4_gtpu, i40e_flow_parse_gtp_filter },
1841 { pattern_fdir_ipv6_gtpc, i40e_flow_parse_gtp_filter },
1842 { pattern_fdir_ipv6_gtpu, i40e_flow_parse_gtp_filter },
1844 { pattern_qinq_1, i40e_flow_parse_qinq_filter },
1845 /* L2TPv3 over IP */
1846 { pattern_fdir_ipv4_l2tpv3oip, i40e_flow_parse_fdir_filter },
1847 { pattern_fdir_ipv6_l2tpv3oip, i40e_flow_parse_fdir_filter },
1850 #define NEXT_ITEM_OF_ACTION(act, actions, index) \
1852 act = actions + index; \
1853 while (act->type == RTE_FLOW_ACTION_TYPE_VOID) { \
1855 act = actions + index; \
1859 /* Find the first VOID or non-VOID item pointer */
1860 static const struct rte_flow_item *
1861 i40e_find_first_item(const struct rte_flow_item *item, bool is_void)
1865 while (item->type != RTE_FLOW_ITEM_TYPE_END) {
1867 is_find = item->type == RTE_FLOW_ITEM_TYPE_VOID;
1869 is_find = item->type != RTE_FLOW_ITEM_TYPE_VOID;
1877 /* Skip all VOID items of the pattern */
1879 i40e_pattern_skip_void_item(struct rte_flow_item *items,
1880 const struct rte_flow_item *pattern)
1882 uint32_t cpy_count = 0;
1883 const struct rte_flow_item *pb = pattern, *pe = pattern;
1886 /* Find a non-void item first */
1887 pb = i40e_find_first_item(pb, false);
1888 if (pb->type == RTE_FLOW_ITEM_TYPE_END) {
1893 /* Find a void item */
1894 pe = i40e_find_first_item(pb + 1, true);
1896 cpy_count = pe - pb;
1897 rte_memcpy(items, pb, sizeof(struct rte_flow_item) * cpy_count);
1901 if (pe->type == RTE_FLOW_ITEM_TYPE_END) {
1908 /* Copy the END item. */
1909 rte_memcpy(items, pe, sizeof(struct rte_flow_item));
1912 /* Check if the pattern matches a supported item type array */
1914 i40e_match_pattern(enum rte_flow_item_type *item_array,
1915 struct rte_flow_item *pattern)
1917 struct rte_flow_item *item = pattern;
1919 while ((*item_array == item->type) &&
1920 (*item_array != RTE_FLOW_ITEM_TYPE_END)) {
1925 return (*item_array == RTE_FLOW_ITEM_TYPE_END &&
1926 item->type == RTE_FLOW_ITEM_TYPE_END);
1929 /* Find if there's parse filter function matched */
1930 static parse_filter_t
1931 i40e_find_parse_filter_func(struct rte_flow_item *pattern, uint32_t *idx)
1933 parse_filter_t parse_filter = NULL;
1936 for (; i < RTE_DIM(i40e_supported_patterns); i++) {
1937 if (i40e_match_pattern(i40e_supported_patterns[i].items,
1939 parse_filter = i40e_supported_patterns[i].parse_filter;
1946 return parse_filter;
1949 /* Parse attributes */
1951 i40e_flow_parse_attr(const struct rte_flow_attr *attr,
1952 struct rte_flow_error *error)
1954 /* Must be input direction */
1955 if (!attr->ingress) {
1956 rte_flow_error_set(error, EINVAL,
1957 RTE_FLOW_ERROR_TYPE_ATTR_INGRESS,
1958 attr, "Only support ingress.");
1964 rte_flow_error_set(error, EINVAL,
1965 RTE_FLOW_ERROR_TYPE_ATTR_EGRESS,
1966 attr, "Not support egress.");
1971 if (attr->priority) {
1972 rte_flow_error_set(error, EINVAL,
1973 RTE_FLOW_ERROR_TYPE_ATTR_PRIORITY,
1974 attr, "Not support priority.");
1980 rte_flow_error_set(error, EINVAL,
1981 RTE_FLOW_ERROR_TYPE_ATTR_GROUP,
1982 attr, "Not support group.");
1990 i40e_get_outer_vlan(struct rte_eth_dev *dev)
1992 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
1993 int qinq = dev->data->dev_conf.rxmode.offloads &
1994 DEV_RX_OFFLOAD_VLAN_EXTEND;
2004 i40e_aq_debug_read_register(hw, I40E_GL_SWT_L2TAGCTRL(reg_id),
2007 tpid = (reg_r >> I40E_GL_SWT_L2TAGCTRL_ETHERTYPE_SHIFT) & 0xFFFF;
2012 /* 1. Last in item should be NULL as range is not supported.
2013 * 2. Supported filter types: MAC_ETHTYPE and ETHTYPE.
2014 * 3. SRC mac_addr mask should be 00:00:00:00:00:00.
2015 * 4. DST mac_addr mask should be 00:00:00:00:00:00 or
2017 * 5. Ether_type mask should be 0xFFFF.
2020 i40e_flow_parse_ethertype_pattern(struct rte_eth_dev *dev,
2021 const struct rte_flow_item *pattern,
2022 struct rte_flow_error *error,
2023 struct rte_eth_ethertype_filter *filter)
2025 const struct rte_flow_item *item = pattern;
2026 const struct rte_flow_item_eth *eth_spec;
2027 const struct rte_flow_item_eth *eth_mask;
2028 enum rte_flow_item_type item_type;
2029 uint16_t outer_tpid;
2031 outer_tpid = i40e_get_outer_vlan(dev);
2033 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
2035 rte_flow_error_set(error, EINVAL,
2036 RTE_FLOW_ERROR_TYPE_ITEM,
2038 "Not support range");
2041 item_type = item->type;
2042 switch (item_type) {
2043 case RTE_FLOW_ITEM_TYPE_ETH:
2044 eth_spec = item->spec;
2045 eth_mask = item->mask;
2046 /* Get the MAC info. */
2047 if (!eth_spec || !eth_mask) {
2048 rte_flow_error_set(error, EINVAL,
2049 RTE_FLOW_ERROR_TYPE_ITEM,
2051 "NULL ETH spec/mask");
2055 /* Mask bits of source MAC address must be full of 0.
2056 * Mask bits of destination MAC address must be full
2057 * of 1 or full of 0.
2059 if (!rte_is_zero_ether_addr(ð_mask->src) ||
2060 (!rte_is_zero_ether_addr(ð_mask->dst) &&
2061 !rte_is_broadcast_ether_addr(ð_mask->dst))) {
2062 rte_flow_error_set(error, EINVAL,
2063 RTE_FLOW_ERROR_TYPE_ITEM,
2065 "Invalid MAC_addr mask");
2069 if ((eth_mask->type & UINT16_MAX) != UINT16_MAX) {
2070 rte_flow_error_set(error, EINVAL,
2071 RTE_FLOW_ERROR_TYPE_ITEM,
2073 "Invalid ethertype mask");
2077 /* If mask bits of destination MAC address
2078 * are full of 1, set RTE_ETHTYPE_FLAGS_MAC.
2080 if (rte_is_broadcast_ether_addr(ð_mask->dst)) {
2081 filter->mac_addr = eth_spec->dst;
2082 filter->flags |= RTE_ETHTYPE_FLAGS_MAC;
2084 filter->flags &= ~RTE_ETHTYPE_FLAGS_MAC;
2086 filter->ether_type = rte_be_to_cpu_16(eth_spec->type);
2088 if (filter->ether_type == RTE_ETHER_TYPE_IPV4 ||
2089 filter->ether_type == RTE_ETHER_TYPE_IPV6 ||
2090 filter->ether_type == RTE_ETHER_TYPE_LLDP ||
2091 filter->ether_type == outer_tpid) {
2092 rte_flow_error_set(error, EINVAL,
2093 RTE_FLOW_ERROR_TYPE_ITEM,
2095 "Unsupported ether_type in"
2096 " control packet filter.");
2108 /* Ethertype action only supports QUEUE or DROP. */
2110 i40e_flow_parse_ethertype_action(struct rte_eth_dev *dev,
2111 const struct rte_flow_action *actions,
2112 struct rte_flow_error *error,
2113 struct rte_eth_ethertype_filter *filter)
2115 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
2116 const struct rte_flow_action *act;
2117 const struct rte_flow_action_queue *act_q;
2120 /* Check if the first non-void action is QUEUE or DROP. */
2121 NEXT_ITEM_OF_ACTION(act, actions, index);
2122 if (act->type != RTE_FLOW_ACTION_TYPE_QUEUE &&
2123 act->type != RTE_FLOW_ACTION_TYPE_DROP) {
2124 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
2125 act, "Not supported action.");
2129 if (act->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
2131 filter->queue = act_q->index;
2132 if (filter->queue >= pf->dev_data->nb_rx_queues) {
2133 rte_flow_error_set(error, EINVAL,
2134 RTE_FLOW_ERROR_TYPE_ACTION,
2135 act, "Invalid queue ID for"
2136 " ethertype_filter.");
2140 filter->flags |= RTE_ETHTYPE_FLAGS_DROP;
2143 /* Check if the next non-void item is END */
2145 NEXT_ITEM_OF_ACTION(act, actions, index);
2146 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
2147 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
2148 act, "Not supported action.");
2156 i40e_flow_parse_ethertype_filter(struct rte_eth_dev *dev,
2157 const struct rte_flow_attr *attr,
2158 const struct rte_flow_item pattern[],
2159 const struct rte_flow_action actions[],
2160 struct rte_flow_error *error,
2161 union i40e_filter_t *filter)
2163 struct rte_eth_ethertype_filter *ethertype_filter =
2164 &filter->ethertype_filter;
2167 ret = i40e_flow_parse_ethertype_pattern(dev, pattern, error,
2172 ret = i40e_flow_parse_ethertype_action(dev, actions, error,
2177 ret = i40e_flow_parse_attr(attr, error);
2181 cons_filter_type = RTE_ETH_FILTER_ETHERTYPE;
2187 i40e_flow_check_raw_item(const struct rte_flow_item *item,
2188 const struct rte_flow_item_raw *raw_spec,
2189 struct rte_flow_error *error)
2191 if (!raw_spec->relative) {
2192 rte_flow_error_set(error, EINVAL,
2193 RTE_FLOW_ERROR_TYPE_ITEM,
2195 "Relative should be 1.");
2199 if (raw_spec->offset % sizeof(uint16_t)) {
2200 rte_flow_error_set(error, EINVAL,
2201 RTE_FLOW_ERROR_TYPE_ITEM,
2203 "Offset should be even.");
2207 if (raw_spec->search || raw_spec->limit) {
2208 rte_flow_error_set(error, EINVAL,
2209 RTE_FLOW_ERROR_TYPE_ITEM,
2211 "search or limit is not supported.");
2215 if (raw_spec->offset < 0) {
2216 rte_flow_error_set(error, EINVAL,
2217 RTE_FLOW_ERROR_TYPE_ITEM,
2219 "Offset should be non-negative.");
2226 i40e_flow_store_flex_pit(struct i40e_pf *pf,
2227 struct i40e_fdir_flex_pit *flex_pit,
2228 enum i40e_flxpld_layer_idx layer_idx,
2233 field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + raw_id;
2234 /* Check if the configuration is conflicted */
2235 if (pf->fdir.flex_pit_flag[layer_idx] &&
2236 (pf->fdir.flex_set[field_idx].src_offset != flex_pit->src_offset ||
2237 pf->fdir.flex_set[field_idx].size != flex_pit->size ||
2238 pf->fdir.flex_set[field_idx].dst_offset != flex_pit->dst_offset))
2241 /* Check if the configuration exists. */
2242 if (pf->fdir.flex_pit_flag[layer_idx] &&
2243 (pf->fdir.flex_set[field_idx].src_offset == flex_pit->src_offset &&
2244 pf->fdir.flex_set[field_idx].size == flex_pit->size &&
2245 pf->fdir.flex_set[field_idx].dst_offset == flex_pit->dst_offset))
2248 pf->fdir.flex_set[field_idx].src_offset =
2249 flex_pit->src_offset;
2250 pf->fdir.flex_set[field_idx].size =
2252 pf->fdir.flex_set[field_idx].dst_offset =
2253 flex_pit->dst_offset;
2259 i40e_flow_store_flex_mask(struct i40e_pf *pf,
2260 enum i40e_filter_pctype pctype,
2263 struct i40e_fdir_flex_mask flex_mask;
2265 uint8_t i, nb_bitmask = 0;
2267 memset(&flex_mask, 0, sizeof(struct i40e_fdir_flex_mask));
2268 for (i = 0; i < I40E_FDIR_MAX_FLEX_LEN; i += sizeof(uint16_t)) {
2269 mask_tmp = I40E_WORD(mask[i], mask[i + 1]);
2271 flex_mask.word_mask |=
2272 I40E_FLEX_WORD_MASK(i / sizeof(uint16_t));
2273 if (mask_tmp != UINT16_MAX) {
2274 flex_mask.bitmask[nb_bitmask].mask = ~mask_tmp;
2275 flex_mask.bitmask[nb_bitmask].offset =
2276 i / sizeof(uint16_t);
2278 if (nb_bitmask > I40E_FDIR_BITMASK_NUM_WORD)
2283 flex_mask.nb_bitmask = nb_bitmask;
2285 if (pf->fdir.flex_mask_flag[pctype] &&
2286 (memcmp(&flex_mask, &pf->fdir.flex_mask[pctype],
2287 sizeof(struct i40e_fdir_flex_mask))))
2289 else if (pf->fdir.flex_mask_flag[pctype] &&
2290 !(memcmp(&flex_mask, &pf->fdir.flex_mask[pctype],
2291 sizeof(struct i40e_fdir_flex_mask))))
2294 memcpy(&pf->fdir.flex_mask[pctype], &flex_mask,
2295 sizeof(struct i40e_fdir_flex_mask));
2300 i40e_flow_set_fdir_flex_pit(struct i40e_pf *pf,
2301 enum i40e_flxpld_layer_idx layer_idx,
2304 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
2305 uint32_t flx_pit, flx_ort;
2307 uint16_t min_next_off = 0; /* in words */
2311 flx_ort = (1 << I40E_GLQF_ORT_FLX_PAYLOAD_SHIFT) |
2312 (raw_id << I40E_GLQF_ORT_FIELD_CNT_SHIFT) |
2313 (layer_idx * I40E_MAX_FLXPLD_FIED);
2314 I40E_WRITE_GLB_REG(hw, I40E_GLQF_ORT(33 + layer_idx), flx_ort);
2318 for (i = 0; i < raw_id; i++) {
2319 field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + i;
2320 flx_pit = MK_FLX_PIT(pf->fdir.flex_set[field_idx].src_offset,
2321 pf->fdir.flex_set[field_idx].size,
2322 pf->fdir.flex_set[field_idx].dst_offset);
2324 I40E_WRITE_REG(hw, I40E_PRTQF_FLX_PIT(field_idx), flx_pit);
2325 min_next_off = pf->fdir.flex_set[field_idx].src_offset +
2326 pf->fdir.flex_set[field_idx].size;
2329 for (; i < I40E_MAX_FLXPLD_FIED; i++) {
2330 /* set the non-used register obeying register's constrain */
2331 field_idx = layer_idx * I40E_MAX_FLXPLD_FIED + i;
2332 flx_pit = MK_FLX_PIT(min_next_off, NONUSE_FLX_PIT_FSIZE,
2333 NONUSE_FLX_PIT_DEST_OFF);
2334 I40E_WRITE_REG(hw, I40E_PRTQF_FLX_PIT(field_idx), flx_pit);
2338 pf->fdir.flex_pit_flag[layer_idx] = 1;
2342 i40e_flow_set_fdir_flex_msk(struct i40e_pf *pf,
2343 enum i40e_filter_pctype pctype)
2345 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
2346 struct i40e_fdir_flex_mask *flex_mask;
2347 uint32_t flxinset, fd_mask;
2351 flex_mask = &pf->fdir.flex_mask[pctype];
2352 flxinset = (flex_mask->word_mask <<
2353 I40E_PRTQF_FD_FLXINSET_INSET_SHIFT) &
2354 I40E_PRTQF_FD_FLXINSET_INSET_MASK;
2355 i40e_write_rx_ctl(hw, I40E_PRTQF_FD_FLXINSET(pctype), flxinset);
2357 for (i = 0; i < flex_mask->nb_bitmask; i++) {
2358 fd_mask = (flex_mask->bitmask[i].mask <<
2359 I40E_PRTQF_FD_MSK_MASK_SHIFT) &
2360 I40E_PRTQF_FD_MSK_MASK_MASK;
2361 fd_mask |= ((flex_mask->bitmask[i].offset +
2362 I40E_FLX_OFFSET_IN_FIELD_VECTOR) <<
2363 I40E_PRTQF_FD_MSK_OFFSET_SHIFT) &
2364 I40E_PRTQF_FD_MSK_OFFSET_MASK;
2365 i40e_write_rx_ctl(hw, I40E_PRTQF_FD_MSK(pctype, i), fd_mask);
2368 pf->fdir.flex_mask_flag[pctype] = 1;
2372 i40e_flow_set_fdir_inset(struct i40e_pf *pf,
2373 enum i40e_filter_pctype pctype,
2376 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
2377 uint64_t inset_reg = 0;
2378 uint32_t mask_reg[I40E_INSET_MASK_NUM_REG] = {0};
2381 /* Check if the input set is valid */
2382 if (i40e_validate_input_set(pctype, RTE_ETH_FILTER_FDIR,
2384 PMD_DRV_LOG(ERR, "Invalid input set");
2388 /* Check if the configuration is conflicted */
2389 if (pf->fdir.inset_flag[pctype] &&
2390 memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
2393 if (pf->fdir.inset_flag[pctype] &&
2394 !memcmp(&pf->fdir.input_set[pctype], &input_set, sizeof(uint64_t)))
2397 num = i40e_generate_inset_mask_reg(input_set, mask_reg,
2398 I40E_INSET_MASK_NUM_REG);
2402 if (pf->support_multi_driver) {
2403 for (i = 0; i < num; i++)
2404 if (i40e_read_rx_ctl(hw,
2405 I40E_GLQF_FD_MSK(i, pctype)) !=
2407 PMD_DRV_LOG(ERR, "Input set setting is not"
2409 " `support-multi-driver`"
2413 for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
2414 if (i40e_read_rx_ctl(hw,
2415 I40E_GLQF_FD_MSK(i, pctype)) != 0) {
2416 PMD_DRV_LOG(ERR, "Input set setting is not"
2418 " `support-multi-driver`"
2424 for (i = 0; i < num; i++)
2425 i40e_check_write_reg(hw, I40E_GLQF_FD_MSK(i, pctype),
2427 /*clear unused mask registers of the pctype */
2428 for (i = num; i < I40E_INSET_MASK_NUM_REG; i++)
2429 i40e_check_write_reg(hw,
2430 I40E_GLQF_FD_MSK(i, pctype), 0);
2433 inset_reg |= i40e_translate_input_set_reg(hw->mac.type, input_set);
2435 i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 0),
2436 (uint32_t)(inset_reg & UINT32_MAX));
2437 i40e_check_write_reg(hw, I40E_PRTQF_FD_INSET(pctype, 1),
2438 (uint32_t)((inset_reg >>
2439 I40E_32_BIT_WIDTH) & UINT32_MAX));
2441 I40E_WRITE_FLUSH(hw);
2443 pf->fdir.input_set[pctype] = input_set;
2444 pf->fdir.inset_flag[pctype] = 1;
2449 i40e_flow_fdir_get_pctype_value(struct i40e_pf *pf,
2450 enum rte_flow_item_type item_type,
2451 struct i40e_fdir_filter_conf *filter)
2453 struct i40e_customized_pctype *cus_pctype = NULL;
2455 switch (item_type) {
2456 case RTE_FLOW_ITEM_TYPE_GTPC:
2457 cus_pctype = i40e_find_customized_pctype(pf,
2458 I40E_CUSTOMIZED_GTPC);
2460 case RTE_FLOW_ITEM_TYPE_GTPU:
2461 if (!filter->input.flow_ext.inner_ip)
2462 cus_pctype = i40e_find_customized_pctype(pf,
2463 I40E_CUSTOMIZED_GTPU);
2464 else if (filter->input.flow_ext.iip_type ==
2465 I40E_FDIR_IPTYPE_IPV4)
2466 cus_pctype = i40e_find_customized_pctype(pf,
2467 I40E_CUSTOMIZED_GTPU_IPV4);
2468 else if (filter->input.flow_ext.iip_type ==
2469 I40E_FDIR_IPTYPE_IPV6)
2470 cus_pctype = i40e_find_customized_pctype(pf,
2471 I40E_CUSTOMIZED_GTPU_IPV6);
2473 case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
2474 if (filter->input.flow_ext.oip_type == I40E_FDIR_IPTYPE_IPV4)
2475 cus_pctype = i40e_find_customized_pctype(pf,
2476 I40E_CUSTOMIZED_IPV4_L2TPV3);
2477 else if (filter->input.flow_ext.oip_type ==
2478 I40E_FDIR_IPTYPE_IPV6)
2479 cus_pctype = i40e_find_customized_pctype(pf,
2480 I40E_CUSTOMIZED_IPV6_L2TPV3);
2482 case RTE_FLOW_ITEM_TYPE_ESP:
2483 if (!filter->input.flow_ext.is_udp) {
2484 if (filter->input.flow_ext.oip_type ==
2485 I40E_FDIR_IPTYPE_IPV4)
2486 cus_pctype = i40e_find_customized_pctype(pf,
2487 I40E_CUSTOMIZED_ESP_IPV4);
2488 else if (filter->input.flow_ext.oip_type ==
2489 I40E_FDIR_IPTYPE_IPV6)
2490 cus_pctype = i40e_find_customized_pctype(pf,
2491 I40E_CUSTOMIZED_ESP_IPV6);
2493 if (filter->input.flow_ext.oip_type ==
2494 I40E_FDIR_IPTYPE_IPV4)
2495 cus_pctype = i40e_find_customized_pctype(pf,
2496 I40E_CUSTOMIZED_ESP_IPV4_UDP);
2497 else if (filter->input.flow_ext.oip_type ==
2498 I40E_FDIR_IPTYPE_IPV6)
2499 cus_pctype = i40e_find_customized_pctype(pf,
2500 I40E_CUSTOMIZED_ESP_IPV6_UDP);
2501 filter->input.flow_ext.is_udp = false;
2505 PMD_DRV_LOG(ERR, "Unsupported item type");
2509 if (cus_pctype && cus_pctype->valid)
2510 return cus_pctype->pctype;
2512 return I40E_FILTER_PCTYPE_INVALID;
2516 i40e_flow_set_filter_spi(struct i40e_fdir_filter_conf *filter,
2517 const struct rte_flow_item_esp *esp_spec)
2519 if (filter->input.flow_ext.oip_type ==
2520 I40E_FDIR_IPTYPE_IPV4) {
2521 if (filter->input.flow_ext.is_udp)
2522 filter->input.flow.esp_ipv4_udp_flow.spi =
2525 filter->input.flow.esp_ipv4_flow.spi =
2528 if (filter->input.flow_ext.oip_type ==
2529 I40E_FDIR_IPTYPE_IPV6) {
2530 if (filter->input.flow_ext.is_udp)
2531 filter->input.flow.esp_ipv6_udp_flow.spi =
2534 filter->input.flow.esp_ipv6_flow.spi =
2539 /* 1. Last in item should be NULL as range is not supported.
2540 * 2. Supported patterns: refer to array i40e_supported_patterns.
2541 * 3. Default supported flow type and input set: refer to array
2542 * valid_fdir_inset_table in i40e_ethdev.c.
2543 * 4. Mask of fields which need to be matched should be
2545 * 5. Mask of fields which needn't to be matched should be
2547 * 6. GTP profile supports GTPv1 only.
2548 * 7. GTP-C response message ('source_port' = 2123) is not supported.
2551 i40e_flow_parse_fdir_pattern(struct rte_eth_dev *dev,
2552 const struct rte_flow_attr *attr,
2553 const struct rte_flow_item *pattern,
2554 struct rte_flow_error *error,
2555 struct i40e_fdir_filter_conf *filter)
2557 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
2558 const struct rte_flow_item *item = pattern;
2559 const struct rte_flow_item_eth *eth_spec, *eth_mask;
2560 const struct rte_flow_item_vlan *vlan_spec, *vlan_mask;
2561 const struct rte_flow_item_ipv4 *ipv4_spec, *ipv4_mask;
2562 const struct rte_flow_item_ipv6 *ipv6_spec, *ipv6_mask;
2563 const struct rte_flow_item_tcp *tcp_spec, *tcp_mask;
2564 const struct rte_flow_item_udp *udp_spec, *udp_mask;
2565 const struct rte_flow_item_sctp *sctp_spec, *sctp_mask;
2566 const struct rte_flow_item_gtp *gtp_spec, *gtp_mask;
2567 const struct rte_flow_item_esp *esp_spec, *esp_mask;
2568 const struct rte_flow_item_raw *raw_spec, *raw_mask;
2569 const struct rte_flow_item_vf *vf_spec;
2570 const struct rte_flow_item_l2tpv3oip *l2tpv3oip_spec, *l2tpv3oip_mask;
2573 uint64_t input_set = I40E_INSET_NONE;
2575 enum rte_flow_item_type item_type;
2576 enum rte_flow_item_type next_type;
2577 enum rte_flow_item_type l3 = RTE_FLOW_ITEM_TYPE_END;
2578 enum rte_flow_item_type cus_proto = RTE_FLOW_ITEM_TYPE_END;
2580 uint8_t ipv6_addr_mask[16] = {
2581 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
2582 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF };
2583 enum i40e_flxpld_layer_idx layer_idx = I40E_FLXPLD_L2_IDX;
2585 int32_t off_arr[I40E_MAX_FLXPLD_FIED];
2586 uint16_t len_arr[I40E_MAX_FLXPLD_FIED];
2587 struct i40e_fdir_flex_pit flex_pit;
2588 uint8_t next_dst_off = 0;
2589 uint8_t flex_mask[I40E_FDIR_MAX_FLEX_LEN];
2591 bool cfg_flex_pit = true;
2592 bool cfg_flex_msk = true;
2593 uint16_t outer_tpid;
2594 uint16_t ether_type;
2595 uint32_t vtc_flow_cpu;
2596 bool outer_ip = true;
2599 memset(off_arr, 0, sizeof(off_arr));
2600 memset(len_arr, 0, sizeof(len_arr));
2601 memset(flex_mask, 0, I40E_FDIR_MAX_FLEX_LEN);
2602 outer_tpid = i40e_get_outer_vlan(dev);
2603 filter->input.flow_ext.customized_pctype = false;
2604 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
2606 rte_flow_error_set(error, EINVAL,
2607 RTE_FLOW_ERROR_TYPE_ITEM,
2609 "Not support range");
2612 item_type = item->type;
2613 switch (item_type) {
2614 case RTE_FLOW_ITEM_TYPE_ETH:
2615 eth_spec = item->spec;
2616 eth_mask = item->mask;
2617 next_type = (item + 1)->type;
2619 if (next_type == RTE_FLOW_ITEM_TYPE_END &&
2620 (!eth_spec || !eth_mask)) {
2621 rte_flow_error_set(error, EINVAL,
2622 RTE_FLOW_ERROR_TYPE_ITEM,
2624 "NULL eth spec/mask.");
2628 if (eth_spec && eth_mask) {
2629 if (rte_is_broadcast_ether_addr(ð_mask->dst) &&
2630 rte_is_zero_ether_addr(ð_mask->src)) {
2631 filter->input.flow.l2_flow.dst =
2633 input_set |= I40E_INSET_DMAC;
2634 } else if (rte_is_zero_ether_addr(ð_mask->dst) &&
2635 rte_is_broadcast_ether_addr(ð_mask->src)) {
2636 filter->input.flow.l2_flow.src =
2638 input_set |= I40E_INSET_SMAC;
2639 } else if (rte_is_broadcast_ether_addr(ð_mask->dst) &&
2640 rte_is_broadcast_ether_addr(ð_mask->src)) {
2641 filter->input.flow.l2_flow.dst =
2643 filter->input.flow.l2_flow.src =
2645 input_set |= (I40E_INSET_DMAC | I40E_INSET_SMAC);
2646 } else if (!rte_is_zero_ether_addr(ð_mask->src) ||
2647 !rte_is_zero_ether_addr(ð_mask->dst)) {
2648 rte_flow_error_set(error, EINVAL,
2649 RTE_FLOW_ERROR_TYPE_ITEM,
2651 "Invalid MAC_addr mask.");
2655 if (eth_spec && eth_mask &&
2656 next_type == RTE_FLOW_ITEM_TYPE_END) {
2657 if (eth_mask->type != RTE_BE16(0xffff)) {
2658 rte_flow_error_set(error, EINVAL,
2659 RTE_FLOW_ERROR_TYPE_ITEM,
2661 "Invalid type mask.");
2665 ether_type = rte_be_to_cpu_16(eth_spec->type);
2667 if (next_type == RTE_FLOW_ITEM_TYPE_VLAN ||
2668 ether_type == RTE_ETHER_TYPE_IPV4 ||
2669 ether_type == RTE_ETHER_TYPE_IPV6 ||
2670 ether_type == outer_tpid) {
2671 rte_flow_error_set(error, EINVAL,
2672 RTE_FLOW_ERROR_TYPE_ITEM,
2674 "Unsupported ether_type.");
2677 input_set |= I40E_INSET_LAST_ETHER_TYPE;
2678 filter->input.flow.l2_flow.ether_type =
2682 pctype = I40E_FILTER_PCTYPE_L2_PAYLOAD;
2683 layer_idx = I40E_FLXPLD_L2_IDX;
2686 case RTE_FLOW_ITEM_TYPE_VLAN:
2687 vlan_spec = item->spec;
2688 vlan_mask = item->mask;
2690 RTE_ASSERT(!(input_set & I40E_INSET_LAST_ETHER_TYPE));
2691 if (vlan_spec && vlan_mask) {
2692 if (vlan_mask->tci ==
2693 rte_cpu_to_be_16(I40E_TCI_MASK)) {
2694 input_set |= I40E_INSET_VLAN_INNER;
2695 filter->input.flow_ext.vlan_tci =
2699 if (vlan_spec && vlan_mask && vlan_mask->inner_type) {
2700 if (vlan_mask->inner_type != RTE_BE16(0xffff)) {
2701 rte_flow_error_set(error, EINVAL,
2702 RTE_FLOW_ERROR_TYPE_ITEM,
2704 "Invalid inner_type"
2710 rte_be_to_cpu_16(vlan_spec->inner_type);
2712 if (ether_type == RTE_ETHER_TYPE_IPV4 ||
2713 ether_type == RTE_ETHER_TYPE_IPV6 ||
2714 ether_type == outer_tpid) {
2715 rte_flow_error_set(error, EINVAL,
2716 RTE_FLOW_ERROR_TYPE_ITEM,
2718 "Unsupported inner_type.");
2721 input_set |= I40E_INSET_LAST_ETHER_TYPE;
2722 filter->input.flow.l2_flow.ether_type =
2723 vlan_spec->inner_type;
2726 pctype = I40E_FILTER_PCTYPE_L2_PAYLOAD;
2727 layer_idx = I40E_FLXPLD_L2_IDX;
2730 case RTE_FLOW_ITEM_TYPE_IPV4:
2731 l3 = RTE_FLOW_ITEM_TYPE_IPV4;
2732 ipv4_spec = item->spec;
2733 ipv4_mask = item->mask;
2734 pctype = I40E_FILTER_PCTYPE_NONF_IPV4_OTHER;
2735 layer_idx = I40E_FLXPLD_L3_IDX;
2737 if (ipv4_spec && ipv4_mask && outer_ip) {
2738 /* Check IPv4 mask and update input set */
2739 if (ipv4_mask->hdr.version_ihl ||
2740 ipv4_mask->hdr.total_length ||
2741 ipv4_mask->hdr.packet_id ||
2742 ipv4_mask->hdr.fragment_offset ||
2743 ipv4_mask->hdr.hdr_checksum) {
2744 rte_flow_error_set(error, EINVAL,
2745 RTE_FLOW_ERROR_TYPE_ITEM,
2747 "Invalid IPv4 mask.");
2751 if (ipv4_mask->hdr.src_addr == UINT32_MAX)
2752 input_set |= I40E_INSET_IPV4_SRC;
2753 if (ipv4_mask->hdr.dst_addr == UINT32_MAX)
2754 input_set |= I40E_INSET_IPV4_DST;
2755 if (ipv4_mask->hdr.type_of_service == UINT8_MAX)
2756 input_set |= I40E_INSET_IPV4_TOS;
2757 if (ipv4_mask->hdr.time_to_live == UINT8_MAX)
2758 input_set |= I40E_INSET_IPV4_TTL;
2759 if (ipv4_mask->hdr.next_proto_id == UINT8_MAX)
2760 input_set |= I40E_INSET_IPV4_PROTO;
2762 /* Check if it is fragment. */
2763 frag_off = ipv4_spec->hdr.fragment_offset;
2764 frag_off = rte_be_to_cpu_16(frag_off);
2765 if (frag_off & RTE_IPV4_HDR_OFFSET_MASK ||
2766 frag_off & RTE_IPV4_HDR_MF_FLAG)
2767 pctype = I40E_FILTER_PCTYPE_FRAG_IPV4;
2769 if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) {
2770 if (input_set & (I40E_INSET_IPV4_SRC |
2771 I40E_INSET_IPV4_DST | I40E_INSET_IPV4_TOS |
2772 I40E_INSET_IPV4_TTL | I40E_INSET_IPV4_PROTO)) {
2773 rte_flow_error_set(error, EINVAL,
2774 RTE_FLOW_ERROR_TYPE_ITEM,
2776 "L2 and L3 input set are exclusive.");
2780 /* Get the filter info */
2781 filter->input.flow.ip4_flow.proto =
2782 ipv4_spec->hdr.next_proto_id;
2783 filter->input.flow.ip4_flow.tos =
2784 ipv4_spec->hdr.type_of_service;
2785 filter->input.flow.ip4_flow.ttl =
2786 ipv4_spec->hdr.time_to_live;
2787 filter->input.flow.ip4_flow.src_ip =
2788 ipv4_spec->hdr.src_addr;
2789 filter->input.flow.ip4_flow.dst_ip =
2790 ipv4_spec->hdr.dst_addr;
2792 filter->input.flow_ext.inner_ip = false;
2793 filter->input.flow_ext.oip_type =
2794 I40E_FDIR_IPTYPE_IPV4;
2796 } else if (!ipv4_spec && !ipv4_mask && !outer_ip) {
2797 filter->input.flow_ext.inner_ip = true;
2798 filter->input.flow_ext.iip_type =
2799 I40E_FDIR_IPTYPE_IPV4;
2800 } else if (!ipv4_spec && !ipv4_mask && outer_ip) {
2801 filter->input.flow_ext.inner_ip = false;
2802 filter->input.flow_ext.oip_type =
2803 I40E_FDIR_IPTYPE_IPV4;
2804 } else if ((ipv4_spec || ipv4_mask) && !outer_ip) {
2805 rte_flow_error_set(error, EINVAL,
2806 RTE_FLOW_ERROR_TYPE_ITEM,
2808 "Invalid inner IPv4 mask.");
2816 case RTE_FLOW_ITEM_TYPE_IPV6:
2817 l3 = RTE_FLOW_ITEM_TYPE_IPV6;
2818 ipv6_spec = item->spec;
2819 ipv6_mask = item->mask;
2820 pctype = I40E_FILTER_PCTYPE_NONF_IPV6_OTHER;
2821 layer_idx = I40E_FLXPLD_L3_IDX;
2823 if (ipv6_spec && ipv6_mask && outer_ip) {
2824 /* Check IPv6 mask and update input set */
2825 if (ipv6_mask->hdr.payload_len) {
2826 rte_flow_error_set(error, EINVAL,
2827 RTE_FLOW_ERROR_TYPE_ITEM,
2829 "Invalid IPv6 mask");
2833 if (!memcmp(ipv6_mask->hdr.src_addr,
2835 RTE_DIM(ipv6_mask->hdr.src_addr)))
2836 input_set |= I40E_INSET_IPV6_SRC;
2837 if (!memcmp(ipv6_mask->hdr.dst_addr,
2839 RTE_DIM(ipv6_mask->hdr.dst_addr)))
2840 input_set |= I40E_INSET_IPV6_DST;
2842 if ((ipv6_mask->hdr.vtc_flow &
2843 rte_cpu_to_be_32(I40E_IPV6_TC_MASK))
2844 == rte_cpu_to_be_32(I40E_IPV6_TC_MASK))
2845 input_set |= I40E_INSET_IPV6_TC;
2846 if (ipv6_mask->hdr.proto == UINT8_MAX)
2847 input_set |= I40E_INSET_IPV6_NEXT_HDR;
2848 if (ipv6_mask->hdr.hop_limits == UINT8_MAX)
2849 input_set |= I40E_INSET_IPV6_HOP_LIMIT;
2851 /* Get filter info */
2853 rte_be_to_cpu_32(ipv6_spec->hdr.vtc_flow);
2854 filter->input.flow.ipv6_flow.tc =
2855 (uint8_t)(vtc_flow_cpu >>
2856 I40E_FDIR_IPv6_TC_OFFSET);
2857 filter->input.flow.ipv6_flow.proto =
2858 ipv6_spec->hdr.proto;
2859 filter->input.flow.ipv6_flow.hop_limits =
2860 ipv6_spec->hdr.hop_limits;
2862 filter->input.flow_ext.inner_ip = false;
2863 filter->input.flow_ext.oip_type =
2864 I40E_FDIR_IPTYPE_IPV6;
2866 rte_memcpy(filter->input.flow.ipv6_flow.src_ip,
2867 ipv6_spec->hdr.src_addr, 16);
2868 rte_memcpy(filter->input.flow.ipv6_flow.dst_ip,
2869 ipv6_spec->hdr.dst_addr, 16);
2871 /* Check if it is fragment. */
2872 if (ipv6_spec->hdr.proto ==
2873 I40E_IPV6_FRAG_HEADER)
2874 pctype = I40E_FILTER_PCTYPE_FRAG_IPV6;
2875 } else if (!ipv6_spec && !ipv6_mask && !outer_ip) {
2876 filter->input.flow_ext.inner_ip = true;
2877 filter->input.flow_ext.iip_type =
2878 I40E_FDIR_IPTYPE_IPV6;
2879 } else if (!ipv6_spec && !ipv6_mask && outer_ip) {
2880 filter->input.flow_ext.inner_ip = false;
2881 filter->input.flow_ext.oip_type =
2882 I40E_FDIR_IPTYPE_IPV6;
2883 } else if ((ipv6_spec || ipv6_mask) && !outer_ip) {
2884 rte_flow_error_set(error, EINVAL,
2885 RTE_FLOW_ERROR_TYPE_ITEM,
2887 "Invalid inner IPv6 mask");
2894 case RTE_FLOW_ITEM_TYPE_TCP:
2895 tcp_spec = item->spec;
2896 tcp_mask = item->mask;
2898 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
2900 I40E_FILTER_PCTYPE_NONF_IPV4_TCP;
2901 else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
2903 I40E_FILTER_PCTYPE_NONF_IPV6_TCP;
2904 if (tcp_spec && tcp_mask) {
2905 /* Check TCP mask and update input set */
2906 if (tcp_mask->hdr.sent_seq ||
2907 tcp_mask->hdr.recv_ack ||
2908 tcp_mask->hdr.data_off ||
2909 tcp_mask->hdr.tcp_flags ||
2910 tcp_mask->hdr.rx_win ||
2911 tcp_mask->hdr.cksum ||
2912 tcp_mask->hdr.tcp_urp) {
2913 rte_flow_error_set(error, EINVAL,
2914 RTE_FLOW_ERROR_TYPE_ITEM,
2916 "Invalid TCP mask");
2920 if (tcp_mask->hdr.src_port == UINT16_MAX)
2921 input_set |= I40E_INSET_SRC_PORT;
2922 if (tcp_mask->hdr.dst_port == UINT16_MAX)
2923 input_set |= I40E_INSET_DST_PORT;
2925 if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) {
2927 (I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT)) {
2928 rte_flow_error_set(error, EINVAL,
2929 RTE_FLOW_ERROR_TYPE_ITEM,
2931 "L2 and L4 input set are exclusive.");
2935 /* Get filter info */
2936 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
2937 filter->input.flow.tcp4_flow.src_port =
2938 tcp_spec->hdr.src_port;
2939 filter->input.flow.tcp4_flow.dst_port =
2940 tcp_spec->hdr.dst_port;
2941 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
2942 filter->input.flow.tcp6_flow.src_port =
2943 tcp_spec->hdr.src_port;
2944 filter->input.flow.tcp6_flow.dst_port =
2945 tcp_spec->hdr.dst_port;
2950 layer_idx = I40E_FLXPLD_L4_IDX;
2953 case RTE_FLOW_ITEM_TYPE_UDP:
2954 udp_spec = item->spec;
2955 udp_mask = item->mask;
2957 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
2959 I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
2960 else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
2962 I40E_FILTER_PCTYPE_NONF_IPV6_UDP;
2964 if (udp_spec && udp_mask) {
2965 /* Check UDP mask and update input set*/
2966 if (udp_mask->hdr.dgram_len ||
2967 udp_mask->hdr.dgram_cksum) {
2968 rte_flow_error_set(error, EINVAL,
2969 RTE_FLOW_ERROR_TYPE_ITEM,
2971 "Invalid UDP mask");
2975 if (udp_mask->hdr.src_port == UINT16_MAX)
2976 input_set |= I40E_INSET_SRC_PORT;
2977 if (udp_mask->hdr.dst_port == UINT16_MAX)
2978 input_set |= I40E_INSET_DST_PORT;
2980 if (input_set & (I40E_INSET_DMAC | I40E_INSET_SMAC)) {
2982 (I40E_INSET_SRC_PORT | I40E_INSET_DST_PORT)) {
2983 rte_flow_error_set(error, EINVAL,
2984 RTE_FLOW_ERROR_TYPE_ITEM,
2986 "L2 and L4 input set are exclusive.");
2990 /* Get filter info */
2991 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
2992 filter->input.flow.udp4_flow.src_port =
2993 udp_spec->hdr.src_port;
2994 filter->input.flow.udp4_flow.dst_port =
2995 udp_spec->hdr.dst_port;
2996 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
2997 filter->input.flow.udp6_flow.src_port =
2998 udp_spec->hdr.src_port;
2999 filter->input.flow.udp6_flow.dst_port =
3000 udp_spec->hdr.dst_port;
3004 filter->input.flow_ext.is_udp = true;
3005 layer_idx = I40E_FLXPLD_L4_IDX;
3008 case RTE_FLOW_ITEM_TYPE_GTPC:
3009 case RTE_FLOW_ITEM_TYPE_GTPU:
3010 if (!pf->gtp_support) {
3011 rte_flow_error_set(error, EINVAL,
3012 RTE_FLOW_ERROR_TYPE_ITEM,
3014 "Unsupported protocol");
3018 gtp_spec = item->spec;
3019 gtp_mask = item->mask;
3021 if (gtp_spec && gtp_mask) {
3022 if (gtp_mask->v_pt_rsv_flags ||
3023 gtp_mask->msg_type ||
3024 gtp_mask->msg_len ||
3025 gtp_mask->teid != UINT32_MAX) {
3026 rte_flow_error_set(error, EINVAL,
3027 RTE_FLOW_ERROR_TYPE_ITEM,
3029 "Invalid GTP mask");
3033 filter->input.flow.gtp_flow.teid =
3035 filter->input.flow_ext.customized_pctype = true;
3036 cus_proto = item_type;
3039 case RTE_FLOW_ITEM_TYPE_ESP:
3040 if (!pf->esp_support) {
3041 rte_flow_error_set(error, EINVAL,
3042 RTE_FLOW_ERROR_TYPE_ITEM,
3044 "Unsupported ESP protocol");
3048 esp_spec = item->spec;
3049 esp_mask = item->mask;
3051 if (!esp_spec || !esp_mask) {
3052 rte_flow_error_set(error, EINVAL,
3053 RTE_FLOW_ERROR_TYPE_ITEM,
3055 "Invalid ESP item");
3059 if (esp_spec && esp_mask) {
3060 if (esp_mask->hdr.spi != UINT32_MAX) {
3061 rte_flow_error_set(error, EINVAL,
3062 RTE_FLOW_ERROR_TYPE_ITEM,
3064 "Invalid ESP mask");
3067 i40e_flow_set_filter_spi(filter, esp_spec);
3068 filter->input.flow_ext.customized_pctype = true;
3069 cus_proto = item_type;
3072 case RTE_FLOW_ITEM_TYPE_SCTP:
3073 sctp_spec = item->spec;
3074 sctp_mask = item->mask;
3076 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4)
3078 I40E_FILTER_PCTYPE_NONF_IPV4_SCTP;
3079 else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6)
3081 I40E_FILTER_PCTYPE_NONF_IPV6_SCTP;
3083 if (sctp_spec && sctp_mask) {
3084 /* Check SCTP mask and update input set */
3085 if (sctp_mask->hdr.cksum) {
3086 rte_flow_error_set(error, EINVAL,
3087 RTE_FLOW_ERROR_TYPE_ITEM,
3089 "Invalid UDP mask");
3093 if (sctp_mask->hdr.src_port == UINT16_MAX)
3094 input_set |= I40E_INSET_SRC_PORT;
3095 if (sctp_mask->hdr.dst_port == UINT16_MAX)
3096 input_set |= I40E_INSET_DST_PORT;
3097 if (sctp_mask->hdr.tag == UINT32_MAX)
3098 input_set |= I40E_INSET_SCTP_VT;
3100 /* Get filter info */
3101 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
3102 filter->input.flow.sctp4_flow.src_port =
3103 sctp_spec->hdr.src_port;
3104 filter->input.flow.sctp4_flow.dst_port =
3105 sctp_spec->hdr.dst_port;
3106 filter->input.flow.sctp4_flow.verify_tag
3107 = sctp_spec->hdr.tag;
3108 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
3109 filter->input.flow.sctp6_flow.src_port =
3110 sctp_spec->hdr.src_port;
3111 filter->input.flow.sctp6_flow.dst_port =
3112 sctp_spec->hdr.dst_port;
3113 filter->input.flow.sctp6_flow.verify_tag
3114 = sctp_spec->hdr.tag;
3118 layer_idx = I40E_FLXPLD_L4_IDX;
3121 case RTE_FLOW_ITEM_TYPE_RAW:
3122 raw_spec = item->spec;
3123 raw_mask = item->mask;
3125 if (!raw_spec || !raw_mask) {
3126 rte_flow_error_set(error, EINVAL,
3127 RTE_FLOW_ERROR_TYPE_ITEM,
3129 "NULL RAW spec/mask");
3133 if (pf->support_multi_driver) {
3134 rte_flow_error_set(error, ENOTSUP,
3135 RTE_FLOW_ERROR_TYPE_ITEM,
3137 "Unsupported flexible payload.");
3141 ret = i40e_flow_check_raw_item(item, raw_spec, error);
3145 off_arr[raw_id] = raw_spec->offset;
3146 len_arr[raw_id] = raw_spec->length;
3149 memset(&flex_pit, 0, sizeof(struct i40e_fdir_flex_pit));
3151 raw_spec->length / sizeof(uint16_t);
3152 flex_pit.dst_offset =
3153 next_dst_off / sizeof(uint16_t);
3155 for (i = 0; i <= raw_id; i++) {
3157 flex_pit.src_offset +=
3161 flex_pit.src_offset +=
3162 (off_arr[i] + len_arr[i]) /
3164 flex_size += len_arr[i];
3166 if (((flex_pit.src_offset + flex_pit.size) >=
3167 I40E_MAX_FLX_SOURCE_OFF / sizeof(uint16_t)) ||
3168 flex_size > I40E_FDIR_MAX_FLEXLEN) {
3169 rte_flow_error_set(error, EINVAL,
3170 RTE_FLOW_ERROR_TYPE_ITEM,
3172 "Exceeds maxmial payload limit.");
3176 /* Store flex pit to SW */
3177 ret = i40e_flow_store_flex_pit(pf, &flex_pit,
3180 rte_flow_error_set(error, EINVAL,
3181 RTE_FLOW_ERROR_TYPE_ITEM,
3183 "Conflict with the first flexible rule.");
3186 cfg_flex_pit = false;
3188 for (i = 0; i < raw_spec->length; i++) {
3189 j = i + next_dst_off;
3190 filter->input.flow_ext.flexbytes[j] =
3191 raw_spec->pattern[i];
3192 flex_mask[j] = raw_mask->pattern[i];
3195 next_dst_off += raw_spec->length;
3198 case RTE_FLOW_ITEM_TYPE_VF:
3199 vf_spec = item->spec;
3200 if (!attr->transfer) {
3201 rte_flow_error_set(error, ENOTSUP,
3202 RTE_FLOW_ERROR_TYPE_ITEM,
3204 "Matching VF traffic"
3205 " without affecting it"
3206 " (transfer attribute)"
3210 filter->input.flow_ext.is_vf = 1;
3211 filter->input.flow_ext.dst_id = vf_spec->id;
3212 if (filter->input.flow_ext.is_vf &&
3213 filter->input.flow_ext.dst_id >= pf->vf_num) {
3214 rte_flow_error_set(error, EINVAL,
3215 RTE_FLOW_ERROR_TYPE_ITEM,
3217 "Invalid VF ID for FDIR.");
3221 case RTE_FLOW_ITEM_TYPE_L2TPV3OIP:
3222 l2tpv3oip_spec = item->spec;
3223 l2tpv3oip_mask = item->mask;
3225 if (!l2tpv3oip_spec || !l2tpv3oip_mask)
3228 if (l2tpv3oip_mask->session_id != UINT32_MAX) {
3229 rte_flow_error_set(error, EINVAL,
3230 RTE_FLOW_ERROR_TYPE_ITEM,
3232 "Invalid L2TPv3 mask");
3236 if (l3 == RTE_FLOW_ITEM_TYPE_IPV4) {
3237 filter->input.flow.ip4_l2tpv3oip_flow.session_id =
3238 l2tpv3oip_spec->session_id;
3239 filter->input.flow_ext.oip_type =
3240 I40E_FDIR_IPTYPE_IPV4;
3241 } else if (l3 == RTE_FLOW_ITEM_TYPE_IPV6) {
3242 filter->input.flow.ip6_l2tpv3oip_flow.session_id =
3243 l2tpv3oip_spec->session_id;
3244 filter->input.flow_ext.oip_type =
3245 I40E_FDIR_IPTYPE_IPV6;
3248 filter->input.flow_ext.customized_pctype = true;
3249 cus_proto = item_type;
3256 /* Get customized pctype value */
3257 if (filter->input.flow_ext.customized_pctype) {
3258 pctype = i40e_flow_fdir_get_pctype_value(pf, cus_proto, filter);
3259 if (pctype == I40E_FILTER_PCTYPE_INVALID) {
3260 rte_flow_error_set(error, EINVAL,
3261 RTE_FLOW_ERROR_TYPE_ITEM,
3263 "Unsupported pctype");
3268 /* If customized pctype is not used, set fdir configuration.*/
3269 if (!filter->input.flow_ext.customized_pctype) {
3270 ret = i40e_flow_set_fdir_inset(pf, pctype, input_set);
3272 rte_flow_error_set(error, EINVAL,
3273 RTE_FLOW_ERROR_TYPE_ITEM, item,
3274 "Conflict with the first rule's input set.");
3276 } else if (ret == -EINVAL) {
3277 rte_flow_error_set(error, EINVAL,
3278 RTE_FLOW_ERROR_TYPE_ITEM, item,
3279 "Invalid pattern mask.");
3283 /* Store flex mask to SW */
3284 ret = i40e_flow_store_flex_mask(pf, pctype, flex_mask);
3286 rte_flow_error_set(error, EINVAL,
3287 RTE_FLOW_ERROR_TYPE_ITEM,
3289 "Exceed maximal number of bitmasks");
3291 } else if (ret == -2) {
3292 rte_flow_error_set(error, EINVAL,
3293 RTE_FLOW_ERROR_TYPE_ITEM,
3295 "Conflict with the first flexible rule");
3298 cfg_flex_msk = false;
3301 i40e_flow_set_fdir_flex_pit(pf, layer_idx, raw_id);
3304 i40e_flow_set_fdir_flex_msk(pf, pctype);
3307 filter->input.pctype = pctype;
3312 /* Parse to get the action info of a FDIR filter.
3313 * FDIR action supports QUEUE or (QUEUE + MARK).
3316 i40e_flow_parse_fdir_action(struct rte_eth_dev *dev,
3317 const struct rte_flow_action *actions,
3318 struct rte_flow_error *error,
3319 struct i40e_fdir_filter_conf *filter)
3321 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
3322 const struct rte_flow_action *act;
3323 const struct rte_flow_action_queue *act_q;
3324 const struct rte_flow_action_mark *mark_spec = NULL;
3327 /* Check if the first non-void action is QUEUE or DROP or PASSTHRU. */
3328 NEXT_ITEM_OF_ACTION(act, actions, index);
3329 switch (act->type) {
3330 case RTE_FLOW_ACTION_TYPE_QUEUE:
3332 filter->action.rx_queue = act_q->index;
3333 if ((!filter->input.flow_ext.is_vf &&
3334 filter->action.rx_queue >= pf->dev_data->nb_rx_queues) ||
3335 (filter->input.flow_ext.is_vf &&
3336 filter->action.rx_queue >= pf->vf_nb_qps)) {
3337 rte_flow_error_set(error, EINVAL,
3338 RTE_FLOW_ERROR_TYPE_ACTION, act,
3339 "Invalid queue ID for FDIR.");
3342 filter->action.behavior = I40E_FDIR_ACCEPT;
3344 case RTE_FLOW_ACTION_TYPE_DROP:
3345 filter->action.behavior = I40E_FDIR_REJECT;
3347 case RTE_FLOW_ACTION_TYPE_PASSTHRU:
3348 filter->action.behavior = I40E_FDIR_PASSTHRU;
3350 case RTE_FLOW_ACTION_TYPE_MARK:
3351 filter->action.behavior = I40E_FDIR_PASSTHRU;
3352 mark_spec = act->conf;
3353 filter->action.report_status = I40E_FDIR_REPORT_ID;
3354 filter->soft_id = mark_spec->id;
3357 rte_flow_error_set(error, EINVAL,
3358 RTE_FLOW_ERROR_TYPE_ACTION, act,
3363 /* Check if the next non-void item is MARK or FLAG or END. */
3365 NEXT_ITEM_OF_ACTION(act, actions, index);
3366 switch (act->type) {
3367 case RTE_FLOW_ACTION_TYPE_MARK:
3369 /* Double MARK actions requested */
3370 rte_flow_error_set(error, EINVAL,
3371 RTE_FLOW_ERROR_TYPE_ACTION, act,
3375 mark_spec = act->conf;
3376 filter->action.report_status = I40E_FDIR_REPORT_ID;
3377 filter->soft_id = mark_spec->id;
3379 case RTE_FLOW_ACTION_TYPE_FLAG:
3381 /* MARK + FLAG not supported */
3382 rte_flow_error_set(error, EINVAL,
3383 RTE_FLOW_ERROR_TYPE_ACTION, act,
3387 filter->action.report_status = I40E_FDIR_NO_REPORT_STATUS;
3389 case RTE_FLOW_ACTION_TYPE_RSS:
3390 if (filter->action.behavior != I40E_FDIR_PASSTHRU) {
3391 /* RSS filter won't be next if FDIR did not pass thru */
3392 rte_flow_error_set(error, EINVAL,
3393 RTE_FLOW_ERROR_TYPE_ACTION, act,
3398 case RTE_FLOW_ACTION_TYPE_END:
3401 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
3402 act, "Invalid action.");
3406 /* Check if the next non-void item is END */
3408 NEXT_ITEM_OF_ACTION(act, actions, index);
3409 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
3410 rte_flow_error_set(error, EINVAL,
3411 RTE_FLOW_ERROR_TYPE_ACTION,
3412 act, "Invalid action.");
3420 i40e_flow_parse_fdir_filter(struct rte_eth_dev *dev,
3421 const struct rte_flow_attr *attr,
3422 const struct rte_flow_item pattern[],
3423 const struct rte_flow_action actions[],
3424 struct rte_flow_error *error,
3425 union i40e_filter_t *filter)
3427 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
3428 struct i40e_fdir_filter_conf *fdir_filter =
3429 &filter->fdir_filter;
3432 ret = i40e_flow_parse_fdir_pattern(dev, attr, pattern, error,
3437 ret = i40e_flow_parse_fdir_action(dev, actions, error, fdir_filter);
3441 ret = i40e_flow_parse_attr(attr, error);
3445 cons_filter_type = RTE_ETH_FILTER_FDIR;
3447 if (pf->fdir.fdir_vsi == NULL) {
3448 /* Enable fdir when fdir flow is added at first time. */
3449 ret = i40e_fdir_setup(pf);
3450 if (ret != I40E_SUCCESS) {
3451 rte_flow_error_set(error, ENOTSUP,
3452 RTE_FLOW_ERROR_TYPE_HANDLE,
3453 NULL, "Failed to setup fdir.");
3456 ret = i40e_fdir_configure(dev);
3458 rte_flow_error_set(error, ENOTSUP,
3459 RTE_FLOW_ERROR_TYPE_HANDLE,
3460 NULL, "Failed to configure fdir.");
3465 /* If create the first fdir rule, enable fdir check for rx queues */
3466 if (TAILQ_EMPTY(&pf->fdir.fdir_list))
3467 i40e_fdir_rx_proc_enable(dev, 1);
3471 i40e_fdir_teardown(pf);
3475 /* Parse to get the action info of a tunnel filter
3476 * Tunnel action only supports PF, VF and QUEUE.
3479 i40e_flow_parse_tunnel_action(struct rte_eth_dev *dev,
3480 const struct rte_flow_action *actions,
3481 struct rte_flow_error *error,
3482 struct i40e_tunnel_filter_conf *filter)
3484 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
3485 const struct rte_flow_action *act;
3486 const struct rte_flow_action_queue *act_q;
3487 const struct rte_flow_action_vf *act_vf;
3490 /* Check if the first non-void action is PF or VF. */
3491 NEXT_ITEM_OF_ACTION(act, actions, index);
3492 if (act->type != RTE_FLOW_ACTION_TYPE_PF &&
3493 act->type != RTE_FLOW_ACTION_TYPE_VF) {
3494 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
3495 act, "Not supported action.");
3499 if (act->type == RTE_FLOW_ACTION_TYPE_VF) {
3501 filter->vf_id = act_vf->id;
3502 filter->is_to_vf = 1;
3503 if (filter->vf_id >= pf->vf_num) {
3504 rte_flow_error_set(error, EINVAL,
3505 RTE_FLOW_ERROR_TYPE_ACTION,
3506 act, "Invalid VF ID for tunnel filter");
3511 /* Check if the next non-void item is QUEUE */
3513 NEXT_ITEM_OF_ACTION(act, actions, index);
3514 if (act->type == RTE_FLOW_ACTION_TYPE_QUEUE) {
3516 filter->queue_id = act_q->index;
3517 if ((!filter->is_to_vf) &&
3518 (filter->queue_id >= pf->dev_data->nb_rx_queues)) {
3519 rte_flow_error_set(error, EINVAL,
3520 RTE_FLOW_ERROR_TYPE_ACTION,
3521 act, "Invalid queue ID for tunnel filter");
3523 } else if (filter->is_to_vf &&
3524 (filter->queue_id >= pf->vf_nb_qps)) {
3525 rte_flow_error_set(error, EINVAL,
3526 RTE_FLOW_ERROR_TYPE_ACTION,
3527 act, "Invalid queue ID for tunnel filter");
3532 /* Check if the next non-void item is END */
3534 NEXT_ITEM_OF_ACTION(act, actions, index);
3535 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
3536 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
3537 act, "Not supported action.");
3544 static uint16_t i40e_supported_tunnel_filter_types[] = {
3545 ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_TENID |
3546 ETH_TUNNEL_FILTER_IVLAN,
3547 ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_IVLAN,
3548 ETH_TUNNEL_FILTER_IMAC | ETH_TUNNEL_FILTER_TENID,
3549 ETH_TUNNEL_FILTER_OMAC | ETH_TUNNEL_FILTER_TENID |
3550 ETH_TUNNEL_FILTER_IMAC,
3551 ETH_TUNNEL_FILTER_IMAC,
3555 i40e_check_tunnel_filter_type(uint8_t filter_type)
3559 for (i = 0; i < RTE_DIM(i40e_supported_tunnel_filter_types); i++) {
3560 if (filter_type == i40e_supported_tunnel_filter_types[i])
3567 /* 1. Last in item should be NULL as range is not supported.
3568 * 2. Supported filter types: IMAC_IVLAN_TENID, IMAC_IVLAN,
3569 * IMAC_TENID, OMAC_TENID_IMAC and IMAC.
3570 * 3. Mask of fields which need to be matched should be
3572 * 4. Mask of fields which needn't to be matched should be
3576 i40e_flow_parse_vxlan_pattern(__rte_unused struct rte_eth_dev *dev,
3577 const struct rte_flow_item *pattern,
3578 struct rte_flow_error *error,
3579 struct i40e_tunnel_filter_conf *filter)
3581 const struct rte_flow_item *item = pattern;
3582 const struct rte_flow_item_eth *eth_spec;
3583 const struct rte_flow_item_eth *eth_mask;
3584 const struct rte_flow_item_vxlan *vxlan_spec;
3585 const struct rte_flow_item_vxlan *vxlan_mask;
3586 const struct rte_flow_item_vlan *vlan_spec;
3587 const struct rte_flow_item_vlan *vlan_mask;
3588 uint8_t filter_type = 0;
3589 bool is_vni_masked = 0;
3590 uint8_t vni_mask[] = {0xFF, 0xFF, 0xFF};
3591 enum rte_flow_item_type item_type;
3592 bool vxlan_flag = 0;
3593 uint32_t tenant_id_be = 0;
3596 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
3598 rte_flow_error_set(error, EINVAL,
3599 RTE_FLOW_ERROR_TYPE_ITEM,
3601 "Not support range");
3604 item_type = item->type;
3605 switch (item_type) {
3606 case RTE_FLOW_ITEM_TYPE_ETH:
3607 eth_spec = item->spec;
3608 eth_mask = item->mask;
3610 /* Check if ETH item is used for place holder.
3611 * If yes, both spec and mask should be NULL.
3612 * If no, both spec and mask shouldn't be NULL.
3614 if ((!eth_spec && eth_mask) ||
3615 (eth_spec && !eth_mask)) {
3616 rte_flow_error_set(error, EINVAL,
3617 RTE_FLOW_ERROR_TYPE_ITEM,
3619 "Invalid ether spec/mask");
3623 if (eth_spec && eth_mask) {
3624 /* DST address of inner MAC shouldn't be masked.
3625 * SRC address of Inner MAC should be masked.
3627 if (!rte_is_broadcast_ether_addr(ð_mask->dst) ||
3628 !rte_is_zero_ether_addr(ð_mask->src) ||
3630 rte_flow_error_set(error, EINVAL,
3631 RTE_FLOW_ERROR_TYPE_ITEM,
3633 "Invalid ether spec/mask");
3638 rte_memcpy(&filter->outer_mac,
3640 RTE_ETHER_ADDR_LEN);
3641 filter_type |= ETH_TUNNEL_FILTER_OMAC;
3643 rte_memcpy(&filter->inner_mac,
3645 RTE_ETHER_ADDR_LEN);
3646 filter_type |= ETH_TUNNEL_FILTER_IMAC;
3650 case RTE_FLOW_ITEM_TYPE_VLAN:
3651 vlan_spec = item->spec;
3652 vlan_mask = item->mask;
3653 if (!(vlan_spec && vlan_mask) ||
3654 vlan_mask->inner_type) {
3655 rte_flow_error_set(error, EINVAL,
3656 RTE_FLOW_ERROR_TYPE_ITEM,
3658 "Invalid vlan item");
3662 if (vlan_spec && vlan_mask) {
3663 if (vlan_mask->tci ==
3664 rte_cpu_to_be_16(I40E_TCI_MASK))
3665 filter->inner_vlan =
3666 rte_be_to_cpu_16(vlan_spec->tci) &
3668 filter_type |= ETH_TUNNEL_FILTER_IVLAN;
3671 case RTE_FLOW_ITEM_TYPE_IPV4:
3672 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
3673 /* IPv4 is used to describe protocol,
3674 * spec and mask should be NULL.
3676 if (item->spec || item->mask) {
3677 rte_flow_error_set(error, EINVAL,
3678 RTE_FLOW_ERROR_TYPE_ITEM,
3680 "Invalid IPv4 item");
3684 case RTE_FLOW_ITEM_TYPE_IPV6:
3685 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
3686 /* IPv6 is used to describe protocol,
3687 * spec and mask should be NULL.
3689 if (item->spec || item->mask) {
3690 rte_flow_error_set(error, EINVAL,
3691 RTE_FLOW_ERROR_TYPE_ITEM,
3693 "Invalid IPv6 item");
3697 case RTE_FLOW_ITEM_TYPE_UDP:
3698 /* UDP is used to describe protocol,
3699 * spec and mask should be NULL.
3701 if (item->spec || item->mask) {
3702 rte_flow_error_set(error, EINVAL,
3703 RTE_FLOW_ERROR_TYPE_ITEM,
3705 "Invalid UDP item");
3709 case RTE_FLOW_ITEM_TYPE_VXLAN:
3710 vxlan_spec = item->spec;
3711 vxlan_mask = item->mask;
3712 /* Check if VXLAN item is used to describe protocol.
3713 * If yes, both spec and mask should be NULL.
3714 * If no, both spec and mask shouldn't be NULL.
3716 if ((!vxlan_spec && vxlan_mask) ||
3717 (vxlan_spec && !vxlan_mask)) {
3718 rte_flow_error_set(error, EINVAL,
3719 RTE_FLOW_ERROR_TYPE_ITEM,
3721 "Invalid VXLAN item");
3725 /* Check if VNI is masked. */
3726 if (vxlan_spec && vxlan_mask) {
3728 !!memcmp(vxlan_mask->vni, vni_mask,
3730 if (is_vni_masked) {
3731 rte_flow_error_set(error, EINVAL,
3732 RTE_FLOW_ERROR_TYPE_ITEM,
3734 "Invalid VNI mask");
3738 rte_memcpy(((uint8_t *)&tenant_id_be + 1),
3739 vxlan_spec->vni, 3);
3741 rte_be_to_cpu_32(tenant_id_be);
3742 filter_type |= ETH_TUNNEL_FILTER_TENID;
3752 ret = i40e_check_tunnel_filter_type(filter_type);
3754 rte_flow_error_set(error, EINVAL,
3755 RTE_FLOW_ERROR_TYPE_ITEM,
3757 "Invalid filter type");
3760 filter->filter_type = filter_type;
3762 filter->tunnel_type = I40E_TUNNEL_TYPE_VXLAN;
3768 i40e_flow_parse_vxlan_filter(struct rte_eth_dev *dev,
3769 const struct rte_flow_attr *attr,
3770 const struct rte_flow_item pattern[],
3771 const struct rte_flow_action actions[],
3772 struct rte_flow_error *error,
3773 union i40e_filter_t *filter)
3775 struct i40e_tunnel_filter_conf *tunnel_filter =
3776 &filter->consistent_tunnel_filter;
3779 ret = i40e_flow_parse_vxlan_pattern(dev, pattern,
3780 error, tunnel_filter);
3784 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
3788 ret = i40e_flow_parse_attr(attr, error);
3792 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
3797 /* 1. Last in item should be NULL as range is not supported.
3798 * 2. Supported filter types: IMAC_IVLAN_TENID, IMAC_IVLAN,
3799 * IMAC_TENID, OMAC_TENID_IMAC and IMAC.
3800 * 3. Mask of fields which need to be matched should be
3802 * 4. Mask of fields which needn't to be matched should be
3806 i40e_flow_parse_nvgre_pattern(__rte_unused struct rte_eth_dev *dev,
3807 const struct rte_flow_item *pattern,
3808 struct rte_flow_error *error,
3809 struct i40e_tunnel_filter_conf *filter)
3811 const struct rte_flow_item *item = pattern;
3812 const struct rte_flow_item_eth *eth_spec;
3813 const struct rte_flow_item_eth *eth_mask;
3814 const struct rte_flow_item_nvgre *nvgre_spec;
3815 const struct rte_flow_item_nvgre *nvgre_mask;
3816 const struct rte_flow_item_vlan *vlan_spec;
3817 const struct rte_flow_item_vlan *vlan_mask;
3818 enum rte_flow_item_type item_type;
3819 uint8_t filter_type = 0;
3820 bool is_tni_masked = 0;
3821 uint8_t tni_mask[] = {0xFF, 0xFF, 0xFF};
3822 bool nvgre_flag = 0;
3823 uint32_t tenant_id_be = 0;
3826 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
3828 rte_flow_error_set(error, EINVAL,
3829 RTE_FLOW_ERROR_TYPE_ITEM,
3831 "Not support range");
3834 item_type = item->type;
3835 switch (item_type) {
3836 case RTE_FLOW_ITEM_TYPE_ETH:
3837 eth_spec = item->spec;
3838 eth_mask = item->mask;
3840 /* Check if ETH item is used for place holder.
3841 * If yes, both spec and mask should be NULL.
3842 * If no, both spec and mask shouldn't be NULL.
3844 if ((!eth_spec && eth_mask) ||
3845 (eth_spec && !eth_mask)) {
3846 rte_flow_error_set(error, EINVAL,
3847 RTE_FLOW_ERROR_TYPE_ITEM,
3849 "Invalid ether spec/mask");
3853 if (eth_spec && eth_mask) {
3854 /* DST address of inner MAC shouldn't be masked.
3855 * SRC address of Inner MAC should be masked.
3857 if (!rte_is_broadcast_ether_addr(ð_mask->dst) ||
3858 !rte_is_zero_ether_addr(ð_mask->src) ||
3860 rte_flow_error_set(error, EINVAL,
3861 RTE_FLOW_ERROR_TYPE_ITEM,
3863 "Invalid ether spec/mask");
3868 rte_memcpy(&filter->outer_mac,
3870 RTE_ETHER_ADDR_LEN);
3871 filter_type |= ETH_TUNNEL_FILTER_OMAC;
3873 rte_memcpy(&filter->inner_mac,
3875 RTE_ETHER_ADDR_LEN);
3876 filter_type |= ETH_TUNNEL_FILTER_IMAC;
3881 case RTE_FLOW_ITEM_TYPE_VLAN:
3882 vlan_spec = item->spec;
3883 vlan_mask = item->mask;
3884 if (!(vlan_spec && vlan_mask) ||
3885 vlan_mask->inner_type) {
3886 rte_flow_error_set(error, EINVAL,
3887 RTE_FLOW_ERROR_TYPE_ITEM,
3889 "Invalid vlan item");
3893 if (vlan_spec && vlan_mask) {
3894 if (vlan_mask->tci ==
3895 rte_cpu_to_be_16(I40E_TCI_MASK))
3896 filter->inner_vlan =
3897 rte_be_to_cpu_16(vlan_spec->tci) &
3899 filter_type |= ETH_TUNNEL_FILTER_IVLAN;
3902 case RTE_FLOW_ITEM_TYPE_IPV4:
3903 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
3904 /* IPv4 is used to describe protocol,
3905 * spec and mask should be NULL.
3907 if (item->spec || item->mask) {
3908 rte_flow_error_set(error, EINVAL,
3909 RTE_FLOW_ERROR_TYPE_ITEM,
3911 "Invalid IPv4 item");
3915 case RTE_FLOW_ITEM_TYPE_IPV6:
3916 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
3917 /* IPv6 is used to describe protocol,
3918 * spec and mask should be NULL.
3920 if (item->spec || item->mask) {
3921 rte_flow_error_set(error, EINVAL,
3922 RTE_FLOW_ERROR_TYPE_ITEM,
3924 "Invalid IPv6 item");
3928 case RTE_FLOW_ITEM_TYPE_NVGRE:
3929 nvgre_spec = item->spec;
3930 nvgre_mask = item->mask;
3931 /* Check if NVGRE item is used to describe protocol.
3932 * If yes, both spec and mask should be NULL.
3933 * If no, both spec and mask shouldn't be NULL.
3935 if ((!nvgre_spec && nvgre_mask) ||
3936 (nvgre_spec && !nvgre_mask)) {
3937 rte_flow_error_set(error, EINVAL,
3938 RTE_FLOW_ERROR_TYPE_ITEM,
3940 "Invalid NVGRE item");
3944 if (nvgre_spec && nvgre_mask) {
3946 !!memcmp(nvgre_mask->tni, tni_mask,
3948 if (is_tni_masked) {
3949 rte_flow_error_set(error, EINVAL,
3950 RTE_FLOW_ERROR_TYPE_ITEM,
3952 "Invalid TNI mask");
3955 if (nvgre_mask->protocol &&
3956 nvgre_mask->protocol != 0xFFFF) {
3957 rte_flow_error_set(error, EINVAL,
3958 RTE_FLOW_ERROR_TYPE_ITEM,
3960 "Invalid NVGRE item");
3963 if (nvgre_mask->c_k_s_rsvd0_ver &&
3964 nvgre_mask->c_k_s_rsvd0_ver !=
3965 rte_cpu_to_be_16(0xFFFF)) {
3966 rte_flow_error_set(error, EINVAL,
3967 RTE_FLOW_ERROR_TYPE_ITEM,
3969 "Invalid NVGRE item");
3972 if (nvgre_spec->c_k_s_rsvd0_ver !=
3973 rte_cpu_to_be_16(0x2000) &&
3974 nvgre_mask->c_k_s_rsvd0_ver) {
3975 rte_flow_error_set(error, EINVAL,
3976 RTE_FLOW_ERROR_TYPE_ITEM,
3978 "Invalid NVGRE item");
3981 if (nvgre_mask->protocol &&
3982 nvgre_spec->protocol !=
3983 rte_cpu_to_be_16(0x6558)) {
3984 rte_flow_error_set(error, EINVAL,
3985 RTE_FLOW_ERROR_TYPE_ITEM,
3987 "Invalid NVGRE item");
3990 rte_memcpy(((uint8_t *)&tenant_id_be + 1),
3991 nvgre_spec->tni, 3);
3993 rte_be_to_cpu_32(tenant_id_be);
3994 filter_type |= ETH_TUNNEL_FILTER_TENID;
4004 ret = i40e_check_tunnel_filter_type(filter_type);
4006 rte_flow_error_set(error, EINVAL,
4007 RTE_FLOW_ERROR_TYPE_ITEM,
4009 "Invalid filter type");
4012 filter->filter_type = filter_type;
4014 filter->tunnel_type = I40E_TUNNEL_TYPE_NVGRE;
4020 i40e_flow_parse_nvgre_filter(struct rte_eth_dev *dev,
4021 const struct rte_flow_attr *attr,
4022 const struct rte_flow_item pattern[],
4023 const struct rte_flow_action actions[],
4024 struct rte_flow_error *error,
4025 union i40e_filter_t *filter)
4027 struct i40e_tunnel_filter_conf *tunnel_filter =
4028 &filter->consistent_tunnel_filter;
4031 ret = i40e_flow_parse_nvgre_pattern(dev, pattern,
4032 error, tunnel_filter);
4036 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4040 ret = i40e_flow_parse_attr(attr, error);
4044 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4049 /* 1. Last in item should be NULL as range is not supported.
4050 * 2. Supported filter types: MPLS label.
4051 * 3. Mask of fields which need to be matched should be
4053 * 4. Mask of fields which needn't to be matched should be
4057 i40e_flow_parse_mpls_pattern(__rte_unused struct rte_eth_dev *dev,
4058 const struct rte_flow_item *pattern,
4059 struct rte_flow_error *error,
4060 struct i40e_tunnel_filter_conf *filter)
4062 const struct rte_flow_item *item = pattern;
4063 const struct rte_flow_item_mpls *mpls_spec;
4064 const struct rte_flow_item_mpls *mpls_mask;
4065 enum rte_flow_item_type item_type;
4066 bool is_mplsoudp = 0; /* 1 - MPLSoUDP, 0 - MPLSoGRE */
4067 const uint8_t label_mask[3] = {0xFF, 0xFF, 0xF0};
4068 uint32_t label_be = 0;
4070 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4072 rte_flow_error_set(error, EINVAL,
4073 RTE_FLOW_ERROR_TYPE_ITEM,
4075 "Not support range");
4078 item_type = item->type;
4079 switch (item_type) {
4080 case RTE_FLOW_ITEM_TYPE_ETH:
4081 if (item->spec || item->mask) {
4082 rte_flow_error_set(error, EINVAL,
4083 RTE_FLOW_ERROR_TYPE_ITEM,
4085 "Invalid ETH item");
4089 case RTE_FLOW_ITEM_TYPE_IPV4:
4090 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
4091 /* IPv4 is used to describe protocol,
4092 * spec and mask should be NULL.
4094 if (item->spec || item->mask) {
4095 rte_flow_error_set(error, EINVAL,
4096 RTE_FLOW_ERROR_TYPE_ITEM,
4098 "Invalid IPv4 item");
4102 case RTE_FLOW_ITEM_TYPE_IPV6:
4103 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV6;
4104 /* IPv6 is used to describe protocol,
4105 * spec and mask should be NULL.
4107 if (item->spec || item->mask) {
4108 rte_flow_error_set(error, EINVAL,
4109 RTE_FLOW_ERROR_TYPE_ITEM,
4111 "Invalid IPv6 item");
4115 case RTE_FLOW_ITEM_TYPE_UDP:
4116 /* UDP is used to describe protocol,
4117 * spec and mask should be NULL.
4119 if (item->spec || item->mask) {
4120 rte_flow_error_set(error, EINVAL,
4121 RTE_FLOW_ERROR_TYPE_ITEM,
4123 "Invalid UDP item");
4128 case RTE_FLOW_ITEM_TYPE_GRE:
4129 /* GRE is used to describe protocol,
4130 * spec and mask should be NULL.
4132 if (item->spec || item->mask) {
4133 rte_flow_error_set(error, EINVAL,
4134 RTE_FLOW_ERROR_TYPE_ITEM,
4136 "Invalid GRE item");
4140 case RTE_FLOW_ITEM_TYPE_MPLS:
4141 mpls_spec = item->spec;
4142 mpls_mask = item->mask;
4144 if (!mpls_spec || !mpls_mask) {
4145 rte_flow_error_set(error, EINVAL,
4146 RTE_FLOW_ERROR_TYPE_ITEM,
4148 "Invalid MPLS item");
4152 if (memcmp(mpls_mask->label_tc_s, label_mask, 3)) {
4153 rte_flow_error_set(error, EINVAL,
4154 RTE_FLOW_ERROR_TYPE_ITEM,
4156 "Invalid MPLS label mask");
4159 rte_memcpy(((uint8_t *)&label_be + 1),
4160 mpls_spec->label_tc_s, 3);
4161 filter->tenant_id = rte_be_to_cpu_32(label_be) >> 4;
4169 filter->tunnel_type = I40E_TUNNEL_TYPE_MPLSoUDP;
4171 filter->tunnel_type = I40E_TUNNEL_TYPE_MPLSoGRE;
4177 i40e_flow_parse_mpls_filter(struct rte_eth_dev *dev,
4178 const struct rte_flow_attr *attr,
4179 const struct rte_flow_item pattern[],
4180 const struct rte_flow_action actions[],
4181 struct rte_flow_error *error,
4182 union i40e_filter_t *filter)
4184 struct i40e_tunnel_filter_conf *tunnel_filter =
4185 &filter->consistent_tunnel_filter;
4188 ret = i40e_flow_parse_mpls_pattern(dev, pattern,
4189 error, tunnel_filter);
4193 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4197 ret = i40e_flow_parse_attr(attr, error);
4201 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4206 /* 1. Last in item should be NULL as range is not supported.
4207 * 2. Supported filter types: GTP TEID.
4208 * 3. Mask of fields which need to be matched should be
4210 * 4. Mask of fields which needn't to be matched should be
4212 * 5. GTP profile supports GTPv1 only.
4213 * 6. GTP-C response message ('source_port' = 2123) is not supported.
4216 i40e_flow_parse_gtp_pattern(struct rte_eth_dev *dev,
4217 const struct rte_flow_item *pattern,
4218 struct rte_flow_error *error,
4219 struct i40e_tunnel_filter_conf *filter)
4221 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4222 const struct rte_flow_item *item = pattern;
4223 const struct rte_flow_item_gtp *gtp_spec;
4224 const struct rte_flow_item_gtp *gtp_mask;
4225 enum rte_flow_item_type item_type;
4227 if (!pf->gtp_support) {
4228 rte_flow_error_set(error, EINVAL,
4229 RTE_FLOW_ERROR_TYPE_ITEM,
4231 "GTP is not supported by default.");
4235 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4237 rte_flow_error_set(error, EINVAL,
4238 RTE_FLOW_ERROR_TYPE_ITEM,
4240 "Not support range");
4243 item_type = item->type;
4244 switch (item_type) {
4245 case RTE_FLOW_ITEM_TYPE_ETH:
4246 if (item->spec || item->mask) {
4247 rte_flow_error_set(error, EINVAL,
4248 RTE_FLOW_ERROR_TYPE_ITEM,
4250 "Invalid ETH item");
4254 case RTE_FLOW_ITEM_TYPE_IPV4:
4255 filter->ip_type = I40E_TUNNEL_IPTYPE_IPV4;
4256 /* IPv4 is used to describe protocol,
4257 * spec and mask should be NULL.
4259 if (item->spec || item->mask) {
4260 rte_flow_error_set(error, EINVAL,
4261 RTE_FLOW_ERROR_TYPE_ITEM,
4263 "Invalid IPv4 item");
4267 case RTE_FLOW_ITEM_TYPE_UDP:
4268 if (item->spec || item->mask) {
4269 rte_flow_error_set(error, EINVAL,
4270 RTE_FLOW_ERROR_TYPE_ITEM,
4272 "Invalid UDP item");
4276 case RTE_FLOW_ITEM_TYPE_GTPC:
4277 case RTE_FLOW_ITEM_TYPE_GTPU:
4278 gtp_spec = item->spec;
4279 gtp_mask = item->mask;
4281 if (!gtp_spec || !gtp_mask) {
4282 rte_flow_error_set(error, EINVAL,
4283 RTE_FLOW_ERROR_TYPE_ITEM,
4285 "Invalid GTP item");
4289 if (gtp_mask->v_pt_rsv_flags ||
4290 gtp_mask->msg_type ||
4291 gtp_mask->msg_len ||
4292 gtp_mask->teid != UINT32_MAX) {
4293 rte_flow_error_set(error, EINVAL,
4294 RTE_FLOW_ERROR_TYPE_ITEM,
4296 "Invalid GTP mask");
4300 if (item_type == RTE_FLOW_ITEM_TYPE_GTPC)
4301 filter->tunnel_type = I40E_TUNNEL_TYPE_GTPC;
4302 else if (item_type == RTE_FLOW_ITEM_TYPE_GTPU)
4303 filter->tunnel_type = I40E_TUNNEL_TYPE_GTPU;
4305 filter->tenant_id = rte_be_to_cpu_32(gtp_spec->teid);
4317 i40e_flow_parse_gtp_filter(struct rte_eth_dev *dev,
4318 const struct rte_flow_attr *attr,
4319 const struct rte_flow_item pattern[],
4320 const struct rte_flow_action actions[],
4321 struct rte_flow_error *error,
4322 union i40e_filter_t *filter)
4324 struct i40e_tunnel_filter_conf *tunnel_filter =
4325 &filter->consistent_tunnel_filter;
4328 ret = i40e_flow_parse_gtp_pattern(dev, pattern,
4329 error, tunnel_filter);
4333 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4337 ret = i40e_flow_parse_attr(attr, error);
4341 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4346 /* 1. Last in item should be NULL as range is not supported.
4347 * 2. Supported filter types: QINQ.
4348 * 3. Mask of fields which need to be matched should be
4350 * 4. Mask of fields which needn't to be matched should be
4354 i40e_flow_parse_qinq_pattern(__rte_unused struct rte_eth_dev *dev,
4355 const struct rte_flow_item *pattern,
4356 struct rte_flow_error *error,
4357 struct i40e_tunnel_filter_conf *filter)
4359 const struct rte_flow_item *item = pattern;
4360 const struct rte_flow_item_vlan *vlan_spec = NULL;
4361 const struct rte_flow_item_vlan *vlan_mask = NULL;
4362 const struct rte_flow_item_vlan *i_vlan_spec = NULL;
4363 const struct rte_flow_item_vlan *i_vlan_mask = NULL;
4364 const struct rte_flow_item_vlan *o_vlan_spec = NULL;
4365 const struct rte_flow_item_vlan *o_vlan_mask = NULL;
4367 enum rte_flow_item_type item_type;
4370 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4372 rte_flow_error_set(error, EINVAL,
4373 RTE_FLOW_ERROR_TYPE_ITEM,
4375 "Not support range");
4378 item_type = item->type;
4379 switch (item_type) {
4380 case RTE_FLOW_ITEM_TYPE_ETH:
4381 if (item->spec || item->mask) {
4382 rte_flow_error_set(error, EINVAL,
4383 RTE_FLOW_ERROR_TYPE_ITEM,
4385 "Invalid ETH item");
4389 case RTE_FLOW_ITEM_TYPE_VLAN:
4390 vlan_spec = item->spec;
4391 vlan_mask = item->mask;
4393 if (!(vlan_spec && vlan_mask) ||
4394 vlan_mask->inner_type) {
4395 rte_flow_error_set(error, EINVAL,
4396 RTE_FLOW_ERROR_TYPE_ITEM,
4398 "Invalid vlan item");
4403 o_vlan_spec = vlan_spec;
4404 o_vlan_mask = vlan_mask;
4407 i_vlan_spec = vlan_spec;
4408 i_vlan_mask = vlan_mask;
4418 /* Get filter specification */
4419 if ((o_vlan_mask != NULL) && (o_vlan_mask->tci ==
4420 rte_cpu_to_be_16(I40E_TCI_MASK)) &&
4421 (i_vlan_mask != NULL) &&
4422 (i_vlan_mask->tci == rte_cpu_to_be_16(I40E_TCI_MASK))) {
4423 filter->outer_vlan = rte_be_to_cpu_16(o_vlan_spec->tci)
4425 filter->inner_vlan = rte_be_to_cpu_16(i_vlan_spec->tci)
4428 rte_flow_error_set(error, EINVAL,
4429 RTE_FLOW_ERROR_TYPE_ITEM,
4431 "Invalid filter type");
4435 filter->tunnel_type = I40E_TUNNEL_TYPE_QINQ;
4440 i40e_flow_parse_qinq_filter(struct rte_eth_dev *dev,
4441 const struct rte_flow_attr *attr,
4442 const struct rte_flow_item pattern[],
4443 const struct rte_flow_action actions[],
4444 struct rte_flow_error *error,
4445 union i40e_filter_t *filter)
4447 struct i40e_tunnel_filter_conf *tunnel_filter =
4448 &filter->consistent_tunnel_filter;
4451 ret = i40e_flow_parse_qinq_pattern(dev, pattern,
4452 error, tunnel_filter);
4456 ret = i40e_flow_parse_tunnel_action(dev, actions, error, tunnel_filter);
4460 ret = i40e_flow_parse_attr(attr, error);
4464 cons_filter_type = RTE_ETH_FILTER_TUNNEL;
4470 * This function is used to do configuration i40e existing RSS with rte_flow.
4471 * It also enable queue region configuration using flow API for i40e.
4472 * pattern can be used indicate what parameters will be include in flow,
4473 * like user_priority or flowtype for queue region or HASH function for RSS.
4474 * Action is used to transmit parameter like queue index and HASH
4475 * function for RSS, or flowtype for queue region configuration.
4478 * Case 1: try to transform patterns to pctype. valid pctype will be
4479 * used in parse action.
4480 * Case 2: only ETH, indicate flowtype for queue region will be parsed.
4481 * Case 3: only VLAN, indicate user_priority for queue region will be parsed.
4482 * So, pattern choice is depened on the purpose of configuration of
4485 * action RSS will be used to transmit valid parameter with
4486 * struct rte_flow_action_rss for all the 3 case.
4489 i40e_flow_parse_rss_pattern(__rte_unused struct rte_eth_dev *dev,
4490 const struct rte_flow_item *pattern,
4491 struct rte_flow_error *error,
4492 struct i40e_rss_pattern_info *p_info,
4493 struct i40e_queue_regions *info)
4495 const struct rte_flow_item_vlan *vlan_spec, *vlan_mask;
4496 const struct rte_flow_item *item = pattern;
4497 enum rte_flow_item_type item_type;
4498 struct rte_flow_item *items;
4499 uint32_t item_num = 0; /* non-void item number of pattern*/
4501 static const struct {
4502 enum rte_flow_item_type *item_array;
4504 } i40e_rss_pctype_patterns[] = {
4505 { pattern_fdir_ipv4,
4506 ETH_RSS_FRAG_IPV4 | ETH_RSS_NONFRAG_IPV4_OTHER },
4507 { pattern_fdir_ipv4_tcp, ETH_RSS_NONFRAG_IPV4_TCP },
4508 { pattern_fdir_ipv4_udp, ETH_RSS_NONFRAG_IPV4_UDP },
4509 { pattern_fdir_ipv4_sctp, ETH_RSS_NONFRAG_IPV4_SCTP },
4510 { pattern_fdir_ipv4_esp, ETH_RSS_ESP },
4511 { pattern_fdir_ipv4_udp_esp, ETH_RSS_ESP },
4512 { pattern_fdir_ipv6,
4513 ETH_RSS_FRAG_IPV6 | ETH_RSS_NONFRAG_IPV6_OTHER },
4514 { pattern_fdir_ipv6_tcp, ETH_RSS_NONFRAG_IPV6_TCP },
4515 { pattern_fdir_ipv6_udp, ETH_RSS_NONFRAG_IPV6_UDP },
4516 { pattern_fdir_ipv6_sctp, ETH_RSS_NONFRAG_IPV6_SCTP },
4517 { pattern_ethertype, ETH_RSS_L2_PAYLOAD },
4518 { pattern_fdir_ipv6_esp, ETH_RSS_ESP },
4519 { pattern_fdir_ipv6_udp_esp, ETH_RSS_ESP },
4522 p_info->types = I40E_RSS_TYPE_INVALID;
4524 if (item->type == RTE_FLOW_ITEM_TYPE_END) {
4525 p_info->types = I40E_RSS_TYPE_NONE;
4529 /* Convert pattern to RSS offload types */
4530 while ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_END) {
4531 if ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_VOID)
4537 items = rte_zmalloc("i40e_pattern",
4538 item_num * sizeof(struct rte_flow_item), 0);
4540 rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
4541 NULL, "No memory for PMD internal items.");
4545 i40e_pattern_skip_void_item(items, pattern);
4547 for (i = 0; i < RTE_DIM(i40e_rss_pctype_patterns); i++) {
4548 if (i40e_match_pattern(i40e_rss_pctype_patterns[i].item_array,
4550 p_info->types = i40e_rss_pctype_patterns[i].type;
4557 for (; item->type != RTE_FLOW_ITEM_TYPE_END; item++) {
4559 rte_flow_error_set(error, EINVAL,
4560 RTE_FLOW_ERROR_TYPE_ITEM,
4562 "Not support range");
4565 item_type = item->type;
4566 switch (item_type) {
4567 case RTE_FLOW_ITEM_TYPE_ETH:
4568 p_info->action_flag = 1;
4570 case RTE_FLOW_ITEM_TYPE_VLAN:
4571 vlan_spec = item->spec;
4572 vlan_mask = item->mask;
4573 if (vlan_spec && vlan_mask) {
4574 if (vlan_mask->tci ==
4575 rte_cpu_to_be_16(I40E_TCI_MASK)) {
4576 info->region[0].user_priority[0] =
4578 vlan_spec->tci) >> 13) & 0x7;
4579 info->region[0].user_priority_num = 1;
4580 info->queue_region_number = 1;
4581 p_info->action_flag = 0;
4586 p_info->action_flag = 0;
4587 memset(info, 0, sizeof(struct i40e_queue_regions));
4596 * This function is used to parse RSS queue index, total queue number and
4597 * hash functions, If the purpose of this configuration is for queue region
4598 * configuration, it will set queue_region_conf flag to TRUE, else to FALSE.
4599 * In queue region configuration, it also need to parse hardware flowtype
4600 * and user_priority from configuration, it will also cheeck the validity
4601 * of these parameters. For example, The queue region sizes should
4602 * be any of the following values: 1, 2, 4, 8, 16, 32, 64, the
4603 * hw_flowtype or PCTYPE max index should be 63, the user priority
4604 * max index should be 7, and so on. And also, queue index should be
4605 * continuous sequence and queue region index should be part of RSS
4606 * queue index for this port.
4607 * For hash params, the pctype in action and pattern must be same.
4608 * Set queue index must be with non-types.
4611 i40e_flow_parse_rss_action(struct rte_eth_dev *dev,
4612 const struct rte_flow_action *actions,
4613 struct rte_flow_error *error,
4614 struct i40e_rss_pattern_info p_info,
4615 struct i40e_queue_regions *conf_info,
4616 union i40e_filter_t *filter)
4618 const struct rte_flow_action *act;
4619 const struct rte_flow_action_rss *rss;
4620 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4621 struct i40e_queue_regions *info = &pf->queue_region;
4622 struct i40e_rte_flow_rss_conf *rss_config =
4624 struct i40e_rte_flow_rss_conf *rss_info = &pf->rss_info;
4625 uint16_t i, j, n, tmp, nb_types;
4627 uint64_t hf_bit = 1;
4629 static const struct {
4631 enum i40e_filter_pctype pctype;
4632 } pctype_match_table[] = {
4634 I40E_FILTER_PCTYPE_FRAG_IPV4},
4635 {ETH_RSS_NONFRAG_IPV4_TCP,
4636 I40E_FILTER_PCTYPE_NONF_IPV4_TCP},
4637 {ETH_RSS_NONFRAG_IPV4_UDP,
4638 I40E_FILTER_PCTYPE_NONF_IPV4_UDP},
4639 {ETH_RSS_NONFRAG_IPV4_SCTP,
4640 I40E_FILTER_PCTYPE_NONF_IPV4_SCTP},
4641 {ETH_RSS_NONFRAG_IPV4_OTHER,
4642 I40E_FILTER_PCTYPE_NONF_IPV4_OTHER},
4644 I40E_FILTER_PCTYPE_FRAG_IPV6},
4645 {ETH_RSS_NONFRAG_IPV6_TCP,
4646 I40E_FILTER_PCTYPE_NONF_IPV6_TCP},
4647 {ETH_RSS_NONFRAG_IPV6_UDP,
4648 I40E_FILTER_PCTYPE_NONF_IPV6_UDP},
4649 {ETH_RSS_NONFRAG_IPV6_SCTP,
4650 I40E_FILTER_PCTYPE_NONF_IPV6_SCTP},
4651 {ETH_RSS_NONFRAG_IPV6_OTHER,
4652 I40E_FILTER_PCTYPE_NONF_IPV6_OTHER},
4653 {ETH_RSS_L2_PAYLOAD,
4654 I40E_FILTER_PCTYPE_L2_PAYLOAD},
4657 NEXT_ITEM_OF_ACTION(act, actions, index);
4661 * RSS only supports forwarding,
4662 * check if the first not void action is RSS.
4664 if (act->type != RTE_FLOW_ACTION_TYPE_RSS) {
4665 memset(rss_config, 0, sizeof(struct i40e_rte_flow_rss_conf));
4666 rte_flow_error_set(error, EINVAL,
4667 RTE_FLOW_ERROR_TYPE_ACTION,
4668 act, "Not supported action.");
4672 if (p_info.action_flag && rss->queue_num) {
4673 for (j = 0; j < RTE_DIM(pctype_match_table); j++) {
4674 if (rss->types & pctype_match_table[j].rss_type) {
4675 conf_info->region[0].hw_flowtype[0] =
4676 (uint8_t)pctype_match_table[j].pctype;
4677 conf_info->region[0].flowtype_num = 1;
4678 conf_info->queue_region_number = 1;
4685 * Do some queue region related parameters check
4686 * in order to keep queue index for queue region to be
4687 * continuous sequence and also to be part of RSS
4688 * queue index for this port.
4690 if (conf_info->queue_region_number) {
4691 for (i = 0; i < rss->queue_num; i++) {
4692 for (j = 0; j < rss_info->conf.queue_num; j++) {
4693 if (rss->queue[i] == rss_info->conf.queue[j])
4696 if (j == rss_info->conf.queue_num) {
4697 rte_flow_error_set(error, EINVAL,
4698 RTE_FLOW_ERROR_TYPE_ACTION,
4705 for (i = 0; i < rss->queue_num - 1; i++) {
4706 if (rss->queue[i + 1] != rss->queue[i] + 1) {
4707 rte_flow_error_set(error, EINVAL,
4708 RTE_FLOW_ERROR_TYPE_ACTION,
4716 /* Parse queue region related parameters from configuration */
4717 for (n = 0; n < conf_info->queue_region_number; n++) {
4718 if (conf_info->region[n].user_priority_num ||
4719 conf_info->region[n].flowtype_num) {
4720 if (!((rte_is_power_of_2(rss->queue_num)) &&
4721 rss->queue_num <= 64)) {
4722 rte_flow_error_set(error, EINVAL,
4723 RTE_FLOW_ERROR_TYPE_ACTION,
4725 "The region sizes should be any of the following values: 1, 2, 4, 8, 16, 32, 64 as long as the "
4726 "total number of queues do not exceed the VSI allocation");
4730 if (conf_info->region[n].user_priority[n] >=
4731 I40E_MAX_USER_PRIORITY) {
4732 rte_flow_error_set(error, EINVAL,
4733 RTE_FLOW_ERROR_TYPE_ACTION,
4735 "the user priority max index is 7");
4739 if (conf_info->region[n].hw_flowtype[n] >=
4740 I40E_FILTER_PCTYPE_MAX) {
4741 rte_flow_error_set(error, EINVAL,
4742 RTE_FLOW_ERROR_TYPE_ACTION,
4744 "the hw_flowtype or PCTYPE max index is 63");
4748 for (i = 0; i < info->queue_region_number; i++) {
4749 if (info->region[i].queue_num ==
4751 info->region[i].queue_start_index ==
4756 if (i == info->queue_region_number) {
4757 if (i > I40E_REGION_MAX_INDEX) {
4758 rte_flow_error_set(error, EINVAL,
4759 RTE_FLOW_ERROR_TYPE_ACTION,
4761 "the queue region max index is 7");
4765 info->region[i].queue_num =
4767 info->region[i].queue_start_index =
4769 info->region[i].region_id =
4770 info->queue_region_number;
4772 j = info->region[i].user_priority_num;
4773 tmp = conf_info->region[n].user_priority[0];
4774 if (conf_info->region[n].user_priority_num) {
4775 info->region[i].user_priority[j] = tmp;
4776 info->region[i].user_priority_num++;
4779 j = info->region[i].flowtype_num;
4780 tmp = conf_info->region[n].hw_flowtype[0];
4781 if (conf_info->region[n].flowtype_num) {
4782 info->region[i].hw_flowtype[j] = tmp;
4783 info->region[i].flowtype_num++;
4785 info->queue_region_number++;
4787 j = info->region[i].user_priority_num;
4788 tmp = conf_info->region[n].user_priority[0];
4789 if (conf_info->region[n].user_priority_num) {
4790 info->region[i].user_priority[j] = tmp;
4791 info->region[i].user_priority_num++;
4794 j = info->region[i].flowtype_num;
4795 tmp = conf_info->region[n].hw_flowtype[0];
4796 if (conf_info->region[n].flowtype_num) {
4797 info->region[i].hw_flowtype[j] = tmp;
4798 info->region[i].flowtype_num++;
4803 rss_config->queue_region_conf = TRUE;
4807 * Return function if this flow is used for queue region configuration
4809 if (rss_config->queue_region_conf)
4813 rte_flow_error_set(error, EINVAL,
4814 RTE_FLOW_ERROR_TYPE_ACTION,
4820 for (n = 0; n < rss->queue_num; n++) {
4821 if (rss->queue[n] >= dev->data->nb_rx_queues) {
4822 rte_flow_error_set(error, EINVAL,
4823 RTE_FLOW_ERROR_TYPE_ACTION,
4825 "queue id > max number of queues");
4830 if (rss->queue_num && (p_info.types || rss->types))
4831 return rte_flow_error_set
4832 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4833 "RSS types must be empty while configuring queue region");
4835 /* validate pattern and pctype */
4836 if (!(rss->types & p_info.types) &&
4837 (rss->types || p_info.types) && !rss->queue_num)
4838 return rte_flow_error_set
4839 (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION,
4840 act, "invalid pctype");
4843 for (n = 0; n < RTE_ETH_FLOW_MAX; n++) {
4844 if (rss->types & (hf_bit << n))
4847 return rte_flow_error_set
4848 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION,
4849 act, "multi pctype is not supported");
4852 if (rss->func == RTE_ETH_HASH_FUNCTION_SIMPLE_XOR &&
4853 (p_info.types || rss->types || rss->queue_num))
4854 return rte_flow_error_set
4855 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4856 "pattern, type and queues must be empty while"
4857 " setting hash function as simple_xor");
4859 if (rss->func == RTE_ETH_HASH_FUNCTION_SYMMETRIC_TOEPLITZ &&
4860 !(p_info.types && rss->types))
4861 return rte_flow_error_set
4862 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4863 "pctype and queues can not be empty while"
4864 " setting hash function as symmetric toeplitz");
4866 /* Parse RSS related parameters from configuration */
4867 if (rss->func >= RTE_ETH_HASH_FUNCTION_MAX ||
4868 rss->func == RTE_ETH_HASH_FUNCTION_TOEPLITZ)
4869 return rte_flow_error_set
4870 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4871 "RSS hash functions are not supported");
4873 return rte_flow_error_set
4874 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4875 "a nonzero RSS encapsulation level is not supported");
4876 if (rss->key_len && rss->key_len > RTE_DIM(rss_config->key))
4877 return rte_flow_error_set
4878 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4879 "RSS hash key too large");
4880 if (rss->queue_num > RTE_DIM(rss_config->queue))
4881 return rte_flow_error_set
4882 (error, ENOTSUP, RTE_FLOW_ERROR_TYPE_ACTION, act,
4883 "too many queues for RSS context");
4884 if (i40e_rss_conf_init(rss_config, rss))
4885 return rte_flow_error_set
4886 (error, EINVAL, RTE_FLOW_ERROR_TYPE_ACTION, act,
4887 "RSS context initialization failure");
4891 /* check if the next not void action is END */
4892 NEXT_ITEM_OF_ACTION(act, actions, index);
4893 if (act->type != RTE_FLOW_ACTION_TYPE_END) {
4894 memset(rss_config, 0, sizeof(struct i40e_rte_flow_rss_conf));
4895 rte_flow_error_set(error, EINVAL,
4896 RTE_FLOW_ERROR_TYPE_ACTION,
4897 act, "Not supported action.");
4900 rss_config->queue_region_conf = FALSE;
4906 i40e_parse_rss_filter(struct rte_eth_dev *dev,
4907 const struct rte_flow_attr *attr,
4908 const struct rte_flow_item pattern[],
4909 const struct rte_flow_action actions[],
4910 union i40e_filter_t *filter,
4911 struct rte_flow_error *error)
4913 struct i40e_rss_pattern_info p_info;
4914 struct i40e_queue_regions info;
4917 memset(&info, 0, sizeof(struct i40e_queue_regions));
4918 memset(&p_info, 0, sizeof(struct i40e_rss_pattern_info));
4920 ret = i40e_flow_parse_rss_pattern(dev, pattern,
4921 error, &p_info, &info);
4925 ret = i40e_flow_parse_rss_action(dev, actions, error,
4926 p_info, &info, filter);
4930 ret = i40e_flow_parse_attr(attr, error);
4934 cons_filter_type = RTE_ETH_FILTER_HASH;
4940 i40e_config_rss_filter_set(struct rte_eth_dev *dev,
4941 struct i40e_rte_flow_rss_conf *conf)
4943 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4944 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
4945 struct i40e_rss_filter *rss_filter;
4948 if (conf->queue_region_conf) {
4949 ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 1);
4951 ret = i40e_config_rss_filter(pf, conf, 1);
4957 rss_filter = rte_zmalloc("i40e_rss_filter",
4958 sizeof(*rss_filter), 0);
4959 if (rss_filter == NULL) {
4960 PMD_DRV_LOG(ERR, "Failed to alloc memory.");
4963 rss_filter->rss_filter_info = *conf;
4964 /* the rule new created is always valid
4965 * the existing rule covered by new rule will be set invalid
4967 rss_filter->rss_filter_info.valid = true;
4969 TAILQ_INSERT_TAIL(&pf->rss_config_list, rss_filter, next);
4975 i40e_config_rss_filter_del(struct rte_eth_dev *dev,
4976 struct i40e_rte_flow_rss_conf *conf)
4978 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
4979 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
4980 struct i40e_rss_filter *rss_filter;
4983 if (conf->queue_region_conf)
4984 i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
4986 i40e_config_rss_filter(pf, conf, 0);
4988 TAILQ_FOREACH_SAFE(rss_filter, &pf->rss_config_list, next, temp) {
4989 if (!memcmp(&rss_filter->rss_filter_info, conf,
4990 sizeof(struct rte_flow_action_rss))) {
4991 TAILQ_REMOVE(&pf->rss_config_list, rss_filter, next);
4992 rte_free(rss_filter);
4999 i40e_flow_validate(struct rte_eth_dev *dev,
5000 const struct rte_flow_attr *attr,
5001 const struct rte_flow_item pattern[],
5002 const struct rte_flow_action actions[],
5003 struct rte_flow_error *error)
5005 struct rte_flow_item *items; /* internal pattern w/o VOID items */
5006 parse_filter_t parse_filter;
5007 uint32_t item_num = 0; /* non-void item number of pattern*/
5010 int ret = I40E_NOT_SUPPORTED;
5013 rte_flow_error_set(error, EINVAL, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
5014 NULL, "NULL pattern.");
5019 rte_flow_error_set(error, EINVAL,
5020 RTE_FLOW_ERROR_TYPE_ACTION_NUM,
5021 NULL, "NULL action.");
5026 rte_flow_error_set(error, EINVAL,
5027 RTE_FLOW_ERROR_TYPE_ATTR,
5028 NULL, "NULL attribute.");
5032 memset(&cons_filter, 0, sizeof(cons_filter));
5034 /* Get the non-void item of action */
5035 while ((actions + i)->type == RTE_FLOW_ACTION_TYPE_VOID)
5038 if ((actions + i)->type == RTE_FLOW_ACTION_TYPE_RSS) {
5039 ret = i40e_parse_rss_filter(dev, attr, pattern,
5040 actions, &cons_filter, error);
5045 /* Get the non-void item number of pattern */
5046 while ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_END) {
5047 if ((pattern + i)->type != RTE_FLOW_ITEM_TYPE_VOID)
5053 items = rte_zmalloc("i40e_pattern",
5054 item_num * sizeof(struct rte_flow_item), 0);
5056 rte_flow_error_set(error, ENOMEM, RTE_FLOW_ERROR_TYPE_ITEM_NUM,
5057 NULL, "No memory for PMD internal items.");
5061 i40e_pattern_skip_void_item(items, pattern);
5065 parse_filter = i40e_find_parse_filter_func(items, &i);
5066 if (!parse_filter && !flag) {
5067 rte_flow_error_set(error, EINVAL,
5068 RTE_FLOW_ERROR_TYPE_ITEM,
5069 pattern, "Unsupported pattern");
5074 ret = parse_filter(dev, attr, items, actions,
5075 error, &cons_filter);
5077 } while ((ret < 0) && (i < RTE_DIM(i40e_supported_patterns)));
5084 static struct rte_flow *
5085 i40e_flow_create(struct rte_eth_dev *dev,
5086 const struct rte_flow_attr *attr,
5087 const struct rte_flow_item pattern[],
5088 const struct rte_flow_action actions[],
5089 struct rte_flow_error *error)
5091 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5092 struct rte_flow *flow;
5095 flow = rte_zmalloc("i40e_flow", sizeof(struct rte_flow), 0);
5097 rte_flow_error_set(error, ENOMEM,
5098 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5099 "Failed to allocate memory");
5103 ret = i40e_flow_validate(dev, attr, pattern, actions, error);
5107 switch (cons_filter_type) {
5108 case RTE_ETH_FILTER_ETHERTYPE:
5109 ret = i40e_ethertype_filter_set(pf,
5110 &cons_filter.ethertype_filter, 1);
5113 flow->rule = TAILQ_LAST(&pf->ethertype.ethertype_list,
5114 i40e_ethertype_filter_list);
5116 case RTE_ETH_FILTER_FDIR:
5117 ret = i40e_flow_add_del_fdir_filter(dev,
5118 &cons_filter.fdir_filter, 1);
5121 flow->rule = TAILQ_LAST(&pf->fdir.fdir_list,
5122 i40e_fdir_filter_list);
5124 case RTE_ETH_FILTER_TUNNEL:
5125 ret = i40e_dev_consistent_tunnel_filter_set(pf,
5126 &cons_filter.consistent_tunnel_filter, 1);
5129 flow->rule = TAILQ_LAST(&pf->tunnel.tunnel_list,
5130 i40e_tunnel_filter_list);
5132 case RTE_ETH_FILTER_HASH:
5133 ret = i40e_config_rss_filter_set(dev,
5134 &cons_filter.rss_conf);
5137 flow->rule = TAILQ_LAST(&pf->rss_config_list,
5138 i40e_rss_conf_list);
5144 flow->filter_type = cons_filter_type;
5145 TAILQ_INSERT_TAIL(&pf->flow_list, flow, node);
5149 rte_flow_error_set(error, -ret,
5150 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5151 "Failed to create flow.");
5157 i40e_flow_destroy(struct rte_eth_dev *dev,
5158 struct rte_flow *flow,
5159 struct rte_flow_error *error)
5161 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5162 enum rte_filter_type filter_type = flow->filter_type;
5165 switch (filter_type) {
5166 case RTE_ETH_FILTER_ETHERTYPE:
5167 ret = i40e_flow_destroy_ethertype_filter(pf,
5168 (struct i40e_ethertype_filter *)flow->rule);
5170 case RTE_ETH_FILTER_TUNNEL:
5171 ret = i40e_flow_destroy_tunnel_filter(pf,
5172 (struct i40e_tunnel_filter *)flow->rule);
5174 case RTE_ETH_FILTER_FDIR:
5175 ret = i40e_flow_add_del_fdir_filter(dev,
5176 &((struct i40e_fdir_filter *)flow->rule)->fdir, 0);
5178 /* If the last flow is destroyed, disable fdir. */
5179 if (!ret && TAILQ_EMPTY(&pf->fdir.fdir_list)) {
5180 i40e_fdir_rx_proc_enable(dev, 0);
5183 case RTE_ETH_FILTER_HASH:
5184 ret = i40e_config_rss_filter_del(dev,
5185 &((struct i40e_rss_filter *)flow->rule)->rss_filter_info);
5188 PMD_DRV_LOG(WARNING, "Filter type (%d) not supported",
5195 TAILQ_REMOVE(&pf->flow_list, flow, node);
5198 rte_flow_error_set(error, -ret,
5199 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5200 "Failed to destroy flow.");
5206 i40e_flow_destroy_ethertype_filter(struct i40e_pf *pf,
5207 struct i40e_ethertype_filter *filter)
5209 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
5210 struct i40e_ethertype_rule *ethertype_rule = &pf->ethertype;
5211 struct i40e_ethertype_filter *node;
5212 struct i40e_control_filter_stats stats;
5216 if (!(filter->flags & RTE_ETHTYPE_FLAGS_MAC))
5217 flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_IGNORE_MAC;
5218 if (filter->flags & RTE_ETHTYPE_FLAGS_DROP)
5219 flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_DROP;
5220 flags |= I40E_AQC_ADD_CONTROL_PACKET_FLAGS_TO_QUEUE;
5222 memset(&stats, 0, sizeof(stats));
5223 ret = i40e_aq_add_rem_control_packet_filter(hw,
5224 filter->input.mac_addr.addr_bytes,
5225 filter->input.ether_type,
5226 flags, pf->main_vsi->seid,
5227 filter->queue, 0, &stats, NULL);
5231 node = i40e_sw_ethertype_filter_lookup(ethertype_rule, &filter->input);
5235 ret = i40e_sw_ethertype_filter_del(pf, &node->input);
5241 i40e_flow_destroy_tunnel_filter(struct i40e_pf *pf,
5242 struct i40e_tunnel_filter *filter)
5244 struct i40e_hw *hw = I40E_PF_TO_HW(pf);
5245 struct i40e_vsi *vsi;
5246 struct i40e_pf_vf *vf;
5247 struct i40e_aqc_cloud_filters_element_bb cld_filter;
5248 struct i40e_tunnel_rule *tunnel_rule = &pf->tunnel;
5249 struct i40e_tunnel_filter *node;
5250 bool big_buffer = 0;
5253 memset(&cld_filter, 0, sizeof(cld_filter));
5254 rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.outer_mac,
5255 (struct rte_ether_addr *)&cld_filter.element.outer_mac);
5256 rte_ether_addr_copy((struct rte_ether_addr *)&filter->input.inner_mac,
5257 (struct rte_ether_addr *)&cld_filter.element.inner_mac);
5258 cld_filter.element.inner_vlan = filter->input.inner_vlan;
5259 cld_filter.element.flags = filter->input.flags;
5260 cld_filter.element.tenant_id = filter->input.tenant_id;
5261 cld_filter.element.queue_number = filter->queue;
5262 rte_memcpy(cld_filter.general_fields,
5263 filter->input.general_fields,
5264 sizeof(cld_filter.general_fields));
5266 if (!filter->is_to_vf)
5269 vf = &pf->vfs[filter->vf_id];
5273 if (((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X11) ==
5274 I40E_AQC_ADD_CLOUD_FILTER_0X11) ||
5275 ((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X12) ==
5276 I40E_AQC_ADD_CLOUD_FILTER_0X12) ||
5277 ((filter->input.flags & I40E_AQC_ADD_CLOUD_FILTER_0X10) ==
5278 I40E_AQC_ADD_CLOUD_FILTER_0X10))
5282 ret = i40e_aq_rem_cloud_filters_bb(hw, vsi->seid,
5285 ret = i40e_aq_rem_cloud_filters(hw, vsi->seid,
5286 &cld_filter.element, 1);
5290 node = i40e_sw_tunnel_filter_lookup(tunnel_rule, &filter->input);
5294 ret = i40e_sw_tunnel_filter_del(pf, &node->input);
5300 i40e_flow_flush(struct rte_eth_dev *dev, struct rte_flow_error *error)
5302 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5305 ret = i40e_flow_flush_fdir_filter(pf);
5307 rte_flow_error_set(error, -ret,
5308 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5309 "Failed to flush FDIR flows.");
5313 ret = i40e_flow_flush_ethertype_filter(pf);
5315 rte_flow_error_set(error, -ret,
5316 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5317 "Failed to ethertype flush flows.");
5321 ret = i40e_flow_flush_tunnel_filter(pf);
5323 rte_flow_error_set(error, -ret,
5324 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5325 "Failed to flush tunnel flows.");
5329 ret = i40e_flow_flush_rss_filter(dev);
5331 rte_flow_error_set(error, -ret,
5332 RTE_FLOW_ERROR_TYPE_HANDLE, NULL,
5333 "Failed to flush RSS flows.");
5341 i40e_flow_flush_fdir_filter(struct i40e_pf *pf)
5343 struct rte_eth_dev *dev = pf->adapter->eth_dev;
5344 struct i40e_fdir_info *fdir_info = &pf->fdir;
5345 struct i40e_fdir_filter *fdir_filter;
5346 enum i40e_filter_pctype pctype;
5347 struct rte_flow *flow;
5351 ret = i40e_fdir_flush(dev);
5353 /* Delete FDIR filters in FDIR list. */
5354 while ((fdir_filter = TAILQ_FIRST(&fdir_info->fdir_list))) {
5355 ret = i40e_sw_fdir_filter_del(pf,
5356 &fdir_filter->fdir.input);
5361 /* Delete FDIR flows in flow list. */
5362 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5363 if (flow->filter_type == RTE_ETH_FILTER_FDIR) {
5364 TAILQ_REMOVE(&pf->flow_list, flow, node);
5369 for (pctype = I40E_FILTER_PCTYPE_NONF_IPV4_UDP;
5370 pctype <= I40E_FILTER_PCTYPE_L2_PAYLOAD; pctype++)
5371 pf->fdir.inset_flag[pctype] = 0;
5373 /* Disable FDIR processing as all FDIR rules are now flushed */
5374 i40e_fdir_rx_proc_enable(dev, 0);
5380 /* Flush all ethertype filters */
5382 i40e_flow_flush_ethertype_filter(struct i40e_pf *pf)
5384 struct i40e_ethertype_filter_list
5385 *ethertype_list = &pf->ethertype.ethertype_list;
5386 struct i40e_ethertype_filter *filter;
5387 struct rte_flow *flow;
5391 while ((filter = TAILQ_FIRST(ethertype_list))) {
5392 ret = i40e_flow_destroy_ethertype_filter(pf, filter);
5397 /* Delete ethertype flows in flow list. */
5398 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5399 if (flow->filter_type == RTE_ETH_FILTER_ETHERTYPE) {
5400 TAILQ_REMOVE(&pf->flow_list, flow, node);
5408 /* Flush all tunnel filters */
5410 i40e_flow_flush_tunnel_filter(struct i40e_pf *pf)
5412 struct i40e_tunnel_filter_list
5413 *tunnel_list = &pf->tunnel.tunnel_list;
5414 struct i40e_tunnel_filter *filter;
5415 struct rte_flow *flow;
5419 while ((filter = TAILQ_FIRST(tunnel_list))) {
5420 ret = i40e_flow_destroy_tunnel_filter(pf, filter);
5425 /* Delete tunnel flows in flow list. */
5426 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5427 if (flow->filter_type == RTE_ETH_FILTER_TUNNEL) {
5428 TAILQ_REMOVE(&pf->flow_list, flow, node);
5436 /* remove the RSS filter */
5438 i40e_flow_flush_rss_filter(struct rte_eth_dev *dev)
5440 struct i40e_pf *pf = I40E_DEV_PRIVATE_TO_PF(dev->data->dev_private);
5441 struct i40e_hw *hw = I40E_DEV_PRIVATE_TO_HW(dev->data->dev_private);
5442 struct rte_flow *flow;
5444 int32_t ret = -EINVAL;
5446 ret = i40e_flush_queue_region_all_conf(dev, hw, pf, 0);
5448 /* Delete RSS flows in flow list. */
5449 TAILQ_FOREACH_SAFE(flow, &pf->flow_list, node, temp) {
5450 if (flow->filter_type != RTE_ETH_FILTER_HASH)
5454 ret = i40e_config_rss_filter_del(dev,
5455 &((struct i40e_rss_filter *)flow->rule)->rss_filter_info);
5459 TAILQ_REMOVE(&pf->flow_list, flow, node);